(function () { /** * Create a cached version of a pure function. * @param {*} fn The function call to be cached * @void */ 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 * @param {Object} to The object to be merged with * @returns {Object} The merged object */ 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 * @param {*} value Checks if a value is primitive * @returns {Boolean} Result of the check */ function isPrimitive(value) { return typeof value === 'string' || typeof value === 'number'; } /** * Performs no operation. * @void */ function noop() {} /** * Check if value is function * @param {*} obj Any javascript object * @returns {Boolean} True if the passed-in value is a function */ function isFn(obj) { return typeof obj === 'function'; } /** * Check if url is external * @param {String} string url * @returns {Boolean} True if the passed-in url is external */ function isExternal(url) { var match = url.match( /^([^:/?#]+:)?(?:\/{2,}([^/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/ ); if ( typeof match[1] === 'string' && match[1].length > 0 && match[1].toLowerCase() !== location.protocol ) { return true; } if ( typeof match[2] === 'string' && match[2].length > 0 && match[2].replace( new RegExp( ':(' + { 'http:': 80, 'https:': 443 }[location.protocol] + ')?$' ), '' ) !== location.host ) { return true; } return false; } var inBrowser = !false; var isMobile = document.body.clientWidth <= 600; /** * @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js */ var supportsPushState = (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 A DOM element * @param {Boolean} noCache Flag to use or not use the cache * @return {Element} The found node 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 $ = document; var body = $.body; var head = $.head; /** * Find elements * @param {String|Element} el The root element where to perform the search from * @param {Element} node The query * @returns {Element} The found DOM element * @example * find('nav') => document.querySelector('nav') * find(nav, 'a') => nav.querySelector('a') */ function find(el, node) { return node ? el.querySelector(node) : $.querySelector(el); } /** * Find all elements * @param {String|Element} el The root element where to perform the search from * @param {Element} node The query * @returns {Array} An array of DOM 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) { return target.insertBefore(el, target.children[0]); } function on(el, type, handler) { 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 * @param {String|Element} el The element that needs the class to be toggled * @param {Element} type The type of action to be performed on the classList (toggle by default) * @param {String} val Name of the class to be toggled * @void * @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)); } /** * Fork https://github.com/bendrucker/document-ready/blob/master/index.js * @param {Function} callback The callbacack to be called when the page is loaded * @returns {Number|void} If the page is already laoded returns the result of the setTimeout callback, * otherwise it only attaches the callback to the DOMContentLoaded event */ function documentReady(callback, doc) { if ( doc === void 0 ) doc = document; var state = doc.readyState; if (state === 'complete' || state === 'interactive') { return setTimeout(callback, 0); } doc.addEventListener('DOMContentLoaded', callback); } var dom = /*#__PURE__*/Object.freeze({ __proto__: null, getNode: getNode, $: $, body: body, head: head, find: find, findAll: findAll, create: create, appendTo: appendTo, before: before, on: on, off: off, toggleClass: toggleClass, style: style, documentReady: documentReady }); 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]); }); 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 removeParams = cached(function (path) { return path.split(/[?#]/)[0]; }); var getParentPath = cached(function (path) { if (/\/$/g.test(path)) { return path; } var matchingParts = path.match(/(\S*\/)[^/]+$/); return matchingParts ? matchingParts[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('/'); }); /** * Normalises the URI path to handle the case where Docsify is * hosted off explicit files, i.e. /index.html. This function * eliminates any path segments that contain `#` fragments. * * This is used to map browser URIs to markdown file sources. * * For example: * * http://example.org/base/index.html#/blah * * would be mapped to: * * http://example.org/base/blah.md. * * See here for more information: * * https://github.com/docsifyjs/docsify/pull/1372 * * @param {string} path The URI path to normalise * @return {string} { path, query } */ function normaliseFragment(path) { return path .split('/') .filter(function (p) { return p.indexOf('#') === -1; }) .join('/'); } function getPath() { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; return cleanPath(args.map(normaliseFragment).join('/')); } var replaceSlug = cached(function (path) { return path.replace('#', '?id='); }); function endsWith(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } var cached$1 = {}; function getAlias(path, alias, last) { var match = Object.keys(alias).filter(function (key) { var re = cached$1[key] || (cached$1[key] = new RegExp(("^" + key + "$"))); return re.test(path) && path !== last; })[0]; return match ? getAlias(path.replace(cached$1[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 = /*@__PURE__*/(function (History) { function HashHistory(config) { History.call(this, config); this.mode = 'hash'; } if ( History ) HashHistory.__proto__ = History; HashHistory.prototype = Object.create( History && History.prototype ); HashHistory.prototype.constructor = HashHistory; HashHistory.prototype.getBasePath = function getBasePath () { var path = window.location.pathname || ''; var base = this.config.basePath; // This handles the case where Docsify is served off an // explicit file path, i.e.`/base/index.html#/blah`. This // prevents the `/index.html` part of the URI from being // remove during routing. // See here: https://github.com/docsifyjs/docsify/pull/1372 var basePath = endsWith(path, '.html') ? path + '#/' + base : path + '/' + base; return /^(\/|https?:)/g.test(base) ? base : cleanPath(basePath); }; 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); }; /** @param {((params: {source: TODO}) => void)} [cb] */ HashHistory.prototype.onchange = function onchange (cb) { if ( cb === void 0 ) cb = noop; // The hashchange event does not tell us if it originated from // a clicked link or by moving back/forward in the history; // therefore we set a `navigating` flag when a link is clicked // to be able to tell these two scenarios apart var navigating = false; on('click', function (e) { var el = e.target.tagName === 'A' ? e.target : e.target.parentNode; if (el && el.tagName === 'A' && !/_blank/.test(el.target)) { navigating = true; } }); on('hashchange', function (e) { var source = navigating ? 'navigate' : 'history'; navigating = false; cb({ event: e, source: source }); }); }; 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] URL to be parsed * @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.prototype.toURL.call(this, path, params, currentRoute); }; return HashHistory; }(History)); /** @typedef {any} TODO */ var HTML5History = /*@__PURE__*/(function (History) { function HTML5History(config) { History.call(this, config); this.mode = 'history'; } if ( History ) HTML5History.__proto__ = History; HTML5History.prototype = Object.create( History && History.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) { var this$1 = this; if ( cb === void 0 ) cb = noop; on('click', function (e) { var el = e.target.tagName === 'A' ? e.target : e.target.parentNode; if (el && el.tagName === 'A' && !/_blank/.test(el.target)) { e.preventDefault(); var url = el.href; // solve history.pushState cross-origin issue if (this$1.config.crossOriginLinks.indexOf(url) !== -1) { window.open(url, '_self'); } else { window.history.pushState({ key: url }, '', url); } cb({ event: e, source: 'navigate' }); } }); on('popstate', function (e) { cb({ event: e, source: 'history' }); }); }; /** * Parse the url * @param {string} [path=location.href] URL to be parsed * @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)); /** * @typedef {{ * path?: string * }} Route */ /** @type {Route} */ var lastRoute = {}; /** @typedef {import('../Docsify').Constructor} Constructor */ /** * @template {!Constructor} T * @param {T} Base - The class to extend */ function Router(Base) { return /*@__PURE__*/(function (Base) { function Router() { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; Base.apply(this, args); this.route = {}; } if ( Base ) Router.__proto__ = Base; Router.prototype = Object.create( Base && Base.prototype ); Router.prototype.constructor = Router; Router.prototype.updateRender = function updateRender () { this.router.normalize(); this.route = this.router.parse(); body.setAttribute('data-page', this.route.file); }; Router.prototype.initRouter = function initRouter () { var this$1 = this; var config = this.config; var mode = config.routerMode || 'hash'; var router; if (mode === 'history' && supportsPushState) { router = new HTML5History(config); } else { router = new HashHistory(config); } this.router = router; this.updateRender(); lastRoute = this.route; // eslint-disable-next-line no-unused-vars router.onchange(function (params) { this$1.updateRender(); this$1._updateRender(); if (lastRoute.path === this$1.route.path) { this$1.$resetEvents(params.source); return; } this$1.$fetch(noop, this$1.$resetEvents.bind(this$1, params.source)); lastRoute = this$1.route; }); }; return Router; }(Base)); } var RGX = /([^{]*?)\w(?=\})/g; var MAP = { YYYY: 'getFullYear', YY: 'getYear', MM: function (d) { return d.getMonth() + 1; }, DD: 'getDate', HH: 'getHours', mm: 'getMinutes', ss: 'getSeconds', fff: 'getMilliseconds' }; function tinydate (str, custom) { 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(custom && custom[key] || function (d) { return ('00' + (typeof MAP[key] === 'string' ? d[MAP[key]]() : MAP[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 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments$1[_key]; } return apply(func, thisArg, args); }; } function unconstruct(func) { return function () { var arguments$1 = arguments; for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments$1[_key2]; } return construct(func, args); }; } /* Add properties to a lookup table */ function addToSet(set, array) { if (setPrototypeOf) { // Make 'in' and truthy checks like Boolean(set.constructor) // independent of any properties defined on Object.prototype. // Prevent prototype setters from intercepting set as a this value. setPrototypeOf(set, null); } var l = array.length; while (l--) { var element = array[l]; if (typeof element === 'string') { var lcElement = stringToLowerCase(element); if (lcElement !== element) { // Config presets (e.g. tags.js, attrs.js) are immutable. if (!isFrozen(array)) { array[l] = lcElement; } element = lcElement; } } set[element] = true; } return set; } /* Shallow clone an object */ function clone(object) { var newObject = create$1(null); var property = void 0; for (property in object) { if (apply(hasOwnProperty, object, [property])) { newObject[property] = object[property]; } } return newObject; } /* IE10 doesn't support __lookupGetter__ so lets' * simulate it. It also automatically checks * if the prop is function or getter and behaves * accordingly. */ function lookupGetter(object, prop) { while (object !== null) { var desc = getOwnPropertyDescriptor(object, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === 'function') { return unapply(desc.value); } } object = getPrototypeOf(object); } function fallbackValue(element) { console.warn('fallback value for', element); return null; } return fallbackValue; } var html = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG var svg = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default. // We still need to know them so that we can do namespace // checks properly in case one wants to add them to // allow-list. var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'feimage', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']); var mathMl = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements, // even those that we disallow by default. var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); var text = freeze(['#text']); var html$1 = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']); var svg$1 = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); var mathMl$1 = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); // eslint-disable-next-line unicorn/better-regex var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm); var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape ); var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex ); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; function _toConsumableArray$1(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } var getGlobal = function getGlobal() { return typeof window === 'undefined' ? null : window; }; /** * Creates a no-op policy for internal use only. * Don't export this function outside this module! * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. * @param {Document} document The document object (to determine policy name suffix) * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types * are not supported). */ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) { if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') { return null; } // Allow the callers to control the unique policy name // by adding a data-tt-policy-suffix to the script element with the DOMPurify. // Policy creation with duplicate names throws in Trusted Types. var suffix = null; var ATTR_NAME = 'data-tt-policy-suffix'; if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) { suffix = document.currentScript.getAttribute(ATTR_NAME); } var policyName = 'dompurify' + (suffix ? '#' + suffix : ''); try { return trustedTypes.createPolicy(policyName, { createHTML: function createHTML(html$$1) { return html$$1; } }); } catch (_) { // Policy creation failed (most likely another DOMPurify script has // already run). Skip creating the policy, as this will only cause errors // if TT are enforced. console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); return null; } }; function createDOMPurify() { var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); var DOMPurify = function DOMPurify(root) { return createDOMPurify(root); }; /** * Version label, exposed for easier checks * if DOMPurify is up to date or not */ DOMPurify.version = '2.3.1'; /** * Array of elements that DOMPurify removed during sanitation. * Empty if nothing was removed. */ DOMPurify.removed = []; if (!window || !window.document || window.document.nodeType !== 9) { // Not running in a browser, provide a factory function // so that you can pass your own Window DOMPurify.isSupported = false; return DOMPurify; } var originalDocument = window.document; var document = window.document; var DocumentFragment = window.DocumentFragment, HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter, _window$NamedNodeMap = window.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, Text = window.Text, Comment = window.Comment, DOMParser = window.DOMParser, trustedTypes = window.trustedTypes; var ElementPrototype = Element.prototype; var cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); var getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a // new document created via createHTMLDocument. As per the spec // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) // a new empty registry is used when creating a template contents owner // document, so we use that as our parent document to ensure nothing // is inherited. if (typeof HTMLTemplateElement === 'function') { var template = document.createElement('template'); if (template.content && template.content.ownerDocument) { document = template.content.ownerDocument; } } var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); var emptyHTML = trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML('') : ''; var _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName; var importNode = originalDocument.importNode; var documentMode = {}; try { documentMode = clone(document).documentMode ? document.documentMode : {}; } catch (_) {} var hooks = {}; /** * Expose whether this browser supports running the full DOMPurify. */ DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9; var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR, ERB_EXPR$$1 = ERB_EXPR, DATA_ATTR$$1 = DATA_ATTR, ARIA_ATTR$$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$$1 = ATTR_WHITESPACE; var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI; /** * We consider the elements and attributes below to be safe. Ideally * don't add any new ones but feel free to remove unwanted ones. */ /* allowed element names */ var ALLOWED_TAGS = null; var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(html), _toConsumableArray$1(svg), _toConsumableArray$1(svgFilters), _toConsumableArray$1(mathMl), _toConsumableArray$1(text))); /* Allowed attribute names */ var ALLOWED_ATTR = null; var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray$1(html$1), _toConsumableArray$1(svg$1), _toConsumableArray$1(mathMl$1), _toConsumableArray$1(xml))); /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ var FORBID_TAGS = null; /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ var FORBID_ATTR = null; /* Decide if ARIA attributes are okay */ var ALLOW_ARIA_ATTR = true; /* Decide if custom data attributes are okay */ var ALLOW_DATA_ATTR = true; /* Decide if unknown protocols are okay */ var ALLOW_UNKNOWN_PROTOCOLS = false; /* Output should be safe for common template engines. * This means, DOMPurify removes data attributes, mustaches and ERB */ var SAFE_FOR_TEMPLATES = false; /* Decide if document with ... should be returned */ var WHOLE_DOCUMENT = false; /* Track whether config is already set on this instance of DOMPurify. */ var SET_CONFIG = false; /* Decide if all elements (e.g. style, script) must be children of * document.body. By default, browsers might move them to document.head */ var FORCE_BODY = false; /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported). * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead */ var RETURN_DOM = false; /* Decide if a DOM `DocumentFragment` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported) */ var RETURN_DOM_FRAGMENT = false; /* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM * `Node` is imported into the current `Document`. If this flag is not enabled the * `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by * DOMPurify. * * This defaults to `true` starting DOMPurify 2.2.0. Note that setting it to `false` * might cause XSS from attacks hidden in closed shadowroots in case the browser * supports Declarative Shadow: DOM https://web.dev/declarative-shadow-dom/ */ var RETURN_DOM_IMPORT = true; /* Try to return a Trusted Type object instead of a string, return a string in * case Trusted Types are not supported */ var RETURN_TRUSTED_TYPE = false; /* Output should be free from DOM clobbering attacks? */ var SANITIZE_DOM = true; /* Keep element content when removing element? */ var KEEP_CONTENT = true; /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead * of importing it into a new Document and returning a sanitized copy */ var IN_PLACE = false; /* Allow usage of profiles like html, svg and mathMl */ var USE_PROFILES = {}; /* Tags to ignore content of when KEEP_CONTENT is true */ var FORBID_CONTENTS = null; var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); /* Tags that are safe for data: URIs */ var DATA_URI_TAGS = null; var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); /* Attributes safe for values like "javascript:" */ var URI_SAFE_ATTRIBUTES = null; var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; /* Document namespace */ var NAMESPACE = HTML_NAMESPACE; var IS_EMPTY_INPUT = false; /* Keep a reference to config to pass to hooks */ var CONFIG = null; /* Ideally, do not touch anything below this line */ /* ______________________________________________ */ var formElement = document.createElement('form'); /** * _parseConfig * * @param {Object} cfg optional config literal */ // eslint-disable-next-line complexity var _parseConfig = function _parseConfig(cfg) { if (CONFIG && CONFIG === cfg) { return; } /* Shield configuration object from tampering */ if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') { cfg = {}; } /* Shield configuration object from prototype pollution */ cfg = clone(cfg); /* Set configuration parameters */ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR; URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {}; FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {}; USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false RETURN_DOM = cfg.RETURN_DOM || false; // Default false RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT !== false; // Default true RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false FORCE_BODY = cfg.FORCE_BODY || false; // Default false SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true IN_PLACE = cfg.IN_PLACE || false; // Default false IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } /* Parse profile info */ if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(text))); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html); addToSet(ALLOWED_ATTR, html$1); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg); addToSet(ALLOWED_ATTR, svg$1); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg$1); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl); addToSet(ALLOWED_ATTR, mathMl$1); addToSet(ALLOWED_ATTR, xml); } } /* Merge configuration parameters */ if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS); } /* Add #text in case KEEP_CONTENT is set to true */ if (KEEP_CONTENT) { ALLOWED_TAGS['#text'] = true; } /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); } /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ['tbody']); delete FORBID_TAGS.tbody; } // Prevent further manipulation of configuration. // Not available in IE8, Safari 5, etc. if (freeze) { freeze(cfg); } CONFIG = cfg; }; var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); /* Keep track of all possible SVG and MathML tags * so that we can perform the namespace checks * correctly. */ var ALL_SVG_TAGS = addToSet({}, svg); addToSet(ALL_SVG_TAGS, svgFilters); addToSet(ALL_SVG_TAGS, svgDisallowed); var ALL_MATHML_TAGS = addToSet({}, mathMl); addToSet(ALL_MATHML_TAGS, mathMlDisallowed); /** * * * @param {Element} element a DOM element whose namespace is being checked * @returns {boolean} Return false if the element has a * namespace that a spec-compliant parser would never * return. Return true otherwise. */ var _checkValidNamespace = function _checkValidNamespace(element) { var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode // can be null. We just simulate parent in this case. if (!parent || !parent.tagName) { parent = { namespaceURI: HTML_NAMESPACE, tagName: 'template' }; } var tagName = stringToLowerCase(element.tagName); var parentTagName = stringToLowerCase(parent.tagName); if (element.namespaceURI === SVG_NAMESPACE) { // The only way to switch from HTML namespace to SVG // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'svg'; } // The only way to switch from MathML to SVG is via // svg if parent is either or MathML // text integration points. if (parent.namespaceURI === MATHML_NAMESPACE) { return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); } // We only allow elements that are defined in SVG // spec. All others are disallowed in SVG namespace. return Boolean(ALL_SVG_TAGS[tagName]); } if (element.namespaceURI === MATHML_NAMESPACE) { // The only way to switch from HTML namespace to MathML // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'math'; } // The only way to switch from SVG to MathML is via // and HTML integration points if (parent.namespaceURI === SVG_NAMESPACE) { return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; } // We only allow elements that are defined in MathML // spec. All others are disallowed in MathML namespace. return Boolean(ALL_MATHML_TAGS[tagName]); } if (element.namespaceURI === HTML_NAMESPACE) { // The only way to switch from SVG to HTML is via // HTML integration points, and from MathML to HTML // is via MathML text integration points if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { return false; } if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { return false; } // Certain elements are allowed in both SVG and HTML // namespace. We need to specify them explicitly // so that they don't get erronously deleted from // HTML namespace. var commonSvgAndHTMLElements = addToSet({}, ['title', 'style', 'font', 'a', 'script']); // We disallow tags that are specific for MathML // or SVG and should never appear in HTML namespace return !ALL_MATHML_TAGS[tagName] && (commonSvgAndHTMLElements[tagName] || !ALL_SVG_TAGS[tagName]); } // The code should never reach this place (this means // that the element somehow got namespace that is not // HTML, SVG or MathML). Return false just in case. return false; }; /** * _forceRemove * * @param {Node} node a DOM node */ var _forceRemove = function _forceRemove(node) { arrayPush(DOMPurify.removed, { element: node }); try { // eslint-disable-next-line unicorn/prefer-dom-node-remove node.parentNode.removeChild(node); } catch (_) { try { node.outerHTML = emptyHTML; } catch (_) { node.remove(); } } }; /** * _removeAttribute * * @param {String} name an Attribute name * @param {Node} node a DOM node */ var _removeAttribute = function _removeAttribute(name, node) { try { arrayPush(DOMPurify.removed, { attribute: node.getAttributeNode(name), from: node }); } catch (_) { arrayPush(DOMPurify.removed, { attribute: null, from: node }); } node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes if (name === 'is' && !ALLOWED_ATTR[name]) { if (RETURN_DOM || RETURN_DOM_FRAGMENT) { try { _forceRemove(node); } catch (_) {} } else { try { node.setAttribute(name, ''); } catch (_) {} } } }; /** * _initDocument * * @param {String} dirty a string of dirty markup * @return {Document} a DOM, filled with the dirty markup */ var _initDocument = function _initDocument(dirty) { /* Create a HTML document */ var doc = void 0; var leadingWhitespace = void 0; if (FORCE_BODY) { dirty = '' + dirty; } else { /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ var matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; /* * Use the DOMParser API by default, fallback later if needs be * DOMParser not work for svg when has multiple root element. */ if (NAMESPACE === HTML_NAMESPACE) { try { doc = new DOMParser().parseFromString(dirtyPayload, 'text/html'); } catch (_) {} } /* Use createHTMLDocument in case DOMParser is not available */ if (!doc || !doc.documentElement) { doc = implementation.createDocument(NAMESPACE, 'template', null); try { doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload; } catch (_) { // Syntax error if dirtyPayload is invalid xml } } var body = doc.body || doc.documentElement; if (dirty && leadingWhitespace) { body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); } /* Work on whole document or just its body */ if (NAMESPACE === HTML_NAMESPACE) { return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; } return WHOLE_DOCUMENT ? doc.documentElement : body; }; /** * _createIterator * * @param {Document} root document/fragment to create iterator for * @return {Iterator} iterator instance */ var _createIterator = function _createIterator(root) { return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false); }; /** * _isClobbered * * @param {Node} elm element to check for clobbering attacks * @return {Boolean} true if clobbered, false if safe */ var _isClobbered = function _isClobbered(elm) { if (elm instanceof Text || elm instanceof Comment) { return false; } if (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function') { return true; } return false; }; /** * _isNode * * @param {Node} obj object to check whether it's a DOM node * @return {Boolean} true is object is a DOM node */ var _isNode = function _isNode(object) { return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? object instanceof Node : object && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'; }; /** * _executeHook * Execute user configurable hooks * * @param {String} entryPoint Name of the hook's entry point * @param {Node} currentNode node to work on with the hook * @param {Object} data additional hook parameters */ var _executeHook = function _executeHook(entryPoint, currentNode, data) { if (!hooks[entryPoint]) { return; } arrayForEach(hooks[entryPoint], function (hook) { hook.call(DOMPurify, currentNode, data, CONFIG); }); }; /** * _sanitizeElements * * @protect nodeName * @protect textContent * @protect removeChild * * @param {Node} currentNode to check for permission to exist * @return {Boolean} true if node was killed, false if left alive */ var _sanitizeElements = function _sanitizeElements(currentNode) { var content = void 0; /* Execute a hook if present */ _executeHook('beforeSanitizeElements', currentNode, null); /* Check if element is clobbered or can clobber */ if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } /* Check if tagname contains Unicode */ if (stringMatch(currentNode.nodeName, /[\u0080-\uFFFF]/)) { _forceRemove(currentNode); return true; } /* Now let's check the element's type and name */ var tagName = stringToLowerCase(currentNode.nodeName); /* Execute a hook if present */ _executeHook('uponSanitizeElement', currentNode, { tagName: tagName, allowedTags: ALLOWED_TAGS }); /* Detect mXSS attempts abusing namespace confusion */ if (!_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { _forceRemove(currentNode); return true; } /* Mitigate a problem with templates inside select */ if (tagName === 'select' && regExpTest(/
'
          + (escaped ? code$1 : escape$2(code$1, true))
          + '
\n'; } return '
'
        + (escaped ? code$1 : escape$2(code$1, true))
        + '
\n'; }; Renderer.prototype.blockquote = function blockquote (quote) { return '
\n' + quote + '
\n'; }; Renderer.prototype.html = function html (html$1) { return html$1; }; Renderer.prototype.heading = function heading (text, level, raw, slugger) { if (this.options.headerIds) { return '' + text + '\n'; } // ignore IDs return '' + text + '\n'; }; Renderer.prototype.hr = function hr () { return this.options.xhtml ? '
\n' : '
\n'; }; Renderer.prototype.list = function list (body, ordered, start) { var type = ordered ? 'ol' : 'ul', startatt = (ordered && start !== 1) ? (' start="' + start + '"') : ''; return '<' + type + startatt + '>\n' + body + '\n'; }; Renderer.prototype.listitem = function listitem (text) { return '
  • ' + text + '
  • \n'; }; Renderer.prototype.checkbox = function checkbox (checked) { return ' '; }; Renderer.prototype.paragraph = function paragraph (text) { return '

    ' + text + '

    \n'; }; Renderer.prototype.table = function table (header, body) { if (body) { body = '' + body + ''; } return '\n' + '\n' + header + '\n' + body + '
    \n'; }; Renderer.prototype.tablerow = function tablerow (content) { return '\n' + content + '\n'; }; Renderer.prototype.tablecell = function tablecell (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 strong (text) { return '' + text + ''; }; Renderer.prototype.em = function em (text) { return '' + text + ''; }; Renderer.prototype.codespan = function codespan (text) { return '' + text + ''; }; Renderer.prototype.br = function br () { return this.options.xhtml ? '
    ' : '
    '; }; Renderer.prototype.del = function del (text) { return '' + text + ''; }; Renderer.prototype.link = function link (href, title, text) { href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href); if (href === null) { return text; } var out = ''; return out; }; Renderer.prototype.image = function image (href, title, text) { href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href); if (href === null) { return text; } var out = '' + text + '' : '>'; return out; }; Renderer.prototype.text = function text (text$1) { return text$1; }; return Renderer; }()); /** * TextRenderer * returns only the textual part of the token */ var TextRenderer = /*@__PURE__*/(function () { function TextRenderer () {} TextRenderer.prototype.strong = function strong (text) { return text; }; TextRenderer.prototype.em = function em (text) { return text; }; TextRenderer.prototype.codespan = function codespan (text) { return text; }; TextRenderer.prototype.del = function del (text) { return text; }; TextRenderer.prototype.html = function html (text) { return text; }; TextRenderer.prototype.text = function text (text$1) { return text$1; }; TextRenderer.prototype.link = function link (href, title, text) { return '' + text; }; TextRenderer.prototype.image = function image (href, title, text) { return '' + text; }; TextRenderer.prototype.br = function br () { return ''; }; return TextRenderer; }()); /** * Slugger generates header id */ var Slugger = /*@__PURE__*/(function () { function Slugger() { this.seen = {}; } Slugger.prototype.serialize = function serialize (value) { return value .toLowerCase() .trim() // remove html tags .replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '') .replace(/\s/g, '-'); }; /** * Finds the next safe (unique) slug to use */ Slugger.prototype.getNextSafeSlug = function getNextSafeSlug (originalSlug, isDryRun) { var slug = originalSlug; var occurenceAccumulator = 0; if (this.seen.hasOwnProperty(slug)) { occurenceAccumulator = this.seen[originalSlug]; do { occurenceAccumulator++; slug = originalSlug + '-' + occurenceAccumulator; } while (this.seen.hasOwnProperty(slug)); } if (!isDryRun) { this.seen[originalSlug] = occurenceAccumulator; this.seen[slug] = 0; } return slug; }; /** * Convert string to unique id * @param {object} options * @param {boolean} options.dryrun Generates the next unique slug without updating the internal accumulator. */ Slugger.prototype.slug = function slug (value, options) { if ( options === void 0 ) options = {}; var slug = this.serialize(value); return this.getNextSafeSlug(slug, options.dryrun); }; return Slugger; }()); var defaults$4 = defaults.defaults; var unescape$1 = helpers.unescape; /** * Parsing & Compiling */ var Parser = /*@__PURE__*/(function () { function Parser(options) { this.options = options || defaults$4; this.options.renderer = this.options.renderer || new Renderer(); this.renderer = this.options.renderer; this.renderer.options = this.options; this.textRenderer = new TextRenderer(); this.slugger = new Slugger(); } /** * Static Parse Method */ Parser.parse = function parse (tokens, options) { var parser = new Parser(options); return parser.parse(tokens); }; /** * Static Parse Inline Method */ Parser.parseInline = function parseInline (tokens, options) { var parser = new Parser(options); return parser.parseInline(tokens); }; /** * Parse Loop */ Parser.prototype.parse = function parse (tokens, top) { if ( top === void 0 ) top = true; var out = '', i, j, k, l2, l3, row, cell, header, body, token, ordered, start, loose, itemBody, item, checked, task, checkbox; var l = tokens.length; for (i = 0; i < l; i++) { token = tokens[i]; switch (token.type) { case 'space': { continue; } case 'hr': { out += this.renderer.hr(); continue; } case 'heading': { out += this.renderer.heading( this.parseInline(token.tokens), token.depth, unescape$1(this.parseInline(token.tokens, this.textRenderer)), this.slugger); continue; } case 'code': { out += this.renderer.code(token.text, token.lang, token.escaped); continue; } case 'table': { header = ''; // header cell = ''; l2 = token.header.length; for (j = 0; j < l2; j++) { cell += this.renderer.tablecell( this.parseInline(token.tokens.header[j]), { header: true, align: token.align[j] } ); } header += this.renderer.tablerow(cell); body = ''; l2 = token.cells.length; for (j = 0; j < l2; j++) { row = token.tokens.cells[j]; cell = ''; l3 = row.length; for (k = 0; k < l3; k++) { cell += this.renderer.tablecell( this.parseInline(row[k]), { header: false, align: token.align[k] } ); } body += this.renderer.tablerow(cell); } out += this.renderer.table(header, body); continue; } case 'blockquote': { body = this.parse(token.tokens); out += this.renderer.blockquote(body); continue; } case 'list': { ordered = token.ordered; start = token.start; loose = token.loose; l2 = token.items.length; body = ''; for (j = 0; j < l2; j++) { item = token.items[j]; checked = item.checked; task = item.task; itemBody = ''; if (item.task) { checkbox = this.renderer.checkbox(checked); if (loose) { if (item.tokens.length > 0 && item.tokens[0].type === 'text') { item.tokens[0].text = checkbox + ' ' + item.tokens[0].text; if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') { item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text; } } else { item.tokens.unshift({ type: 'text', text: checkbox }); } } else { itemBody += checkbox; } } itemBody += this.parse(item.tokens, loose); body += this.renderer.listitem(itemBody, task, checked); } out += this.renderer.list(body, ordered, start); continue; } case 'html': { // TODO parse inline content if parameter markdown=1 out += this.renderer.html(token.text); continue; } case 'paragraph': { out += this.renderer.paragraph(this.parseInline(token.tokens)); continue; } case 'text': { body = token.tokens ? this.parseInline(token.tokens) : token.text; while (i + 1 < l && tokens[i + 1].type === 'text') { token = tokens[++i]; body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text); } out += top ? this.renderer.paragraph(body) : body; continue; } default: { var errMsg = 'Token with "' + token.type + '" type was not found.'; if (this.options.silent) { console.error(errMsg); return; } else { throw new Error(errMsg); } } } } return out; }; /** * Parse Inline Tokens */ Parser.prototype.parseInline = function parseInline (tokens, renderer) { renderer = renderer || this.renderer; var out = '', i, token; var l = tokens.length; for (i = 0; i < l; i++) { token = tokens[i]; switch (token.type) { case 'escape': { out += renderer.text(token.text); break; } case 'html': { out += renderer.html(token.text); break; } case 'link': { out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer)); break; } case 'image': { out += renderer.image(token.href, token.title, token.text); break; } case 'strong': { out += renderer.strong(this.parseInline(token.tokens, renderer)); break; } case 'em': { out += renderer.em(this.parseInline(token.tokens, renderer)); break; } case 'codespan': { out += renderer.codespan(token.text); break; } case 'br': { out += renderer.br(); break; } case 'del': { out += renderer.del(this.parseInline(token.tokens, renderer)); break; } case 'text': { out += renderer.text(token.text); break; } default: { var errMsg = 'Token with "' + token.type + '" type was not found.'; if (this.options.silent) { console.error(errMsg); return; } else { throw new Error(errMsg); } } } } return out; }; return Parser; }()); var merge$3 = helpers.merge; var checkSanitizeDeprecation$1 = helpers.checkSanitizeDeprecation; var escape$3 = helpers.escape; var getDefaults = defaults.getDefaults; var changeDefaults = defaults.changeDefaults; var defaults$5 = defaults.defaults; /** * 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 (typeof opt === 'function') { callback = opt; opt = null; } opt = merge$3({}, marked.defaults, opt || {}); checkSanitizeDeprecation$1(opt); if (callback) { var highlight = opt.highlight; var tokens; try { tokens = Lexer.lex(src, opt); } catch (e) { return callback(e); } var done = function(err) { var out; if (!err) { 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 (!tokens.length) { return done(); } var pending = 0; marked.walkTokens(tokens, function(token) { if (token.type === 'code') { pending++; setTimeout(function () { highlight(token.text, token.lang, function(err, code) { if (err) { return done(err); } if (code != null && code !== token.text) { token.text = code; token.escaped = true; } pending--; if (pending === 0) { done(); } }); }, 0); } }); if (pending === 0) { done(); } return; } try { var tokens$1 = Lexer.lex(src, opt); if (opt.walkTokens) { marked.walkTokens(tokens$1, opt.walkTokens); } return Parser.parse(tokens$1, opt); } catch (e) { e.message += '\nPlease report this to https://github.com/markedjs/marked.'; if (opt.silent) { return '

    An error occurred:

    '
              + escape$3(e.message + '', true)
              + '
    '; } throw e; } } /** * Options */ marked.options = marked.setOptions = function(opt) { merge$3(marked.defaults, opt); changeDefaults(marked.defaults); return marked; }; marked.getDefaults = getDefaults; marked.defaults = defaults$5; /** * Use Extension */ marked.use = function(extension) { var opts = merge$3({}, extension); if (extension.renderer) { var renderer = marked.defaults.renderer || new Renderer(); var loop = function ( prop ) { var prevRenderer = renderer[prop]; renderer[prop] = function () { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; var ret = extension.renderer[prop].apply(renderer, args); if (ret === false) { ret = prevRenderer.apply(renderer, args); } return ret; }; }; for (var prop in extension.renderer) loop( prop ); opts.renderer = renderer; } if (extension.tokenizer) { var tokenizer = marked.defaults.tokenizer || new Tokenizer(); var loop$1 = function ( prop ) { var prevTokenizer = tokenizer[prop$1]; tokenizer[prop$1] = function () { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; var ret = extension.tokenizer[prop$1].apply(tokenizer, args); if (ret === false) { ret = prevTokenizer.apply(tokenizer, args); } return ret; }; }; for (var prop$1 in extension.tokenizer) loop$1( prop ); opts.tokenizer = tokenizer; } if (extension.walkTokens) { var walkTokens = marked.defaults.walkTokens; opts.walkTokens = function (token) { extension.walkTokens(token); if (walkTokens) { walkTokens(token); } }; } marked.setOptions(opts); }; /** * Run callback for every token */ marked.walkTokens = function(tokens, callback) { for (var i$3 = 0, list$3 = tokens; i$3 < list$3.length; i$3 += 1) { var token = list$3[i$3]; callback(token); switch (token.type) { case 'table': { for (var i = 0, list = token.tokens.header; i < list.length; i += 1) { var cell = list[i]; marked.walkTokens(cell, callback); } for (var i$2 = 0, list$2 = token.tokens.cells; i$2 < list$2.length; i$2 += 1) { var row = list$2[i$2]; for (var i$1 = 0, list$1 = row; i$1 < list$1.length; i$1 += 1) { var cell$1 = list$1[i$1]; marked.walkTokens(cell$1, callback); } } break; } case 'list': { marked.walkTokens(token.items, callback); break; } default: { if (token.tokens) { marked.walkTokens(token.tokens, callback); } } } } }; /** * Parse Inline */ marked.parseInline = function(src, opt) { // throw error in case of non string input if (typeof src === 'undefined' || src === null) { throw new Error('marked.parseInline(): input parameter is undefined or null'); } if (typeof src !== 'string') { throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected'); } opt = merge$3({}, marked.defaults, opt || {}); checkSanitizeDeprecation$1(opt); try { var tokens = Lexer.lexInline(src, opt); if (opt.walkTokens) { marked.walkTokens(tokens, opt.walkTokens); } return Parser.parseInline(tokens, opt); } catch (e) { e.message += '\nPlease report this to https://github.com/markedjs/marked.'; if (opt.silent) { return '

    An error occurred:

    '
              + escape$3(e.message + '', true)
              + '
    '; } throw e; } }; /** * Expose */ marked.Parser = Parser; marked.parser = Parser.parse; marked.Renderer = Renderer; marked.TextRenderer = TextRenderer; marked.Lexer = Lexer; marked.lexer = Lexer.lex; marked.Tokenizer = Tokenizer; marked.Slugger = Slugger; marked.parse = marked; var marked_1 = marked; /** * Render github corner * @param {Object} data URL for the View Source on Github link * @param {String} cornerExternalLinkTarge value of the target attribute of the link * @return {String} SVG element as string */ function corner(data, cornerExternalLinkTarge) { if (!data) { return ''; } if (!/\/\//.test(data)) { data = 'https://github.com/' + data; } data = data.replace(/^git\+/, ''); // Double check cornerExternalLinkTarge = cornerExternalLinkTarge || '_blank'; return ( "
    " + '' + '' ); } /** * Renders main content * @param {Object} config Configuration object * @returns {String} HTML of the main content */ function main(config) { var name = config.name ? config.name : ''; var aside = '' + ''; return ( "
    " + aside + '
    ' + '
    ' + '
    ' + '
    ' ); } /** * Cover Page * @returns {String} 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} toc Array of TOC section links * @param {String} tpl TPL list * @return {String} Rendered tree */ function tree(toc, tpl) { if ( tpl === void 0 ) tpl = ''; if (!toc || !toc.length) { return ''; } var innerHTML = ''; toc.forEach(function (node) { var title = node.title.replace(/(<([^>]+)>)/g, ''); 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 (""); } /** * Gen toc tree * @link https://github.com/killercup/grock/blob/5280ae63e16c5739e9233d9009bc235ed7d79a50/styles/solarized/assets/js/behavior.coffee#L54-L81 * @param {Array} toc List of TOC elements * @param {Number} maxLevel Deep level * @return {Array} Headlines */ 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(/<[^>]+>/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(/:\+1:/g, ':thumbsup:') .replace(/:-1:/g, ':thumbsdown:') .replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, function (m) { return m.replace(/:/g, '__colon__'); } ) .replace(/:(\w+?):/gi, ( window.emojify) || replace) .replace(/__colon__/g, ':'); } /** * Converts a colon formatted string to a object with properties. * * This is process a provided string and look for any tokens in the format * of `:name[=value]` and then convert it to a object and return. * An example of this is ':include :type=code :fragment=demo' is taken and * then converted to: * * ``` * { * include: '', * type: 'code', * fragment: 'demo' * } * ``` * * @param {string} str The string to parse. * * @return {object} The original string and parsed object, { str, config }. */ 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) { if (key.indexOf(':') === -1) { config[key] = (value && value.replace(/"/g, '')) || true; return ''; } return m; }) .trim(); } return { str: str, config: config }; } /** * Remove the tag from sidebar when the header with link, details see issue 1069 * @param {string} str The string to deal with. * * @return {string} str The string after delete the element. */ function removeAtag(str) { if ( str === void 0 ) str = ''; return str.replace(/(<\/?a.*?>)/gi, ''); } var imageCompiler = function (ref) { var renderer = ref.renderer; var contentBase = ref.contentBase; var router = ref.router; return (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.push('data-no-zoom'); } if (title) { attrs.push(("title=\"" + title + "\"")); } if (config.size) { var ref$1 = config.size.split('x'); var width = ref$1[0]; var height = ref$1[1]; if (height) { attrs.push(("width=\"" + width + "\" height=\"" + height + "\"")); } else { attrs.push(("width=\"" + width + "\"")); } } if (config.class) { attrs.push(("class=\"" + (config.class) + "\"")); } if (config.id) { attrs.push(("id=\"" + (config.id) + "\"")); } if (!isAbsolutePath(href)) { url = getPath(contentBase, getParentPath(router.getCurrentPath()), href); } if (attrs.length > 0) { return ("\"""); } return ("\"""); }); }; 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 * * @license MIT * @author Lea Verou * @namespace * @public */ var Prism = (function (_self){ // Private helper vars var lang = /\blang(?:uage)?-([\w-]+)\b/i; var uniqueId = 0; var _ = { /** * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load * additional languages or plugins yourself. * * By setting this value to `true`, Prism will not automatically highlight all code elements on the page. * * You obviously have to change this value before the automatic highlighting started. To do this, you can add an * empty Prism object into the global scope before loading the Prism script like this: * * ```js * window.Prism = window.Prism || {}; * Prism.manual = true; * // add a new