aboutsummaryrefslogtreecommitdiffstats
path: root/settings/js/vue-3.js
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-03-06 19:59:15 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2019-03-20 15:16:11 +0100
commit769cb629aebd368fbddd6ea04067fdcfaa262e3e (patch)
tree432bfb3aca1d60128e79da57c2053bf7f19291a2 /settings/js/vue-3.js
parent1c8779dc6e34a89ea9181b3cb252101e457c1543 (diff)
downloadnextcloud-server-769cb629aebd368fbddd6ea04067fdcfaa262e3e.tar.gz
nextcloud-server-769cb629aebd368fbddd6ea04067fdcfaa262e3e.zip
allow enforcing apps to ignore the max version
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'settings/js/vue-3.js')
-rw-r--r--settings/js/vue-3.js8588
1 files changed, 2669 insertions, 5919 deletions
diff --git a/settings/js/vue-3.js b/settings/js/vue-3.js
index c8a98c4c80b..3a0180ca05d 100644
--- a/settings/js/vue-3.js
+++ b/settings/js/vue-3.js
@@ -1,6515 +1,3265 @@
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[3],{
-/***/ "./node_modules/v-tooltip/dist/v-tooltip.esm.js":
-/*!******************************************************!*\
- !*** ./node_modules/v-tooltip/dist/v-tooltip.esm.js ***!
- \******************************************************/
-/*! exports provided: install, VTooltip, VClosePopover, VPopover, createTooltip, destroyTooltip, default */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
+/***/ "./node_modules/css-loader/dist/runtime/api.js":
+/*!*****************************************************!*\
+ !*** ./node_modules/css-loader/dist/runtime/api.js ***!
+ \*****************************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VTooltip", function() { return VTooltip; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VClosePopover", function() { return VClosePopover; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VPopover", function() { return VPopover; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTooltip", function() { return createTooltip; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "destroyTooltip", function() { return destroyTooltip; });
-/**!
- * @fileOverview Kickass library to create and place poppers near their reference elements.
- * @version 1.14.3
- * @license
- * Copyright (c) 2016 Federico Zivolo and contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
-
-var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
-var timeoutDuration = 0;
-for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
- if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
- timeoutDuration = 1;
- break;
- }
-}
-
-function microtaskDebounce(fn) {
- var called = false;
- return function () {
- if (called) {
- return;
- }
- called = true;
- window.Promise.resolve().then(function () {
- called = false;
- fn();
- });
- };
-}
-
-function taskDebounce(fn) {
- var scheduled = false;
- return function () {
- if (!scheduled) {
- scheduled = true;
- setTimeout(function () {
- scheduled = false;
- fn();
- }, timeoutDuration);
- }
- };
-}
-var supportsMicroTasks = isBrowser && window.Promise;
-/**
-* Create a debounced version of a method, that's asynchronously deferred
-* but called in the minimum time possible.
-*
-* @method
-* @memberof Popper.Utils
-* @argument {Function} fn
-* @returns {Function}
+/*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author Tobias Koppers @sokra
*/
-var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
+// css base code, injected by the css-loader
+module.exports = function (useSourceMap) {
+ var list = []; // return the list of modules as css string
-/**
- * Check if the given variable is a function
- * @method
- * @memberof Popper.Utils
- * @argument {Any} functionToCheck - variable to check
- * @returns {Boolean} answer to: is a function?
- */
-function isFunction(functionToCheck) {
- var getType = {};
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
-}
-
-/**
- * Get CSS computed property of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Eement} element
- * @argument {String} property
- */
-function getStyleComputedProperty(element, property) {
- if (element.nodeType !== 1) {
- return [];
- }
- // NOTE: 1 DOM access here
- var css = getComputedStyle(element, null);
- return property ? css[property] : css;
-}
+ list.toString = function toString() {
+ return this.map(function (item) {
+ var content = cssWithMappingToString(item, useSourceMap);
-/**
- * Returns the parentNode or the host of the element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} parent
- */
-function getParentNode(element) {
- if (element.nodeName === 'HTML') {
- return element;
- }
- return element.parentNode || element.host;
-}
-
-/**
- * Returns the scrolling parent of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} scroll parent
- */
-function getScrollParent(element) {
- // Return body, `getScroll` will take care to get the correct `scrollTop` from it
- if (!element) {
- return document.body;
- }
-
- switch (element.nodeName) {
- case 'HTML':
- case 'BODY':
- return element.ownerDocument.body;
- case '#document':
- return element.body;
- }
+ if (item[2]) {
+ return '@media ' + item[2] + '{' + content + '}';
+ } else {
+ return content;
+ }
+ }).join('');
+ }; // import a list of modules into the list
- // Firefox want us to check `-x` and `-y` variations as well
- var _getStyleComputedProp = getStyleComputedProperty(element),
- overflow = _getStyleComputedProp.overflow,
- overflowX = _getStyleComputedProp.overflowX,
- overflowY = _getStyleComputedProp.overflowY;
+ list.i = function (modules, mediaQuery) {
+ if (typeof modules === 'string') {
+ modules = [[null, modules, '']];
+ }
- if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
- return element;
- }
+ var alreadyImportedModules = {};
- return getScrollParent(getParentNode(element));
-}
+ for (var i = 0; i < this.length; i++) {
+ var id = this[i][0];
-var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
-var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
+ if (id != null) {
+ alreadyImportedModules[id] = true;
+ }
+ }
-/**
- * Determines if the browser is Internet Explorer
- * @method
- * @memberof Popper.Utils
- * @param {Number} version to check
- * @returns {Boolean} isIE
- */
-function isIE(version) {
- if (version === 11) {
- return isIE11;
- }
- if (version === 10) {
- return isIE10;
- }
- return isIE11 || isIE10;
-}
+ for (i = 0; i < modules.length; i++) {
+ var item = modules[i]; // skip already imported module
+ // this implementation is not 100% perfect for weird media query combinations
+ // when a module is imported multiple times with different media queries.
+ // I hope this will never occur (Hey this way we have smaller bundles)
-/**
- * Returns the offset parent of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} offset parent
- */
-function getOffsetParent(element) {
- if (!element) {
- return document.documentElement;
- }
+ if (item[0] == null || !alreadyImportedModules[item[0]]) {
+ if (mediaQuery && !item[2]) {
+ item[2] = mediaQuery;
+ } else if (mediaQuery) {
+ item[2] = '(' + item[2] + ') and (' + mediaQuery + ')';
+ }
- var noOffsetParent = isIE(10) ? document.body : null;
+ list.push(item);
+ }
+ }
+ };
- // NOTE: 1 DOM access here
- var offsetParent = element.offsetParent;
- // Skip hidden elements which don't have an offsetParent
- while (offsetParent === noOffsetParent && element.nextElementSibling) {
- offsetParent = (element = element.nextElementSibling).offsetParent;
- }
+ return list;
+};
- var nodeName = offsetParent && offsetParent.nodeName;
+function cssWithMappingToString(item, useSourceMap) {
+ var content = item[1] || '';
+ var cssMapping = item[3];
- if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
- return element ? element.ownerDocument.documentElement : document.documentElement;
+ if (!cssMapping) {
+ return content;
}
- // .offsetParent will return the closest TD or TABLE in case
- // no offsetParent is present, I hate this job...
- if (['TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
- return getOffsetParent(offsetParent);
+ if (useSourceMap && typeof btoa === 'function') {
+ var sourceMapping = toComment(cssMapping);
+ var sourceURLs = cssMapping.sources.map(function (source) {
+ return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */';
+ });
+ return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
- return offsetParent;
-}
+ return [content].join('\n');
+} // Adapted from convert-source-map (MIT)
-function isOffsetContainer(element) {
- var nodeName = element.nodeName;
- if (nodeName === 'BODY') {
- return false;
- }
- return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
+function toComment(sourceMap) {
+ // eslint-disable-next-line no-undef
+ var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
+ var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
+ return '/*# ' + data + ' */';
}
-/**
- * Finds the root node (document, shadowDOM root) of the given element
- * @method
- * @memberof Popper.Utils
- * @argument {Element} node
- * @returns {Element} root node
- */
-function getRoot(node) {
- if (node.parentNode !== null) {
- return getRoot(node.parentNode);
- }
+/***/ }),
- return node;
-}
+/***/ "./node_modules/dompurify/dist/purify.js":
+/*!***********************************************!*\
+ !*** ./node_modules/dompurify/dist/purify.js ***!
+ \***********************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
-/**
- * Finds the offset parent common to the two provided nodes
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element1
- * @argument {Element} element2
- * @returns {Element} common offset parent
- */
-function findCommonOffsetParent(element1, element2) {
- // This check is needed to avoid errors in case one of the elements isn't defined for any reason
- if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
- return document.documentElement;
- }
+(function (global, factory) {
+ true ? module.exports = factory() :
+ undefined;
+}(this, (function () { 'use strict';
- // Here we make sure to give as "start" the element that comes first in the DOM
- var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
- var start = order ? element1 : element2;
- var end = order ? element2 : element1;
+var freeze$1 = Object.freeze || function (x) {
+ return x;
+};
- // Get common ancestor container
- var range = document.createRange();
- range.setStart(start, 0);
- range.setEnd(end, 0);
- var commonAncestorContainer = range.commonAncestorContainer;
+var html = freeze$1(['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', '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', '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']);
- // Both nodes are inside #document
+// SVG
+var svg = freeze$1(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'audio', 'canvas', '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', 'video', 'view', 'vkern']);
- if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
- if (isOffsetContainer(commonAncestorContainer)) {
- return commonAncestorContainer;
- }
+var svgFilters = freeze$1(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
- return getOffsetParent(commonAncestorContainer);
- }
+var mathMl = freeze$1(['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']);
- // one of the nodes is inside shadowDOM, find which one
- var element1root = getRoot(element1);
- if (element1root.host) {
- return findCommonOffsetParent(element1root.host, element2);
- } else {
- return findCommonOffsetParent(element1, getRoot(element2).host);
- }
-}
+var text = freeze$1(['#text']);
-/**
- * Gets the scroll value of the given element in the given side (top and left)
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @argument {String} side `top` or `left`
- * @returns {number} amount of scrolled pixels
- */
-function getScroll(element) {
- var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
+var freeze$2 = Object.freeze || function (x) {
+ return x;
+};
- var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
- var nodeName = element.nodeName;
+var html$1 = freeze$2(['accept', 'action', 'align', 'alt', 'autocomplete', 'background', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'coords', 'crossorigin', 'datetime', 'default', 'dir', 'disabled', 'download', 'enctype', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'integrity', 'ismap', 'label', 'lang', 'list', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'multiple', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', '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', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns']);
- if (nodeName === 'BODY' || nodeName === 'HTML') {
- var html = element.ownerDocument.documentElement;
- var scrollingElement = element.ownerDocument.scrollingElement || html;
- return scrollingElement[upperSide];
- }
+var svg$1 = freeze$2(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', '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', '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', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', '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']);
- return element[upperSide];
-}
+var mathMl$1 = freeze$2(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', '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']);
-/*
- * Sum or subtract the element scroll values (left and top) from a given rect object
- * @method
- * @memberof Popper.Utils
- * @param {Object} rect - Rect object you want to change
- * @param {HTMLElement} element - The element from the function reads the scroll values
- * @param {Boolean} subtract - set to true if you want to subtract the scroll values
- * @return {Object} rect - The modifier rect object
- */
-function includeScroll(rect, element) {
- var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- var scrollTop = getScroll(element, 'top');
- var scrollLeft = getScroll(element, 'left');
- var modifier = subtract ? -1 : 1;
- rect.top += scrollTop * modifier;
- rect.bottom += scrollTop * modifier;
- rect.left += scrollLeft * modifier;
- rect.right += scrollLeft * modifier;
- return rect;
-}
+var xml = freeze$2(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
-/*
- * Helper to detect borders of a given element
- * @method
- * @memberof Popper.Utils
- * @param {CSSStyleDeclaration} styles
- * Result of `getStyleComputedProperty` on the given element
- * @param {String} axis - `x` or `y`
- * @return {number} borders - The borders size of the given axis
- */
+var hasOwnProperty = Object.hasOwnProperty;
+var setPrototypeOf = Object.setPrototypeOf;
-function getBordersSize(styles, axis) {
- var sideA = axis === 'x' ? 'Left' : 'Top';
- var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
+var _ref$1 = typeof Reflect !== 'undefined' && Reflect;
+var apply$1 = _ref$1.apply;
- return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
-}
-
-function getSize(axis, body, html, computedStyle) {
- return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0);
-}
-
-function getWindowSizes() {
- var body = document.body;
- var html = document.documentElement;
- var computedStyle = isIE(10) && getComputedStyle(html);
-
- return {
- height: getSize('Height', body, html, computedStyle),
- width: getSize('Width', body, html, computedStyle)
+if (!apply$1) {
+ apply$1 = function apply(fun, thisValue, args) {
+ return fun.apply(thisValue, args);
};
}
-var classCallCheck = function (instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
-};
-
-var createClass = function () {
- function defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
+/* 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);
}
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
-}();
-
-
-
-
-
-var defineProperty = function (obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
+ var l = array.length;
+ while (l--) {
+ var element = array[l];
+ if (typeof element === 'string') {
+ var lcElement = element.toLowerCase();
+ if (lcElement !== element) {
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
+ if (!Object.isFrozen(array)) {
+ array[l] = lcElement;
+ }
- return obj;
-};
-
-var _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
-
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
+ element = lcElement;
}
}
- }
- return target;
-};
+ set[element] = true;
+ }
-/**
- * Given element offsets, generate an output similar to getBoundingClientRect
- * @method
- * @memberof Popper.Utils
- * @argument {Object} offsets
- * @returns {Object} ClientRect like output
- */
-function getClientRect(offsets) {
- return _extends({}, offsets, {
- right: offsets.left + offsets.width,
- bottom: offsets.top + offsets.height
- });
+ return set;
}
-/**
- * Get bounding client rect of given element
- * @method
- * @memberof Popper.Utils
- * @param {HTMLElement} element
- * @return {Object} client rect
- */
-function getBoundingClientRect(element) {
- var rect = {};
+/* Shallow clone an object */
+function clone(object) {
+ var newObject = {};
- // IE10 10 FIX: Please, don't ask, the element isn't
- // considered in DOM in some circumstances...
- // This isn't reproducible in IE10 compatibility mode of IE11
- try {
- if (isIE(10)) {
- rect = element.getBoundingClientRect();
- var scrollTop = getScroll(element, 'top');
- var scrollLeft = getScroll(element, 'left');
- rect.top += scrollTop;
- rect.left += scrollLeft;
- rect.bottom += scrollTop;
- rect.right += scrollLeft;
- } else {
- rect = element.getBoundingClientRect();
+ var property = void 0;
+ for (property in object) {
+ if (apply$1(hasOwnProperty, object, [property])) {
+ newObject[property] = object[property];
}
- } catch (e) {}
-
- var result = {
- left: rect.left,
- top: rect.top,
- width: rect.right - rect.left,
- height: rect.bottom - rect.top
- };
-
- // subtract scrollbar size from sizes
- var sizes = element.nodeName === 'HTML' ? getWindowSizes() : {};
- var width = sizes.width || element.clientWidth || result.right - result.left;
- var height = sizes.height || element.clientHeight || result.bottom - result.top;
-
- var horizScrollbar = element.offsetWidth - width;
- var vertScrollbar = element.offsetHeight - height;
-
- // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
- // we make this check conditional for performance reasons
- if (horizScrollbar || vertScrollbar) {
- var styles = getStyleComputedProperty(element);
- horizScrollbar -= getBordersSize(styles, 'x');
- vertScrollbar -= getBordersSize(styles, 'y');
-
- result.width -= horizScrollbar;
- result.height -= vertScrollbar;
}
- return getClientRect(result);
+ return newObject;
}
-function getOffsetRectRelativeToArbitraryNode(children, parent) {
- var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- var isIE10 = isIE(10);
- var isHTML = parent.nodeName === 'HTML';
- var childrenRect = getBoundingClientRect(children);
- var parentRect = getBoundingClientRect(parent);
- var scrollParent = getScrollParent(children);
-
- var styles = getStyleComputedProperty(parent);
- var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
- var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
+var seal = Object.seal || function (x) {
+ return x;
+};
- // In cases where the parent is fixed, we must ignore negative scroll in offset calc
- if (fixedPosition && parent.nodeName === 'HTML') {
- parentRect.top = Math.max(parentRect.top, 0);
- parentRect.left = Math.max(parentRect.left, 0);
- }
- var offsets = getClientRect({
- top: childrenRect.top - parentRect.top - borderTopWidth,
- left: childrenRect.left - parentRect.left - borderLeftWidth,
- width: childrenRect.width,
- height: childrenRect.height
- });
- offsets.marginTop = 0;
- offsets.marginLeft = 0;
-
- // Subtract margins of documentElement in case it's being used as parent
- // we do this only on HTML because it's the only element that behaves
- // differently when margins are applied to it. The margins are included in
- // the box of the documentElement, in the other cases not.
- if (!isIE10 && isHTML) {
- var marginTop = parseFloat(styles.marginTop, 10);
- var marginLeft = parseFloat(styles.marginLeft, 10);
-
- offsets.top -= borderTopWidth - marginTop;
- offsets.bottom -= borderTopWidth - marginTop;
- offsets.left -= borderLeftWidth - marginLeft;
- offsets.right -= borderLeftWidth - marginLeft;
-
- // Attach marginTop and marginLeft because in some circumstances we may need them
- offsets.marginTop = marginTop;
- offsets.marginLeft = marginLeft;
- }
+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
+);
- if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
- offsets = includeScroll(offsets, parent);
- }
+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; };
- return offsets;
-}
+function _toConsumableArray(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); } }
-function getViewportOffsetRectRelativeToArtbitraryNode(element) {
- var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+var _ref = typeof Reflect !== 'undefined' && Reflect;
+var apply = _ref.apply;
- var html = element.ownerDocument.documentElement;
- var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
- var width = Math.max(html.clientWidth, window.innerWidth || 0);
- var height = Math.max(html.clientHeight, window.innerHeight || 0);
+var arraySlice = Array.prototype.slice;
+var freeze = Object.freeze;
- var scrollTop = !excludeScroll ? getScroll(html) : 0;
- var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
+var getGlobal = function getGlobal() {
+ return typeof window === 'undefined' ? null : window;
+};
- var offset = {
- top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
- left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
- width: width,
- height: height
+if (!apply) {
+ apply = function apply(fun, thisValue, args) {
+ return fun.apply(thisValue, args);
};
-
- return getClientRect(offset);
}
/**
- * Check if the given element is fixed or is inside a fixed parent
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @argument {Element} customContainer
- * @returns {Boolean} answer to "isFixed?"
+ * 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).
*/
-function isFixed(element) {
- var nodeName = element.nodeName;
- if (nodeName === 'BODY' || nodeName === 'HTML') {
- return false;
+var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
+ if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
+ return null;
}
- if (getStyleComputedProperty(element, 'position') === 'fixed') {
- return true;
- }
- return isFixed(getParentNode(element));
-}
-/**
- * Finds the first parent of an element that has a transformed property defined
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Element} first transformed parent or documentElement
- */
-
-function getFixedPositionOffsetParent(element) {
- // This check is needed to avoid errors in case one of the elements isn't defined for any reason
- if (!element || !element.parentElement || isIE()) {
- return document.documentElement;
- }
- var el = element.parentElement;
- while (el && getStyleComputedProperty(el, 'transform') === 'none') {
- el = el.parentElement;
+ // 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);
}
- return el || document.documentElement;
-}
-/**
- * Computed the boundaries limits and return them
- * @method
- * @memberof Popper.Utils
- * @param {HTMLElement} popper
- * @param {HTMLElement} reference
- * @param {number} padding
- * @param {HTMLElement} boundariesElement - Element used to define the boundaries
- * @param {Boolean} fixedPosition - Is in fixed position mode
- * @returns {Object} Coordinates of the boundaries
- */
-function getBoundaries(popper, reference, padding, boundariesElement) {
- var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
+ var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
- // NOTE: 1 DOM access here
-
- var boundaries = { top: 0, left: 0 };
- var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
-
- // Handle viewport case
- if (boundariesElement === 'viewport') {
- boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
- } else {
- // Handle other cases based on DOM element used as boundaries
- var boundariesNode = void 0;
- if (boundariesElement === 'scrollParent') {
- boundariesNode = getScrollParent(getParentNode(reference));
- if (boundariesNode.nodeName === 'BODY') {
- boundariesNode = popper.ownerDocument.documentElement;
+ try {
+ return trustedTypes.createPolicy(policyName, {
+ createHTML: function createHTML(html$$1) {
+ return html$$1;
}
- } else if (boundariesElement === 'window') {
- boundariesNode = popper.ownerDocument.documentElement;
- } else {
- boundariesNode = boundariesElement;
- }
-
- var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
-
- // In case of HTML, we need a different computation
- if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
- var _getWindowSizes = getWindowSizes(),
- height = _getWindowSizes.height,
- width = _getWindowSizes.width;
-
- boundaries.top += offsets.top - offsets.marginTop;
- boundaries.bottom = height + offsets.top;
- boundaries.left += offsets.left - offsets.marginLeft;
- boundaries.right = width + offsets.left;
- } else {
- // for all the other DOM elements, this one is good
- boundaries = offsets;
- }
+ });
+ } catch (error) {
+ // 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;
}
+};
- // Add paddings
- boundaries.left += padding;
- boundaries.top += padding;
- boundaries.right -= padding;
- boundaries.bottom -= padding;
-
- return boundaries;
-}
-
-function getArea(_ref) {
- var width = _ref.width,
- height = _ref.height;
+function createDOMPurify() {
+ var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
- return width * height;
-}
+ var DOMPurify = function DOMPurify(root) {
+ return createDOMPurify(root);
+ };
-/**
- * Utility used to transform the `auto` placement to the placement with more
- * available space.
- * @method
- * @memberof Popper.Utils
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
-function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
- var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
+ /**
+ * Version label, exposed for easier checks
+ * if DOMPurify is up to date or not
+ */
+ DOMPurify.version = '1.0.10';
- if (placement.indexOf('auto') === -1) {
- return placement;
+ /**
+ * 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 useDOMParser = false;
+ var removeTitle = false;
+
+ var document = window.document;
+ var DocumentFragment = window.DocumentFragment,
+ HTMLTemplateElement = window.HTMLTemplateElement,
+ Node = window.Node,
+ 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;
+
+ // 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 boundaries = getBoundaries(popper, reference, padding, boundariesElement);
+ var trustedTypesPolicy = _createTrustedTypesPolicy(TrustedTypes, originalDocument);
+ var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
- var rects = {
- top: {
- width: boundaries.width,
- height: refRect.top - boundaries.top
- },
- right: {
- width: boundaries.right - refRect.right,
- height: boundaries.height
- },
- bottom: {
- width: boundaries.width,
- height: boundaries.bottom - refRect.bottom
- },
- left: {
- width: refRect.left - boundaries.left,
- height: boundaries.height
- }
- };
+ var _document = document,
+ implementation = _document.implementation,
+ createNodeIterator = _document.createNodeIterator,
+ getElementsByTagName = _document.getElementsByTagName,
+ createDocumentFragment = _document.createDocumentFragment;
+ var importNode = originalDocument.importNode;
- var sortedAreas = Object.keys(rects).map(function (key) {
- return _extends({
- key: key
- }, rects[key], {
- area: getArea(rects[key])
- });
- }).sort(function (a, b) {
- return b.area - a.area;
- });
- var filteredAreas = sortedAreas.filter(function (_ref2) {
- var width = _ref2.width,
- height = _ref2.height;
- return width >= popper.clientWidth && height >= popper.clientHeight;
- });
+ var hooks = {};
- var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
+ /**
+ * Expose whether this browser supports running the full DOMPurify.
+ */
+ DOMPurify.isSupported = implementation && typeof implementation.createHTMLDocument !== 'undefined' && document.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.
+ */
- var variation = placement.split('-')[1];
+ /* allowed element names */
- return computedPlacement + (variation ? '-' + variation : '');
-}
+ var ALLOWED_TAGS = null;
+ var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(svgFilters), _toConsumableArray(mathMl), _toConsumableArray(text)));
-/**
- * Get offsets to the reference element
- * @method
- * @memberof Popper.Utils
- * @param {Object} state
- * @param {Element} popper - the popper element
- * @param {Element} reference - the reference element (the popper will be relative to this)
- * @param {Element} fixedPosition - is in fixed position mode
- * @returns {Object} An object containing the offsets which will be applied to the popper
- */
-function getReferenceOffsets(state, popper, reference) {
- var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
+ /* Allowed attribute names */
+ var ALLOWED_ATTR = null;
+ var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(mathMl$1), _toConsumableArray(xml)));
- var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
- return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
-}
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
+ var FORBID_TAGS = null;
-/**
- * Get the outer sizes of the given element (offset size + margins)
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element
- * @returns {Object} object containing width and height properties
- */
-function getOuterSizes(element) {
- var styles = getComputedStyle(element);
- var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
- var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
- var result = {
- width: element.offsetWidth + y,
- height: element.offsetHeight + x
- };
- return result;
-}
-
-/**
- * Get the opposite placement of the given one
- * @method
- * @memberof Popper.Utils
- * @argument {String} placement
- * @returns {String} flipped placement
- */
-function getOppositePlacement(placement) {
- var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
- return placement.replace(/left|right|bottom|top/g, function (matched) {
- return hash[matched];
- });
-}
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
+ var FORBID_ATTR = null;
-/**
- * Get offsets to the popper
- * @method
- * @memberof Popper.Utils
- * @param {Object} position - CSS position the Popper will get applied
- * @param {HTMLElement} popper - the popper element
- * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
- * @param {String} placement - one of the valid placement options
- * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
- */
-function getPopperOffsets(popper, referenceOffsets, placement) {
- placement = placement.split('-')[0];
+ /* Decide if ARIA attributes are okay */
+ var ALLOW_ARIA_ATTR = true;
- // Get popper node sizes
- var popperRect = getOuterSizes(popper);
+ /* Decide if custom data attributes are okay */
+ var ALLOW_DATA_ATTR = true;
- // Add position, width and height to our offsets object
- var popperOffsets = {
- width: popperRect.width,
- height: popperRect.height
- };
+ /* Decide if unknown protocols are okay */
+ var ALLOW_UNKNOWN_PROTOCOLS = false;
- // depending by the popper placement we have to compute its offsets slightly differently
- var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
- var mainSide = isHoriz ? 'top' : 'left';
- var secondarySide = isHoriz ? 'left' : 'top';
- var measurement = isHoriz ? 'height' : 'width';
- var secondaryMeasurement = !isHoriz ? 'height' : 'width';
+ /* Output should be safe for jQuery's $() factory? */
+ var SAFE_FOR_JQUERY = false;
- popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
- if (placement === secondarySide) {
- popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
- } else {
- popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
- }
+ /* Output should be safe for common template engines.
+ * This means, DOMPurify removes data attributes, mustaches and ERB
+ */
+ var SAFE_FOR_TEMPLATES = false;
- return popperOffsets;
-}
+ /* Decide if document with <html>... should be returned */
+ var WHOLE_DOCUMENT = false;
-/**
- * Mimics the `find` method of Array
- * @method
- * @memberof Popper.Utils
- * @argument {Array} arr
- * @argument prop
- * @argument value
- * @returns index or -1
- */
-function find(arr, check) {
- // use native find if supported
- if (Array.prototype.find) {
- return arr.find(check);
- }
-
- // use `filter` to obtain the same behavior of `find`
- return arr.filter(check)[0];
-}
+ /* Track whether config is already set on this instance of DOMPurify. */
+ var SET_CONFIG = false;
-/**
- * Return the index of the matching object
- * @method
- * @memberof Popper.Utils
- * @argument {Array} arr
- * @argument prop
- * @argument value
- * @returns index or -1
- */
-function findIndex(arr, prop, value) {
- // use native findIndex if supported
- if (Array.prototype.findIndex) {
- return arr.findIndex(function (cur) {
- return cur[prop] === value;
- });
- }
+ /* 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;
- // use `find` + `indexOf` if `findIndex` isn't supported
- var match = find(arr, function (obj) {
- return obj[prop] === value;
- });
- return arr.indexOf(match);
-}
+ /* 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;
-/**
- * Loop trough the list of modifiers and run them in order,
- * each of them will then edit the data object.
- * @method
- * @memberof Popper.Utils
- * @param {dataObject} data
- * @param {Array} modifiers
- * @param {String} ends - Optional modifier name used as stopper
- * @returns {dataObject}
- */
-function runModifiers(modifiers, data, ends) {
- var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
+ /* 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;
- modifiersToRun.forEach(function (modifier) {
- if (modifier['function']) {
- // eslint-disable-line dot-notation
- console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
- }
- var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
- if (modifier.enabled && isFunction(fn)) {
- // Add properties to offsets to make them a complete clientRect object
- // we do this before each modifier to make sure the previous one doesn't
- // mess with these values
- data.offsets.popper = getClientRect(data.offsets.popper);
- data.offsets.reference = getClientRect(data.offsets.reference);
-
- data = fn(data, modifier);
- }
- });
+ /* 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. */
+ var RETURN_DOM_IMPORT = false;
- return data;
-}
+ /* Output should be free from DOM clobbering attacks? */
+ var SANITIZE_DOM = true;
-/**
- * Updates the position of the popper, computing the new offsets and applying
- * the new style.<br />
- * Prefer `scheduleUpdate` over `update` because of performance reasons.
- * @method
- * @memberof Popper
- */
-function update() {
- // if popper is destroyed, don't perform any further update
- if (this.state.isDestroyed) {
- return;
- }
+ /* Keep element content when removing element? */
+ var KEEP_CONTENT = true;
- var data = {
- instance: this,
- styles: {},
- arrowStyles: {},
- attributes: {},
- flipped: false,
- offsets: {}
- };
+ /* 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;
- // compute reference element offsets
- data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
+ /* Allow usage of profiles like html, svg and mathMl */
+ var USE_PROFILES = {};
- // compute auto placement, store placement inside the data object,
- // modifiers will be able to edit `placement` if needed
- // and refer to originalPlacement to know the original value
- data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
+ /* Tags to ignore content of when KEEP_CONTENT is true */
+ var FORBID_CONTENTS = addToSet({}, ['audio', 'head', 'math', 'script', 'style', 'template', 'svg', 'video']);
- // store the computed placement inside `originalPlacement`
- data.originalPlacement = data.placement;
+ /* Tags that are safe for data: URIs */
+ var DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image']);
- data.positionFixed = this.options.positionFixed;
+ /* Attributes safe for values like "javascript:" */
+ var URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'summary', 'title', 'value', 'style', 'xmlns']);
- // compute the popper offsets
- data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
+ /* Keep a reference to config to pass to hooks */
+ var CONFIG = null;
- data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
+ /* Ideally, do not touch anything below this line */
+ /* ______________________________________________ */
- // run the modifiers
- data = runModifiers(this.modifiers, data);
+ var formElement = document.createElement('form');
- // the first `update` will call `onCreate` callback
- // the other ones will call `onUpdate` callback
- if (!this.state.isCreated) {
- this.state.isCreated = true;
- this.options.onCreate(data);
- } else {
- this.options.onUpdate(data);
- }
-}
-
-/**
- * Helper used to know if the given modifier is enabled.
- * @method
- * @memberof Popper.Utils
- * @returns {Boolean}
- */
-function isModifierEnabled(modifiers, modifierName) {
- return modifiers.some(function (_ref) {
- var name = _ref.name,
- enabled = _ref.enabled;
- return enabled && name === modifierName;
- });
-}
+ /**
+ * _parseConfig
+ *
+ * @param {Object} cfg optional config literal
+ */
+ // eslint-disable-next-line complexity
+ var _parseConfig = function _parseConfig(cfg) {
+ if (CONFIG && CONFIG === cfg) {
+ return;
+ }
-/**
- * Get the prefixed supported property name
- * @method
- * @memberof Popper.Utils
- * @argument {String} property (camelCase)
- * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
- */
-function getSupportedPropertyName(property) {
- var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
- var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
-
- for (var i = 0; i < prefixes.length; i++) {
- var prefix = prefixes[i];
- var toCheck = prefix ? '' + prefix + upperProp : property;
- if (typeof document.body.style[toCheck] !== 'undefined') {
- return toCheck;
+ /* Shield configuration object from tampering */
+ if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') {
+ cfg = {};
}
- }
- return null;
-}
-/**
- * Destroy the popper
- * @method
- * @memberof Popper
- */
-function destroy() {
- this.state.isDestroyed = true;
-
- // touch DOM only if `applyStyle` modifier is enabled
- if (isModifierEnabled(this.modifiers, 'applyStyle')) {
- this.popper.removeAttribute('x-placement');
- this.popper.style.position = '';
- this.popper.style.top = '';
- this.popper.style.left = '';
- this.popper.style.right = '';
- this.popper.style.bottom = '';
- this.popper.style.willChange = '';
- this.popper.style[getSupportedPropertyName('transform')] = '';
- }
+ /* 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;
+ 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_JQUERY = cfg.SAFE_FOR_JQUERY || 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 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;
+
+ if (SAFE_FOR_TEMPLATES) {
+ ALLOW_DATA_ATTR = false;
+ }
- this.disableEventListeners();
+ if (RETURN_DOM_FRAGMENT) {
+ RETURN_DOM = true;
+ }
- // remove the popper if user explicity asked for the deletion on destroy
- // do not use `remove` because IE11 doesn't support it
- if (this.options.removeOnDestroy) {
- this.popper.parentNode.removeChild(this.popper);
- }
- return this;
-}
+ /* Parse profile info */
+ if (USE_PROFILES) {
+ ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(text)));
+ ALLOWED_ATTR = [];
+ if (USE_PROFILES.html === true) {
+ addToSet(ALLOWED_TAGS, html);
+ addToSet(ALLOWED_ATTR, html$1);
+ }
-/**
- * Get the window associated with the element
- * @argument {Element} element
- * @returns {Window}
- */
-function getWindow(element) {
- var ownerDocument = element.ownerDocument;
- return ownerDocument ? ownerDocument.defaultView : window;
-}
+ if (USE_PROFILES.svg === true) {
+ addToSet(ALLOWED_TAGS, svg);
+ addToSet(ALLOWED_ATTR, svg$1);
+ addToSet(ALLOWED_ATTR, xml);
+ }
-function attachToScrollParents(scrollParent, event, callback, scrollParents) {
- var isBody = scrollParent.nodeName === 'BODY';
- var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
- target.addEventListener(event, callback, { passive: true });
+ if (USE_PROFILES.svgFilters === true) {
+ addToSet(ALLOWED_TAGS, svgFilters);
+ addToSet(ALLOWED_ATTR, svg$1);
+ addToSet(ALLOWED_ATTR, xml);
+ }
- if (!isBody) {
- attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
- }
- scrollParents.push(target);
-}
+ if (USE_PROFILES.mathMl === true) {
+ addToSet(ALLOWED_TAGS, mathMl);
+ addToSet(ALLOWED_ATTR, mathMl$1);
+ addToSet(ALLOWED_ATTR, xml);
+ }
+ }
-/**
- * Setup needed event listeners used to update the popper position
- * @method
- * @memberof Popper.Utils
- * @private
- */
-function setupEventListeners(reference, options, state, updateBound) {
- // Resize event listener on window
- state.updateBound = updateBound;
- getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
-
- // Scroll event listener on scroll parents
- var scrollElement = getScrollParent(reference);
- attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
- state.scrollElement = scrollElement;
- state.eventsEnabled = true;
-
- return state;
-}
+ /* Merge configuration parameters */
+ if (cfg.ADD_TAGS) {
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
+ }
-/**
- * It will add resize/scroll events and start recalculating
- * position of the popper element when they are triggered.
- * @method
- * @memberof Popper
- */
-function enableEventListeners() {
- if (!this.state.eventsEnabled) {
- this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
- }
-}
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
+ }
-/**
- * Remove event listeners used to update the popper position
- * @method
- * @memberof Popper.Utils
- * @private
- */
-function removeEventListeners(reference, state) {
- // Remove resize event listener on window
- getWindow(reference).removeEventListener('resize', state.updateBound);
+ if (cfg.ADD_ATTR) {
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
+ }
- // Remove scroll event listener on scroll parents
- state.scrollParents.forEach(function (target) {
- target.removeEventListener('scroll', state.updateBound);
- });
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
+ }
- // Reset state
- state.updateBound = null;
- state.scrollParents = [];
- state.scrollElement = null;
- state.eventsEnabled = false;
- return state;
-}
+ if (cfg.ADD_URI_SAFE_ATTR) {
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
+ }
-/**
- * It will remove resize/scroll events and won't recalculate popper position
- * when they are triggered. It also won't trigger onUpdate callback anymore,
- * unless you call `update` method manually.
- * @method
- * @memberof Popper
- */
-function disableEventListeners() {
- if (this.state.eventsEnabled) {
- cancelAnimationFrame(this.scheduleUpdate);
- this.state = removeEventListeners(this.reference, this.state);
- }
-}
+ /* Add #text in case KEEP_CONTENT is set to true */
+ if (KEEP_CONTENT) {
+ ALLOWED_TAGS['#text'] = true;
+ }
-/**
- * Tells if a given input is a number
- * @method
- * @memberof Popper.Utils
- * @param {*} input to check
- * @return {Boolean}
- */
-function isNumeric(n) {
- return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
-}
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
+ if (WHOLE_DOCUMENT) {
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
+ }
-/**
- * Set the style to the given popper
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element - Element to apply the style to
- * @argument {Object} styles
- * Object with a list of properties and values which will be applied to the element
- */
-function setStyles(element, styles) {
- Object.keys(styles).forEach(function (prop) {
- var unit = '';
- // add unit if the value is numeric and is one of the following
- if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
- unit = 'px';
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286 */
+ if (ALLOWED_TAGS.table) {
+ addToSet(ALLOWED_TAGS, ['tbody']);
}
- element.style[prop] = styles[prop] + unit;
- });
-}
-/**
- * Set the attributes to the given popper
- * @method
- * @memberof Popper.Utils
- * @argument {Element} element - Element to apply the attributes to
- * @argument {Object} styles
- * Object with a list of properties and values which will be applied to the element
- */
-function setAttributes(element, attributes) {
- Object.keys(attributes).forEach(function (prop) {
- var value = attributes[prop];
- if (value !== false) {
- element.setAttribute(prop, attributes[prop]);
- } else {
- element.removeAttribute(prop);
+ // Prevent further manipulation of configuration.
+ // Not available in IE8, Safari 5, etc.
+ if (freeze) {
+ freeze(cfg);
}
- });
-}
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} data.styles - List of style properties - values to apply to popper element
- * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The same data object
- */
-function applyStyle(data) {
- // any property present in `data.styles` will be applied to the popper,
- // in this way we can make the 3rd party modifiers add custom styles to it
- // Be aware, modifiers could override the properties defined in the previous
- // lines of this modifier!
- setStyles(data.instance.popper, data.styles);
-
- // any property present in `data.attributes` will be applied to the popper,
- // they will be set as HTML attributes of the element
- setAttributes(data.instance.popper, data.attributes);
-
- // if arrowElement is defined and arrowStyles has some properties
- if (data.arrowElement && Object.keys(data.arrowStyles).length) {
- setStyles(data.arrowElement, data.arrowStyles);
- }
+ CONFIG = cfg;
+ };
- return data;
-}
+ /**
+ * _forceRemove
+ *
+ * @param {Node} node a DOM node
+ */
+ var _forceRemove = function _forceRemove(node) {
+ DOMPurify.removed.push({ element: node });
+ try {
+ node.parentNode.removeChild(node);
+ } catch (error) {
+ node.outerHTML = emptyHTML;
+ }
+ };
-/**
- * Set the x-placement attribute before everything else because it could be used
- * to add margins to the popper margins needs to be calculated to get the
- * correct popper offsets.
- * @method
- * @memberof Popper.modifiers
- * @param {HTMLElement} reference - The reference element used to position the popper
- * @param {HTMLElement} popper - The HTML element used as popper
- * @param {Object} options - Popper.js options
- */
-function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
- // compute reference element offsets
- var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
+ /**
+ * _removeAttribute
+ *
+ * @param {String} name an Attribute name
+ * @param {Node} node a DOM node
+ */
+ var _removeAttribute = function _removeAttribute(name, node) {
+ try {
+ DOMPurify.removed.push({
+ attribute: node.getAttributeNode(name),
+ from: node
+ });
+ } catch (error) {
+ DOMPurify.removed.push({
+ attribute: null,
+ from: node
+ });
+ }
- // compute auto placement, store placement inside the data object,
- // modifiers will be able to edit `placement` if needed
- // and refer to originalPlacement to know the original value
- var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
+ node.removeAttribute(name);
+ };
- popper.setAttribute('x-placement', placement);
+ /**
+ * _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;
- // Apply `position` to popper before anything else because
- // without the position applied we can't guarantee correct computations
- setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
+ if (FORCE_BODY) {
+ dirty = '<remove></remove>' + dirty;
+ } else {
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
+ var matches = dirty.match(/^[\s]+/);
+ leadingWhitespace = matches && matches[0];
+ if (leadingWhitespace) {
+ dirty = dirty.slice(leadingWhitespace.length);
+ }
+ }
- return options;
-}
+ /* Use DOMParser to workaround Firefox bug (see comment below) */
+ if (useDOMParser) {
+ try {
+ doc = new DOMParser().parseFromString(dirty, 'text/html');
+ } catch (error) {}
+ }
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
-function computeStyle(data, options) {
- var x = options.x,
- y = options.y;
- var popper = data.offsets.popper;
-
- // Remove this legacy support in Popper.js v2
-
- var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
- return modifier.name === 'applyStyle';
- }).gpuAcceleration;
- if (legacyGpuAccelerationOption !== undefined) {
- console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
- }
- var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
+ /* Remove title to fix a mXSS bug in older MS Edge */
+ if (removeTitle) {
+ addToSet(FORBID_TAGS, ['title']);
+ }
- var offsetParent = getOffsetParent(data.instance.popper);
- var offsetParentRect = getBoundingClientRect(offsetParent);
+ /* Otherwise use createHTMLDocument, because DOMParser is unsafe in
+ Safari (see comment below) */
+ if (!doc || !doc.documentElement) {
+ doc = implementation.createHTMLDocument('');
+ var _doc = doc,
+ body = _doc.body;
- // Styles
- var styles = {
- position: popper.position
- };
+ body.parentNode.removeChild(body.parentNode.firstElementChild);
+ body.outerHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
+ }
+
+ if (leadingWhitespace) {
+ doc.body.insertBefore(document.createTextNode(leadingWhitespace), doc.body.childNodes[0] || null);
+ }
- // Avoid blurry text by using full pixel integers.
- // For pixel-perfect positioning, top/bottom prefers rounded
- // values, while left/right prefers floored values.
- var offsets = {
- left: Math.floor(popper.left),
- top: Math.round(popper.top),
- bottom: Math.round(popper.bottom),
- right: Math.floor(popper.right)
+ /* Work on whole document or just its body */
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
};
- var sideA = x === 'bottom' ? 'top' : 'bottom';
- var sideB = y === 'right' ? 'left' : 'right';
-
- // if gpuAcceleration is set to `true` and transform is supported,
- // we use `translate3d` to apply the position to the popper we
- // automatically use the supported prefixed version if needed
- var prefixedProperty = getSupportedPropertyName('transform');
-
- // now, let's make a step back and look at this code closely (wtf?)
- // If the content of the popper grows once it's been positioned, it
- // may happen that the popper gets misplaced because of the new content
- // overflowing its reference element
- // To avoid this problem, we provide two options (x and y), which allow
- // the consumer to define the offset origin.
- // If we position a popper on top of a reference element, we can set
- // `x` to `top` to make the popper grow towards its top instead of
- // its bottom.
- var left = void 0,
- top = void 0;
- if (sideA === 'bottom') {
- top = -offsetParentRect.height + offsets.bottom;
- } else {
- top = offsets.top;
- }
- if (sideB === 'right') {
- left = -offsetParentRect.width + offsets.right;
- } else {
- left = offsets.left;
- }
- if (gpuAcceleration && prefixedProperty) {
- styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
- styles[sideA] = 0;
- styles[sideB] = 0;
- styles.willChange = 'transform';
- } else {
- // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
- var invertTop = sideA === 'bottom' ? -1 : 1;
- var invertLeft = sideB === 'right' ? -1 : 1;
- styles[sideA] = top * invertTop;
- styles[sideB] = left * invertLeft;
- styles.willChange = sideA + ', ' + sideB;
+ // Firefox uses a different parser for innerHTML rather than
+ // DOMParser (see https://bugzilla.mozilla.org/show_bug.cgi?id=1205631)
+ // which means that you *must* use DOMParser, otherwise the output may
+ // not be safe if used in a document.write context later.
+ //
+ // So we feature detect the Firefox bug and use the DOMParser if necessary.
+ //
+ // MS Edge, in older versions, is affected by an mXSS behavior. The second
+ // check tests for the behavior and fixes it if necessary.
+ if (DOMPurify.isSupported) {
+ (function () {
+ try {
+ var doc = _initDocument('<svg><p><style><img src="</style><img src=x onerror=1//">');
+ if (doc.querySelector('svg img')) {
+ useDOMParser = true;
+ }
+ } catch (error) {}
+ })();
+
+ (function () {
+ try {
+ var doc = _initDocument('<x/><title>&lt;/title&gt;&lt;img&gt;');
+ if (doc.querySelector('title').innerHTML.match(/<\/title/)) {
+ removeTitle = true;
+ }
+ } catch (error) {}
+ })();
}
- // Attributes
- var attributes = {
- 'x-placement': data.placement
+ /**
+ * _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, function () {
+ return NodeFilter.FILTER_ACCEPT;
+ }, false);
};
- // Update `data` attributes, styles and arrowStyles
- data.attributes = _extends({}, attributes, data.attributes);
- data.styles = _extends({}, styles, data.styles);
- data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
-
- return data;
-}
+ /**
+ * _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;
+ }
-/**
- * Helper used to know if the given modifier depends from another one.<br />
- * It checks if the needed modifier is listed and enabled.
- * @method
- * @memberof Popper.Utils
- * @param {Array} modifiers - list of modifiers
- * @param {String} requestingName - name of requesting modifier
- * @param {String} requestedName - name of requested modifier
- * @returns {Boolean}
- */
-function isModifierRequired(modifiers, requestingName, requestedName) {
- var requesting = find(modifiers, function (_ref) {
- var name = _ref.name;
- return name === requestingName;
- });
+ 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') {
+ return true;
+ }
- var isRequired = !!requesting && modifiers.some(function (modifier) {
- return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
- });
+ return false;
+ };
- if (!isRequired) {
- var _requesting = '`' + requestingName + '`';
- var requested = '`' + requestedName + '`';
- console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
- }
- return isRequired;
-}
+ /**
+ * _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(obj) {
+ return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? obj instanceof Node : obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string';
+ };
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
-function arrow(data, options) {
- var _data$offsets$arrow;
+ /**
+ * _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;
+ }
- // arrow depends on keepTogether in order to work
- if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
- return data;
- }
+ hooks[entryPoint].forEach(function (hook) {
+ hook.call(DOMPurify, currentNode, data, CONFIG);
+ });
+ };
- var arrowElement = options.element;
+ /**
+ * _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
+ */
+ // eslint-disable-next-line complexity
+ var _sanitizeElements = function _sanitizeElements(currentNode) {
+ var content = void 0;
- // if arrowElement is a string, suppose it's a CSS selector
- if (typeof arrowElement === 'string') {
- arrowElement = data.instance.popper.querySelector(arrowElement);
+ /* Execute a hook if present */
+ _executeHook('beforeSanitizeElements', currentNode, null);
- // if arrowElement is not found, don't run the modifier
- if (!arrowElement) {
- return data;
- }
- } else {
- // if the arrowElement isn't a query selector we must check that the
- // provided DOM node is child of its popper node
- if (!data.instance.popper.contains(arrowElement)) {
- console.warn('WARNING: `arrow.element` must be child of its popper element!');
- return data;
+ /* Check if element is clobbered or can clobber */
+ if (_isClobbered(currentNode)) {
+ _forceRemove(currentNode);
+ return true;
}
- }
-
- var placement = data.placement.split('-')[0];
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
- var isVertical = ['left', 'right'].indexOf(placement) !== -1;
+ /* Now let's check the element's type and name */
+ var tagName = currentNode.nodeName.toLowerCase();
- var len = isVertical ? 'height' : 'width';
- var sideCapitalized = isVertical ? 'Top' : 'Left';
- var side = sideCapitalized.toLowerCase();
- var altSide = isVertical ? 'left' : 'top';
- var opSide = isVertical ? 'bottom' : 'right';
- var arrowElementSize = getOuterSizes(arrowElement)[len];
+ /* Execute a hook if present */
+ _executeHook('uponSanitizeElement', currentNode, {
+ tagName: tagName,
+ allowedTags: ALLOWED_TAGS
+ });
- //
- // extends keepTogether behavior making sure the popper and its
- // reference have enough pixels in conjuction
- //
+ /* Remove element if anything forbids its presence */
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
+ /* Keep content except for black-listed elements */
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName] && typeof currentNode.insertAdjacentHTML === 'function') {
+ try {
+ var htmlToInsert = currentNode.innerHTML;
+ currentNode.insertAdjacentHTML('AfterEnd', trustedTypesPolicy ? trustedTypesPolicy.createHTML(htmlToInsert) : htmlToInsert);
+ } catch (error) {}
+ }
- // top/left side
- if (reference[opSide] - arrowElementSize < popper[side]) {
- data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
- }
- // bottom/right side
- if (reference[side] + arrowElementSize > popper[opSide]) {
- data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
- }
- data.offsets.popper = getClientRect(data.offsets.popper);
+ _forceRemove(currentNode);
+ return true;
+ }
- // compute center of the popper
- var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
+ /* Remove in case a noscript/noembed XSS is suspected */
+ if (tagName === 'noscript' && currentNode.innerHTML.match(/<\/noscript/i)) {
+ _forceRemove(currentNode);
+ return true;
+ }
- // Compute the sideValue using the updated popper offsets
- // take popper margin in account because we don't have this info available
- var css = getStyleComputedProperty(data.instance.popper);
- var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
- var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
- var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
+ if (tagName === 'noembed' && currentNode.innerHTML.match(/<\/noembed/i)) {
+ _forceRemove(currentNode);
+ return true;
+ }
- // prevent arrowElement from being placed not contiguously to its popper
- sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
+ /* Convert markup to cover jQuery behavior */
+ if (SAFE_FOR_JQUERY && !currentNode.firstElementChild && (!currentNode.content || !currentNode.content.firstElementChild) && /</g.test(currentNode.textContent)) {
+ DOMPurify.removed.push({ element: currentNode.cloneNode() });
+ if (currentNode.innerHTML) {
+ currentNode.innerHTML = currentNode.innerHTML.replace(/</g, '&lt;');
+ } else {
+ currentNode.innerHTML = currentNode.textContent.replace(/</g, '&lt;');
+ }
+ }
- data.arrowElement = arrowElement;
- data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
+ /* Sanitize element content to be template-safe */
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
+ /* Get the element's text content */
+ content = currentNode.textContent;
+ content = content.replace(MUSTACHE_EXPR$$1, ' ');
+ content = content.replace(ERB_EXPR$$1, ' ');
+ if (currentNode.textContent !== content) {
+ DOMPurify.removed.push({ element: currentNode.cloneNode() });
+ currentNode.textContent = content;
+ }
+ }
- return data;
-}
+ /* Execute a hook if present */
+ _executeHook('afterSanitizeElements', currentNode, null);
-/**
- * Get the opposite placement variation of the given one
- * @method
- * @memberof Popper.Utils
- * @argument {String} placement variation
- * @returns {String} flipped placement variation
- */
-function getOppositeVariation(variation) {
- if (variation === 'end') {
- return 'start';
- } else if (variation === 'start') {
- return 'end';
- }
- return variation;
-}
+ return false;
+ };
-/**
- * List of accepted placements to use as values of the `placement` option.<br />
- * Valid placements are:
- * - `auto`
- * - `top`
- * - `right`
- * - `bottom`
- * - `left`
- *
- * Each placement can have a variation from this list:
- * - `-start`
- * - `-end`
- *
- * Variations are interpreted easily if you think of them as the left to right
- * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
- * is right.<br />
- * Vertically (`left` and `right`), `start` is top and `end` is bottom.
- *
- * Some valid examples are:
- * - `top-end` (on top of reference, right aligned)
- * - `right-start` (on right of reference, top aligned)
- * - `bottom` (on bottom, centered)
- * - `auto-right` (on the side with more space available, alignment depends by placement)
- *
- * @static
- * @type {Array}
- * @enum {String}
- * @readonly
- * @method placements
- * @memberof Popper
- */
-var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
+ /**
+ * _isValidAttribute
+ *
+ * @param {string} lcTag Lowercase tag name of containing element.
+ * @param {string} lcName Lowercase attribute name.
+ * @param {string} value Attribute value.
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
+ */
+ // eslint-disable-next-line complexity
+ var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
+ /* Make sure attribute cannot clobber */
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
+ return false;
+ }
-// Get rid of `auto` `auto-start` and `auto-end`
-var validPlacements = placements.slice(3);
+ /* Allow valid data-* attributes: At least one character after "-"
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
+ We don't need to check the value; it's always URI safe. */
+ if (ALLOW_DATA_ATTR && DATA_ATTR$$1.test(lcName)) {
+ // This attribute is safe
+ } else if (ALLOW_ARIA_ATTR && ARIA_ATTR$$1.test(lcName)) {
+ // This attribute is safe
+ /* Otherwise, check the name is permitted */
+ } else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
+ return false;
+
+ /* Check value is safe. First, is attr inert? If so, is safe */
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) {
+ // This attribute is safe
+ /* Check no script, data or unknown possibly unsafe URI
+ unless we know URI values are safe for that attribute */
+ } else if (IS_ALLOWED_URI$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) {
+ // This attribute is safe
+ /* Keep image data URIs alive if src/xlink:href is allowed */
+ /* Further prevent gadget XSS for dynamically built script tags */
+ } else if ((lcName === 'src' || lcName === 'xlink:href') && lcTag !== 'script' && value.indexOf('data:') === 0 && DATA_URI_TAGS[lcTag]) {
+ // This attribute is safe
+ /* Allow unknown protocols: This provides support for links that
+ are handled by protocol handlers which may be unknown ahead of
+ time, e.g. fb:, spotify: */
+ } else if (ALLOW_UNKNOWN_PROTOCOLS && !IS_SCRIPT_OR_DATA$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) {
+ // This attribute is safe
+ /* Check for binary attributes */
+ // eslint-disable-next-line no-negated-condition
+ } else if (!value) {
+ // Binary attributes are safe at this point
+ /* Anything else, presume unsafe, do not add it back */
+ } else {
+ return false;
+ }
-/**
- * Given an initial placement, returns all the subsequent placements
- * clockwise (or counter-clockwise).
- *
- * @method
- * @memberof Popper.Utils
- * @argument {String} placement - A valid placement (it accepts variations)
- * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
- * @returns {Array} placements including their variations
- */
-function clockwise(placement) {
- var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ return true;
+ };
- var index = validPlacements.indexOf(placement);
- var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
- return counter ? arr.reverse() : arr;
-}
+ /**
+ * _sanitizeAttributes
+ *
+ * @protect attributes
+ * @protect nodeName
+ * @protect removeAttribute
+ * @protect setAttribute
+ *
+ * @param {Node} currentNode to sanitize
+ */
+ var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
+ var attr = void 0;
+ var value = void 0;
+ var lcName = void 0;
+ var idAttr = void 0;
+ var l = void 0;
+ /* Execute a hook if present */
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
-var BEHAVIORS = {
- FLIP: 'flip',
- CLOCKWISE: 'clockwise',
- COUNTERCLOCKWISE: 'counterclockwise'
-};
+ var attributes = currentNode.attributes;
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
-function flip(data, options) {
- // if `inner` modifier is enabled, we can't use the `flip` modifier
- if (isModifierEnabled(data.instance.modifiers, 'inner')) {
- return data;
- }
+ /* Check if we have attributes; if not we might have a text node */
- if (data.flipped && data.placement === data.originalPlacement) {
- // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
- return data;
- }
+ if (!attributes) {
+ return;
+ }
- var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
+ var hookEvent = {
+ attrName: '',
+ attrValue: '',
+ keepAttr: true,
+ allowedAttributes: ALLOWED_ATTR
+ };
+ l = attributes.length;
+
+ /* Go backwards over all attributes; safely remove bad ones */
+ while (l--) {
+ attr = attributes[l];
+ var _attr = attr,
+ name = _attr.name,
+ namespaceURI = _attr.namespaceURI;
+
+ value = attr.value.trim();
+ lcName = name.toLowerCase();
+
+ /* Execute a hook if present */
+ hookEvent.attrName = lcName;
+ hookEvent.attrValue = value;
+ hookEvent.keepAttr = true;
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
+ value = hookEvent.attrValue;
+
+ /* Remove attribute */
+ // Safari (iOS + Mac), last tested v8.0.5, crashes if you try to
+ // remove a "name" attribute from an <img> tag that has an "id"
+ // attribute at the time.
+ if (lcName === 'name' && currentNode.nodeName === 'IMG' && attributes.id) {
+ idAttr = attributes.id;
+ attributes = apply(arraySlice, attributes, []);
+ _removeAttribute('id', currentNode);
+ _removeAttribute(name, currentNode);
+ if (attributes.indexOf(idAttr) > l) {
+ currentNode.setAttribute('id', idAttr.value);
+ }
+ } else if (
+ // This works around a bug in Safari, where input[type=file]
+ // cannot be dynamically set after type has been removed
+ currentNode.nodeName === 'INPUT' && lcName === 'type' && value === 'file' && (ALLOWED_ATTR[lcName] || !FORBID_ATTR[lcName])) {
+ continue;
+ } else {
+ // This avoids a crash in Safari v9.0 with double-ids.
+ // The trick is to first set the id to be empty and then to
+ // remove the attribute
+ if (name === 'id') {
+ currentNode.setAttribute(name, '');
+ }
+
+ _removeAttribute(name, currentNode);
+ }
- var placement = data.placement.split('-')[0];
- var placementOpposite = getOppositePlacement(placement);
- var variation = data.placement.split('-')[1] || '';
+ /* Did the hooks approve of the attribute? */
+ if (!hookEvent.keepAttr) {
+ continue;
+ }
- var flipOrder = [];
+ /* Sanitize attribute content to be template-safe */
+ if (SAFE_FOR_TEMPLATES) {
+ value = value.replace(MUSTACHE_EXPR$$1, ' ');
+ value = value.replace(ERB_EXPR$$1, ' ');
+ }
- switch (options.behavior) {
- case BEHAVIORS.FLIP:
- flipOrder = [placement, placementOpposite];
- break;
- case BEHAVIORS.CLOCKWISE:
- flipOrder = clockwise(placement);
- break;
- case BEHAVIORS.COUNTERCLOCKWISE:
- flipOrder = clockwise(placement, true);
- break;
- default:
- flipOrder = options.behavior;
- }
+ /* Is `value` valid for this attribute? */
+ var lcTag = currentNode.nodeName.toLowerCase();
+ if (!_isValidAttribute(lcTag, lcName, value)) {
+ continue;
+ }
- flipOrder.forEach(function (step, index) {
- if (placement !== step || flipOrder.length === index + 1) {
- return data;
+ /* Handle invalid data-* attribute set by try-catching it */
+ try {
+ if (namespaceURI) {
+ currentNode.setAttributeNS(namespaceURI, name, value);
+ } else {
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
+ currentNode.setAttribute(name, value);
+ }
+
+ DOMPurify.removed.pop();
+ } catch (error) {}
}
- placement = data.placement.split('-')[0];
- placementOpposite = getOppositePlacement(placement);
-
- var popperOffsets = data.offsets.popper;
- var refOffsets = data.offsets.reference;
-
- // using floor because the reference offsets may contain decimals we are not going to consider here
- var floor = Math.floor;
- var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
-
- var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
- var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
- var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
- var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
+ /* Execute a hook if present */
+ _executeHook('afterSanitizeAttributes', currentNode, null);
+ };
- var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
+ /**
+ * _sanitizeShadowDOM
+ *
+ * @param {DocumentFragment} fragment to iterate over recursively
+ */
+ var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
+ var shadowNode = void 0;
+ var shadowIterator = _createIterator(fragment);
- // flip the variation if required
- var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
- var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
+ /* Execute a hook if present */
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
- if (overlapsRef || overflowsBoundaries || flippedVariation) {
- // this boolean to detect any flip loop
- data.flipped = true;
+ while (shadowNode = shadowIterator.nextNode()) {
+ /* Execute a hook if present */
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
- if (overlapsRef || overflowsBoundaries) {
- placement = flipOrder[index + 1];
+ /* Sanitize tags and elements */
+ if (_sanitizeElements(shadowNode)) {
+ continue;
}
- if (flippedVariation) {
- variation = getOppositeVariation(variation);
+ /* Deep shadow DOM detected */
+ if (shadowNode.content instanceof DocumentFragment) {
+ _sanitizeShadowDOM(shadowNode.content);
}
- data.placement = placement + (variation ? '-' + variation : '');
+ /* Check attributes, sanitize if necessary */
+ _sanitizeAttributes(shadowNode);
+ }
- // this object contains `position`, we want to preserve it along with
- // any additional property we may add in the future
- data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
+ /* Execute a hook if present */
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
+ };
- data = runModifiers(data.instance.modifiers, data, 'flip');
+ /**
+ * Sanitize
+ * Public method providing core sanitation functionality
+ *
+ * @param {String|Node} dirty string or DOM node
+ * @param {Object} configuration object
+ */
+ // eslint-disable-next-line complexity
+ DOMPurify.sanitize = function (dirty, cfg) {
+ var body = void 0;
+ var importedNode = void 0;
+ var currentNode = void 0;
+ var oldNode = void 0;
+ var returnNode = void 0;
+ /* Make sure we have a string to sanitize.
+ DO NOT return early, as this will return the wrong type if
+ the user has requested a DOM object rather than a string */
+ if (!dirty) {
+ dirty = '<!-->';
}
- });
- return data;
-}
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
-function keepTogether(data) {
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
-
- var placement = data.placement.split('-')[0];
- var floor = Math.floor;
- var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
- var side = isVertical ? 'right' : 'bottom';
- var opSide = isVertical ? 'left' : 'top';
- var measurement = isVertical ? 'width' : 'height';
-
- if (popper[side] < floor(reference[opSide])) {
- data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
- }
- if (popper[opSide] > floor(reference[side])) {
- data.offsets.popper[opSide] = floor(reference[side]);
- }
+ /* Stringify, in case dirty is an object */
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
+ // eslint-disable-next-line no-negated-condition
+ if (typeof dirty.toString !== 'function') {
+ throw new TypeError('toString is not a function');
+ } else {
+ dirty = dirty.toString();
+ if (typeof dirty !== 'string') {
+ throw new TypeError('dirty is not a string, aborting');
+ }
+ }
+ }
- return data;
-}
+ /* Check we can run. Otherwise fall back or ignore */
+ if (!DOMPurify.isSupported) {
+ if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
+ if (typeof dirty === 'string') {
+ return window.toStaticHTML(dirty);
+ }
-/**
- * Converts a string containing value + unit into a px value number
- * @function
- * @memberof {modifiers~offset}
- * @private
- * @argument {String} str - Value + unit string
- * @argument {String} measurement - `height` or `width`
- * @argument {Object} popperOffsets
- * @argument {Object} referenceOffsets
- * @returns {Number|String}
- * Value in pixels, or original string if no values were extracted
- */
-function toValue(str, measurement, popperOffsets, referenceOffsets) {
- // separate value from unit
- var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
- var value = +split[1];
- var unit = split[2];
-
- // If it's not a number it's an operator, I guess
- if (!value) {
- return str;
- }
+ if (_isNode(dirty)) {
+ return window.toStaticHTML(dirty.outerHTML);
+ }
+ }
- if (unit.indexOf('%') === 0) {
- var element = void 0;
- switch (unit) {
- case '%p':
- element = popperOffsets;
- break;
- case '%':
- case '%r':
- default:
- element = referenceOffsets;
+ return dirty;
}
- var rect = getClientRect(element);
- return rect[measurement] / 100 * value;
- } else if (unit === 'vh' || unit === 'vw') {
- // if is a vh or vw, we calculate the size based on the viewport
- var size = void 0;
- if (unit === 'vh') {
- size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
- } else {
- size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
+ /* Assign config vars */
+ if (!SET_CONFIG) {
+ _parseConfig(cfg);
}
- return size / 100 * value;
- } else {
- // if is an explicit pixel unit, we get rid of the unit and keep the value
- // if is an implicit unit, it's px, and we return just the value
- return value;
- }
-}
-
-/**
- * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
- * @function
- * @memberof {modifiers~offset}
- * @private
- * @argument {String} offset
- * @argument {Object} popperOffsets
- * @argument {Object} referenceOffsets
- * @argument {String} basePlacement
- * @returns {Array} a two cells array with x and y offsets in numbers
- */
-function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
- var offsets = [0, 0];
-
- // Use height if placement is left or right and index is 0 otherwise use width
- // in this way the first offset will use an axis and the second one
- // will use the other one
- var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
-
- // Split the offset string to obtain a list of values and operands
- // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
- var fragments = offset.split(/(\+|\-)/).map(function (frag) {
- return frag.trim();
- });
-
- // Detect if the offset string contains a pair of values or a single one
- // they could be separated by comma or space
- var divider = fragments.indexOf(find(fragments, function (frag) {
- return frag.search(/,|\s/) !== -1;
- }));
- if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
- console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
- }
-
- // If divider is found, we divide the list of values and operands to divide
- // them by ofset X and Y.
- var splitRegex = /\s*,\s*|\s+/;
- var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
-
- // Convert the values with units to absolute pixels to allow our computations
- ops = ops.map(function (op, index) {
- // Most of the units rely on the orientation of the popper
- var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
- var mergeWithPrevious = false;
- return op
- // This aggregates any `+` or `-` sign that aren't considered operators
- // e.g.: 10 + +5 => [10, +, +5]
- .reduce(function (a, b) {
- if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
- a[a.length - 1] = b;
- mergeWithPrevious = true;
- return a;
- } else if (mergeWithPrevious) {
- a[a.length - 1] += b;
- mergeWithPrevious = false;
- return a;
+ /* Clean up removed elements */
+ DOMPurify.removed = [];
+
+ if (IN_PLACE) {
+ /* No special handling necessary for in-place sanitization */
+ } else if (dirty instanceof Node) {
+ /* If dirty is a DOM element, append to an empty document to avoid
+ elements being stripped by the parser */
+ body = _initDocument('<!-->');
+ importedNode = body.ownerDocument.importNode(dirty, true);
+ if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
+ /* Node is already a body, use as is */
+ body = importedNode;
} else {
- return a.concat(b);
+ // eslint-disable-next-line unicorn/prefer-node-append
+ body.appendChild(importedNode);
}
- }, [])
- // Here we convert the string values into number values (in px)
- .map(function (str) {
- return toValue(str, measurement, popperOffsets, referenceOffsets);
- });
- });
-
- // Loop trough the offsets arrays and execute the operations
- ops.forEach(function (op, index) {
- op.forEach(function (frag, index2) {
- if (isNumeric(frag)) {
- offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
+ } else {
+ /* Exit directly if we have nothing to do */
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf('<') === -1) {
+ return trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
}
- });
- });
- return offsets;
-}
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @argument {Number|String} options.offset=0
- * The offset value as described in the modifier description
- * @returns {Object} The data object, properly modified
- */
-function offset(data, _ref) {
- var offset = _ref.offset;
- var placement = data.placement,
- _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
-
- var basePlacement = placement.split('-')[0];
-
- var offsets = void 0;
- if (isNumeric(+offset)) {
- offsets = [+offset, 0];
- } else {
- offsets = parseOffset(offset, popper, reference, basePlacement);
- }
-
- if (basePlacement === 'left') {
- popper.top += offsets[0];
- popper.left -= offsets[1];
- } else if (basePlacement === 'right') {
- popper.top += offsets[0];
- popper.left += offsets[1];
- } else if (basePlacement === 'top') {
- popper.left += offsets[0];
- popper.top -= offsets[1];
- } else if (basePlacement === 'bottom') {
- popper.left += offsets[0];
- popper.top += offsets[1];
- }
-
- data.popper = popper;
- return data;
-}
+ /* Initialize the document to work on */
+ body = _initDocument(dirty);
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
-function preventOverflow(data, options) {
- var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
-
- // If offsetParent is the reference element, we really want to
- // go one step up and use the next offsetParent as reference to
- // avoid to make this modifier completely useless and look like broken
- if (data.instance.reference === boundariesElement) {
- boundariesElement = getOffsetParent(boundariesElement);
- }
-
- // NOTE: DOM access here
- // resets the popper's position so that the document size can be calculated excluding
- // the size of the popper element itself
- var transformProp = getSupportedPropertyName('transform');
- var popperStyles = data.instance.popper.style; // assignment to help minification
- var top = popperStyles.top,
- left = popperStyles.left,
- transform = popperStyles[transformProp];
-
- popperStyles.top = '';
- popperStyles.left = '';
- popperStyles[transformProp] = '';
-
- var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
-
- // NOTE: DOM access here
- // restores the original style properties after the offsets have been computed
- popperStyles.top = top;
- popperStyles.left = left;
- popperStyles[transformProp] = transform;
-
- options.boundaries = boundaries;
-
- var order = options.priority;
- var popper = data.offsets.popper;
-
- var check = {
- primary: function primary(placement) {
- var value = popper[placement];
- if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
- value = Math.max(popper[placement], boundaries[placement]);
+ /* Check we have a DOM node from the data */
+ if (!body) {
+ return RETURN_DOM ? null : emptyHTML;
}
- return defineProperty({}, placement, value);
- },
- secondary: function secondary(placement) {
- var mainSide = placement === 'right' ? 'left' : 'top';
- var value = popper[mainSide];
- if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
- value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
- }
- return defineProperty({}, mainSide, value);
}
- };
-
- order.forEach(function (placement) {
- var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
- popper = _extends({}, popper, check[side](placement));
- });
-
- data.offsets.popper = popper;
-
- return data;
-}
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
-function shift(data) {
- var placement = data.placement;
- var basePlacement = placement.split('-')[0];
- var shiftvariation = placement.split('-')[1];
-
- // if shift shiftvariation is specified, run the modifier
- if (shiftvariation) {
- var _data$offsets = data.offsets,
- reference = _data$offsets.reference,
- popper = _data$offsets.popper;
-
- var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
- var side = isVertical ? 'left' : 'top';
- var measurement = isVertical ? 'width' : 'height';
-
- var shiftOffsets = {
- start: defineProperty({}, side, reference[side]),
- end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
- };
+ /* Remove first element node (ours) if FORCE_BODY is set */
+ if (body && FORCE_BODY) {
+ _forceRemove(body.firstChild);
+ }
- data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
- }
+ /* Get node iterator */
+ var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
- return data;
-}
+ /* Now start iterating over the created document */
+ while (currentNode = nodeIterator.nextNode()) {
+ /* Fix IE's strange behavior with manipulated textNodes #89 */
+ if (currentNode.nodeType === 3 && currentNode === oldNode) {
+ continue;
+ }
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by update method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
-function hide(data) {
- if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
- return data;
- }
+ /* Sanitize tags and elements */
+ if (_sanitizeElements(currentNode)) {
+ continue;
+ }
- var refRect = data.offsets.reference;
- var bound = find(data.instance.modifiers, function (modifier) {
- return modifier.name === 'preventOverflow';
- }).boundaries;
+ /* Shadow DOM detected, sanitize it */
+ if (currentNode.content instanceof DocumentFragment) {
+ _sanitizeShadowDOM(currentNode.content);
+ }
- if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
- // Avoid unnecessary DOM access if visibility hasn't changed
- if (data.hide === true) {
- return data;
- }
+ /* Check attributes, sanitize if necessary */
+ _sanitizeAttributes(currentNode);
- data.hide = true;
- data.attributes['x-out-of-boundaries'] = '';
- } else {
- // Avoid unnecessary DOM access if visibility hasn't changed
- if (data.hide === false) {
- return data;
+ oldNode = currentNode;
}
- data.hide = false;
- data.attributes['x-out-of-boundaries'] = false;
- }
-
- return data;
-}
+ oldNode = null;
-/**
- * @function
- * @memberof Modifiers
- * @argument {Object} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {Object} The data object, properly modified
- */
-function inner(data) {
- var placement = data.placement;
- var basePlacement = placement.split('-')[0];
- var _data$offsets = data.offsets,
- popper = _data$offsets.popper,
- reference = _data$offsets.reference;
+ /* If we sanitized `dirty` in-place, return it. */
+ if (IN_PLACE) {
+ return dirty;
+ }
- var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
+ /* Return sanitized string or DOM */
+ if (RETURN_DOM) {
+ if (RETURN_DOM_FRAGMENT) {
+ returnNode = createDocumentFragment.call(body.ownerDocument);
- var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
+ while (body.firstChild) {
+ // eslint-disable-next-line unicorn/prefer-node-append
+ returnNode.appendChild(body.firstChild);
+ }
+ } else {
+ returnNode = body;
+ }
- popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
+ if (RETURN_DOM_IMPORT) {
+ /* AdoptNode() is not used because internal state is not reset
+ (e.g. the past names map of a HTMLFormElement), this is safe
+ in theory but we would rather not risk another attack vector.
+ The state that is cloned by importNode() is explicitly defined
+ by the specs. */
+ returnNode = importNode.call(originalDocument, returnNode, true);
+ }
- data.placement = getOppositePlacement(placement);
- data.offsets.popper = getClientRect(popper);
+ return returnNode;
+ }
- return data;
-}
+ var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
-/**
- * Modifier function, each modifier can have a function of this type assigned
- * to its `fn` property.<br />
- * These functions will be called on each update, this means that you must
- * make sure they are performant enough to avoid performance bottlenecks.
- *
- * @function ModifierFn
- * @argument {dataObject} data - The data object generated by `update` method
- * @argument {Object} options - Modifiers configuration and options
- * @returns {dataObject} The data object, properly modified
- */
+ /* Sanitize final string template-safe */
+ if (SAFE_FOR_TEMPLATES) {
+ serializedHTML = serializedHTML.replace(MUSTACHE_EXPR$$1, ' ');
+ serializedHTML = serializedHTML.replace(ERB_EXPR$$1, ' ');
+ }
-/**
- * Modifiers are plugins used to alter the behavior of your poppers.<br />
- * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
- * needed by the library.
- *
- * Usually you don't want to override the `order`, `fn` and `onLoad` props.
- * All the other properties are configurations that could be tweaked.
- * @namespace modifiers
- */
-var modifiers = {
- /**
- * Modifier used to shift the popper on the start or end of its reference
- * element.<br />
- * It will read the variation of the `placement` property.<br />
- * It can be one either `-end` or `-start`.
- * @memberof modifiers
- * @inner
- */
- shift: {
- /** @prop {number} order=100 - Index used to define the order of execution */
- order: 100,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: shift
- },
+ return trustedTypesPolicy ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
+ };
/**
- * The `offset` modifier can shift your popper on both its axis.
- *
- * It accepts the following units:
- * - `px` or unitless, interpreted as pixels
- * - `%` or `%r`, percentage relative to the length of the reference element
- * - `%p`, percentage relative to the length of the popper element
- * - `vw`, CSS viewport width unit
- * - `vh`, CSS viewport height unit
- *
- * For length is intended the main axis relative to the placement of the popper.<br />
- * This means that if the placement is `top` or `bottom`, the length will be the
- * `width`. In case of `left` or `right`, it will be the height.
- *
- * You can provide a single value (as `Number` or `String`), or a pair of values
- * as `String` divided by a comma or one (or more) white spaces.<br />
- * The latter is a deprecated method because it leads to confusion and will be
- * removed in v2.<br />
- * Additionally, it accepts additions and subtractions between different units.
- * Note that multiplications and divisions aren't supported.
- *
- * Valid examples are:
- * ```
- * 10
- * '10%'
- * '10, 10'
- * '10%, 10'
- * '10 + 10%'
- * '10 - 5vh + 3%'
- * '-10px + 5vh, 5px - 6%'
- * ```
- * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
- * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
- * > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373)
+ * Public method to set the configuration once
+ * setConfig
*
- * @memberof modifiers
- * @inner
+ * @param {Object} cfg configuration object
*/
- offset: {
- /** @prop {number} order=200 - Index used to define the order of execution */
- order: 200,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: offset,
- /** @prop {Number|String} offset=0
- * The offset value as described in the modifier description
- */
- offset: 0
- },
+ DOMPurify.setConfig = function (cfg) {
+ _parseConfig(cfg);
+ SET_CONFIG = true;
+ };
/**
- * Modifier used to prevent the popper from being positioned outside the boundary.
- *
- * An scenario exists where the reference itself is not within the boundaries.<br />
- * We can say it has "escaped the boundaries" — or just "escaped".<br />
- * In this case we need to decide whether the popper should either:
- *
- * - detach from the reference and remain "trapped" in the boundaries, or
- * - if it should ignore the boundary and "escape with its reference"
+ * Public method to remove the configuration
+ * clearConfig
*
- * When `escapeWithReference` is set to`true` and reference is completely
- * outside its boundaries, the popper will overflow (or completely leave)
- * the boundaries in order to remain attached to the edge of the reference.
- *
- * @memberof modifiers
- * @inner
- */
- preventOverflow: {
- /** @prop {number} order=300 - Index used to define the order of execution */
- order: 300,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: preventOverflow,
- /**
- * @prop {Array} [priority=['left','right','top','bottom']]
- * Popper will try to prevent overflow following these priorities by default,
- * then, it could overflow on the left and on top of the `boundariesElement`
- */
- priority: ['left', 'right', 'top', 'bottom'],
- /**
- * @prop {number} padding=5
- * Amount of pixel used to define a minimum distance between the boundaries
- * and the popper this makes sure the popper has always a little padding
- * between the edges of its container
- */
- padding: 5,
- /**
- * @prop {String|HTMLElement} boundariesElement='scrollParent'
- * Boundaries used by the modifier, can be `scrollParent`, `window`,
- * `viewport` or any DOM element.
- */
- boundariesElement: 'scrollParent'
- },
-
- /**
- * Modifier used to make sure the reference and its popper stay near eachothers
- * without leaving any gap between the two. Expecially useful when the arrow is
- * enabled and you want to assure it to point to its reference element.
- * It cares only about the first axis, you can still have poppers with margin
- * between the popper and its reference element.
- * @memberof modifiers
- * @inner
*/
- keepTogether: {
- /** @prop {number} order=400 - Index used to define the order of execution */
- order: 400,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: keepTogether
- },
+ DOMPurify.clearConfig = function () {
+ CONFIG = null;
+ SET_CONFIG = false;
+ };
/**
- * This modifier is used to move the `arrowElement` of the popper to make
- * sure it is positioned between the reference element and its popper element.
- * It will read the outer size of the `arrowElement` node to detect how many
- * pixels of conjuction are needed.
+ * Public method to check if an attribute value is valid.
+ * Uses last set config, if any. Otherwise, uses config defaults.
+ * isValidAttribute
*
- * It has no effect if no `arrowElement` is provided.
- * @memberof modifiers
- * @inner
+ * @param {string} tag Tag name of containing element.
+ * @param {string} attr Attribute name.
+ * @param {string} value Attribute value.
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
*/
- arrow: {
- /** @prop {number} order=500 - Index used to define the order of execution */
- order: 500,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: arrow,
- /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
- element: '[x-arrow]'
- },
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
+ /* Initialize shared config vars if necessary. */
+ if (!CONFIG) {
+ _parseConfig({});
+ }
+
+ var lcTag = tag.toLowerCase();
+ var lcName = attr.toLowerCase();
+ return _isValidAttribute(lcTag, lcName, value);
+ };
/**
- * Modifier used to flip the popper's placement when it starts to overlap its
- * reference element.
- *
- * Requires the `preventOverflow` modifier before it in order to work.
+ * AddHook
+ * Public method to add DOMPurify hooks
*
- * **NOTE:** this modifier will interrupt the current update cycle and will
- * restart it if it detects the need to flip the placement.
- * @memberof modifiers
- * @inner
+ * @param {String} entryPoint entry point for the hook to add
+ * @param {Function} hookFunction function to execute
*/
- flip: {
- /** @prop {number} order=600 - Index used to define the order of execution */
- order: 600,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: flip,
- /**
- * @prop {String|Array} behavior='flip'
- * The behavior used to change the popper's placement. It can be one of
- * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
- * placements (with optional variations).
- */
- behavior: 'flip',
- /**
- * @prop {number} padding=5
- * The popper will flip if it hits the edges of the `boundariesElement`
- */
- padding: 5,
- /**
- * @prop {String|HTMLElement} boundariesElement='viewport'
- * The element which will define the boundaries of the popper position,
- * the popper will never be placed outside of the defined boundaries
- * (except if keepTogether is enabled)
- */
- boundariesElement: 'viewport'
- },
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
+ if (typeof hookFunction !== 'function') {
+ return;
+ }
- /**
- * Modifier used to make the popper flow toward the inner of the reference element.
- * By default, when this modifier is disabled, the popper will be placed outside
- * the reference element.
- * @memberof modifiers
- * @inner
- */
- inner: {
- /** @prop {number} order=700 - Index used to define the order of execution */
- order: 700,
- /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
- enabled: false,
- /** @prop {ModifierFn} */
- fn: inner
- },
+ hooks[entryPoint] = hooks[entryPoint] || [];
+ hooks[entryPoint].push(hookFunction);
+ };
/**
- * Modifier used to hide the popper when its reference element is outside of the
- * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
- * be used to hide with a CSS selector the popper when its reference is
- * out of boundaries.
+ * RemoveHook
+ * Public method to remove a DOMPurify hook at a given entryPoint
+ * (pops it from the stack of hooks if more are present)
*
- * Requires the `preventOverflow` modifier before it in order to work.
- * @memberof modifiers
- * @inner
+ * @param {String} entryPoint entry point for the hook to remove
*/
- hide: {
- /** @prop {number} order=800 - Index used to define the order of execution */
- order: 800,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: hide
- },
+ DOMPurify.removeHook = function (entryPoint) {
+ if (hooks[entryPoint]) {
+ hooks[entryPoint].pop();
+ }
+ };
/**
- * Computes the style that will be applied to the popper element to gets
- * properly positioned.
+ * RemoveHooks
+ * Public method to remove all DOMPurify hooks at a given entryPoint
*
- * Note that this modifier will not touch the DOM, it just prepares the styles
- * so that `applyStyle` modifier can apply it. This separation is useful
- * in case you need to replace `applyStyle` with a custom implementation.
- *
- * This modifier has `850` as `order` value to maintain backward compatibility
- * with previous versions of Popper.js. Expect the modifiers ordering method
- * to change in future major versions of the library.
- *
- * @memberof modifiers
- * @inner
+ * @param {String} entryPoint entry point for the hooks to remove
*/
- computeStyle: {
- /** @prop {number} order=850 - Index used to define the order of execution */
- order: 850,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: computeStyle,
- /**
- * @prop {Boolean} gpuAcceleration=true
- * If true, it uses the CSS 3d transformation to position the popper.
- * Otherwise, it will use the `top` and `left` properties.
- */
- gpuAcceleration: true,
- /**
- * @prop {string} [x='bottom']
- * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
- * Change this if your popper should grow in a direction different from `bottom`
- */
- x: 'bottom',
- /**
- * @prop {string} [x='left']
- * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
- * Change this if your popper should grow in a direction different from `right`
- */
- y: 'right'
- },
+ DOMPurify.removeHooks = function (entryPoint) {
+ if (hooks[entryPoint]) {
+ hooks[entryPoint] = [];
+ }
+ };
/**
- * Applies the computed styles to the popper element.
- *
- * All the DOM manipulations are limited to this modifier. This is useful in case
- * you want to integrate Popper.js inside a framework or view library and you
- * want to delegate all the DOM manipulations to it.
+ * RemoveAllHooks
+ * Public method to remove all DOMPurify hooks
*
- * Note that if you disable this modifier, you must make sure the popper element
- * has its position set to `absolute` before Popper.js can do its work!
- *
- * Just disable this modifier and define you own to achieve the desired effect.
- *
- * @memberof modifiers
- * @inner
*/
- applyStyle: {
- /** @prop {number} order=900 - Index used to define the order of execution */
- order: 900,
- /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
- enabled: true,
- /** @prop {ModifierFn} */
- fn: applyStyle,
- /** @prop {Function} */
- onLoad: applyStyleOnLoad,
- /**
- * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
- * @prop {Boolean} gpuAcceleration=true
- * If true, it uses the CSS 3d transformation to position the popper.
- * Otherwise, it will use the `top` and `left` properties.
- */
- gpuAcceleration: undefined
- }
-};
+ DOMPurify.removeAllHooks = function () {
+ hooks = {};
+ };
-/**
- * The `dataObject` is an object containing all the informations used by Popper.js
- * this object get passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
- * @name dataObject
- * @property {Object} data.instance The Popper.js instance
- * @property {String} data.placement Placement applied to popper
- * @property {String} data.originalPlacement Placement originally defined on init
- * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
- * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper.
- * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
- * @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`)
- * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`)
- * @property {Object} data.boundaries Offsets of the popper boundaries
- * @property {Object} data.offsets The measurements of popper, reference and arrow elements.
- * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
- * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
- * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
- */
+ return DOMPurify;
+}
-/**
- * Default options provided to Popper.js constructor.<br />
- * These can be overriden using the `options` argument of Popper.js.<br />
- * To override an option, simply pass as 3rd argument an object with the same
- * structure of this object, example:
- * ```
- * new Popper(ref, pop, {
- * modifiers: {
- * preventOverflow: { enabled: false }
- * }
- * })
- * ```
- * @type {Object}
- * @static
- * @memberof Popper
- */
-var Defaults = {
- /**
- * Popper's placement
- * @prop {Popper.placements} placement='bottom'
- */
- placement: 'bottom',
+var purify = createDOMPurify();
- /**
- * Set this to true if you want popper to position it self in 'fixed' mode
- * @prop {Boolean} positionFixed=false
- */
- positionFixed: false,
+return purify;
- /**
- * Whether events (resize, scroll) are initially enabled
- * @prop {Boolean} eventsEnabled=true
- */
- eventsEnabled: true,
+})));
+//# sourceMappingURL=purify.js.map
- /**
- * Set to true if you want to automatically remove the popper when
- * you call the `destroy` method.
- * @prop {Boolean} removeOnDestroy=false
- */
- removeOnDestroy: false,
- /**
- * Callback called when the popper is created.<br />
- * By default, is set to no-op.<br />
- * Access Popper.js instance with `data.instance`.
- * @prop {onCreate}
- */
- onCreate: function onCreate() {},
+/***/ }),
- /**
- * Callback called when the popper is updated, this callback is not called
- * on the initialization/creation of the popper, but only on subsequent
- * updates.<br />
- * By default, is set to no-op.<br />
- * Access Popper.js instance with `data.instance`.
- * @prop {onUpdate}
- */
- onUpdate: function onUpdate() {},
+/***/ "./node_modules/marked/lib/marked.js":
+/*!*******************************************!*\
+ !*** ./node_modules/marked/lib/marked.js ***!
+ \*******************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
- /**
- * List of modifiers used to modify the offsets before they are applied to the popper.
- * They provide most of the functionalities of Popper.js
- * @prop {modifiers}
- */
- modifiers: modifiers
+/* WEBPACK VAR INJECTION */(function(global) {/**
+ * marked - a markdown parser
+ * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed)
+ * https://github.com/markedjs/marked
+ */
+
+;(function(root) {
+'use strict';
+
+/**
+ * Block-Level Grammar
+ */
+
+var block = {
+ newline: /^\n+/,
+ code: /^( {4}[^\n]+\n*)+/,
+ fences: noop,
+ hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
+ heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,
+ nptable: noop,
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
+ list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
+ html: '^ {0,3}(?:' // optional indentation
+ + '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
+ + '|comment[^\\n]*(\\n+|$)' // (2)
+ + '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
+ + '|<![A-Z][\\s\\S]*?>\\n*' // (4)
+ + '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
+ + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
+ + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
+ + '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
+ + ')',
+ def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
+ table: noop,
+ lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
+ paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,
+ text: /^[^\n]+/
};
-/**
- * @callback onCreate
- * @param {dataObject} data
- */
+block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
+block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
+block.def = edit(block.def)
+ .replace('label', block._label)
+ .replace('title', block._title)
+ .getRegex();
-/**
- * @callback onUpdate
- * @param {dataObject} data
- */
+block.bullet = /(?:[*+-]|\d{1,9}\.)/;
+block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
+block.item = edit(block.item, 'gm')
+ .replace(/bull/g, block.bullet)
+ .getRegex();
-// Utils
-// Methods
-var Popper = function () {
- /**
- * Create a new Popper.js instance
- * @class Popper
- * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper
- * @param {HTMLElement} popper - The HTML element used as popper.
- * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
- * @return {Object} instance - The generated Popper.js instance
- */
- function Popper(reference, popper) {
- var _this = this;
+block.list = edit(block.list)
+ .replace(/bull/g, block.bullet)
+ .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
+ .replace('def', '\\n+(?=' + block.def.source + ')')
+ .getRegex();
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- classCallCheck(this, Popper);
+block._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
+ + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
+ + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
+ + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
+ + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
+ + '|track|ul';
+block._comment = /<!--(?!-?>)[\s\S]*?-->/;
+block.html = edit(block.html, 'i')
+ .replace('comment', block._comment)
+ .replace('tag', block._tag)
+ .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
+ .getRegex();
- this.scheduleUpdate = function () {
- return requestAnimationFrame(_this.update);
- };
+block.paragraph = edit(block.paragraph)
+ .replace('hr', block.hr)
+ .replace('heading', block.heading)
+ .replace('lheading', block.lheading)
+ .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
+ .getRegex();
- // make update() debounced, so that it only runs at most once-per-tick
- this.update = debounce(this.update.bind(this));
+block.blockquote = edit(block.blockquote)
+ .replace('paragraph', block.paragraph)
+ .getRegex();
- // with {} we create a new object with the options inside it
- this.options = _extends({}, Popper.Defaults, options);
+/**
+ * Normal Block Grammar
+ */
- // init state
- this.state = {
- isDestroyed: false,
- isCreated: false,
- scrollParents: []
- };
+block.normal = merge({}, block);
- // get reference and popper elements (allow jQuery wrappers)
- this.reference = reference && reference.jquery ? reference[0] : reference;
- this.popper = popper && popper.jquery ? popper[0] : popper;
+/**
+ * GFM Block Grammar
+ */
- // Deep merge modifiers options
- this.options.modifiers = {};
- Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
- _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
- });
+block.gfm = merge({}, block.normal, {
+ fences: /^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
+ paragraph: /^/,
+ heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
+});
- // Refactoring modifiers' list (Object => Array)
- this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
- return _extends({
- name: name
- }, _this.options.modifiers[name]);
- })
- // sort the modifiers by order
- .sort(function (a, b) {
- return a.order - b.order;
- });
+block.gfm.paragraph = edit(block.paragraph)
+ .replace('(?!', '(?!'
+ + block.gfm.fences.source.replace('\\1', '\\2') + '|'
+ + block.list.source.replace('\\1', '\\3') + '|')
+ .getRegex();
- // modifiers have the ability to execute arbitrary code when Popper.js get inited
- // such code is executed in the same order of its modifier
- // they could add new properties to their options configuration
- // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
- this.modifiers.forEach(function (modifierOptions) {
- if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
- modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
- }
- });
+/**
+ * GFM + Tables Block Grammar
+ */
- // fire the first update to position the popper in the right place
- this.update();
+block.tables = merge({}, block.gfm, {
+ nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,
+ table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/
+});
- var eventsEnabled = this.options.eventsEnabled;
- if (eventsEnabled) {
- // setup event listeners, they will take care of update the position in specific situations
- this.enableEventListeners();
- }
+/**
+ * Pedantic grammar
+ */
- this.state.eventsEnabled = eventsEnabled;
- }
+block.pedantic = merge({}, block.normal, {
+ html: edit(
+ '^ *(?:comment *(?:\\n|\\s*$)'
+ + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
+ + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
+ .replace('comment', block._comment)
+ .replace(/tag/g, '(?!(?:'
+ + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'
+ + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'
+ + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b')
+ .getRegex(),
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/
+});
- // We can't use class properties because they don't get listed in the
- // class prototype and break stuff like Sinon stubs
+/**
+ * Block Lexer
+ */
+function Lexer(options) {
+ this.tokens = [];
+ this.tokens.links = Object.create(null);
+ this.options = options || marked.defaults;
+ this.rules = block.normal;
- createClass(Popper, [{
- key: 'update',
- value: function update$$1() {
- return update.call(this);
- }
- }, {
- key: 'destroy',
- value: function destroy$$1() {
- return destroy.call(this);
- }
- }, {
- key: 'enableEventListeners',
- value: function enableEventListeners$$1() {
- return enableEventListeners.call(this);
- }
- }, {
- key: 'disableEventListeners',
- value: function disableEventListeners$$1() {
- return disableEventListeners.call(this);
+ if (this.options.pedantic) {
+ this.rules = block.pedantic;
+ } else if (this.options.gfm) {
+ if (this.options.tables) {
+ this.rules = block.tables;
+ } else {
+ this.rules = block.gfm;
}
-
- /**
- * Schedule an update, it will run on the next UI update available
- * @method scheduleUpdate
- * @memberof Popper
- */
-
-
- /**
- * Collection of utilities useful when writing custom modifiers.
- * Starting from version 1.7, this method is available only if you
- * include `popper-utils.js` before `popper.js`.
- *
- * **DEPRECATION**: This way to access PopperUtils is deprecated
- * and will be removed in v2! Use the PopperUtils module directly instead.
- * Due to the high instability of the methods contained in Utils, we can't
- * guarantee them to follow semver. Use them at your own risk!
- * @static
- * @private
- * @type {Object}
- * @deprecated since version 1.8
- * @member Utils
- * @memberof Popper
- */
-
- }]);
- return Popper;
-}();
+ }
+}
/**
- * The `referenceObject` is an object that provides an interface compatible with Popper.js
- * and lets you use it as replacement of a real DOM node.<br />
- * You can use this method to position a popper relatively to a set of coordinates
- * in case you don't have a DOM node to use as reference.
- *
- * ```
- * new Popper(referenceObject, popperNode);
- * ```
- *
- * NB: This feature isn't supported in Internet Explorer 10
- * @name referenceObject
- * @property {Function} data.getBoundingClientRect
- * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
- * @property {number} data.clientWidth
- * An ES6 getter that will return the width of the virtual reference element.
- * @property {number} data.clientHeight
- * An ES6 getter that will return the height of the virtual reference element.
+ * Expose Block Rules
*/
-
-Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
-Popper.placements = placements;
-Popper.Defaults = Defaults;
-
-var SVGAnimatedString = function SVGAnimatedString() {};
-if (typeof window !== 'undefined') {
- SVGAnimatedString = window.SVGAnimatedString;
-}
-
-function convertToArray(value) {
- if (typeof value === 'string') {
- value = value.split(' ');
- }
- return value;
-}
+Lexer.rules = block;
/**
- * Add classes to an element.
- * This method checks to ensure that the classes don't already exist before adding them.
- * It uses el.className rather than classList in order to be IE friendly.
- * @param {object} el - The element to add the classes to.
- * @param {classes} string - List of space separated classes to be added to the element.
+ * Static Lex Method
*/
-function addClasses(el, classes) {
- var newClasses = convertToArray(classes);
- var classList = void 0;
- if (el.className instanceof SVGAnimatedString) {
- classList = convertToArray(el.className.baseVal);
- } else {
- classList = convertToArray(el.className);
- }
- newClasses.forEach(function (newClass) {
- if (classList.indexOf(newClass) === -1) {
- classList.push(newClass);
- }
- });
- if (el instanceof SVGElement) {
- el.setAttribute('class', classList.join(' '));
- } else {
- el.className = classList.join(' ');
- }
-}
+
+Lexer.lex = function(src, options) {
+ var lexer = new Lexer(options);
+ return lexer.lex(src);
+};
/**
- * Remove classes from an element.
- * It uses el.className rather than classList in order to be IE friendly.
- * @export
- * @param {any} el The element to remove the classes from.
- * @param {any} classes List of space separated classes to be removed from the element.
+ * Preprocessing
*/
-function removeClasses(el, classes) {
- var newClasses = convertToArray(classes);
- var classList = void 0;
- if (el.className instanceof SVGAnimatedString) {
- classList = convertToArray(el.className.baseVal);
- } else {
- classList = convertToArray(el.className);
- }
- newClasses.forEach(function (newClass) {
- var index = classList.indexOf(newClass);
- if (index !== -1) {
- classList.splice(index, 1);
- }
- });
- if (el instanceof SVGElement) {
- el.setAttribute('class', classList.join(' '));
- } else {
- el.className = classList.join(' ');
- }
-}
-var supportsPassive = false;
-
-if (typeof window !== 'undefined') {
- supportsPassive = false;
- try {
- var opts = Object.defineProperty({}, 'passive', {
- get: function get() {
- supportsPassive = true;
- }
- });
- window.addEventListener('test', null, opts);
- } catch (e) {}
-}
+Lexer.prototype.lex = function(src) {
+ src = src
+ .replace(/\r\n|\r/g, '\n')
+ .replace(/\t/g, ' ')
+ .replace(/\u00a0/g, ' ')
+ .replace(/\u2424/g, '\n');
-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;
+ return this.token(src, true);
};
+/**
+ * Lexing
+ */
+
+Lexer.prototype.token = function(src, top) {
+ src = src.replace(/^ +$/gm, '');
+ var next,
+ loose,
+ cap,
+ bull,
+ b,
+ item,
+ listStart,
+ listItems,
+ t,
+ space,
+ i,
+ tag,
+ l,
+ isordered,
+ istask,
+ ischecked;
+
+ while (src) {
+ // newline
+ if (cap = this.rules.newline.exec(src)) {
+ src = src.substring(cap[0].length);
+ if (cap[0].length > 1) {
+ this.tokens.push({
+ type: 'space'
+ });
+ }
+ }
+ // code
+ if (cap = this.rules.code.exec(src)) {
+ src = src.substring(cap[0].length);
+ cap = cap[0].replace(/^ {4}/gm, '');
+ this.tokens.push({
+ type: 'code',
+ text: !this.options.pedantic
+ ? rtrim(cap, '\n')
+ : cap
+ });
+ continue;
+ }
+ // fences (gfm)
+ if (cap = this.rules.fences.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'code',
+ lang: cap[2] ? cap[2].trim() : cap[2],
+ text: cap[3] || ''
+ });
+ continue;
+ }
+ // heading
+ if (cap = this.rules.heading.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'heading',
+ depth: cap[1].length,
+ text: cap[2]
+ });
+ continue;
+ }
+ // table no leading pipe (gfm)
+ if (top && (cap = this.rules.nptable.exec(src))) {
+ item = {
+ type: 'table',
+ header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
+ align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
+ cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
+ };
+
+ if (item.header.length === item.align.length) {
+ src = src.substring(cap[0].length);
+
+ for (i = 0; i < item.align.length; i++) {
+ if (/^ *-+: *$/.test(item.align[i])) {
+ item.align[i] = 'right';
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
+ item.align[i] = 'center';
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
+ item.align[i] = 'left';
+ } else {
+ item.align[i] = null;
+ }
+ }
+
+ for (i = 0; i < item.cells.length; i++) {
+ item.cells[i] = splitCells(item.cells[i], item.header.length);
+ }
+
+ this.tokens.push(item);
+
+ continue;
+ }
+ }
+ // hr
+ if (cap = this.rules.hr.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'hr'
+ });
+ continue;
+ }
+ // blockquote
+ if (cap = this.rules.blockquote.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'blockquote_start'
+ });
+ cap = cap[0].replace(/^ *> ?/gm, '');
+ // Pass `top` to keep the current
+ // "toplevel" state. This is exactly
+ // how markdown.pl works.
+ this.token(cap, top);
-var classCallCheck$1 = function (instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
-};
+ this.tokens.push({
+ type: 'blockquote_end'
+ });
-var createClass$1 = function () {
- function defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
+ continue;
}
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
-}();
+ // list
+ if (cap = this.rules.list.exec(src)) {
+ src = src.substring(cap[0].length);
+ bull = cap[2];
+ isordered = bull.length > 1;
+
+ listStart = {
+ type: 'list_start',
+ ordered: isordered,
+ start: isordered ? +bull : '',
+ loose: false
+ };
+
+ this.tokens.push(listStart);
+
+ // Get each top-level item.
+ cap = cap[0].match(this.rules.item);
+
+ listItems = [];
+ next = false;
+ l = cap.length;
+ i = 0;
+
+ for (; i < l; i++) {
+ item = cap[i];
+
+ // Remove the list item's bullet
+ // so it is seen as the next token.
+ space = item.length;
+ item = item.replace(/^ *([*+-]|\d+\.) */, '');
+
+ // Outdent whatever the
+ // list item contains. Hacky.
+ if (~item.indexOf('\n ')) {
+ space -= item.length;
+ item = !this.options.pedantic
+ ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
+ : item.replace(/^ {1,4}/gm, '');
+ }
+
+ // Determine whether the next list item belongs here.
+ // Backpedal if it does not belong in this list.
+ if (i !== l - 1) {
+ b = block.bullet.exec(cap[i + 1])[0];
+ if (bull.length > 1 ? b.length === 1
+ : (b.length > 1 || (this.options.smartLists && b !== bull))) {
+ src = cap.slice(i + 1).join('\n') + src;
+ i = l - 1;
+ }
+ }
+
+ // Determine whether item is loose or not.
+ // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
+ // for discount behavior.
+ loose = next || /\n\n(?!\s*$)/.test(item);
+ if (i !== l - 1) {
+ next = item.charAt(item.length - 1) === '\n';
+ if (!loose) loose = next;
+ }
+
+ if (loose) {
+ listStart.loose = true;
+ }
+
+ // Check for task list items
+ istask = /^\[[ xX]\] /.test(item);
+ ischecked = undefined;
+ if (istask) {
+ ischecked = item[1] !== ' ';
+ item = item.replace(/^\[[ xX]\] +/, '');
+ }
+
+ t = {
+ type: 'list_item_start',
+ task: istask,
+ checked: ischecked,
+ loose: loose
+ };
+
+ listItems.push(t);
+ this.tokens.push(t);
+
+ // Recurse.
+ this.token(item, false);
+
+ this.tokens.push({
+ type: 'list_item_end'
+ });
+ }
+ if (listStart.loose) {
+ l = listItems.length;
+ i = 0;
+ for (; i < l; i++) {
+ listItems[i].loose = true;
+ }
+ }
+ this.tokens.push({
+ type: 'list_end'
+ });
+ continue;
+ }
+ // html
+ if (cap = this.rules.html.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: this.options.sanitize
+ ? 'paragraph'
+ : 'html',
+ pre: !this.options.sanitizer
+ && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
+ text: cap[0]
+ });
+ continue;
+ }
+ // def
+ if (top && (cap = this.rules.def.exec(src))) {
+ src = src.substring(cap[0].length);
+ if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
+ tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
+ if (!this.tokens.links[tag]) {
+ this.tokens.links[tag] = {
+ href: cap[2],
+ title: cap[3]
+ };
+ }
+ continue;
+ }
+ // table (gfm)
+ if (top && (cap = this.rules.table.exec(src))) {
+ item = {
+ type: 'table',
+ header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
+ align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
+ cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : []
+ };
+
+ if (item.header.length === item.align.length) {
+ src = src.substring(cap[0].length);
+
+ for (i = 0; i < item.align.length; i++) {
+ if (/^ *-+: *$/.test(item.align[i])) {
+ item.align[i] = 'right';
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
+ item.align[i] = 'center';
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
+ item.align[i] = 'left';
+ } else {
+ item.align[i] = null;
+ }
+ }
+
+ for (i = 0; i < item.cells.length; i++) {
+ item.cells[i] = splitCells(
+ item.cells[i].replace(/^ *\| *| *\| *$/g, ''),
+ item.header.length);
+ }
+
+ this.tokens.push(item);
+
+ continue;
+ }
+ }
-var _extends$1 = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
+ // lheading
+ if (cap = this.rules.lheading.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'heading',
+ depth: cap[2] === '=' ? 1 : 2,
+ text: cap[1]
+ });
+ continue;
+ }
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
+ // top-level paragraph
+ if (top && (cap = this.rules.paragraph.exec(src))) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'paragraph',
+ text: cap[1].charAt(cap[1].length - 1) === '\n'
+ ? cap[1].slice(0, -1)
+ : cap[1]
+ });
+ continue;
+ }
+
+ // text
+ if (cap = this.rules.text.exec(src)) {
+ // Top-level should never reach here.
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'text',
+ text: cap[0]
+ });
+ continue;
+ }
+
+ if (src) {
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
}
}
- return target;
+ return this.tokens;
};
-/* Forked from https://github.com/FezVrasta/popper.js/blob/master/packages/tooltip/src/index.js */
-
-var DEFAULT_OPTIONS = {
- container: false,
- delay: 0,
- html: false,
- placement: 'top',
- title: '',
- template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
- trigger: 'hover focus',
- offset: 0
+/**
+ * Inline-Level Grammar
+ */
+
+var inline = {
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
+ url: noop,
+ tag: '^comment'
+ + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
+ + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
+ + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
+ + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
+ + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>', // CDATA section
+ link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,
+ reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
+ nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
+ strong: /^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
+ em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,
+ code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
+ br: /^( {2,}|\\)\n(?!\s*$)/,
+ del: noop,
+ text: /^(`+|[^`])[\s\S]*?(?=[\\<!\[`*]|\b_| {2,}\n|$)/
};
-var openTooltips = [];
-
-var Tooltip = function () {
- /**
- * Create a new Tooltip.js instance
- * @class Tooltip
- * @param {HTMLElement} reference - The DOM node used as reference of the tooltip (it can be a jQuery element).
- * @param {Object} options
- * @param {String} options.placement=bottom
- * Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -end),
- * left(-start, -end)`
- * @param {HTMLElement|String|false} options.container=false - Append the tooltip to a specific element.
- * @param {Number|Object} options.delay=0
- * Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type.
- * If a number is supplied, delay is applied to both hide/show.
- * Object structure is: `{ show: 500, hide: 100 }`
- * @param {Boolean} options.html=false - Insert HTML into the tooltip. If false, the content will inserted with `innerText`.
- * @param {String|PlacementFunction} options.placement='top' - One of the allowed placements, or a function returning one of them.
- * @param {String} [options.template='<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>']
- * Base HTML to used when creating the tooltip.
- * The tooltip's `title` will be injected into the `.tooltip-inner` or `.tooltip__inner`.
- * `.tooltip-arrow` or `.tooltip__arrow` will become the tooltip's arrow.
- * The outermost wrapper element should have the `.tooltip` class.
- * @param {String|HTMLElement|TitleFunction} options.title='' - Default title value if `title` attribute isn't present.
- * @param {String} [options.trigger='hover focus']
- * How tooltip is triggered - click, hover, focus, manual.
- * You may pass multiple triggers; separate them with a space. `manual` cannot be combined with any other trigger.
- * @param {HTMLElement} options.boundariesElement
- * The element used as boundaries for the tooltip. For more information refer to Popper.js'
- * [boundariesElement docs](https://popper.js.org/popper-documentation.html)
- * @param {Number|String} options.offset=0 - Offset of the tooltip relative to its reference. For more information refer to Popper.js'
- * [offset docs](https://popper.js.org/popper-documentation.html)
- * @param {Object} options.popperOptions={} - Popper options, will be passed directly to popper instance. For more information refer to Popper.js'
- * [options docs](https://popper.js.org/popper-documentation.html)
- * @return {Object} instance - The generated tooltip instance
- */
- function Tooltip(reference, options) {
- classCallCheck$1(this, Tooltip);
-
- _initialiseProps.call(this);
-
- // apply user options over default ones
- options = _extends$1({}, DEFAULT_OPTIONS, options);
-
- reference.jquery && (reference = reference[0]);
-
- // cache reference and options
- this.reference = reference;
- this.options = options;
-
- // set initial state
- this._isOpen = false;
-
- this._init();
- }
-
- //
- // Public methods
- //
-
- /**
- * Reveals an element's tooltip. This is considered a "manual" triggering of the tooltip.
- * Tooltips with zero-length titles are never displayed.
- * @method Tooltip#show
- * @memberof Tooltip
- */
-
-
- /**
- * Hides an element’s tooltip. This is considered a “manual” triggering of the tooltip.
- * @method Tooltip#hide
- * @memberof Tooltip
- */
-
-
- /**
- * Hides and destroys an element’s tooltip.
- * @method Tooltip#dispose
- * @memberof Tooltip
- */
-
-
- /**
- * Toggles an element’s tooltip. This is considered a “manual” triggering of the tooltip.
- * @method Tooltip#toggle
- * @memberof Tooltip
- */
-
-
- createClass$1(Tooltip, [{
- key: 'setClasses',
- value: function setClasses(classes) {
- this._classes = classes;
- }
- }, {
- key: 'setContent',
- value: function setContent(content) {
- this.options.title = content;
- if (this._tooltipNode) {
- this._setContent(content, this.options);
- }
- }
- }, {
- key: 'setOptions',
- value: function setOptions(options) {
- var classesUpdated = false;
- var classes = options && options.classes || directive.options.defaultClass;
- if (this._classes !== classes) {
- this.setClasses(classes);
- classesUpdated = true;
- }
-
- options = getOptions(options);
-
- var needPopperUpdate = false;
- var needRestart = false;
-
- if (this.options.offset !== options.offset || this.options.placement !== options.placement) {
- needPopperUpdate = true;
- }
-
- if (this.options.template !== options.template || this.options.trigger !== options.trigger || this.options.container !== options.container || classesUpdated) {
- needRestart = true;
- }
-
- for (var key in options) {
- this.options[key] = options[key];
- }
-
- if (this._tooltipNode) {
- if (needRestart) {
- var isOpen = this._isOpen;
-
- this.dispose();
- this._init();
-
- if (isOpen) {
- this.show();
- }
- } else if (needPopperUpdate) {
- this.popperInstance.update();
- }
- }
- }
-
- //
- // Private methods
- //
-
- }, {
- key: '_init',
- value: function _init() {
- // get events list
- var events = typeof this.options.trigger === 'string' ? this.options.trigger.split(' ').filter(function (trigger) {
- return ['click', 'hover', 'focus'].indexOf(trigger) !== -1;
- }) : [];
- this._isDisposed = false;
- this._enableDocumentTouch = events.indexOf('manual') === -1;
-
- // set event listeners
- this._setEventListeners(this.reference, events, this.options);
- }
-
- /**
- * Creates a new tooltip node
- * @memberof Tooltip
- * @private
- * @param {HTMLElement} reference
- * @param {String} template
- * @param {String|HTMLElement|TitleFunction} title
- * @param {Boolean} allowHtml
- * @return {HTMLelement} tooltipNode
- */
+// list of punctuation marks from common mark spec
+// without ` and ] to workaround Rule 17 (inline code blocks/links)
+inline._punctuation = '!"#$%&\'()*+,\\-./:;<=>?@\\[^_{|}~';
+inline.em = edit(inline.em).replace(/punctuation/g, inline._punctuation).getRegex();
- }, {
- key: '_create',
- value: function _create(reference, template) {
- // create tooltip element
- var tooltipGenerator = window.document.createElement('div');
- tooltipGenerator.innerHTML = template.trim();
- var tooltipNode = tooltipGenerator.childNodes[0];
-
- // add unique ID to our tooltip (needed for accessibility reasons)
- tooltipNode.id = 'tooltip_' + Math.random().toString(36).substr(2, 10);
-
- // Initially hide the tooltip
- // The attribute will be switched in a next frame so
- // CSS transitions can play
- tooltipNode.setAttribute('aria-hidden', 'true');
-
- if (this.options.autoHide && this.options.trigger.indexOf('hover') !== -1) {
- tooltipNode.addEventListener('mouseenter', this.hide);
- tooltipNode.addEventListener('click', this.hide);
- }
-
- // return the generated tooltip node
- return tooltipNode;
- }
- }, {
- key: '_setContent',
- value: function _setContent(content, options) {
- var _this = this;
-
- this.asyncContent = false;
- this._applyContent(content, options).then(function () {
- _this.popperInstance.update();
- });
- }
- }, {
- key: '_applyContent',
- value: function _applyContent(title, options) {
- var _this2 = this;
-
- return new Promise(function (resolve, reject) {
- var allowHtml = options.html;
- var rootNode = _this2._tooltipNode;
- if (!rootNode) return;
- var titleNode = rootNode.querySelector(_this2.options.innerSelector);
- if (title.nodeType === 1) {
- // if title is a node, append it only if allowHtml is true
- if (allowHtml) {
- while (titleNode.firstChild) {
- titleNode.removeChild(titleNode.firstChild);
- }
- titleNode.appendChild(title);
- }
- } else if (typeof title === 'function') {
- // if title is a function, call it and set innerText or innerHtml depending by `allowHtml` value
- var result = title();
- if (result && typeof result.then === 'function') {
- _this2.asyncContent = true;
- options.loadingClass && addClasses(rootNode, options.loadingClass);
- if (options.loadingContent) {
- _this2._applyContent(options.loadingContent, options);
- }
- result.then(function (asyncResult) {
- options.loadingClass && removeClasses(rootNode, options.loadingClass);
- return _this2._applyContent(asyncResult, options);
- }).then(resolve).catch(reject);
- } else {
- _this2._applyContent(result, options).then(resolve).catch(reject);
- }
- return;
- } else {
- // if it's just a simple text, set innerText or innerHtml depending by `allowHtml` value
- allowHtml ? titleNode.innerHTML = title : titleNode.innerText = title;
- }
- resolve();
- });
- }
- }, {
- key: '_show',
- value: function _show(reference, options) {
- if (options && typeof options.container === 'string') {
- var container = document.querySelector(options.container);
- if (!container) return;
- }
-
- clearTimeout(this._disposeTimer);
-
- options = Object.assign({}, options);
- delete options.offset;
-
- var updateClasses = true;
- if (this._tooltipNode) {
- addClasses(this._tooltipNode, this._classes);
- updateClasses = false;
- }
-
- var result = this._ensureShown(reference, options);
-
- if (updateClasses && this._tooltipNode) {
- addClasses(this._tooltipNode, this._classes);
- }
-
- addClasses(reference, ['v-tooltip-open']);
-
- return result;
- }
- }, {
- key: '_ensureShown',
- value: function _ensureShown(reference, options) {
- var _this3 = this;
-
- // don't show if it's already visible
- if (this._isOpen) {
- return this;
- }
- this._isOpen = true;
-
- openTooltips.push(this);
-
- // if the tooltipNode already exists, just show it
- if (this._tooltipNode) {
- this._tooltipNode.style.display = '';
- this._tooltipNode.setAttribute('aria-hidden', 'false');
- this.popperInstance.enableEventListeners();
- this.popperInstance.update();
- if (this.asyncContent) {
- this._setContent(options.title, options);
- }
- return this;
- }
-
- // get title
- var title = reference.getAttribute('title') || options.title;
-
- // don't show tooltip if no title is defined
- if (!title) {
- return this;
- }
-
- // create tooltip node
- var tooltipNode = this._create(reference, options.template);
- this._tooltipNode = tooltipNode;
-
- this._setContent(title, options);
-
- // Add `aria-describedby` to our reference element for accessibility reasons
- reference.setAttribute('aria-describedby', tooltipNode.id);
-
- // append tooltip to container
- var container = this._findContainer(options.container, reference);
-
- this._append(tooltipNode, container);
-
- var popperOptions = _extends$1({}, options.popperOptions, {
- placement: options.placement
- });
-
- popperOptions.modifiers = _extends$1({}, popperOptions.modifiers, {
- arrow: {
- element: this.options.arrowSelector
- }
- });
-
- if (options.boundariesElement) {
- popperOptions.modifiers.preventOverflow = {
- boundariesElement: options.boundariesElement
- };
- }
-
- this.popperInstance = new Popper(reference, tooltipNode, popperOptions);
-
- // Fix position
- requestAnimationFrame(function () {
- if (!_this3._isDisposed && _this3.popperInstance) {
- _this3.popperInstance.update();
-
- // Show the tooltip
- requestAnimationFrame(function () {
- if (!_this3._isDisposed) {
- _this3._isOpen && tooltipNode.setAttribute('aria-hidden', 'false');
- } else {
- _this3.dispose();
- }
- });
- } else {
- _this3.dispose();
- }
- });
-
- return this;
- }
- }, {
- key: '_noLongerOpen',
- value: function _noLongerOpen() {
- var index = openTooltips.indexOf(this);
- if (index !== -1) {
- openTooltips.splice(index, 1);
- }
- }
- }, {
- key: '_hide',
- value: function _hide() /* reference, options */{
- var _this4 = this;
-
- // don't hide if it's already hidden
- if (!this._isOpen) {
- return this;
- }
-
- this._isOpen = false;
- this._noLongerOpen();
-
- // hide tooltipNode
- this._tooltipNode.style.display = 'none';
- this._tooltipNode.setAttribute('aria-hidden', 'true');
-
- this.popperInstance.disableEventListeners();
-
- clearTimeout(this._disposeTimer);
- var disposeTime = directive.options.disposeTimeout;
- if (disposeTime !== null) {
- this._disposeTimer = setTimeout(function () {
- if (_this4._tooltipNode) {
- _this4._tooltipNode.removeEventListener('mouseenter', _this4.hide);
- _this4._tooltipNode.removeEventListener('click', _this4.hide);
- // Don't remove popper instance, just the HTML element
- _this4._tooltipNode.parentNode.removeChild(_this4._tooltipNode);
- _this4._tooltipNode = null;
- }
- }, disposeTime);
- }
-
- removeClasses(this.reference, ['v-tooltip-open']);
-
- return this;
- }
- }, {
- key: '_dispose',
- value: function _dispose() {
- var _this5 = this;
-
- this._isDisposed = true;
-
- // remove event listeners first to prevent any unexpected behaviour
- this._events.forEach(function (_ref) {
- var func = _ref.func,
- event = _ref.event;
-
- _this5.reference.removeEventListener(event, func);
- });
- this._events = [];
-
- if (this._tooltipNode) {
- this._hide();
-
- this._tooltipNode.removeEventListener('mouseenter', this.hide);
- this._tooltipNode.removeEventListener('click', this.hide);
-
- // destroy instance
- this.popperInstance.destroy();
-
- // destroy tooltipNode if removeOnDestroy is not set, as popperInstance.destroy() already removes the element
- if (!this.popperInstance.options.removeOnDestroy) {
- this._tooltipNode.parentNode.removeChild(this._tooltipNode);
- this._tooltipNode = null;
- }
- } else {
- this._noLongerOpen();
- }
- return this;
- }
- }, {
- key: '_findContainer',
- value: function _findContainer(container, reference) {
- // if container is a query, get the relative element
- if (typeof container === 'string') {
- container = window.document.querySelector(container);
- } else if (container === false) {
- // if container is `false`, set it to reference parent
- container = reference.parentNode;
- }
- return container;
- }
-
- /**
- * Append tooltip to container
- * @memberof Tooltip
- * @private
- * @param {HTMLElement} tooltip
- * @param {HTMLElement|String|false} container
- */
+inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
- }, {
- key: '_append',
- value: function _append(tooltipNode, container) {
- container.appendChild(tooltipNode);
- }
- }, {
- key: '_setEventListeners',
- value: function _setEventListeners(reference, events, options) {
- var _this6 = this;
-
- var directEvents = [];
- var oppositeEvents = [];
-
- events.forEach(function (event) {
- switch (event) {
- case 'hover':
- directEvents.push('mouseenter');
- oppositeEvents.push('mouseleave');
- if (_this6.options.hideOnTargetClick) oppositeEvents.push('click');
- break;
- case 'focus':
- directEvents.push('focus');
- oppositeEvents.push('blur');
- if (_this6.options.hideOnTargetClick) oppositeEvents.push('click');
- break;
- case 'click':
- directEvents.push('click');
- oppositeEvents.push('click');
- break;
- }
- });
-
- // schedule show tooltip
- directEvents.forEach(function (event) {
- var func = function func(evt) {
- if (_this6._isOpen === true) {
- return;
- }
- evt.usedByTooltip = true;
- _this6._scheduleShow(reference, options.delay, options, evt);
- };
- _this6._events.push({ event: event, func: func });
- reference.addEventListener(event, func);
- });
-
- // schedule hide tooltip
- oppositeEvents.forEach(function (event) {
- var func = function func(evt) {
- if (evt.usedByTooltip === true) {
- return;
- }
- _this6._scheduleHide(reference, options.delay, options, evt);
- };
- _this6._events.push({ event: event, func: func });
- reference.addEventListener(event, func);
- });
- }
- }, {
- key: '_onDocumentTouch',
- value: function _onDocumentTouch(event) {
- if (this._enableDocumentTouch) {
- this._scheduleHide(this.reference, this.options.delay, this.options, event);
- }
- }
- }, {
- key: '_scheduleShow',
- value: function _scheduleShow(reference, delay, options /*, evt */) {
- var _this7 = this;
-
- // defaults to 0
- var computedDelay = delay && delay.show || delay || 0;
- clearTimeout(this._scheduleTimer);
- this._scheduleTimer = window.setTimeout(function () {
- return _this7._show(reference, options);
- }, computedDelay);
- }
- }, {
- key: '_scheduleHide',
- value: function _scheduleHide(reference, delay, options, evt) {
- var _this8 = this;
-
- // defaults to 0
- var computedDelay = delay && delay.hide || delay || 0;
- clearTimeout(this._scheduleTimer);
- this._scheduleTimer = window.setTimeout(function () {
- if (_this8._isOpen === false) {
- return;
- }
- if (!document.body.contains(_this8._tooltipNode)) {
- return;
- }
-
- // if we are hiding because of a mouseleave, we must check that the new
- // reference isn't the tooltip, because in this case we don't want to hide it
- if (evt.type === 'mouseleave') {
- var isSet = _this8._setTooltipNodeEvent(evt, reference, delay, options);
-
- // if we set the new event, don't hide the tooltip yet
- // the new event will take care to hide it if necessary
- if (isSet) {
- return;
- }
- }
-
- _this8._hide(reference, options);
- }, computedDelay);
- }
- }]);
- return Tooltip;
-}();
-
-// Hide tooltips on touch devices
-
-
-var _initialiseProps = function _initialiseProps() {
- var _this9 = this;
-
- this.show = function () {
- _this9._show(_this9.reference, _this9.options);
- };
-
- this.hide = function () {
- _this9._hide();
- };
-
- this.dispose = function () {
- _this9._dispose();
- };
-
- this.toggle = function () {
- if (_this9._isOpen) {
- return _this9.hide();
- } else {
- return _this9.show();
- }
- };
-
- this._events = [];
-
- this._setTooltipNodeEvent = function (evt, reference, delay, options) {
- var relatedreference = evt.relatedreference || evt.toElement || evt.relatedTarget;
-
- var callback = function callback(evt2) {
- var relatedreference2 = evt2.relatedreference || evt2.toElement || evt2.relatedTarget;
-
- // Remove event listener after call
- _this9._tooltipNode.removeEventListener(evt.type, callback);
-
- // If the new reference is not the reference element
- if (!reference.contains(relatedreference2)) {
- // Schedule to hide tooltip
- _this9._scheduleHide(reference, options.delay, options, evt2);
- }
- };
-
- if (_this9._tooltipNode.contains(relatedreference)) {
- // listen to mouseleave on the tooltip element to be able to hide the tooltip
- _this9._tooltipNode.addEventListener(evt.type, callback);
- return true;
- }
-
- return false;
- };
-};
+inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
+inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
+inline.autolink = edit(inline.autolink)
+ .replace('scheme', inline._scheme)
+ .replace('email', inline._email)
+ .getRegex();
-if (typeof document !== 'undefined') {
- document.addEventListener('touchstart', function (event) {
- for (var i = 0; i < openTooltips.length; i++) {
- openTooltips[i]._onDocumentTouch(event);
- }
- }, supportsPassive ? {
- passive: true,
- capture: true
- } : true);
-}
+inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
-/**
- * Placement function, its context is the Tooltip instance.
- * @memberof Tooltip
- * @callback PlacementFunction
- * @param {HTMLElement} tooltip - tooltip DOM node.
- * @param {HTMLElement} reference - reference DOM node.
- * @return {String} placement - One of the allowed placement options.
- */
+inline.tag = edit(inline.tag)
+ .replace('comment', block._comment)
+ .replace('attribute', inline._attribute)
+ .getRegex();
+
+inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/;
+inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*)/;
+inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
+
+inline.link = edit(inline.link)
+ .replace('label', inline._label)
+ .replace('href', inline._href)
+ .replace('title', inline._title)
+ .getRegex();
+
+inline.reflink = edit(inline.reflink)
+ .replace('label', inline._label)
+ .getRegex();
/**
- * Title function, its context is the Tooltip instance.
- * @memberof Tooltip
- * @callback TitleFunction
- * @return {String} placement - The desired title.
+ * Normal Inline Grammar
*/
-var state = {
- enabled: true
-};
+inline.normal = merge({}, inline);
-var positions = ['top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end'];
-
-var defaultOptions = {
- // Default tooltip placement relative to target element
- defaultPlacement: 'top',
- // Default CSS classes applied to the tooltip element
- defaultClass: 'vue-tooltip-theme',
- // Default CSS classes applied to the target element of the tooltip
- defaultTargetClass: 'has-tooltip',
- // Is the content HTML by default?
- defaultHtml: true,
- // Default HTML template of the tooltip element
- // It must include `tooltip-arrow` & `tooltip-inner` CSS classes (can be configured, see below)
- // Change if the classes conflict with other libraries (for example bootstrap)
- defaultTemplate: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
- // Selector used to get the arrow element in the tooltip template
- defaultArrowSelector: '.tooltip-arrow, .tooltip__arrow',
- // Selector used to get the inner content element in the tooltip template
- defaultInnerSelector: '.tooltip-inner, .tooltip__inner',
- // Delay (ms)
- defaultDelay: 0,
- // Default events that trigger the tooltip
- defaultTrigger: 'hover focus',
- // Default position offset (px)
- defaultOffset: 0,
- // Default container where the tooltip will be appended
- defaultContainer: 'body',
- defaultBoundariesElement: undefined,
- defaultPopperOptions: {},
- // Class added when content is loading
- defaultLoadingClass: 'tooltip-loading',
- // Displayed when tooltip content is loading
- defaultLoadingContent: '...',
- // Hide on mouseover tooltip
- autoHide: true,
- // Close tooltip on click on tooltip target?
- defaultHideOnTargetClick: true,
- // Auto destroy tooltip DOM nodes (ms)
- disposeTimeout: 5000,
- // Options for popover
- popover: {
- defaultPlacement: 'bottom',
- // Use the `popoverClass` prop for theming
- defaultClass: 'vue-popover-theme',
- // Base class (change if conflicts with other libraries)
- defaultBaseClass: 'tooltip popover',
- // Wrapper class (contains arrow and inner)
- defaultWrapperClass: 'wrapper',
- // Inner content class
- defaultInnerClass: 'tooltip-inner popover-inner',
- // Arrow class
- defaultArrowClass: 'tooltip-arrow popover-arrow',
- defaultDelay: 0,
- defaultTrigger: 'click',
- defaultOffset: 0,
- defaultContainer: 'body',
- defaultBoundariesElement: undefined,
- defaultPopperOptions: {},
- // Hides if clicked outside of popover
- defaultAutoHide: true,
- // Update popper on content resize
- defaultHandleResize: true
- }
-};
+/**
+ * Pedantic Inline Grammar
+ */
-function getOptions(options) {
- var result = {
- placement: typeof options.placement !== 'undefined' ? options.placement : directive.options.defaultPlacement,
- delay: typeof options.delay !== 'undefined' ? options.delay : directive.options.defaultDelay,
- html: typeof options.html !== 'undefined' ? options.html : directive.options.defaultHtml,
- template: typeof options.template !== 'undefined' ? options.template : directive.options.defaultTemplate,
- arrowSelector: typeof options.arrowSelector !== 'undefined' ? options.arrowSelector : directive.options.defaultArrowSelector,
- innerSelector: typeof options.innerSelector !== 'undefined' ? options.innerSelector : directive.options.defaultInnerSelector,
- trigger: typeof options.trigger !== 'undefined' ? options.trigger : directive.options.defaultTrigger,
- offset: typeof options.offset !== 'undefined' ? options.offset : directive.options.defaultOffset,
- container: typeof options.container !== 'undefined' ? options.container : directive.options.defaultContainer,
- boundariesElement: typeof options.boundariesElement !== 'undefined' ? options.boundariesElement : directive.options.defaultBoundariesElement,
- autoHide: typeof options.autoHide !== 'undefined' ? options.autoHide : directive.options.autoHide,
- hideOnTargetClick: typeof options.hideOnTargetClick !== 'undefined' ? options.hideOnTargetClick : directive.options.defaultHideOnTargetClick,
- loadingClass: typeof options.loadingClass !== 'undefined' ? options.loadingClass : directive.options.defaultLoadingClass,
- loadingContent: typeof options.loadingContent !== 'undefined' ? options.loadingContent : directive.options.defaultLoadingContent,
- popperOptions: _extends$1({}, typeof options.popperOptions !== 'undefined' ? options.popperOptions : directive.options.defaultPopperOptions)
- };
-
- if (result.offset) {
- var typeofOffset = _typeof(result.offset);
- var offset = result.offset;
-
- // One value -> switch
- if (typeofOffset === 'number' || typeofOffset === 'string' && offset.indexOf(',') === -1) {
- offset = '0, ' + offset;
- }
-
- if (!result.popperOptions.modifiers) {
- result.popperOptions.modifiers = {};
- }
- result.popperOptions.modifiers.offset = {
- offset: offset
- };
- }
-
- if (result.trigger && result.trigger.indexOf('click') !== -1) {
- result.hideOnTargetClick = false;
- }
-
- return result;
-}
+inline.pedantic = merge({}, inline.normal, {
+ strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
+ em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
+ link: edit(/^!?\[(label)\]\((.*?)\)/)
+ .replace('label', inline._label)
+ .getRegex(),
+ reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
+ .replace('label', inline._label)
+ .getRegex()
+});
-function getPlacement(value, modifiers) {
- var placement = value.placement;
- for (var i = 0; i < positions.length; i++) {
- var pos = positions[i];
- if (modifiers[pos]) {
- placement = pos;
- }
- }
- return placement;
-}
+/**
+ * GFM Inline Grammar
+ */
-function getContent(value) {
- var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
- if (type === 'string') {
- return value;
- } else if (value && type === 'object') {
- return value.content;
- } else {
- return false;
- }
-}
+inline.gfm = merge({}, inline.normal, {
+ escape: edit(inline.escape).replace('])', '~|])').getRegex(),
+ _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
+ url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
+ _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
+ del: /^~+(?=\S)([\s\S]*?\S)~+/,
+ text: edit(inline.text)
+ .replace(']|', '~]|')
+ .replace('|$', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|$')
+ .getRegex()
+});
-function createTooltip(el, value) {
- var modifiers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
-
- var content = getContent(value);
- var classes = typeof value.classes !== 'undefined' ? value.classes : directive.options.defaultClass;
- var opts = _extends$1({
- title: content
- }, getOptions(_extends$1({}, value, {
- placement: getPlacement(value, modifiers)
- })));
- var tooltip = el._tooltip = new Tooltip(el, opts);
- tooltip.setClasses(classes);
- tooltip._vueEl = el;
-
- // Class on target
- var targetClasses = typeof value.targetClasses !== 'undefined' ? value.targetClasses : directive.options.defaultTargetClass;
- el._tooltipTargetClasses = targetClasses;
- addClasses(el, targetClasses);
-
- return tooltip;
-}
+inline.gfm.url = edit(inline.gfm.url, 'i')
+ .replace('email', inline.gfm._extended_email)
+ .getRegex();
+/**
+ * GFM + Line Breaks Inline Grammar
+ */
-function destroyTooltip(el) {
- if (el._tooltip) {
- el._tooltip.dispose();
- delete el._tooltip;
- delete el._tooltipOldShow;
- }
-
- if (el._tooltipTargetClasses) {
- removeClasses(el, el._tooltipTargetClasses);
- delete el._tooltipTargetClasses;
- }
-}
+inline.breaks = merge({}, inline.gfm, {
+ br: edit(inline.br).replace('{2,}', '*').getRegex(),
+ text: edit(inline.gfm.text).replace('{2,}', '*').getRegex()
+});
-function bind(el, _ref) {
- var value = _ref.value,
- oldValue = _ref.oldValue,
- modifiers = _ref.modifiers;
-
- var content = getContent(value);
- if (!content || !state.enabled) {
- destroyTooltip(el);
- } else {
- var tooltip = void 0;
- if (el._tooltip) {
- tooltip = el._tooltip;
- // Content
- tooltip.setContent(content);
- // Options
- tooltip.setOptions(_extends$1({}, value, {
- placement: getPlacement(value, modifiers)
- }));
- } else {
- tooltip = createTooltip(el, value, modifiers);
- }
-
- // Manual show
- if (typeof value.show !== 'undefined' && value.show !== el._tooltipOldShow) {
- el._tooltipOldShow = value.show;
- value.show ? tooltip.show() : tooltip.hide();
- }
- }
-}
+/**
+ * Inline Lexer & Compiler
+ */
-var directive = {
- options: defaultOptions,
- bind: bind,
- update: bind,
- unbind: function unbind(el) {
- destroyTooltip(el);
- }
-};
+function InlineLexer(links, options) {
+ this.options = options || marked.defaults;
+ this.links = links;
+ this.rules = inline.normal;
+ this.renderer = this.options.renderer || new Renderer();
+ this.renderer.options = this.options;
-function addListeners(el) {
- el.addEventListener('click', onClick);
- el.addEventListener('touchstart', onTouchStart, supportsPassive ? {
- passive: true
- } : false);
-}
-
-function removeListeners(el) {
- el.removeEventListener('click', onClick);
- el.removeEventListener('touchstart', onTouchStart);
- el.removeEventListener('touchend', onTouchEnd);
- el.removeEventListener('touchcancel', onTouchCancel);
-}
+ if (!this.links) {
+ throw new Error('Tokens array requires a `links` property.');
+ }
-function onClick(event) {
- var el = event.currentTarget;
- event.closePopover = !el.$_vclosepopover_touch;
- event.closeAllPopover = el.$_closePopoverModifiers && !!el.$_closePopoverModifiers.all;
+ if (this.options.pedantic) {
+ this.rules = inline.pedantic;
+ } else if (this.options.gfm) {
+ if (this.options.breaks) {
+ this.rules = inline.breaks;
+ } else {
+ this.rules = inline.gfm;
+ }
+ }
}
-function onTouchStart(event) {
- if (event.changedTouches.length === 1) {
- var el = event.currentTarget;
- el.$_vclosepopover_touch = true;
- var touch = event.changedTouches[0];
- el.$_vclosepopover_touchPoint = touch;
- el.addEventListener('touchend', onTouchEnd);
- el.addEventListener('touchcancel', onTouchCancel);
- }
-}
+/**
+ * Expose Inline Rules
+ */
-function onTouchEnd(event) {
- var el = event.currentTarget;
- el.$_vclosepopover_touch = false;
- if (event.changedTouches.length === 1) {
- var touch = event.changedTouches[0];
- var firstTouch = el.$_vclosepopover_touchPoint;
- event.closePopover = Math.abs(touch.screenY - firstTouch.screenY) < 20 && Math.abs(touch.screenX - firstTouch.screenX) < 20;
- event.closeAllPopover = el.$_closePopoverModifiers && !!el.$_closePopoverModifiers.all;
- }
-}
+InlineLexer.rules = inline;
-function onTouchCancel(event) {
- var el = event.currentTarget;
- el.$_vclosepopover_touch = false;
-}
+/**
+ * Static Lexing/Compiling Method
+ */
-var vclosepopover = {
- bind: function bind(el, _ref) {
- var value = _ref.value,
- modifiers = _ref.modifiers;
-
- el.$_closePopoverModifiers = modifiers;
- if (typeof value === 'undefined' || value) {
- addListeners(el);
- }
- },
- update: function update(el, _ref2) {
- var value = _ref2.value,
- oldValue = _ref2.oldValue,
- modifiers = _ref2.modifiers;
-
- el.$_closePopoverModifiers = modifiers;
- if (value !== oldValue) {
- if (typeof value === 'undefined' || value) {
- addListeners(el);
- } else {
- removeListeners(el);
- }
- }
- },
- unbind: function unbind(el) {
- removeListeners(el);
- }
+InlineLexer.output = function(src, links, options) {
+ var inline = new InlineLexer(links, options);
+ return inline.output(src);
};
-function getInternetExplorerVersion() {
- var ua = window.navigator.userAgent;
-
- var msie = ua.indexOf('MSIE ');
- if (msie > 0) {
- // IE 10 or older => return version number
- return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
- }
-
- var trident = ua.indexOf('Trident/');
- if (trident > 0) {
- // IE 11 => return version number
- var rv = ua.indexOf('rv:');
- return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
- }
-
- var edge = ua.indexOf('Edge/');
- if (edge > 0) {
- // Edge (IE 12+) => return version number
- return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
- }
-
- // other browser
- return -1;
-}
-
-var isIE$1 = void 0;
+/**
+ * Lexing/Compiling
+ */
-function initCompat() {
- if (!initCompat.init) {
- initCompat.init = true;
- isIE$1 = getInternetExplorerVersion() !== -1;
- }
-}
+InlineLexer.prototype.output = function(src) {
+ var out = '',
+ link,
+ text,
+ href,
+ title,
+ cap,
+ prevCapZero;
-var ResizeObserver = { render: function render() {
- var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { staticClass: "resize-observer", attrs: { "tabindex": "-1" } });
- }, staticRenderFns: [], _scopeId: 'data-v-b329ee4c',
- name: 'resize-observer',
-
- methods: {
- notify: function notify() {
- this.$emit('notify');
- },
- addResizeHandlers: function addResizeHandlers() {
- this._resizeObject.contentDocument.defaultView.addEventListener('resize', this.notify);
- if (this._w !== this.$el.offsetWidth || this._h !== this.$el.offsetHeight) {
- this.notify();
- }
- },
- removeResizeHandlers: function removeResizeHandlers() {
- if (this._resizeObject && this._resizeObject.onload) {
- if (!isIE$1 && this._resizeObject.contentDocument) {
- this._resizeObject.contentDocument.defaultView.removeEventListener('resize', this.notify);
- }
- delete this._resizeObject.onload;
- }
- }
- },
-
- mounted: function mounted() {
- var _this = this;
-
- initCompat();
- this.$nextTick(function () {
- _this._w = _this.$el.offsetWidth;
- _this._h = _this.$el.offsetHeight;
- });
- var object = document.createElement('object');
- this._resizeObject = object;
- object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;');
- object.setAttribute('aria-hidden', 'true');
- object.setAttribute('tabindex', -1);
- object.onload = this.addResizeHandlers;
- object.type = 'text/html';
- if (isIE$1) {
- this.$el.appendChild(object);
- }
- object.data = 'about:blank';
- if (!isIE$1) {
- this.$el.appendChild(object);
- }
- },
- beforeDestroy: function beforeDestroy() {
- this.removeResizeHandlers();
- }
-};
+ while (src) {
+ // escape
+ if (cap = this.rules.escape.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += escape(cap[1]);
+ continue;
+ }
-// Install the components
-function install$1(Vue) {
- Vue.component('resize-observer', ResizeObserver);
- /* -- Add more components here -- */
-}
+ // tag
+ if (cap = this.rules.tag.exec(src)) {
+ if (!this.inLink && /^<a /i.test(cap[0])) {
+ this.inLink = true;
+ } else if (this.inLink && /^<\/a>/i.test(cap[0])) {
+ this.inLink = false;
+ }
+ if (!this.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
+ this.inRawBlock = true;
+ } else if (this.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
+ this.inRawBlock = false;
+ }
-/* -- Plugin definition & Auto-install -- */
-/* You shouldn't have to modify the code below */
+ src = src.substring(cap[0].length);
+ out += this.options.sanitize
+ ? this.options.sanitizer
+ ? this.options.sanitizer(cap[0])
+ : escape(cap[0])
+ : cap[0];
+ continue;
+ }
-// Plugin
-var plugin$2 = {
- // eslint-disable-next-line no-undef
- version: "0.4.4",
- install: install$1
-};
+ // link
+ if (cap = this.rules.link.exec(src)) {
+ var lastParenIndex = findClosingBracket(cap[2], '()');
+ if (lastParenIndex > -1) {
+ var removeChars = cap[2].length - lastParenIndex;
+ cap[2] = cap[2].substring(0, lastParenIndex);
+ cap[0] = cap[0].substring(0, cap[0].length - removeChars);
+ }
+ src = src.substring(cap[0].length);
+ this.inLink = true;
+ href = cap[2];
+ if (this.options.pedantic) {
+ link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
+
+ if (link) {
+ href = link[1];
+ title = link[3];
+ } else {
+ title = '';
+ }
+ } else {
+ title = cap[3] ? cap[3].slice(1, -1) : '';
+ }
+ href = href.trim().replace(/^<([\s\S]*)>$/, '$1');
+ out += this.outputLink(cap, {
+ href: InlineLexer.escapes(href),
+ title: InlineLexer.escapes(title)
+ });
+ this.inLink = false;
+ continue;
+ }
-// Auto-install
-var GlobalVue$1 = null;
-if (typeof window !== 'undefined') {
- GlobalVue$1 = window.Vue;
-} else if (typeof global !== 'undefined') {
- GlobalVue$1 = global.Vue;
-}
-if (GlobalVue$1) {
- GlobalVue$1.use(plugin$2);
-}
+ // reflink, nolink
+ if ((cap = this.rules.reflink.exec(src))
+ || (cap = this.rules.nolink.exec(src))) {
+ src = src.substring(cap[0].length);
+ link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
+ link = this.links[link.toLowerCase()];
+ if (!link || !link.href) {
+ out += cap[0].charAt(0);
+ src = cap[0].substring(1) + src;
+ continue;
+ }
+ this.inLink = true;
+ out += this.outputLink(cap, link);
+ this.inLink = false;
+ continue;
+ }
-function getDefault(key) {
- var value = directive.options.popover[key];
- if (typeof value === 'undefined') {
- return directive.options[key];
- }
- return value;
-}
+ // strong
+ if (cap = this.rules.strong.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.strong(this.output(cap[4] || cap[3] || cap[2] || cap[1]));
+ continue;
+ }
-var isIOS = false;
-if (typeof window !== 'undefined' && typeof navigator !== 'undefined') {
- isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
-}
+ // em
+ if (cap = this.rules.em.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.em(this.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1]));
+ continue;
+ }
-var openPopovers = [];
+ // code
+ if (cap = this.rules.code.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.codespan(escape(cap[2].trim(), true));
+ continue;
+ }
-var Element = function Element() {};
-if (typeof window !== 'undefined') {
- Element = window.Element;
-}
+ // br
+ if (cap = this.rules.br.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.br();
+ continue;
+ }
-var Popover = { render: function render() {
- var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { staticClass: "v-popover", class: _vm.cssClass }, [_c('span', { ref: "trigger", staticClass: "trigger", staticStyle: { "display": "inline-block" }, attrs: { "aria-describedby": _vm.popoverId, "tabindex": _vm.trigger.indexOf('focus') !== -1 ? 0 : -1 } }, [_vm._t("default")], 2), _vm._v(" "), _c('div', { ref: "popover", class: [_vm.popoverBaseClass, _vm.popoverClass, _vm.cssClass], style: {
- visibility: _vm.isOpen ? 'visible' : 'hidden'
- }, attrs: { "id": _vm.popoverId, "aria-hidden": _vm.isOpen ? 'false' : 'true' } }, [_c('div', { class: _vm.popoverWrapperClass }, [_c('div', { ref: "inner", class: _vm.popoverInnerClass, staticStyle: { "position": "relative" } }, [_c('div', [_vm._t("popover")], 2), _vm._v(" "), _vm.handleResize ? _c('ResizeObserver', { on: { "notify": _vm.$_handleResize } }) : _vm._e()], 1), _vm._v(" "), _c('div', { ref: "arrow", class: _vm.popoverArrowClass })])])]);
- }, staticRenderFns: [],
- name: 'VPopover',
-
- components: {
- ResizeObserver: ResizeObserver
- },
-
- props: {
- open: {
- type: Boolean,
- default: false
- },
- disabled: {
- type: Boolean,
- default: false
- },
- placement: {
- type: String,
- default: function _default() {
- return getDefault('defaultPlacement');
- }
- },
- delay: {
- type: [String, Number, Object],
- default: function _default() {
- return getDefault('defaultDelay');
- }
- },
- offset: {
- type: [String, Number],
- default: function _default() {
- return getDefault('defaultOffset');
- }
- },
- trigger: {
- type: String,
- default: function _default() {
- return getDefault('defaultTrigger');
- }
- },
- container: {
- type: [String, Object, Element, Boolean],
- default: function _default() {
- return getDefault('defaultContainer');
- }
- },
- boundariesElement: {
- type: [String, Element],
- default: function _default() {
- return getDefault('defaultBoundariesElement');
- }
- },
- popperOptions: {
- type: Object,
- default: function _default() {
- return getDefault('defaultPopperOptions');
- }
- },
- popoverClass: {
- type: [String, Array],
- default: function _default() {
- return getDefault('defaultClass');
- }
- },
- popoverBaseClass: {
- type: [String, Array],
- default: function _default() {
- return directive.options.popover.defaultBaseClass;
- }
- },
- popoverInnerClass: {
- type: [String, Array],
- default: function _default() {
- return directive.options.popover.defaultInnerClass;
- }
- },
- popoverWrapperClass: {
- type: [String, Array],
- default: function _default() {
- return directive.options.popover.defaultWrapperClass;
- }
- },
- popoverArrowClass: {
- type: [String, Array],
- default: function _default() {
- return directive.options.popover.defaultArrowClass;
- }
- },
- autoHide: {
- type: Boolean,
- default: function _default() {
- return directive.options.popover.defaultAutoHide;
- }
- },
- handleResize: {
- type: Boolean,
- default: function _default() {
- return directive.options.popover.defaultHandleResize;
- }
- },
- openGroup: {
- type: String,
- default: null
- }
- },
-
- data: function data() {
- return {
- isOpen: false,
- id: Math.random().toString(36).substr(2, 10)
- };
- },
-
-
- computed: {
- cssClass: function cssClass() {
- return {
- 'open': this.isOpen
- };
- },
- popoverId: function popoverId() {
- return 'popover_' + this.id;
- }
- },
-
- watch: {
- open: function open(val) {
- if (val) {
- this.show();
- } else {
- this.hide();
- }
- },
- disabled: function disabled(val, oldVal) {
- if (val !== oldVal) {
- if (val) {
- this.hide();
- } else if (this.open) {
- this.show();
- }
- }
- },
- container: function container(val) {
- if (this.isOpen && this.popperInstance) {
- var popoverNode = this.$refs.popover;
- var reference = this.$refs.trigger;
-
- var container = this.$_findContainer(this.container, reference);
- if (!container) {
- console.warn('No container for popover', this);
- return;
- }
-
- container.appendChild(popoverNode);
- this.popperInstance.scheduleUpdate();
- }
- },
- trigger: function trigger(val) {
- this.$_removeEventListeners();
- this.$_addEventListeners();
- },
- placement: function placement(val) {
- var _this = this;
-
- this.$_updatePopper(function () {
- _this.popperInstance.options.placement = val;
- });
- },
-
-
- offset: '$_restartPopper',
-
- boundariesElement: '$_restartPopper',
-
- popperOptions: {
- handler: '$_restartPopper',
- deep: true
- }
- },
-
- created: function created() {
- this.$_isDisposed = false;
- this.$_mounted = false;
- this.$_events = [];
- this.$_preventOpen = false;
- },
- mounted: function mounted() {
- var popoverNode = this.$refs.popover;
- popoverNode.parentNode && popoverNode.parentNode.removeChild(popoverNode);
-
- this.$_init();
-
- if (this.open) {
- this.show();
- }
- },
- beforeDestroy: function beforeDestroy() {
- this.dispose();
- },
-
-
- methods: {
- show: function show() {
- var _this2 = this;
-
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- event = _ref.event,
- _ref$skipDelay = _ref.skipDelay,
- skipDelay = _ref$skipDelay === undefined ? false : _ref$skipDelay,
- _ref$force = _ref.force,
- force = _ref$force === undefined ? false : _ref$force;
-
- if (force || !this.disabled) {
- this.$_scheduleShow(event);
- this.$emit('show');
- }
- this.$emit('update:open', true);
- this.$_beingShowed = true;
- requestAnimationFrame(function () {
- _this2.$_beingShowed = false;
- });
- },
- hide: function hide() {
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- event = _ref2.event,
- _ref2$skipDelay = _ref2.skipDelay;
-
- this.$_scheduleHide(event);
-
- this.$emit('hide');
- this.$emit('update:open', false);
- },
- dispose: function dispose() {
- this.$_isDisposed = true;
- this.$_removeEventListeners();
- this.hide({ skipDelay: true });
- if (this.popperInstance) {
- this.popperInstance.destroy();
-
- // destroy tooltipNode if removeOnDestroy is not set, as popperInstance.destroy() already removes the element
- if (!this.popperInstance.options.removeOnDestroy) {
- var popoverNode = this.$refs.popover;
- popoverNode.parentNode && popoverNode.parentNode.removeChild(popoverNode);
- }
- }
- this.$_mounted = false;
- this.popperInstance = null;
- this.isOpen = false;
-
- this.$emit('dispose');
- },
- $_init: function $_init() {
- if (this.trigger.indexOf('manual') === -1) {
- this.$_addEventListeners();
- }
- },
- $_show: function $_show() {
- var _this3 = this;
-
- var reference = this.$refs.trigger;
- var popoverNode = this.$refs.popover;
-
- clearTimeout(this.$_disposeTimer);
-
- // Already open
- if (this.isOpen) {
- return;
- }
-
- // Popper is already initialized
- if (this.popperInstance) {
- this.isOpen = true;
- this.popperInstance.enableEventListeners();
- this.popperInstance.scheduleUpdate();
- }
-
- if (!this.$_mounted) {
- var container = this.$_findContainer(this.container, reference);
- if (!container) {
- console.warn('No container for popover', this);
- return;
- }
- container.appendChild(popoverNode);
- this.$_mounted = true;
- }
-
- if (!this.popperInstance) {
- var popperOptions = _extends$1({}, this.popperOptions, {
- placement: this.placement
- });
-
- popperOptions.modifiers = _extends$1({}, popperOptions.modifiers, {
- arrow: _extends$1({}, popperOptions.modifiers && popperOptions.modifiers.arrow, {
- element: this.$refs.arrow
- })
- });
-
- if (this.offset) {
- var offset = this.$_getOffset();
-
- popperOptions.modifiers.offset = _extends$1({}, popperOptions.modifiers && popperOptions.modifiers.offset, {
- offset: offset
- });
- }
-
- if (this.boundariesElement) {
- popperOptions.modifiers.preventOverflow = _extends$1({}, popperOptions.modifiers && popperOptions.modifiers.preventOverflow, {
- boundariesElement: this.boundariesElement
- });
- }
-
- this.popperInstance = new Popper(reference, popoverNode, popperOptions);
-
- // Fix position
- requestAnimationFrame(function () {
- if (!_this3.$_isDisposed && _this3.popperInstance) {
- _this3.popperInstance.scheduleUpdate();
-
- // Show the tooltip
- requestAnimationFrame(function () {
- if (!_this3.$_isDisposed) {
- _this3.isOpen = true;
- } else {
- _this3.dispose();
- }
- });
- } else {
- _this3.dispose();
- }
- });
- }
-
- var openGroup = this.openGroup;
- if (openGroup) {
- var popover = void 0;
- for (var i = 0; i < openPopovers.length; i++) {
- popover = openPopovers[i];
- if (popover.openGroup !== openGroup) {
- popover.hide();
- popover.$emit('close-group');
- }
- }
- }
-
- openPopovers.push(this);
-
- this.$emit('apply-show');
- },
- $_hide: function $_hide() {
- var _this4 = this;
-
- // Already hidden
- if (!this.isOpen) {
- return;
- }
-
- var index = openPopovers.indexOf(this);
- if (index !== -1) {
- openPopovers.splice(index, 1);
- }
-
- this.isOpen = false;
- if (this.popperInstance) {
- this.popperInstance.disableEventListeners();
- }
-
- clearTimeout(this.$_disposeTimer);
- var disposeTime = directive.options.popover.disposeTimeout || directive.options.disposeTimeout;
- if (disposeTime !== null) {
- this.$_disposeTimer = setTimeout(function () {
- var popoverNode = _this4.$refs.popover;
- if (popoverNode) {
- // Don't remove popper instance, just the HTML element
- popoverNode.parentNode && popoverNode.parentNode.removeChild(popoverNode);
- _this4.$_mounted = false;
- }
- }, disposeTime);
- }
-
- this.$emit('apply-hide');
- },
- $_findContainer: function $_findContainer(container, reference) {
- // if container is a query, get the relative element
- if (typeof container === 'string') {
- container = window.document.querySelector(container);
- } else if (container === false) {
- // if container is `false`, set it to reference parent
- container = reference.parentNode;
- }
- return container;
- },
- $_getOffset: function $_getOffset() {
- var typeofOffset = _typeof(this.offset);
- var offset = this.offset;
-
- // One value -> switch
- if (typeofOffset === 'number' || typeofOffset === 'string' && offset.indexOf(',') === -1) {
- offset = '0, ' + offset;
- }
-
- return offset;
- },
- $_addEventListeners: function $_addEventListeners() {
- var _this5 = this;
-
- var reference = this.$refs.trigger;
- var directEvents = [];
- var oppositeEvents = [];
-
- var events = typeof this.trigger === 'string' ? this.trigger.split(' ').filter(function (trigger) {
- return ['click', 'hover', 'focus'].indexOf(trigger) !== -1;
- }) : [];
-
- events.forEach(function (event) {
- switch (event) {
- case 'hover':
- directEvents.push('mouseenter');
- oppositeEvents.push('mouseleave');
- break;
- case 'focus':
- directEvents.push('focus');
- oppositeEvents.push('blur');
- break;
- case 'click':
- directEvents.push('click');
- oppositeEvents.push('click');
- break;
- }
- });
-
- // schedule show tooltip
- directEvents.forEach(function (event) {
- var func = function func(event) {
- if (_this5.isOpen) {
- return;
- }
- event.usedByTooltip = true;
- !_this5.$_preventOpen && _this5.show({ event: event });
- };
- _this5.$_events.push({ event: event, func: func });
- reference.addEventListener(event, func);
- });
-
- // schedule hide tooltip
- oppositeEvents.forEach(function (event) {
- var func = function func(event) {
- if (event.usedByTooltip) {
- return;
- }
- _this5.hide({ event: event });
- };
- _this5.$_events.push({ event: event, func: func });
- reference.addEventListener(event, func);
- });
- },
- $_scheduleShow: function $_scheduleShow() {
- var skipDelay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- clearTimeout(this.$_scheduleTimer);
- if (skipDelay) {
- this.$_show();
- } else {
- // defaults to 0
- var computedDelay = parseInt(this.delay && this.delay.show || this.delay || 0);
- this.$_scheduleTimer = setTimeout(this.$_show.bind(this), computedDelay);
- }
- },
- $_scheduleHide: function $_scheduleHide() {
- var _this6 = this;
-
- var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
- var skipDelay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- clearTimeout(this.$_scheduleTimer);
- if (skipDelay) {
- this.$_hide();
- } else {
- // defaults to 0
- var computedDelay = parseInt(this.delay && this.delay.hide || this.delay || 0);
- this.$_scheduleTimer = setTimeout(function () {
- if (!_this6.isOpen) {
- return;
- }
-
- // if we are hiding because of a mouseleave, we must check that the new
- // reference isn't the tooltip, because in this case we don't want to hide it
- if (event && event.type === 'mouseleave') {
- var isSet = _this6.$_setTooltipNodeEvent(event);
-
- // if we set the new event, don't hide the tooltip yet
- // the new event will take care to hide it if necessary
- if (isSet) {
- return;
- }
- }
-
- _this6.$_hide();
- }, computedDelay);
- }
- },
- $_setTooltipNodeEvent: function $_setTooltipNodeEvent(event) {
- var _this7 = this;
-
- var reference = this.$refs.trigger;
- var popoverNode = this.$refs.popover;
-
- var relatedreference = event.relatedreference || event.toElement || event.relatedTarget;
-
- var callback = function callback(event2) {
- var relatedreference2 = event2.relatedreference || event2.toElement || event2.relatedTarget;
-
- // Remove event listener after call
- popoverNode.removeEventListener(event.type, callback);
-
- // If the new reference is not the reference element
- if (!reference.contains(relatedreference2)) {
- // Schedule to hide tooltip
- _this7.hide({ event: event2 });
- }
- };
-
- if (popoverNode.contains(relatedreference)) {
- // listen to mouseleave on the tooltip element to be able to hide the tooltip
- popoverNode.addEventListener(event.type, callback);
- return true;
- }
-
- return false;
- },
- $_removeEventListeners: function $_removeEventListeners() {
- var reference = this.$refs.trigger;
- this.$_events.forEach(function (_ref3) {
- var func = _ref3.func,
- event = _ref3.event;
-
- reference.removeEventListener(event, func);
- });
- this.$_events = [];
- },
- $_updatePopper: function $_updatePopper(cb) {
- if (this.popperInstance) {
- cb();
- if (this.isOpen) this.popperInstance.scheduleUpdate();
- }
- },
- $_restartPopper: function $_restartPopper() {
- if (this.popperInstance) {
- var isOpen = this.isOpen;
- this.dispose();
- this.$_isDisposed = false;
- this.$_init();
- if (isOpen) {
- this.show({ skipDelay: true, force: true });
- }
- }
- },
- $_handleGlobalClose: function $_handleGlobalClose(event) {
- var _this8 = this;
-
- var touch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- if (this.$_beingShowed) return;
-
- this.hide({ event: event });
-
- if (event.closePopover) {
- this.$emit('close-directive');
- } else {
- this.$emit('auto-hide');
- }
-
- if (touch) {
- this.$_preventOpen = true;
- setTimeout(function () {
- _this8.$_preventOpen = false;
- }, 300);
- }
- },
- $_handleResize: function $_handleResize() {
- if (this.isOpen && this.popperInstance) {
- this.popperInstance.scheduleUpdate();
- this.$emit('resize');
- }
- }
- }
-};
+ // del (gfm)
+ if (cap = this.rules.del.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.del(this.output(cap[1]));
+ continue;
+ }
-if (typeof document !== 'undefined' && typeof window !== 'undefined') {
- if (isIOS) {
- document.addEventListener('touchend', handleGlobalTouchend, supportsPassive ? {
- passive: true,
- capture: true
- } : true);
- } else {
- window.addEventListener('click', handleGlobalClick, true);
- }
-}
+ // autolink
+ if (cap = this.rules.autolink.exec(src)) {
+ src = src.substring(cap[0].length);
+ if (cap[2] === '@') {
+ text = escape(this.mangle(cap[1]));
+ href = 'mailto:' + text;
+ } else {
+ text = escape(cap[1]);
+ href = text;
+ }
+ out += this.renderer.link(href, null, text);
+ continue;
+ }
-function handleGlobalClick(event) {
- handleGlobalClose(event);
-}
+ // url (gfm)
+ if (!this.inLink && (cap = this.rules.url.exec(src))) {
+ if (cap[2] === '@') {
+ text = escape(cap[0]);
+ href = 'mailto:' + text;
+ } else {
+ // do extended autolink path validation
+ do {
+ prevCapZero = cap[0];
+ cap[0] = this.rules._backpedal.exec(cap[0])[0];
+ } while (prevCapZero !== cap[0]);
+ text = escape(cap[0]);
+ if (cap[1] === 'www.') {
+ href = 'http://' + text;
+ } else {
+ href = text;
+ }
+ }
+ src = src.substring(cap[0].length);
+ out += this.renderer.link(href, null, text);
+ continue;
+ }
-function handleGlobalTouchend(event) {
- handleGlobalClose(event, true);
-}
+ // text
+ if (cap = this.rules.text.exec(src)) {
+ src = src.substring(cap[0].length);
+ if (this.inRawBlock) {
+ out += this.renderer.text(cap[0]);
+ } else {
+ out += this.renderer.text(escape(this.smartypants(cap[0])));
+ }
+ continue;
+ }
-function handleGlobalClose(event) {
- var touch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-
- // Delay so that close directive has time to set values
- requestAnimationFrame(function () {
- var popover = void 0;
- for (var i = 0; i < openPopovers.length; i++) {
- popover = openPopovers[i];
- if (popover.$refs.popover) {
- var contains = popover.$refs.popover.contains(event.target);
- if (event.closeAllPopover || event.closePopover && contains || popover.autoHide && !contains) {
- popover.$_handleGlobalClose(event, touch);
- }
- }
- }
- });
-}
+ if (src) {
+ throw new Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
+ }
-var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+ return out;
+};
+InlineLexer.escapes = function(text) {
+ return text ? text.replace(InlineLexer.rules._escapes, '$1') : text;
+};
+/**
+ * Compile Link
+ */
+InlineLexer.prototype.outputLink = function(cap, link) {
+ var href = link.href,
+ title = link.title ? escape(link.title) : null;
+ return cap[0].charAt(0) !== '!'
+ ? this.renderer.link(href, title, this.output(cap[1]))
+ : this.renderer.image(href, title, escape(cap[1]));
+};
-function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
-}
+/**
+ * Smartypants Transformations
+ */
+
+InlineLexer.prototype.smartypants = function(text) {
+ if (!this.options.smartypants) return text;
+ return text
+ // em-dashes
+ .replace(/---/g, '\u2014')
+ // en-dashes
+ .replace(/--/g, '\u2013')
+ // opening singles
+ .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
+ // closing singles & apostrophes
+ .replace(/'/g, '\u2019')
+ // opening doubles
+ .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
+ // closing doubles
+ .replace(/"/g, '\u201d')
+ // ellipses
+ .replace(/\.{3}/g, '\u2026');
+};
-var lodash_merge = createCommonjsModule(function (module, exports) {
/**
- * Lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright JS Foundation and other contributors <https://js.foundation/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Mangle Links
*/
-/** Used as the size to enable large array optimizations. */
-var LARGE_ARRAY_SIZE = 200;
-
-/** Used to stand-in for `undefined` hash values. */
-var HASH_UNDEFINED = '__lodash_hash_undefined__';
-
-/** Used to detect hot functions by number of calls within a span of milliseconds. */
-var HOT_COUNT = 800,
- HOT_SPAN = 16;
-
-/** Used as references for various `Number` constants. */
-var MAX_SAFE_INTEGER = 9007199254740991;
-
-/** `Object#toString` result references. */
-var argsTag = '[object Arguments]',
- arrayTag = '[object Array]',
- asyncTag = '[object AsyncFunction]',
- boolTag = '[object Boolean]',
- dateTag = '[object Date]',
- errorTag = '[object Error]',
- funcTag = '[object Function]',
- genTag = '[object GeneratorFunction]',
- mapTag = '[object Map]',
- numberTag = '[object Number]',
- nullTag = '[object Null]',
- objectTag = '[object Object]',
- proxyTag = '[object Proxy]',
- regexpTag = '[object RegExp]',
- setTag = '[object Set]',
- stringTag = '[object String]',
- undefinedTag = '[object Undefined]',
- weakMapTag = '[object WeakMap]';
-
-var arrayBufferTag = '[object ArrayBuffer]',
- dataViewTag = '[object DataView]',
- float32Tag = '[object Float32Array]',
- float64Tag = '[object Float64Array]',
- int8Tag = '[object Int8Array]',
- int16Tag = '[object Int16Array]',
- int32Tag = '[object Int32Array]',
- uint8Tag = '[object Uint8Array]',
- uint8ClampedTag = '[object Uint8ClampedArray]',
- uint16Tag = '[object Uint16Array]',
- uint32Tag = '[object Uint32Array]';
+InlineLexer.prototype.mangle = function(text) {
+ if (!this.options.mangle) return text;
+ var out = '',
+ l = text.length,
+ i = 0,
+ ch;
+
+ for (; i < l; i++) {
+ ch = text.charCodeAt(i);
+ if (Math.random() > 0.5) {
+ ch = 'x' + ch.toString(16);
+ }
+ out += '&#' + ch + ';';
+ }
+
+ return out;
+};
/**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
+ * Renderer
*/
-var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
-/** Used to detect host constructors (Safari). */
-var reIsHostCtor = /^\[object .+?Constructor\]$/;
+function Renderer(options) {
+ this.options = options || marked.defaults;
+}
-/** Used to detect unsigned integer values. */
-var reIsUint = /^(?:0|[1-9]\d*)$/;
+Renderer.prototype.code = function(code, infostring, escaped) {
+ var lang = (infostring || '').match(/\S*/)[0];
+ if (this.options.highlight) {
+ var out = this.options.highlight(code, lang);
+ if (out != null && out !== code) {
+ escaped = true;
+ code = out;
+ }
+ }
+
+ if (!lang) {
+ return '<pre><code>'
+ + (escaped ? code : escape(code, true))
+ + '</code></pre>';
+ }
-/** Used to identify `toStringTag` values of typed arrays. */
-var typedArrayTags = {};
-typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
-typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
-typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
-typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
-typedArrayTags[uint32Tag] = true;
-typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
-typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
-typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
-typedArrayTags[errorTag] = typedArrayTags[funcTag] =
-typedArrayTags[mapTag] = typedArrayTags[numberTag] =
-typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
-typedArrayTags[setTag] = typedArrayTags[stringTag] =
-typedArrayTags[weakMapTag] = false;
+ return '<pre><code class="'
+ + this.options.langPrefix
+ + escape(lang, true)
+ + '">'
+ + (escaped ? code : escape(code, true))
+ + '</code></pre>\n';
+};
-/** Detect free variable `global` from Node.js. */
-var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
+Renderer.prototype.blockquote = function(quote) {
+ return '<blockquote>\n' + quote + '</blockquote>\n';
+};
-/** Detect free variable `self`. */
-var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+Renderer.prototype.html = function(html) {
+ return html;
+};
-/** Used as a reference to the global object. */
-var root = freeGlobal || freeSelf || Function('return this')();
+Renderer.prototype.heading = function(text, level, raw, slugger) {
+ if (this.options.headerIds) {
+ return '<h'
+ + level
+ + ' id="'
+ + this.options.headerPrefix
+ + slugger.slug(raw)
+ + '">'
+ + text
+ + '</h'
+ + level
+ + '>\n';
+ }
+ // ignore IDs
+ return '<h' + level + '>' + text + '</h' + level + '>\n';
+};
-/** Detect free variable `exports`. */
-var freeExports = true && exports && !exports.nodeType && exports;
+Renderer.prototype.hr = function() {
+ return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
+};
-/** Detect free variable `module`. */
-var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
+Renderer.prototype.list = function(body, ordered, start) {
+ var type = ordered ? 'ol' : 'ul',
+ startatt = (ordered && start !== 1) ? (' start="' + start + '"') : '';
+ return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
+};
-/** Detect the popular CommonJS extension `module.exports`. */
-var moduleExports = freeModule && freeModule.exports === freeExports;
+Renderer.prototype.listitem = function(text) {
+ return '<li>' + text + '</li>\n';
+};
-/** Detect free variable `process` from Node.js. */
-var freeProcess = moduleExports && freeGlobal.process;
+Renderer.prototype.checkbox = function(checked) {
+ return '<input '
+ + (checked ? 'checked="" ' : '')
+ + 'disabled="" type="checkbox"'
+ + (this.options.xhtml ? ' /' : '')
+ + '> ';
+};
-/** Used to access faster Node.js helpers. */
-var nodeUtil = (function() {
- try {
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
- } catch (e) {}
-}());
+Renderer.prototype.paragraph = function(text) {
+ return '<p>' + text + '</p>\n';
+};
-/* Node.js helper references. */
-var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
+Renderer.prototype.table = function(header, body) {
+ if (body) body = '<tbody>' + body + '</tbody>';
-/**
- * A faster alternative to `Function#apply`, this function invokes `func`
- * with the `this` binding of `thisArg` and the arguments of `args`.
- *
- * @private
- * @param {Function} func The function to invoke.
- * @param {*} thisArg The `this` binding of `func`.
- * @param {Array} args The arguments to invoke `func` with.
- * @returns {*} Returns the result of `func`.
- */
-function apply(func, thisArg, args) {
- switch (args.length) {
- case 0: return func.call(thisArg);
- case 1: return func.call(thisArg, args[0]);
- case 2: return func.call(thisArg, args[0], args[1]);
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
- }
- return func.apply(thisArg, args);
-}
+ return '<table>\n'
+ + '<thead>\n'
+ + header
+ + '</thead>\n'
+ + body
+ + '</table>\n';
+};
-/**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
-function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
+Renderer.prototype.tablerow = function(content) {
+ return '<tr>\n' + content + '</tr>\n';
+};
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
-}
+Renderer.prototype.tablecell = function(content, flags) {
+ var type = flags.header ? 'th' : 'td';
+ var tag = flags.align
+ ? '<' + type + ' align="' + flags.align + '">'
+ : '<' + type + '>';
+ return tag + content + '</' + type + '>\n';
+};
-/**
- * The base implementation of `_.unary` without support for storing metadata.
- *
- * @private
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- */
-function baseUnary(func) {
- return function(value) {
- return func(value);
- };
-}
+// span level renderer
+Renderer.prototype.strong = function(text) {
+ return '<strong>' + text + '</strong>';
+};
-/**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */
-function getValue(object, key) {
- return object == null ? undefined : object[key];
-}
+Renderer.prototype.em = function(text) {
+ return '<em>' + text + '</em>';
+};
-/**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */
-function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
-}
+Renderer.prototype.codespan = function(text) {
+ return '<code>' + text + '</code>';
+};
-/**
- * Gets the value at `key`, unless `key` is "__proto__".
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */
-function safeGet(object, key) {
- return key == '__proto__'
- ? undefined
- : object[key];
-}
+Renderer.prototype.br = function() {
+ return this.options.xhtml ? '<br/>' : '<br>';
+};
-/** Used for built-in method references. */
-var arrayProto = Array.prototype,
- funcProto = Function.prototype,
- objectProto = Object.prototype;
+Renderer.prototype.del = function(text) {
+ return '<del>' + text + '</del>';
+};
-/** Used to detect overreaching core-js shims. */
-var coreJsData = root['__core-js_shared__'];
+Renderer.prototype.link = function(href, title, text) {
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
+ if (href === null) {
+ return text;
+ }
+ var out = '<a href="' + escape(href) + '"';
+ if (title) {
+ out += ' title="' + title + '"';
+ }
+ out += '>' + text + '</a>';
+ return out;
+};
-/** Used to resolve the decompiled source of functions. */
-var funcToString = funcProto.toString;
+Renderer.prototype.image = function(href, title, text) {
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
+ if (href === null) {
+ return text;
+ }
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
+ var out = '<img src="' + href + '" alt="' + text + '"';
+ if (title) {
+ out += ' title="' + title + '"';
+ }
+ out += this.options.xhtml ? '/>' : '>';
+ return out;
+};
-/** Used to detect methods masquerading as native. */
-var maskSrcKey = (function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
- return uid ? ('Symbol(src)_1.' + uid) : '';
-}());
+Renderer.prototype.text = function(text) {
+ return text;
+};
/**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
+ * TextRenderer
+ * returns only the textual part of the token
*/
-var nativeObjectToString = objectProto.toString;
-/** Used to infer the `Object` constructor. */
-var objectCtorString = funcToString.call(Object);
+function TextRenderer() {}
-/** Used to detect if a method is native. */
-var reIsNative = RegExp('^' +
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
-);
+// no need for block level renderers
-/** Built-in value references. */
-var Buffer = moduleExports ? root.Buffer : undefined,
- Symbol = root.Symbol,
- Uint8Array = root.Uint8Array,
- allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
- getPrototype = overArg(Object.getPrototypeOf, Object),
- objectCreate = Object.create,
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
- splice = arrayProto.splice,
- symToStringTag = Symbol ? Symbol.toStringTag : undefined;
-
-var defineProperty = (function() {
- try {
- var func = getNative(Object, 'defineProperty');
- func({}, '', {});
- return func;
- } catch (e) {}
-}());
+TextRenderer.prototype.strong =
+TextRenderer.prototype.em =
+TextRenderer.prototype.codespan =
+TextRenderer.prototype.del =
+TextRenderer.prototype.text = function (text) {
+ return text;
+};
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
- nativeMax = Math.max,
- nativeNow = Date.now;
+TextRenderer.prototype.link =
+TextRenderer.prototype.image = function(href, title, text) {
+ return '' + text;
+};
-/* Built-in method references that are verified to be native. */
-var Map = getNative(root, 'Map'),
- nativeCreate = getNative(Object, 'create');
+TextRenderer.prototype.br = function() {
+ return '';
+};
/**
- * The base implementation of `_.create` without support for assigning
- * properties to the created object.
- *
- * @private
- * @param {Object} proto The object to inherit from.
- * @returns {Object} Returns the new object.
+ * Parsing & Compiling
*/
-var baseCreate = (function() {
- function object() {}
- return function(proto) {
- if (!isObject(proto)) {
- return {};
- }
- if (objectCreate) {
- return objectCreate(proto);
- }
- object.prototype = proto;
- var result = new object;
- object.prototype = undefined;
- return result;
- };
-}());
-/**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
-function Hash(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
-
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
+function Parser(options) {
+ this.tokens = [];
+ this.token = null;
+ this.options = options || marked.defaults;
+ this.options.renderer = this.options.renderer || new Renderer();
+ this.renderer = this.options.renderer;
+ this.renderer.options = this.options;
+ this.slugger = new Slugger();
}
/**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
+ * Static Parse Method
*/
-function hashClear() {
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
- this.size = 0;
-}
-/**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
-function hashDelete(key) {
- var result = this.has(key) && delete this.__data__[key];
- this.size -= result ? 1 : 0;
- return result;
-}
+Parser.parse = function(src, options) {
+ var parser = new Parser(options);
+ return parser.parse(src);
+};
/**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
+ * Parse Loop
*/
-function hashGet(key) {
- var data = this.__data__;
- if (nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED ? undefined : result;
+
+Parser.prototype.parse = function(src) {
+ this.inline = new InlineLexer(src.links, this.options);
+ // use an InlineLexer with a TextRenderer to extract pure text
+ this.inlineText = new InlineLexer(
+ src.links,
+ merge({}, this.options, {renderer: new TextRenderer()})
+ );
+ this.tokens = src.reverse();
+
+ var out = '';
+ while (this.next()) {
+ out += this.tok();
}
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
-}
-/**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
-function hashHas(key) {
- var data = this.__data__;
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
-}
+ return out;
+};
/**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
+ * Next Token
*/
-function hashSet(key, value) {
- var data = this.__data__;
- this.size += this.has(key) ? 0 : 1;
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
- return this;
-}
-// Add methods to `Hash`.
-Hash.prototype.clear = hashClear;
-Hash.prototype['delete'] = hashDelete;
-Hash.prototype.get = hashGet;
-Hash.prototype.has = hashHas;
-Hash.prototype.set = hashSet;
+Parser.prototype.next = function() {
+ return this.token = this.tokens.pop();
+};
/**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
+ * Preview Next Token
*/
-function ListCache(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
-
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-/**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */
-function listCacheClear() {
- this.__data__ = [];
- this.size = 0;
-}
+Parser.prototype.peek = function() {
+ return this.tokens[this.tokens.length - 1] || 0;
+};
/**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ * Parse Text Tokens
*/
-function listCacheDelete(key) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
- if (index < 0) {
- return false;
- }
- var lastIndex = data.length - 1;
- if (index == lastIndex) {
- data.pop();
- } else {
- splice.call(data, index, 1);
- }
- --this.size;
- return true;
-}
+Parser.prototype.parseText = function() {
+ var body = this.token.text;
-/**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
-function listCacheGet(key) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
+ while (this.peek().type === 'text') {
+ body += '\n' + this.next().text;
+ }
- return index < 0 ? undefined : data[index][1];
-}
+ return this.inline.output(body);
+};
/**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ * Parse Current Token
*/
-function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
-}
-/**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */
-function listCacheSet(key, value) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
+Parser.prototype.tok = function() {
+ switch (this.token.type) {
+ case 'space': {
+ return '';
+ }
+ case 'hr': {
+ return this.renderer.hr();
+ }
+ case 'heading': {
+ return this.renderer.heading(
+ this.inline.output(this.token.text),
+ this.token.depth,
+ unescape(this.inlineText.output(this.token.text)),
+ this.slugger);
+ }
+ case 'code': {
+ return this.renderer.code(this.token.text,
+ this.token.lang,
+ this.token.escaped);
+ }
+ case 'table': {
+ var header = '',
+ body = '',
+ i,
+ row,
+ cell,
+ j;
+
+ // header
+ cell = '';
+ for (i = 0; i < this.token.header.length; i++) {
+ cell += this.renderer.tablecell(
+ this.inline.output(this.token.header[i]),
+ { header: true, align: this.token.align[i] }
+ );
+ }
+ header += this.renderer.tablerow(cell);
- if (index < 0) {
- ++this.size;
- data.push([key, value]);
- } else {
- data[index][1] = value;
- }
- return this;
-}
+ for (i = 0; i < this.token.cells.length; i++) {
+ row = this.token.cells[i];
-// Add methods to `ListCache`.
-ListCache.prototype.clear = listCacheClear;
-ListCache.prototype['delete'] = listCacheDelete;
-ListCache.prototype.get = listCacheGet;
-ListCache.prototype.has = listCacheHas;
-ListCache.prototype.set = listCacheSet;
+ cell = '';
+ for (j = 0; j < row.length; j++) {
+ cell += this.renderer.tablecell(
+ this.inline.output(row[j]),
+ { header: false, align: this.token.align[j] }
+ );
+ }
-/**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
-function MapCache(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
-
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
+ body += this.renderer.tablerow(cell);
+ }
+ return this.renderer.table(header, body);
+ }
+ case 'blockquote_start': {
+ body = '';
-/**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */
-function mapCacheClear() {
- this.size = 0;
- this.__data__ = {
- 'hash': new Hash,
- 'map': new (Map || ListCache),
- 'string': new Hash
- };
-}
+ while (this.next().type !== 'blockquote_end') {
+ body += this.tok();
+ }
-/**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
-function mapCacheDelete(key) {
- var result = getMapData(this, key)['delete'](key);
- this.size -= result ? 1 : 0;
- return result;
-}
+ return this.renderer.blockquote(body);
+ }
+ case 'list_start': {
+ body = '';
+ var ordered = this.token.ordered,
+ start = this.token.start;
-/**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
-function mapCacheGet(key) {
- return getMapData(this, key).get(key);
-}
+ while (this.next().type !== 'list_end') {
+ body += this.tok();
+ }
-/**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
-function mapCacheHas(key) {
- return getMapData(this, key).has(key);
-}
+ return this.renderer.list(body, ordered, start);
+ }
+ case 'list_item_start': {
+ body = '';
+ var loose = this.token.loose;
-/**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */
-function mapCacheSet(key, value) {
- var data = getMapData(this, key),
- size = data.size;
+ if (this.token.task) {
+ body += this.renderer.checkbox(this.token.checked);
+ }
- data.set(key, value);
- this.size += data.size == size ? 0 : 1;
- return this;
-}
+ while (this.next().type !== 'list_item_end') {
+ body += !loose && this.token.type === 'text'
+ ? this.parseText()
+ : this.tok();
+ }
-// Add methods to `MapCache`.
-MapCache.prototype.clear = mapCacheClear;
-MapCache.prototype['delete'] = mapCacheDelete;
-MapCache.prototype.get = mapCacheGet;
-MapCache.prototype.has = mapCacheHas;
-MapCache.prototype.set = mapCacheSet;
+ return this.renderer.listitem(body);
+ }
+ case 'html': {
+ // TODO parse inline content if parameter markdown=1
+ return this.renderer.html(this.token.text);
+ }
+ case 'paragraph': {
+ return this.renderer.paragraph(this.inline.output(this.token.text));
+ }
+ case 'text': {
+ return this.renderer.paragraph(this.parseText());
+ }
+ default: {
+ var errMsg = 'Token with "' + this.token.type + '" type was not found.';
+ if (this.options.silent) {
+ console.log(errMsg);
+ } else {
+ throw new Error(errMsg);
+ }
+ }
+ }
+};
/**
- * Creates a stack cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
+ * Slugger generates header id
*/
-function Stack(entries) {
- var data = this.__data__ = new ListCache(entries);
- this.size = data.size;
-}
-/**
- * Removes all key-value entries from the stack.
- *
- * @private
- * @name clear
- * @memberOf Stack
- */
-function stackClear() {
- this.__data__ = new ListCache;
- this.size = 0;
+function Slugger () {
+ this.seen = {};
}
/**
- * Removes `key` and its value from the stack.
- *
- * @private
- * @name delete
- * @memberOf Stack
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ * Convert string to unique id
*/
-function stackDelete(key) {
- var data = this.__data__,
- result = data['delete'](key);
- this.size = data.size;
- return result;
-}
+Slugger.prototype.slug = function (value) {
+ var slug = value
+ .toLowerCase()
+ .trim()
+ .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
+ .replace(/\s/g, '-');
-/**
- * Gets the stack value for `key`.
- *
- * @private
- * @name get
- * @memberOf Stack
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
-function stackGet(key) {
- return this.__data__.get(key);
-}
+ if (this.seen.hasOwnProperty(slug)) {
+ var originalSlug = slug;
+ do {
+ this.seen[originalSlug]++;
+ slug = originalSlug + '-' + this.seen[originalSlug];
+ } while (this.seen.hasOwnProperty(slug));
+ }
+ this.seen[slug] = 0;
-/**
- * Checks if a stack value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Stack
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
-function stackHas(key) {
- return this.__data__.has(key);
-}
+ return slug;
+};
/**
- * Sets the stack `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Stack
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the stack cache instance.
+ * Helpers
*/
-function stackSet(key, value) {
- var data = this.__data__;
- if (data instanceof ListCache) {
- var pairs = data.__data__;
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
- pairs.push([key, value]);
- this.size = ++data.size;
- return this;
+
+function escape(html, encode) {
+ if (encode) {
+ if (escape.escapeTest.test(html)) {
+ return html.replace(escape.escapeReplace, function (ch) { return escape.replacements[ch]; });
+ }
+ } else {
+ if (escape.escapeTestNoEncode.test(html)) {
+ return html.replace(escape.escapeReplaceNoEncode, function (ch) { return escape.replacements[ch]; });
}
- data = this.__data__ = new MapCache(pairs);
}
- data.set(key, value);
- this.size = data.size;
- return this;
+
+ return html;
}
-// Add methods to `Stack`.
-Stack.prototype.clear = stackClear;
-Stack.prototype['delete'] = stackDelete;
-Stack.prototype.get = stackGet;
-Stack.prototype.has = stackHas;
-Stack.prototype.set = stackSet;
+escape.escapeTest = /[&<>"']/;
+escape.escapeReplace = /[&<>"']/g;
+escape.replacements = {
+ '&': '&amp;',
+ '<': '&lt;',
+ '>': '&gt;',
+ '"': '&quot;',
+ "'": '&#39;'
+};
-/**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */
-function arrayLikeKeys(value, inherited) {
- var isArr = isArray(value),
- isArg = !isArr && isArguments(value),
- isBuff = !isArr && !isArg && isBuffer(value),
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
- skipIndexes = isArr || isArg || isBuff || isType,
- result = skipIndexes ? baseTimes(value.length, String) : [],
- length = result.length;
-
- for (var key in value) {
- if ((inherited || hasOwnProperty.call(value, key)) &&
- !(skipIndexes && (
- // Safari 9 has enumerable `arguments.length` in strict mode.
- key == 'length' ||
- // Node.js 0.10 has enumerable non-index properties on buffers.
- (isBuff && (key == 'offset' || key == 'parent')) ||
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
- // Skip index properties.
- isIndex(key, length)
- ))) {
- result.push(key);
+escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
+escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
+
+function unescape(html) {
+ // explicitly match decimal, hex, and named HTML entities
+ return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) {
+ n = n.toLowerCase();
+ if (n === 'colon') return ':';
+ if (n.charAt(0) === '#') {
+ return n.charAt(1) === 'x'
+ ? String.fromCharCode(parseInt(n.substring(2), 16))
+ : String.fromCharCode(+n.substring(1));
}
- }
- return result;
+ return '';
+ });
}
-/**
- * This function is like `assignValue` except that it doesn't assign
- * `undefined` values.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */
-function assignMergeValue(object, key, value) {
- if ((value !== undefined && !eq(object[key], value)) ||
- (value === undefined && !(key in object))) {
- baseAssignValue(object, key, value);
- }
+function edit(regex, opt) {
+ regex = regex.source || regex;
+ opt = opt || '';
+ return {
+ replace: function(name, val) {
+ val = val.source || val;
+ val = val.replace(/(^|[^\[])\^/g, '$1');
+ regex = regex.replace(name, val);
+ return this;
+ },
+ getRegex: function() {
+ return new RegExp(regex, opt);
+ }
+ };
}
-/**
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */
-function assignValue(object, key, value) {
- var objValue = object[key];
- if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
- (value === undefined && !(key in object))) {
- baseAssignValue(object, key, value);
+function cleanUrl(sanitize, base, href) {
+ if (sanitize) {
+ try {
+ var prot = decodeURIComponent(unescape(href))
+ .replace(/[^\w:]/g, '')
+ .toLowerCase();
+ } catch (e) {
+ return null;
+ }
+ if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
+ return null;
+ }
}
+ if (base && !originIndependentUrl.test(href)) {
+ href = resolveUrl(base, href);
+ }
+ try {
+ href = encodeURI(href).replace(/%25/g, '%');
+ } catch (e) {
+ return null;
+ }
+ return href;
}
-/**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
-function assocIndexOf(array, key) {
- var length = array.length;
- while (length--) {
- if (eq(array[length][0], key)) {
- return length;
+function resolveUrl(base, href) {
+ if (!baseUrls[' ' + base]) {
+ // we can ignore everything in base after the last slash of its path component,
+ // but we might need to add _that_
+ // https://tools.ietf.org/html/rfc3986#section-3
+ if (/^[^:]+:\/*[^/]*$/.test(base)) {
+ baseUrls[' ' + base] = base + '/';
+ } else {
+ baseUrls[' ' + base] = rtrim(base, '/', true);
}
}
- return -1;
-}
+ base = baseUrls[' ' + base];
-/**
- * The base implementation of `assignValue` and `assignMergeValue` without
- * value checks.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */
-function baseAssignValue(object, key, value) {
- if (key == '__proto__' && defineProperty) {
- defineProperty(object, key, {
- 'configurable': true,
- 'enumerable': true,
- 'value': value,
- 'writable': true
- });
+ if (href.slice(0, 2) === '//') {
+ return base.replace(/:[\s\S]*/, ':') + href;
+ } else if (href.charAt(0) === '/') {
+ return base.replace(/(:\/*[^/]*)[\s\S]*/, '$1') + href;
} else {
- object[key] = value;
+ return base + href;
}
}
+var baseUrls = {};
+var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
-/**
- * The base implementation of `baseForOwn` which iterates over `object`
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
- * Iteratee functions may exit iteration early by explicitly returning `false`.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
- */
-var baseFor = createBaseFor();
+function noop() {}
+noop.exec = noop;
-/**
- * The base implementation of `getTag` without fallbacks for buggy environments.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
-function baseGetTag(value) {
- if (value == null) {
- return value === undefined ? undefinedTag : nullTag;
- }
- return (symToStringTag && symToStringTag in Object(value))
- ? getRawTag(value)
- : objectToString(value);
-}
-
-/**
- * The base implementation of `_.isArguments`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- */
-function baseIsArguments(value) {
- return isObjectLike(value) && baseGetTag(value) == argsTag;
-}
+function merge(obj) {
+ var i = 1,
+ target,
+ key;
-/**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */
-function baseIsNative(value) {
- if (!isObject(value) || isMasked(value)) {
- return false;
+ for (; i < arguments.length; i++) {
+ target = arguments[i];
+ for (key in target) {
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
+ obj[key] = target[key];
+ }
+ }
}
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
-}
-/**
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- */
-function baseIsTypedArray(value) {
- return isObjectLike(value) &&
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
+ return obj;
}
-/**
- * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
-function baseKeysIn(object) {
- if (!isObject(object)) {
- return nativeKeysIn(object);
+function splitCells(tableRow, count) {
+ // ensure that every cell-delimiting pipe has a space
+ // before it to distinguish it from an escaped pipe
+ var row = tableRow.replace(/\|/g, function (match, offset, str) {
+ var escaped = false,
+ curr = offset;
+ while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
+ if (escaped) {
+ // odd number of slashes means | is escaped
+ // so we leave it alone
+ return '|';
+ } else {
+ // add space before unescaped |
+ return ' |';
+ }
+ }),
+ cells = row.split(/ \|/),
+ i = 0;
+
+ if (cells.length > count) {
+ cells.splice(count);
+ } else {
+ while (cells.length < count) cells.push('');
}
- var isProto = isPrototype(object),
- result = [];
- for (var key in object) {
- if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
- result.push(key);
- }
+ for (; i < cells.length; i++) {
+ // leading or trailing whitespace is ignored per the gfm spec
+ cells[i] = cells[i].trim().replace(/\\\|/g, '|');
}
- return result;
+ return cells;
}
-/**
- * The base implementation of `_.merge` without support for multiple sources.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @param {number} srcIndex The index of `source`.
- * @param {Function} [customizer] The function to customize merged values.
- * @param {Object} [stack] Tracks traversed source values and their merged
- * counterparts.
- */
-function baseMerge(object, source, srcIndex, customizer, stack) {
- if (object === source) {
- return;
+// Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
+// /c*$/ is vulnerable to REDOS.
+// invert: Remove suffix of non-c chars instead. Default falsey.
+function rtrim(str, c, invert) {
+ if (str.length === 0) {
+ return '';
}
- baseFor(source, function(srcValue, key) {
- if (isObject(srcValue)) {
- stack || (stack = new Stack);
- baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
- }
- else {
- var newValue = customizer
- ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
- : undefined;
-
- if (newValue === undefined) {
- newValue = srcValue;
- }
- assignMergeValue(object, key, newValue);
- }
- }, keysIn);
-}
-/**
- * A specialized version of `baseMerge` for arrays and objects which performs
- * deep merges and tracks traversed objects enabling objects with circular
- * references to be merged.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @param {string} key The key of the value to merge.
- * @param {number} srcIndex The index of `source`.
- * @param {Function} mergeFunc The function to merge values.
- * @param {Function} [customizer] The function to customize assigned values.
- * @param {Object} [stack] Tracks traversed source values and their merged
- * counterparts.
- */
-function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
- var objValue = safeGet(object, key),
- srcValue = safeGet(source, key),
- stacked = stack.get(srcValue);
+ // Length of suffix matching the invert condition.
+ var suffLen = 0;
- if (stacked) {
- assignMergeValue(object, key, stacked);
- return;
+ // Step left until we fail to match the invert condition.
+ while (suffLen < str.length) {
+ var currChar = str.charAt(str.length - suffLen - 1);
+ if (currChar === c && !invert) {
+ suffLen++;
+ } else if (currChar !== c && invert) {
+ suffLen++;
+ } else {
+ break;
+ }
}
- var newValue = customizer
- ? customizer(objValue, srcValue, (key + ''), object, source, stack)
- : undefined;
- var isCommon = newValue === undefined;
-
- if (isCommon) {
- var isArr = isArray(srcValue),
- isBuff = !isArr && isBuffer(srcValue),
- isTyped = !isArr && !isBuff && isTypedArray(srcValue);
+ return str.substr(0, str.length - suffLen);
+}
- newValue = srcValue;
- if (isArr || isBuff || isTyped) {
- if (isArray(objValue)) {
- newValue = objValue;
- }
- else if (isArrayLikeObject(objValue)) {
- newValue = copyArray(objValue);
- }
- else if (isBuff) {
- isCommon = false;
- newValue = cloneBuffer(srcValue, true);
- }
- else if (isTyped) {
- isCommon = false;
- newValue = cloneTypedArray(srcValue, true);
- }
- else {
- newValue = [];
- }
- }
- else if (isPlainObject(srcValue) || isArguments(srcValue)) {
- newValue = objValue;
- if (isArguments(objValue)) {
- newValue = toPlainObject(objValue);
- }
- else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
- newValue = initCloneObject(srcValue);
+function findClosingBracket(str, b) {
+ if (str.indexOf(b[1]) === -1) {
+ return -1;
+ }
+ var level = 0;
+ for (var i = 0; i < str.length; i++) {
+ if (str[i] === '\\') {
+ i++;
+ } else if (str[i] === b[0]) {
+ level++;
+ } else if (str[i] === b[1]) {
+ level--;
+ if (level < 0) {
+ return i;
}
}
- else {
- isCommon = false;
- }
}
- if (isCommon) {
- // Recursively merge objects and arrays (susceptible to call stack limits).
- stack.set(srcValue, newValue);
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
- stack['delete'](srcValue);
- }
- assignMergeValue(object, key, newValue);
-}
-
-/**
- * The base implementation of `_.rest` which doesn't validate or coerce arguments.
- *
- * @private
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @returns {Function} Returns the new function.
- */
-function baseRest(func, start) {
- return setToString(overRest(func, start, identity), func + '');
+ return -1;
}
/**
- * The base implementation of `setToString` without support for hot loop shorting.
- *
- * @private
- * @param {Function} func The function to modify.
- * @param {Function} string The `toString` result.
- * @returns {Function} Returns `func`.
+ * Marked
*/
-var baseSetToString = !defineProperty ? identity : function(func, string) {
- return defineProperty(func, 'toString', {
- 'configurable': true,
- 'enumerable': false,
- 'value': constant(string),
- 'writable': true
- });
-};
-/**
- * Creates a clone of `buffer`.
- *
- * @private
- * @param {Buffer} buffer The buffer to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Buffer} Returns the cloned buffer.
- */
-function cloneBuffer(buffer, isDeep) {
- if (isDeep) {
- return buffer.slice();
+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');
}
- var length = buffer.length,
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
- buffer.copy(result);
- return result;
-}
+ if (callback || typeof opt === 'function') {
+ if (!callback) {
+ callback = opt;
+ opt = null;
+ }
-/**
- * Creates a clone of `arrayBuffer`.
- *
- * @private
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
- * @returns {ArrayBuffer} Returns the cloned array buffer.
- */
-function cloneArrayBuffer(arrayBuffer) {
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
- new Uint8Array(result).set(new Uint8Array(arrayBuffer));
- return result;
-}
+ opt = merge({}, marked.defaults, opt || {});
-/**
- * Creates a clone of `typedArray`.
- *
- * @private
- * @param {Object} typedArray The typed array to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned typed array.
- */
-function cloneTypedArray(typedArray, isDeep) {
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
-}
+ var highlight = opt.highlight,
+ tokens,
+ pending,
+ i = 0;
-/**
- * Copies the values of `source` to `array`.
- *
- * @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
- */
-function copyArray(source, array) {
- var index = -1,
- length = source.length;
+ try {
+ tokens = Lexer.lex(src, opt);
+ } catch (e) {
+ return callback(e);
+ }
- array || (array = Array(length));
- while (++index < length) {
- array[index] = source[index];
- }
- return array;
-}
+ pending = tokens.length;
-/**
- * Copies properties of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy properties from.
- * @param {Array} props The property identifiers to copy.
- * @param {Object} [object={}] The object to copy properties to.
- * @param {Function} [customizer] The function to customize copied values.
- * @returns {Object} Returns `object`.
- */
-function copyObject(source, props, object, customizer) {
- var isNew = !object;
- object || (object = {});
+ var done = function(err) {
+ if (err) {
+ opt.highlight = highlight;
+ return callback(err);
+ }
- var index = -1,
- length = props.length;
+ var out;
- while (++index < length) {
- var key = props[index];
+ try {
+ out = Parser.parse(tokens, opt);
+ } catch (e) {
+ err = e;
+ }
- var newValue = customizer
- ? customizer(object[key], source[key], key, object, source)
- : undefined;
+ opt.highlight = highlight;
- if (newValue === undefined) {
- newValue = source[key];
- }
- if (isNew) {
- baseAssignValue(object, key, newValue);
- } else {
- assignValue(object, key, newValue);
- }
- }
- return object;
-}
+ return err
+ ? callback(err)
+ : callback(null, out);
+ };
-/**
- * Creates a function like `_.assign`.
- *
- * @private
- * @param {Function} assigner The function to assign values.
- * @returns {Function} Returns the new assigner function.
- */
-function createAssigner(assigner) {
- return baseRest(function(object, sources) {
- var index = -1,
- length = sources.length,
- customizer = length > 1 ? sources[length - 1] : undefined,
- guard = length > 2 ? sources[2] : undefined;
-
- customizer = (assigner.length > 3 && typeof customizer == 'function')
- ? (length--, customizer)
- : undefined;
-
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
- customizer = length < 3 ? undefined : customizer;
- length = 1;
- }
- object = Object(object);
- while (++index < length) {
- var source = sources[index];
- if (source) {
- assigner(object, source, index, customizer);
- }
+ if (!highlight || highlight.length < 3) {
+ return done();
}
- return object;
- });
-}
-/**
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
-function createBaseFor(fromRight) {
- return function(object, iteratee, keysFunc) {
- var index = -1,
- iterable = Object(object),
- props = keysFunc(object),
- length = props.length;
-
- while (length--) {
- var key = props[fromRight ? length : ++index];
- if (iteratee(iterable[key], key, iterable) === false) {
- break;
- }
+ delete opt.highlight;
+
+ if (!pending) return done();
+
+ for (; i < tokens.length; i++) {
+ (function(token) {
+ if (token.type !== 'code') {
+ return --pending || done();
+ }
+ return highlight(token.text, token.lang, function(err, code) {
+ if (err) return done(err);
+ if (code == null || code === token.text) {
+ return --pending || done();
+ }
+ token.text = code;
+ token.escaped = true;
+ --pending || done();
+ });
+ })(tokens[i]);
}
- return object;
- };
-}
-
-/**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */
-function getMapData(map, key) {
- var data = map.__data__;
- return isKeyable(key)
- ? data[typeof key == 'string' ? 'string' : 'hash']
- : data.map;
-}
-
-/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
-function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : undefined;
-}
-
-/**
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the raw `toStringTag`.
- */
-function getRawTag(value) {
- var isOwn = hasOwnProperty.call(value, symToStringTag),
- tag = value[symToStringTag];
+ return;
+ }
try {
- value[symToStringTag] = undefined;
- var unmasked = true;
- } catch (e) {}
-
- var result = nativeObjectToString.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag] = tag;
- } else {
- delete value[symToStringTag];
+ if (opt) opt = merge({}, marked.defaults, opt);
+ return Parser.parse(Lexer.lex(src, opt), opt);
+ } catch (e) {
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
+ if ((opt || marked.defaults).silent) {
+ return '<p>An error occurred:</p><pre>'
+ + escape(e.message + '', true)
+ + '</pre>';
}
+ throw e;
}
- return result;
}
/**
- * Initializes an object clone.
- *
- * @private
- * @param {Object} object The object to clone.
- * @returns {Object} Returns the initialized clone.
+ * Options
*/
-function initCloneObject(object) {
- return (typeof object.constructor == 'function' && !isPrototype(object))
- ? baseCreate(getPrototype(object))
- : {};
-}
-/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
-function isIndex(value, length) {
- var type = typeof value;
- length = length == null ? MAX_SAFE_INTEGER : length;
-
- return !!length &&
- (type == 'number' ||
- (type != 'symbol' && reIsUint.test(value))) &&
- (value > -1 && value % 1 == 0 && value < length);
-}
+marked.options =
+marked.setOptions = function(opt) {
+ merge(marked.defaults, opt);
+ return marked;
+};
-/**
- * Checks if the given arguments are from an iteratee call.
- *
- * @private
- * @param {*} value The potential iteratee value argument.
- * @param {*} index The potential iteratee index or key argument.
- * @param {*} object The potential iteratee object argument.
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
- * else `false`.
- */
-function isIterateeCall(value, index, object) {
- if (!isObject(object)) {
- return false;
- }
- var type = typeof index;
- if (type == 'number'
- ? (isArrayLike(object) && isIndex(index, object.length))
- : (type == 'string' && index in object)
- ) {
- return eq(object[index], value);
- }
- return false;
-}
+marked.getDefaults = function () {
+ return {
+ baseUrl: null,
+ breaks: false,
+ gfm: true,
+ headerIds: true,
+ headerPrefix: '',
+ highlight: null,
+ langPrefix: 'language-',
+ mangle: true,
+ pedantic: false,
+ renderer: new Renderer(),
+ sanitize: false,
+ sanitizer: null,
+ silent: false,
+ smartLists: false,
+ smartypants: false,
+ tables: true,
+ xhtml: false
+ };
+};
-/**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */
-function isKeyable(value) {
- var type = typeof value;
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
- ? (value !== '__proto__')
- : (value === null);
-}
+marked.defaults = marked.getDefaults();
/**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
+ * Expose
*/
-function isMasked(func) {
- return !!maskSrcKey && (maskSrcKey in func);
-}
-/**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
-function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
+marked.Parser = Parser;
+marked.parser = Parser.parse;
- return value === proto;
-}
+marked.Renderer = Renderer;
+marked.TextRenderer = TextRenderer;
-/**
- * This function is like
- * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * except that it includes inherited enumerable properties.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
-function nativeKeysIn(object) {
- var result = [];
- if (object != null) {
- for (var key in Object(object)) {
- result.push(key);
- }
- }
- return result;
-}
+marked.Lexer = Lexer;
+marked.lexer = Lexer.lex;
-/**
- * Converts `value` to a string using `Object.prototype.toString`.
- *
- * @private
- * @param {*} value The value to convert.
- * @returns {string} Returns the converted string.
- */
-function objectToString(value) {
- return nativeObjectToString.call(value);
-}
+marked.InlineLexer = InlineLexer;
+marked.inlineLexer = InlineLexer.output;
-/**
- * A specialized version of `baseRest` which transforms the rest array.
- *
- * @private
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @param {Function} transform The rest array transform.
- * @returns {Function} Returns the new function.
- */
-function overRest(func, start, transform) {
- start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
- return function() {
- var args = arguments,
- index = -1,
- length = nativeMax(args.length - start, 0),
- array = Array(length);
-
- while (++index < length) {
- array[index] = args[start + index];
- }
- index = -1;
- var otherArgs = Array(start + 1);
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = transform(array);
- return apply(func, this, otherArgs);
- };
-}
+marked.Slugger = Slugger;
-/**
- * Sets the `toString` method of `func` to return `string`.
- *
- * @private
- * @param {Function} func The function to modify.
- * @param {Function} string The `toString` result.
- * @returns {Function} Returns `func`.
- */
-var setToString = shortOut(baseSetToString);
+marked.parse = marked;
-/**
- * Creates a function that'll short out and invoke `identity` instead
- * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
- * milliseconds.
- *
- * @private
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new shortable function.
- */
-function shortOut(func) {
- var count = 0,
- lastCalled = 0;
-
- return function() {
- var stamp = nativeNow(),
- remaining = HOT_SPAN - (stamp - lastCalled);
-
- lastCalled = stamp;
- if (remaining > 0) {
- if (++count >= HOT_COUNT) {
- return arguments[0];
- }
- } else {
- count = 0;
- }
- return func.apply(undefined, arguments);
- };
-}
+if (true) {
+ module.exports = marked;
+} else {}
+})(this || (typeof window !== 'undefined' ? window : global));
-/**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to convert.
- * @returns {string} Returns the source code.
- */
-function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {}
- try {
- return (func + '');
- } catch (e) {}
- }
- return '';
-}
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
-/**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */
-function eq(value, other) {
- return value === other || (value !== value && other !== other);
-}
+/***/ }),
-/**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
-var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
- return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
- !propertyIsEnumerable.call(value, 'callee');
-};
+/***/ "./node_modules/vue-style-loader/lib/addStylesClient.js":
+/*!**************************************************************!*\
+ !*** ./node_modules/vue-style-loader/lib/addStylesClient.js ***!
+ \**************************************************************/
+/*! exports provided: default */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
-var isArray = Array.isArray;
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addStylesClient; });
+/* harmony import */ var _listToStyles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./listToStyles */ "./node_modules/vue-style-loader/lib/listToStyles.js");
+/*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author Tobias Koppers @sokra
+ Modified by Evan You @yyx990803
+*/
-/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
-function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
-}
-/**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */
-function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
-}
-/**
- * Checks if `value` is a buffer.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
- * @example
- *
- * _.isBuffer(new Buffer(2));
- * // => true
- *
- * _.isBuffer(new Uint8Array(2));
- * // => false
- */
-var isBuffer = nativeIsBuffer || stubFalse;
+var hasDocument = typeof document !== 'undefined'
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
-function isFunction(value) {
- if (!isObject(value)) {
- return false;
- }
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
- var tag = baseGetTag(value);
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
+if (typeof DEBUG !== 'undefined' && DEBUG) {
+ if (!hasDocument) {
+ throw new Error(
+ 'vue-style-loader cannot be used in a non-browser environment. ' +
+ "Use { target: 'node' } in your Webpack config to indicate a server-rendering environment."
+ ) }
}
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
-function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+/*
+type StyleObject = {
+ id: number;
+ parts: Array<StyleObjectPart>
}
-/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
-function isObject(value) {
- var type = typeof value;
- return value != null && (type == 'object' || type == 'function');
+type StyleObjectPart = {
+ css: string;
+ media: string;
+ sourceMap: ?string
}
+*/
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
-function isObjectLike(value) {
- return value != null && typeof value == 'object';
+var stylesInDom = {/*
+ [id: number]: {
+ id: number,
+ refs: number,
+ parts: Array<(obj?: StyleObjectPart) => void>
+ }
+*/}
+
+var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
+var singletonElement = null
+var singletonCounter = 0
+var isProduction = false
+var noop = function () {}
+var options = null
+var ssrIdKey = 'data-vue-ssr-id'
+
+// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
+// tags it will allow on a page
+var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
+
+function addStylesClient (parentId, list, _isProduction, _options) {
+ isProduction = _isProduction
+
+ options = _options || {}
+
+ var styles = Object(_listToStyles__WEBPACK_IMPORTED_MODULE_0__["default"])(parentId, list)
+ addStylesToDom(styles)
+
+ return function update (newList) {
+ var mayRemove = []
+ for (var i = 0; i < styles.length; i++) {
+ var item = styles[i]
+ var domStyle = stylesInDom[item.id]
+ domStyle.refs--
+ mayRemove.push(domStyle)
+ }
+ if (newList) {
+ styles = Object(_listToStyles__WEBPACK_IMPORTED_MODULE_0__["default"])(parentId, newList)
+ addStylesToDom(styles)
+ } else {
+ styles = []
+ }
+ for (var i = 0; i < mayRemove.length; i++) {
+ var domStyle = mayRemove[i]
+ if (domStyle.refs === 0) {
+ for (var j = 0; j < domStyle.parts.length; j++) {
+ domStyle.parts[j]()
+ }
+ delete stylesInDom[domStyle.id]
+ }
+ }
+ }
}
-/**
- * Checks if `value` is a plain object, that is, an object created by the
- * `Object` constructor or one with a `[[Prototype]]` of `null`.
- *
- * @static
- * @memberOf _
- * @since 0.8.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * }
- *
- * _.isPlainObject(new Foo);
- * // => false
- *
- * _.isPlainObject([1, 2, 3]);
- * // => false
- *
- * _.isPlainObject({ 'x': 0, 'y': 0 });
- * // => true
- *
- * _.isPlainObject(Object.create(null));
- * // => true
- */
-function isPlainObject(value) {
- if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
- return false;
- }
- var proto = getPrototype(value);
- if (proto === null) {
- return true;
+function addStylesToDom (styles /* Array<StyleObject> */) {
+ for (var i = 0; i < styles.length; i++) {
+ var item = styles[i]
+ var domStyle = stylesInDom[item.id]
+ if (domStyle) {
+ domStyle.refs++
+ for (var j = 0; j < domStyle.parts.length; j++) {
+ domStyle.parts[j](item.parts[j])
+ }
+ for (; j < item.parts.length; j++) {
+ domStyle.parts.push(addStyle(item.parts[j]))
+ }
+ if (domStyle.parts.length > item.parts.length) {
+ domStyle.parts.length = item.parts.length
+ }
+ } else {
+ var parts = []
+ for (var j = 0; j < item.parts.length; j++) {
+ parts.push(addStyle(item.parts[j]))
+ }
+ stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
+ }
}
- var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
- return typeof Ctor == 'function' && Ctor instanceof Ctor &&
- funcToString.call(Ctor) == objectCtorString;
}
-/**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */
-var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
-
-/**
- * Converts `value` to a plain object flattening inherited enumerable string
- * keyed properties of `value` to own properties of the plain object.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {Object} Returns the converted plain object.
- * @example
- *
- * function Foo() {
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.assign({ 'a': 1 }, new Foo);
- * // => { 'a': 1, 'b': 2 }
- *
- * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
- * // => { 'a': 1, 'b': 2, 'c': 3 }
- */
-function toPlainObject(value) {
- return copyObject(value, keysIn(value));
+function createStyleElement () {
+ var styleElement = document.createElement('style')
+ styleElement.type = 'text/css'
+ head.appendChild(styleElement)
+ return styleElement
}
-/**
- * Creates an array of the own and inherited enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keysIn(new Foo);
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
- */
-function keysIn(object) {
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
-}
+function addStyle (obj /* StyleObjectPart */) {
+ var update, remove
+ var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')
-/**
- * This method is like `_.assign` except that it recursively merges own and
- * inherited enumerable string keyed properties of source objects into the
- * destination object. Source properties that resolve to `undefined` are
- * skipped if a destination value exists. Array and plain object properties
- * are merged recursively. Other objects and value types are overridden by
- * assignment. Source objects are applied from left to right. Subsequent
- * sources overwrite property assignments of previous sources.
- *
- * **Note:** This method mutates `object`.
- *
- * @static
- * @memberOf _
- * @since 0.5.0
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
- * @returns {Object} Returns `object`.
- * @example
- *
- * var object = {
- * 'a': [{ 'b': 2 }, { 'd': 4 }]
- * };
- *
- * var other = {
- * 'a': [{ 'c': 3 }, { 'e': 5 }]
- * };
- *
- * _.merge(object, other);
- * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
- */
-var merge = createAssigner(function(object, source, srcIndex) {
- baseMerge(object, source, srcIndex);
-});
+ if (styleElement) {
+ if (isProduction) {
+ // has SSR styles and in production mode.
+ // simply do nothing.
+ return noop
+ } else {
+ // has SSR styles but in dev mode.
+ // for some reason Chrome can't handle source map in server-rendered
+ // style tags - source maps in <style> only works if the style tag is
+ // created and inserted dynamically. So we remove the server rendered
+ // styles and inject new ones.
+ styleElement.parentNode.removeChild(styleElement)
+ }
+ }
-/**
- * Creates a function that returns `value`.
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Util
- * @param {*} value The value to return from the new function.
- * @returns {Function} Returns the new constant function.
- * @example
- *
- * var objects = _.times(2, _.constant({ 'a': 1 }));
- *
- * console.log(objects);
- * // => [{ 'a': 1 }, { 'a': 1 }]
- *
- * console.log(objects[0] === objects[1]);
- * // => true
- */
-function constant(value) {
- return function() {
- return value;
- };
-}
+ if (isOldIE) {
+ // use singleton mode for IE9.
+ var styleIndex = singletonCounter++
+ styleElement = singletonElement || (singletonElement = createStyleElement())
+ update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
+ remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
+ } else {
+ // use multi-style-tag mode in all other cases
+ styleElement = createStyleElement()
+ update = applyToTag.bind(null, styleElement)
+ remove = function () {
+ styleElement.parentNode.removeChild(styleElement)
+ }
+ }
-/**
- * This method returns the first argument it receives.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'a': 1 };
- *
- * console.log(_.identity(object) === object);
- * // => true
- */
-function identity(value) {
- return value;
-}
+ update(obj)
-/**
- * This method returns `false`.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {boolean} Returns `false`.
- * @example
- *
- * _.times(2, _.stubFalse);
- * // => [false, false]
- */
-function stubFalse() {
- return false;
+ return function updateStyle (newObj /* StyleObjectPart */) {
+ if (newObj) {
+ if (newObj.css === obj.css &&
+ newObj.media === obj.media &&
+ newObj.sourceMap === obj.sourceMap) {
+ return
+ }
+ update(obj = newObj)
+ } else {
+ remove()
+ }
+ }
}
-module.exports = merge;
-});
-
-function install(Vue) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+var replaceText = (function () {
+ var textStore = []
- if (install.installed) return;
- install.installed = true;
-
- var finalOptions = {};
- lodash_merge(finalOptions, defaultOptions, options);
+ return function (index, replacement) {
+ textStore[index] = replacement
+ return textStore.filter(Boolean).join('\n')
+ }
+})()
- plugin.options = finalOptions;
- directive.options = finalOptions;
+function applyToSingletonTag (styleElement, index, remove, obj) {
+ var css = remove ? '' : obj.css
- Vue.directive('tooltip', directive);
- Vue.directive('close-popover', vclosepopover);
- Vue.component('v-popover', Popover);
+ if (styleElement.styleSheet) {
+ styleElement.styleSheet.cssText = replaceText(index, css)
+ } else {
+ var cssNode = document.createTextNode(css)
+ var childNodes = styleElement.childNodes
+ if (childNodes[index]) styleElement.removeChild(childNodes[index])
+ if (childNodes.length) {
+ styleElement.insertBefore(cssNode, childNodes[index])
+ } else {
+ styleElement.appendChild(cssNode)
+ }
+ }
}
-var VTooltip = directive;
-var VClosePopover = vclosepopover;
-var VPopover = Popover;
-
-var plugin = {
- install: install,
+function applyToTag (styleElement, obj) {
+ var css = obj.css
+ var media = obj.media
+ var sourceMap = obj.sourceMap
- get enabled() {
- return state.enabled;
- },
+ if (media) {
+ styleElement.setAttribute('media', media)
+ }
+ if (options.ssrId) {
+ styleElement.setAttribute(ssrIdKey, obj.id)
+ }
- set enabled(value) {
- state.enabled = value;
- }
-};
+ if (sourceMap) {
+ // https://developer.chrome.com/devtools/docs/javascript-debugging
+ // this makes source maps inside style tags work properly in Chrome
+ css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
+ // http://stackoverflow.com/a/26603875
+ css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
+ }
-// Auto-install
-var GlobalVue = null;
-if (typeof window !== 'undefined') {
- GlobalVue = window.Vue;
-} else if (typeof global !== 'undefined') {
- GlobalVue = global.Vue;
-}
-if (GlobalVue) {
- GlobalVue.use(plugin);
+ if (styleElement.styleSheet) {
+ styleElement.styleSheet.cssText = css
+ } else {
+ while (styleElement.firstChild) {
+ styleElement.removeChild(styleElement.firstChild)
+ }
+ styleElement.appendChild(document.createTextNode(css))
+ }
}
-/* harmony default export */ __webpack_exports__["default"] = (plugin);
-
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
-
/***/ }),
-/***/ "./node_modules/vue-click-outside/index.js":
-/*!*************************************************!*\
- !*** ./node_modules/vue-click-outside/index.js ***!
- \*************************************************/
-/*! no static exports found */
-/***/ (function(module, exports) {
-
-function validate(binding) {
- if (typeof binding.value !== 'function') {
- console.warn('[Vue-click-outside:] provided expression', binding.expression, 'is not a function.')
- return false
- }
-
- return true
-}
-
-function isPopup(popupItem, elements) {
- if (!popupItem || !elements)
- return false
-
- for (var i = 0, len = elements.length; i < len; i++) {
- try {
- if (popupItem.contains(elements[i])) {
- return true
- }
- if (elements[i].contains(popupItem)) {
- return false
- }
- } catch(e) {
- return false
- }
- }
-
- return false
-}
-
-function isServer(vNode) {
- return typeof vNode.componentInstance !== 'undefined' && vNode.componentInstance.$isServer
-}
-
-exports = module.exports = {
- bind: function (el, binding, vNode) {
- if (!validate(binding)) return
-
- // Define Handler and cache it on the element
- function handler(e) {
- if (!vNode.context) return
-
- // some components may have related popup item, on which we shall prevent the click outside event handler.
- var elements = e.path || (e.composedPath && e.composedPath())
- elements && elements.length > 0 && elements.unshift(e.target)
-
- if (el.contains(e.target) || isPopup(vNode.context.popupItem, elements)) return
-
- el.__vueClickOutside__.callback(e)
- }
-
- // add Event Listeners
- el.__vueClickOutside__ = {
- handler: handler,
- callback: binding.value
- }
- !isServer(vNode) && document.addEventListener('click', handler)
- },
-
- update: function (el, binding) {
- if (validate(binding)) el.__vueClickOutside__.callback = binding.value
- },
-
- unbind: function (el, binding, vNode) {
- // Remove Event Listeners
- !isServer(vNode) && document.removeEventListener('click', el.__vueClickOutside__.handler)
- delete el.__vueClickOutside__
- }
-}
-
-
-/***/ }),
+/***/ "./node_modules/vue-style-loader/lib/listToStyles.js":
+/*!***********************************************************!*\
+ !*** ./node_modules/vue-style-loader/lib/listToStyles.js ***!
+ \***********************************************************/
+/*! exports provided: default */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
-/***/ "./node_modules/vue-infinite-loading/dist/vue-infinite-loading.js":
-/*!************************************************************************!*\
- !*** ./node_modules/vue-infinite-loading/dist/vue-infinite-loading.js ***!
- \************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return listToStyles; });
+/**
+ * Translates the list format produced by css-loader into something
+ * easier to manipulate.
+ */
+function listToStyles (parentId, list) {
+ var styles = []
+ var newStyles = {}
+ for (var i = 0; i < list.length; i++) {
+ var item = list[i]
+ var id = item[0]
+ var css = item[1]
+ var media = item[2]
+ var sourceMap = item[3]
+ var part = {
+ id: parentId + ':' + i,
+ css: css,
+ media: media,
+ sourceMap: sourceMap
+ }
+ if (!newStyles[id]) {
+ styles.push(newStyles[id] = { id: id, parts: [part] })
+ } else {
+ newStyles[id].parts.push(part)
+ }
+ }
+ return styles
+}
-/*!
- * vue-infinite-loading v2.4.3
- * (c) 2016-2018 PeachScript
- * MIT License
- */
-!function(t,e){ true?module.exports=e():undefined}(this,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){var i=n(6);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);(0,n(3).default)("09280948",i,!0,{})},function(t,e,n){var i=n(8);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);(0,n(3).default)("65938a1f",i,!0,{})},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var r=(o=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),a=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[n].concat(a).concat([r]).join("\n")}var o;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r<this.length;r++){var a=this[r][0];"number"==typeof a&&(i[a]=!0)}for(r=0;r<t.length;r++){var o=t[r];"number"==typeof o[0]&&i[o[0]]||(n&&!o[2]?o[2]=n:n&&(o[2]="("+o[2]+") and ("+n+")"),e.push(o))}},e}},function(t,e,n){"use strict";function i(t,e){for(var n=[],i={},r=0;r<e.length;r++){var a=e[r],o=a[0],s={id:t+":"+r,css:a[1],media:a[2],sourceMap:a[3]};i[o]?i[o].parts.push(s):n.push(i[o]={id:o,parts:[s]})}return n}n.r(e),n.d(e,"default",function(){return b});var r="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!r)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var a={},o=r&&(document.head||document.getElementsByTagName("head")[0]),s=null,l=0,d=!1,c=function(){},u=null,p="data-vue-ssr-id",f="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function b(t,e,n,r){d=n,u=r||{};var o=i(t,e);return h(o),function(e){for(var n=[],r=0;r<o.length;r++){var s=o[r];(l=a[s.id]).refs--,n.push(l)}e?h(o=i(t,e)):o=[];for(r=0;r<n.length;r++){var l;if(0===(l=n[r]).refs){for(var d=0;d<l.parts.length;d++)l.parts[d]();delete a[l.id]}}}}function h(t){for(var e=0;e<t.length;e++){var n=t[e],i=a[n.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](n.parts[r]);for(;r<n.parts.length;r++)i.parts.push(g(n.parts[r]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var o=[];for(r=0;r<n.parts.length;r++)o.push(g(n.parts[r]));a[n.id]={id:n.id,refs:1,parts:o}}}}function m(){var t=document.createElement("style");return t.type="text/css",o.appendChild(t),t}function g(t){var e,n,i=document.querySelector("style["+p+'~="'+t.id+'"]');if(i){if(d)return c;i.parentNode.removeChild(i)}if(f){var r=l++;i=s||(s=m()),e=w.bind(null,i,r,!1),n=w.bind(null,i,r,!0)}else i=m(),e=function(t,e){var n=e.css,i=e.media,r=e.sourceMap;i&&t.setAttribute("media",i);u.ssrId&&t.setAttribute(p,e.id);r&&(n+="\n/*# sourceURL="+r.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,i),n=function(){i.parentNode.removeChild(i)};return e(t),function(i){if(i){if(i.css===t.css&&i.media===t.media&&i.sourceMap===t.sourceMap)return;e(t=i)}else n()}}var v,y=(v=[],function(t,e){return v[t]=e,v.filter(Boolean).join("\n")});function w(t,e,n,i){var r=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=y(e,r);else{var a=document.createTextNode(r),o=t.childNodes;o[e]&&t.removeChild(o[e]),o.length?t.insertBefore(a,o[e]):t.appendChild(a)}}},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=i=function(t){return n(t)}:t.exports=i=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},i(e)}t.exports=i},function(t,e,n){"use strict";n.r(e);var i=n(0),r=n.n(i);for(var a in i)"default"!==a&&function(t){n.d(e,t,function(){return i[t]})}(a);e.default=r.a},function(t,e,n){(t.exports=n(2)(!1)).push([t.i,'.loading-wave-dots[data-v-46b20d22]{position:relative}.loading-wave-dots[data-v-46b20d22] .wave-item{position:absolute;top:50%;left:50%;display:inline-block;margin-top:-4px;width:8px;height:8px;border-radius:50%;-webkit-animation:loading-wave-dots-data-v-46b20d22 linear 2.8s infinite;animation:loading-wave-dots-data-v-46b20d22 linear 2.8s infinite}.loading-wave-dots[data-v-46b20d22] .wave-item:first-child{margin-left:-36px}.loading-wave-dots[data-v-46b20d22] .wave-item:nth-child(2){margin-left:-20px;-webkit-animation-delay:.14s;animation-delay:.14s}.loading-wave-dots[data-v-46b20d22] .wave-item:nth-child(3){margin-left:-4px;-webkit-animation-delay:.28s;animation-delay:.28s}.loading-wave-dots[data-v-46b20d22] .wave-item:nth-child(4){margin-left:12px;-webkit-animation-delay:.42s;animation-delay:.42s}.loading-wave-dots[data-v-46b20d22] .wave-item:last-child{margin-left:28px;-webkit-animation-delay:.56s;animation-delay:.56s}@-webkit-keyframes loading-wave-dots-data-v-46b20d22{0%{-webkit-transform:translateY(0);transform:translateY(0);background:#bbb}10%{-webkit-transform:translateY(-6px);transform:translateY(-6px);background:#999}20%{-webkit-transform:translateY(0);transform:translateY(0);background:#bbb}to{-webkit-transform:translateY(0);transform:translateY(0);background:#bbb}}@keyframes loading-wave-dots-data-v-46b20d22{0%{-webkit-transform:translateY(0);transform:translateY(0);background:#bbb}10%{-webkit-transform:translateY(-6px);transform:translateY(-6px);background:#999}20%{-webkit-transform:translateY(0);transform:translateY(0);background:#bbb}to{-webkit-transform:translateY(0);transform:translateY(0);background:#bbb}}.loading-circles[data-v-46b20d22] .circle-item{width:5px;height:5px;-webkit-animation:loading-circles-data-v-46b20d22 linear .75s infinite;animation:loading-circles-data-v-46b20d22 linear .75s infinite}.loading-circles[data-v-46b20d22] .circle-item:first-child{margin-top:-14.5px;margin-left:-2.5px}.loading-circles[data-v-46b20d22] .circle-item:nth-child(2){margin-top:-11.26px;margin-left:6.26px}.loading-circles[data-v-46b20d22] .circle-item:nth-child(3){margin-top:-2.5px;margin-left:9.5px}.loading-circles[data-v-46b20d22] .circle-item:nth-child(4){margin-top:6.26px;margin-left:6.26px}.loading-circles[data-v-46b20d22] .circle-item:nth-child(5){margin-top:9.5px;margin-left:-2.5px}.loading-circles[data-v-46b20d22] .circle-item:nth-child(6){margin-top:6.26px;margin-left:-11.26px}.loading-circles[data-v-46b20d22] .circle-item:nth-child(7){margin-top:-2.5px;margin-left:-14.5px}.loading-circles[data-v-46b20d22] .circle-item:last-child{margin-top:-11.26px;margin-left:-11.26px}@-webkit-keyframes loading-circles-data-v-46b20d22{0%{background:#dfdfdf}90%{background:#505050}to{background:#dfdfdf}}@keyframes loading-circles-data-v-46b20d22{0%{background:#dfdfdf}90%{background:#505050}to{background:#dfdfdf}}.loading-bubbles[data-v-46b20d22] .bubble-item{background:#666;-webkit-animation:loading-bubbles-data-v-46b20d22 linear .75s infinite;animation:loading-bubbles-data-v-46b20d22 linear .75s infinite}.loading-bubbles[data-v-46b20d22] .bubble-item:first-child{margin-top:-12.5px;margin-left:-.5px}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(2){margin-top:-9.26px;margin-left:8.26px}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(3){margin-top:-.5px;margin-left:11.5px}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(4){margin-top:8.26px;margin-left:8.26px}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(5){margin-top:11.5px;margin-left:-.5px}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(6){margin-top:8.26px;margin-left:-9.26px}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(7){margin-top:-.5px;margin-left:-12.5px}.loading-bubbles[data-v-46b20d22] .bubble-item:last-child{margin-top:-9.26px;margin-left:-9.26px}@-webkit-keyframes loading-bubbles-data-v-46b20d22{0%{width:1px;height:1px;box-shadow:0 0 0 3px #666}90%{width:1px;height:1px;box-shadow:0 0 0 0 #666}to{width:1px;height:1px;box-shadow:0 0 0 3px #666}}@keyframes loading-bubbles-data-v-46b20d22{0%{width:1px;height:1px;box-shadow:0 0 0 3px #666}90%{width:1px;height:1px;box-shadow:0 0 0 0 #666}to{width:1px;height:1px;box-shadow:0 0 0 3px #666}}.loading-default[data-v-46b20d22]{position:relative;border:1px solid #999;-webkit-animation:loading-rotating-data-v-46b20d22 ease 1.5s infinite;animation:loading-rotating-data-v-46b20d22 ease 1.5s infinite}.loading-default[data-v-46b20d22]:before{content:"";position:absolute;display:block;top:0;left:50%;margin-top:-3px;margin-left:-3px;width:6px;height:6px;background-color:#999;border-radius:50%}.loading-spiral[data-v-46b20d22]{border:2px solid #777;border-right-color:transparent;-webkit-animation:loading-rotating-data-v-46b20d22 linear .85s infinite;animation:loading-rotating-data-v-46b20d22 linear .85s infinite}@-webkit-keyframes loading-rotating-data-v-46b20d22{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loading-rotating-data-v-46b20d22{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.loading-bubbles[data-v-46b20d22],.loading-circles[data-v-46b20d22]{position:relative}.loading-bubbles[data-v-46b20d22] .bubble-item,.loading-circles[data-v-46b20d22] .circle-item{position:absolute;top:50%;left:50%;display:inline-block;border-radius:50%}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(2),.loading-circles[data-v-46b20d22] .circle-item:nth-child(2){-webkit-animation-delay:93ms;animation-delay:93ms}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(3),.loading-circles[data-v-46b20d22] .circle-item:nth-child(3){-webkit-animation-delay:.186s;animation-delay:.186s}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(4),.loading-circles[data-v-46b20d22] .circle-item:nth-child(4){-webkit-animation-delay:.279s;animation-delay:.279s}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(5),.loading-circles[data-v-46b20d22] .circle-item:nth-child(5){-webkit-animation-delay:.372s;animation-delay:.372s}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(6),.loading-circles[data-v-46b20d22] .circle-item:nth-child(6){-webkit-animation-delay:.465s;animation-delay:.465s}.loading-bubbles[data-v-46b20d22] .bubble-item:nth-child(7),.loading-circles[data-v-46b20d22] .circle-item:nth-child(7){-webkit-animation-delay:.558s;animation-delay:.558s}.loading-bubbles[data-v-46b20d22] .bubble-item:last-child,.loading-circles[data-v-46b20d22] .circle-item:last-child{-webkit-animation-delay:.651s;animation-delay:.651s}',""])},function(t,e,n){"use strict";n.r(e);var i=n(1),r=n.n(i);for(var a in i)"default"!==a&&function(t){n.d(e,t,function(){return i[t]})}(a);e.default=r.a},function(t,e,n){(t.exports=n(2)(!1)).push([t.i,".infinite-loading-container[data-v-358985eb]{clear:both;text-align:center}.infinite-loading-container[data-v-358985eb] [class^=loading-]{display:inline-block;margin:5px 0;width:28px;height:28px;font-size:28px;line-height:28px;border-radius:50%}.btn-try-infinite[data-v-358985eb]{margin-top:5px;padding:5px 10px;color:#999;font-size:14px;line-height:1;background:transparent;border:1px solid #ccc;border-radius:3px;outline:none;cursor:pointer}.btn-try-infinite[data-v-358985eb]:not(:active):hover{opacity:.8}",""])},function(t,e,n){"use strict";n.r(e);var i={throttleLimit:50,loopCheckTimeout:1e3,loopCheckMaxCalls:10},r=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){return t={passive:!0},!0}});window.addEventListener("testpassive",e,e),window.remove("testpassive",e,e)}catch(t){}return t}(),a={STATE_CHANGER:["emit `loaded` and `complete` event through component instance of `$refs` may cause error, so it will be deprecated soon, please use the `$state` argument instead (`$state` just the special `$event` variable):","\ntemplate:",'<infinite-loading @infinite="infiniteHandler"></infinite-loading>',"\nscript:\n...\ninfiniteHandler($state) {\n ajax('https://www.example.com/api/news')\n .then((res) => {\n if (res.data.length) {\n $state.loaded();\n } else {\n $state.complete();\n }\n });\n}\n...","","more details: https://github.com/PeachScript/vue-infinite-loading/issues/57#issuecomment-324370549"].join("\n"),INFINITE_EVENT:"`:on-infinite` property will be deprecated soon, please use `@infinite` event instead.",IDENTIFIER:"the `reset` event will be deprecated soon, please reset this component by change the `identifier` property."},o={INFINITE_LOOP:["executed the callback function more than ".concat(i.loopCheckMaxCalls," times for a short time, it looks like searched a wrong scroll wrapper that doest not has fixed height or maximum height, please check it. If you want to force to set a element as scroll wrapper ranther than automatic searching, you can do this:"),'\n\x3c!-- add a special attribute for the real scroll wrapper --\x3e\n<div infinite-wrapper>\n ...\n \x3c!-- set force-use-infinite-wrapper --\x3e\n <infinite-loading force-use-infinite-wrapper></infinite-loading>\n</div>\nor\n<div class="infinite-wrapper">\n ...\n \x3c!-- set force-use-infinite-wrapper as css selector of the real scroll wrapper --\x3e\n <infinite-loading force-use-infinite-wrapper=".infinite-wrapper"></infinite-loading>\n</div>\n ',"more details: https://github.com/PeachScript/vue-infinite-loading/issues/55#issuecomment-316934169"].join("\n")},s={READY:0,LOADING:1,COMPLETE:2,ERROR:3},l={color:"#666",fontSize:"14px",padding:"10px 0"},d={mode:"development",props:{spinner:"default",distance:100,forceUseInfiniteWrapper:!1},system:i,slots:{noResults:"No results :(",noMore:"No more data :)",error:"Opps, something went wrong :(",errorBtnText:"Retry",spinner:""},WARNINGS:a,ERRORS:o,STATUS:s},c=n(4),u=n.n(c),p={BUBBLES:{render:function(t){return t("span",{attrs:{class:"loading-bubbles"}},Array.apply(Array,Array(8)).map(function(){return t("span",{attrs:{class:"bubble-item"}})}))}},CIRCLES:{render:function(t){return t("span",{attrs:{class:"loading-circles"}},Array.apply(Array,Array(8)).map(function(){return t("span",{attrs:{class:"circle-item"}})}))}},DEFAULT:{render:function(t){return t("i",{attrs:{class:"loading-default"}})}},SPIRAL:{render:function(t){return t("i",{attrs:{class:"loading-spiral"}})}},WAVEDOTS:{render:function(t){return t("span",{attrs:{class:"loading-wave-dots"}},Array.apply(Array,Array(5)).map(function(){return t("span",{attrs:{class:"wave-item"}})}))}}};function f(t,e,n,i,r,a,o,s){var l,d="function"==typeof t?t.options:t;if(e&&(d.render=e,d.staticRenderFns=n,d._compiled=!0),i&&(d.functional=!0),a&&(d._scopeId="data-v-"+a),o?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},d._ssrRegister=l):r&&(l=s?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(d.functional){d._injectStyles=l;var c=d.render;d.render=function(t,e){return l.call(e),c(t,e)}}else{var u=d.beforeCreate;d.beforeCreate=u?[].concat(u,l):[l]}return{exports:t,options:d}}var b=f({name:"Spinner",computed:{spinnerView:function(){return p[(this.$attrs.spinner||"").toUpperCase()]||this.spinnerInConfig},spinnerInConfig:function(){return d.slots.spinner&&"string"==typeof d.slots.spinner?{render:function(){return this._v(d.slots.spinner)}}:"object"===u()(d.slots.spinner)?d.slots.spinner:p[d.props.spinner.toUpperCase()]||p.DEFAULT}}},function(){var t=this.$createElement;return(this._self._c||t)(this.spinnerView,{tag:"component"})},[],!1,function(t){var e=n(5);e.__inject__&&e.__inject__(t)},"46b20d22",null);b.options.__file="Spinner.vue";var h=b.exports;function m(t){"production"!==d.mode&&console.warn("[Vue-infinite-loading warn]: ".concat(t))}function g(t){console.error("[Vue-infinite-loading error]: ".concat(t))}var v={timers:[],caches:[],throttle:function(t){var e=this;-1===this.caches.indexOf(t)&&(this.caches.push(t),this.timers.push(setTimeout(function(){t(),e.caches.splice(e.caches.indexOf(t),1),e.timers.shift()},d.system.throttleLimit)))},reset:function(){this.timers.forEach(function(t){clearTimeout(t)}),this.timers.length=0,this.caches=[]}},y={isChecked:!1,timer:null,times:0,track:function(){var t=this;this.times+=1,clearTimeout(this.timer),this.timer=setTimeout(function(){t.isChecked=!0},d.system.loopCheckTimeout),this.times>d.system.loopCheckMaxCalls&&(g(o.INFINITE_LOOP),this.isChecked=!0)}},w={key:"_infiniteScrollHeight",getScrollElm:function(t){return t===window?document.documentElement:t},save:function(t){var e=this.getScrollElm(t);e[this.key]=e.scrollHeight},restore:function(t){var e=this.getScrollElm(t);"number"==typeof e[this.key]&&(e.scrollTop=e.scrollHeight-e[this.key]+e.scrollTop),this.remove(e)},remove:function(t){void 0!==t[this.key]&&delete t[this.key]}};function x(t){return t.replace(/[A-Z]/g,function(t){return"-".concat(t.toLowerCase())})}function k(t){return t.offsetWidth+t.offsetHeight>0}var S=f({name:"InfiniteLoading",data:function(){return{scrollParent:null,scrollHandler:null,isFirstLoad:!0,status:s.READY,slots:d.slots}},components:{Spinner:h},computed:{isShowSpinner:function(){return this.status===s.LOADING},isShowError:function(){return this.status===s.ERROR},isShowNoResults:function(){return this.status===s.COMPLETE&&this.isFirstLoad},isShowNoMore:function(){return this.status===s.COMPLETE&&!this.isFirstLoad},slotStyles:function(){var t=this,e={};return Object.keys(d.slots).forEach(function(n){var i=x(n);(!t.$slots[i]&&!d.slots[n].render||t.$slots[i]&&!t.$slots[i][0].tag)&&(e[n]=l)}),e}},props:{distance:{type:Number,default:d.props.distance},spinner:String,direction:{type:String,default:"bottom"},forceUseInfiniteWrapper:{type:[Boolean,String],default:d.props.forceUseInfiniteWrapper},identifier:{default:+new Date},onInfinite:Function},watch:{identifier:function(){this.stateChanger.reset()}},mounted:function(){var t=this;this.$watch("forceUseInfiniteWrapper",function(){t.scrollParent=t.getScrollParent()},{immediate:!0}),this.scrollHandler=function(t){this.status===s.READY&&(t&&t.constructor===Event&&k(this.$el)?v.throttle(this.attemptLoad):this.attemptLoad())}.bind(this),setTimeout(this.scrollHandler,1),this.scrollParent.addEventListener("scroll",this.scrollHandler,r),this.$on("$InfiniteLoading:loaded",function(e){t.isFirstLoad=!1,"top"===t.direction&&t.$nextTick(function(){w.restore(t.scrollParent)}),t.status===s.LOADING&&t.$nextTick(t.attemptLoad.bind(null,!0)),e&&e.target===t||m(a.STATE_CHANGER)}),this.$on("$InfiniteLoading:complete",function(e){t.status=s.COMPLETE,t.$nextTick(function(){t.$forceUpdate()}),t.scrollParent.removeEventListener("scroll",t.scrollHandler,r),e&&e.target===t||m(a.STATE_CHANGER)}),this.$on("$InfiniteLoading:reset",function(e){t.status=s.READY,t.isFirstLoad=!0,w.remove(t.scrollParent),t.scrollParent.addEventListener("scroll",t.scrollHandler,r),setTimeout(function(){v.reset(),t.scrollHandler()},1),e&&e.target===t||m(a.IDENTIFIER)}),this.stateChanger={loaded:function(){t.$emit("$InfiniteLoading:loaded",{target:t})},complete:function(){t.$emit("$InfiniteLoading:complete",{target:t})},reset:function(){t.$emit("$InfiniteLoading:reset",{target:t})},error:function(){t.status=s.ERROR,v.reset()}},this.onInfinite&&m(a.INFINITE_EVENT)},deactivated:function(){this.status===s.LOADING&&(this.status=s.READY),this.scrollParent.removeEventListener("scroll",this.scrollHandler,r)},activated:function(){this.scrollParent.addEventListener("scroll",this.scrollHandler,r)},methods:{attemptLoad:function(t){var e=this;this.status!==s.COMPLETE&&k(this.$el)&&this.getCurrentDistance()<=this.distance?(this.status=s.LOADING,"top"===this.direction&&this.$nextTick(function(){w.save(e.scrollParent)}),"function"==typeof this.onInfinite?this.onInfinite.call(null,this.stateChanger):this.$emit("infinite",this.stateChanger),!t||this.forceUseInfiniteWrapper||y.isChecked||y.track()):this.status===s.LOADING&&(this.status=s.READY)},getCurrentDistance:function(){var t;"top"===this.direction?t="number"==typeof this.scrollParent.scrollTop?this.scrollParent.scrollTop:this.scrollParent.pageYOffset:t=this.$el.getBoundingClientRect().top-(this.scrollParent===window?window.innerHeight:this.scrollParent.getBoundingClientRect().bottom);return t},getScrollParent:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.$el;return"string"==typeof this.forceUseInfiniteWrapper&&(t=e.querySelector(this.forceUseInfiniteWrapper)),t||("BODY"===e.tagName?t=window:!this.forceUseInfiniteWrapper&&["scroll","auto"].indexOf(getComputedStyle(e).overflowY)>-1?t=e:(e.hasAttribute("infinite-wrapper")||e.hasAttribute("data-infinite-wrapper"))&&(t=e)),t||this.getScrollParent(e.parentNode)}},destroyed:function(){!this.status!==s.COMPLETE&&(v.reset(),w.remove(this.scrollParent),this.scrollParent.removeEventListener("scroll",this.scrollHandler,r))}},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"infinite-loading-container"},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.isShowSpinner,expression:"isShowSpinner"}],staticClass:"infinite-status-prompt",style:t.slotStyles.spinner},[t._t("spinner",[n("spinner",{attrs:{spinner:t.spinner}})])],2),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.isShowNoResults,expression:"isShowNoResults"}],staticClass:"infinite-status-prompt",style:t.slotStyles.noResults},[t._t("no-results",[t.slots.noResults.render?n(t.slots.noResults,{tag:"component"}):[t._v(t._s(t.slots.noResults))]])],2),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.isShowNoMore,expression:"isShowNoMore"}],staticClass:"infinite-status-prompt",style:t.slotStyles.noMore},[t._t("no-more",[t.slots.noMore.render?n(t.slots.noMore,{tag:"component"}):[t._v(t._s(t.slots.noMore))]])],2),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.isShowError,expression:"isShowError"}],staticClass:"infinite-status-prompt",style:t.slotStyles.error},[t._t("error",[t.slots.error.render?n(t.slots.error,{tag:"component",attrs:{trigger:t.attemptLoad}}):[t._v("\n "+t._s(t.slots.error)+"\n "),n("br"),t._v(" "),n("button",{staticClass:"btn-try-infinite",domProps:{textContent:t._s(t.slots.errorBtnText)},on:{click:t.attemptLoad}})]],{trigger:t.attemptLoad})],2)])},[],!1,function(t){var e=n(7);e.__inject__&&e.__inject__(t)},"358985eb",null);S.options.__file="InfiniteLoading.vue";var E=S.exports;function _(t){d.mode=t.config.productionTip?"development":"production"}Object.defineProperty(E,"install",{configurable:!1,enumerable:!1,value:function(t,e){Object.assign(d.props,e&&e.props),Object.assign(d.slots,e&&e.slots),Object.assign(d.system,e&&e.system),t.component("infinite-loading",E),_(t)}}),"undefined"!=typeof window&&window.Vue&&(window.Vue.component("infinite-loading",E),_(window.Vue));e.default=E}])});
/***/ })