You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19526 lines
1.2 MiB

3 years ago
/*
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
if you want to view the source visit the plugins github repository
https://github.com/joethei/obsidian-rss
*/
'use strict';
var obsidian = require('obsidian');
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
3 years ago
var top = 'top';
var bottom = 'bottom';
var right = 'right';
var left = 'left';
var auto = 'auto';
var basePlacements = [top, bottom, right, left];
var start = 'start';
var end = 'end';
var clippingParents = 'clippingParents';
var viewport = 'viewport';
var popper = 'popper';
var reference = 'reference';
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
return acc.concat([placement + "-" + start, placement + "-" + end]);
}, []);
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
}, []); // modifiers that need to read the DOM
var beforeRead = 'beforeRead';
var read = 'read';
var afterRead = 'afterRead'; // pure-logic modifiers
var beforeMain = 'beforeMain';
var main = 'main';
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
var beforeWrite = 'beforeWrite';
var write = 'write';
var afterWrite = 'afterWrite';
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
function getNodeName(element) {
return element ? (element.nodeName || '').toLowerCase() : null;
3 years ago
}
3 years ago
function getWindow(node) {
if (node == null) {
return window;
}
if (node.toString() !== '[object Window]') {
var ownerDocument = node.ownerDocument;
return ownerDocument ? ownerDocument.defaultView || window : window;
}
return node;
3 years ago
}
3 years ago
function isElement(node) {
var OwnElement = getWindow(node).Element;
return node instanceof OwnElement || node instanceof Element;
3 years ago
}
3 years ago
function isHTMLElement(node) {
var OwnElement = getWindow(node).HTMLElement;
return node instanceof OwnElement || node instanceof HTMLElement;
3 years ago
}
3 years ago
function isShadowRoot(node) {
// IE 11 has no ShadowRoot
if (typeof ShadowRoot === 'undefined') {
return false;
}
var OwnElement = getWindow(node).ShadowRoot;
return node instanceof OwnElement || node instanceof ShadowRoot;
3 years ago
}
3 years ago
// and applies them to the HTMLElements such as popper and arrow
function applyStyles(_ref) {
var state = _ref.state;
Object.keys(state.elements).forEach(function (name) {
var style = state.styles[name] || {};
var attributes = state.attributes[name] || {};
var element = state.elements[name]; // arrow is optional + virtual elements
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
} // Flow doesn't support to extend this property, but it's the most
// effective way to apply styles to an HTMLElement
// $FlowFixMe[cannot-write]
Object.assign(element.style, style);
Object.keys(attributes).forEach(function (name) {
var value = attributes[name];
if (value === false) {
element.removeAttribute(name);
} else {
element.setAttribute(name, value === true ? '' : value);
}
3 years ago
});
3 years ago
});
3 years ago
}
3 years ago
function effect$2(_ref2) {
var state = _ref2.state;
var initialStyles = {
popper: {
position: state.options.strategy,
left: '0',
top: '0',
margin: '0'
},
arrow: {
position: 'absolute'
},
reference: {}
};
Object.assign(state.elements.popper.style, initialStyles.popper);
state.styles = initialStyles;
3 years ago
3 years ago
if (state.elements.arrow) {
Object.assign(state.elements.arrow.style, initialStyles.arrow);
}
3 years ago
3 years ago
return function () {
Object.keys(state.elements).forEach(function (name) {
var element = state.elements[name];
var attributes = state.attributes[name] || {};
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
3 years ago
3 years ago
var style = styleProperties.reduce(function (style, property) {
style[property] = '';
return style;
}, {}); // arrow is optional + virtual elements
3 years ago
3 years ago
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
}
3 years ago
3 years ago
Object.assign(element.style, style);
Object.keys(attributes).forEach(function (attribute) {
element.removeAttribute(attribute);
});
});
};
} // eslint-disable-next-line import/no-unused-modules
3 years ago
3 years ago
var applyStyles$1 = {
name: 'applyStyles',
enabled: true,
phase: 'write',
fn: applyStyles,
effect: effect$2,
requires: ['computeStyles']
};
3 years ago
3 years ago
function getBasePlacement(placement) {
return placement.split('-')[0];
}
3 years ago
3 years ago
var max = Math.max;
var min = Math.min;
var round = Math.round;
function getBoundingClientRect(element, includeScale) {
if (includeScale === void 0) {
includeScale = false;
}
3 years ago
3 years ago
var rect = element.getBoundingClientRect();
var scaleX = 1;
3 years ago
var scaleY = 1;
if (isHTMLElement(element) && includeScale) {
var offsetHeight = element.offsetHeight;
var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
// Fallback to 1 in case both values are `0`
if (offsetWidth > 0) {
scaleX = round(rect.width) / offsetWidth || 1;
}
if (offsetHeight > 0) {
scaleY = round(rect.height) / offsetHeight || 1;
}
}
3 years ago
3 years ago
return {
width: rect.width / scaleX,
height: rect.height / scaleY,
top: rect.top / scaleY,
right: rect.right / scaleX,
bottom: rect.bottom / scaleY,
left: rect.left / scaleX,
x: rect.left / scaleX,
y: rect.top / scaleY
};
}
3 years ago
3 years ago
// means it doesn't take into account transforms.
3 years ago
3 years ago
function getLayoutRect(element) {
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
// Fixes https://github.com/popperjs/popper-core/issues/1223
3 years ago
3 years ago
var width = element.offsetWidth;
var height = element.offsetHeight;
3 years ago
3 years ago
if (Math.abs(clientRect.width - width) <= 1) {
width = clientRect.width;
}
3 years ago
3 years ago
if (Math.abs(clientRect.height - height) <= 1) {
height = clientRect.height;
}
3 years ago
3 years ago
return {
x: element.offsetLeft,
y: element.offsetTop,
width: width,
height: height
};
}
3 years ago
3 years ago
function contains(parent, child) {
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
3 years ago
3 years ago
if (parent.contains(child)) {
return true;
} // then fallback to custom implementation with Shadow DOM support
else if (rootNode && isShadowRoot(rootNode)) {
var next = child;
3 years ago
3 years ago
do {
if (next && parent.isSameNode(next)) {
return true;
} // $FlowFixMe[prop-missing]: need a better way to handle this...
3 years ago
3 years ago
next = next.parentNode || next.host;
} while (next);
} // Give up, the result is false
3 years ago
3 years ago
return false;
}
3 years ago
3 years ago
function getComputedStyle(element) {
return getWindow(element).getComputedStyle(element);
}
3 years ago
3 years ago
function isTableElement(element) {
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
}
3 years ago
3 years ago
function getDocumentElement(element) {
// $FlowFixMe[incompatible-return]: assume body is always available
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
element.document) || window.document).documentElement;
}
3 years ago
3 years ago
function getParentNode(element) {
if (getNodeName(element) === 'html') {
return element;
3 years ago
}
3 years ago
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
// $FlowFixMe[incompatible-return]
// $FlowFixMe[prop-missing]
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
element.parentNode || ( // DOM Element detected
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
getDocumentElement(element) // fallback
);
3 years ago
}
3 years ago
function getTrueOffsetParent(element) {
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
getComputedStyle(element).position === 'fixed') {
return null;
}
3 years ago
3 years ago
return element.offsetParent;
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
// return the containing block
function getContainingBlock(element) {
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
var isIE = navigator.userAgent.indexOf('Trident') !== -1;
if (isIE && isHTMLElement(element)) {
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
var elementCss = getComputedStyle(element);
if (elementCss.position === 'fixed') {
return null;
3 years ago
}
}
3 years ago
var currentNode = getParentNode(element);
3 years ago
3 years ago
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
// create a containing block.
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
3 years ago
3 years ago
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
return currentNode;
} else {
currentNode = currentNode.parentNode;
}
3 years ago
}
3 years ago
return null;
} // Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
3 years ago
3 years ago
function getOffsetParent(element) {
var window = getWindow(element);
var offsetParent = getTrueOffsetParent(element);
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
offsetParent = getTrueOffsetParent(offsetParent);
}
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
return window;
}
return offsetParent || getContainingBlock(element) || window;
3 years ago
}
3 years ago
function getMainAxisFromPlacement(placement) {
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
3 years ago
}
3 years ago
function within(min$1, value, max$1) {
return max(min$1, min(value, max$1));
3 years ago
}
3 years ago
function withinMaxClamp(min, value, max) {
var v = within(min, value, max);
return v > max ? max : v;
}
3 years ago
3 years ago
function getFreshSideObject() {
return {
top: 0,
right: 0,
bottom: 0,
left: 0
3 years ago
};
}
3 years ago
function mergePaddingObject(paddingObject) {
return Object.assign({}, getFreshSideObject(), paddingObject);
}
3 years ago
3 years ago
function expandToHashMap(value, keys) {
return keys.reduce(function (hashMap, key) {
hashMap[key] = value;
return hashMap;
}, {});
3 years ago
}
3 years ago
var toPaddingObject = function toPaddingObject(padding, state) {
padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
placement: state.placement
})) : padding;
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
};
3 years ago
3 years ago
function arrow(_ref) {
var _state$modifiersData$;
3 years ago
3 years ago
var state = _ref.state,
name = _ref.name,
options = _ref.options;
var arrowElement = state.elements.arrow;
var popperOffsets = state.modifiersData.popperOffsets;
var basePlacement = getBasePlacement(state.placement);
var axis = getMainAxisFromPlacement(basePlacement);
var isVertical = [left, right].indexOf(basePlacement) >= 0;
var len = isVertical ? 'height' : 'width';
3 years ago
3 years ago
if (!arrowElement || !popperOffsets) {
return;
}
3 years ago
3 years ago
var paddingObject = toPaddingObject(options.padding, state);
var arrowRect = getLayoutRect(arrowElement);
var minProp = axis === 'y' ? top : left;
var maxProp = axis === 'y' ? bottom : right;
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
var arrowOffsetParent = getOffsetParent(arrowElement);
var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
// outside of the popper bounds
3 years ago
3 years ago
var min = paddingObject[minProp];
var max = clientSize - arrowRect[len] - paddingObject[maxProp];
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
var offset = within(min, center, max); // Prevents breaking syntax highlighting...
3 years ago
3 years ago
var axisProp = axis;
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
}
3 years ago
3 years ago
function effect$1(_ref2) {
var state = _ref2.state,
options = _ref2.options;
var _options$element = options.element,
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
3 years ago
3 years ago
if (arrowElement == null) {
return;
} // CSS selector
3 years ago
3 years ago
if (typeof arrowElement === 'string') {
arrowElement = state.elements.popper.querySelector(arrowElement);
3 years ago
3 years ago
if (!arrowElement) {
return;
}
}
3 years ago
3 years ago
if (process.env.NODE_ENV !== "production") {
if (!isHTMLElement(arrowElement)) {
console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
}
}
3 years ago
3 years ago
if (!contains(state.elements.popper, arrowElement)) {
if (process.env.NODE_ENV !== "production") {
console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
}
return;
3 years ago
}
3 years ago
state.elements.arrow = arrowElement;
} // eslint-disable-next-line import/no-unused-modules
3 years ago
3 years ago
var arrow$1 = {
name: 'arrow',
enabled: true,
phase: 'main',
fn: arrow,
effect: effect$1,
requires: ['popperOffsets'],
requiresIfExists: ['preventOverflow']
};
3 years ago
3 years ago
function getVariation(placement) {
return placement.split('-')[1];
3 years ago
}
3 years ago
var unsetSides = {
top: 'auto',
right: 'auto',
bottom: 'auto',
left: 'auto'
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
// Zooming can change the DPR, but it seems to report a value that will
// cleanly divide the values into the appropriate subpixels.
function roundOffsetsByDPR(_ref) {
var x = _ref.x,
y = _ref.y;
var win = window;
var dpr = win.devicePixelRatio || 1;
return {
3 years ago
x: round(x * dpr) / dpr || 0,
y: round(y * dpr) / dpr || 0
3 years ago
};
3 years ago
}
3 years ago
function mapToStyles(_ref2) {
var _Object$assign2;
3 years ago
3 years ago
var popper = _ref2.popper,
popperRect = _ref2.popperRect,
placement = _ref2.placement,
variation = _ref2.variation,
offsets = _ref2.offsets,
position = _ref2.position,
gpuAcceleration = _ref2.gpuAcceleration,
adaptive = _ref2.adaptive,
3 years ago
roundOffsets = _ref2.roundOffsets,
isFixed = _ref2.isFixed;
3 years ago
3 years ago
var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
_ref3$x = _ref3.x,
x = _ref3$x === void 0 ? 0 : _ref3$x,
_ref3$y = _ref3.y,
y = _ref3$y === void 0 ? 0 : _ref3$y;
3 years ago
3 years ago
var hasX = offsets.hasOwnProperty('x');
var hasY = offsets.hasOwnProperty('y');
var sideX = left;
var sideY = top;
var win = window;
3 years ago
3 years ago
if (adaptive) {
var offsetParent = getOffsetParent(popper);
var heightProp = 'clientHeight';
var widthProp = 'clientWidth';
3 years ago
3 years ago
if (offsetParent === getWindow(popper)) {
offsetParent = getDocumentElement(popper);
3 years ago
3 years ago
if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
heightProp = 'scrollHeight';
widthProp = 'scrollWidth';
}
} // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
3 years ago
3 years ago
offsetParent = offsetParent;
3 years ago
3 years ago
if (placement === top || (placement === left || placement === right) && variation === end) {
3 years ago
sideY = bottom;
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
offsetParent[heightProp];
y -= offsetY - popperRect.height;
3 years ago
y *= gpuAcceleration ? 1 : -1;
}
if (placement === left || (placement === top || placement === bottom) && variation === end) {
3 years ago
sideX = right;
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
offsetParent[widthProp];
x -= offsetX - popperRect.width;
3 years ago
x *= gpuAcceleration ? 1 : -1;
}
3 years ago
}
3 years ago
var commonStyles = Object.assign({
position: position
}, adaptive && unsetSides);
3 years ago
3 years ago
if (gpuAcceleration) {
var _Object$assign;
3 years ago
3 years ago
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
3 years ago
}
3 years ago
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
3 years ago
}
3 years ago
function computeStyles(_ref4) {
var state = _ref4.state,
options = _ref4.options;
var _options$gpuAccelerat = options.gpuAcceleration,
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
_options$adaptive = options.adaptive,
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
_options$roundOffsets = options.roundOffsets,
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
3 years ago
3 years ago
if (process.env.NODE_ENV !== "production") {
var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
3 years ago
3 years ago
if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
return transitionProperty.indexOf(property) >= 0;
})) {
console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
}
}
3 years ago
3 years ago
var commonStyles = {
placement: getBasePlacement(state.placement),
variation: getVariation(state.placement),
popper: state.elements.popper,
popperRect: state.rects.popper,
3 years ago
gpuAcceleration: gpuAcceleration,
isFixed: state.options.strategy === 'fixed'
3 years ago
};
3 years ago
3 years ago
if (state.modifiersData.popperOffsets != null) {
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
offsets: state.modifiersData.popperOffsets,
position: state.options.strategy,
adaptive: adaptive,
roundOffsets: roundOffsets
})));
}
3 years ago
3 years ago
if (state.modifiersData.arrow != null) {
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
offsets: state.modifiersData.arrow,
position: 'absolute',
adaptive: false,
roundOffsets: roundOffsets
})));
}
3 years ago
3 years ago
state.attributes.popper = Object.assign({}, state.attributes.popper, {
'data-popper-placement': state.placement
});
} // eslint-disable-next-line import/no-unused-modules
var computeStyles$1 = {
name: 'computeStyles',
enabled: true,
phase: 'beforeWrite',
fn: computeStyles,
data: {}
};
var passive = {
passive: true
};
function effect(_ref) {
var state = _ref.state,
instance = _ref.instance,
options = _ref.options;
var _options$scroll = options.scroll,
scroll = _options$scroll === void 0 ? true : _options$scroll,
_options$resize = options.resize,
resize = _options$resize === void 0 ? true : _options$resize;
var window = getWindow(state.elements.popper);
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
if (scroll) {
scrollParents.forEach(function (scrollParent) {
scrollParent.addEventListener('scroll', instance.update, passive);
});
3 years ago
}
3 years ago
if (resize) {
window.addEventListener('resize', instance.update, passive);
}
3 years ago
3 years ago
return function () {
if (scroll) {
scrollParents.forEach(function (scrollParent) {
scrollParent.removeEventListener('scroll', instance.update, passive);
});
}
3 years ago
3 years ago
if (resize) {
window.removeEventListener('resize', instance.update, passive);
}
};
} // eslint-disable-next-line import/no-unused-modules
3 years ago
3 years ago
var eventListeners = {
name: 'eventListeners',
enabled: true,
phase: 'write',
fn: function fn() {},
effect: effect,
data: {}
};
3 years ago
3 years ago
var hash$1 = {
left: 'right',
right: 'left',
bottom: 'top',
top: 'bottom'
};
function getOppositePlacement(placement) {
return placement.replace(/left|right|bottom|top/g, function (matched) {
return hash$1[matched];
});
3 years ago
}
3 years ago
var hash = {
start: 'end',
end: 'start'
};
function getOppositeVariationPlacement(placement) {
return placement.replace(/start|end/g, function (matched) {
return hash[matched];
});
3 years ago
}
3 years ago
function getWindowScroll(node) {
var win = getWindow(node);
var scrollLeft = win.pageXOffset;
var scrollTop = win.pageYOffset;
return {
scrollLeft: scrollLeft,
scrollTop: scrollTop
};
3 years ago
}
3 years ago
function getWindowScrollBarX(element) {
// If <html> has a CSS width greater than the viewport, then this will be
// incorrect for RTL.
// Popper 1 is broken in this case and never had a bug report so let's assume
// it's not an issue. I don't think anyone ever specifies width on <html>
// anyway.
// Browsers where the left scrollbar doesn't cause an issue report `0` for
// this (e.g. Edge 2019, IE11, Safari)
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
3 years ago
}
3 years ago
function getViewportRect(element) {
var win = getWindow(element);
var html = getDocumentElement(element);
var visualViewport = win.visualViewport;
var width = html.clientWidth;
var height = html.clientHeight;
var x = 0;
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
// can be obscured underneath it.
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
// if it isn't open, so if this isn't available, the popper will be detected
// to overflow the bottom of the screen too early.
3 years ago
3 years ago
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
// errors due to floating point numbers, so we need to check precision.
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
// Feature detection fails in mobile emulation mode in Chrome.
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
// 0.001
// Fallback here: "Not Safari" userAgent
3 years ago
3 years ago
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
x = visualViewport.offsetLeft;
y = visualViewport.offsetTop;
3 years ago
}
}
3 years ago
return {
width: width,
height: height,
x: x + getWindowScrollBarX(element),
y: y
};
3 years ago
}
3 years ago
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
function getDocumentRect(element) {
var _element$ownerDocumen;
var html = getDocumentElement(element);
var winScroll = getWindowScroll(element);
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
var y = -winScroll.scrollTop;
if (getComputedStyle(body || html).direction === 'rtl') {
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
3 years ago
}
3 years ago
return {
width: width,
height: height,
x: x,
y: y
};
3 years ago
}
3 years ago
function isScrollParent(element) {
// Firefox wants us to check `-x` and `-y` variations as well
var _getComputedStyle = getComputedStyle(element),
overflow = _getComputedStyle.overflow,
overflowX = _getComputedStyle.overflowX,
overflowY = _getComputedStyle.overflowY;
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
3 years ago
}
3 years ago
function getScrollParent(node) {
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
// $FlowFixMe[incompatible-return]: assume body is always available
return node.ownerDocument.body;
}
3 years ago
3 years ago
if (isHTMLElement(node) && isScrollParent(node)) {
return node;
}
3 years ago
3 years ago
return getScrollParent(getParentNode(node));
3 years ago
}
3 years ago
/*
given a DOM element, return the list of all scroll parents, up the list of ancesors
until we get to the top window object. This list is what we attach scroll listeners
to, because if any of these parent elements scroll, we'll need to re-calculate the
reference element's position.
*/
3 years ago
3 years ago
function listScrollParents(element, list) {
var _element$ownerDocumen;
3 years ago
3 years ago
if (list === void 0) {
list = [];
3 years ago
}
3 years ago
var scrollParent = getScrollParent(element);
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
var win = getWindow(scrollParent);
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
updatedList.concat(listScrollParents(getParentNode(target)));
3 years ago
}
3 years ago
function rectToClientRect(rect) {
return Object.assign({}, rect, {
left: rect.x,
top: rect.y,
right: rect.x + rect.width,
bottom: rect.y + rect.height
});
3 years ago
}
3 years ago
function getInnerBoundingClientRect(element) {
var rect = getBoundingClientRect(element);
rect.top = rect.top + element.clientTop;
rect.left = rect.left + element.clientLeft;
rect.bottom = rect.top + element.clientHeight;
rect.right = rect.left + element.clientWidth;
rect.width = element.clientWidth;
rect.height = element.clientHeight;
rect.x = rect.left;
rect.y = rect.top;
return rect;
3 years ago
}
3 years ago
function getClientRectFromMixedType(element, clippingParent) {
3 years ago
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
3 years ago
} // A "clipping parent" is an overflowable container with the characteristic of
// clipping (or hiding) overflowing elements with a position different from
// `initial`
3 years ago
3 years ago
function getClippingParents(element) {
var clippingParents = listScrollParents(getParentNode(element));
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
3 years ago
3 years ago
if (!isElement(clipperElement)) {
return [];
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
3 years ago
3 years ago
return clippingParents.filter(function (clippingParent) {
3 years ago
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
3 years ago
});
} // Gets the maximum area that the element is visible in due to any number of
// clipping parents
function getClippingRect(element, boundary, rootBoundary) {
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
var firstClippingParent = clippingParents[0];
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
var rect = getClientRectFromMixedType(element, clippingParent);
accRect.top = max(rect.top, accRect.top);
accRect.right = min(rect.right, accRect.right);
accRect.bottom = min(rect.bottom, accRect.bottom);
accRect.left = max(rect.left, accRect.left);
return accRect;
}, getClientRectFromMixedType(element, firstClippingParent));
clippingRect.width = clippingRect.right - clippingRect.left;
clippingRect.height = clippingRect.bottom - clippingRect.top;
clippingRect.x = clippingRect.left;
clippingRect.y = clippingRect.top;
return clippingRect;
3 years ago
}
3 years ago
function computeOffsets(_ref) {
var reference = _ref.reference,
element = _ref.element,
placement = _ref.placement;
var basePlacement = placement ? getBasePlacement(placement) : null;
var variation = placement ? getVariation(placement) : null;
var commonX = reference.x + reference.width / 2 - element.width / 2;
var commonY = reference.y + reference.height / 2 - element.height / 2;
var offsets;
3 years ago
3 years ago
switch (basePlacement) {
case top:
offsets = {
x: commonX,
y: reference.y - element.height
};
break;
case bottom:
offsets = {
x: commonX,
y: reference.y + reference.height
};
break;
case right:
offsets = {
x: reference.x + reference.width,
y: commonY
};
break;
case left:
offsets = {
x: reference.x - element.width,
y: commonY
};
break;
default:
offsets = {
x: reference.x,
y: reference.y
};
3 years ago
}
3 years ago
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
if (mainAxis != null) {
var len = mainAxis === 'y' ? 'height' : 'width';
switch (variation) {
case start:
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
break;
case end:
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
break;
3 years ago
}
}
3 years ago
return offsets;
3 years ago
}
3 years ago
function detectOverflow(state, options) {
if (options === void 0) {
options = {};
}
3 years ago
3 years ago
var _options = options,
_options$placement = _options.placement,
placement = _options$placement === void 0 ? state.placement : _options$placement,
_options$boundary = _options.boundary,
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
_options$rootBoundary = _options.rootBoundary,
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
_options$elementConte = _options.elementContext,
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
_options$altBoundary = _options.altBoundary,
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
_options$padding = _options.padding,
padding = _options$padding === void 0 ? 0 : _options$padding;
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
var altContext = elementContext === popper ? reference : popper;
var popperRect = state.rects.popper;
var element = state.elements[altBoundary ? altContext : elementContext];
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
var referenceClientRect = getBoundingClientRect(state.elements.reference);
var popperOffsets = computeOffsets({
reference: referenceClientRect,
element: popperRect,
strategy: 'absolute',
placement: placement
});
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
// 0 or negative = within the clipping rect
3 years ago
3 years ago
var overflowOffsets = {
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
3 years ago
};
3 years ago
var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
3 years ago
3 years ago
if (elementContext === popper && offsetData) {
var offset = offsetData[placement];
Object.keys(overflowOffsets).forEach(function (key) {
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
overflowOffsets[key] += offset[axis] * multiply;
});
3 years ago
}
3 years ago
return overflowOffsets;
3 years ago
}
3 years ago
function computeAutoPlacement(state, options) {
if (options === void 0) {
options = {};
3 years ago
}
3 years ago
var _options = options,
placement = _options.placement,
boundary = _options.boundary,
rootBoundary = _options.rootBoundary,
padding = _options.padding,
flipVariations = _options.flipVariations,
_options$allowedAutoP = _options.allowedAutoPlacements,
allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
var variation = getVariation(placement);
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
return getVariation(placement) === variation;
}) : basePlacements;
var allowedPlacements = placements$1.filter(function (placement) {
return allowedAutoPlacements.indexOf(placement) >= 0;
});
3 years ago
3 years ago
if (allowedPlacements.length === 0) {
allowedPlacements = placements$1;
3 years ago
3 years ago
if (process.env.NODE_ENV !== "production") {
console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
3 years ago
}
3 years ago
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
3 years ago
3 years ago
var overflows = allowedPlacements.reduce(function (acc, placement) {
acc[placement] = detectOverflow(state, {
placement: placement,
boundary: boundary,
rootBoundary: rootBoundary,
padding: padding
})[getBasePlacement(placement)];
return acc;
}, {});
return Object.keys(overflows).sort(function (a, b) {
return overflows[a] - overflows[b];
});
3 years ago
}
3 years ago
function getExpandedFallbackPlacements(placement) {
if (getBasePlacement(placement) === auto) {
return [];
}
3 years ago
3 years ago
var oppositePlacement = getOppositePlacement(placement);
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
3 years ago
}
3 years ago
function flip(_ref) {
var state = _ref.state,
options = _ref.options,
name = _ref.name;
3 years ago
3 years ago
if (state.modifiersData[name]._skip) {
return;
3 years ago
}
3 years ago
var _options$mainAxis = options.mainAxis,
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
_options$altAxis = options.altAxis,
checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
specifiedFallbackPlacements = options.fallbackPlacements,
padding = options.padding,
boundary = options.boundary,
rootBoundary = options.rootBoundary,
altBoundary = options.altBoundary,
_options$flipVariatio = options.flipVariations,
flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
allowedAutoPlacements = options.allowedAutoPlacements;
var preferredPlacement = state.options.placement;
var basePlacement = getBasePlacement(preferredPlacement);
var isBasePlacement = basePlacement === preferredPlacement;
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
placement: placement,
boundary: boundary,
rootBoundary: rootBoundary,
padding: padding,
flipVariations: flipVariations,
allowedAutoPlacements: allowedAutoPlacements
}) : placement);
}, []);
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var checksMap = new Map();
var makeFallbackChecks = true;
var firstFittingPlacement = placements[0];
3 years ago
3 years ago
for (var i = 0; i < placements.length; i++) {
var placement = placements[i];
3 years ago
3 years ago
var _basePlacement = getBasePlacement(placement);
var isStartVariation = getVariation(placement) === start;
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
var len = isVertical ? 'width' : 'height';
var overflow = detectOverflow(state, {
placement: placement,
boundary: boundary,
rootBoundary: rootBoundary,
altBoundary: altBoundary,
padding: padding
});
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
if (referenceRect[len] > popperRect[len]) {
mainVariationSide = getOppositePlacement(mainVariationSide);
3 years ago
}
3 years ago
var altVariationSide = getOppositePlacement(mainVariationSide);
var checks = [];
if (checkMainAxis) {
checks.push(overflow[_basePlacement] <= 0);
3 years ago
}
3 years ago
if (checkAltAxis) {
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
}
if (checks.every(function (check) {
return check;
})) {
firstFittingPlacement = placement;
makeFallbackChecks = false;
3 years ago
break;
}
3 years ago
checksMap.set(placement, checks);
3 years ago
}
3 years ago
if (makeFallbackChecks) {
// `2` may be desired in some cases research later
var numberOfChecks = flipVariations ? 3 : 1;
3 years ago
3 years ago
var _loop = function _loop(_i) {
var fittingPlacement = placements.find(function (placement) {
var checks = checksMap.get(placement);
3 years ago
3 years ago
if (checks) {
return checks.slice(0, _i).every(function (check) {
return check;
});
}
});
3 years ago
3 years ago
if (fittingPlacement) {
firstFittingPlacement = fittingPlacement;
return "break";
}
};
3 years ago
3 years ago
for (var _i = numberOfChecks; _i > 0; _i--) {
var _ret = _loop(_i);
3 years ago
3 years ago
if (_ret === "break") break;
}
}
3 years ago
3 years ago
if (state.placement !== firstFittingPlacement) {
state.modifiersData[name]._skip = true;
state.placement = firstFittingPlacement;
state.reset = true;
}
} // eslint-disable-next-line import/no-unused-modules
3 years ago
3 years ago
var flip$1 = {
name: 'flip',
enabled: true,
phase: 'main',
fn: flip,
requiresIfExists: ['offset'],
data: {
_skip: false
}
};
3 years ago
3 years ago
function getSideOffsets(overflow, rect, preventedOffsets) {
if (preventedOffsets === void 0) {
preventedOffsets = {
x: 0,
y: 0
};
3 years ago
}
3 years ago
return {
top: overflow.top - rect.height - preventedOffsets.y,
right: overflow.right - rect.width + preventedOffsets.x,
bottom: overflow.bottom - rect.height + preventedOffsets.y,
left: overflow.left - rect.width - preventedOffsets.x
};
3 years ago
}
3 years ago
function isAnySideFullyClipped(overflow) {
return [top, right, bottom, left].some(function (side) {
return overflow[side] >= 0;
});
}
3 years ago
3 years ago
function hide(_ref) {
var state = _ref.state,
name = _ref.name;
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var preventedOffsets = state.modifiersData.preventOverflow;
var referenceOverflow = detectOverflow(state, {
elementContext: 'reference'
});
var popperAltOverflow = detectOverflow(state, {
altBoundary: true
});
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
state.modifiersData[name] = {
referenceClippingOffsets: referenceClippingOffsets,
popperEscapeOffsets: popperEscapeOffsets,
isReferenceHidden: isReferenceHidden,
hasPopperEscaped: hasPopperEscaped
};
state.attributes.popper = Object.assign({}, state.attributes.popper, {
'data-popper-reference-hidden': isReferenceHidden,
'data-popper-escaped': hasPopperEscaped
});
} // eslint-disable-next-line import/no-unused-modules
3 years ago
3 years ago
var hide$1 = {
name: 'hide',
enabled: true,
phase: 'main',
requiresIfExists: ['preventOverflow'],
fn: hide
};
3 years ago
3 years ago
function distanceAndSkiddingToXY(placement, rects, offset) {
var basePlacement = getBasePlacement(placement);
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
3 years ago
3 years ago
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
placement: placement
})) : offset,
skidding = _ref[0],
distance = _ref[1];
3 years ago
3 years ago
skidding = skidding || 0;
distance = (distance || 0) * invertDistance;
return [left, right].indexOf(basePlacement) >= 0 ? {
x: distance,
y: skidding
} : {
x: skidding,
y: distance
};
}
3 years ago
3 years ago
function offset(_ref2) {
var state = _ref2.state,
options = _ref2.options,
name = _ref2.name;
var _options$offset = options.offset,
offset = _options$offset === void 0 ? [0, 0] : _options$offset;
var data = placements.reduce(function (acc, placement) {
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
return acc;
}, {});
var _data$state$placement = data[state.placement],
x = _data$state$placement.x,
y = _data$state$placement.y;
3 years ago
3 years ago
if (state.modifiersData.popperOffsets != null) {
state.modifiersData.popperOffsets.x += x;
state.modifiersData.popperOffsets.y += y;
3 years ago
}
3 years ago
state.modifiersData[name] = data;
} // eslint-disable-next-line import/no-unused-modules
3 years ago
3 years ago
var offset$1 = {
name: 'offset',
enabled: true,
phase: 'main',
requires: ['popperOffsets'],
fn: offset
};
3 years ago
3 years ago
function popperOffsets(_ref) {
var state = _ref.state,
name = _ref.name;
// Offsets are the actual position the popper needs to have to be
// properly positioned near its reference element
// This is the most basic placement, and will be adjusted by
// the modifiers in the next step
state.modifiersData[name] = computeOffsets({
reference: state.rects.reference,
element: state.rects.popper,
strategy: 'absolute',
placement: state.placement
});
} // eslint-disable-next-line import/no-unused-modules
3 years ago
3 years ago
var popperOffsets$1 = {
name: 'popperOffsets',
enabled: true,
phase: 'read',
fn: popperOffsets,
data: {}
};
3 years ago
3 years ago
function getAltAxis(axis) {
return axis === 'x' ? 'y' : 'x';
3 years ago
}
3 years ago
function preventOverflow(_ref) {
var state = _ref.state,
options = _ref.options,
name = _ref.name;
var _options$mainAxis = options.mainAxis,
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
_options$altAxis = options.altAxis,
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
boundary = options.boundary,
rootBoundary = options.rootBoundary,
altBoundary = options.altBoundary,
padding = options.padding,
_options$tether = options.tether,
tether = _options$tether === void 0 ? true : _options$tether,
_options$tetherOffset = options.tetherOffset,
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
var overflow = detectOverflow(state, {
boundary: boundary,
rootBoundary: rootBoundary,
padding: padding,
altBoundary: altBoundary
});
var basePlacement = getBasePlacement(state.placement);
var variation = getVariation(state.placement);
var isBasePlacement = !variation;
var mainAxis = getMainAxisFromPlacement(basePlacement);
var altAxis = getAltAxis(mainAxis);
var popperOffsets = state.modifiersData.popperOffsets;
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
placement: state.placement
})) : tetherOffset;
3 years ago
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
mainAxis: tetherOffsetValue,
altAxis: tetherOffsetValue
} : Object.assign({
mainAxis: 0,
altAxis: 0
}, tetherOffsetValue);
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
3 years ago
var data = {
x: 0,
y: 0
};
if (!popperOffsets) {
return;
3 years ago
}
3 years ago
if (checkMainAxis) {
var _offsetModifierState$;
3 years ago
var mainSide = mainAxis === 'y' ? top : left;
var altSide = mainAxis === 'y' ? bottom : right;
var len = mainAxis === 'y' ? 'height' : 'width';
var offset = popperOffsets[mainAxis];
3 years ago
var min$1 = offset + overflow[mainSide];
var max$1 = offset - overflow[altSide];
3 years ago
var additive = tether ? -popperRect[len] / 2 : 0;
var minLen = variation === start ? referenceRect[len] : popperRect[len];
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
// outside the reference bounds
3 years ago
3 years ago
var arrowElement = state.elements.arrow;
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
width: 0,
height: 0
};
var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
var arrowPaddingMin = arrowPaddingObject[mainSide];
var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
// to include its full size in the calculation. If the reference is small
// and near the edge of a boundary, the popper can overflow even if the
// reference is not overflowing as well (e.g. virtual elements with no
// width or height)
3 years ago
3 years ago
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
3 years ago
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
3 years ago
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
3 years ago
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
var tetherMax = offset + maxOffset - offsetModifierValue;
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
popperOffsets[mainAxis] = preventedOffset;
data[mainAxis] = preventedOffset - offset;
}
3 years ago
3 years ago
if (checkAltAxis) {
var _offsetModifierState$2;
3 years ago
3 years ago
var _mainSide = mainAxis === 'x' ? top : left;
3 years ago
3 years ago
var _altSide = mainAxis === 'x' ? bottom : right;
3 years ago
3 years ago
var _offset = popperOffsets[altAxis];
3 years ago
3 years ago
var _len = altAxis === 'y' ? 'height' : 'width';
3 years ago
3 years ago
var _min = _offset + overflow[_mainSide];
3 years ago
3 years ago
var _max = _offset - overflow[_altSide];
3 years ago
3 years ago
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
popperOffsets[altAxis] = _preventedOffset;
data[altAxis] = _preventedOffset - _offset;
3 years ago
}
3 years ago
state.modifiersData[name] = data;
} // eslint-disable-next-line import/no-unused-modules
var preventOverflow$1 = {
name: 'preventOverflow',
enabled: true,
phase: 'main',
fn: preventOverflow,
requiresIfExists: ['offset']
};
function getHTMLElementScroll(element) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
function getNodeScroll(node) {
if (node === getWindow(node) || !isHTMLElement(node)) {
return getWindowScroll(node);
3 years ago
} else {
3 years ago
return getHTMLElementScroll(node);
3 years ago
}
3 years ago
}
3 years ago
3 years ago
function isElementScaled(element) {
var rect = element.getBoundingClientRect();
3 years ago
var scaleX = round(rect.width) / element.offsetWidth || 1;
var scaleY = round(rect.height) / element.offsetHeight || 1;
3 years ago
return scaleX !== 1 || scaleY !== 1;
} // Returns the composite rect of an element relative to its offsetParent.
// Composite means it takes into account transforms as well as layout.
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
if (isFixed === void 0) {
isFixed = false;
3 years ago
}
3 years ago
var isOffsetParentAnElement = isHTMLElement(offsetParent);
3 years ago
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
3 years ago
var documentElement = getDocumentElement(offsetParent);
3 years ago
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
3 years ago
var scroll = {
scrollLeft: 0,
scrollTop: 0
};
var offsets = {
x: 0,
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
3 years ago
}
3 years ago
if (isHTMLElement(offsetParent)) {
3 years ago
offsets = getBoundingClientRect(offsetParent, true);
3 years ago
offsets.x += offsetParent.clientLeft;
offsets.y += offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
return {
x: rect.left + scroll.scrollLeft - offsets.x,
y: rect.top + scroll.scrollTop - offsets.y,
width: rect.width,
height: rect.height
3 years ago
};
}
3 years ago
function order(modifiers) {
var map = new Map();
var visited = new Set();
var result = [];
modifiers.forEach(function (modifier) {
map.set(modifier.name, modifier);
}); // On visiting object, check for its dependencies and visit them recursively
3 years ago
3 years ago
function sort(modifier) {
visited.add(modifier.name);
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
requires.forEach(function (dep) {
if (!visited.has(dep)) {
var depModifier = map.get(dep);
if (depModifier) {
sort(depModifier);
}
}
});
result.push(modifier);
}
modifiers.forEach(function (modifier) {
if (!visited.has(modifier.name)) {
// check for visited object
sort(modifier);
}
});
return result;
3 years ago
}
3 years ago
function orderModifiers(modifiers) {
// order based on dependencies
var orderedModifiers = order(modifiers); // order based on phase
return modifierPhases.reduce(function (acc, phase) {
return acc.concat(orderedModifiers.filter(function (modifier) {
return modifier.phase === phase;
}));
}, []);
3 years ago
}
3 years ago
function debounce(fn) {
var pending;
return function () {
if (!pending) {
pending = new Promise(function (resolve) {
Promise.resolve().then(function () {
pending = undefined;
resolve(fn());
});
});
}
3 years ago
3 years ago
return pending;
};
3 years ago
}
3 years ago
function format(str) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
3 years ago
3 years ago
return [].concat(args).reduce(function (p, c) {
return p.replace(/%s/, c);
}, str);
3 years ago
}
3 years ago
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
function validateModifiers(modifiers) {
modifiers.forEach(function (modifier) {
[].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
.filter(function (value, index, self) {
return self.indexOf(value) === index;
}).forEach(function (key) {
switch (key) {
case 'name':
if (typeof modifier.name !== 'string') {
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
}
3 years ago
3 years ago
break;
3 years ago
3 years ago
case 'enabled':
if (typeof modifier.enabled !== 'boolean') {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
}
3 years ago
3 years ago
break;
3 years ago
3 years ago
case 'phase':
if (modifierPhases.indexOf(modifier.phase) < 0) {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
}
3 years ago
3 years ago
break;
3 years ago
3 years ago
case 'fn':
if (typeof modifier.fn !== 'function') {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
}
3 years ago
3 years ago
break;
3 years ago
3 years ago
case 'effect':
if (modifier.effect != null && typeof modifier.effect !== 'function') {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
}
3 years ago
3 years ago
break;
3 years ago
3 years ago
case 'requires':
if (modifier.requires != null && !Array.isArray(modifier.requires)) {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
}
3 years ago
3 years ago
break;
3 years ago
3 years ago
case 'requiresIfExists':
if (!Array.isArray(modifier.requiresIfExists)) {
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
}
3 years ago
3 years ago
break;
3 years ago
3 years ago
case 'options':
case 'data':
break;
3 years ago
3 years ago
default:
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
return "\"" + s + "\"";
}).join(', ') + "; but \"" + key + "\" was provided.");
}
3 years ago
3 years ago
modifier.requires && modifier.requires.forEach(function (requirement) {
if (modifiers.find(function (mod) {
return mod.name === requirement;
}) == null) {
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
}
});
});
});
3 years ago
}
3 years ago
function uniqueBy(arr, fn) {
var identifiers = new Set();
return arr.filter(function (item) {
var identifier = fn(item);
3 years ago
3 years ago
if (!identifiers.has(identifier)) {
identifiers.add(identifier);
return true;
}
});
3 years ago
}
3 years ago
function mergeByName(modifiers) {
var merged = modifiers.reduce(function (merged, current) {
var existing = merged[current.name];
merged[current.name] = existing ? Object.assign({}, existing, current, {
options: Object.assign({}, existing.options, current.options),
data: Object.assign({}, existing.data, current.data)
}) : current;
return merged;
}, {}); // IE11 does not support Object.values
3 years ago
3 years ago
return Object.keys(merged).map(function (key) {
return merged[key];
});
3 years ago
}
3 years ago
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
var DEFAULT_OPTIONS = {
placement: 'bottom',
modifiers: [],
strategy: 'absolute'
};
function areValidElements() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
3 years ago
}
3 years ago
return !args.some(function (element) {
return !(element && typeof element.getBoundingClientRect === 'function');
});
3 years ago
}
3 years ago
function popperGenerator(generatorOptions) {
if (generatorOptions === void 0) {
generatorOptions = {};
}
3 years ago
3 years ago
var _generatorOptions = generatorOptions,
_generatorOptions$def = _generatorOptions.defaultModifiers,
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
_generatorOptions$def2 = _generatorOptions.defaultOptions,
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
return function createPopper(reference, popper, options) {
if (options === void 0) {
options = defaultOptions;
}
3 years ago
3 years ago
var state = {
placement: 'bottom',
orderedModifiers: [],
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
modifiersData: {},
elements: {
reference: reference,
popper: popper
},
attributes: {},
styles: {}
};
var effectCleanupFns = [];
var isDestroyed = false;
var instance = {
state: state,
setOptions: function setOptions(setOptionsAction) {
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
cleanupModifierEffects();
state.options = Object.assign({}, defaultOptions, state.options, options);
state.scrollParents = {
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
popper: listScrollParents(popper)
}; // Orders the modifiers based on their dependencies and `phase`
// properties
3 years ago
3 years ago
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
3 years ago
3 years ago
state.orderedModifiers = orderedModifiers.filter(function (m) {
return m.enabled;
}); // Validate the provided modifiers so that the consumer will get warned
// if one of the modifiers is invalid for any reason
3 years ago
3 years ago
if (process.env.NODE_ENV !== "production") {
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
var name = _ref.name;
return name;
});
validateModifiers(modifiers);
3 years ago
3 years ago
if (getBasePlacement(state.options.placement) === auto) {
var flipModifier = state.orderedModifiers.find(function (_ref2) {
var name = _ref2.name;
return name === 'flip';
});
3 years ago
3 years ago
if (!flipModifier) {
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
}
}
3 years ago
3 years ago
var _getComputedStyle = getComputedStyle(popper),
marginTop = _getComputedStyle.marginTop,
marginRight = _getComputedStyle.marginRight,
marginBottom = _getComputedStyle.marginBottom,
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
// cause bugs with positioning, so we'll warn the consumer
3 years ago
3 years ago
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
return parseFloat(margin);
})) {
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
}
}
3 years ago
3 years ago
runModifierEffects();
return instance.update();
},
// Sync update it will always be executed, even if not necessary. This
// is useful for low frequency updates where sync behavior simplifies the
// logic.
// For high frequency updates (e.g. `resize` and `scroll` events), always
// prefer the async Popper#update method
forceUpdate: function forceUpdate() {
if (isDestroyed) {
return;
}
3 years ago
3 years ago
var _state$elements = state.elements,
reference = _state$elements.reference,
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
// anymore
3 years ago
3 years ago
if (!areValidElements(reference, popper)) {
if (process.env.NODE_ENV !== "production") {
console.error(INVALID_ELEMENT_ERROR);
}
3 years ago
3 years ago
return;
} // Store the reference and popper rects to be read by modifiers
3 years ago
3 years ago
state.rects = {
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
popper: getLayoutRect(popper)
}; // Modifiers have the ability to reset the current update cycle. The
// most common use case for this is the `flip` modifier changing the
// placement, which then needs to re-run all the modifiers, because the
// logic was previously ran for the previous placement and is therefore
// stale/incorrect
3 years ago
3 years ago
state.reset = false;
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
// is filled with the initial data specified by the modifier. This means
// it doesn't persist and is fresh on each update.
// To ensure persistent data, use `${name}#persistent`
3 years ago
3 years ago
state.orderedModifiers.forEach(function (modifier) {
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
});
var __debug_loops__ = 0;
3 years ago
3 years ago
for (var index = 0; index < state.orderedModifiers.length; index++) {
if (process.env.NODE_ENV !== "production") {
__debug_loops__ += 1;
3 years ago
3 years ago
if (__debug_loops__ > 100) {
console.error(INFINITE_LOOP_ERROR);
break;
}
}
3 years ago
3 years ago
if (state.reset === true) {
state.reset = false;
index = -1;
continue;
}
3 years ago
3 years ago
var _state$orderedModifie = state.orderedModifiers[index],
fn = _state$orderedModifie.fn,
_state$orderedModifie2 = _state$orderedModifie.options,
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
name = _state$orderedModifie.name;
3 years ago
3 years ago
if (typeof fn === 'function') {
state = fn({
state: state,
options: _options,
name: name,
instance: instance
}) || state;
}
}
},
// Async and optimistically optimized update it will not be executed if
// not necessary (debounced to run at most once-per-tick)
update: debounce(function () {
return new Promise(function (resolve) {
instance.forceUpdate();
resolve(state);
});
}),
destroy: function destroy() {
cleanupModifierEffects();
isDestroyed = true;
}
};
3 years ago
3 years ago
if (!areValidElements(reference, popper)) {
if (process.env.NODE_ENV !== "production") {
console.error(INVALID_ELEMENT_ERROR);
}
3 years ago
3 years ago
return instance;
}
3 years ago
3 years ago
instance.setOptions(options).then(function (state) {
if (!isDestroyed && options.onFirstUpdate) {
options.onFirstUpdate(state);
}
}); // Modifiers have the ability to execute arbitrary code before the first
// update cycle runs. They will be executed in the same order as the update
// cycle. This is useful when a modifier adds some persistent data that
// other modifiers need to use, but the modifier is run after the dependent
// one.
3 years ago
3 years ago
function runModifierEffects() {
state.orderedModifiers.forEach(function (_ref3) {
var name = _ref3.name,
_ref3$options = _ref3.options,
options = _ref3$options === void 0 ? {} : _ref3$options,
effect = _ref3.effect;
3 years ago
3 years ago
if (typeof effect === 'function') {
var cleanupFn = effect({
state: state,
name: name,
instance: instance,
options: options
});
3 years ago
3 years ago
var noopFn = function noopFn() {};
3 years ago
3 years ago
effectCleanupFns.push(cleanupFn || noopFn);
}
});
3 years ago
}
3 years ago
function cleanupModifierEffects() {
effectCleanupFns.forEach(function (fn) {
return fn();
});
effectCleanupFns = [];
3 years ago
}
3 years ago
return instance;
3 years ago
};
}
3 years ago
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
var createPopper = /*#__PURE__*/popperGenerator({
defaultModifiers: defaultModifiers
}); // eslint-disable-next-line import/no-unused-modules
3 years ago
3 years ago
// Credits go to Liam's Periodic Notes Plugin: https://github.com/liamcain/obsidian-periodic-notes
const wrapAround = (value, size) => {
return ((value % size) + size) % size;
3 years ago
};
3 years ago
class Suggest {
constructor(owner, containerEl, scope) {
this.owner = owner;
this.containerEl = containerEl;
containerEl.on("click", ".suggestion-item", this.onSuggestionClick.bind(this));
containerEl.on("mousemove", ".suggestion-item", this.onSuggestionMouseover.bind(this));
scope.register([], "ArrowUp", (event) => {
if (!event.isComposing) {
this.setSelectedItem(this.selectedItem - 1, true);
return false;
}
});
scope.register([], "ArrowDown", (event) => {
if (!event.isComposing) {
this.setSelectedItem(this.selectedItem + 1, true);
return false;
}
});
scope.register([], "Enter", (event) => {
if (!event.isComposing) {
this.useSelectedItem(event);
return false;
}
});
}
onSuggestionClick(event, el) {
event.preventDefault();
const item = this.suggestions.indexOf(el);
this.setSelectedItem(item, false);
this.useSelectedItem(event);
}
onSuggestionMouseover(_event, el) {
const item = this.suggestions.indexOf(el);
this.setSelectedItem(item, false);
}
setSuggestions(values) {
this.containerEl.empty();
const suggestionEls = [];
values.forEach((value) => {
const suggestionEl = this.containerEl.createDiv("suggestion-item");
this.owner.renderSuggestion(value, suggestionEl);
suggestionEls.push(suggestionEl);
});
this.values = values;
this.suggestions = suggestionEls;
this.setSelectedItem(0, false);
}
useSelectedItem(event) {
const currentValue = this.values[this.selectedItem];
if (currentValue) {
this.owner.selectSuggestion(currentValue, event);
}
}
setSelectedItem(selectedIndex, scrollIntoView) {
const normalizedIndex = wrapAround(selectedIndex, this.suggestions.length);
const prevSelectedSuggestion = this.suggestions[this.selectedItem];
const selectedSuggestion = this.suggestions[normalizedIndex];
prevSelectedSuggestion === null || prevSelectedSuggestion === void 0 ? void 0 : prevSelectedSuggestion.removeClass("is-selected");
selectedSuggestion === null || selectedSuggestion === void 0 ? void 0 : selectedSuggestion.addClass("is-selected");
this.selectedItem = normalizedIndex;
if (scrollIntoView) {
selectedSuggestion.scrollIntoView(false);
}
}
3 years ago
}
3 years ago
class TextInputSuggest {
constructor(app, inputEl) {
this.app = app;
this.inputEl = inputEl;
this.scope = new obsidian.Scope();
this.suggestEl = createDiv("suggestion-container");
const suggestion = this.suggestEl.createDiv("suggestion");
this.suggest = new Suggest(this, suggestion, this.scope);
this.scope.register([], "Escape", this.close.bind(this));
this.inputEl.addEventListener("input", this.onInputChanged.bind(this));
this.inputEl.addEventListener("focus", this.onInputChanged.bind(this));
this.inputEl.addEventListener("blur", this.close.bind(this));
this.suggestEl.on("mousedown", ".suggestion-container", (event) => {
event.preventDefault();
});
3 years ago
}
3 years ago
onInputChanged() {
const inputStr = this.inputEl.value;
const suggestions = this.getSuggestions(inputStr);
if (!suggestions) {
this.close();
return;
}
if (suggestions.length > 0) {
this.suggest.setSuggestions(suggestions);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.open(this.app.dom.appContainerEl, this.inputEl);
}
else {
this.close();
}
3 years ago
}
3 years ago
open(container, inputEl) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.app.keymap.pushScope(this.scope);
container.appendChild(this.suggestEl);
this.popper = createPopper(inputEl, this.suggestEl, {
placement: "bottom-start",
modifiers: [
{
name: "sameWidth",
enabled: true,
fn: ({ state, instance }) => {
// Note: positioning needs to be calculated twice -
// first pass - positioning it according to the width of the popper
// second pass - position it with the width bound to the reference element
// we need to early exit to avoid an infinite loop
const targetWidth = `${state.rects.reference.width}px`;
if (state.styles.popper.width === targetWidth) {
return;
}
state.styles.popper.width = targetWidth;
instance.update();
},
phase: "beforeWrite",
requires: ["computeStyles"],
},
],
});
}
close() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.app.keymap.popScope(this.scope);
this.suggest.setSuggestions([]);
if (this.popper)
this.popper.destroy();
this.suggestEl.detach();
3 years ago
}
}
3 years ago
// Credits go to Liam's Periodic Notes Plugin: https://github.com/liamcain/obsidian-periodic-notes
class FolderSuggest extends TextInputSuggest {
getSuggestions(inputStr) {
const abstractFiles = this.app.vault.getAllLoadedFiles();
const folders = [];
const lowerCaseInputStr = inputStr.toLowerCase();
abstractFiles.forEach((folder) => {
if (folder instanceof obsidian.TFolder &&
folder.path.toLowerCase().contains(lowerCaseInputStr)) {
folders.push(folder);
}
});
return folders;
}
renderSuggestion(file, el) {
el.setText(file.path);
}
selectSuggestion(file) {
this.inputEl.value = file.path;
this.inputEl.trigger("input");
this.close();
}
3 years ago
}
3 years ago
class BaseModal extends obsidian.Modal {
//taken from github.com/valentine195/obsidian-admonition
3 years ago
setValidationError(input, message) {
input.inputEl.addClass("is-invalid");
3 years ago
if (message) {
3 years ago
input.inputEl.parentElement.addClasses([
3 years ago
"has-invalid-message",
"unset-align-items"
]);
3 years ago
input.inputEl.parentElement.parentElement.addClass(".unset-align-items");
let mDiv = input.inputEl.parentElement.querySelector(".invalid-feedback");
3 years ago
if (!mDiv) {
mDiv = createDiv({ cls: "invalid-feedback" });
}
mDiv.innerText = message;
3 years ago
mDiv.insertAfter(input.inputEl);
3 years ago
}
}
3 years ago
removeValidationError(input) {
input.inputEl.removeClass("is-invalid");
input.inputEl.parentElement.removeClasses([
3 years ago
"has-invalid-message",
"unset-align-items"
]);
3 years ago
input.inputEl.parentElement.parentElement.removeClass(".unset-align-items");
if (input.inputEl.parentElement.querySelector(".invalid-feedback")) {
input.inputEl.parentElement.removeChild(input.inputEl.parentElement.querySelector(".invalid-feedback"));
3 years ago
}
}
}
3 years ago
3 years ago
var en = {
RSS_Reader: "RSS Reader",
RSS_Feeds: "RSS Feeds",
//commands
open: "Open",
refresh_feeds: "Refresh feeds",
create_all: "Create all",
//folder actions
mark_all_as_read: "Mark all als read",
filtered_folders: "Filtered Folders",
folders: "Folders",
folder: "Folder",
feeds: "Feeds",
//article actions
create_note: "create new note",
paste_to_note: "paste to current note",
copy_to_clipboard: "copy to clipboard",
open_browser: "open in browser",
edit_tags: "edit tags",
mark_as_read: "Mark as read",
mark_as_unread: "Mark as unread",
mark_as_favorite: "mark as favorite",
remove_from_favorites: "remove from favorites",
read_article_tts: "read article with TTS",
mark_as_read_unread: "mark as read/unread",
mark_as_favorite_remove: "mark as favorite/remove from favorites",
//action notifications
marked_as_read: "marked item as read",
marked_as_unread: "marked item as unread",
removed_from_favorites: "removed item from favorites",
added_to_favorites: "marked item as favorite",
//base modal
save: "Save",
cancel: "Cancel",
delete: "Delete",
edit: "Edit",
reset: "restore default",
fix_errors: "Please fix errors before saving.",
add_new: "Add new",
//feed settings
add_new_feed: "Add new feed",
feed_already_configured: "you already have a feed configured with that url",
no_folder: "No folder",
//feed creation modal
name: "Name",
name_help: "What do you want this feed to show up as?",
url_help: "What is the URL to the feed?",
folder_help: "What do you categorize this feed as?",
invalid_name: "you need to specify a name",
invalid_url: "this url is not valid",
invalid_feed: "This feed does not have any entries",
//filter types
filter_tags: "all articles with tags",
filter_unread: "All unread articles(from folders)",
filter_read: "All read articles(from folders)",
filter_favorites: "Favorites(from folders)",
//sort order
sort_date_newest: 'Publication date (new to old)',
sort_date_oldest: 'Publication date (old to new)',
sort_alphabet_normal: 'Name (A to Z)',
sort_alphabet_inverted: 'Name (Z to A)',
sort: 'Order by',
//filter creation modal
filter_name_help: 'What do you want this filter to show up as?',
filter_type: 'Type',
filter_type_help: 'Type of filter',
filter: 'Filter',
filter_help: 'Folders/Tags to filter on, split by ,',
invalid_tag: "This is not a valid tag",
note_exists: "there is already a note with that name",
invalid_filename: "that filename is not valid",
specify_name: "Please specify a filename",
cannot_contain: "cannot contain:",
created_note: "Created note from article",
inserted_article: "inserted article into note",
no_file_active: "no file active",
//settings
settings: "Settings",
file_creation: "File creation",
template_new: "new file template",
template_new_help: "When creating a note from a article this gets processed.",
template_paste: "paste article template",
template_paste_help: "When pasting/copying an article this gets processed.",
available_variables: "Available variables are:",
file_location: "Default location for new notes",
file_location_help: "Where newly created notes are placed",
file_location_default: "In the default folder",
file_location_custom: "In the folder specified below",
file_location_folder: "Folder to create new articles in",
file_location_folder_help: "newly created articles will appear in this folder",
date_format: "Date format",
syntax_reference: "Syntax Reference",
syntax_looks: "Your current syntax looks like this: ",
ask_filename: "Ask for filename",
ask_filename_help: "Disable to use title as filename(with invalid symbols removed)",
refresh_time: "Refresh time",
refresh_time_help: "How often should the feeds be refreshed, in minutes, use 0 to disable",
specify_positive_number: "please specify a positive number",
multi_device_usage: "Multi device usage",
multi_device_usage_help: "Keep article status synced when using multiple devices at the same time\n(Requires a restart to become effective)",
add_new_filter: "Add new filtered folder",
filter_exists: "you already have a filter configured with that name",
hotkeys: "Hotkeys",
hotkeys_reading: "when reading a article",
};
var de = {
RSS_Reader: "RSS Reader",
RSS_Feeds: "RSS Feeds",
//commands
open: "Öffnen",
refresh_feeds: "Feeds neu laden",
create_all: "Alle erstellen",
//folder actions
mark_all_as_read: "Alle als gelesen markieren",
filtered_folders: "Gefilterte Ordner",
folders: "Ordner",
folder: "Ordner",
feeds: "Feeds",
//article actions
create_note: "Neue Notiz erstellen",
paste_to_note: "In aktuelle Notiz einfügen",
copy_to_clipboard: "In die Zwischenablage kopieren",
open_browser: "Im Webbrowser öffnen",
edit_tags: "Tags bearbeiten",
mark_as_read: "Als gelesen markieren",
mark_as_unread: "Als ungelesen markieren",
mark_as_favorite: "As Favorit markieren",
remove_from_favorites: "Aus den Favoriten entfernen",
read_article_tts: "Vorlesen",
mark_as_read_unread: "Als gelesen/ungelesen markieren",
mark_as_favorite_remove: "Als Favorit markieren/Aus den Favoriten entfernen",
//action notifications
marked_as_read: "Als gelesen markiert",
marked_as_unread: "Als ungelesen markiert",
removed_from_favorites: "Von den Favoriten entfernt",
added_to_favorites: "Als Favorit markiert",
//base modal
save: "Speichern",
cancel: "Abbrechen",
delete: "Löschen",
edit: "Bearbeiten",
reset: "zurücksetzen",
fix_errors: "Bitte behebe die Fehler vor dem speichern.",
add_new: "neu hinzufügen",
//feed settings
add_new_feed: "neuen Feed hinzufügen",
feed_already_configured: "Es existiert bereits ein Feed mit dieser URL",
no_folder: "Kein Ordner",
//feed creation modal
name: "Name",
name_help: "Unter welchem Namen soll dieser Feed angezeigt werden?",
url_help: "Wie lautet die URL zu diesem Feed?",
folder_help: "Als was kategorisierst du diesen Feed?",
invalid_name: "Du must einen gültigen Namen vergeben",
invalid_url: "diese URL ist nicht gültig",
invalid_feed: "Dieser Feed hat keine Einträge",
//filter types
filter_tags: "Alle Artikel mit Tags",
filter_unread: "Alle ungelesenen Artikel(aus Ordnern)",
filter_read: "Alle gelesenen Artikel(aus Ordnern)",
filter_favorites: "Favoriten(aus Ordnern)",
//sort order
sort_date_newest: 'Veröffentlichungsdatum (neu - alt)',
sort_date_oldest: 'Veröffentlichungsdatum (alt - neu)',
sort_alphabet_normal: 'Name (A - Z)',
sort_alphabet_inverted: 'Name (Z - A)',
sort: 'Ordnen nach',
//filter creation modal
filter_name_help: 'Wie soll der Filter angezeigt werden?',
filter_type: 'Typ',
filter_type_help: 'Typ des Filters',
filter: 'Filter',
filter_help: 'Order/Tags die gefiltert werden sollen, getrennt durch ,',
invalid_tag: "Dieser Tag ist nicht gültig",
note_exists: "Es existiert bereits eine Notiz mit diesem Namen",
invalid_filename: "Der Dateiname ist nicht gültig",
specify_name: "Bitte einen Dateinamen angeben",
cannot_contain: "kann nicht enhalten:",
created_note: "Notiz erstellt",
inserted_article: "in Notiz eingefügt",
no_file_active: "Keine Datei geöffnet",
//settings
settings: "Einstellungen",
file_creation: "Dateierstellung",
template_new: "Vorlage für neue Dateien",
template_new_help: "Beim erstellen einer Notiz wird dies verarbeitet.",
template_paste: "Vorlage beim Einfügen in eine Datei",
template_paste_help: "Beim einfügen/in die Zwischenablage kopieren wird dies verarbeitet.",
available_variables: "Mögliche Variablen sind:",
file_location: "Speicherort für neue Notizen",
file_location_help: "Wo sollen neue Notizen gespeichert werden?",
file_location_default: "In Standardordner",
file_location_custom: "Eigenen Ordner festlegen",
file_location_folder: "Ordner für neue Notizen",
file_location_folder_help: "Speichert neue Notizen an diesem Ort",
date_format: "Datumsformat",
syntax_reference: "Syntax Referenz",
syntax_looks: "So wird es aussehen: ",
ask_filename: "Nach Dateiname fragen",
ask_filename_help: "Deaktivieren um Titel als Dateinamen zu verwenden(ohne ungültige Zeichen)",
refresh_time: "Aktualisierungsintervall",
refresh_time_help: "Wie häufig soll auf neue Einträge überprüft werden(in Minuten), 0 zu deaktivieren",
specify_positive_number: "Bitte eine positive Zahl angeben",
multi_device_usage: "Mit mehreren Geräten nutzen",
multi_device_usage_help: "Syncronisiere Lesestatus & Tags zwischen mehreren gleichzeitig genutzten Geräten\n(Benötigt einen Neustart der App)",
add_new_filter: "Neuen gefilterten Ordner erstellen",
filter_exists: "Es exisitiert bereits ein Feed mit diesem Namen",
hotkeys: "Tastenkürzel",
hotkeys_reading: "in der Leseansicht",
};
//taken from https://github.com/valentine195/obsidian-leaflet-plugin/blob/master/src/l10n/locale.ts
const locale = window.moment.locale;
const localeMap = {
en,
de
};
const userLocale = localeMap[locale()];
function t(str, ...inserts) {
var _a;
let localeStr = (_a = (userLocale && userLocale[str])) !== null && _a !== void 0 ? _a : en[str];
for (let i = 0; i < inserts.length; i++) {
localeStr = localeStr.replace(`%${i + 1}`, inserts[i]);
}
return localeStr;
}
3 years ago
var FilterType;
(function (FilterType) {
3 years ago
FilterType[FilterType["TAGS"] = 0] = "TAGS";
FilterType[FilterType["UNREAD"] = 1] = "UNREAD";
FilterType[FilterType["READ"] = 2] = "READ";
FilterType[FilterType["FAVORITES"] = 3] = "FAVORITES";
3 years ago
})(FilterType || (FilterType = {}));
var SortOrder;
(function (SortOrder) {
3 years ago
SortOrder[SortOrder["DATE_NEWEST"] = 0] = "DATE_NEWEST";
SortOrder[SortOrder["DATE_OLDEST"] = 1] = "DATE_OLDEST";
SortOrder[SortOrder["ALPHABET_NORMAL"] = 2] = "ALPHABET_NORMAL";
SortOrder[SortOrder["ALPHABET_INVERTED"] = 3] = "ALPHABET_INVERTED";
3 years ago
})(SortOrder || (SortOrder = {}));
class FilteredFolderModal extends BaseModal {
constructor(plugin, folder) {
super(plugin.app);
this.filterContent = "";
this.saved = false;
if (folder) {
this.name = folder.name;
this.filterType = folder.filterType;
this.filterContent = folder.filterContent;
this.sortOrder = folder.sortOrder;
}
}
display() {
return __awaiter(this, void 0, void 0, function* () {
const { contentEl } = this;
contentEl.empty();
let nameText;
const name = new obsidian.Setting(contentEl)
3 years ago
.setName(t("name"))
.setDesc(t("filter_name_help"))
3 years ago
.addText((text) => {
nameText = text;
text.setValue(this.name)
.onChange((value) => {
this.removeValidationError(text);
this.name = value;
});
});
name.controlEl.addClass("rss-setting-input");
const type = new obsidian.Setting(contentEl)
3 years ago
.setName(t("filter_type"))
.setDesc(t("filter_type_help"))
3 years ago
.addDropdown((dropdown) => {
for (const option in FilterType) {
3 years ago
if (option.length > 1) {
// @ts-ignore
dropdown.addOption(option, t("filter_" + option.toLowerCase()));
}
3 years ago
}
dropdown
.setValue(this.filterType)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.filterType = value;
}));
});
type.controlEl.addClass("rss-setting-input");
new obsidian.Setting(contentEl)
3 years ago
.setName(t("filter"))
.setDesc(t("filter_help"))
3 years ago
.addText((text) => {
text
.setValue(this.filterContent)
.onChange((value) => {
this.filterContent = value;
this.removeValidationError(text);
});
});
const sorting = new obsidian.Setting(contentEl)
3 years ago
.setName(t("sort"))
3 years ago
.addDropdown((dropdown) => {
for (const order in SortOrder) {
3 years ago
if (order.length > 1) {
// @ts-ignore
dropdown.addOption(order, t("sort_" + order.toLowerCase()));
}
3 years ago
}
dropdown
.setValue(this.sortOrder)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.sortOrder = value;
}));
});
sorting.controlEl.addClass("rss-setting-input");
const footerEl = contentEl.createDiv();
const footerButtons = new obsidian.Setting(footerEl);
footerButtons.addButton((b) => {
3 years ago
b.setTooltip(t("save"))
3 years ago
.setIcon("checkmark")
.onClick(() => __awaiter(this, void 0, void 0, function* () {
let error = false;
if (!nameText.getValue().length) {
3 years ago
this.setValidationError(nameText, t("invalid_name"));
3 years ago
error = true;
}
if (error) {
3 years ago
new obsidian.Notice(t("fix_errors"));
3 years ago
return;
}
this.saved = true;
this.close();
}));
return b;
});
footerButtons.addExtraButton((b) => {
b.setIcon("cross")
3 years ago
.setTooltip(t("cancel"))
3 years ago
.onClick(() => {
this.saved = false;
this.close();
});
return b;
});
});
}
onOpen() {
return __awaiter(this, void 0, void 0, function* () {
yield this.display();
});
}
}
3 years ago
3 years ago
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3 years ago
3 years ago
function createCommonjsModule(fn) {
var module = { exports: {} };
return fn(module, module.exports), module.exports;
}
3 years ago
3 years ago
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* 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
*/
3 years ago
3 years ago
var lodash_sortby = createCommonjsModule(function (module, exports) {
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
3 years ago
3 years ago
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
3 years ago
3 years ago
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
3 years ago
3 years ago
/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
PARTIAL_COMPARE_FLAG = 2;
3 years ago
3 years ago
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0,
MAX_SAFE_INTEGER = 9007199254740991;
3 years ago
3 years ago
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]';
3 years ago
3 years ago
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]';
3 years ago
3 years ago
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
3 years ago
3 years ago
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
3 years ago
3 years ago
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
3 years ago
3 years ago
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
3 years ago
3 years ago
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
3 years ago
3 years ago
/** 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;
3 years ago
3 years ago
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
3 years ago
3 years ago
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
3 years ago
3 years ago
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
3 years ago
3 years ago
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
3 years ago
3 years ago
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
3 years ago
3 years ago
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
3 years ago
3 years ago
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
3 years ago
3 years ago
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding('util');
} catch (e) {}
}());
3 years ago
3 years ago
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
3 years ago
3 years ago
/**
* 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);
3 years ago
}
3 years ago
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array ? array.length : 0,
result = Array(length);
3 years ago
3 years ago
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
3 years ago
}
3 years ago
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
3 years ago
3 years ago
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
3 years ago
3 years ago
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array ? array.length : 0;
3 years ago
3 years ago
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
3 years ago
}
}
3 years ago
return false;
}
3 years ago
3 years ago
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
3 years ago
};
}
3 years ago
/**
* The base implementation of `_.sortBy` which uses `comparer` to define the
* sort order of `array` and replaces criteria objects with their corresponding
* values.
*
* @private
* @param {Array} array The array to sort.
* @param {Function} comparer The function to define sort order.
* @returns {Array} Returns `array`.
*/
function baseSortBy(array, comparer) {
var length = array.length;
3 years ago
3 years ago
array.sort(comparer);
while (length--) {
array[length] = array[length].value;
}
return array;
}
3 years ago
3 years ago
/**
* 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);
3 years ago
3 years ago
while (++index < n) {
result[index] = iteratee(index);
3 years ago
}
3 years ago
return result;
}
3 years ago
3 years ago
/**
* 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);
3 years ago
};
}
3 years ago
/**
* 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];
3 years ago
}
3 years ago
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
3 years ago
}
3 years ago
return result;
3 years ago
}
3 years ago
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
3 years ago
3 years ago
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
3 years ago
3 years ago
/**
* 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));
};
3 years ago
}
3 years ago
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
3 years ago
});
3 years ago
return result;
3 years ago
}
3 years ago
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
3 years ago
3 years ago
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
3 years ago
3 years ago
/** 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) : '';
}());
3 years ago
3 years ago
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
3 years ago
3 years ago
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
3 years ago
3 years ago
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
3 years ago
3 years ago
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
3 years ago
3 years ago
/** Built-in value references. */
var Symbol = root.Symbol,
Uint8Array = root.Uint8Array,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice,
spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
3 years ago
3 years ago
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object),
nativeMax = Math.max;
3 years ago
3 years ago
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView'),
Map = getNative(root, 'Map'),
Promise = getNative(root, 'Promise'),
Set = getNative(root, 'Set'),
WeakMap = getNative(root, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
3 years ago
3 years ago
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
3 years ago
3 years ago
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
3 years ago
3 years ago
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
3 years ago
3 years ago
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
3 years ago
}
3 years ago
}
3 years ago
3 years ago
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
3 years ago
3 years ago
/**
* 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) {
return this.has(key) && delete this.__data__[key];
}
3 years ago
3 years ago
/**
* 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.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
3 years ago
}
3 years ago
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
3 years ago
3 years ago
/**
* 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);
3 years ago
}
3 years ago
/**
* 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.
*/
function hashSet(key, value) {
var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
3 years ago
3 years ago
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
3 years ago
3 years ago
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
3 years ago
3 years ago
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
3 years ago
}
3 years ago
}
3 years ago
3 years ago
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
3 years ago
}
3 years ago
/**
* 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`.
*/
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);
3 years ago
}
3 years ago
return true;
}
3 years ago
3 years ago
/**
* 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);
3 years ago
3 years ago
return index < 0 ? undefined : data[index][1];
}
3 years ago
3 years ago
/**
* 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`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
3 years ago
}
3 years ago
/**
* 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);
3 years ago
3 years ago
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
3 years ago
}
3 years ago
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
3 years ago
3 years ago
/**
* 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 ? entries.length : 0;
3 years ago
3 years ago
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
3 years ago
3 years ago
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
3 years ago
3 years ago
/**
* 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) {
return getMapData(this, key)['delete'](key);
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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) {
getMapData(this, key).set(key, value);
return this;
}
3 years ago
3 years ago
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
3 years ago
3 years ago
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values ? values.length : 0;
3 years ago
3 years ago
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
3 years ago
}
3 years ago
}
3 years ago
3 years ago
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
3 years ago
3 years ago
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
3 years ago
3 years ago
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
3 years ago
3 years ago
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
this.__data__ = new ListCache(entries);
}
3 years ago
3 years ago
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
}
/**
* 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`.
*/
function stackDelete(key) {
return this.__data__['delete'](key);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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.
*/
function stackSet(key, value) {
var cache = this.__data__;
if (cache instanceof ListCache) {
var pairs = cache.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
return this;
3 years ago
}
3 years ago
cache = this.__data__ = new MapCache(pairs);
3 years ago
}
3 years ago
cache.set(key, value);
return this;
}
3 years ago
3 years ago
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
3 years ago
3 years ago
/**
* 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) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
3 years ago
3 years ago
var length = result.length,
skipIndexes = !!length;
3 years ago
3 years ago
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
3 years ago
}
3 years ago
return result;
3 years ago
}
3 years ago
/**
* 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;
}
}
return -1;
3 years ago
}
3 years ago
/**
* The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
3 years ago
3 years ago
/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
3 years ago
3 years ago
predicate || (predicate = isFlattenable);
result || (result = []);
3 years ago
3 years ago
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
3 years ago
3 years ago
/**
* 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();
3 years ago
3 years ago
/**
* The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return object && baseFor(object, iteratee, keys);
}
3 years ago
3 years ago
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
3 years ago
3 years ago
var index = 0,
length = path.length;
3 years ago
3 years ago
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
3 years ago
3 years ago
/**
* The base implementation of `getTag`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
return objectToString.call(value);
}
3 years ago
3 years ago
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
3 years ago
3 years ago
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
* @param {boolean} [bitmask] The bitmask of comparison flags.
* The bitmask may be composed of the following flags:
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, bitmask, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
3 years ago
}
3 years ago
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparisons.
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
3 years ago
3 years ago
if (!objIsArr) {
objTag = getTag(object);
objTag = objTag == argsTag ? objectTag : objTag;
3 years ago
}
3 years ago
if (!othIsArr) {
othTag = getTag(other);
othTag = othTag == argsTag ? objectTag : othTag;
}
var objIsObj = objTag == objectTag && !isHostObject(object),
othIsObj = othTag == objectTag && !isHostObject(other),
isSameTag = objTag == othTag;
3 years ago
3 years ago
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
}
if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
3 years ago
3 years ago
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
3 years ago
3 years ago
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
3 years ago
}
3 years ago
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
}
3 years ago
3 years ago
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Array} matchData The property names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
3 years ago
3 years ago
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
3 years ago
3 years ago
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new Stack;
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
: result
)) {
return false;
}
}
}
return true;
}
3 years ago
3 years ago
/**
* 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;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
3 years ago
3 years ago
/**
* 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[objectToString.call(value)];
}
3 years ago
3 years ago
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == 'object') {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
}
return property(value);
}
3 years ago
3 years ago
/**
* The base implementation of `_.keys` 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 baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
3 years ago
}
}
3 years ago
return result;
}
3 years ago
3 years ago
/**
* The base implementation of `_.map` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function baseMap(collection, iteratee) {
var index = -1,
result = isArrayLike(collection) ? Array(collection.length) : [];
3 years ago
3 years ago
baseEach(collection, function(value, key, collection) {
result[++index] = iteratee(value, key, collection);
});
return result;
}
3 years ago
3 years ago
/**
* The base implementation of `_.matches` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
3 years ago
};
}
3 years ago
/**
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
3 years ago
}
3 years ago
return function(object) {
var objValue = get(object, path);
return (objValue === undefined && objValue === srcValue)
? hasIn(object, path)
: baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
};
3 years ago
}
3 years ago
/**
* The base implementation of `_.orderBy` without param guards.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
* @param {string[]} orders The sort orders of `iteratees`.
* @returns {Array} Returns the new sorted array.
*/
function baseOrderBy(collection, iteratees, orders) {
var index = -1;
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
3 years ago
3 years ago
var result = baseMap(collection, function(value, key, collection) {
var criteria = arrayMap(iteratees, function(iteratee) {
return iteratee(value);
});
return { 'criteria': criteria, 'index': ++index, 'value': value };
});
3 years ago
3 years ago
return baseSortBy(result, function(object, other) {
return compareMultiple(object, other, orders);
});
}
3 years ago
3 years ago
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
3 years ago
};
3 years ago
}
3 years ago
3 years ago
/**
* 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) {
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);
3 years ago
3 years ago
while (++index < length) {
array[index] = args[start + index];
3 years ago
}
3 years ago
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = array;
return apply(func, this, otherArgs);
3 years ago
};
}
3 years ago
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
3 years ago
}
3 years ago
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
3 years ago
3 years ago
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
}
/**
* Compares values to sort them in ascending order.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {number} Returns the sort order indicator for `value`.
*/
function compareAscending(value, other) {
if (value !== other) {
var valIsDefined = value !== undefined,
valIsNull = value === null,
valIsReflexive = value === value,
valIsSymbol = isSymbol(value);
var othIsDefined = other !== undefined,
othIsNull = other === null,
othIsReflexive = other === other,
othIsSymbol = isSymbol(other);
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
(valIsNull && othIsDefined && othIsReflexive) ||
(!valIsDefined && othIsReflexive) ||
!valIsReflexive) {
return 1;
3 years ago
}
3 years ago
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
(othIsNull && valIsDefined && valIsReflexive) ||
(!othIsDefined && valIsReflexive) ||
!othIsReflexive) {
return -1;
}
}
return 0;
3 years ago
}
3 years ago
/**
* Used by `_.orderBy` to compare multiple properties of a value to another
* and stable sort them.
*
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
* specify an order of "desc" for descending or "asc" for ascending sort order
* of corresponding values.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {boolean[]|string[]} orders The order to sort by for each property.
* @returns {number} Returns the sort order indicator for `object`.
*/
function compareMultiple(object, other, orders) {
var index = -1,
objCriteria = object.criteria,
othCriteria = other.criteria,
length = objCriteria.length,
ordersLength = orders.length;
3 years ago
3 years ago
while (++index < length) {
var result = compareAscending(objCriteria[index], othCriteria[index]);
if (result) {
if (index >= ordersLength) {
return result;
}
var order = orders[index];
return result * (order == 'desc' ? -1 : 1);
}
}
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
// that causes it, under certain circumstances, to provide the same value for
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
// for more details.
//
// This also ensures a stable sort in V8 and other engines.
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
return object.index - other.index;
3 years ago
}
3 years ago
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
if (collection == null) {
return collection;
}
if (!isArrayLike(collection)) {
return eachFunc(collection, iteratee);
3 years ago
}
3 years ago
var length = collection.length,
index = fromRight ? length : -1,
iterable = Object(collection);
3 years ago
3 years ago
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
3 years ago
};
}
3 years ago
/**
* 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;
3 years ago
3 years ago
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
3 years ago
}
3 years ago
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
arrLength = array.length,
othLength = other.length;
3 years ago
3 years ago
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
3 years ago
3 years ago
stack.set(array, other);
stack.set(other, array);
3 years ago
3 years ago
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
3 years ago
3 years ago
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!seen.has(othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
return seen.add(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, customizer, bitmask, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
3 years ago
3 years ago
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
3 years ago
3 years ago
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
3 years ago
3 years ago
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
3 years ago
3 years ago
case errorTag:
return object.name == other.name && object.message == other.message;
3 years ago
3 years ago
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
3 years ago
3 years ago
case mapTag:
var convert = mapToArray;
3 years ago
3 years ago
case setTag:
var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
convert || (convert = setToArray);
3 years ago
3 years ago
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
3 years ago
}
3 years ago
bitmask |= UNORDERED_COMPARE_FLAG;
3 years ago
3 years ago
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
3 years ago
}
3 years ago
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
3 years ago
3 years ago
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
3 years ago
}
3 years ago
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
3 years ago
3 years ago
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
3 years ago
3 years ago
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
3 years ago
3 years ago
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
3 years ago
}
3 years ago
stack['delete'](object);
stack['delete'](other);
return result;
}
3 years ago
3 years ago
/**
* 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;
3 years ago
}
3 years ago
/**
* Gets the property names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = keys(object),
length = result.length;
3 years ago
3 years ago
while (length--) {
var key = result[length],
value = object[key];
3 years ago
3 years ago
result[length] = [key, value, isStrictComparable(value)];
}
return result;
}
3 years ago
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
3 years ago
3 years ago
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge < 14, and promises in Node.js.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : undefined;
3 years ago
3 years ago
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
3 years ago
3 years ago
/**
* Checks if `path` exists on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = isKey(path, object) ? [path] : castPath(path);
3 years ago
3 years ago
var result,
index = -1,
length = path.length;
3 years ago
3 years ago
while (++index < length) {
var key = toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result) {
return result;
}
var length = object ? object.length : 0;
return !!length && isLength(length) && isIndex(key, length) &&
(isArray(object) || isArguments(object));
}
3 years ago
3 years ago
/**
* Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray(value) || isArguments(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]);
}
3 years ago
3 years ago
/**
* 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) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
3 years ago
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
return value === proto;
}
3 years ago
3 years ago
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
3 years ago
3 years ago
/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
3 years ago
}
3 years ago
return object[key] === srcValue &&
(srcValue !== undefined || (key in Object(object)));
};
}
3 years ago
3 years ago
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoize(function(string) {
string = toString(string);
3 years ago
3 years ago
var result = [];
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
3 years ago
3 years ago
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
3 years ago
3 years ago
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @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 '';
}
3 years ago
3 years ago
/**
* Creates an array of elements, sorted in ascending order by the results of
* running each element in a collection thru each iteratee. This method
* performs a stable sort, that is, it preserves the original sort order of
* equal elements. The iteratees are invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {...(Function|Function[])} [iteratees=[_.identity]]
* The iteratees to sort by.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 },
* { 'user': 'barney', 'age': 34 }
* ];
*
* _.sortBy(users, function(o) { return o.user; });
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*
* _.sortBy(users, ['user', 'age']);
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
*
* _.sortBy(users, 'user', function(o) {
* return Math.floor(o.age / 10);
* });
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
var sortBy = baseRest(function(collection, iteratees) {
if (collection == null) {
return [];
}
var length = iteratees.length;
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
iteratees = [];
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
iteratees = [iteratees[0]];
}
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
3 years ago
3 years ago
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
3 years ago
3 years ago
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result);
return result;
3 years ago
};
3 years ago
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
3 years ago
}
3 years ago
// Assign cache to `_.memoize`.
memoize.Cache = MapCache;
3 years ago
3 years ago
/**
* 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);
3 years ago
}
3 years ago
/**
* 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
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
3 years ago
}
3 years ago
/**
* 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;
/**
* 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);
3 years ago
}
3 years ago
/**
* 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);
3 years ago
}
3 years ago
/**
* 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) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
3 years ago
}
3 years ago
/**
* 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;
3 years ago
}
3 years ago
/**
* 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 && (type == 'object' || type == 'function');
3 years ago
}
3 years ago
/**
* 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 && typeof value == 'object';
3 years ago
}
3 years ago
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
3 years ago
}
3 years ago
/**
* 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 string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
3 years ago
}
3 years ago
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
3 years ago
}
3 years ago
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
3 years ago
}
3 years ago
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @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;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
3 years ago
}
3 years ago
/**
* 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;
3 years ago
}
3 years ago
/**
* Creates a function that returns the value at `path` of a given object.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
* @example
*
* var objects = [
* { 'a': { 'b': 2 } },
* { 'a': { 'b': 1 } }
* ];
*
* _.map(objects, _.property('a.b'));
* // => [2, 1]
*
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
3 years ago
}
3 years ago
module.exports = sortBy;
});
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* 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
*/
var lodash_groupby = createCommonjsModule(function (module, exports) {
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
PARTIAL_COMPARE_FLAG = 2;
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0,
MAX_SAFE_INTEGER = 9007199254740991;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
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]';
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/** 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;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding('util');
} catch (e) {}
}());
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/**
* A specialized version of `baseAggregator` for arrays.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
3 years ago
}
3 years ago
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
3 years ago
}
3 years ago
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
/**
* 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);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/**
* 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);
};
}
/**
* 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];
}
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
3 years ago
}
3 years ago
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
/**
* 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));
};
}
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** 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) : '';
}());
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Symbol = root.Symbol,
Uint8Array = root.Uint8Array,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView'),
Map = getNative(root, 'Map'),
Promise = getNative(root, 'Promise'),
Set = getNative(root, 'Set'),
WeakMap = getNative(root, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
/**
* 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) {
return this.has(key) && delete this.__data__[key];
}
/**
* 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.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
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);
}
/**
* 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.
*/
function hashSet(key, value) {
var data = this.__data__;
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;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
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__ = [];
}
/**
* 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`.
*/
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);
}
return true;
}
/**
* 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);
return index < 0 ? undefined : data[index][1];
}
/**
* 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`.
*/
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);
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/**
* 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 ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
/**
* 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) {
return getMapData(this, key)['delete'](key);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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) {
getMapData(this, key).set(key, value);
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values ? values.length : 0;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
this.__data__ = new ListCache(entries);
}
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
}
/**
* 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`.
*/
function stackDelete(key) {
return this.__data__['delete'](key);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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.
*/
function stackSet(key, value) {
var cache = this.__data__;
if (cache instanceof ListCache) {
var pairs = cache.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
return this;
}
cache = this.__data__ = new MapCache(pairs);
}
cache.set(key, value);
return this;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/**
* 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) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
var length = result.length,
skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
/**
* 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;
}
}
return -1;
}
/**
* Aggregates elements of `collection` on `accumulator` with keys transformed
* by `iteratee` and values set by `setter`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function baseAggregator(collection, setter, iteratee, accumulator) {
baseEach(collection, function(value, key, collection) {
setter(accumulator, value, iteratee(value), collection);
});
return accumulator;
}
/**
* The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
/**
* 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();
/**
* The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return object && baseFor(object, iteratee, keys);
}
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
/**
* The base implementation of `getTag`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
return objectToString.call(value);
}
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
* @param {boolean} [bitmask] The bitmask of comparison flags.
* The bitmask may be composed of the following flags:
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, bitmask, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
}
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparisons.
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
if (!objIsArr) {
objTag = getTag(object);
objTag = objTag == argsTag ? objectTag : objTag;
}
if (!othIsArr) {
othTag = getTag(other);
othTag = othTag == argsTag ? objectTag : othTag;
}
var objIsObj = objTag == objectTag && !isHostObject(object),
othIsObj = othTag == objectTag && !isHostObject(other),
isSameTag = objTag == othTag;
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
}
if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
}
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Array} matchData The property names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new Stack;
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
: result
)) {
return false;
}
}
}
return true;
}
/**
* 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;
}
var pattern = (isFunction(value) || isHostObject(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[objectToString.call(value)];
}
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == 'object') {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
}
return property(value);
}
/**
* The base implementation of `_.keys` 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 baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/**
* The base implementation of `_.matches` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
};
}
/**
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get(object, path);
return (objValue === undefined && objValue === srcValue)
? hasIn(object, path)
: baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
};
}
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
};
}
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
}
/**
* Creates a function like `_.groupBy`.
*
* @private
* @param {Function} setter The function to set accumulator values.
* @param {Function} [initializer] The accumulator object initializer.
* @returns {Function} Returns the new aggregator function.
*/
function createAggregator(setter, initializer) {
return function(collection, iteratee) {
var func = isArray(collection) ? arrayAggregator : baseAggregator,
accumulator = initializer ? initializer() : {};
return func(collection, setter, baseIteratee(iteratee), accumulator);
};
}
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
if (collection == null) {
return collection;
}
if (!isArrayLike(collection)) {
return eachFunc(collection, iteratee);
}
var length = collection.length,
index = fromRight ? length : -1,
iterable = Object(collection);
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
/**
* 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;
}
}
return object;
};
}
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!seen.has(othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
return seen.add(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, customizer, bitmask, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= UNORDERED_COMPARE_FLAG;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
/**
* 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 property names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = keys(object),
length = result.length;
while (length--) {
var key = result[length],
value = object[key];
result[length] = [key, value, isStrictComparable(value)];
}
return result;
}
/**
* 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;
}
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge < 14, and promises in Node.js.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : undefined;
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
/**
* Checks if `path` exists on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = isKey(path, object) ? [path] : castPath(path);
var result,
index = -1,
length = path.length;
while (++index < length) {
var key = toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result) {
return result;
}
var length = object ? object.length : 0;
return !!length && isLength(length) && isIndex(key, length) &&
(isArray(object) || isArguments(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) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
/**
* 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);
}
/**
* 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`.
*/
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;
return value === proto;
}
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue &&
(srcValue !== undefined || (key in Object(object)));
};
}
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoize(function(string) {
string = toString(string);
var result = [];
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @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 '';
}
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The order of grouped values
* is determined by the order they occur in `collection`. The corresponding
* value of each key is an array of elements responsible for generating the
* key. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* _.groupBy([6.1, 4.2, 6.3], Math.floor);
* // => { '4': [4.2], '6': [6.1, 6.3] }
*
* // The `_.property` iteratee shorthand.
* _.groupBy(['one', 'two', 'three'], 'length');
* // => { '3': ['one', 'two'], '5': ['three'] }
*/
var groupBy = createAggregator(function(result, value, key) {
if (hasOwnProperty.call(result, key)) {
result[key].push(value);
} else {
result[key] = [value];
}
});
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result);
return result;
};
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
// Assign cache to `_.memoize`.
memoize.Cache = MapCache;
/**
* 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
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
/**
* 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;
/**
* 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 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) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* 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;
}
/**
* 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 && (type == 'object' || type == 'function');
}
/**
* 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 && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
/**
* 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 string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @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;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
/**
* 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;
}
/**
* Creates a function that returns the value at `path` of a given object.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
* @example
*
* var objects = [
* { 'a': { 'b': 2 } },
* { 'a': { 'b': 1 } }
* ];
*
* _.map(objects, _.property('a.b'));
* // => [2, 1]
*
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
module.exports = groupBy;
});
3 years ago
/*
TypeScript Md5
==============
Based on work by
* Joseph Myers: http://www.myersdaily.org/joseph/javascript/md5-text.html
* André Cruz: https://github.com/satazor/SparkMD5
* Raymond Hill: https://github.com/gorhill/yamd5.js
Effectively a TypeScrypt re-write of Raymond Hill JS Library
The MIT License (MIT)
Copyright (C) 2014 Raymond Hill
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.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2015 André Cruz <amdfcruz@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
*/
var Md5 = /** @class */ (function () {
function Md5() {
this._state = new Int32Array(4);
this._buffer = new ArrayBuffer(68);
this._buffer8 = new Uint8Array(this._buffer, 0, 68);
this._buffer32 = new Uint32Array(this._buffer, 0, 17);
this.start();
}
Md5.hashStr = function (str, raw) {
if (raw === void 0) { raw = false; }
return this.onePassHasher
.start()
.appendStr(str)
.end(raw);
};
Md5.hashAsciiStr = function (str, raw) {
if (raw === void 0) { raw = false; }
return this.onePassHasher
.start()
.appendAsciiStr(str)
.end(raw);
};
Md5._hex = function (x) {
var hc = Md5.hexChars;
var ho = Md5.hexOut;
var n;
var offset;
var j;
var i;
for (i = 0; i < 4; i += 1) {
offset = i * 8;
n = x[i];
for (j = 0; j < 8; j += 2) {
ho[offset + 1 + j] = hc.charAt(n & 0x0F);
n >>>= 4;
ho[offset + 0 + j] = hc.charAt(n & 0x0F);
n >>>= 4;
}
}
return ho.join('');
};
Md5._md5cycle = function (x, k) {
var a = x[0];
var b = x[1];
var c = x[2];
var d = x[3];
// ff()
a += (b & c | ~b & d) + k[0] - 680876936 | 0;
a = (a << 7 | a >>> 25) + b | 0;
d += (a & b | ~a & c) + k[1] - 389564586 | 0;
d = (d << 12 | d >>> 20) + a | 0;
c += (d & a | ~d & b) + k[2] + 606105819 | 0;
c = (c << 17 | c >>> 15) + d | 0;
b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
b = (b << 22 | b >>> 10) + c | 0;
a += (b & c | ~b & d) + k[4] - 176418897 | 0;
a = (a << 7 | a >>> 25) + b | 0;
d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
d = (d << 12 | d >>> 20) + a | 0;
c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
c = (c << 17 | c >>> 15) + d | 0;
b += (c & d | ~c & a) + k[7] - 45705983 | 0;
b = (b << 22 | b >>> 10) + c | 0;
a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
a = (a << 7 | a >>> 25) + b | 0;
d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
d = (d << 12 | d >>> 20) + a | 0;
c += (d & a | ~d & b) + k[10] - 42063 | 0;
c = (c << 17 | c >>> 15) + d | 0;
b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
b = (b << 22 | b >>> 10) + c | 0;
a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
a = (a << 7 | a >>> 25) + b | 0;
d += (a & b | ~a & c) + k[13] - 40341101 | 0;
d = (d << 12 | d >>> 20) + a | 0;
c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
c = (c << 17 | c >>> 15) + d | 0;
b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
b = (b << 22 | b >>> 10) + c | 0;
// gg()
a += (b & d | c & ~d) + k[1] - 165796510 | 0;
a = (a << 5 | a >>> 27) + b | 0;
d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
d = (d << 9 | d >>> 23) + a | 0;
c += (d & b | a & ~b) + k[11] + 643717713 | 0;
c = (c << 14 | c >>> 18) + d | 0;
b += (c & a | d & ~a) + k[0] - 373897302 | 0;
b = (b << 20 | b >>> 12) + c | 0;
a += (b & d | c & ~d) + k[5] - 701558691 | 0;
a = (a << 5 | a >>> 27) + b | 0;
d += (a & c | b & ~c) + k[10] + 38016083 | 0;
d = (d << 9 | d >>> 23) + a | 0;
c += (d & b | a & ~b) + k[15] - 660478335 | 0;
c = (c << 14 | c >>> 18) + d | 0;
b += (c & a | d & ~a) + k[4] - 405537848 | 0;
b = (b << 20 | b >>> 12) + c | 0;
a += (b & d | c & ~d) + k[9] + 568446438 | 0;
a = (a << 5 | a >>> 27) + b | 0;
d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
d = (d << 9 | d >>> 23) + a | 0;
c += (d & b | a & ~b) + k[3] - 187363961 | 0;
c = (c << 14 | c >>> 18) + d | 0;
b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
b = (b << 20 | b >>> 12) + c | 0;
a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
a = (a << 5 | a >>> 27) + b | 0;
d += (a & c | b & ~c) + k[2] - 51403784 | 0;
d = (d << 9 | d >>> 23) + a | 0;
c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
c = (c << 14 | c >>> 18) + d | 0;
b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
b = (b << 20 | b >>> 12) + c | 0;
// hh()
a += (b ^ c ^ d) + k[5] - 378558 | 0;
a = (a << 4 | a >>> 28) + b | 0;
d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
d = (d << 11 | d >>> 21) + a | 0;
c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
c = (c << 16 | c >>> 16) + d | 0;
b += (c ^ d ^ a) + k[14] - 35309556 | 0;
b = (b << 23 | b >>> 9) + c | 0;
a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
a = (a << 4 | a >>> 28) + b | 0;
d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
d = (d << 11 | d >>> 21) + a | 0;
c += (d ^ a ^ b) + k[7] - 155497632 | 0;
c = (c << 16 | c >>> 16) + d | 0;
b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
b = (b << 23 | b >>> 9) + c | 0;
a += (b ^ c ^ d) + k[13] + 681279174 | 0;
a = (a << 4 | a >>> 28) + b | 0;
d += (a ^ b ^ c) + k[0] - 358537222 | 0;
d = (d << 11 | d >>> 21) + a | 0;
c += (d ^ a ^ b) + k[3] - 722521979 | 0;
c = (c << 16 | c >>> 16) + d | 0;
b += (c ^ d ^ a) + k[6] + 76029189 | 0;
b = (b << 23 | b >>> 9) + c | 0;
a += (b ^ c ^ d) + k[9] - 640364487 | 0;
a = (a << 4 | a >>> 28) + b | 0;
d += (a ^ b ^ c) + k[12] - 421815835 | 0;
d = (d << 11 | d >>> 21) + a | 0;
c += (d ^ a ^ b) + k[15] + 530742520 | 0;
c = (c << 16 | c >>> 16) + d | 0;
b += (c ^ d ^ a) + k[2] - 995338651 | 0;
b = (b << 23 | b >>> 9) + c | 0;
// ii()
a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
a = (a << 6 | a >>> 26) + b | 0;
d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
d = (d << 10 | d >>> 22) + a | 0;
c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
c = (c << 15 | c >>> 17) + d | 0;
b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
b = (b << 21 | b >>> 11) + c | 0;
a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
a = (a << 6 | a >>> 26) + b | 0;
d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
d = (d << 10 | d >>> 22) + a | 0;
c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
c = (c << 15 | c >>> 17) + d | 0;
b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
b = (b << 21 | b >>> 11) + c | 0;
a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
a = (a << 6 | a >>> 26) + b | 0;
d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
d = (d << 10 | d >>> 22) + a | 0;
c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
c = (c << 15 | c >>> 17) + d | 0;
b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
b = (b << 21 | b >>> 11) + c | 0;
a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
a = (a << 6 | a >>> 26) + b | 0;
d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
d = (d << 10 | d >>> 22) + a | 0;
c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
c = (c << 15 | c >>> 17) + d | 0;
b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
b = (b << 21 | b >>> 11) + c | 0;
x[0] = a + x[0] | 0;
x[1] = b + x[1] | 0;
x[2] = c + x[2] | 0;
x[3] = d + x[3] | 0;
};
Md5.prototype.start = function () {
this._dataLength = 0;
this._bufferLength = 0;
this._state.set(Md5.stateIdentity);
return this;
};
// Char to code point to to array conversion:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
// #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown
Md5.prototype.appendStr = function (str) {
var buf8 = this._buffer8;
var buf32 = this._buffer32;
var bufLen = this._bufferLength;
var code;
var i;
for (i = 0; i < str.length; i += 1) {
code = str.charCodeAt(i);
if (code < 128) {
buf8[bufLen++] = code;
}
else if (code < 0x800) {
buf8[bufLen++] = (code >>> 6) + 0xC0;
buf8[bufLen++] = code & 0x3F | 0x80;
}
else if (code < 0xD800 || code > 0xDBFF) {
buf8[bufLen++] = (code >>> 12) + 0xE0;
buf8[bufLen++] = (code >>> 6 & 0x3F) | 0x80;
buf8[bufLen++] = (code & 0x3F) | 0x80;
}
else {
code = ((code - 0xD800) * 0x400) + (str.charCodeAt(++i) - 0xDC00) + 0x10000;
if (code > 0x10FFFF) {
throw new Error('Unicode standard supports code points up to U+10FFFF');
}
buf8[bufLen++] = (code >>> 18) + 0xF0;
buf8[bufLen++] = (code >>> 12 & 0x3F) | 0x80;
buf8[bufLen++] = (code >>> 6 & 0x3F) | 0x80;
buf8[bufLen++] = (code & 0x3F) | 0x80;
}
if (bufLen >= 64) {
this._dataLength += 64;
Md5._md5cycle(this._state, buf32);
bufLen -= 64;
buf32[0] = buf32[16];
}
}
this._bufferLength = bufLen;
return this;
};
Md5.prototype.appendAsciiStr = function (str) {
var buf8 = this._buffer8;
var buf32 = this._buffer32;
var bufLen = this._bufferLength;
var i;
var j = 0;
for (;;) {
i = Math.min(str.length - j, 64 - bufLen);
while (i--) {
buf8[bufLen++] = str.charCodeAt(j++);
}
if (bufLen < 64) {
break;
}
this._dataLength += 64;
Md5._md5cycle(this._state, buf32);
bufLen = 0;
}
this._bufferLength = bufLen;
return this;
};
Md5.prototype.appendByteArray = function (input) {
var buf8 = this._buffer8;
var buf32 = this._buffer32;
var bufLen = this._bufferLength;
var i;
var j = 0;
for (;;) {
i = Math.min(input.length - j, 64 - bufLen);
while (i--) {
buf8[bufLen++] = input[j++];
}
if (bufLen < 64) {
break;
}
this._dataLength += 64;
Md5._md5cycle(this._state, buf32);
bufLen = 0;
}
this._bufferLength = bufLen;
return this;
};
Md5.prototype.getState = function () {
var self = this;
var s = self._state;
return {
buffer: String.fromCharCode.apply(null, self._buffer8),
buflen: self._bufferLength,
length: self._dataLength,
state: [s[0], s[1], s[2], s[3]]
};
};
Md5.prototype.setState = function (state) {
var buf = state.buffer;
var x = state.state;
var s = this._state;
var i;
this._dataLength = state.length;
this._bufferLength = state.buflen;
s[0] = x[0];
s[1] = x[1];
s[2] = x[2];
s[3] = x[3];
for (i = 0; i < buf.length; i += 1) {
this._buffer8[i] = buf.charCodeAt(i);
}
};
Md5.prototype.end = function (raw) {
if (raw === void 0) { raw = false; }
var bufLen = this._bufferLength;
var buf8 = this._buffer8;
var buf32 = this._buffer32;
var i = (bufLen >> 2) + 1;
var dataBitsLen;
this._dataLength += bufLen;
buf8[bufLen] = 0x80;
buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0;
buf32.set(Md5.buffer32Identity.subarray(i), i);
if (bufLen > 55) {
Md5._md5cycle(this._state, buf32);
buf32.set(Md5.buffer32Identity);
}
// Do the final computation based on the tail and length
// Beware that the final length may not fit in 32 bits so we take care of that
dataBitsLen = this._dataLength * 8;
if (dataBitsLen <= 0xFFFFFFFF) {
buf32[14] = dataBitsLen;
}
else {
var matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/);
if (matches === null) {
return;
}
var lo = parseInt(matches[2], 16);
var hi = parseInt(matches[1], 16) || 0;
buf32[14] = lo;
buf32[15] = hi;
}
Md5._md5cycle(this._state, buf32);
return raw ? this._state : Md5._hex(this._state);
};
// Private Static Variables
Md5.stateIdentity = new Int32Array([1732584193, -271733879, -1732584194, 271733878]);
Md5.buffer32Identity = new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
Md5.hexChars = '0123456789abcdef';
Md5.hexOut = [];
// Permanent instance is to use for one-call hashing
Md5.onePassHasher = new Md5();
return Md5;
}());
var Md5_1 = Md5;
if (Md5.hashStr('hello') !== '5d41402abc4b2a76b9719d911017c592') {
console.error('Md5 self test failed.');
}
3 years ago
/**
* : to get namespaced element
* . to get nested element
* @param element
* @param name
*/
function getElementByName(element, name) {
let value;
if (typeof element.getElementsByTagName !== 'function') {
return;
}
if (name.contains(":")) {
const [namespace, tag] = name.split(":");
const namespaceUri = element.lookupNamespaceURI(namespace);
if (element.getElementsByTagNameNS(namespaceUri, tag).length > 0) {
value = element.getElementsByTagNameNS(namespaceUri, tag)[0].childNodes[0];
}
}
else if (name.contains(".")) {
const [prefix, tag] = name.split(".");
if (element.getElementsByTagName(prefix).length > 0) {
const nodes = Array.from(element.getElementsByTagName(prefix)[0].childNodes);
nodes.forEach((node) => {
if (node.nodeName == tag) {
value = node;
}
});
}
}
else {
if (element.getElementsByTagName(name).length > 0) {
if (element.getElementsByTagName(name)[0].childNodes.length == 0) {
value = element.getElementsByTagName(name)[0];
}
else {
const node = element.getElementsByTagName(name)[0].childNodes[0];
if (node !== undefined)
value = node;
}
}
}
return value;
}
/**
* # to get attribute
* @param element
* @param names possible names
*/
function getContent(element, names) {
let value;
names.forEach((name) => {
if (name.contains("#")) {
const [elementName, attr] = name.split("#");
const data = getElementByName(element, elementName);
if (data) {
if (data.nodeName == elementName) {
//@ts-ignore
value = data.getAttr(attr);
}
}
}
const data = getElementByName(element, name);
if (data) {
//@ts-ignore
if (data.nodeValue) {
value = data.nodeValue;
}
//@ts-ignore
if (data.innerHTML) {
//@ts-ignore
value = data.innerHTML;
}
}
});
if (value === undefined) {
return "";
}
return value;
}
function buildItem(element) {
return {
title: getContent(element, ["title"]),
description: getContent(element, ["description"]),
3 years ago
content: getContent(element, ["itunes:summary", "description", "content", "content:encoded", "summary"]),
3 years ago
category: getContent(element, ["category"]),
link: getContent(element, ["link", "link#href"]),
creator: getContent(element, ["creator", "dc:creator", "author", "author.name"]),
pubDate: getContent(element, ["pubDate", "published", "updated", "dc:date"]),
3 years ago
enclosure: getContent(element, ["enclosure#url"]),
enclosureType: getContent(element, ["enclosure#type"]),
image: getContent(element, ["itunes:image#href"]),
language: null,
3 years ago
folder: null,
feed: null,
read: null,
favorite: null,
created: null,
tags: [],
3 years ago
hash: null,
3 years ago
};
}
function getAllItems(doc) {
const items = [];
if (doc.getElementsByTagName("item")) {
for (const elementsByTagNameKey in doc.getElementsByTagName("item")) {
const entry = doc.getElementsByTagName("item")[elementsByTagNameKey];
items.push(entry);
}
}
if (doc.getElementsByTagName("entry")) {
for (const elementsByTagNameKey in doc.getElementsByTagName("entry")) {
const entry = doc.getElementsByTagName("entry")[elementsByTagNameKey];
items.push(entry);
}
}
return items;
}
function getFeedItems(feed) {
return __awaiter(this, void 0, void 0, function* () {
const rawData = yield obsidian.request({ url: feed.url });
const data = new window.DOMParser().parseFromString(rawData, "text/xml");
const items = [];
const rawItems = getAllItems(data);
3 years ago
const language = getContent(data, ["language"]).substr(0, 2);
3 years ago
rawItems.forEach((rawItem) => {
const item = buildItem(rawItem);
if (item.title !== undefined && item.title.length !== 0) {
item.folder = feed.folder;
item.feed = feed.name;
item.read = false;
item.favorite = false;
item.created = false;
3 years ago
item.language = language;
item.hash = new Md5_1().appendStr(item.title).appendStr(item.folder).appendStr(item.link).end();
3 years ago
items.push(item);
}
});
const image = getContent(data, ["image", "image.url", "icon"]);
const content = {
title: getContent(data, ["title"]),
subtitle: getContent(data, ["subtitle"]),
link: getContent(data, ["link"]),
//we don't want any leading or trailing slashes in image urls(i.e. reddit does that)
image: image ? image.replace(/^\/|\/$/g, '') : null,
description: getContent(data, ["description"]),
items: items,
folder: feed.folder,
3 years ago
name: feed.name,
language: language,
3 years ago
};
return Promise.resolve(content);
});
}
const VIEW_ID = "RSS_FEED";
const FILE_NAME_REGEX = /["\/<>:|?]/gm;
const TAG_REGEX = /([\p{Letter}\p{Emoji_Presentation}\p{Number}\/_-]+)/u;
const NUMBER_REGEX = /^[0-9]*$/gm;
//TODO: remove once api definition has been updated
/**
* taken from @licat(https://discord.com/channels/686053708261228577/840286264964022302/899037833552093184)
* @param html
*/
function sanitizeHTMLToDom(html) {
// @ts-ignore
return window.DOMPurify.sanitize(html, {
ALLOW_UNKNOWN_PROTOCOLS: true,
RETURN_DOM_FRAGMENT: true,
RETURN_DOM_IMPORT: true,
FORBID_TAGS: ['style'],
ADD_TAGS: ['iframe'],
ADD_ATTR: ['frameborder', 'allowfullscreen', 'allow', 'aria-label-position'],
});
}
//taken from: https://stackoverflow.com/a/43467144/5589264
function isValidHttpUrl(string) {
let url;
try {
url = new URL(string);
}
catch (_) {
return false;
}
return url.protocol === "http:" || url.protocol === "https:";
}
class FeedModal extends BaseModal {
constructor(plugin, feed) {
super(plugin.app);
this.saved = false;
if (feed) {
this.name = feed.name;
this.url = feed.url;
this.folder = feed.folder;
}
}
display() {
return __awaiter(this, void 0, void 0, function* () {
const { contentEl } = this;
contentEl.empty();
let nameText;
const name = new obsidian.Setting(contentEl)
3 years ago
.setName(t("name"))
.setDesc(t("name_help"))
3 years ago
.addText((text) => {
nameText = text;
text.setValue(this.name)
.onChange((value) => {
this.removeValidationError(text);
this.name = value;
});
});
name.controlEl.addClass("rss-setting-input");
let urlText;
const url = new obsidian.Setting(contentEl)
3 years ago
.setName("URL")
.setDesc(t("url_help"))
3 years ago
.addText((text) => {
urlText = text;
text.setValue(this.url)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.removeValidationError(text);
this.url = value;
}));
});
url.controlEl.addClass("rss-setting-input");
new obsidian.Setting(contentEl)
3 years ago
.setName(t("folder"))
.setDesc(t("folder_help"))
3 years ago
.addText((text) => {
text.setValue(this.folder)
.onChange((value) => {
this.folder = value;
});
});
const footerEl = contentEl.createDiv();
const footerButtons = new obsidian.Setting(footerEl);
footerButtons.addButton((b) => {
3 years ago
b.setTooltip(t("save"))
3 years ago
.setIcon("checkmark")
.onClick(() => __awaiter(this, void 0, void 0, function* () {
let error = false;
if (!nameText.getValue().length) {
3 years ago
this.setValidationError(nameText, t("invalid_name"));
3 years ago
error = true;
}
if (!urlText.getValue().length) {
3 years ago
this.setValidationError(urlText, t("invalid_url"));
3 years ago
error = true;
}
if (!isValidHttpUrl(urlText.getValue())) {
3 years ago
this.setValidationError(urlText, t("invalid_url"));
3 years ago
error = true;
}
else {
const items = yield getFeedItems({ name: "test", url: urlText.getValue(), folder: "" });
if (items.items.length == 0) {
3 years ago
this.setValidationError(urlText, t("invalid_feed"));
3 years ago
error = true;
}
}
if (error) {
3 years ago
new obsidian.Notice(t("fix_errors"));
3 years ago
return;
}
this.saved = true;
this.close();
}));
return b;
});
footerButtons.addExtraButton((b) => {
b.setIcon("cross")
3 years ago
.setTooltip(t("cancel"))
3 years ago
.onClick(() => {
this.saved = false;
this.close();
});
return b;
});
});
}
onOpen() {
return __awaiter(this, void 0, void 0, function* () {
yield this.display();
});
}
}
function displayFeedSettings(plugin, container) {
container.empty();
3 years ago
container.createEl("h3", { text: t("feeds") });
3 years ago
new obsidian.Setting(container)
3 years ago
.setName(t("add_new"))
.setDesc(t("add_new_feed"))
3 years ago
.addButton((button) => {
return button
3 years ago
.setTooltip(t("add_new_feed"))
3 years ago
.setIcon("create-new")
.onClick(() => __awaiter(this, void 0, void 0, function* () {
const modal = new FeedModal(plugin);
modal.onClose = () => __awaiter(this, void 0, void 0, function* () {
if (modal.saved) {
if (plugin.settings.feeds.some(item => item.url === modal.url)) {
3 years ago
new obsidian.Notice(t("feed_already_configured"));
3 years ago
return;
}
yield plugin.writeFeeds(() => (plugin.settings.feeds.concat({
name: modal.name,
url: modal.url,
folder: modal.folder
})));
displayFeedSettings(plugin, container);
}
});
modal.open();
}));
});
const feedsDiv = container.createDiv("feeds");
const sorted = lodash_sortby(lodash_groupby(plugin.settings.feeds, "folder"), function (o) {
return o[0].folder;
});
for (const [, feeds] of Object.entries(sorted)) {
for (const id in feeds) {
const feed = feeds[id];
const setting = new obsidian.Setting(feedsDiv);
3 years ago
setting.setName((feed.folder ? feed.folder : t("no_folder")) + " - " + feed.name);
3 years ago
setting.setDesc(feed.url);
setting
.addExtraButton((b) => {
b.setIcon("pencil")
3 years ago
.setTooltip(t("edit"))
3 years ago
.onClick(() => {
const modal = new FeedModal(plugin, feed);
const oldFeed = feed;
modal.onClose = () => __awaiter(this, void 0, void 0, function* () {
if (modal.saved) {
const feeds = plugin.settings.feeds;
feeds.remove(oldFeed);
feeds.push({ name: modal.name, url: modal.url, folder: modal.folder });
yield plugin.writeFeeds(() => (feeds));
displayFeedSettings(plugin, container);
}
});
modal.open();
});
})
.addExtraButton((b) => {
3 years ago
b
.setIcon("trash")
3 years ago
.setTooltip(t("delete"))
3 years ago
.onClick(() => __awaiter(this, void 0, void 0, function* () {
const feeds = plugin.settings.feeds;
feeds.remove(feed);
3 years ago
yield plugin.writeFeeds(() => feeds);
//delete all items from feed
let content = plugin.settings.items;
content = content.filter((content) => {
return content.name !== feed.name;
});
yield plugin.writeFeedContent(() => content);
3 years ago
displayFeedSettings(plugin, container);
}));
});
}
}
}
const DEFAULT_SETTINGS = Object.freeze({
feeds: [],
updateTime: 60,
filtered: [{
name: "Favorites",
filterType: "FAVORITES",
filterContent: "",
sortOrder: "ALPHABET_NORMAL"
}],
saveLocation: 'default',
saveLocationFolder: '',
items: [],
dateFormat: "YYYY-MM-DDTHH:MM:SS",
template: "---\n" +
"link: {{link}}\n" +
"author: {{author}}\n" +
"published: {{published}}\n" +
"tags: [{{tags:,}}]\n" +
"---\n" +
"{{title}}\n" +
"{{content}}",
pasteTemplate: "## {{title}}\n" +
"{{content}}",
askForFilename: true,
autoSync: false,
hotkeys: {
create: "n",
paste: "v",
copy: "c",
favorite: "f",
read: "r",
tags: "t",
open: "o",
3 years ago
tts: "s"
},
folded: []
3 years ago
});
class RSSReaderSettingsTab extends obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
const { containerEl } = this;
containerEl.empty();
3 years ago
containerEl.createEl('h2', { text: t("RSS_Reader") + " " + t("settings") });
containerEl.createEl('h3', { text: t("file_creation") });
3 years ago
new obsidian.Setting(containerEl)
3 years ago
.setName(t("template_new"))
.setDesc(t("template_new_help") + ' ' +
t("available_variables") + ' {{title}}, {{link}}, {{author}}, {{published}}, {{created}}, {{content}}, {{description}}, {{folder}}, {{feed}}, {{filename}, {{tags}}, {{#tags}}')
3 years ago
.addTextArea((textArea) => {
textArea
.setValue(this.plugin.settings.template)
.setPlaceholder(DEFAULT_SETTINGS.template)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
template: value
}));
}));
textArea.inputEl.setAttr("rows", 8);
});
new obsidian.Setting(containerEl)
3 years ago
.setName(t("template_paste"))
.setDesc(t("template_paste_help") + ' ' +
t("available_variables") + '{{title}}, {{link}}, {{author}}, {{published}}, {{content}}, {{description}}, {{folder}}, {{feed}}, {{tags}}, {{#tags}}')
3 years ago
.addTextArea((textArea) => {
textArea
.setValue(this.plugin.settings.pasteTemplate)
.setPlaceholder(DEFAULT_SETTINGS.pasteTemplate)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
pasteTemplate: value
}));
}));
textArea.inputEl.setAttr("rows", 8);
});
new obsidian.Setting(containerEl)
3 years ago
.setName(t("file_location"))
.setDesc(t("file_location_help"))
3 years ago
.addDropdown((dropdown) => __awaiter(this, void 0, void 0, function* () {
dropdown
3 years ago
.addOption("default", t("file_location_default"))
.addOption("custom", t("file_location_custom"))
3 years ago
.setValue(this.plugin.settings.saveLocation)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({ saveLocation: value }));
this.display();
}));
}));
if (this.plugin.settings.saveLocation == "custom") {
new obsidian.Setting(containerEl)
3 years ago
.setName(t("file_location_folder"))
.setDesc(t("file_location_folder_help"))
3 years ago
.addSearch((search) => __awaiter(this, void 0, void 0, function* () {
new FolderSuggest(this.app, search.inputEl);
search
.setValue(this.plugin.settings.saveLocationFolder)
.setPlaceholder(DEFAULT_SETTINGS.saveLocationFolder)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({ saveLocationFolder: value }));
}));
}));
}
let dateFormatSampleEl;
const dateFormat = new obsidian.Setting(containerEl)
3 years ago
.setName(t("date_format"))
3 years ago
.addMomentFormat((format) => {
dateFormatSampleEl = format
.setDefaultFormat(DEFAULT_SETTINGS.dateFormat)
.setPlaceholder(DEFAULT_SETTINGS.dateFormat)
.setValue(this.plugin.settings.dateFormat)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({ dateFormat: value }));
}));
});
const referenceLink = dateFormat.descEl.createEl("a");
referenceLink.setAttr("href", "https://momentjs.com/docs/#/displaying/format/");
3 years ago
referenceLink.setText(t("syntax_reference"));
3 years ago
const text = dateFormat.descEl.createDiv("text");
3 years ago
text.setText(t("syntax_looks"));
3 years ago
const sampleEl = text.createSpan("sample");
dateFormatSampleEl.setSampleEl(sampleEl);
dateFormat.addExtraButton((button) => {
button
.setIcon('reset')
3 years ago
.setTooltip(t("reset"))
3 years ago
.onClick(() => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
dateFormat: DEFAULT_SETTINGS.dateFormat
}));
this.display();
}));
});
3 years ago
new obsidian.Setting(containerEl)
.setName(t("ask_filename"))
.setDesc(t("ask_filename_help"))
.addToggle((toggle) => {
return toggle
.setValue(this.plugin.settings.askForFilename)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
askForFilename: value
}));
}));
});
3 years ago
containerEl.createEl("h3", { text: "Misc" });
const refresh = new obsidian.Setting(containerEl)
3 years ago
.setName(t("refresh_time"))
.setDesc(t("refresh_time_help"))
3 years ago
.addText((text) => {
text
.setPlaceholder(String(DEFAULT_SETTINGS.updateTime))
.setValue(String(this.plugin.settings.updateTime))
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
if (value.length === 0) {
3 years ago
new obsidian.Notice(t("specify_positive_number"));
3 years ago
return;
}
if (Number(value) < 0) {
3 years ago
new obsidian.Notice(t("specify_positive_number"));
3 years ago
return;
}
yield this.plugin.writeSettings(() => ({ updateTime: Number(value) }));
}));
text.inputEl.setAttr("type", "number");
text.inputEl.setAttr("min", "1");
//we don't want decimal numbers.
text.inputEl.setAttr("onkeypress", "return event.charCode >= 48 && event.charCode <= 57");
});
refresh.addExtraButton((button) => {
button
.setIcon('reset')
.setTooltip('restore default')
.onClick(() => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
updateTime: DEFAULT_SETTINGS.updateTime
}));
this.display();
}));
});
new obsidian.Setting(containerEl)
3 years ago
.setName(t("multi_device_usage"))
.setDesc(t("multi_device_usage_help"))
3 years ago
.addToggle((toggle) => {
return toggle
.setValue(this.plugin.settings.autoSync)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
autoSync: value
}));
}));
});
3 years ago
containerEl.createEl("h3", { text: t("filtered_folders") });
3 years ago
new obsidian.Setting(containerEl)
3 years ago
.setName(t("add_new"))
.setDesc(t("add_new_filter"))
3 years ago
.addButton((button) => {
return button
3 years ago
.setTooltip(t("add_new_filter"))
3 years ago
.setIcon("create-new")
.onClick(() => __awaiter(this, void 0, void 0, function* () {
const modal = new FilteredFolderModal(this.plugin);
modal.onClose = () => __awaiter(this, void 0, void 0, function* () {
if (modal.saved) {
if (this.plugin.settings.filtered.some(folder => folder.name === modal.name)) {
3 years ago
new obsidian.Notice(t("filter_exists"));
3 years ago
return;
}
yield this.plugin.writeFiltered(() => (this.plugin.settings.filtered.concat({
name: modal.name,
filterType: modal.filterType,
filterContent: modal.filterContent,
sortOrder: modal.sortOrder
})));
this.display();
}
});
modal.open();
}));
});
const filterContainer = containerEl.createDiv("filter-container");
const filtersDiv = filterContainer.createDiv("filters");
for (const id in this.plugin.settings.filtered.sort((a, b) => a.name.localeCompare(b.name))) {
const filter = this.plugin.settings.filtered[id];
const setting = new obsidian.Setting(filtersDiv);
setting.setName(filter.name);
3 years ago
setting.setDesc(filter.filterType + (filter.filterContent.length > 0) ? filter.filterContent : "");
3 years ago
setting
.addExtraButton((b) => {
b.setIcon("pencil")
3 years ago
.setTooltip(t("edit"))
3 years ago
.onClick(() => {
const modal = new FilteredFolderModal(this.plugin, filter);
const oldFilter = filter;
modal.onClose = () => __awaiter(this, void 0, void 0, function* () {
if (modal.saved) {
const filters = this.plugin.settings.filtered;
filters.remove(oldFilter);
filters.push({ name: modal.name, filterType: modal.filterType, filterContent: modal.filterContent, sortOrder: modal.sortOrder });
yield this.plugin.writeFiltered(() => (filters));
this.display();
}
});
modal.open();
});
})
.addExtraButton((b) => {
b.setIcon("trash")
3 years ago
.setTooltip(t("delete"))
3 years ago
.onClick(() => __awaiter(this, void 0, void 0, function* () {
const filters = this.plugin.settings.filtered;
filters.remove(filter);
yield this.plugin.writeFiltered(() => (filters));
this.display();
}));
});
}
const feedsContainer = containerEl.createDiv("feed-container");
displayFeedSettings(this.plugin, feedsContainer);
3 years ago
containerEl.createEl("h2", { text: t("hotkeys") });
containerEl.createEl("h3", { text: t("hotkeys_reading") });
3 years ago
new obsidian.Setting(containerEl)
3 years ago
.setName(t("create_note"))
3 years ago
.addText((text) => {
text
.setValue(this.plugin.settings.hotkeys.create)
.setPlaceholder(DEFAULT_SETTINGS.hotkeys.create)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
hotkeys: Object.assign(Object.assign({}, this.plugin.settings.hotkeys), { create: value })
}));
}));
text.inputEl.setAttr("maxlength", 1);
text.inputEl.style.width = "20%";
});
new obsidian.Setting(containerEl)
3 years ago
.setName(t("paste_to_note"))
3 years ago
.addText((text) => {
text
.setValue(this.plugin.settings.hotkeys.paste)
.setPlaceholder(DEFAULT_SETTINGS.hotkeys.paste)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
hotkeys: Object.assign(Object.assign({}, this.plugin.settings.hotkeys), { paste: value })
}));
}));
text.inputEl.setAttr("maxlength", 1);
text.inputEl.style.width = "20%";
});
new obsidian.Setting(containerEl)
3 years ago
.setName(t("open_browser"))
3 years ago
.addText((text) => {
text
.setValue(this.plugin.settings.hotkeys.open)
.setPlaceholder(DEFAULT_SETTINGS.hotkeys.open)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
hotkeys: Object.assign(Object.assign({}, this.plugin.settings.hotkeys), { open: value })
}));
}));
text.inputEl.setAttr("maxlength", 1);
text.inputEl.style.width = "20%";
});
new obsidian.Setting(containerEl)
3 years ago
.setName(t("copy_to_clipboard"))
3 years ago
.addText((text) => {
text
.setValue(this.plugin.settings.hotkeys.copy)
.setPlaceholder(DEFAULT_SETTINGS.hotkeys.copy)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
hotkeys: Object.assign(Object.assign({}, this.plugin.settings.hotkeys), { copy: value })
}));
}));
text.inputEl.setAttr("maxlength", 1);
text.inputEl.style.width = "20%";
});
new obsidian.Setting(containerEl)
3 years ago
.setName(t("mark_as_favorite_remove"))
3 years ago
.addText((text) => {
text
.setValue(this.plugin.settings.hotkeys.favorite)
.setPlaceholder(DEFAULT_SETTINGS.hotkeys.favorite)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
hotkeys: Object.assign(Object.assign({}, this.plugin.settings.hotkeys), { favorite: value })
}));
}));
text.inputEl.setAttr("maxlength", 1);
text.inputEl.style.width = "20%";
});
new obsidian.Setting(containerEl)
3 years ago
.setName(t("mark_as_read_unread"))
3 years ago
.addText((text) => {
text
.setValue(this.plugin.settings.hotkeys.read)
.setPlaceholder(DEFAULT_SETTINGS.hotkeys.read)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
hotkeys: Object.assign(Object.assign({}, this.plugin.settings.hotkeys), { read: value })
}));
}));
text.inputEl.setAttr("maxlength", 1);
text.inputEl.style.width = "20%";
});
new obsidian.Setting(containerEl)
3 years ago
.setName(t("edit_tags"))
3 years ago
.addText((text) => {
text
.setValue(this.plugin.settings.hotkeys.tags)
.setPlaceholder(DEFAULT_SETTINGS.hotkeys.tags)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
hotkeys: Object.assign(Object.assign({}, this.plugin.settings.hotkeys), { tags: value })
}));
}));
text.inputEl.setAttr("maxlength", 1);
text.inputEl.style.width = "20%";
});
3 years ago
//@ts-ignore
if (this.app.plugins.plugins["obsidian-tts"]) {
new obsidian.Setting(containerEl)
3 years ago
.setName(t("read_article_tts"))
3 years ago
.addText((text) => {
text
.setValue(this.plugin.settings.hotkeys.tts)
.setPlaceholder(DEFAULT_SETTINGS.hotkeys.tts)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
yield this.plugin.writeSettings(() => ({
hotkeys: Object.assign(Object.assign({}, this.plugin.settings.hotkeys), { tts: value })
}));
}));
text.inputEl.setAttr("maxlength", 1);
text.inputEl.style.width = "20%";
});
}
3 years ago
}
}
function noop() { }
function run(fn) {
return fn();
}
function blank_object() {
return Object.create(null);
}
function run_all(fns) {
fns.forEach(run);
}
function is_function(thing) {
return typeof thing === 'function';
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
}
let src_url_equal_anchor;
function src_url_equal(element_src, url) {
if (!src_url_equal_anchor) {
src_url_equal_anchor = document.createElement('a');
}
src_url_equal_anchor.href = url;
return element_src === src_url_equal_anchor.href;
}
function is_empty(obj) {
return Object.keys(obj).length === 0;
}
function subscribe(store, ...callbacks) {
if (store == null) {
return noop;
}
const unsub = store.subscribe(...callbacks);
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
3 years ago
function get_store_value(store) {
let value;
subscribe(store, _ => value = _)();
return value;
}
3 years ago
function component_subscribe(component, store, callback) {
component.$$.on_destroy.push(subscribe(store, callback));
}
function action_destroyer(action_result) {
return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;
}
function append(target, node) {
target.appendChild(node);
}
function insert(target, node, anchor) {
target.insertBefore(node, anchor || null);
}
function detach(node) {
node.parentNode.removeChild(node);
}
function destroy_each(iterations, detaching) {
for (let i = 0; i < iterations.length; i += 1) {
if (iterations[i])
iterations[i].d(detaching);
}
}
function element(name) {
return document.createElement(name);
}
function text(data) {
return document.createTextNode(data);
}
function space() {
return text(' ');
}
function empty() {
return text('');
}
function listen(node, event, handler, options) {
node.addEventListener(event, handler, options);
return () => node.removeEventListener(event, handler, options);
}
function attr(node, attribute, value) {
if (value == null)
node.removeAttribute(attribute);
else if (node.getAttribute(attribute) !== value)
node.setAttribute(attribute, value);
}
function children(element) {
return Array.from(element.childNodes);
}
function set_data(text, data) {
data = '' + data;
if (text.wholeText !== data)
text.data = data;
}
function set_style(node, key, value, important) {
node.style.setProperty(key, value, important ? 'important' : '');
}
let current_component;
function set_current_component(component) {
current_component = component;
}
const dirty_components = [];
const binding_callbacks = [];
const render_callbacks = [];
const flush_callbacks = [];
const resolved_promise = Promise.resolve();
let update_scheduled = false;
function schedule_update() {
if (!update_scheduled) {
update_scheduled = true;
resolved_promise.then(flush);
}
}
function add_render_callback(fn) {
render_callbacks.push(fn);
}
let flushing = false;
const seen_callbacks = new Set();
function flush() {
if (flushing)
return;
flushing = true;
do {
// first, call beforeUpdate functions
// and update components
for (let i = 0; i < dirty_components.length; i += 1) {
const component = dirty_components[i];
set_current_component(component);
update(component.$$);
}
set_current_component(null);
dirty_components.length = 0;
while (binding_callbacks.length)
binding_callbacks.pop()();
// then, once components are updated, call
// afterUpdate functions. This may cause
// subsequent updates...
for (let i = 0; i < render_callbacks.length; i += 1) {
const callback = render_callbacks[i];
if (!seen_callbacks.has(callback)) {
// ...so guard against infinite loops
seen_callbacks.add(callback);
callback();
}
}
render_callbacks.length = 0;
} while (dirty_components.length);
while (flush_callbacks.length) {
flush_callbacks.pop()();
}
update_scheduled = false;
flushing = false;
seen_callbacks.clear();
}
function update($$) {
if ($$.fragment !== null) {
$$.update();
run_all($$.before_update);
const dirty = $$.dirty;
$$.dirty = [-1];
$$.fragment && $$.fragment.p($$.ctx, dirty);
$$.after_update.forEach(add_render_callback);
}
}
const outroing = new Set();
let outros;
function group_outros() {
outros = {
r: 0,
c: [],
p: outros // parent group
};
}
function check_outros() {
if (!outros.r) {
run_all(outros.c);
}
outros = outros.p;
}
function transition_in(block, local) {
if (block && block.i) {
outroing.delete(block);
block.i(local);
}
}
function transition_out(block, local, detach, callback) {
if (block && block.o) {
if (outroing.has(block))
return;
outroing.add(block);
outros.c.push(() => {
outroing.delete(block);
if (callback) {
if (detach)
block.d(1);
callback();
}
});
block.o(local);
}
}
function create_component(block) {
block && block.c();
}
function mount_component(component, target, anchor, customElement) {
const { fragment, on_mount, on_destroy, after_update } = component.$$;
fragment && fragment.m(target, anchor);
if (!customElement) {
// onMount happens before the initial afterUpdate
add_render_callback(() => {
const new_on_destroy = on_mount.map(run).filter(is_function);
if (on_destroy) {
on_destroy.push(...new_on_destroy);
}
else {
// Edge case - component was destroyed immediately,
// most likely as a result of a binding initialising
run_all(new_on_destroy);
}
component.$$.on_mount = [];
});
}
after_update.forEach(add_render_callback);
}
function destroy_component(component, detaching) {
const $$ = component.$$;
if ($$.fragment !== null) {
run_all($$.on_destroy);
$$.fragment && $$.fragment.d(detaching);
// TODO null out other refs, including component.$$ (but need to
// preserve final state?)
$$.on_destroy = $$.fragment = null;
$$.ctx = [];
}
}
function make_dirty(component, i) {
if (component.$$.dirty[0] === -1) {
dirty_components.push(component);
schedule_update();
component.$$.dirty.fill(0);
}
component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
}
function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
const parent_component = current_component;
set_current_component(component);
const $$ = component.$$ = {
fragment: null,
ctx: null,
// state
props,
update: noop,
not_equal,
bound: blank_object(),
// lifecycle
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
// everything else
callbacks: blank_object(),
dirty,
skip_bound: false,
root: options.target || parent_component.$$.root
};
append_styles && append_styles($$.root);
let ready = false;
$$.ctx = instance
? instance(component, options.props || {}, (i, ret, ...rest) => {
const value = rest.length ? rest[0] : ret;
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
if (!$$.skip_bound && $$.bound[i])
$$.bound[i](value);
if (ready)
make_dirty(component, i);
}
return ret;
})
: [];
$$.update();
ready = true;
run_all($$.before_update);
// `false` as a special case of no DOM component
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;
if (options.target) {
if (options.hydrate) {
const nodes = children(options.target);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$$.fragment && $$.fragment.l(nodes);
nodes.forEach(detach);
}
else {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
$$.fragment && $$.fragment.c();
}
if (options.intro)
transition_in(component.$$.fragment);
mount_component(component, options.target, options.anchor, options.customElement);
flush();
}
set_current_component(parent_component);
}
/**
* Base class for Svelte components. Used when dev=false.
*/
class SvelteComponent {
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
$on(type, callback) {
const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
callbacks.push(callback);
return () => {
const index = callbacks.indexOf(callback);
if (index !== -1)
callbacks.splice(index, 1);
};
}
$set($$props) {
if (this.$$set && !is_empty($$props)) {
this.$$.skip_bound = true;
this.$$set($$props);
this.$$.skip_bound = false;
}
}
}
const subscriber_queue = [];
/**
* Create a `Writable` store that allows both updating and reading by subscription.
* @param {*=}value initial value
* @param {StartStopNotifier=}start start and stop notifications for subscriptions
*/
function writable(value, start = noop) {
let stop;
const subscribers = new Set();
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) { // store is ready
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
function update(fn) {
set(fn(value));
}
function subscribe(run, invalidate = noop) {
const subscriber = [run, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set) || noop;
}
run(value);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0) {
stop();
stop = null;
}
};
}
return { set, update, subscribe };
}
const configuredFeedsStore = writable([]);
const filteredStore = writable([]);
const settingsStore = writable(DEFAULT_SETTINGS);
const feedsStore = writable([]);
const sortedFeedsStore = writable();
const filteredItemsStore = writable();
3 years ago
const foldedState = writable();
const tagsStore = writable();
3 years ago
/* src/view/IconComponent.svelte generated by Svelte v3.44.2 */
function create_if_block$4(ctx) {
let span;
let icon_action;
let mounted;
let dispose;
return {
c() {
span = element("span");
},
m(target, anchor) {
insert(target, span, anchor);
if (!mounted) {
dispose = action_destroyer(icon_action = /*icon*/ ctx[1].call(null, span, /*iconName*/ ctx[0]));
mounted = true;
}
},
p(ctx, dirty) {
if (icon_action && is_function(icon_action.update) && dirty & /*iconName*/ 1) icon_action.update.call(null, /*iconName*/ ctx[0]);
},
d(detaching) {
if (detaching) detach(span);
mounted = false;
dispose();
}
};
}
function create_fragment$4(ctx) {
let if_block_anchor;
let if_block = /*iconName*/ ctx[0].length > 0 && create_if_block$4(ctx);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
},
p(ctx, [dirty]) {
if (/*iconName*/ ctx[0].length > 0) {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block$4(ctx);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
i: noop,
o: noop,
d(detaching) {
if (if_block) if_block.d(detaching);
if (detaching) detach(if_block_anchor);
}
};
}
function instance$4($$self, $$props, $$invalidate) {
let { iconName = "" } = $$props;
const icon = (node, icon) => {
obsidian.setIcon(node, icon);
};
$$self.$$set = $$props => {
if ('iconName' in $$props) $$invalidate(0, iconName = $$props.iconName);
};
return [iconName, icon];
}
class IconComponent extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$4, create_fragment$4, safe_not_equal, { iconName: 0 });
}
}
//slightly modified version from https://github.com/zsviczian/obsidian-excalidraw-plugin
class TextInputPrompt extends BaseModal {
constructor(app, promptText, hint, defaultValue, placeholder) {
super(app);
this.promptText = promptText;
this.hint = hint;
this.defaultValue = defaultValue;
this.placeholder = placeholder;
}
onOpen() {
this.titleEl.setText(this.promptText);
this.createForm();
}
onClose() {
this.contentEl.empty();
}
createForm() {
const div = this.contentEl.createDiv();
const text = new obsidian.Setting(div).setName(this.promptText).setDesc(this.hint).addText((textComponent) => {
textComponent
.setValue(this.defaultValue)
.setPlaceholder(this.placeholder)
.onChange(() => {
this.removeValidationError(textComponent);
})
.inputEl.setAttribute("size", "50");
this.textComponent = textComponent;
});
text.controlEl.addClass("rss-setting-input");
new obsidian.Setting(div).addButton((b) => {
b
3 years ago
.setButtonText(t("save"))
3 years ago
.onClick(() => __awaiter(this, void 0, void 0, function* () {
this.resolve(this.textComponent);
}));
return b;
});
}
openAndGetValue(resolve) {
return __awaiter(this, void 0, void 0, function* () {
this.resolve = resolve;
yield this.open();
});
}
}
var feather = createCommonjsModule(function (module, exports) {
(function webpackUniversalModuleDefinition(root, factory) {
module.exports = factory();
})(typeof self !== 'undefined' ? self : commonjsGlobal, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./dist/icons.json":
/*!*************************!*\
!*** ./dist/icons.json ***!
\*************************/
/*! exports provided: activity, airplay, alert-circle, alert-octagon, alert-triangle, align-center, align-justify, align-left, align-right, anchor, aperture, archive, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, award, bar-chart-2, bar-chart, battery-charging, battery, bell-off, bell, bluetooth, bold, book-open, book, bookmark, box, briefcase, calendar, camera-off, camera, cast, check-circle, check-square, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, chrome, circle, clipboard, clock, cloud-drizzle, cloud-lightning, cloud-off, cloud-rain, cloud-snow, cloud, code, codepen, codesandbox, coffee, columns, command, compass, copy, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, cpu, credit-card, crop, crosshair, database, delete, disc, divide-circle, divide-square, divide, dollar-sign, download-cloud, download, dribbble, droplet, edit-2, edit-3, edit, external-link, eye-off, eye, facebook, fast-forward, feather, figma, file-minus, file-plus, file-text, file, film, filter, flag, folder-minus, folder-plus, folder, framer, frown, gift, git-branch, git-commit, git-merge, git-pull-request, github, gitlab, globe, grid, hard-drive, hash, headphones, heart, help-circle, hexagon, home, image, inbox, info, instagram, italic, key, layers, layout, life-buoy, link-2, link, linkedin, list, loader, lock, log-in, log-out, mail, map-pin, map, maximize-2, maximize, meh, menu, message-circle, message-square, mic-off, mic, minimize-2, minimize, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, mouse-pointer, move, music, navigation-2, navigation, octagon, package, paperclip, pause-circle, pause, pen-tool, percent, phone-call, phone-forwarded, phone-incoming, phone-missed, phone-off, phone-outgoing, phone, pie-chart, play-circle, play, plus-circle, plus-square, plus, pocket, power, printer, radio, refresh-ccw, refresh-cw, repeat, rewind, rotate-ccw, rotate-cw, rss, save, scissors, search, send, server, settings, share-2, share, shield-off, shield, shopping-bag, shopping-cart, shuffle, sidebar, skip-back, skip-forward, slack, slash, sliders, smartphone, smile, speaker, square, star, stop-circle, sun, sunrise, sunset, tablet, tag, target, terminal, thermometer, thumbs-down, thumbs-up, toggle-left, toggle-right, tool, trash-2, trash, trello, trending-down, trending-up, triangle, truck, tv, twitch, twitter, type, umbrella, underline, unlock, upload-cloud, upload, user-check, user-minus, user-plus, user-x, user, users, video-off, video, voicemail, volume-1, volume-2, volume-x, volume, watch, wifi-off, wifi, wind, x-circle, x-octagon, x-square, x, youtube, zap-off, zap, zoom-in, zoom-out, default */
/***/ (function(module) {
module.exports = {"activity":"<polyline points=\"22 12 18 12 15 21 9 3 6 12 2 12\"></polyline>","airplay":"<path d=\"M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1\"></path><polygon points=\"12 15 17 21 7 21 12 15\"></polygon>","alert-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line><line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>","alert-octagon":"<polygon points=\"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2\"></polygon><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line><line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>","alert-triangle":"<path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"></path><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"></line><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"></line>","align-center":"<line x1=\"18\" y1=\"10\" x2=\"6\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"18\" y1=\"18\" x2=\"6\" y2=\"18\"></line>","align-justify":"<line x1=\"21\" y1=\"10\" x2=\"3\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"21\" y1=\"18\" x2=\"3\" y2=\"18\"></line>","align-left":"<line x1=\"17\" y1=\"10\" x2=\"3\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"17\" y1=\"18\" x2=\"3\" y2=\"18\"></line>","align-right":"<line x1=\"21\" y1=\"10\" x2=\"7\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"21\" y1=\"18\" x2=\"7\" y2=\"18\"></line>","anchor":"<circle cx=\"12\" cy=\"5\" r=\"3\"></circle><line x1=\"12\" y1=\"22\" x2=\"12\" y2=\"8\"></line><path d=\"M5 12H2a10 10 0 0 0 20 0h-3\"></path>","aperture":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"14.31\" y1=\"8\" x2=\"20.05\" y2=\"17.94\"></line><line x1=\"9.69\" y1=\"8\" x2=\"21.17\" y2=\"8\"></line><line x1=\"7.38\" y1=\"12\" x2=\"13.12\" y2=\"2.06\"></line><line x1=\"9.69\" y1=\"16\" x2=\"3.95\" y2=\"6.06\"></line><line x1=\"14.31\" y1=\"16\" x2=\"2.83\" y2=\"16\"></line><line x1=\"16.62\" y1=\"12\" x2=\"10.88\" y2=\"21.94\"></line>","archive":"<polyline points=\"21 8 21 21 3 21 3 8\"></polyline><rect x=\"1\" y=\"3\" width=\"22\" height=\"5\"></rect><line x1=\"10\" y1=\"12\" x2=\"14\" y2=\"12\"></line>","arrow-down-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"8 12 12 16 16 12\"></polyline><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"16\"></line>","arrow-down-left":"<line x1=\"17\" y1=\"7\" x2=\"7\" y2=\"17\"></line><polyline points=\"17 17 7 17 7 7\"></polyline>","arrow-down-right":"<line x1=\"7\" y1=\"7\" x2=\"17\" y2=\"17\"></line><polyline points=\"17 7 17 17 7 17\"></polyline>","arrow-down":"<line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line><polyline points=\"19 12 12 19 5 12\"></polyline>","arrow-left-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"12 8 8 12 12 16\"></polyline><line x1=\"16\" y1=\"12\" x2=\"8\" y2=\"12\"></line>","arrow-left":"<line x1=\"19\" y1=\"12\" x2=\"5\" y2=\"12\"></line><polyline points=\"12 19 5 12 12 5\"></polyline>","arrow-right-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"12 16 16 12 12 8\"></polyline><line x1=\"8\" y1=\"12\" x2=\"16\" y2=\"12\"></line>","arrow-right":"<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line><polyline points=\"12 5 19 12 12 19\"></polyline>","arrow-up-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"16 12 12 8 8 12\"></polyline><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"8\"></line>","arrow-up-left":"<line x1=\"17\" y1=\"17\" x2=\"7\" y2=\"7\"></line><polyline points=\"7 17 7 7 17 7\"></polyline>","arrow-up-right":"<line x1=\"7\" y1=\"17\" x2=\"17\" y2=\"7\"></line><polyline points=\"7 7 17 7 17 17\"></polyline>","arrow-up":"<line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"5\"></line
/***/ }),
/***/ "./node_modules/classnames/dedupe.js":
/*!*******************************************!*\
!*** ./node_modules/classnames/dedupe.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
var classNames = (function () {
// don't inherit from Object so we can skip hasOwnProperty check later
// http://stackoverflow.com/questions/15518328/creating-js-object-with-object-createnull#answer-21079232
function StorageObject() {}
StorageObject.prototype = Object.create(null);
function _parseArray (resultSet, array) {
var length = array.length;
for (var i = 0; i < length; ++i) {
_parse(resultSet, array[i]);
}
}
var hasOwn = {}.hasOwnProperty;
function _parseNumber (resultSet, num) {
resultSet[num] = true;
}
function _parseObject (resultSet, object) {
for (var k in object) {
if (hasOwn.call(object, k)) {
// set value to false instead of deleting it to avoid changing object structure
// https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions
resultSet[k] = !!object[k];
}
}
}
var SPACE = /\s+/;
function _parseString (resultSet, str) {
var array = str.split(SPACE);
var length = array.length;
for (var i = 0; i < length; ++i) {
resultSet[array[i]] = true;
}
}
function _parse (resultSet, arg) {
if (!arg) return;
var argType = typeof arg;
// 'foo bar'
if (argType === 'string') {
_parseString(resultSet, arg);
// ['foo', 'bar', ...]
} else if (Array.isArray(arg)) {
_parseArray(resultSet, arg);
// { 'foo': true, ... }
} else if (argType === 'object') {
_parseObject(resultSet, arg);
// '130'
} else if (argType === 'number') {
_parseNumber(resultSet, arg);
}
}
function _classNames () {
// don't leak arguments
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var len = arguments.length;
var args = Array(len);
for (var i = 0; i < len; i++) {
args[i] = arguments[i];
}
var classSet = new StorageObject();
_parseArray(classSet, args);
var list = [];
for (var k in classSet) {
if (classSet[k]) {
list.push(k);
}
}
return list.join(' ');
}
return _classNames;
})();
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
}());
/***/ }),
/***/ "./node_modules/core-js/es/array/from.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/es/array/from.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(/*! ../../modules/es.string.iterator */ "./node_modules/core-js/modules/es.string.iterator.js");
__webpack_require__(/*! ../../modules/es.array.from */ "./node_modules/core-js/modules/es.array.from.js");
var path = __webpack_require__(/*! ../../internals/path */ "./node_modules/core-js/internals/path.js");
module.exports = path.Array.from;
/***/ }),
/***/ "./node_modules/core-js/internals/a-function.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/a-function.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (it) {
if (typeof it != 'function') {
throw TypeError(String(it) + ' is not a function');
} return it;
};
/***/ }),
/***/ "./node_modules/core-js/internals/an-object.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/an-object.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
module.exports = function (it) {
if (!isObject(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
/***/ }),
/***/ "./node_modules/core-js/internals/array-from.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/array-from.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var bind = __webpack_require__(/*! ../internals/bind-context */ "./node_modules/core-js/internals/bind-context.js");
var toObject = __webpack_require__(/*! ../internals/to-object */ "./node_modules/core-js/internals/to-object.js");
var callWithSafeIterationClosing = __webpack_require__(/*! ../internals/call-with-safe-iteration-closing */ "./node_modules/core-js/internals/call-with-safe-iteration-closing.js");
var isArrayIteratorMethod = __webpack_require__(/*! ../internals/is-array-iterator-method */ "./node_modules/core-js/internals/is-array-iterator-method.js");
var toLength = __webpack_require__(/*! ../internals/to-length */ "./node_modules/core-js/internals/to-length.js");
var createProperty = __webpack_require__(/*! ../internals/create-property */ "./node_modules/core-js/internals/create-property.js");
var getIteratorMethod = __webpack_require__(/*! ../internals/get-iterator-method */ "./node_modules/core-js/internals/get-iterator-method.js");
// `Array.from` method
// https://tc39.github.io/ecma262/#sec-array.from
module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
var O = toObject(arrayLike);
var C = typeof this == 'function' ? this : Array;
var argumentsLength = arguments.length;
var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
var mapping = mapfn !== undefined;
var index = 0;
var iteratorMethod = getIteratorMethod(O);
var length, result, step, iterator;
if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
// if the target is not iterable or it's an array with the default iterator - use a simple case
if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
iterator = iteratorMethod.call(O);
result = new C();
for (;!(step = iterator.next()).done; index++) {
createProperty(result, index, mapping
? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true)
: step.value
);
}
} else {
length = toLength(O.length);
result = new C(length);
for (;length > index; index++) {
createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
}
}
result.length = index;
return result;
};
/***/ }),
/***/ "./node_modules/core-js/internals/array-includes.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/array-includes.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js");
var toLength = __webpack_require__(/*! ../internals/to-length */ "./node_modules/core-js/internals/to-length.js");
var toAbsoluteIndex = __webpack_require__(/*! ../internals/to-absolute-index */ "./node_modules/core-js/internals/to-absolute-index.js");
// `Array.prototype.{ indexOf, includes }` methods implementation
// false -> Array#indexOf
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
// true -> Array#includes
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
module.exports = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIndexedObject($this);
var length = toLength(O.length);
var index = toAbsoluteIndex(fromIndex, length);
var value;
// Array#includes uses SameValueZero equality algorithm
// eslint-disable-next-line no-self-compare
if (IS_INCLUDES && el != el) while (length > index) {
value = O[index++];
// eslint-disable-next-line no-self-compare
if (value != value) return true;
// Array#indexOf ignores holes, Array#includes - not
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
if (O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
/***/ }),
/***/ "./node_modules/core-js/internals/bind-context.js":
/*!********************************************************!*\
!*** ./node_modules/core-js/internals/bind-context.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var aFunction = __webpack_require__(/*! ../internals/a-function */ "./node_modules/core-js/internals/a-function.js");
// optional / simple context binding
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 0: return function () {
return fn.call(that);
};
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
/***/ }),
/***/ "./node_modules/core-js/internals/call-with-safe-iteration-closing.js":
/*!****************************************************************************!*\
!*** ./node_modules/core-js/internals/call-with-safe-iteration-closing.js ***!
\****************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
// call something on iterator step with safe closing on error
module.exports = function (iterator, fn, value, ENTRIES) {
try {
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch (error) {
var returnMethod = iterator['return'];
if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
throw error;
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/check-correctness-of-iteration.js":
/*!**************************************************************************!*\
!*** ./node_modules/core-js/internals/check-correctness-of-iteration.js ***!
\**************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var ITERATOR = wellKnownSymbol('iterator');
var SAFE_CLOSING = false;
try {
var called = 0;
var iteratorWithReturn = {
next: function () {
return { done: !!called++ };
},
'return': function () {
SAFE_CLOSING = true;
}
};
iteratorWithReturn[ITERATOR] = function () {
return this;
};
// eslint-disable-next-line no-throw-literal
Array.from(iteratorWithReturn, function () { throw 2; });
} catch (error) { /* empty */ }
module.exports = function (exec, SKIP_CLOSING) {
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
var ITERATION_SUPPORT = false;
try {
var object = {};
object[ITERATOR] = function () {
return {
next: function () {
return { done: ITERATION_SUPPORT = true };
}
};
};
exec(object);
} catch (error) { /* empty */ }
return ITERATION_SUPPORT;
};
/***/ }),
/***/ "./node_modules/core-js/internals/classof-raw.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/internals/classof-raw.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function (it) {
return toString.call(it).slice(8, -1);
};
/***/ }),
/***/ "./node_modules/core-js/internals/classof.js":
/*!***************************************************!*\
!*** ./node_modules/core-js/internals/classof.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var classofRaw = __webpack_require__(/*! ../internals/classof-raw */ "./node_modules/core-js/internals/classof-raw.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
// ES3 wrong here
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
try {
return it[key];
} catch (error) { /* empty */ }
};
// getting tag from ES6+ `Object.prototype.toString`
module.exports = function (it) {
var O, tag, result;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
// builtinTag case
: CORRECT_ARGUMENTS ? classofRaw(O)
// ES3 arguments fallback
: (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
};
/***/ }),
/***/ "./node_modules/core-js/internals/copy-constructor-properties.js":
/*!***********************************************************************!*\
!*** ./node_modules/core-js/internals/copy-constructor-properties.js ***!
\***********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var ownKeys = __webpack_require__(/*! ../internals/own-keys */ "./node_modules/core-js/internals/own-keys.js");
var getOwnPropertyDescriptorModule = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ "./node_modules/core-js/internals/object-get-own-property-descriptor.js");
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
module.exports = function (target, source) {
var keys = ownKeys(source);
var defineProperty = definePropertyModule.f;
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/correct-prototype-getter.js":
/*!********************************************************************!*\
!*** ./node_modules/core-js/internals/correct-prototype-getter.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
module.exports = !fails(function () {
function F() { /* empty */ }
F.prototype.constructor = null;
return Object.getPrototypeOf(new F()) !== F.prototype;
});
/***/ }),
/***/ "./node_modules/core-js/internals/create-iterator-constructor.js":
/*!***********************************************************************!*\
!*** ./node_modules/core-js/internals/create-iterator-constructor.js ***!
\***********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var IteratorPrototype = __webpack_require__(/*! ../internals/iterators-core */ "./node_modules/core-js/internals/iterators-core.js").IteratorPrototype;
var create = __webpack_require__(/*! ../internals/object-create */ "./node_modules/core-js/internals/object-create.js");
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
var setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ "./node_modules/core-js/internals/set-to-string-tag.js");
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
var returnThis = function () { return this; };
module.exports = function (IteratorConstructor, NAME, next) {
var TO_STRING_TAG = NAME + ' Iterator';
IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
Iterators[TO_STRING_TAG] = returnThis;
return IteratorConstructor;
};
/***/ }),
/***/ "./node_modules/core-js/internals/create-property-descriptor.js":
/*!**********************************************************************!*\
!*** ./node_modules/core-js/internals/create-property-descriptor.js ***!
\**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
/***/ }),
/***/ "./node_modules/core-js/internals/create-property.js":
/*!***********************************************************!*\
!*** ./node_modules/core-js/internals/create-property.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
module.exports = function (object, key, value) {
var propertyKey = toPrimitive(key);
if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
else object[propertyKey] = value;
};
/***/ }),
/***/ "./node_modules/core-js/internals/define-iterator.js":
/*!***********************************************************!*\
!*** ./node_modules/core-js/internals/define-iterator.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var $ = __webpack_require__(/*! ../internals/export */ "./node_modules/core-js/internals/export.js");
var createIteratorConstructor = __webpack_require__(/*! ../internals/create-iterator-constructor */ "./node_modules/core-js/internals/create-iterator-constructor.js");
var getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ "./node_modules/core-js/internals/object-get-prototype-of.js");
var setPrototypeOf = __webpack_require__(/*! ../internals/object-set-prototype-of */ "./node_modules/core-js/internals/object-set-prototype-of.js");
var setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ "./node_modules/core-js/internals/set-to-string-tag.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var redefine = __webpack_require__(/*! ../internals/redefine */ "./node_modules/core-js/internals/redefine.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
var IteratorsCore = __webpack_require__(/*! ../internals/iterators-core */ "./node_modules/core-js/internals/iterators-core.js");
var IteratorPrototype = IteratorsCore.IteratorPrototype;
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
var ITERATOR = wellKnownSymbol('iterator');
var KEYS = 'keys';
var VALUES = 'values';
var ENTRIES = 'entries';
var returnThis = function () { return this; };
module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
createIteratorConstructor(IteratorConstructor, NAME, next);
var getIterationMethod = function (KIND) {
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
switch (KIND) {
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
} return function () { return new IteratorConstructor(this); };
};
var TO_STRING_TAG = NAME + ' Iterator';
var INCORRECT_VALUES_NAME = false;
var IterablePrototype = Iterable.prototype;
var nativeIterator = IterablePrototype[ITERATOR]
|| IterablePrototype['@@iterator']
|| DEFAULT && IterablePrototype[DEFAULT];
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
var CurrentIteratorPrototype, methods, KEY;
// fix native
if (anyNativeIterator) {
CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
if (setPrototypeOf) {
setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
} else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
hide(CurrentIteratorPrototype, ITERATOR, returnThis);
}
}
// Set @@toStringTag to native iterators
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
INCORRECT_VALUES_NAME = true;
defaultIterator = function values() { return nativeIterator.call(this); };
}
// define iterator
if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
hide(IterablePrototype, ITERATOR, defaultIterator);
}
Iterators[NAME] = defaultIterator;
// export additional methods
if (DEFAULT) {
methods = {
values: getIterationMethod(VALUES),
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
entries: getIterationMethod(ENTRIES)
};
if (FORCED) for (KEY in methods) {
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
redefine(IterablePrototype, KEY, methods[KEY]);
}
} else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
}
return methods;
};
/***/ }),
/***/ "./node_modules/core-js/internals/descriptors.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/internals/descriptors.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
// Thank's IE8 for his funny defineProperty
module.exports = !fails(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/***/ "./node_modules/core-js/internals/document-create-element.js":
/*!*******************************************************************!*\
!*** ./node_modules/core-js/internals/document-create-element.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
var document = global.document;
// typeof document.createElement is 'object' in old IE
var exist = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
return exist ? document.createElement(it) : {};
};
/***/ }),
/***/ "./node_modules/core-js/internals/enum-bug-keys.js":
/*!*********************************************************!*\
!*** ./node_modules/core-js/internals/enum-bug-keys.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
// IE8- don't enum bug keys
module.exports = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
/***/ }),
/***/ "./node_modules/core-js/internals/export.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/internals/export.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var getOwnPropertyDescriptor = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ "./node_modules/core-js/internals/object-get-own-property-descriptor.js").f;
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var redefine = __webpack_require__(/*! ../internals/redefine */ "./node_modules/core-js/internals/redefine.js");
var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js");
var copyConstructorProperties = __webpack_require__(/*! ../internals/copy-constructor-properties */ "./node_modules/core-js/internals/copy-constructor-properties.js");
var isForced = __webpack_require__(/*! ../internals/is-forced */ "./node_modules/core-js/internals/is-forced.js");
/*
options.target - name of the target object
options.global - target is the global object
options.stat - export as static methods of target
options.proto - export as prototype methods of target
options.real - real prototype method for the `pure` version
options.forced - export even if the native feature is available
options.bind - bind methods to the target, required for the `pure` version
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
options.unsafe - use the simple assignment of property instead of delete + defineProperty
options.sham - add a flag to not completely full polyfills
options.enumerable - export as enumerable property
options.noTargetGet - prevent calling a getter on target
*/
module.exports = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = global;
} else if (STATIC) {
target = global[TARGET] || setGlobal(TARGET, {});
} else {
target = (global[TARGET] || {}).prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contained in target
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty === typeof targetProperty) continue;
copyConstructorProperties(sourceProperty, targetProperty);
}
// add a flag to not completely full polyfills
if (options.sham || (targetProperty && targetProperty.sham)) {
hide(sourceProperty, 'sham', true);
}
// extend global
redefine(target, key, sourceProperty, options);
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/fails.js":
/*!*************************************************!*\
!*** ./node_modules/core-js/internals/fails.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/function-to-string.js":
/*!**************************************************************!*\
!*** ./node_modules/core-js/internals/function-to-string.js ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
module.exports = shared('native-function-to-string', Function.toString);
/***/ }),
/***/ "./node_modules/core-js/internals/get-iterator-method.js":
/*!***************************************************************!*\
!*** ./node_modules/core-js/internals/get-iterator-method.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var classof = __webpack_require__(/*! ../internals/classof */ "./node_modules/core-js/internals/classof.js");
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var ITERATOR = wellKnownSymbol('iterator');
module.exports = function (it) {
if (it != undefined) return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ }),
/***/ "./node_modules/core-js/internals/global.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/internals/global.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var O = 'object';
var check = function (it) {
return it && it.Math == Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
module.exports =
// eslint-disable-next-line no-undef
check(typeof globalThis == O && globalThis) ||
check(typeof window == O && window) ||
check(typeof self == O && self) ||
check(typeof global == O && global) ||
// eslint-disable-next-line no-new-func
Function('return this')();
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")));
/***/ }),
/***/ "./node_modules/core-js/internals/has.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/internals/has.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/***/ "./node_modules/core-js/internals/hidden-keys.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/internals/hidden-keys.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/***/ "./node_modules/core-js/internals/hide.js":
/*!************************************************!*\
!*** ./node_modules/core-js/internals/hide.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
module.exports = DESCRIPTORS ? function (object, key, value) {
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/***/ "./node_modules/core-js/internals/html.js":
/*!************************************************!*\
!*** ./node_modules/core-js/internals/html.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var document = global.document;
module.exports = document && document.documentElement;
/***/ }),
/***/ "./node_modules/core-js/internals/ie8-dom-define.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/ie8-dom-define.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
var createElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js");
// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
/***/ }),
/***/ "./node_modules/core-js/internals/indexed-object.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/indexed-object.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
var classof = __webpack_require__(/*! ../internals/classof-raw */ "./node_modules/core-js/internals/classof-raw.js");
var split = ''.split;
module.exports = fails(function () {
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
// eslint-disable-next-line no-prototype-builtins
return !Object('z').propertyIsEnumerable(0);
}) ? function (it) {
return classof(it) == 'String' ? split.call(it, '') : Object(it);
} : Object;
/***/ }),
/***/ "./node_modules/core-js/internals/internal-state.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/internal-state.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var NATIVE_WEAK_MAP = __webpack_require__(/*! ../internals/native-weak-map */ "./node_modules/core-js/internals/native-weak-map.js");
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var objectHas = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
var WeakMap = global.WeakMap;
var set, get, has;
var enforce = function (it) {
return has(it) ? get(it) : set(it, {});
};
var getterFor = function (TYPE) {
return function (it) {
var state;
if (!isObject(it) || (state = get(it)).type !== TYPE) {
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
} return state;
};
};
if (NATIVE_WEAK_MAP) {
var store = new WeakMap();
var wmget = store.get;
var wmhas = store.has;
var wmset = store.set;
set = function (it, metadata) {
wmset.call(store, it, metadata);
return metadata;
};
get = function (it) {
return wmget.call(store, it) || {};
};
has = function (it) {
return wmhas.call(store, it);
};
} else {
var STATE = sharedKey('state');
hiddenKeys[STATE] = true;
set = function (it, metadata) {
hide(it, STATE, metadata);
return metadata;
};
get = function (it) {
return objectHas(it, STATE) ? it[STATE] : {};
};
has = function (it) {
return objectHas(it, STATE);
};
}
module.exports = {
set: set,
get: get,
has: has,
enforce: enforce,
getterFor: getterFor
};
/***/ }),
/***/ "./node_modules/core-js/internals/is-array-iterator-method.js":
/*!********************************************************************!*\
!*** ./node_modules/core-js/internals/is-array-iterator-method.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
var ITERATOR = wellKnownSymbol('iterator');
var ArrayPrototype = Array.prototype;
// check on default Array iterator
module.exports = function (it) {
return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
};
/***/ }),
/***/ "./node_modules/core-js/internals/is-forced.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/is-forced.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
var replacement = /#|\.prototype\./;
var isForced = function (feature, detection) {
var value = data[normalize(feature)];
return value == POLYFILL ? true
: value == NATIVE ? false
: typeof detection == 'function' ? fails(detection)
: !!detection;
};
var normalize = isForced.normalize = function (string) {
return String(string).replace(replacement, '.').toLowerCase();
};
var data = isForced.data = {};
var NATIVE = isForced.NATIVE = 'N';
var POLYFILL = isForced.POLYFILL = 'P';
module.exports = isForced;
/***/ }),
/***/ "./node_modules/core-js/internals/is-object.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/is-object.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/***/ "./node_modules/core-js/internals/is-pure.js":
/*!***************************************************!*\
!*** ./node_modules/core-js/internals/is-pure.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = false;
/***/ }),
/***/ "./node_modules/core-js/internals/iterators-core.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/internals/iterators-core.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ "./node_modules/core-js/internals/object-get-prototype-of.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
var ITERATOR = wellKnownSymbol('iterator');
var BUGGY_SAFARI_ITERATORS = false;
var returnThis = function () { return this; };
// `%IteratorPrototype%` object
// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
if ([].keys) {
arrayIterator = [].keys();
// Safari 8 has buggy iterators w/o `next`
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
else {
PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
}
}
if (IteratorPrototype == undefined) IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
module.exports = {
IteratorPrototype: IteratorPrototype,
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
};
/***/ }),
/***/ "./node_modules/core-js/internals/iterators.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/iterators.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/***/ "./node_modules/core-js/internals/native-symbol.js":
/*!*********************************************************!*\
!*** ./node_modules/core-js/internals/native-symbol.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
// Chrome 38 Symbol has incorrect toString conversion
// eslint-disable-next-line no-undef
return !String(Symbol());
});
/***/ }),
/***/ "./node_modules/core-js/internals/native-weak-map.js":
/*!***********************************************************!*\
!*** ./node_modules/core-js/internals/native-weak-map.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var nativeFunctionToString = __webpack_require__(/*! ../internals/function-to-string */ "./node_modules/core-js/internals/function-to-string.js");
var WeakMap = global.WeakMap;
module.exports = typeof WeakMap === 'function' && /native code/.test(nativeFunctionToString.call(WeakMap));
/***/ }),
/***/ "./node_modules/core-js/internals/object-create.js":
/*!*********************************************************!*\
!*** ./node_modules/core-js/internals/object-create.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
var defineProperties = __webpack_require__(/*! ../internals/object-define-properties */ "./node_modules/core-js/internals/object-define-properties.js");
var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js");
var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
var html = __webpack_require__(/*! ../internals/html */ "./node_modules/core-js/internals/html.js");
var documentCreateElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js");
var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
var IE_PROTO = sharedKey('IE_PROTO');
var PROTOTYPE = 'prototype';
var Empty = function () { /* empty */ };
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = documentCreateElement('iframe');
var length = enumBugKeys.length;
var lt = '<';
var script = 'script';
var gt = '>';
var js = 'java' + script + ':';
var iframeDocument;
iframe.style.display = 'none';
html.appendChild(iframe);
iframe.src = String(js);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
return createDict();
};
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
module.exports = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Empty[PROTOTYPE] = anObject(O);
result = new Empty();
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : defineProperties(result, Properties);
};
hiddenKeys[IE_PROTO] = true;
/***/ }),
/***/ "./node_modules/core-js/internals/object-define-properties.js":
/*!********************************************************************!*\
!*** ./node_modules/core-js/internals/object-define-properties.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
var objectKeys = __webpack_require__(/*! ../internals/object-keys */ "./node_modules/core-js/internals/object-keys.js");
module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = objectKeys(Properties);
var length = keys.length;
var i = 0;
var key;
while (length > i) definePropertyModule.f(O, key = keys[i++], Properties[key]);
return O;
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-define-property.js":
/*!******************************************************************!*\
!*** ./node_modules/core-js/internals/object-define-property.js ***!
\******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js");
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
var nativeDefineProperty = Object.defineProperty;
exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return nativeDefineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-get-own-property-descriptor.js":
/*!******************************************************************************!*\
!*** ./node_modules/core-js/internals/object-get-own-property-descriptor.js ***!
\******************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
var propertyIsEnumerableModule = __webpack_require__(/*! ../internals/object-property-is-enumerable */ "./node_modules/core-js/internals/object-property-is-enumerable.js");
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js");
var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js");
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (IE8_DOM_DEFINE) try {
return nativeGetOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-get-own-property-names.js":
/*!*************************************************************************!*\
!*** ./node_modules/core-js/internals/object-get-own-property-names.js ***!
\*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var internalObjectKeys = __webpack_require__(/*! ../internals/object-keys-internal */ "./node_modules/core-js/internals/object-keys-internal.js");
var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js");
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return internalObjectKeys(O, hiddenKeys);
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-get-own-property-symbols.js":
/*!***************************************************************************!*\
!*** ./node_modules/core-js/internals/object-get-own-property-symbols.js ***!
\***************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
/***/ }),
/***/ "./node_modules/core-js/internals/object-get-prototype-of.js":
/*!*******************************************************************!*\
!*** ./node_modules/core-js/internals/object-get-prototype-of.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var toObject = __webpack_require__(/*! ../internals/to-object */ "./node_modules/core-js/internals/to-object.js");
var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
var CORRECT_PROTOTYPE_GETTER = __webpack_require__(/*! ../internals/correct-prototype-getter */ "./node_modules/core-js/internals/correct-prototype-getter.js");
var IE_PROTO = sharedKey('IE_PROTO');
var ObjectPrototype = Object.prototype;
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
O = toObject(O);
if (has(O, IE_PROTO)) return O[IE_PROTO];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
} return O instanceof Object ? ObjectPrototype : null;
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-keys-internal.js":
/*!****************************************************************!*\
!*** ./node_modules/core-js/internals/object-keys-internal.js ***!
\****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js");
var arrayIncludes = __webpack_require__(/*! ../internals/array-includes */ "./node_modules/core-js/internals/array-includes.js");
var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
var arrayIndexOf = arrayIncludes(false);
module.exports = function (object, names) {
var O = toIndexedObject(object);
var i = 0;
var result = [];
var key;
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (has(O, key = names[i++])) {
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-keys.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/internals/object-keys.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var internalObjectKeys = __webpack_require__(/*! ../internals/object-keys-internal */ "./node_modules/core-js/internals/object-keys-internal.js");
var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js");
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
module.exports = Object.keys || function keys(O) {
return internalObjectKeys(O, enumBugKeys);
};
/***/ }),
/***/ "./node_modules/core-js/internals/object-property-is-enumerable.js":
/*!*************************************************************************!*\
!*** ./node_modules/core-js/internals/object-property-is-enumerable.js ***!
\*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor(this, V);
return !!descriptor && descriptor.enumerable;
} : nativePropertyIsEnumerable;
/***/ }),
/***/ "./node_modules/core-js/internals/object-set-prototype-of.js":
/*!*******************************************************************!*\
!*** ./node_modules/core-js/internals/object-set-prototype-of.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var validateSetPrototypeOfArguments = __webpack_require__(/*! ../internals/validate-set-prototype-of-arguments */ "./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
var correctSetter = false;
var test = {};
var setter;
try {
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
setter.call(test, []);
correctSetter = test instanceof Array;
} catch (error) { /* empty */ }
return function setPrototypeOf(O, proto) {
validateSetPrototypeOfArguments(O, proto);
if (correctSetter) setter.call(O, proto);
else O.__proto__ = proto;
return O;
};
}() : undefined);
/***/ }),
/***/ "./node_modules/core-js/internals/own-keys.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/internals/own-keys.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var getOwnPropertyNamesModule = __webpack_require__(/*! ../internals/object-get-own-property-names */ "./node_modules/core-js/internals/object-get-own-property-names.js");
var getOwnPropertySymbolsModule = __webpack_require__(/*! ../internals/object-get-own-property-symbols */ "./node_modules/core-js/internals/object-get-own-property-symbols.js");
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
var Reflect = global.Reflect;
// all object keys, includes non-enumerable and symbols
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {
var keys = getOwnPropertyNamesModule.f(anObject(it));
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
};
3 years ago
3 years ago
/***/ }),
/***/ "./node_modules/core-js/internals/path.js":
/*!************************************************!*\
!*** ./node_modules/core-js/internals/path.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
/***/ }),
/***/ "./node_modules/core-js/internals/redefine.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/internals/redefine.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js");
var nativeFunctionToString = __webpack_require__(/*! ../internals/function-to-string */ "./node_modules/core-js/internals/function-to-string.js");
var InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ "./node_modules/core-js/internals/internal-state.js");
3 years ago
3 years ago
var getInternalState = InternalStateModule.get;
var enforceInternalState = InternalStateModule.enforce;
var TEMPLATE = String(nativeFunctionToString).split('toString');
3 years ago
3 years ago
shared('inspectSource', function (it) {
return nativeFunctionToString.call(it);
});
3 years ago
3 years ago
(module.exports = function (O, key, value, options) {
var unsafe = options ? !!options.unsafe : false;
var simple = options ? !!options.enumerable : false;
var noTargetGet = options ? !!options.noTargetGet : false;
if (typeof value == 'function') {
if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
}
if (O === global) {
if (simple) O[key] = value;
else setGlobal(key, value);
return;
} else if (!unsafe) {
delete O[key];
} else if (!noTargetGet && O[key]) {
simple = true;
}
if (simple) O[key] = value;
else hide(O, key, value);
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, 'toString', function toString() {
return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this);
});
3 years ago
3 years ago
/***/ }),
3 years ago
3 years ago
/***/ "./node_modules/core-js/internals/require-object-coercible.js":
/*!********************************************************************!*\
!*** ./node_modules/core-js/internals/require-object-coercible.js ***!
\********************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
3 years ago
3 years ago
// `RequireObjectCoercible` abstract operation
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
module.exports = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
3 years ago
3 years ago
/***/ }),
/***/ "./node_modules/core-js/internals/set-global.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/set-global.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
module.exports = function (key, value) {
try {
hide(global, key, value);
} catch (error) {
global[key] = value;
} return value;
};
/***/ }),
/***/ "./node_modules/core-js/internals/set-to-string-tag.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/internals/set-to-string-tag.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var defineProperty = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js").f;
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
module.exports = function (it, TAG, STATIC) {
if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
}
};
/***/ }),
/***/ "./node_modules/core-js/internals/shared-key.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/shared-key.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js");
var keys = shared('keys');
module.exports = function (key) {
return keys[key] || (keys[key] = uid(key));
};
/***/ }),
/***/ "./node_modules/core-js/internals/shared.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/internals/shared.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js");
var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
var SHARED = '__core-js_shared__';
var store = global[SHARED] || setGlobal(SHARED, {});
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.1.3',
mode: IS_PURE ? 'pure' : 'global',
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
});
/***/ }),
/***/ "./node_modules/core-js/internals/string-at.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/string-at.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js");
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
3 years ago
3 years ago
// CONVERT_TO_STRING: true -> String#at
// CONVERT_TO_STRING: false -> String#codePointAt
module.exports = function (that, pos, CONVERT_TO_STRING) {
var S = String(requireObjectCoercible(that));
var position = toInteger(pos);
var size = S.length;
var first, second;
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
first = S.charCodeAt(position);
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|| (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
? CONVERT_TO_STRING ? S.charAt(position) : first
: CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
};
3 years ago
3 years ago
/***/ }),
3 years ago
3 years ago
/***/ "./node_modules/core-js/internals/to-absolute-index.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/internals/to-absolute-index.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
3 years ago
var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js");
3 years ago
3 years ago
var max = Math.max;
var min = Math.min;
3 years ago
3 years ago
// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
module.exports = function (index, length) {
var integer = toInteger(index);
return integer < 0 ? max(integer + length, 0) : min(integer, length);
};
3 years ago
/***/ }),
3 years ago
/***/ "./node_modules/core-js/internals/to-indexed-object.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/internals/to-indexed-object.js ***!
\*************************************************************/
3 years ago
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
// toObject with fallback for non-array-like ES3 strings
var IndexedObject = __webpack_require__(/*! ../internals/indexed-object */ "./node_modules/core-js/internals/indexed-object.js");
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
3 years ago
3 years ago
module.exports = function (it) {
return IndexedObject(requireObjectCoercible(it));
};
3 years ago
3 years ago
/***/ }),
3 years ago
3 years ago
/***/ "./node_modules/core-js/internals/to-integer.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/internals/to-integer.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
3 years ago
3 years ago
var ceil = Math.ceil;
var floor = Math.floor;
3 years ago
3 years ago
// `ToInteger` abstract operation
// https://tc39.github.io/ecma262/#sec-tointeger
module.exports = function (argument) {
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
};
3 years ago
3 years ago
/***/ }),
3 years ago
3 years ago
/***/ "./node_modules/core-js/internals/to-length.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/to-length.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js");
3 years ago
3 years ago
var min = Math.min;
3 years ago
3 years ago
// `ToLength` abstract operation
// https://tc39.github.io/ecma262/#sec-tolength
module.exports = function (argument) {
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};
3 years ago
3 years ago
/***/ }),
3 years ago
3 years ago
/***/ "./node_modules/core-js/internals/to-object.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/internals/to-object.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
3 years ago
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
3 years ago
3 years ago
// `ToObject` abstract operation
// https://tc39.github.io/ecma262/#sec-toobject
module.exports = function (argument) {
return Object(requireObjectCoercible(argument));
};
3 years ago
3 years ago
/***/ }),
3 years ago
3 years ago
/***/ "./node_modules/core-js/internals/to-primitive.js":
/*!********************************************************!*\
!*** ./node_modules/core-js/internals/to-primitive.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
3 years ago
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
3 years ago
3 years ago
// 7.1.1 ToPrimitive(input [, PreferredType])
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function (it, S) {
if (!isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
3 years ago
/***/ }),
3 years ago
/***/ "./node_modules/core-js/internals/uid.js":
3 years ago
/*!***********************************************!*\
3 years ago
!*** ./node_modules/core-js/internals/uid.js ***!
3 years ago
\***********************************************/
/*! no static exports found */
3 years ago
/***/ (function(module, exports) {
3 years ago
3 years ago
var id = 0;
var postfix = Math.random();
3 years ago
3 years ago
module.exports = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36));
};
3 years ago
/***/ }),
3 years ago
/***/ "./node_modules/core-js/internals/validate-set-prototype-of-arguments.js":
/*!*******************************************************************************!*\
!*** ./node_modules/core-js/internals/validate-set-prototype-of-arguments.js ***!
\*******************************************************************************/
3 years ago
/*! no static exports found */
3 years ago
/***/ (function(module, exports, __webpack_require__) {
3 years ago
3 years ago
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
module.exports = function (O, proto) {
anObject(O);
if (!isObject(proto) && proto !== null) {
throw TypeError("Can't set " + String(proto) + ' as a prototype');
}
3 years ago
};
/***/ }),
3 years ago
/***/ "./node_modules/core-js/internals/well-known-symbol.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/internals/well-known-symbol.js ***!
\*************************************************************/
3 years ago
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js");
var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/native-symbol */ "./node_modules/core-js/internals/native-symbol.js");
3 years ago
3 years ago
var Symbol = global.Symbol;
var store = shared('wks');
module.exports = function (name) {
return store[name] || (store[name] = NATIVE_SYMBOL && Symbol[name]
|| (NATIVE_SYMBOL ? Symbol : uid)('Symbol.' + name));
3 years ago
};
/***/ }),
3 years ago
/***/ "./node_modules/core-js/modules/es.array.from.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/modules/es.array.from.js ***!
\*******************************************************/
3 years ago
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
var $ = __webpack_require__(/*! ../internals/export */ "./node_modules/core-js/internals/export.js");
var from = __webpack_require__(/*! ../internals/array-from */ "./node_modules/core-js/internals/array-from.js");
var checkCorrectnessOfIteration = __webpack_require__(/*! ../internals/check-correctness-of-iteration */ "./node_modules/core-js/internals/check-correctness-of-iteration.js");
var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
Array.from(iterable);
});
3 years ago
// `Array.from` method
// https://tc39.github.io/ecma262/#sec-array.from
3 years ago
$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
from: from
});
3 years ago
/***/ }),
3 years ago
/***/ "./node_modules/core-js/modules/es.string.iterator.js":
/*!************************************************************!*\
!*** ./node_modules/core-js/modules/es.string.iterator.js ***!
\************************************************************/
3 years ago
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
var codePointAt = __webpack_require__(/*! ../internals/string-at */ "./node_modules/core-js/internals/string-at.js");
var InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ "./node_modules/core-js/internals/internal-state.js");
var defineIterator = __webpack_require__(/*! ../internals/define-iterator */ "./node_modules/core-js/internals/define-iterator.js");
3 years ago
3 years ago
var STRING_ITERATOR = 'String Iterator';
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
// `String.prototype[@@iterator]` method
// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
defineIterator(String, 'String', function (iterated) {
setInternalState(this, {
type: STRING_ITERATOR,
string: String(iterated),
index: 0
});
// `%StringIteratorPrototype%.next` method
// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
}, function next() {
var state = getInternalState(this);
var string = state.string;
var index = state.index;
var point;
if (index >= string.length) return { value: undefined, done: true };
point = codePointAt(string, index, true);
state.index += point.length;
return { value: point, done: false };
});
3 years ago
/***/ }),
3 years ago
/***/ "./node_modules/webpack/buildin/global.js":
/*!***********************************!*\
!*** (webpack)/buildin/global.js ***!
\***********************************/
3 years ago
/*! no static exports found */
3 years ago
/***/ (function(module, exports) {
3 years ago
3 years ago
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1, eval)("this");
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
3 years ago
/***/ }),
3 years ago
/***/ "./src/default-attrs.json":
/*!********************************!*\
!*** ./src/default-attrs.json ***!
\********************************/
/*! exports provided: xmlns, width, height, viewBox, fill, stroke, stroke-width, stroke-linecap, stroke-linejoin, default */
/***/ (function(module) {
3 years ago
3 years ago
module.exports = {"xmlns":"http://www.w3.org/2000/svg","width":24,"height":24,"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};
3 years ago
/***/ }),
3 years ago
/***/ "./src/icon.js":
/*!*********************!*\
!*** ./src/icon.js ***!
\*********************/
3 years ago
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
Object.defineProperty(exports, "__esModule", {
value: true
});
3 years ago
3 years ago
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]; } } } return target; };
3 years ago
3 years ago
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
3 years ago
3 years ago
var _dedupe = __webpack_require__(/*! classnames/dedupe */ "./node_modules/classnames/dedupe.js");
3 years ago
3 years ago
var _dedupe2 = _interopRequireDefault(_dedupe);
3 years ago
3 years ago
var _defaultAttrs = __webpack_require__(/*! ./default-attrs.json */ "./src/default-attrs.json");
3 years ago
3 years ago
var _defaultAttrs2 = _interopRequireDefault(_defaultAttrs);
3 years ago
3 years ago
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3 years ago
3 years ago
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3 years ago
3 years ago
var Icon = function () {
function Icon(name, contents) {
var tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
3 years ago
3 years ago
_classCallCheck(this, Icon);
3 years ago
3 years ago
this.name = name;
this.contents = contents;
this.tags = tags;
this.attrs = _extends({}, _defaultAttrs2.default, { class: 'feather feather-' + name });
}
3 years ago
3 years ago
/**
* Create an SVG string.
* @param {Object} attrs
* @returns {string}
*/
3 years ago
3 years ago
_createClass(Icon, [{
key: 'toSvg',
value: function toSvg() {
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3 years ago
3 years ago
var combinedAttrs = _extends({}, this.attrs, attrs, { class: (0, _dedupe2.default)(this.attrs.class, attrs.class) });
3 years ago
3 years ago
return '<svg ' + attrsToString(combinedAttrs) + '>' + this.contents + '</svg>';
}
3 years ago
3 years ago
/**
* Return string representation of an `Icon`.
*
* Added for backward compatibility. If old code expects `feather.icons.<name>`
* to be a string, `toString()` will get implicitly called.
*
* @returns {string}
*/
3 years ago
3 years ago
}, {
key: 'toString',
value: function toString() {
return this.contents;
}
}]);
3 years ago
3 years ago
return Icon;
}();
/**
* Convert attributes object to string of HTML attributes.
* @param {Object} attrs
* @returns {string}
*/
function attrsToString(attrs) {
return Object.keys(attrs).map(function (key) {
return key + '="' + attrs[key] + '"';
}).join(' ');
}
3 years ago
3 years ago
exports.default = Icon;
3 years ago
/***/ }),
3 years ago
/***/ "./src/icons.js":
/*!**********************!*\
!*** ./src/icons.js ***!
\**********************/
3 years ago
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
Object.defineProperty(exports, "__esModule", {
value: true
3 years ago
});
3 years ago
var _icon = __webpack_require__(/*! ./icon */ "./src/icon.js");
3 years ago
3 years ago
var _icon2 = _interopRequireDefault(_icon);
3 years ago
3 years ago
var _icons = __webpack_require__(/*! ../dist/icons.json */ "./dist/icons.json");
3 years ago
3 years ago
var _icons2 = _interopRequireDefault(_icons);
3 years ago
3 years ago
var _tags = __webpack_require__(/*! ./tags.json */ "./src/tags.json");
3 years ago
3 years ago
var _tags2 = _interopRequireDefault(_tags);
3 years ago
3 years ago
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = Object.keys(_icons2.default).map(function (key) {
return new _icon2.default(key, _icons2.default[key], _tags2.default[key]);
}).reduce(function (object, icon) {
object[icon.name] = icon;
return object;
}, {});
3 years ago
/***/ }),
3 years ago
/***/ "./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
3 years ago
/*! no static exports found */
3 years ago
/***/ (function(module, exports, __webpack_require__) {
3 years ago
3 years ago
var _icons = __webpack_require__(/*! ./icons */ "./src/icons.js");
3 years ago
3 years ago
var _icons2 = _interopRequireDefault(_icons);
3 years ago
3 years ago
var _toSvg = __webpack_require__(/*! ./to-svg */ "./src/to-svg.js");
3 years ago
3 years ago
var _toSvg2 = _interopRequireDefault(_toSvg);
3 years ago
3 years ago
var _replace = __webpack_require__(/*! ./replace */ "./src/replace.js");
var _replace2 = _interopRequireDefault(_replace);
3 years ago
3 years ago
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = { icons: _icons2.default, toSvg: _toSvg2.default, replace: _replace2.default };
3 years ago
/***/ }),
3 years ago
/***/ "./src/replace.js":
/*!************************!*\
!*** ./src/replace.js ***!
\************************/
3 years ago
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
Object.defineProperty(exports, "__esModule", {
value: true
});
3 years ago
3 years ago
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]; } } } return target; }; /* eslint-env browser */
3 years ago
3 years ago
var _dedupe = __webpack_require__(/*! classnames/dedupe */ "./node_modules/classnames/dedupe.js");
3 years ago
3 years ago
var _dedupe2 = _interopRequireDefault(_dedupe);
3 years ago
3 years ago
var _icons = __webpack_require__(/*! ./icons */ "./src/icons.js");
3 years ago
3 years ago
var _icons2 = _interopRequireDefault(_icons);
3 years ago
3 years ago
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3 years ago
3 years ago
/**
* Replace all HTML elements that have a `data-feather` attribute with SVG markup
* corresponding to the element's `data-feather` attribute value.
* @param {Object} attrs
*/
function replace() {
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (typeof document === 'undefined') {
throw new Error('`feather.replace()` only works in a browser environment.');
3 years ago
}
3 years ago
var elementsToReplace = document.querySelectorAll('[data-feather]');
Array.from(elementsToReplace).forEach(function (element) {
return replaceElement(element, attrs);
});
}
/**
* Replace a single HTML element with SVG markup
* corresponding to the element's `data-feather` attribute value.
* @param {HTMLElement} element
* @param {Object} attrs
*/
function replaceElement(element) {
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var elementAttrs = getAttrs(element);
var name = elementAttrs['data-feather'];
delete elementAttrs['data-feather'];
var svgString = _icons2.default[name].toSvg(_extends({}, attrs, elementAttrs, { class: (0, _dedupe2.default)(attrs.class, elementAttrs.class) }));
var svgDocument = new DOMParser().parseFromString(svgString, 'image/svg+xml');
var svgElement = svgDocument.querySelector('svg');
element.parentNode.replaceChild(svgElement, element);
}
/**
* Get the attributes of an HTML element.
* @param {HTMLElement} element
* @returns {Object}
*/
function getAttrs(element) {
return Array.from(element.attributes).reduce(function (attrs, attr) {
attrs[attr.name] = attr.value;
return attrs;
}, {});
}
3 years ago
3 years ago
exports.default = replace;
3 years ago
/***/ }),
3 years ago
/***/ "./src/tags.json":
/*!***********************!*\
!*** ./src/tags.json ***!
\***********************/
/*! exports provided: activity, airplay, alert-circle, alert-octagon, alert-triangle, align-center, align-justify, align-left, align-right, anchor, archive, at-sign, award, aperture, bar-chart, bar-chart-2, battery, battery-charging, bell, bell-off, bluetooth, book-open, book, bookmark, box, briefcase, calendar, camera, cast, circle, clipboard, clock, cloud-drizzle, cloud-lightning, cloud-rain, cloud-snow, cloud, codepen, codesandbox, code, coffee, columns, command, compass, copy, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, cpu, credit-card, crop, crosshair, database, delete, disc, dollar-sign, droplet, edit, edit-2, edit-3, eye, eye-off, external-link, facebook, fast-forward, figma, file-minus, file-plus, file-text, film, filter, flag, folder-minus, folder-plus, folder, framer, frown, gift, git-branch, git-commit, git-merge, git-pull-request, github, gitlab, globe, hard-drive, hash, headphones, heart, help-circle, hexagon, home, image, inbox, instagram, key, layers, layout, life-bouy, link, link-2, linkedin, list, lock, log-in, log-out, mail, map-pin, map, maximize, maximize-2, meh, menu, message-circle, message-square, mic-off, mic, minimize, minimize-2, minus, monitor, moon, more-horizontal, more-vertical, mouse-pointer, move, music, navigation, navigation-2, octagon, package, paperclip, pause, pause-circle, pen-tool, percent, phone-call, phone-forwarded, phone-incoming, phone-missed, phone-off, phone-outgoing, phone, play, pie-chart, play-circle, plus, plus-circle, plus-square, pocket, power, printer, radio, refresh-cw, refresh-ccw, repeat, rewind, rotate-ccw, rotate-cw, rss, save, scissors, search, send, settings, share-2, shield, shield-off, shopping-bag, shopping-cart, shuffle, skip-back, skip-forward, slack, slash, sliders, smartphone, smile, speaker, star, stop-circle, sun, sunrise, sunset, tablet, tag, target, terminal, thermometer, thumbs-down, thumbs-up, toggle-left, toggle-right, tool, trash, trash-2, triangle, truck, tv, twitch, twitter, type, umbrella, unlock, user-check, user-minus, user-plus, user-x, user, users, video-off, video, voicemail, volume, volume-1, volume-2, volume-x, watch, wifi-off, wifi, wind, x-circle, x-octagon, x-square, x, youtube, zap-off, zap, zoom-in, zoom-out, default */
/***/ (function(module) {
3 years ago
3 years ago
module.exports = {"activity":["pulse","health","action","motion"],"airplay":["stream","cast","mirroring"],"alert-circle":["warning","alert","danger"],"alert-octagon":["warning","alert","danger"],"alert-triangle":["warning","alert","danger"],"align-center":["text alignment","center"],"align-justify":["text alignment","justified"],"align-left":["text alignment","left"],"align-right":["text alignment","right"],"anchor":[],"archive":["index","box"],"at-sign":["mention","at","email","message"],"award":["achievement","badge"],"aperture":["camera","photo"],"bar-chart":["statistics","diagram","graph"],"bar-chart-2":["statistics","diagram","graph"],"battery":["power","electricity"],"battery-charging":["power","electricity"],"bell":["alarm","notification","sound"],"bell-off":["alarm","notification","silent"],"bluetooth":["wireless"],"book-open":["read","library"],"book":["read","dictionary","booklet","magazine","library"],"bookmark":["read","clip","marker","tag"],"box":["cube"],"briefcase":["work","bag","baggage","folder"],"calendar":["date"],"camera":["photo"],"cast":["chromecast","airplay"],"circle":["off","zero","record"],"clipboard":["copy"],"clock":["time","watch","alarm"],"cloud-drizzle":["weather","shower"],"cloud-lightning":["weather","bolt"],"cloud-rain":["weather"],"cloud-snow":["weather","blizzard"],"cloud":["weather"],"codepen":["logo"],"codesandbox":["logo"],"code":["source","programming"],"coffee":["drink","cup","mug","tea","cafe","hot","beverage"],"columns":["layout"],"command":["keyboard","cmd","terminal","prompt"],"compass":["navigation","safari","travel","direction"],"copy":["clone","duplicate"],"corner-down-left":["arrow","return"],"corner-down-right":["arrow"],"corner-left-down":["arrow"],"corner-left-up":["arrow"],"corner-right-down":["arrow"],"corner-right-up":["arrow"],"corner-up-left":["arrow"],"corner-up-right":["arrow"],"cpu":["processor","technology"],"credit-card":["purchase","payment","cc"],"crop":["photo","image"],"crosshair":["aim","target"],"database":["storage","memory"],"delete":["remove"],"disc":["album","cd","dvd","music"],"dollar-sign":["currency","money","payment"],"droplet":["water"],"edit":["pencil","change"],"edit-2":["pencil","change"],"edit-3":["pencil","change"],"eye":["view","watch"],"eye-off":["view","watch","hide","hidden"],"external-link":["outbound"],"facebook":["logo","social"],"fast-forward":["music"],"figma":["logo","design","tool"],"file-minus":["delete","remove","erase"],"file-plus":["add","create","new"],"file-text":["data","txt","pdf"],"film":["movie","video"],"filter":["funnel","hopper"],"flag":["report"],"folder-minus":["directory"],"folder-plus":["directory"],"folder":["directory"],"framer":["logo","design","tool"],"frown":["emoji","face","bad","sad","emotion"],"gift":["present","box","birthday","party"],"git-branch":["code","version control"],"git-commit":["code","version control"],"git-merge":["code","version control"],"git-pull-request":["code","version control"],"github":["logo","version control"],"gitlab":["logo","version control"],"globe":["world","browser","language","translate"],"hard-drive":["computer","server","memory","data"],"hash":["hashtag","number","pound"],"headphones":["music","audio","sound"],"heart":["like","love","emotion"],"help-circle":["question mark"],"hexagon":["shape","node.js","logo"],"home":["house","living"],"image":["picture"],"inbox":["email"],"instagram":["logo","camera"],"key":["password","login","authentication","secure"],"layers":["stack"],"layout":["window","webpage"],"life-bouy":["help","life ring","support"],"link":["chain","url"],"link-2":["chain","url"],"linkedin":["logo","social media"],"list":["options"],"lock":["security","password","secure"],"log-in":["sign in","arrow","enter"],"log-out":["sign out","arrow","exit"],"mail":["email","message"],"map-pin":["location","navigation","travel","marker"],"map":["location","navigation","travel"],"maximize":["fullscreen"],"maximize-2":["fullscreen","arrows","expand"],"meh":["emoji","face","neutral","emotion"],"menu":["bars","navigation","hamburger"],"message-circle":["comment","chat"],"mess
3 years ago
3 years ago
/***/ }),
/***/ "./src/to-svg.js":
/*!***********************!*\
!*** ./src/to-svg.js ***!
\***********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
3 years ago
Object.defineProperty(exports, "__esModule", {
value: true
});
3 years ago
3 years ago
var _icons = __webpack_require__(/*! ./icons */ "./src/icons.js");
3 years ago
3 years ago
var _icons2 = _interopRequireDefault(_icons);
3 years ago
3 years ago
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3 years ago
3 years ago
/**
* Create an SVG string.
* @deprecated
* @param {string} name
* @param {Object} attrs
* @returns {string}
*/
function toSvg(name) {
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3 years ago
3 years ago
console.warn('feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead.');
3 years ago
3 years ago
if (!name) {
throw new Error('The required `key` (icon name) parameter is missing.');
}
3 years ago
3 years ago
if (!_icons2.default[name]) {
throw new Error('No icon matching \'' + name + '\'. See the complete list of icons at https://feathericons.com');
}
3 years ago
3 years ago
return _icons2.default[name].toSvg(attrs);
}
3 years ago
3 years ago
exports.default = toSvg;
3 years ago
/***/ }),
3 years ago
/***/ 0:
3 years ago
/*!**************************************************!*\
3 years ago
!*** multi core-js/es/array/from ./src/index.js ***!
3 years ago
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
3 years ago
__webpack_require__(/*! core-js/es/array/from */"./node_modules/core-js/es/array/from.js");
module.exports = __webpack_require__(/*! /home/travis/build/feathericons/feather/src/index.js */"./src/index.js");
3 years ago
3 years ago
/***/ })
/******/ });
});
});
/**
* This module contains various utility functions commonly used in Obsidian plugins.
* @module obsidian-community-lib
*/
/**
* Adds a specific Feather Icon to Obsidian.
*
* @param name official Name of the Icon (https://feathericons.com/)
* @param attr SVG Attributes for the Icon. The default should work for most usecases.
* @returns {string} Icon name
*/
function addFeatherIcon(name, attr = { viewBox: "0 0 24 24", width: "100", height: "100" }) {
if (feather.icons[name]) {
const iconName = `feather-${name}`;
obsidian.addIcon(iconName, feather.icons[name].toSvg(attr));
return iconName;
}
else {
throw Error(`This Icon (${name}) doesn't exist in the Feather Library.`);
}
}
/**
* Copy `content` to the users clipboard.
*
* @param {string} content The content to be copied to clipboard.
* @param {() => any} success The callback to run when text is successfully copied. Default throws a new `Notice`
* @param {(reason?) => any} failure The callback to run when text was not able to be copied. Default throws a new `Notice`, and console logs the error.`
*/
async function copy(content, success = () => new obsidian.Notice("Copied to clipboard"), failure = (reason) => {
new obsidian.Notice("Could not copy to clipboard");
console.log({ reason });
}) {
await navigator.clipboard.writeText(content).then(success, failure);
}
/**
* Check if `noteName` is the name of a note that exists in the vault.
* @param {App} app
* @param {string} noteName Basename of the note to search for.
* @param {string} [sourcePath=""] Optional file path to start searching from. Default is the current file.
* @returns boolean
*/
const isInVault = (app, noteName, sourcePath = "") => !!app.metadataCache.getFirstLinkpathDest(noteName, sourcePath);
function createNewNote(plugin, item) {
return __awaiter(this, void 0, void 0, function* () {
const activeFile = plugin.app.workspace.getActiveFile();
let dir = plugin.app.fileManager.getNewFileParent(activeFile ? activeFile.path : "").path;
if (plugin.settings.saveLocation === "custom") {
dir = plugin.settings.saveLocationFolder;
}
//make sure there are no slashes in the title.
const title = item.title.replace(/[\/\\:]/g, ' ');
3 years ago
const inputPrompt = new TextInputPrompt(plugin.app, t("specify_name"), t("cannot_contain") + " * \" \\ / < > : | ?", title, title);
3 years ago
if (plugin.settings.askForFilename) {
yield inputPrompt
.openAndGetValue((text) => __awaiter(this, void 0, void 0, function* () {
const value = text.getValue();
if (value.match(FILE_NAME_REGEX)) {
3 years ago
inputPrompt.setValidationError(text, t("invalid_filename"));
3 years ago
return;
}
const filePath = obsidian.normalizePath([dir, `${value}.md`].join('/'));
if (isInVault(plugin.app, filePath, '')) {
3 years ago
inputPrompt.setValidationError(text, t("note_exists"));
3 years ago
return;
}
inputPrompt.close();
yield createNewFile(plugin, item, filePath, value);
}));
}
else {
const replacedTitle = item.title.replace(FILE_NAME_REGEX, '');
const filePath = obsidian.normalizePath([dir, `${replacedTitle}.md`].join('/'));
yield createNewFile(plugin, item, filePath, item.title);
}
});
}
function createNewFile(plugin, item, path, title) {
return __awaiter(this, void 0, void 0, function* () {
if (isInVault(plugin.app, path, '')) {
3 years ago
new obsidian.Notice(t("note_exists"));
3 years ago
return;
}
const appliedTemplate = applyTemplate(item, plugin.settings.template, plugin.settings, title);
const file = yield plugin.app.vault.create(path, appliedTemplate);
yield plugin.app.workspace.activeLeaf.openFile(file, {
state: { mode: 'edit' },
});
item.created = true;
const items = plugin.settings.items;
yield plugin.writeFeedContent(() => {
return items;
});
3 years ago
new obsidian.Notice(t("created_note"));
3 years ago
});
}
function pasteToNote(plugin, item) {
return __awaiter(this, void 0, void 0, function* () {
const file = plugin.app.workspace.getActiveFile();
if (file === null) {
3 years ago
new obsidian.Notice(t("no_file_active"));
3 years ago
return;
}
const view = plugin.app.workspace.getActiveViewOfType(obsidian.MarkdownView);
if (view) {
const appliedTemplate = applyTemplate(item, plugin.settings.pasteTemplate, plugin.settings);
const editor = view.editor;
editor.replaceRange(appliedTemplate, editor.getCursor());
item.created = true;
const items = plugin.settings.items;
yield plugin.writeFeedContent(() => {
return items;
});
3 years ago
new obsidian.Notice(t("RSS_Reader") + t("inserted_article"));
3 years ago
}
});
}
function applyTemplate(item, template, settings, filename) {
const content = obsidian.htmlToMarkdown(item.content);
let result = replaceAll(template, "{{title}}", item.title);
result = replaceAll(result, "{{link}}", item.link);
result = replaceAll(result, "{{author}}", item.creator);
result = replaceAll(result, "{{content}}", content);
result = replaceAll(result, "{{published}}", window.moment(item.pubDate).format(settings.dateFormat));
result = replaceAll(result, "{{feed}}", item.feed);
result = replaceAll(result, "{{folder}}", item.folder);
result = replaceAll(result, "{{description}}", item.description);
result = result.replace(/({{tags:).*(}})/g, function (k) {
const value = k.split(":")[1];
const separator = value.substring(0, value.indexOf("}"));
return item.tags.join(separator);
});
result = result.replace(/({{#tags:).*(}})/g, function (k) {
const value = k.split(":")[1];
const separator = value.substring(0, value.indexOf("}"));
return item.tags.map(i => '#' + i).join(separator);
});
result = replaceAll(result, "{{tags}}", item.tags.join(", "));
result = replaceAll(result, "{{#tags}}", item.tags.map(i => '#' + i).join(", "));
if (filename) {
result = replaceAll(result, "{{filename}}", filename);
result = replaceAll(result, "{{created}}", window.moment().format(settings.dateFormat));
3 years ago
}
3 years ago
return result;
}
function openInBrowser(item) {
if (typeof item.link === "string") {
window.open(item.link, '_blank');
3 years ago
}
3 years ago
}
//taken from: https://stackoverflow.com/a/1144788/5589264
function escapeRegExp(string) {
return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
function replaceAll(str, find, replace) {
return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
3 years ago
3 years ago
class TagSuggest extends TextInputSuggest {
getSuggestions(inputStr) {
const tags = get_store_value(tagsStore);
const lowerCaseInputStr = inputStr.toLowerCase();
return [...tags].filter((tag) => tag.contains(lowerCaseInputStr));
}
renderSuggestion(tag, el) {
el.setText(tag);
}
selectSuggestion(tag) {
this.inputEl.value = tag;
this.inputEl.trigger("input");
this.close();
}
}
3 years ago
class TagModal extends BaseModal {
constructor(plugin, tags) {
super(plugin.app);
this.plugin = plugin;
this.tags = tags;
}
display() {
const { contentEl } = this;
contentEl.empty();
3 years ago
contentEl.createEl("h1", { text: t("edit_tags") });
3 years ago
const tagDiv = contentEl.createDiv("tags");
for (const tag in this.tags) {
3 years ago
new obsidian.Setting(tagDiv)
.addSearch((search) => __awaiter(this, void 0, void 0, function* () {
new TagSuggest(this.app, search.inputEl);
search
.setValue(this.tags[tag])
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
if (!value.match(TAG_REGEX) || value.match(NUMBER_REGEX) || value.contains(" ") || value.contains('#')) {
3 years ago
this.setValidationError(search, t("invalid_tag"));
3 years ago
return;
}
this.tags = this.tags.filter(e => e !== this.tags[tag]);
this.tags.push(value);
}));
}))
.addExtraButton((button) => {
button
3 years ago
.setTooltip(t("delete"))
3 years ago
.setIcon("trash")
3 years ago
.onClick(() => {
this.tags = this.tags.filter(e => e !== this.tags[tag]);
this.display();
});
});
}
3 years ago
let tagValue = "";
let tagComponent;
const newTag = new obsidian.Setting(tagDiv)
.addSearch((search) => __awaiter(this, void 0, void 0, function* () {
tagComponent = search;
new TagSuggest(this.app, search.inputEl);
search
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
if (!value.match(TAG_REGEX) || value.match(NUMBER_REGEX) || value.contains(" ") || value.contains('#')) {
3 years ago
this.setValidationError(search, t("invalid_tag"));
3 years ago
return;
}
3 years ago
tagValue = value;
3 years ago
}));
3 years ago
})).addExtraButton(button => {
button
.setTooltip("Create")
.setIcon("create-new")
.onClick(() => {
if (!tagValue.match(TAG_REGEX) || tagValue.match(NUMBER_REGEX) || tagValue.contains(" ") || tagValue.contains('#')) {
3 years ago
this.setValidationError(tagComponent, t("invalid_tag"));
3 years ago
return;
}
this.tags.push(tagValue);
this.display();
});
});
newTag.controlEl.addClass("rss-setting-input");
const buttonEl = contentEl.createSpan("actionButtons");
3 years ago
new obsidian.Setting(buttonEl).addExtraButton((btn) => btn
.setTooltip(t("save"))
.setIcon("checkmark")
.onClick(() => __awaiter(this, void 0, void 0, function* () {
3 years ago
this.close();
})));
}
onClose() {
const { contentEl } = this;
contentEl.empty();
}
onOpen() {
return __awaiter(this, void 0, void 0, function* () {
yield this.display();
});
}
}
3 years ago
3 years ago
class Action {
constructor(name, icon, processor) {
this.name = name;
this.icon = icon;
this.processor = processor;
}
}
3 years ago
Action.CREATE_NOTE = new Action(t("create_note"), "create-new", (plugin, item) => {
3 years ago
return createNewNote(plugin, item);
});
3 years ago
Action.PASTE = new Action(t("paste_to_note"), "paste", (plugin, item) => {
3 years ago
return pasteToNote(plugin, item);
});
3 years ago
Action.COPY = new Action(t("copy_to_clipboard"), "feather-clipboard", ((_, item) => {
3 years ago
return copy(obsidian.htmlToMarkdown(item.content));
}));
3 years ago
Action.OPEN = new Action(t("open_browser"), "open-elsewhere-glyph", ((_, item) => {
3 years ago
openInBrowser(item);
return Promise.resolve();
}));
3 years ago
Action.TAGS = new Action(t("edit_tags"), "tag-glyph", (((plugin, item) => {
3 years ago
const modal = new TagModal(plugin, item.tags);
modal.onClose = () => __awaiter(void 0, void 0, void 0, function* () {
item.tags = modal.tags;
const items = plugin.settings.items;
yield plugin.writeFeedContent(() => {
return items;
});
});
modal.open();
return Promise.resolve();
})));
3 years ago
Action.READ = new Action(t("mark_as_read_unread"), "feather-eye", (((plugin, item) => __awaiter(void 0, void 0, void 0, function* () {
3 years ago
if (item.read) {
item.read = false;
3 years ago
new obsidian.Notice(t("marked_as_unread"));
3 years ago
}
else {
item.read = true;
3 years ago
new obsidian.Notice(t("marked_as_read"));
3 years ago
}
const items = plugin.settings.items;
yield plugin.writeFeedContent(() => {
return items;
});
return Promise.resolve();
}))));
3 years ago
Action.FAVORITE = new Action(t("mark_as_favorite_remove"), "star", (((plugin, item) => __awaiter(void 0, void 0, void 0, function* () {
3 years ago
if (item.favorite) {
item.favorite = false;
3 years ago
new obsidian.Notice(t("removed_from_favorites"));
3 years ago
}
else {
item.favorite = true;
3 years ago
new obsidian.Notice(t("added_to_favorites"));
3 years ago
}
const items = plugin.settings.items;
yield plugin.writeFeedContent(() => {
return items;
});
return Promise.resolve();
}))));
Action.actions = Array.of(Action.FAVORITE, Action.READ, Action.TAGS, Action.CREATE_NOTE, Action.PASTE, Action.COPY, Action.OPEN);
3 years ago
3 years ago
class ItemModal extends obsidian.Modal {
constructor(plugin, item) {
super(plugin.app);
this.plugin = plugin;
this.item = item;
item.read = true;
const items = this.plugin.settings.items;
this.plugin.writeFeedContent(() => {
return items;
});
3 years ago
if (this.plugin.settings.hotkeys.read) {
this.scope.register([], this.plugin.settings.hotkeys.read, () => {
this.markAsRead();
});
}
if (this.plugin.settings.hotkeys.favorite) {
this.scope.register([], this.plugin.settings.hotkeys.favorite, () => {
this.markAsFavorite();
});
}
if (this.plugin.settings.hotkeys.create) {
this.scope.register([], this.plugin.settings.hotkeys.create, () => {
Action.CREATE_NOTE.processor(this.plugin, this.item);
});
}
if (this.plugin.settings.hotkeys.paste) {
this.scope.register([], this.plugin.settings.hotkeys.paste, () => {
Action.PASTE.processor(this.plugin, this.item);
});
}
if (this.plugin.settings.hotkeys.copy) {
this.scope.register([], this.plugin.settings.hotkeys.copy, () => {
Action.COPY.processor(this.plugin, this.item);
});
}
if (this.plugin.settings.hotkeys.tags) {
this.scope.register([], this.plugin.settings.hotkeys.tags, () => {
Action.TAGS.processor(this.plugin, this.item);
});
}
if (this.plugin.settings.hotkeys.open) {
this.scope.register([], this.plugin.settings.hotkeys.open, () => {
Action.OPEN.processor(this.plugin, this.item);
});
}
//@ts-ignore
if (this.app.plugins.plugins["obsidian-tts"] && this.plugin.settings.hotkeys.tts) {
this.scope.register([], this.plugin.settings.hotkeys.tts, () => {
//@ts-ignore
const tts = this.app.plugins.plugins["obsidian-tts"].ttsService;
if (tts.isSpeaking()) {
if (tts.isPaused()) {
tts.resume();
}
else {
tts.pause();
}
return;
}
const content = obsidian.htmlToMarkdown(this.item.content);
tts.say(this.item.title, content, this.item.language);
});
}
3 years ago
}
markAsFavorite() {
return __awaiter(this, void 0, void 0, function* () {
yield Action.FAVORITE.processor(this.plugin, this.item);
this.favoriteButton.setIcon((this.item.favorite) ? 'star-glyph' : 'star');
3 years ago
this.favoriteButton.setTooltip((this.item.favorite) ? t("remove_from_favorites") : t("mark_as_favorite"));
3 years ago
});
}
markAsRead() {
return __awaiter(this, void 0, void 0, function* () {
yield Action.READ.processor(this.plugin, this.item);
this.readButton.setIcon((this.item.read) ? 'feather-eye-off' : 'feather-eye');
3 years ago
this.readButton.setTooltip((this.item.read) ? t("mark_as_unread") : t("mark_as_unread"));
3 years ago
});
}
display() {
const { contentEl } = this;
contentEl.empty();
const topButtons = contentEl.createSpan('topButtons');
const title = contentEl.createEl('h1', 'rss-title');
title.setText(this.item.title);
const subtitle = contentEl.createEl("h3", "rss-subtitle");
if (this.item.creator) {
subtitle.appendText(this.item.creator);
}
if (this.item.pubDate) {
subtitle.appendText(" - " + window.moment(this.item.pubDate).format(this.plugin.settings.dateFormat));
}
const tagEl = contentEl.createSpan("tags");
this.item.tags.forEach((tag) => {
const tagA = tagEl.createEl("a");
tagA.setText(tag);
tagA.addClass("tag", "rss-tag");
});
this.readButton = new obsidian.ButtonComponent(topButtons)
.setIcon(this.item.read ? 'feather-eye-off' : 'feather-eye')
3 years ago
.setTooltip(this.item.read ? t("mark_as_unread") : t("mark_as_read"))
3 years ago
.onClick(() => __awaiter(this, void 0, void 0, function* () {
yield this.markAsRead();
}));
this.readButton.buttonEl.setAttribute("tabindex", "-1");
this.favoriteButton = new obsidian.ButtonComponent(topButtons)
.setIcon(this.item.favorite ? 'star-glyph' : 'star')
3 years ago
.setTooltip(this.item.favorite ? t("remove_from_favorites") : t("mark_as_favorite"))
3 years ago
.onClick(() => __awaiter(this, void 0, void 0, function* () {
yield this.markAsFavorite();
}));
this.favoriteButton.buttonEl.setAttribute("tabindex", "-1");
Array.of(Action.TAGS, Action.CREATE_NOTE, Action.PASTE, Action.COPY, Action.OPEN).forEach((action) => {
const button = new obsidian.ButtonComponent(topButtons)
.setIcon(action.icon)
.setTooltip(action.name)
.onClick(() => __awaiter(this, void 0, void 0, function* () {
yield action.processor(this.plugin, this.item);
}));
button.buttonEl.setAttribute("tabindex", "-1");
});
3 years ago
//@ts-ignore
if (this.app.plugins.plugins["obsidian-tts"]) {
new obsidian.ButtonComponent(topButtons)
.setIcon("feather-headphones")
3 years ago
.setTooltip(t("read_article_tts"))
3 years ago
.onClick(() => __awaiter(this, void 0, void 0, function* () {
const content = obsidian.htmlToMarkdown(this.item.content);
//@ts-ignore
yield this.app.plugins.plugins["obsidian-tts"].ttsService.say(this.item.title, content, this.item.language);
}));
}
3 years ago
const content = contentEl.createDiv('rss-content');
content.addClass("scrollable-content");
3 years ago
if (this.item.enclosure) {
if (this.item.enclosureType.toLowerCase().contains("audio")) {
const audio = content.createEl("audio", { attr: { controls: "controls" } });
audio.createEl("source", { attr: { src: this.item.enclosure, type: this.item.enclosureType } });
}
}
3 years ago
if (this.item.content) {
content.append(sanitizeHTMLToDom(this.item.content));
}
}
onClose() {
const { contentEl } = this;
contentEl.empty();
}
onOpen() {
return __awaiter(this, void 0, void 0, function* () {
yield this.display();
});
}
}
3 years ago
3 years ago
/* src/view/HtmlTooltip.svelte generated by Svelte v3.44.2 */
3 years ago
3 years ago
function create_if_block$3(ctx) {
3 years ago
let p;
3 years ago
let html_action;
let mounted;
let dispose;
3 years ago
3 years ago
return {
c() {
3 years ago
p = element("p");
attr(p, "class", "tooltiptext");
3 years ago
},
m(target, anchor) {
3 years ago
insert(target, p, anchor);
3 years ago
3 years ago
if (!mounted) {
3 years ago
dispose = action_destroyer(html_action = /*html*/ ctx[1].call(null, p, /*content*/ ctx[0]));
3 years ago
mounted = true;
}
},
p(ctx, dirty) {
if (html_action && is_function(html_action.update) && dirty & /*content*/ 1) html_action.update.call(null, /*content*/ ctx[0]);
},
d(detaching) {
3 years ago
if (detaching) detach(p);
3 years ago
mounted = false;
dispose();
}
};
}
3 years ago
3 years ago
function create_fragment$3(ctx) {
let if_block_anchor;
let if_block = /*content*/ ctx[0].length > 0 && create_if_block$3(ctx);
3 years ago
3 years ago
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
},
p(ctx, [dirty]) {
if (/*content*/ ctx[0].length > 0) {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block$3(ctx);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
i: noop,
o: noop,
d(detaching) {
if (if_block) if_block.d(detaching);
if (detaching) detach(if_block_anchor);
}
};
}
3 years ago
3 years ago
function instance$3($$self, $$props, $$invalidate) {
let { content = "" } = $$props;
3 years ago
3 years ago
const html = (node, content) => {
node.append(sanitizeHTMLToDom(content));
};
3 years ago
3 years ago
$$self.$$set = $$props => {
if ('content' in $$props) $$invalidate(0, content = $$props.content);
};
3 years ago
3 years ago
return [content, html];
}
3 years ago
3 years ago
class HtmlTooltip extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$3, create_fragment$3, safe_not_equal, { content: 0 });
}
}
3 years ago
3 years ago
/* src/view/ItemView.svelte generated by Svelte v3.44.2 */
3 years ago
3 years ago
function get_each_context$2(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[6] = list[i];
return child_ctx;
}
3 years ago
3 years ago
// (46:0) {#if item}
function create_if_block$2(ctx) {
3 years ago
let li;
3 years ago
let t0;
let t1;
let a;
let t2_value = /*item*/ ctx[1].title + "";
let t2;
let t3;
let t4;
3 years ago
let li_class_value;
3 years ago
let current;
let mounted;
let dispose;
3 years ago
let if_block0 = /*item*/ ctx[1].favorite && create_if_block_5$1();
let if_block1 = /*item*/ ctx[1].created && create_if_block_4$1();
let if_block2 = /*item*/ ctx[1].tags.length > 0 && create_if_block_3$1(ctx);
let if_block3 = /*hover*/ ctx[2] && create_if_block_1$2(ctx);
3 years ago
3 years ago
return {
c() {
3 years ago
li = element("li");
3 years ago
if (if_block0) if_block0.c();
t0 = space();
if (if_block1) if_block1.c();
t1 = space();
a = element("a");
t2 = text(t2_value);
t3 = space();
if (if_block2) if_block2.c();
3 years ago
t4 = space();
if (if_block3) if_block3.c();
attr(li, "class", li_class_value = "is-clickable rss-tooltip rss-feed-item " + (/*item*/ ctx[1].read ? 'rss-read' : 'rss-not-read'));
3 years ago
},
m(target, anchor) {
3 years ago
insert(target, li, anchor);
if (if_block0) if_block0.m(li, null);
append(li, t0);
if (if_block1) if_block1.m(li, null);
append(li, t1);
append(li, a);
3 years ago
append(a, t2);
3 years ago
append(li, t3);
if (if_block2) if_block2.m(li, null);
append(li, t4);
if (if_block3) if_block3.m(li, null);
3 years ago
current = true;
3 years ago
3 years ago
if (!mounted) {
dispose = [
listen(a, "click", /*click_handler*/ ctx[5]),
listen(a, "contextmenu", /*openMenu*/ ctx[4]),
listen(a, "mouseover", /*toggleHover*/ ctx[3]),
listen(a, "mouseleave", /*toggleHover*/ ctx[3])
];
3 years ago
3 years ago
mounted = true;
}
},
p(ctx, dirty) {
if (/*item*/ ctx[1].favorite) {
if (if_block0) {
if (dirty & /*item*/ 2) {
transition_in(if_block0, 1);
}
} else {
3 years ago
if_block0 = create_if_block_5$1();
3 years ago
if_block0.c();
transition_in(if_block0, 1);
3 years ago
if_block0.m(li, t0);
3 years ago
}
} else if (if_block0) {
group_outros();
3 years ago
3 years ago
transition_out(if_block0, 1, 1, () => {
if_block0 = null;
});
3 years ago
3 years ago
check_outros();
}
3 years ago
3 years ago
if (/*item*/ ctx[1].created) {
if (if_block1) {
if (dirty & /*item*/ 2) {
transition_in(if_block1, 1);
}
} else {
3 years ago
if_block1 = create_if_block_4$1();
3 years ago
if_block1.c();
transition_in(if_block1, 1);
3 years ago
if_block1.m(li, t1);
3 years ago
}
} else if (if_block1) {
group_outros();
3 years ago
3 years ago
transition_out(if_block1, 1, 1, () => {
if_block1 = null;
});
3 years ago
3 years ago
check_outros();
}
3 years ago
3 years ago
if ((!current || dirty & /*item*/ 2) && t2_value !== (t2_value = /*item*/ ctx[1].title + "")) set_data(t2, t2_value);
3 years ago
3 years ago
if (/*item*/ ctx[1].tags.length > 0) {
if (if_block2) {
if_block2.p(ctx, dirty);
} else {
if_block2 = create_if_block_3$1(ctx);
if_block2.c();
if_block2.m(li, t4);
3 years ago
}
3 years ago
} else if (if_block2) {
if_block2.d(1);
if_block2 = null;
3 years ago
}
3 years ago
3 years ago
if (/*hover*/ ctx[2]) {
3 years ago
if (if_block3) {
if_block3.p(ctx, dirty);
3 years ago
3 years ago
if (dirty & /*hover*/ 4) {
3 years ago
transition_in(if_block3, 1);
3 years ago
}
} else {
3 years ago
if_block3 = create_if_block_1$2(ctx);
if_block3.c();
transition_in(if_block3, 1);
if_block3.m(li, null);
3 years ago
}
3 years ago
} else if (if_block3) {
3 years ago
group_outros();
3 years ago
3 years ago
transition_out(if_block3, 1, 1, () => {
if_block3 = null;
3 years ago
});
3 years ago
3 years ago
check_outros();
}
3 years ago
if (!current || dirty & /*item*/ 2 && li_class_value !== (li_class_value = "is-clickable rss-tooltip rss-feed-item " + (/*item*/ ctx[1].read ? 'rss-read' : 'rss-not-read'))) {
attr(li, "class", li_class_value);
}
3 years ago
},
i(local) {
if (current) return;
transition_in(if_block0);
transition_in(if_block1);
3 years ago
transition_in(if_block3);
3 years ago
current = true;
},
o(local) {
transition_out(if_block0);
transition_out(if_block1);
3 years ago
transition_out(if_block3);
3 years ago
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(li);
3 years ago
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
if (if_block2) if_block2.d();
3 years ago
if (if_block3) if_block3.d();
3 years ago
mounted = false;
run_all(dispose);
}
};
}
3 years ago
3 years ago
// (48:8) {#if (item.favorite)}
function create_if_block_5$1(ctx) {
3 years ago
let iconcomponent;
let current;
iconcomponent = new IconComponent({ props: { iconName: "star" } });
3 years ago
3 years ago
return {
c() {
create_component(iconcomponent.$$.fragment);
},
m(target, anchor) {
mount_component(iconcomponent, target, anchor);
current = true;
},
i(local) {
if (current) return;
transition_in(iconcomponent.$$.fragment, local);
current = true;
},
o(local) {
transition_out(iconcomponent.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(iconcomponent, detaching);
}
};
}
3 years ago
3 years ago
// (51:8) {#if (item.created)}
function create_if_block_4$1(ctx) {
3 years ago
let iconcomponent;
let current;
iconcomponent = new IconComponent({ props: { iconName: "document" } });
3 years ago
3 years ago
return {
c() {
create_component(iconcomponent.$$.fragment);
},
m(target, anchor) {
mount_component(iconcomponent, target, anchor);
current = true;
},
i(local) {
if (current) return;
transition_in(iconcomponent.$$.fragment, local);
current = true;
},
o(local) {
transition_out(iconcomponent.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(iconcomponent, detaching);
}
};
}
3 years ago
3 years ago
// (64:8) {#if item.tags.length > 0}
function create_if_block_3$1(ctx) {
let span;
let each_value = /*item*/ ctx[1].tags;
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i));
}
return {
c() {
span = element("span");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
},
m(target, anchor) {
insert(target, span, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(span, null);
}
},
p(ctx, dirty) {
if (dirty & /*item*/ 2) {
each_value = /*item*/ ctx[1].tags;
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$2(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block$2(child_ctx);
each_blocks[i].c();
each_blocks[i].m(span, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
d(detaching) {
if (detaching) detach(span);
destroy_each(each_blocks, detaching);
}
};
}
// (66:16) {#each item.tags as tag}
3 years ago
function create_each_block$2(ctx) {
let t0;
let a;
let t1_value = /*tag*/ ctx[6] + "";
let t1;
3 years ago
let a_href_value;
3 years ago
3 years ago
return {
c() {
t0 = text(" ");
a = element("a");
t1 = text(t1_value);
attr(a, "class", "tag rss-tag");
3 years ago
attr(a, "href", a_href_value = "#" + /*tag*/ ctx[6]);
3 years ago
},
m(target, anchor) {
insert(target, t0, anchor);
insert(target, a, anchor);
append(a, t1);
},
p(ctx, dirty) {
if (dirty & /*item*/ 2 && t1_value !== (t1_value = /*tag*/ ctx[6] + "")) set_data(t1, t1_value);
3 years ago
if (dirty & /*item*/ 2 && a_href_value !== (a_href_value = "#" + /*tag*/ ctx[6])) {
attr(a, "href", a_href_value);
}
3 years ago
},
d(detaching) {
if (detaching) detach(t0);
if (detaching) detach(a);
}
};
3 years ago
}
3 years ago
// (71:8) {#if (hover)}
function create_if_block_1$2(ctx) {
let if_block_anchor;
let current;
let if_block = /*item*/ ctx[1].description !== /*item*/ ctx[1].content && create_if_block_2$2(ctx);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx, dirty) {
if (/*item*/ ctx[1].description !== /*item*/ ctx[1].content) {
if (if_block) {
if_block.p(ctx, dirty);
if (dirty & /*item*/ 2) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block_2$2(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
3 years ago
3 years ago
transition_out(if_block, 1, 1, () => {
if_block = null;
});
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (if_block) if_block.d(detaching);
if (detaching) detach(if_block_anchor);
}
};
}
3 years ago
3 years ago
// (72:12) {#if (item.description !== item.content)}
function create_if_block_2$2(ctx) {
let htmltooltip;
let current;
3 years ago
3 years ago
htmltooltip = new HtmlTooltip({
props: { content: /*item*/ ctx[1].description }
});
3 years ago
3 years ago
return {
c() {
create_component(htmltooltip.$$.fragment);
},
m(target, anchor) {
mount_component(htmltooltip, target, anchor);
current = true;
},
p(ctx, dirty) {
const htmltooltip_changes = {};
if (dirty & /*item*/ 2) htmltooltip_changes.content = /*item*/ ctx[1].description;
htmltooltip.$set(htmltooltip_changes);
},
i(local) {
if (current) return;
transition_in(htmltooltip.$$.fragment, local);
current = true;
},
o(local) {
transition_out(htmltooltip.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(htmltooltip, detaching);
}
};
}
3 years ago
3 years ago
function create_fragment$2(ctx) {
let if_block_anchor;
let current;
let if_block = /*item*/ ctx[1] && create_if_block$2(ctx);
3 years ago
3 years ago
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx, [dirty]) {
if (/*item*/ ctx[1]) {
if (if_block) {
if_block.p(ctx, dirty);
3 years ago
3 years ago
if (dirty & /*item*/ 2) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block$2(ctx);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
3 years ago
3 years ago
transition_out(if_block, 1, 1, () => {
if_block = null;
});
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (if_block) if_block.d(detaching);
if (detaching) detach(if_block_anchor);
}
};
}
3 years ago
3 years ago
function instance$2($$self, $$props, $$invalidate) {
let { plugin = null } = $$props;
let { item = null } = $$props;
let hover = false;
3 years ago
3 years ago
function toggleHover() {
$$invalidate(2, hover = !hover);
}
3 years ago
3 years ago
function openMenu(e) {
return __awaiter(this, void 0, void 0, function* () {
if (e.ctrlKey && e.altKey) {
openInBrowser(item);
return;
}
3 years ago
3 years ago
if (e.ctrlKey) {
yield createNewNote(plugin, item);
return;
}
3 years ago
3 years ago
if (e.altKey) {
yield pasteToNote(plugin, item);
return;
}
3 years ago
3 years ago
const menu = new obsidian.Menu(plugin.app);
3 years ago
3 years ago
Action.actions.forEach(action => {
menu.addItem(menuItem => {
menuItem.setIcon(action.icon).setTitle(action.name).onClick(() => __awaiter(this, void 0, void 0, function* () {
yield action.processor(plugin, item);
}));
});
});
3 years ago
3 years ago
menu.showAtPosition({ x: e.x, y: e.y });
});
}
3 years ago
3 years ago
const click_handler = () => {
new ItemModal(plugin, item).open();
};
3 years ago
3 years ago
$$self.$$set = $$props => {
if ('plugin' in $$props) $$invalidate(0, plugin = $$props.plugin);
if ('item' in $$props) $$invalidate(1, item = $$props.item);
};
3 years ago
3 years ago
return [plugin, item, hover, toggleHover, openMenu, click_handler];
}
3 years ago
3 years ago
class ItemView extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$2, create_fragment$2, safe_not_equal, { plugin: 0, item: 1 });
}
}
3 years ago
3 years ago
/* src/view/FeedView.svelte generated by Svelte v3.44.2 */
3 years ago
3 years ago
function get_each_context$1(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[6] = list[i];
return child_ctx;
}
3 years ago
3 years ago
// (61:0) {:else}
3 years ago
function create_else_block$1(ctx) {
3 years ago
let div3;
let div1;
let div0;
let iconcomponent;
let t0;
let span;
let t1_value = /*feed*/ ctx[0].name + "";
let t1;
let t2;
let div1_class_value;
let t3;
let div2;
3 years ago
let show_if = !/*folded*/ ctx[2].contains(/*feed*/ ctx[0].name);
3 years ago
let current;
let mounted;
let dispose;
3 years ago
iconcomponent = new IconComponent({
props: { iconName: "feather-chevron-down" }
});
3 years ago
let if_block0 = /*feed*/ ctx[0].image && create_if_block_2$1(ctx);
let if_block1 = show_if && create_if_block_1$1(ctx);
3 years ago
3 years ago
return {
c() {
div3 = element("div");
div1 = element("div");
div0 = element("div");
create_component(iconcomponent.$$.fragment);
t0 = space();
span = element("span");
t1 = text(t1_value);
t2 = space();
if (if_block0) if_block0.c();
t3 = space();
div2 = element("div");
if (if_block1) if_block1.c();
attr(div0, "class", "rss-feed-title");
set_style(div0, "overflow", "hidden");
3 years ago
3 years ago
attr(div1, "class", div1_class_value = /*folded*/ ctx[2].contains(/*feed*/ ctx[0].name)
3 years ago
? 'is-collapsed'
: '');
3 years ago
3 years ago
attr(div2, "class", "rss-feed-items");
attr(div3, "class", "rss-feed");
},
m(target, anchor) {
insert(target, div3, anchor);
append(div3, div1);
append(div1, div0);
mount_component(iconcomponent, div0, null);
append(div0, t0);
append(div0, span);
append(span, t1);
append(span, t2);
if (if_block0) if_block0.m(span, null);
append(div3, t3);
append(div3, div2);
if (if_block1) if_block1.m(div2, null);
current = true;
3 years ago
3 years ago
if (!mounted) {
dispose = [
listen(div1, "click", /*click_handler*/ ctx[5]),
listen(div1, "contextmenu", /*openMenu*/ ctx[4])
];
3 years ago
3 years ago
mounted = true;
}
},
p(ctx, dirty) {
if ((!current || dirty & /*feed*/ 1) && t1_value !== (t1_value = /*feed*/ ctx[0].name + "")) set_data(t1, t1_value);
3 years ago
3 years ago
if (/*feed*/ ctx[0].image) {
if (if_block0) {
if_block0.p(ctx, dirty);
} else {
if_block0 = create_if_block_2$1(ctx);
if_block0.c();
if_block0.m(span, null);
}
} else if (if_block0) {
if_block0.d(1);
if_block0 = null;
}
3 years ago
3 years ago
if (!current || dirty & /*folded, feed*/ 5 && div1_class_value !== (div1_class_value = /*folded*/ ctx[2].contains(/*feed*/ ctx[0].name)
3 years ago
? 'is-collapsed'
: '')) {
attr(div1, "class", div1_class_value);
}
3 years ago
3 years ago
if (dirty & /*folded, feed*/ 5) show_if = !/*folded*/ ctx[2].contains(/*feed*/ ctx[0].name);
3 years ago
3 years ago
if (show_if) {
if (if_block1) {
if_block1.p(ctx, dirty);
3 years ago
3 years ago
if (dirty & /*folded, feed*/ 5) {
3 years ago
transition_in(if_block1, 1);
}
} else {
if_block1 = create_if_block_1$1(ctx);
if_block1.c();
transition_in(if_block1, 1);
if_block1.m(div2, null);
}
} else if (if_block1) {
group_outros();
3 years ago
3 years ago
transition_out(if_block1, 1, 1, () => {
if_block1 = null;
});
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
transition_in(iconcomponent.$$.fragment, local);
transition_in(if_block1);
current = true;
},
o(local) {
transition_out(iconcomponent.$$.fragment, local);
transition_out(if_block1);
current = false;
},
d(detaching) {
if (detaching) detach(div3);
destroy_component(iconcomponent);
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
mounted = false;
run_all(dispose);
}
};
}
3 years ago
3 years ago
// (59:0) {#if !feed}
3 years ago
function create_if_block$1(ctx) {
let p;
3 years ago
3 years ago
return {
c() {
p = element("p");
p.textContent = "...loading";
},
m(target, anchor) {
insert(target, p, anchor);
},
p: noop,
i: noop,
o: noop,
d(detaching) {
if (detaching) detach(p);
}
};
}
3 years ago
3 years ago
// (70:20) {#if (feed.image)}
3 years ago
function create_if_block_2$1(ctx) {
let img;
let img_src_value;
let img_alt_value;
3 years ago
3 years ago
return {
c() {
img = element("img");
if (!src_url_equal(img.src, img_src_value = /*feed*/ ctx[0].image)) attr(img, "src", img_src_value);
attr(img, "alt", img_alt_value = /*feed*/ ctx[0].title);
set_style(img, "height", "1em");
},
m(target, anchor) {
insert(target, img, anchor);
},
p(ctx, dirty) {
if (dirty & /*feed*/ 1 && !src_url_equal(img.src, img_src_value = /*feed*/ ctx[0].image)) {
attr(img, "src", img_src_value);
}
3 years ago
3 years ago
if (dirty & /*feed*/ 1 && img_alt_value !== (img_alt_value = /*feed*/ ctx[0].title)) {
attr(img, "alt", img_alt_value);
}
},
d(detaching) {
if (detaching) detach(img);
}
};
}
3 years ago
3 years ago
// (78:12) {#if !folded.contains(feed.name)}
3 years ago
function create_if_block_1$1(ctx) {
3 years ago
let ul;
3 years ago
let current;
let each_value = /*feed*/ ctx[0].items;
let each_blocks = [];
3 years ago
3 years ago
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i));
}
3 years ago
3 years ago
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
3 years ago
3 years ago
return {
c() {
3 years ago
ul = element("ul");
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
},
m(target, anchor) {
3 years ago
insert(target, ul, anchor);
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
3 years ago
3 years ago
current = true;
},
p(ctx, dirty) {
if (dirty & /*feed, plugin*/ 3) {
each_value = /*feed*/ ctx[0].items;
let i;
3 years ago
3 years ago
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$1(ctx, each_value, i);
3 years ago
3 years ago
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block$1(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
}
3 years ago
3 years ago
group_outros();
3 years ago
3 years ago
for (i = each_value.length; i < each_blocks.length; i += 1) {
out(i);
}
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
3 years ago
3 years ago
for (let i = 0; i < each_value.length; i += 1) {
transition_in(each_blocks[i]);
}
3 years ago
3 years ago
current = true;
},
o(local) {
each_blocks = each_blocks.filter(Boolean);
3 years ago
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
3 years ago
3 years ago
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(ul);
3 years ago
destroy_each(each_blocks, detaching);
}
};
}
3 years ago
3 years ago
// (80:20) {#each feed.items as item}
3 years ago
function create_each_block$1(ctx) {
let itemview;
let current;
3 years ago
3 years ago
itemview = new ItemView({
props: {
item: /*item*/ ctx[6],
plugin: /*plugin*/ ctx[1]
}
});
3 years ago
3 years ago
return {
c() {
create_component(itemview.$$.fragment);
},
m(target, anchor) {
mount_component(itemview, target, anchor);
current = true;
},
p(ctx, dirty) {
const itemview_changes = {};
if (dirty & /*feed*/ 1) itemview_changes.item = /*item*/ ctx[6];
if (dirty & /*plugin*/ 2) itemview_changes.plugin = /*plugin*/ ctx[1];
itemview.$set(itemview_changes);
},
i(local) {
if (current) return;
transition_in(itemview.$$.fragment, local);
current = true;
},
o(local) {
transition_out(itemview.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(itemview, detaching);
}
};
}
3 years ago
3 years ago
function create_fragment$1(ctx) {
let current_block_type_index;
let if_block;
let if_block_anchor;
let current;
3 years ago
const if_block_creators = [create_if_block$1, create_else_block$1];
3 years ago
const if_blocks = [];
3 years ago
3 years ago
function select_block_type(ctx, dirty) {
if (!/*feed*/ ctx[0]) return 0;
return 1;
}
3 years ago
3 years ago
current_block_type_index = select_block_type(ctx);
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3 years ago
3 years ago
return {
c() {
if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if_blocks[current_block_type_index].m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx, [dirty]) {
let previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(ctx);
3 years ago
3 years ago
if (current_block_type_index === previous_block_index) {
if_blocks[current_block_type_index].p(ctx, dirty);
} else {
group_outros();
3 years ago
3 years ago
transition_out(if_blocks[previous_block_index], 1, 1, () => {
if_blocks[previous_block_index] = null;
});
3 years ago
3 years ago
check_outros();
if_block = if_blocks[current_block_type_index];
3 years ago
3 years ago
if (!if_block) {
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
if_block.c();
} else {
if_block.p(ctx, dirty);
}
3 years ago
3 years ago
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
},
i(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if_blocks[current_block_type_index].d(detaching);
if (detaching) detach(if_block_anchor);
}
};
}
3 years ago
3 years ago
function instance$1($$self, $$props, $$invalidate) {
let { feed = null } = $$props;
let { plugin } = $$props;
3 years ago
let folded = [];
foldedState.subscribe(value => {
$$invalidate(2, folded = value);
});
3 years ago
3 years ago
function toggleFold(feed) {
3 years ago
if (!folded) {
$$invalidate(2, folded = []);
}
if (folded.contains(feed)) {
folded.remove(feed);
} else folded.push(feed);
plugin.writeFolded(folded);
3 years ago
}
3 years ago
3 years ago
function openMenu(e) {
return __awaiter(this, void 0, void 0, function* () {
const menu = new obsidian.Menu(plugin.app);
3 years ago
3 years ago
menu.addItem(menuItem => {
3 years ago
menuItem.setIcon("create-new").setTitle(t("create_all")).onClick(() => __awaiter(this, void 0, void 0, function* () {
3 years ago
for (let item of feed.items) {
yield Action.CREATE_NOTE.processor(plugin, item);
}
}));
});
3 years ago
3 years ago
menu.addItem(menuItem => {
3 years ago
menuItem.setIcon("feather-eye").setTitle(t("mark_all_as_read")).onClick(() => __awaiter(this, void 0, void 0, function* () {
3 years ago
for (let item of feed.items) {
item.read = true;
}
3 years ago
3 years ago
const items = plugin.settings.items;
3 years ago
3 years ago
yield plugin.writeFeedContent(() => {
return items;
});
}));
});
3 years ago
3 years ago
menu.showAtPosition({ x: e.x, y: e.y });
});
}
3 years ago
3 years ago
const click_handler = () => toggleFold(feed.name);
3 years ago
3 years ago
$$self.$$set = $$props => {
if ('feed' in $$props) $$invalidate(0, feed = $$props.feed);
if ('plugin' in $$props) $$invalidate(1, plugin = $$props.plugin);
};
3 years ago
3 years ago
return [feed, plugin, folded, toggleFold, openMenu, click_handler];
3 years ago
}
3 years ago
3 years ago
class FeedView extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$1, create_fragment$1, safe_not_equal, { feed: 0, plugin: 1 });
}
}
3 years ago
3 years ago
/* src/view/FolderView.svelte generated by Svelte v3.44.2 */
3 years ago
3 years ago
function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
3 years ago
child_ctx[13] = list[i];
3 years ago
return child_ctx;
}
3 years ago
3 years ago
function get_each_context_1(ctx, list, i) {
const child_ctx = ctx.slice();
3 years ago
child_ctx[16] = list[i];
3 years ago
return child_ctx;
}
3 years ago
3 years ago
function get_each_context_2(ctx, list, i) {
const child_ctx = ctx.slice();
3 years ago
child_ctx[19] = list[i][0];
child_ctx[13] = list[i][1];
3 years ago
return child_ctx;
}
3 years ago
3 years ago
function get_each_context_3(ctx, list, i) {
const child_ctx = ctx.slice();
3 years ago
child_ctx[22] = list[i];
3 years ago
return child_ctx;
}
3 years ago
3 years ago
// (72:0) {:else}
3 years ago
function create_else_block(ctx) {
3 years ago
let ul;
3 years ago
let t0;
let t1;
let current;
let if_block0 = /*$filteredItemsStore*/ ctx[3] && create_if_block_5(ctx);
let if_block1 = !/*$sortedFeedsStore*/ ctx[2] && create_if_block_4();
let if_block2 = /*$sortedFeedsStore*/ ctx[2] && create_if_block_1(ctx);
return {
c() {
3 years ago
ul = element("ul");
3 years ago
if (if_block0) if_block0.c();
t0 = space();
if (if_block1) if_block1.c();
t1 = space();
if (if_block2) if_block2.c();
},
m(target, anchor) {
3 years ago
insert(target, ul, anchor);
if (if_block0) if_block0.m(ul, null);
append(ul, t0);
if (if_block1) if_block1.m(ul, null);
append(ul, t1);
if (if_block2) if_block2.m(ul, null);
3 years ago
current = true;
},
p(ctx, dirty) {
if (/*$filteredItemsStore*/ ctx[3]) {
if (if_block0) {
if_block0.p(ctx, dirty);
if (dirty & /*$filteredItemsStore*/ 8) {
transition_in(if_block0, 1);
}
} else {
if_block0 = create_if_block_5(ctx);
if_block0.c();
transition_in(if_block0, 1);
3 years ago
if_block0.m(ul, t0);
3 years ago
}
} else if (if_block0) {
group_outros();
transition_out(if_block0, 1, 1, () => {
if_block0 = null;
});
check_outros();
}
if (!/*$sortedFeedsStore*/ ctx[2]) {
if (if_block1) ; else {
if_block1 = create_if_block_4();
if_block1.c();
3 years ago
if_block1.m(ul, t1);
3 years ago
}
} else if (if_block1) {
if_block1.d(1);
if_block1 = null;
}
if (/*$sortedFeedsStore*/ ctx[2]) {
if (if_block2) {
if_block2.p(ctx, dirty);
if (dirty & /*$sortedFeedsStore*/ 4) {
transition_in(if_block2, 1);
}
} else {
if_block2 = create_if_block_1(ctx);
if_block2.c();
transition_in(if_block2, 1);
3 years ago
if_block2.m(ul, null);
3 years ago
}
} else if (if_block2) {
group_outros();
transition_out(if_block2, 1, 1, () => {
if_block2 = null;
});
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block0);
transition_in(if_block2);
current = true;
},
o(local) {
transition_out(if_block0);
transition_out(if_block2);
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(ul);
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
if (if_block2) if_block2.d();
3 years ago
}
};
}
3 years ago
// (70:0) {#if !folded}
3 years ago
function create_if_block(ctx) {
let p;
return {
c() {
p = element("p");
p.textContent = "Loading";
},
m(target, anchor) {
insert(target, p, anchor);
},
p: noop,
i: noop,
o: noop,
d(detaching) {
if (detaching) detach(p);
}
};
}
3 years ago
// (74:8) {#if $filteredItemsStore}
3 years ago
function create_if_block_5(ctx) {
3 years ago
let li;
3 years ago
let div1;
let iconcomponent;
let t0;
3 years ago
let div0;
let div1_class_value;
3 years ago
let t2;
3 years ago
let show_if = !/*folded*/ ctx[1].contains('rss-filters');
3 years ago
let current;
let mounted;
let dispose;
3 years ago
iconcomponent = new IconComponent({
props: { iconName: "feather-chevron-down" }
});
3 years ago
let if_block = show_if && create_if_block_6(ctx);
3 years ago
3 years ago
return {
c() {
3 years ago
li = element("li");
3 years ago
div1 = element("div");
create_component(iconcomponent.$$.fragment);
t0 = space();
3 years ago
div0 = element("div");
3 years ago
div0.textContent = `${t("filtered_folders")}`;
3 years ago
t2 = space();
if (if_block) if_block.c();
3 years ago
attr(div0, "class", "tree-item-inner");
3 years ago
3 years ago
attr(div1, "class", div1_class_value = "" + ((/*folded*/ ctx[1].contains('rss-filters')
3 years ago
? 'is-collapsed'
3 years ago
: '') + " tree-item-self is-clickable"));
3 years ago
3 years ago
attr(li, "class", "rss-filtered-folders");
3 years ago
},
m(target, anchor) {
3 years ago
insert(target, li, anchor);
append(li, div1);
3 years ago
mount_component(iconcomponent, div1, null);
append(div1, t0);
3 years ago
append(div1, div0);
3 years ago
append(li, t2);
if (if_block) if_block.m(li, null);
3 years ago
current = true;
3 years ago
3 years ago
if (!mounted) {
3 years ago
dispose = listen(div1, "click", /*click_handler*/ ctx[7]);
3 years ago
mounted = true;
}
},
p(ctx, dirty) {
3 years ago
if (!current || dirty & /*folded*/ 2 && div1_class_value !== (div1_class_value = "" + ((/*folded*/ ctx[1].contains('rss-filters')
3 years ago
? 'is-collapsed'
3 years ago
: '') + " tree-item-self is-clickable"))) {
attr(div1, "class", div1_class_value);
3 years ago
}
3 years ago
3 years ago
if (dirty & /*folded*/ 2) show_if = !/*folded*/ ctx[1].contains('rss-filters');
3 years ago
3 years ago
if (show_if) {
if (if_block) {
if_block.p(ctx, dirty);
3 years ago
3 years ago
if (dirty & /*folded*/ 2) {
3 years ago
transition_in(if_block, 1);
}
} else {
3 years ago
if_block = create_if_block_6(ctx);
3 years ago
if_block.c();
transition_in(if_block, 1);
3 years ago
if_block.m(li, null);
3 years ago
}
} else if (if_block) {
group_outros();
3 years ago
3 years ago
transition_out(if_block, 1, 1, () => {
if_block = null;
});
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
transition_in(iconcomponent.$$.fragment, local);
transition_in(if_block);
current = true;
},
o(local) {
transition_out(iconcomponent.$$.fragment, local);
transition_out(if_block);
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(li);
3 years ago
destroy_component(iconcomponent);
if (if_block) if_block.d();
mounted = false;
dispose();
}
};
}
3 years ago
3 years ago
// (82:16) {#if (!folded.contains('rss-filters'))}
3 years ago
function create_if_block_6(ctx) {
3 years ago
let ul;
3 years ago
let current;
3 years ago
let each_value_2 = Object.entries(/*$filteredItemsStore*/ ctx[3]);
3 years ago
let each_blocks = [];
3 years ago
3 years ago
for (let i = 0; i < each_value_2.length; i += 1) {
each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
}
3 years ago
3 years ago
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
3 years ago
3 years ago
return {
c() {
3 years ago
ul = element("ul");
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
},
m(target, anchor) {
3 years ago
insert(target, ul, anchor);
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
current = true;
},
p(ctx, dirty) {
3 years ago
if (dirty & /*Object, $filteredItemsStore, plugin, folded, toggleFold, openMenu*/ 91) {
each_value_2 = Object.entries(/*$filteredItemsStore*/ ctx[3]);
3 years ago
let i;
3 years ago
3 years ago
for (i = 0; i < each_value_2.length; i += 1) {
const child_ctx = get_each_context_2(ctx, each_value_2, i);
3 years ago
3 years ago
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block_2(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
}
3 years ago
3 years ago
group_outros();
3 years ago
3 years ago
for (i = each_value_2.length; i < each_blocks.length; i += 1) {
out(i);
}
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
3 years ago
3 years ago
for (let i = 0; i < each_value_2.length; i += 1) {
transition_in(each_blocks[i]);
}
3 years ago
3 years ago
current = true;
},
o(local) {
each_blocks = each_blocks.filter(Boolean);
3 years ago
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
3 years ago
3 years ago
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(ul);
3 years ago
destroy_each(each_blocks, detaching);
}
};
}
3 years ago
3 years ago
// (92:32) {#if (folded.contains('rss-filter' + folder.filter.name))}
3 years ago
function create_if_block_7(ctx) {
3 years ago
let div;
3 years ago
let ul;
3 years ago
let current;
3 years ago
let each_value_3 = /*folder*/ ctx[13].items.items;
3 years ago
let each_blocks = [];
3 years ago
3 years ago
for (let i = 0; i < each_value_3.length; i += 1) {
each_blocks[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
}
3 years ago
3 years ago
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
3 years ago
3 years ago
return {
c() {
div = element("div");
3 years ago
ul = element("ul");
3 years ago
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
},
m(target, anchor) {
insert(target, div, anchor);
3 years ago
append(div, ul);
3 years ago
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
3 years ago
3 years ago
current = true;
},
p(ctx, dirty) {
3 years ago
if (dirty & /*Object, $filteredItemsStore, plugin*/ 9) {
each_value_3 = /*folder*/ ctx[13].items.items;
3 years ago
let i;
3 years ago
3 years ago
for (i = 0; i < each_value_3.length; i += 1) {
const child_ctx = get_each_context_3(ctx, each_value_3, i);
3 years ago
3 years ago
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block_3(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
}
3 years ago
3 years ago
group_outros();
3 years ago
3 years ago
for (i = each_value_3.length; i < each_blocks.length; i += 1) {
out(i);
}
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
3 years ago
3 years ago
for (let i = 0; i < each_value_3.length; i += 1) {
transition_in(each_blocks[i]);
}
3 years ago
3 years ago
current = true;
},
o(local) {
each_blocks = each_blocks.filter(Boolean);
3 years ago
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
3 years ago
3 years ago
current = false;
},
d(detaching) {
if (detaching) detach(div);
destroy_each(each_blocks, detaching);
}
};
}
3 years ago
3 years ago
// (95:44) {#each folder.items.items as item}
3 years ago
function create_each_block_3(ctx) {
let itemview;
let current;
3 years ago
3 years ago
itemview = new ItemView({
props: {
3 years ago
item: /*item*/ ctx[22],
3 years ago
plugin: /*plugin*/ ctx[0]
}
});
3 years ago
3 years ago
return {
c() {
create_component(itemview.$$.fragment);
},
m(target, anchor) {
mount_component(itemview, target, anchor);
current = true;
},
p(ctx, dirty) {
const itemview_changes = {};
3 years ago
if (dirty & /*$filteredItemsStore*/ 8) itemview_changes.item = /*item*/ ctx[22];
3 years ago
if (dirty & /*plugin*/ 1) itemview_changes.plugin = /*plugin*/ ctx[0];
itemview.$set(itemview_changes);
},
i(local) {
if (current) return;
transition_in(itemview.$$.fragment, local);
current = true;
},
o(local) {
transition_out(itemview.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(itemview, detaching);
}
};
}
3 years ago
3 years ago
// (84:24) {#each Object.entries($filteredItemsStore) as [key, folder]}
3 years ago
function create_each_block_2(ctx) {
3 years ago
let li;
3 years ago
let div;
let iconcomponent;
let t0;
let span;
3 years ago
let t1_value = /*folder*/ ctx[13].filter.name + "";
3 years ago
let t1;
let div_class_value;
let t2;
3 years ago
let show_if = /*folded*/ ctx[1].contains('rss-filter' + /*folder*/ ctx[13].filter.name);
3 years ago
let t3;
3 years ago
let current;
let mounted;
let dispose;
3 years ago
iconcomponent = new IconComponent({
props: { iconName: "feather-chevron-down" }
});
3 years ago
3 years ago
function click_handler_1() {
3 years ago
return /*click_handler_1*/ ctx[8](/*folder*/ ctx[13]);
3 years ago
}
3 years ago
3 years ago
function contextmenu_handler(...args) {
return /*contextmenu_handler*/ ctx[9](/*folder*/ ctx[13], ...args);
}
let if_block = show_if && create_if_block_7(ctx);
3 years ago
3 years ago
return {
c() {
3 years ago
li = element("li");
3 years ago
div = element("div");
create_component(iconcomponent.$$.fragment);
t0 = space();
span = element("span");
t1 = text(t1_value);
t2 = space();
if (if_block) if_block.c();
3 years ago
t3 = space();
3 years ago
3 years ago
attr(div, "class", div_class_value = "" + ((/*folded*/ ctx[1].contains('rss-filters' + /*folder*/ ctx[13].filter.name)
3 years ago
? 'is-collapsed'
3 years ago
: '') + " tree-item-self is-clickable"));
3 years ago
},
m(target, anchor) {
3 years ago
insert(target, li, anchor);
append(li, div);
3 years ago
mount_component(iconcomponent, div, null);
append(div, t0);
append(div, span);
append(span, t1);
3 years ago
append(li, t2);
if (if_block) if_block.m(li, null);
append(li, t3);
3 years ago
current = true;
3 years ago
3 years ago
if (!mounted) {
3 years ago
dispose = [
listen(div, "click", click_handler_1),
listen(div, "contextmenu", contextmenu_handler)
];
3 years ago
mounted = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
3 years ago
if ((!current || dirty & /*$filteredItemsStore*/ 8) && t1_value !== (t1_value = /*folder*/ ctx[13].filter.name + "")) set_data(t1, t1_value);
3 years ago
3 years ago
if (!current || dirty & /*folded, $filteredItemsStore*/ 10 && div_class_value !== (div_class_value = "" + ((/*folded*/ ctx[1].contains('rss-filters' + /*folder*/ ctx[13].filter.name)
3 years ago
? 'is-collapsed'
3 years ago
: '') + " tree-item-self is-clickable"))) {
3 years ago
attr(div, "class", div_class_value);
}
3 years ago
3 years ago
if (dirty & /*folded, $filteredItemsStore*/ 10) show_if = /*folded*/ ctx[1].contains('rss-filter' + /*folder*/ ctx[13].filter.name);
3 years ago
3 years ago
if (show_if) {
if (if_block) {
if_block.p(ctx, dirty);
3 years ago
3 years ago
if (dirty & /*folded, $filteredItemsStore*/ 10) {
3 years ago
transition_in(if_block, 1);
}
} else {
3 years ago
if_block = create_if_block_7(ctx);
3 years ago
if_block.c();
transition_in(if_block, 1);
3 years ago
if_block.m(li, t3);
3 years ago
}
} else if (if_block) {
group_outros();
3 years ago
3 years ago
transition_out(if_block, 1, 1, () => {
if_block = null;
});
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
transition_in(iconcomponent.$$.fragment, local);
transition_in(if_block);
current = true;
},
o(local) {
transition_out(iconcomponent.$$.fragment, local);
transition_out(if_block);
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(li);
3 years ago
destroy_component(iconcomponent);
3 years ago
if (if_block) if_block.d();
3 years ago
mounted = false;
3 years ago
run_all(dispose);
3 years ago
}
};
}
3 years ago
3 years ago
// (109:8) {#if !$sortedFeedsStore}
3 years ago
function create_if_block_4(ctx) {
3 years ago
let h1;
return {
c() {
h1 = element("h1");
h1.textContent = "No feeds configured";
},
m(target, anchor) {
insert(target, h1, anchor);
},
d(detaching) {
if (detaching) detach(h1);
}
};
}
3 years ago
3 years ago
// (113:8) {#if $sortedFeedsStore}
3 years ago
function create_if_block_1(ctx) {
3 years ago
let li;
let p;
3 years ago
let iconcomponent;
let t0;
let span;
3 years ago
let p_class_value;
3 years ago
let t2;
3 years ago
let show_if = !/*folded*/ ctx[1].contains('rss-folders');
3 years ago
let current;
let mounted;
let dispose;
3 years ago
iconcomponent = new IconComponent({
props: { iconName: "feather-chevron-down" }
});
3 years ago
let if_block = show_if && create_if_block_2(ctx);
3 years ago
3 years ago
return {
c() {
3 years ago
li = element("li");
p = element("p");
3 years ago
create_component(iconcomponent.$$.fragment);
t0 = space();
span = element("span");
3 years ago
span.textContent = `${t("folders")}`;
3 years ago
t2 = space();
if (if_block) if_block.c();
3 years ago
3 years ago
attr(p, "class", p_class_value = /*folded*/ ctx[1].contains('rss-folders')
3 years ago
? 'is-collapsed'
: '');
3 years ago
3 years ago
attr(li, "class", "rss-feeds-folders");
3 years ago
},
m(target, anchor) {
3 years ago
insert(target, li, anchor);
append(li, p);
mount_component(iconcomponent, p, null);
append(p, t0);
append(p, span);
append(li, t2);
if (if_block) if_block.m(li, null);
3 years ago
current = true;
3 years ago
3 years ago
if (!mounted) {
3 years ago
dispose = listen(p, "click", /*click_handler_2*/ ctx[10]);
3 years ago
mounted = true;
}
},
p(ctx, dirty) {
3 years ago
if (!current || dirty & /*folded*/ 2 && p_class_value !== (p_class_value = /*folded*/ ctx[1].contains('rss-folders')
3 years ago
? 'is-collapsed'
: '')) {
3 years ago
attr(p, "class", p_class_value);
3 years ago
}
3 years ago
3 years ago
if (dirty & /*folded*/ 2) show_if = !/*folded*/ ctx[1].contains('rss-folders');
3 years ago
3 years ago
if (show_if) {
if (if_block) {
if_block.p(ctx, dirty);
3 years ago
3 years ago
if (dirty & /*folded*/ 2) {
3 years ago
transition_in(if_block, 1);
}
} else {
3 years ago
if_block = create_if_block_2(ctx);
3 years ago
if_block.c();
transition_in(if_block, 1);
3 years ago
if_block.m(li, null);
3 years ago
}
} else if (if_block) {
group_outros();
3 years ago
3 years ago
transition_out(if_block, 1, 1, () => {
if_block = null;
});
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
transition_in(iconcomponent.$$.fragment, local);
transition_in(if_block);
current = true;
},
o(local) {
transition_out(iconcomponent.$$.fragment, local);
transition_out(if_block);
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(li);
3 years ago
destroy_component(iconcomponent);
if (if_block) if_block.d();
mounted = false;
dispose();
}
};
}
3 years ago
3 years ago
// (122:16) {#if (!folded.contains('rss-folders'))}
3 years ago
function create_if_block_2(ctx) {
3 years ago
let ul;
3 years ago
let current;
3 years ago
let each_value = Object.keys(/*$sortedFeedsStore*/ ctx[2]);
3 years ago
let each_blocks = [];
3 years ago
3 years ago
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
}
3 years ago
3 years ago
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
3 years ago
3 years ago
return {
c() {
3 years ago
ul = element("ul");
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
},
m(target, anchor) {
3 years ago
insert(target, ul, anchor);
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
3 years ago
3 years ago
current = true;
},
p(ctx, dirty) {
3 years ago
if (dirty & /*$sortedFeedsStore, Object, plugin, folded, toggleFold, openMenuForFolder*/ 55) {
each_value = Object.keys(/*$sortedFeedsStore*/ ctx[2]);
3 years ago
let i;
3 years ago
3 years ago
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context(ctx, each_value, i);
3 years ago
3 years ago
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
}
3 years ago
3 years ago
group_outros();
3 years ago
3 years ago
for (i = each_value.length; i < each_blocks.length; i += 1) {
out(i);
}
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
3 years ago
3 years ago
for (let i = 0; i < each_value.length; i += 1) {
transition_in(each_blocks[i]);
}
3 years ago
3 years ago
current = true;
},
o(local) {
each_blocks = each_blocks.filter(Boolean);
3 years ago
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
3 years ago
3 years ago
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(ul);
3 years ago
destroy_each(each_blocks, detaching);
}
};
}
3 years ago
3 years ago
// (134:32) {#if (!folded.contains(folder))}
3 years ago
function create_if_block_3(ctx) {
3 years ago
let ul;
3 years ago
let current;
3 years ago
let each_value_1 = /*$sortedFeedsStore*/ ctx[2][/*folder*/ ctx[13]];
3 years ago
let each_blocks = [];
3 years ago
3 years ago
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
}
3 years ago
3 years ago
const out = i => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
3 years ago
3 years ago
return {
c() {
3 years ago
ul = element("ul");
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
},
m(target, anchor) {
3 years ago
insert(target, ul, anchor);
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
3 years ago
3 years ago
current = true;
},
p(ctx, dirty) {
3 years ago
if (dirty & /*$sortedFeedsStore, Object, plugin*/ 5) {
each_value_1 = /*$sortedFeedsStore*/ ctx[2][/*folder*/ ctx[13]];
3 years ago
let i;
3 years ago
3 years ago
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1(ctx, each_value_1, i);
3 years ago
3 years ago
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block_1(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
3 years ago
each_blocks[i].m(ul, null);
3 years ago
}
}
3 years ago
3 years ago
group_outros();
3 years ago
3 years ago
for (i = each_value_1.length; i < each_blocks.length; i += 1) {
out(i);
}
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
3 years ago
3 years ago
for (let i = 0; i < each_value_1.length; i += 1) {
transition_in(each_blocks[i]);
}
3 years ago
3 years ago
current = true;
},
o(local) {
each_blocks = each_blocks.filter(Boolean);
3 years ago
3 years ago
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
3 years ago
3 years ago
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(ul);
3 years ago
destroy_each(each_blocks, detaching);
}
};
}
3 years ago
3 years ago
// (136:40) {#each $sortedFeedsStore[folder] as feed}
3 years ago
function create_each_block_1(ctx) {
let feedview;
let current;
3 years ago
3 years ago
feedview = new FeedView({
props: {
3 years ago
feed: /*feed*/ ctx[16],
3 years ago
plugin: /*plugin*/ ctx[0]
}
});
3 years ago
3 years ago
return {
c() {
create_component(feedview.$$.fragment);
},
m(target, anchor) {
mount_component(feedview, target, anchor);
current = true;
},
p(ctx, dirty) {
const feedview_changes = {};
3 years ago
if (dirty & /*$sortedFeedsStore*/ 4) feedview_changes.feed = /*feed*/ ctx[16];
3 years ago
if (dirty & /*plugin*/ 1) feedview_changes.plugin = /*plugin*/ ctx[0];
feedview.$set(feedview_changes);
},
i(local) {
if (current) return;
transition_in(feedview.$$.fragment, local);
current = true;
},
o(local) {
transition_out(feedview.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(feedview, detaching);
}
};
}
3 years ago
3 years ago
// (124:24) {#each Object.keys($sortedFeedsStore) as folder}
3 years ago
function create_each_block(ctx) {
3 years ago
let li;
let p;
3 years ago
let iconcomponent;
let t0;
let span;
3 years ago
3 years ago
let t1_value = (/*folder*/ ctx[13] !== "undefined"
? /*folder*/ ctx[13]
3 years ago
: 'No Folder') + "";
3 years ago
3 years ago
let t1;
3 years ago
let p_class_value;
3 years ago
let t2;
3 years ago
let show_if = !/*folded*/ ctx[1].contains(/*folder*/ ctx[13]);
3 years ago
let t3;
let current;
let mounted;
let dispose;
3 years ago
iconcomponent = new IconComponent({
props: { iconName: "feather-chevron-down" }
});
3 years ago
3 years ago
function click_handler_3() {
3 years ago
return /*click_handler_3*/ ctx[11](/*folder*/ ctx[13]);
3 years ago
}
3 years ago
3 years ago
function contextmenu_handler_1(...args) {
return /*contextmenu_handler_1*/ ctx[12](/*folder*/ ctx[13], ...args);
}
let if_block = show_if && create_if_block_3(ctx);
3 years ago
3 years ago
return {
c() {
3 years ago
li = element("li");
p = element("p");
3 years ago
create_component(iconcomponent.$$.fragment);
t0 = space();
span = element("span");
t1 = text(t1_value);
t2 = space();
if (if_block) if_block.c();
t3 = space();
3 years ago
3 years ago
attr(p, "class", p_class_value = /*folded*/ ctx[1].contains(/*folder*/ ctx[13])
3 years ago
? 'is-collapsed'
: '');
3 years ago
3 years ago
attr(li, "class", "rss-folder");
3 years ago
},
m(target, anchor) {
3 years ago
insert(target, li, anchor);
append(li, p);
mount_component(iconcomponent, p, null);
append(p, t0);
append(p, span);
3 years ago
append(span, t1);
3 years ago
append(li, t2);
if (if_block) if_block.m(li, null);
append(li, t3);
3 years ago
current = true;
3 years ago
3 years ago
if (!mounted) {
3 years ago
dispose = [
3 years ago
listen(p, "click", click_handler_3),
listen(p, "contextmenu", contextmenu_handler_1)
3 years ago
];
3 years ago
mounted = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
3 years ago
3 years ago
if ((!current || dirty & /*$sortedFeedsStore*/ 4) && t1_value !== (t1_value = (/*folder*/ ctx[13] !== "undefined"
? /*folder*/ ctx[13]
3 years ago
: 'No Folder') + "")) set_data(t1, t1_value);
3 years ago
3 years ago
if (!current || dirty & /*folded, $sortedFeedsStore*/ 6 && p_class_value !== (p_class_value = /*folded*/ ctx[1].contains(/*folder*/ ctx[13])
3 years ago
? 'is-collapsed'
: '')) {
3 years ago
attr(p, "class", p_class_value);
3 years ago
}
3 years ago
3 years ago
if (dirty & /*folded, $sortedFeedsStore*/ 6) show_if = !/*folded*/ ctx[1].contains(/*folder*/ ctx[13]);
3 years ago
3 years ago
if (show_if) {
if (if_block) {
if_block.p(ctx, dirty);
3 years ago
3 years ago
if (dirty & /*folded, $sortedFeedsStore*/ 6) {
3 years ago
transition_in(if_block, 1);
}
} else {
3 years ago
if_block = create_if_block_3(ctx);
3 years ago
if_block.c();
transition_in(if_block, 1);
3 years ago
if_block.m(li, t3);
3 years ago
}
} else if (if_block) {
group_outros();
3 years ago
3 years ago
transition_out(if_block, 1, 1, () => {
if_block = null;
});
3 years ago
3 years ago
check_outros();
}
},
i(local) {
if (current) return;
transition_in(iconcomponent.$$.fragment, local);
transition_in(if_block);
current = true;
},
o(local) {
transition_out(iconcomponent.$$.fragment, local);
transition_out(if_block);
current = false;
},
d(detaching) {
3 years ago
if (detaching) detach(li);
3 years ago
destroy_component(iconcomponent);
if (if_block) if_block.d();
mounted = false;
3 years ago
run_all(dispose);
3 years ago
}
};
}
3 years ago
3 years ago
function create_fragment(ctx) {
3 years ago
let current_block_type_index;
let if_block;
let if_block_anchor;
3 years ago
let current;
3 years ago
const if_block_creators = [create_if_block, create_else_block];
const if_blocks = [];
function select_block_type(ctx, dirty) {
if (!/*folded*/ ctx[1]) return 0;
return 1;
}
current_block_type_index = select_block_type(ctx);
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3 years ago
3 years ago
return {
c() {
3 years ago
if_block.c();
if_block_anchor = empty();
3 years ago
},
m(target, anchor) {
3 years ago
if_blocks[current_block_type_index].m(target, anchor);
insert(target, if_block_anchor, anchor);
3 years ago
current = true;
},
p(ctx, [dirty]) {
3 years ago
let previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(ctx);
3 years ago
3 years ago
if (current_block_type_index === previous_block_index) {
if_blocks[current_block_type_index].p(ctx, dirty);
} else {
3 years ago
group_outros();
3 years ago
3 years ago
transition_out(if_blocks[previous_block_index], 1, 1, () => {
if_blocks[previous_block_index] = null;
3 years ago
});
3 years ago
3 years ago
check_outros();
3 years ago
if_block = if_blocks[current_block_type_index];
3 years ago
3 years ago
if (!if_block) {
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
if_block.c();
3 years ago
} else {
3 years ago
if_block.p(ctx, dirty);
3 years ago
}
3 years ago
3 years ago
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
3 years ago
}
},
i(local) {
if (current) return;
3 years ago
transition_in(if_block);
3 years ago
current = true;
},
o(local) {
3 years ago
transition_out(if_block);
3 years ago
current = false;
},
d(detaching) {
3 years ago
if_blocks[current_block_type_index].d(detaching);
if (detaching) detach(if_block_anchor);
3 years ago
}
};
}
3 years ago
3 years ago
function instance($$self, $$props, $$invalidate) {
let $sortedFeedsStore;
3 years ago
let $filteredItemsStore;
component_subscribe($$self, sortedFeedsStore, $$value => $$invalidate(2, $sortedFeedsStore = $$value));
component_subscribe($$self, filteredItemsStore, $$value => $$invalidate(3, $filteredItemsStore = $$value));
3 years ago
let { plugin } = $$props;
3 years ago
let folded = [];
foldedState.subscribe(value => {
$$invalidate(1, folded = value);
});
3 years ago
3 years ago
function toggleFold(folder) {
3 years ago
if (!folded) {
$$invalidate(1, folded = []);
}
if (folded.contains(folder)) {
folded.remove(folder);
} else folded.push(folder);
plugin.writeFolded(folded);
}
function openMenuForFolder(e, folder) {
return __awaiter(this, void 0, void 0, function* () {
const items = [];
for (const feed of $sortedFeedsStore[folder]) {
for (let item of feed.items) {
items.push(item);
}
}
yield openMenu(e, items);
});
}
function openMenu(e, feedItems) {
return __awaiter(this, void 0, void 0, function* () {
const menu = new obsidian.Menu(plugin.app);
menu.addItem(menuItem => {
3 years ago
menuItem.setIcon("create-new").setTitle(t("create_all")).onClick(() => __awaiter(this, void 0, void 0, function* () {
3 years ago
for (const item of feedItems) {
yield Action.CREATE_NOTE.processor(plugin, item);
}
}));
});
menu.addItem(menuItem => {
3 years ago
menuItem.setIcon("feather-eye").setTitle(t("mark_all_as_read")).onClick(() => __awaiter(this, void 0, void 0, function* () {
3 years ago
for (const item of feedItems) {
item.read = true;
}
const items = plugin.settings.items;
yield plugin.writeFeedContent(() => {
return items;
});
}));
});
menu.showAtPosition({ x: e.x, y: e.y });
});
3 years ago
}
3 years ago
3 years ago
const click_handler = () => toggleFold('rss-filters');
const click_handler_1 = folder => toggleFold('rss-filter' + folder.filter.name);
3 years ago
const contextmenu_handler = (folder, e) => openMenu(e, folder.items.items);
3 years ago
const click_handler_2 = () => toggleFold('rss-folders');
const click_handler_3 = folder => toggleFold(folder);
3 years ago
const contextmenu_handler_1 = (folder, e) => openMenuForFolder(e, folder);
3 years ago
3 years ago
$$self.$$set = $$props => {
if ('plugin' in $$props) $$invalidate(0, plugin = $$props.plugin);
};
3 years ago
3 years ago
return [
plugin,
3 years ago
folded,
3 years ago
$sortedFeedsStore,
3 years ago
$filteredItemsStore,
3 years ago
toggleFold,
3 years ago
openMenuForFolder,
openMenu,
3 years ago
click_handler,
click_handler_1,
3 years ago
contextmenu_handler,
3 years ago
click_handler_2,
3 years ago
click_handler_3,
contextmenu_handler_1
3 years ago
];
}
3 years ago
3 years ago
class FolderView extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, { plugin: 0 });
}
}
3 years ago
3 years ago
class ViewLoader extends obsidian.ItemView {
constructor(leaf, plugin) {
super(leaf);
this.plugin = plugin;
}
getDisplayText() {
3 years ago
return t("RSS_Feeds");
3 years ago
}
getViewType() {
return VIEW_ID;
}
getIcon() {
return "feather-rss";
}
onOpen() {
return __awaiter(this, void 0, void 0, function* () {
this.feed = new FolderView({
target: this.contentEl,
props: {
plugin: this.plugin
},
});
});
}
onClose() {
if (this.feed) {
this.feed.$destroy();
}
return Promise.resolve();
}
}
3 years ago
3 years ago
/**
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* 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
*/
3 years ago
3 years ago
var lodash_mergewith = createCommonjsModule(function (module, exports) {
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
3 years ago
3 years ago
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
3 years ago
3 years ago
/** Used to detect hot functions by number of calls within a span of milliseconds. */
var HOT_COUNT = 800,
HOT_SPAN = 16;
3 years ago
3 years ago
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
3 years ago
3 years ago
/** `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]';
3 years ago
3 years ago
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]';
3 years ago
3 years ago
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
3 years ago
3 years ago
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
3 years ago
3 years ago
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
3 years ago
3 years ago
/** 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;
3 years ago
3 years ago
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
3 years ago
3 years ago
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
3 years ago
3 years ago
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
3 years ago
3 years ago
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
3 years ago
3 years ago
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
3 years ago
3 years ago
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
3 years ago
3 years ago
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
3 years ago
3 years ago
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
// Use `util.types` for Node.js 10+.
var types = freeModule && freeModule.require && freeModule.require('util').types;
3 years ago
3 years ago
if (types) {
return types;
}
3 years ago
3 years ago
// Legacy `process.binding('util')` for Node.js < 10.
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
3 years ago
3 years ago
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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);
while (++index < n) {
result[index] = iteratee(index);
3 years ago
}
3 years ago
return result;
}
3 years ago
3 years ago
/**
* 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);
};
}
3 years ago
3 years ago
/**
* 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];
}
3 years ago
3 years ago
/**
* 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));
};
}
3 years ago
3 years ago
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
3 years ago
3 years ago
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
3 years ago
3 years ago
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
3 years ago
3 years ago
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
3 years ago
3 years ago
/** 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) : '';
}());
3 years ago
/**
3 years ago
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
3 years ago
*/
3 years ago
var nativeObjectToString = objectProto.toString;
3 years ago
3 years ago
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
3 years ago
3 years ago
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
3 years ago
3 years ago
/** 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;
3 years ago
3 years ago
var defineProperty = (function() {
try {
var func = getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {}
}());
3 years ago
3 years ago
/* 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;
3 years ago
3 years ago
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map'),
nativeCreate = getNative(Object, 'create');
3 years ago
3 years ago
/**
* 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.
*/
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;
};
}());
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
3 years ago
3 years ago
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
3 years ago
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* 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.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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.
*/
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;
}
3 years ago
3 years ago
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
3 years ago
3 years ago
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
3 years ago
3 years ago
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
3 years ago
3 years ago
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
3 years ago
3 years ago
/**
* 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`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
3 years ago
3 years ago
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;
}
3 years ago
3 years ago
/**
* 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);
3 years ago
3 years ago
return index < 0 ? undefined : data[index][1];
}
3 years ago
3 years ago
/**
* 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`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
3 years ago
3 years ago
/**
* 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);
3 years ago
3 years ago
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
3 years ago
3 years ago
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
3 years ago
3 years ago
/**
* 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
};
}
3 years ago
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
3 years ago
3 years ago
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
3 years ago
3 years ago
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
3 years ago
3 years ago
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
this.size = 0;
}
3 years ago
/**
3 years ago
* 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`.
3 years ago
*/
3 years ago
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
3 years ago
3 years ago
this.size = data.size;
return result;
3 years ago
}
/**
3 years ago
* 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.
3 years ago
*/
3 years ago
function stackGet(key) {
return this.__data__.get(key);
3 years ago
}
/**
3 years ago
* 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`.
3 years ago
*/
3 years ago
function stackHas(key) {
return this.__data__.has(key);
3 years ago
}
/**
3 years ago
* 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.
3 years ago
*/
3 years ago
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;
}
data = this.__data__ = new MapCache(pairs);
3 years ago
}
3 years ago
data.set(key, value);
this.size = data.size;
return this;
3 years ago
}
3 years ago
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
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);
}
}
return result;
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
}
3 years ago
/**
* 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);
}
3 years ago
}
3 years ago
/**
* 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;
}
}
return -1;
3 years ago
}
3 years ago
/**
* 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
3 years ago
});
3 years ago
} else {
object[key] = value;
}
3 years ago
}
3 years ago
/**
* 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();
/**
* 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);
3 years ago
}
3 years ago
/**
* 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;
3 years ago
}
3 years ago
/**
* 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;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
3 years ago
}
3 years ago
/**
* 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)];
}
/**
* 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);
}
var isProto = isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
3 years ago
}
3 years ago
}
return result;
}
/**
* 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;
}
baseFor(source, function(srcValue, key) {
stack || (stack = new Stack);
if (isObject(srcValue)) {
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
3 years ago
}
3 years ago
else {
var newValue = customizer
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
3 years ago
}
3 years ago
}, 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);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
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);
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) || isFunction(objValue)) {
newValue = initCloneObject(srcValue);
}
}
else {
isCommon = false;
3 years ago
}
3 years ago
}
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);
3 years ago
}
3 years ago
/**
* 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 + '');
3 years ago
}
3 years ago
/**
* 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`.
*/
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();
}
var length = buffer.length,
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result);
return result;
}
/**
* 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;
}
/**
* 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);
}
/**
* 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;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
/**
* 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 index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined;
if (newValue === undefined) {
newValue = source[key];
3 years ago
}
3 years ago
if (isNew) {
baseAssignValue(object, key, newValue);
} else {
assignValue(object, key, newValue);
3 years ago
}
3 years ago
}
return object;
3 years ago
}
3 years ago
/**
* 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;
3 years ago
3 years ago
customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
: undefined;
3 years ago
3 years ago
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);
}
}
return object;
});
3 years ago
}
3 years ago
/**
* 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;
3 years ago
3 years ago
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
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;
3 years ago
}
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* 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];
3 years ago
3 years ago
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
3 years ago
3 years ago
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
3 years ago
}
3 years ago
/**
* Initializes an object clone.
*
* @private
* @param {Object} object The object to clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
return (typeof object.constructor == 'function' && !isPrototype(object))
? baseCreate(getPrototype(object))
: {};
3 years ago
}
3 years ago
/**
* 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;
3 years ago
3 years ago
return !!length &&
(type == 'number' ||
(type != 'symbol' && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length);
3 years ago
}
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
return value === proto;
}
3 years ago
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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);
3 years ago
3 years ago
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);
};
}
3 years ago
3 years ago
/**
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
*
* @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) {
if (key === 'constructor' && typeof object[key] === 'function') {
return;
}
3 years ago
3 years ago
if (key == '__proto__') {
return;
}
3 years ago
3 years ago
return object[key];
}
3 years ago
3 years ago
/**
* 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);
3 years ago
3 years ago
/**
* 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);
};
}
3 years ago
3 years ago
/**
* 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 '';
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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');
};
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
/**
* 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;
}
/**
* 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;
}
3 years ago
3 years ago
/**
* 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');
}
3 years ago
3 years ago
/**
* 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';
}
3 years ago
3 years ago
/**
* 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;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
3 years ago
}
3 years ago
/**
* 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;
3 years ago
3 years ago
/**
* 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));
3 years ago
}
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* This method is like `_.merge` except that it accepts `customizer` which
* is invoked to produce the merged values of the destination and source
* properties. If `customizer` returns `undefined`, merging is handled by the
* method instead. The `customizer` is invoked with six arguments:
* (objValue, srcValue, key, object, source, stack).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
* @example
*
* function customizer(objValue, srcValue) {
* if (_.isArray(objValue)) {
* return objValue.concat(srcValue);
* }
* }
*
* var object = { 'a': [1], 'b': [2] };
* var other = { 'a': [3], 'b': [4] };
*
* _.mergeWith(object, other, customizer);
* // => { 'a': [1, 3], 'b': [2, 4] }
*/
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
/**
* 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;
};
3 years ago
}
3 years ago
/**
* 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;
3 years ago
}
3 years ago
/**
* 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;
}
3 years ago
3 years ago
module.exports = mergeWith;
});
3 years ago
3 years ago
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* 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
*/
3 years ago
3 years ago
var lodash_keyby = createCommonjsModule(function (module, exports) {
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
3 years ago
3 years ago
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
3 years ago
3 years ago
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
3 years ago
3 years ago
/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
PARTIAL_COMPARE_FLAG = 2;
3 years ago
3 years ago
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0,
MAX_SAFE_INTEGER = 9007199254740991;
3 years ago
3 years ago
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]';
3 years ago
3 years ago
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]';
3 years ago
3 years ago
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
3 years ago
3 years ago
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
3 years ago
3 years ago
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
3 years ago
3 years ago
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
3 years ago
3 years ago
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
3 years ago
3 years ago
/** 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;
3 years ago
3 years ago
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
3 years ago
3 years ago
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
3 years ago
3 years ago
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
3 years ago
3 years ago
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
3 years ago
3 years ago
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
3 years ago
3 years ago
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
3 years ago
3 years ago
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
3 years ago
3 years ago
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding('util');
} catch (e) {}
}());
3 years ago
3 years ago
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
3 years ago
3 years ago
/**
* A specialized version of `baseAggregator` for arrays.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array ? array.length : 0;
3 years ago
3 years ago
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
3 years ago
}
3 years ago
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array ? array.length : 0;
3 years ago
3 years ago
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
3 years ago
3 years ago
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
3 years ago
3 years ago
/**
* 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);
3 years ago
3 years ago
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
3 years ago
3 years ago
/**
* 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);
};
}
3 years ago
3 years ago
/**
* 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];
}
3 years ago
3 years ago
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
}
3 years ago
3 years ago
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
3 years ago
3 years ago
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
3 years ago
3 years ago
/**
* 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));
};
3 years ago
}
3 years ago
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
3 years ago
3 years ago
set.forEach(function(value) {
result[++index] = value;
});
return result;
3 years ago
}
3 years ago
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
3 years ago
3 years ago
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
3 years ago
3 years ago
/** 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) : '';
}());
3 years ago
3 years ago
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
3 years ago
3 years ago
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
3 years ago
3 years ago
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
3 years ago
3 years ago
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
3 years ago
3 years ago
/** Built-in value references. */
var Symbol = root.Symbol,
Uint8Array = root.Uint8Array,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice;
3 years ago
3 years ago
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
3 years ago
3 years ago
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView'),
Map = getNative(root, 'Map'),
Promise = getNative(root, 'Promise'),
Set = getNative(root, 'Set'),
WeakMap = getNative(root, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
3 years ago
3 years ago
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
3 years ago
3 years ago
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
3 years ago
3 years ago
/**
* 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) {
return this.has(key) && delete this.__data__[key];
}
3 years ago
3 years ago
/**
* 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.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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.
*/
function hashSet(key, value) {
var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
3 years ago
3 years ago
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
3 years ago
3 years ago
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
3 years ago
}
3 years ago
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
}
3 years ago
3 years ago
/**
* 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`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
3 years ago
3 years ago
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
return true;
3 years ago
}
3 years ago
/**
* 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);
3 years ago
3 years ago
return index < 0 ? undefined : data[index][1];
}
3 years ago
3 years ago
/**
* 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`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
3 years ago
3 years ago
/**
* 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);
3 years ago
3 years ago
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
3 years ago
3 years ago
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
3 years ago
3 years ago
/**
* 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 ? entries.length : 0;
3 years ago
3 years ago
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
3 years ago
}
3 years ago
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
3 years ago
3 years ago
/**
* 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) {
return getMapData(this, key)['delete'](key);
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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);
3 years ago
}
3 years ago
/**
* 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) {
getMapData(this, key).set(key, value);
return this;
3 years ago
}
3 years ago
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
3 years ago
3 years ago
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values ? values.length : 0;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
3 years ago
}
3 years ago
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
3 years ago
}
3 years ago
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
3 years ago
}
3 years ago
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
this.__data__ = new ListCache(entries);
3 years ago
}
3 years ago
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
}
3 years ago
3 years ago
/**
* 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`.
*/
function stackDelete(key) {
return this.__data__['delete'](key);
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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.
*/
function stackSet(key, value) {
var cache = this.__data__;
if (cache instanceof ListCache) {
var pairs = cache.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
return this;
}
cache = this.__data__ = new MapCache(pairs);
}
cache.set(key, value);
return this;
}
3 years ago
3 years ago
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
3 years ago
3 years ago
/**
* 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) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
3 years ago
3 years ago
var length = result.length,
skipIndexes = !!length;
3 years ago
3 years ago
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
3 years ago
3 years ago
/**
* 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;
}
}
return -1;
3 years ago
}
3 years ago
/**
* Aggregates elements of `collection` on `accumulator` with keys transformed
* by `iteratee` and values set by `setter`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function baseAggregator(collection, setter, iteratee, accumulator) {
baseEach(collection, function(value, key, collection) {
setter(accumulator, value, iteratee(value), collection);
});
return accumulator;
}
3 years ago
3 years ago
/**
* The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
3 years ago
3 years ago
/**
* 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();
3 years ago
3 years ago
/**
* The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return object && baseFor(object, iteratee, keys);
}
3 years ago
3 years ago
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
3 years ago
3 years ago
var index = 0,
length = path.length;
3 years ago
3 years ago
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
3 years ago
3 years ago
/**
* The base implementation of `getTag`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
return objectToString.call(value);
}
3 years ago
3 years ago
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
3 years ago
3 years ago
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
* @param {boolean} [bitmask] The bitmask of comparison flags.
* The bitmask may be composed of the following flags:
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, bitmask, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
}
3 years ago
3 years ago
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparisons.
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
3 years ago
3 years ago
if (!objIsArr) {
objTag = getTag(object);
objTag = objTag == argsTag ? objectTag : objTag;
}
if (!othIsArr) {
othTag = getTag(other);
othTag = othTag == argsTag ? objectTag : othTag;
}
var objIsObj = objTag == objectTag && !isHostObject(object),
othIsObj = othTag == objectTag && !isHostObject(other),
isSameTag = objTag == othTag;
3 years ago
3 years ago
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
}
if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
3 years ago
3 years ago
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
3 years ago
3 years ago
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
3 years ago
}
3 years ago
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Array} matchData The property names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
3 years ago
3 years ago
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
3 years ago
3 years ago
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new Stack;
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
: result
)) {
return false;
}
}
}
return true;
}
3 years ago
3 years ago
/**
* 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;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
3 years ago
3 years ago
/**
* 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[objectToString.call(value)];
}
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == 'object') {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
}
return property(value);
}
3 years ago
3 years ago
/**
* The base implementation of `_.keys` 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 baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
3 years ago
3 years ago
/**
* The base implementation of `_.matches` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
};
}
3 years ago
3 years ago
/**
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get(object, path);
return (objValue === undefined && objValue === srcValue)
? hasIn(object, path)
: baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
};
}
3 years ago
3 years ago
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
};
}
3 years ago
3 years ago
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
3 years ago
3 years ago
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
}
3 years ago
3 years ago
/**
* Creates a function like `_.groupBy`.
*
* @private
* @param {Function} setter The function to set accumulator values.
* @param {Function} [initializer] The accumulator object initializer.
* @returns {Function} Returns the new aggregator function.
*/
function createAggregator(setter, initializer) {
return function(collection, iteratee) {
var func = isArray(collection) ? arrayAggregator : baseAggregator,
accumulator = initializer ? initializer() : {};
3 years ago
3 years ago
return func(collection, setter, baseIteratee(iteratee), accumulator);
};
}
3 years ago
3 years ago
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
if (collection == null) {
return collection;
}
if (!isArrayLike(collection)) {
return eachFunc(collection, iteratee);
}
var length = collection.length,
index = fromRight ? length : -1,
iterable = Object(collection);
3 years ago
3 years ago
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
3 years ago
}
3 years ago
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
arrLength = array.length,
othLength = other.length;
3 years ago
3 years ago
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
3 years ago
3 years ago
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!seen.has(othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
return seen.add(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, customizer, bitmask, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
3 years ago
}
3 years ago
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
3 years ago
3 years ago
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
3 years ago
3 years ago
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
3 years ago
3 years ago
case errorTag:
return object.name == other.name && object.message == other.message;
3 years ago
3 years ago
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
3 years ago
3 years ago
case mapTag:
var convert = mapToArray;
3 years ago
3 years ago
case setTag:
var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
convert || (convert = setToArray);
3 years ago
3 years ago
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= UNORDERED_COMPARE_FLAG;
3 years ago
3 years ago
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
stack['delete'](object);
return result;
3 years ago
3 years ago
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
3 years ago
3 years ago
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
3 years ago
3 years ago
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
3 years ago
3 years ago
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
3 years ago
3 years ago
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
3 years ago
3 years ago
/**
* 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;
3 years ago
}
3 years ago
/**
* Gets the property names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = keys(object),
length = result.length;
3 years ago
3 years ago
while (length--) {
var key = result[length],
value = object[key];
3 years ago
3 years ago
result[length] = [key, value, isStrictComparable(value)];
}
return result;
}
3 years ago
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
3 years ago
3 years ago
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge < 14, and promises in Node.js.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : undefined;
3 years ago
3 years ago
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
3 years ago
3 years ago
/**
* Checks if `path` exists on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = isKey(path, object) ? [path] : castPath(path);
3 years ago
3 years ago
var result,
index = -1,
length = path.length;
3 years ago
3 years ago
while (++index < length) {
var key = toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result) {
return result;
}
var length = object ? object.length : 0;
return !!length && isLength(length) && isIndex(key, length) &&
(isArray(object) || isArguments(object));
3 years ago
}
3 years ago
/**
* 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) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
3 years ago
3 years ago
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
return value === proto;
}
3 years ago
3 years ago
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
3 years ago
3 years ago
/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue &&
(srcValue !== undefined || (key in Object(object)));
};
}
3 years ago
3 years ago
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoize(function(string) {
string = toString(string);
3 years ago
3 years ago
var result = [];
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
3 years ago
3 years ago
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
3 years ago
3 years ago
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @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 '';
}
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The corresponding value of
* each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* var array = [
* { 'dir': 'left', 'code': 97 },
* { 'dir': 'right', 'code': 100 }
* ];
*
* _.keyBy(array, function(o) {
* return String.fromCharCode(o.code);
* });
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
*
* _.keyBy(array, 'dir');
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
*/
var keyBy = createAggregator(function(result, value, key) {
result[key] = value;
});
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
3 years ago
3 years ago
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result);
return result;
};
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
3 years ago
3 years ago
// Assign cache to `_.memoize`.
memoize.Cache = MapCache;
3 years ago
3 years ago
/**
* 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);
3 years ago
}
3 years ago
/**
* 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
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
3 years ago
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* 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 && (type == 'object' || type == 'function');
}
3 years ago
3 years ago
/**
* 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 && typeof value == 'object';
}
3 years ago
3 years ago
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
3 years ago
3 years ago
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}
3 years ago
3 years ago
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
3 years ago
3 years ago
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @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;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
3 years ago
}
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* Creates a function that returns the value at `path` of a given object.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
* @example
*
* var objects = [
* { 'a': { 'b': 2 } },
* { 'a': { 'b': 1 } }
* ];
*
* _.map(objects, _.property('a.b'));
* // => [2, 1]
*
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
3 years ago
}
3 years ago
module.exports = keyBy;
});
3 years ago
3 years ago
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* 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
*/
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
3 years ago
3 years ago
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]';
3 years ago
3 years ago
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
3 years ago
3 years ago
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array ? array.length : 0,
result = Array(length);
3 years ago
3 years ago
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
3 years ago
3 years ago
/**
* 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);
3 years ago
3 years ago
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
3 years ago
3 years ago
/**
* The base implementation of `_.values` and `_.valuesIn` which creates an
* array of `object` property values corresponding to the property names
* of `props`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} props The property names to get values for.
* @returns {Object} Returns the array of property values.
*/
function baseValues(object, props) {
return arrayMap(props, function(key) {
return object[key];
});
}
3 years ago
3 years ago
/**
* 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));
};
}
3 years ago
3 years ago
/** Used for built-in method references. */
var objectProto = Object.prototype;
3 years ago
3 years ago
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
3 years ago
3 years ago
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
3 years ago
3 years ago
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
/**
* 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) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
3 years ago
3 years ago
var length = result.length,
skipIndexes = !!length;
3 years ago
3 years ago
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
3 years ago
}
3 years ago
/**
* The base implementation of `_.keys` 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 baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
3 years ago
3 years ago
/**
* 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) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
return value === proto;
}
3 years ago
3 years ago
/**
* 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
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
3 years ago
3 years ago
/**
* 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;
3 years ago
3 years ago
/**
* 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);
}
3 years ago
3 years ago
/**
* 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);
3 years ago
}
3 years ago
/**
* 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) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
3 years ago
3 years ago
/**
* 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;
}
3 years ago
3 years ago
/**
* 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 && (type == 'object' || type == 'function');
}
3 years ago
3 years ago
/**
* 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 && typeof value == 'object';
3 years ago
}
3 years ago
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @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;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
3 years ago
}
3 years ago
/**
* Creates an array of the own enumerable string keyed property values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property values.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.values(new Foo);
* // => [1, 2] (iteration order is not guaranteed)
*
* _.values('hi');
* // => ['h', 'i']
*/
function values(object) {
return object ? baseValues(object, keys(object)) : [];
3 years ago
}
3 years ago
var lodash_values = values;
3 years ago
class RssReaderPlugin extends obsidian.Plugin {
onload() {
return __awaiter(this, void 0, void 0, function* () {
console.log('loading plugin rss reader');
addFeatherIcon("rss");
addFeatherIcon("eye");
addFeatherIcon("eye-off");
addFeatherIcon("star");
addFeatherIcon("clipboard");
3 years ago
addFeatherIcon("headphones");
3 years ago
addFeatherIcon("chevron-down");
3 years ago
//update settings whenever store contents change.
this.register(settingsStore.subscribe((value) => {
this.settings = value;
}));
yield this.loadSettings();
this.addCommand({
id: "rss-open",
3 years ago
name: t("open"),
3 years ago
checkCallback: (checking) => {
if (checking) {
return (this.app.workspace.getLeavesOfType(VIEW_ID).length === 0);
}
this.initLeaf();
}
});
/* parser not fully implemented
this.addCommand({
id: "rss-import",
name: "Import OPML",
callback: () => {
new ImportModal(this.app, this).open();
}
});*/
this.addCommand({
id: 'rss-refresh',
3 years ago
name: t("refresh_feeds"),
3 years ago
callback: () => __awaiter(this, void 0, void 0, function* () {
yield this.updateFeeds();
})
});
this.registerView(VIEW_ID, (leaf) => new ViewLoader(leaf, this));
this.addSettingTab(new RSSReaderSettingsTab(this.app, this));
let interval;
if (this.settings.updateTime !== 0) {
interval = window.setInterval(() => __awaiter(this, void 0, void 0, function* () {
yield this.updateFeeds();
}), this.settings.updateTime * 60 * 1000);
this.registerInterval(interval);
}
3 years ago
if (this.settings.autoSync) {
this.registerInterval(window.setInterval(() => __awaiter(this, void 0, void 0, function* () {
yield this.loadSettings();
}), 1000 * 60));
}
3 years ago
//reset update timer on settings change.
settingsStore.subscribe((settings) => {
if (interval !== undefined)
clearInterval(interval);
if (settings.updateTime != 0) {
interval = window.setInterval(() => __awaiter(this, void 0, void 0, function* () {
yield this.updateFeeds();
}), settings.updateTime * 60 * 1000);
this.registerInterval(interval);
}
this.settings = settings;
this.saveSettings();
});
feedsStore.subscribe((feeds) => {
//keep sorted store sorted when the items change.
const sorted = lodash_groupby(feeds, "folder");
sortedFeedsStore.update(() => sorted);
let items = [];
for (const feed in Object.keys(feeds)) {
3 years ago
//@ts-ignore
3 years ago
const feedItems = feeds[feed].items;
3 years ago
items = items.concat(feedItems);
3 years ago
}
3 years ago
//collect all tags for auto completion
const tags = [];
for (let item of items) {
tags.push(...item.tags);
}
//@ts-ignore
const fileTags = this.app.metadataCache.getTags();
for (const tag of Object.keys(fileTags)) {
tags.push(tag.replace('#', ''));
}
tagsStore.update(() => new Set(tags.filter(tag => tag.length > 0)));
3 years ago
this.filterItems(items);
});
this.app.workspace.onLayoutReady(() => __awaiter(this, void 0, void 0, function* () {
yield this.updateFeeds();
yield this.migrateData();
yield this.initLeaf();
}));
});
}
filterItems(items) {
const filtered = new Array();
for (const filter of this.settings.filtered) {
// @ts-ignore
const filterType = FilterType[filter.filterType];
// @ts-ignore
const sortOrder = SortOrder[filter.sortOrder];
let filteredItems;
if (filterType == FilterType.READ) {
filteredItems = items.filter((item) => {
return item.read && (filter.filterContent.split(",").contains(item.folder) || filter.filterContent.length == 0);
});
}
if (filterType == FilterType.FAVORITES) {
filteredItems = items.filter((item) => {
return item.favorite && (filter.filterContent.split(",").contains(item.folder) || filter.filterContent.length == 0);
});
}
if (filterType == FilterType.UNREAD) {
filteredItems = items.filter((item) => {
return !item.read && (filter.filterContent.split(",").contains(item.folder) || filter.filterContent.length == 0);
});
}
if (filterType == FilterType.TAGS) {
filteredItems = items.filter((item) => {
return item.tags.some((tag) => filter.filterContent.split(",").contains(tag));
});
}
const sortedItems = this.sortItems(filteredItems, sortOrder);
filtered.push({ filter: filter, items: { items: sortedItems } });
}
filteredItemsStore.update(() => filtered);
}
sortItems(items, sortOrder) {
if (sortOrder === SortOrder.ALPHABET_NORMAL) {
return items.sort((a, b) => a.title.localeCompare(b.title));
}
if (sortOrder === SortOrder.ALPHABET_INVERTED) {
return items.sort((a, b) => b.title.localeCompare(a.title));
}
if (sortOrder === SortOrder.DATE_NEWEST) {
//@ts-ignore
return items.sort((a, b) => window.moment(b.pubDate) - window.moment(a.pubDate));
}
if (sortOrder === SortOrder.DATE_OLDEST) {
//@ts-ignore
return items.sort((a, b) => window.moment(a.pubDate) - window.moment(b.pubDate));
}
return items;
}
updateFeeds() {
return __awaiter(this, void 0, void 0, function* () {
3 years ago
function mergeArrayById(array1, array2) {
3 years ago
const mergedObjectMap = lodash_keyby(array1, 'hash');
3 years ago
const finalArray = [];
for (const object of array2) {
3 years ago
mergedObjectMap[object.hash] = Object.assign(Object.assign({}, mergedObjectMap[object.hash]), object);
3 years ago
}
lodash_values(mergedObjectMap).forEach(object => {
finalArray.push(object);
});
return finalArray;
}
function customizer(objValue, srcValue) {
if (Array.isArray(objValue)) {
return mergeArrayById(objValue, srcValue);
}
}
3 years ago
let result = [];
for (const feed of this.settings.feeds) {
const items = yield getFeedItems(feed);
result.push(items);
}
3 years ago
let items = this.settings.items;
for (const feed of items) {
for (let item of feed.items) {
if (item.hash === undefined) {
item.hash = new Md5_1().appendStr(item.title).appendStr(item.folder).appendStr(item.link).end();
}
}
}
result = lodash_mergewith(result, items, customizer);
3 years ago
yield this.writeFeedContent(() => result);
});
}
onunload() {
console.log('unloading plugin rss reader');
this.app.workspace
.getLeavesOfType(VIEW_ID)
.forEach((leaf) => leaf.detach());
}
initLeaf() {
return __awaiter(this, void 0, void 0, function* () {
if (this.app.workspace.getLeavesOfType(VIEW_ID).length > 0) {
return;
}
yield this.app.workspace.getRightLeaf(false).setViewState({
type: VIEW_ID,
});
});
}
//migrate from old settings pre 0.6.0
migrateData() {
return __awaiter(this, void 0, void 0, function* () {
const configPath = this.app.vault.configDir + "/plugins/rss-reader/data.json";
const config = JSON.parse(yield this.app.vault.adapter.read(configPath));
if (config.read === undefined)
return;
new obsidian.Notice("RSS Reader: migrating data");
for (const content of Object.values(config.items)) {
// @ts-ignore
for (const item of content.items) {
if (config.read.items.some((readItem) => {
return item.title == readItem.title && item.link == readItem.link && item.content == readItem.content;
})) {
item.read = true;
}
}
// @ts-ignore
for (const item of content.items) {
if (config.favorites.items.some((favItem) => {
return item.title == favItem.title && item.link == favItem.link && item.content == favItem.content;
})) {
item.favorite = true;
}
}
}
delete config.read;
delete config.favorites;
yield this.app.vault.adapter.write(configPath, JSON.stringify(config));
yield this.loadSettings();
new obsidian.Notice("RSS Reader: data has been migrated");
});
}
loadSettings() {
return __awaiter(this, void 0, void 0, function* () {
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
settingsStore.set(this.settings);
configuredFeedsStore.set(this.settings.feeds);
feedsStore.set(this.settings.items);
3 years ago
foldedState.set(this.settings.folded);
3 years ago
});
}
saveSettings() {
return __awaiter(this, void 0, void 0, function* () {
yield this.saveData(this.settings);
});
}
writeFeeds(changeOpts) {
return __awaiter(this, void 0, void 0, function* () {
yield configuredFeedsStore.update((old) => (Object.assign(Object.assign({}, old), changeOpts(old))));
yield this.writeSettings((old) => ({
feeds: changeOpts(old.feeds)
}));
yield this.updateFeeds();
});
}
writeFeedContent(changeOpts) {
return __awaiter(this, void 0, void 0, function* () {
3 years ago
yield feedsStore.update((old) => (Object.assign({}, changeOpts(old))));
3 years ago
yield this.writeSettings((old) => ({
items: changeOpts(old.items)
}));
});
}
writeFiltered(changeOpts) {
return __awaiter(this, void 0, void 0, function* () {
yield filteredStore.update((old) => (Object.assign(Object.assign({}, old), changeOpts(old))));
yield this.writeSettings((old) => ({
filtered: changeOpts(old.filtered)
}));
yield this.updateFeeds();
});
}
3 years ago
writeFolded(folded) {
return __awaiter(this, void 0, void 0, function* () {
yield foldedState.update(() => (folded));
yield this.writeSettings(() => ({
folded: folded
}));
});
}
3 years ago
writeSettings(changeOpts) {
return __awaiter(this, void 0, void 0, function* () {
yield settingsStore.update((old) => (Object.assign(Object.assign({}, old), changeOpts(old))));
});
}
}
module.exports = RssReaderPlugin;
3 years ago
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZW51bXMuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXROb2RlTmFtZS5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldFdpbmRvdy5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2luc3RhbmNlT2YuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL21vZGlmaWVycy9hcHBseVN0eWxlcy5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvdXRpbHMvZ2V0QmFzZVBsYWNlbWVudC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvdXRpbHMvbWF0aC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldEJvdW5kaW5nQ2xpZW50UmVjdC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldExheW91dFJlY3QuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9jb250YWlucy5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldENvbXB1dGVkU3R5bGUuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9pc1RhYmxlRWxlbWVudC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldERvY3VtZW50RWxlbWVudC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldFBhcmVudE5vZGUuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRPZmZzZXRQYXJlbnQuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL2dldE1haW5BeGlzRnJvbVBsYWNlbWVudC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvdXRpbHMvd2l0aGluLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9nZXRGcmVzaFNpZGVPYmplY3QuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL21lcmdlUGFkZGluZ09iamVjdC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvdXRpbHMvZXhwYW5kVG9IYXNoTWFwLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9tb2RpZmllcnMvYXJyb3cuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL2dldFZhcmlhdGlvbi5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvbW9kaWZpZXJzL2NvbXB1dGVTdHlsZXMuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL21vZGlmaWVycy9ldmVudExpc3RlbmVycy5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvdXRpbHMvZ2V0T3Bwb3NpdGVQbGFjZW1lbnQuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL2dldE9wcG9zaXRlVmFyaWF0aW9uUGxhY2VtZW50LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvZ2V0V2luZG93U2Nyb2xsLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvZ2V0V2luZG93U2Nyb2xsQmFyWC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldFZpZXdwb3J0UmVjdC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldERvY3VtZW50UmVjdC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2lzU2Nyb2xsUGFyZW50LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvZ2V0U2Nyb2xsUGFyZW50LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvbGlzdFNjcm9sbFBhcmVudHMuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL3JlY3RUb0NsaWVudFJlY3QuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRDbGlwcGluZ1JlY3QuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL2NvbXB1dGVPZmZzZXRzLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9kZXRlY3RPdmVyZmxvdy5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvdXRpbHMvY29tcHV0ZUF1dG9QbGFjZW1lbnQuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL21vZGlmaWVycy9mbGlwLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9tb2RpZmllcnMvaGlkZS5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvbW9kaWZpZXJzL29mZnNldC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvbW9kaWZpZXJzL3BvcHBlck9mZnNldHMuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL2dldEFsdEF4aXMuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL21vZGlmaWVycy9wcmV2ZW50T3ZlcmZsb3cuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRIVE1MRWxlbWVudFNjcm9sbC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldE5vZGVTY3JvbGwuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRDb21wb3NpdGVSZWN0LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9vcmRlck1vZGlmaWVycy5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvdXRpbHMvZGVib3VuY2UuanMiLCJub2R