1 /******/ (() => { // webpackBootstrap
2 /******/ var __webpack_modules__ = ({
4 /***/ "./node_modules/keyboardjs/dist/keyboard.js":
5 /*!**************************************************!*\
6 !*** ./node_modules/keyboardjs/dist/keyboard.js ***!
7 \**************************************************/
8 /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
10 (function (global, factory) {
11 true ? module.exports = factory() :
13 }(this, (function () { 'use strict';
15 function _typeof(obj) {
16 "@babel/helpers - typeof";
18 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
19 _typeof = function (obj) {
23 _typeof = function (obj) {
24 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
31 function _classCallCheck(instance, Constructor) {
32 if (!(instance instanceof Constructor)) {
33 throw new TypeError("Cannot call a class as a function");
37 function _defineProperties(target, props) {
38 for (var i = 0; i < props.length; i++) {
39 var descriptor = props[i];
40 descriptor.enumerable = descriptor.enumerable || false;
41 descriptor.configurable = true;
42 if ("value" in descriptor) descriptor.writable = true;
43 Object.defineProperty(target, descriptor.key, descriptor);
47 function _createClass(Constructor, protoProps, staticProps) {
48 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
49 if (staticProps) _defineProperties(Constructor, staticProps);
53 function _toConsumableArray(arr) {
54 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
57 function _arrayWithoutHoles(arr) {
58 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
61 function _iterableToArray(iter) {
62 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
65 function _unsupportedIterableToArray(o, minLen) {
67 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
68 var n = Object.prototype.toString.call(o).slice(8, -1);
69 if (n === "Object" && o.constructor) n = o.constructor.name;
70 if (n === "Map" || n === "Set") return Array.from(o);
71 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
74 function _arrayLikeToArray(arr, len) {
75 if (len == null || len > arr.length) len = arr.length;
77 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
82 function _nonIterableSpread() {
83 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
86 var KeyCombo = /*#__PURE__*/function () {
87 function KeyCombo(keyComboStr) {
88 _classCallCheck(this, KeyCombo);
90 this.sourceStr = keyComboStr;
91 this.subCombos = KeyCombo.parseComboStr(keyComboStr);
92 this.keyNames = this.subCombos.reduce(function (memo, nextSubCombo) {
93 return memo.concat(nextSubCombo);
97 _createClass(KeyCombo, [{
99 value: function check(pressedKeyNames) {
100 var startingKeyNameIndex = 0;
102 for (var i = 0; i < this.subCombos.length; i += 1) {
103 startingKeyNameIndex = this._checkSubCombo(this.subCombos[i], startingKeyNameIndex, pressedKeyNames);
105 if (startingKeyNameIndex === -1) {
114 value: function isEqual(otherKeyCombo) {
115 if (!otherKeyCombo || typeof otherKeyCombo !== 'string' && _typeof(otherKeyCombo) !== 'object') {
119 if (typeof otherKeyCombo === 'string') {
120 otherKeyCombo = new KeyCombo(otherKeyCombo);
123 if (this.subCombos.length !== otherKeyCombo.subCombos.length) {
127 for (var i = 0; i < this.subCombos.length; i += 1) {
128 if (this.subCombos[i].length !== otherKeyCombo.subCombos[i].length) {
133 for (var _i = 0; _i < this.subCombos.length; _i += 1) {
134 var subCombo = this.subCombos[_i];
136 var otherSubCombo = otherKeyCombo.subCombos[_i].slice(0);
138 for (var j = 0; j < subCombo.length; j += 1) {
139 var keyName = subCombo[j];
140 var index = otherSubCombo.indexOf(keyName);
143 otherSubCombo.splice(index, 1);
147 if (otherSubCombo.length !== 0) {
155 key: "_checkSubCombo",
156 value: function _checkSubCombo(subCombo, startingKeyNameIndex, pressedKeyNames) {
157 subCombo = subCombo.slice(0);
158 pressedKeyNames = pressedKeyNames.slice(startingKeyNameIndex);
159 var endIndex = startingKeyNameIndex;
161 for (var i = 0; i < subCombo.length; i += 1) {
162 var keyName = subCombo[i];
164 if (keyName[0] === '\\') {
165 var escapedKeyName = keyName.slice(1);
167 if (escapedKeyName === KeyCombo.comboDeliminator || escapedKeyName === KeyCombo.keyDeliminator) {
168 keyName = escapedKeyName;
172 var index = pressedKeyNames.indexOf(keyName);
175 subCombo.splice(i, 1);
178 if (index > endIndex) {
182 if (subCombo.length === 0) {
194 KeyCombo.comboDeliminator = '>';
195 KeyCombo.keyDeliminator = '+';
197 KeyCombo.parseComboStr = function (keyComboStr) {
198 var subComboStrs = KeyCombo._splitStr(keyComboStr, KeyCombo.comboDeliminator);
202 for (var i = 0; i < subComboStrs.length; i += 1) {
203 combo.push(KeyCombo._splitStr(subComboStrs[i], KeyCombo.keyDeliminator));
209 KeyCombo._splitStr = function (str, deliminator) {
215 for (var ci = 0; ci < s.length; ci += 1) {
216 if (ci > 0 && s[ci] === d && s[ci - 1] !== '\\') {
232 var Locale = /*#__PURE__*/function () {
233 function Locale(name) {
234 _classCallCheck(this, Locale);
236 this.localeName = name;
237 this.activeTargetKeys = [];
238 this.pressedKeys = [];
239 this._appliedMacros = [];
241 this._killKeyCodes = [];
245 _createClass(Locale, [{
247 value: function bindKeyCode(keyCode, keyNames) {
248 if (typeof keyNames === 'string') {
249 keyNames = [keyNames];
252 this._keyMap[keyCode] = keyNames;
256 value: function bindMacro(keyComboStr, keyNames) {
257 if (typeof keyNames === 'string') {
258 keyNames = [keyNames];
263 if (typeof keyNames === 'function') {
269 keyCombo: new KeyCombo(keyComboStr),
274 this._macros.push(macro);
278 value: function getKeyCodes(keyName) {
281 for (var keyCode in this._keyMap) {
282 var index = this._keyMap[keyCode].indexOf(keyName);
285 keyCodes.push(keyCode | 0);
293 value: function getKeyNames(keyCode) {
294 return this._keyMap[keyCode] || [];
298 value: function setKillKey(keyCode) {
299 if (typeof keyCode === 'string') {
300 var keyCodes = this.getKeyCodes(keyCode);
302 for (var i = 0; i < keyCodes.length; i += 1) {
303 this.setKillKey(keyCodes[i]);
309 this._killKeyCodes.push(keyCode);
313 value: function pressKey(keyCode) {
314 if (typeof keyCode === 'string') {
315 var keyCodes = this.getKeyCodes(keyCode);
317 for (var i = 0; i < keyCodes.length; i += 1) {
318 this.pressKey(keyCodes[i]);
324 this.activeTargetKeys.length = 0;
325 var keyNames = this.getKeyNames(keyCode);
327 for (var _i = 0; _i < keyNames.length; _i += 1) {
328 this.activeTargetKeys.push(keyNames[_i]);
330 if (this.pressedKeys.indexOf(keyNames[_i]) === -1) {
331 this.pressedKeys.push(keyNames[_i]);
339 value: function releaseKey(keyCode) {
340 if (typeof keyCode === 'string') {
341 var keyCodes = this.getKeyCodes(keyCode);
343 for (var i = 0; i < keyCodes.length; i += 1) {
344 this.releaseKey(keyCodes[i]);
347 var keyNames = this.getKeyNames(keyCode);
349 var killKeyCodeIndex = this._killKeyCodes.indexOf(keyCode);
351 if (killKeyCodeIndex !== -1) {
352 this.pressedKeys.length = 0;
354 for (var _i2 = 0; _i2 < keyNames.length; _i2 += 1) {
355 var index = this.pressedKeys.indexOf(keyNames[_i2]);
358 this.pressedKeys.splice(index, 1);
363 this.activeTargetKeys.length = 0;
370 value: function _applyMacros() {
371 var macros = this._macros.slice(0);
373 for (var i = 0; i < macros.length; i += 1) {
374 var macro = macros[i];
376 if (macro.keyCombo.check(this.pressedKeys)) {
378 macro.keyNames = macro.handler(this.pressedKeys);
381 for (var j = 0; j < macro.keyNames.length; j += 1) {
382 if (this.pressedKeys.indexOf(macro.keyNames[j]) === -1) {
383 this.pressedKeys.push(macro.keyNames[j]);
387 this._appliedMacros.push(macro);
393 value: function _clearMacros() {
394 for (var i = 0; i < this._appliedMacros.length; i += 1) {
395 var macro = this._appliedMacros[i];
397 if (!macro.keyCombo.check(this.pressedKeys)) {
398 for (var j = 0; j < macro.keyNames.length; j += 1) {
399 var index = this.pressedKeys.indexOf(macro.keyNames[j]);
402 this.pressedKeys.splice(index, 1);
407 macro.keyNames = null;
410 this._appliedMacros.splice(i, 1);
421 var Keyboard = /*#__PURE__*/function () {
422 function Keyboard(targetWindow, targetElement, targetPlatform, targetUserAgent) {
423 _classCallCheck(this, Keyboard);
426 this._currentContext = '';
428 this._listeners = [];
429 this._appliedListeners = [];
431 this._targetElement = null;
432 this._targetWindow = null;
433 this._targetPlatform = '';
434 this._targetUserAgent = '';
435 this._isModernBrowser = false;
436 this._targetKeyDownBinding = null;
437 this._targetKeyUpBinding = null;
438 this._targetResetBinding = null;
439 this._paused = false;
440 this._contexts.global = {
441 listeners: this._listeners,
442 targetWindow: targetWindow,
443 targetElement: targetElement,
444 targetPlatform: targetPlatform,
445 targetUserAgent: targetUserAgent
447 this.setContext('global');
450 _createClass(Keyboard, [{
452 value: function setLocale(localeName, localeBuilder) {
455 if (typeof localeName === 'string') {
457 locale = new Locale(localeName);
458 localeBuilder(locale, this._targetPlatform, this._targetUserAgent);
460 locale = this._locales[localeName] || null;
464 localeName = locale._localeName;
467 this._locale = locale;
468 this._locales[localeName] = locale;
471 this._locale.pressedKeys = locale.pressedKeys;
478 value: function getLocale(localName) {
479 localName || (localName = this._locale.localeName);
480 return this._locales[localName] || null;
484 value: function bind(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault) {
485 if (keyComboStr === null || typeof keyComboStr === 'function') {
486 preventRepeatByDefault = releaseHandler;
487 releaseHandler = pressHandler;
488 pressHandler = keyComboStr;
492 if (keyComboStr && _typeof(keyComboStr) === 'object' && typeof keyComboStr.length === 'number') {
493 for (var i = 0; i < keyComboStr.length; i += 1) {
494 this.bind(keyComboStr[i], pressHandler, releaseHandler);
500 this._listeners.push({
501 keyCombo: keyComboStr ? new KeyCombo(keyComboStr) : null,
502 pressHandler: pressHandler || null,
503 releaseHandler: releaseHandler || null,
504 preventRepeat: false,
505 preventRepeatByDefault: preventRepeatByDefault || false,
506 executingHandler: false
513 value: function addListener(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault) {
514 return this.bind(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault);
518 value: function on(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault) {
519 return this.bind(keyComboStr, pressHandler, releaseHandler, preventRepeatByDefault);
523 value: function bindPress(keyComboStr, pressHandler, preventRepeatByDefault) {
524 return this.bind(keyComboStr, pressHandler, null, preventRepeatByDefault);
528 value: function bindRelease(keyComboStr, releaseHandler) {
529 return this.bind(keyComboStr, null, releaseHandler, preventRepeatByDefault);
533 value: function unbind(keyComboStr, pressHandler, releaseHandler) {
534 if (keyComboStr === null || typeof keyComboStr === 'function') {
535 releaseHandler = pressHandler;
536 pressHandler = keyComboStr;
540 if (keyComboStr && _typeof(keyComboStr) === 'object' && typeof keyComboStr.length === 'number') {
541 for (var i = 0; i < keyComboStr.length; i += 1) {
542 this.unbind(keyComboStr[i], pressHandler, releaseHandler);
548 for (var _i = 0; _i < this._listeners.length; _i += 1) {
549 var listener = this._listeners[_i];
550 var comboMatches = !keyComboStr && !listener.keyCombo || listener.keyCombo && listener.keyCombo.isEqual(keyComboStr);
551 var pressHandlerMatches = !pressHandler && !releaseHandler || !pressHandler && !listener.pressHandler || pressHandler === listener.pressHandler;
552 var releaseHandlerMatches = !pressHandler && !releaseHandler || !releaseHandler && !listener.releaseHandler || releaseHandler === listener.releaseHandler;
554 if (comboMatches && pressHandlerMatches && releaseHandlerMatches) {
555 this._listeners.splice(_i, 1);
564 key: "removeListener",
565 value: function removeListener(keyComboStr, pressHandler, releaseHandler) {
566 return this.unbind(keyComboStr, pressHandler, releaseHandler);
570 value: function off(keyComboStr, pressHandler, releaseHandler) {
571 return this.unbind(keyComboStr, pressHandler, releaseHandler);
575 value: function setContext(contextName) {
577 this.releaseAllKeys();
580 if (!this._contexts[contextName]) {
581 var globalContext = this._contexts.global;
582 this._contexts[contextName] = {
584 targetWindow: globalContext.targetWindow,
585 targetElement: globalContext.targetElement,
586 targetPlatform: globalContext.targetPlatform,
587 targetUserAgent: globalContext.targetUserAgent
591 var context = this._contexts[contextName];
592 this._currentContext = contextName;
593 this._listeners = context.listeners;
595 this.watch(context.targetWindow, context.targetElement, context.targetPlatform, context.targetUserAgent);
600 value: function getContext() {
601 return this._currentContext;
605 value: function withContext(contextName, callback) {
606 var previousContextName = this.getContext();
607 this.setContext(contextName);
609 this.setContext(previousContextName);
614 value: function watch(targetWindow, targetElement, targetPlatform, targetUserAgent) {
618 var win = typeof globalThis !== 'undefined' ? globalThis : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : {};
621 if (!win.addEventListener && !win.attachEvent) {
622 // This was added so when using things like JSDOM watch can be used to configure watch
623 // for the global namespace manually.
624 if (this._currentContext === 'global') {
628 throw new Error('Cannot find window functions addEventListener or attachEvent.');
632 } // Handle element bindings where a target window is not passed
635 if (typeof targetWindow.nodeType === 'number') {
636 targetUserAgent = targetPlatform;
637 targetPlatform = targetElement;
638 targetElement = targetWindow;
642 if (!targetWindow.addEventListener && !targetWindow.attachEvent) {
643 throw new Error('Cannot find addEventListener or attachEvent methods on targetWindow.');
646 this._isModernBrowser = !!targetWindow.addEventListener;
647 var userAgent = targetWindow.navigator && targetWindow.navigator.userAgent || '';
648 var platform = targetWindow.navigator && targetWindow.navigator.platform || '';
649 targetElement && targetElement !== null || (targetElement = targetWindow.document);
650 targetPlatform && targetPlatform !== null || (targetPlatform = platform);
651 targetUserAgent && targetUserAgent !== null || (targetUserAgent = userAgent);
653 this._targetKeyDownBinding = function (event) {
654 _this.pressKey(event.keyCode, event);
656 _this._handleCommandBug(event, platform);
659 this._targetKeyUpBinding = function (event) {
660 _this.releaseKey(event.keyCode, event);
663 this._targetResetBinding = function (event) {
664 _this.releaseAllKeys(event);
667 this._bindEvent(targetElement, 'keydown', this._targetKeyDownBinding);
669 this._bindEvent(targetElement, 'keyup', this._targetKeyUpBinding);
671 this._bindEvent(targetWindow, 'focus', this._targetResetBinding);
673 this._bindEvent(targetWindow, 'blur', this._targetResetBinding);
675 this._targetElement = targetElement;
676 this._targetWindow = targetWindow;
677 this._targetPlatform = targetPlatform;
678 this._targetUserAgent = targetUserAgent;
679 var currentContext = this._contexts[this._currentContext];
680 currentContext.targetWindow = this._targetWindow;
681 currentContext.targetElement = this._targetElement;
682 currentContext.targetPlatform = this._targetPlatform;
683 currentContext.targetUserAgent = this._targetUserAgent;
688 value: function stop() {
689 if (!this._targetElement || !this._targetWindow) {
693 this._unbindEvent(this._targetElement, 'keydown', this._targetKeyDownBinding);
695 this._unbindEvent(this._targetElement, 'keyup', this._targetKeyUpBinding);
697 this._unbindEvent(this._targetWindow, 'focus', this._targetResetBinding);
699 this._unbindEvent(this._targetWindow, 'blur', this._targetResetBinding);
701 this._targetWindow = null;
702 this._targetElement = null;
707 value: function pressKey(keyCode, event) {
713 throw new Error('Locale not set');
716 this._locale.pressKey(keyCode);
718 this._applyBindings(event);
724 value: function releaseKey(keyCode, event) {
730 throw new Error('Locale not set');
733 this._locale.releaseKey(keyCode);
735 this._clearBindings(event);
740 key: "releaseAllKeys",
741 value: function releaseAllKeys(event) {
747 throw new Error('Locale not set');
750 this._locale.pressedKeys.length = 0;
752 this._clearBindings(event);
758 value: function pause() {
764 this.releaseAllKeys();
772 value: function resume() {
773 this._paused = false;
778 value: function reset() {
779 this.releaseAllKeys();
780 this._listeners.length = 0;
785 value: function _bindEvent(targetElement, eventName, handler) {
786 return this._isModernBrowser ? targetElement.addEventListener(eventName, handler, false) : targetElement.attachEvent('on' + eventName, handler);
790 value: function _unbindEvent(targetElement, eventName, handler) {
791 return this._isModernBrowser ? targetElement.removeEventListener(eventName, handler, false) : targetElement.detachEvent('on' + eventName, handler);
794 key: "_getGroupedListeners",
795 value: function _getGroupedListeners() {
796 var listenerGroups = [];
797 var listenerGroupMap = [];
798 var listeners = this._listeners;
800 if (this._currentContext !== 'global') {
801 listeners = [].concat(_toConsumableArray(listeners), _toConsumableArray(this._contexts.global.listeners));
804 listeners.sort(function (a, b) {
805 return (b.keyCombo ? b.keyCombo.keyNames.length : 0) - (a.keyCombo ? a.keyCombo.keyNames.length : 0);
806 }).forEach(function (l) {
809 for (var i = 0; i < listenerGroupMap.length; i += 1) {
810 if (listenerGroupMap[i] === null && l.keyCombo === null || listenerGroupMap[i] !== null && listenerGroupMap[i].isEqual(l.keyCombo)) {
815 if (mapIndex === -1) {
816 mapIndex = listenerGroupMap.length;
817 listenerGroupMap.push(l.keyCombo);
820 if (!listenerGroups[mapIndex]) {
821 listenerGroups[mapIndex] = [];
824 listenerGroups[mapIndex].push(l);
826 return listenerGroups;
829 key: "_applyBindings",
830 value: function _applyBindings(event) {
833 var preventRepeat = false;
834 event || (event = {});
836 event.preventRepeat = function () {
837 preventRepeat = true;
840 event.pressedKeys = this._locale.pressedKeys.slice(0);
841 var activeTargetKeys = this._locale.activeTargetKeys;
843 var pressedKeys = this._locale.pressedKeys.slice(0);
845 var listenerGroups = this._getGroupedListeners();
847 var _loop = function _loop(i) {
848 var listeners = listenerGroups[i];
849 var keyCombo = listeners[0].keyCombo;
851 if (keyCombo === null || keyCombo.check(pressedKeys) && activeTargetKeys.some(function (k) {
852 return keyCombo.keyNames.includes(k);
854 for (var j = 0; j < listeners.length; j += 1) {
855 var listener = listeners[j];
857 if (!listener.executingHandler && listener.pressHandler && !listener.preventRepeat) {
858 listener.executingHandler = true;
859 listener.pressHandler.call(_this2, event);
860 listener.executingHandler = false;
862 if (preventRepeat || listener.preventRepeatByDefault) {
863 listener.preventRepeat = true;
864 preventRepeat = false;
868 if (_this2._appliedListeners.indexOf(listener) === -1) {
869 _this2._appliedListeners.push(listener);
874 for (var _j = 0; _j < keyCombo.keyNames.length; _j += 1) {
875 var index = pressedKeys.indexOf(keyCombo.keyNames[_j]);
878 pressedKeys.splice(index, 1);
886 for (var i = 0; i < listenerGroups.length; i += 1) {
891 key: "_clearBindings",
892 value: function _clearBindings(event) {
893 event || (event = {});
894 event.pressedKeys = this._locale.pressedKeys.slice(0);
896 for (var i = 0; i < this._appliedListeners.length; i += 1) {
897 var listener = this._appliedListeners[i];
898 var keyCombo = listener.keyCombo;
900 if (keyCombo === null || !keyCombo.check(this._locale.pressedKeys)) {
901 listener.preventRepeat = false;
903 if (keyCombo !== null || event.pressedKeys.length === 0) {
904 this._appliedListeners.splice(i, 1);
909 if (!listener.executingHandler && listener.releaseHandler) {
910 listener.executingHandler = true;
911 listener.releaseHandler.call(this, event);
912 listener.executingHandler = false;
918 key: "_handleCommandBug",
919 value: function _handleCommandBug(event, platform) {
920 // On Mac when the command key is kept pressed, keyup is not triggered for any other key.
921 // In this case force a keyup for non-modifier keys directly after the keypress.
922 var modifierKeys = ["shift", "ctrl", "alt", "capslock", "tab", "command"];
924 if (platform.match("Mac") && this._locale.pressedKeys.includes("command") && !modifierKeys.includes(this._locale.getKeyNames(event.keyCode)[0])) {
925 this._targetKeyUpBinding(event);
933 function us(locale, platform, userAgent) {
935 locale.bindKeyCode(3, ['cancel']);
936 locale.bindKeyCode(8, ['backspace']);
937 locale.bindKeyCode(9, ['tab']);
938 locale.bindKeyCode(12, ['clear']);
939 locale.bindKeyCode(13, ['enter']);
940 locale.bindKeyCode(16, ['shift']);
941 locale.bindKeyCode(17, ['ctrl']);
942 locale.bindKeyCode(18, ['alt', 'menu']);
943 locale.bindKeyCode(19, ['pause', 'break']);
944 locale.bindKeyCode(20, ['capslock']);
945 locale.bindKeyCode(27, ['escape', 'esc']);
946 locale.bindKeyCode(32, ['space', 'spacebar']);
947 locale.bindKeyCode(33, ['pageup']);
948 locale.bindKeyCode(34, ['pagedown']);
949 locale.bindKeyCode(35, ['end']);
950 locale.bindKeyCode(36, ['home']);
951 locale.bindKeyCode(37, ['left']);
952 locale.bindKeyCode(38, ['up']);
953 locale.bindKeyCode(39, ['right']);
954 locale.bindKeyCode(40, ['down']);
955 locale.bindKeyCode(41, ['select']);
956 locale.bindKeyCode(42, ['printscreen']);
957 locale.bindKeyCode(43, ['execute']);
958 locale.bindKeyCode(44, ['snapshot']);
959 locale.bindKeyCode(45, ['insert', 'ins']);
960 locale.bindKeyCode(46, ['delete', 'del']);
961 locale.bindKeyCode(47, ['help']);
962 locale.bindKeyCode(145, ['scrolllock', 'scroll']);
963 locale.bindKeyCode(188, ['comma', ',']);
964 locale.bindKeyCode(190, ['period', '.']);
965 locale.bindKeyCode(191, ['slash', 'forwardslash', '/']);
966 locale.bindKeyCode(192, ['graveaccent', '`']);
967 locale.bindKeyCode(219, ['openbracket', '[']);
968 locale.bindKeyCode(220, ['backslash', '\\']);
969 locale.bindKeyCode(221, ['closebracket', ']']);
970 locale.bindKeyCode(222, ['apostrophe', '\'']); // 0-9
972 locale.bindKeyCode(48, ['zero', '0']);
973 locale.bindKeyCode(49, ['one', '1']);
974 locale.bindKeyCode(50, ['two', '2']);
975 locale.bindKeyCode(51, ['three', '3']);
976 locale.bindKeyCode(52, ['four', '4']);
977 locale.bindKeyCode(53, ['five', '5']);
978 locale.bindKeyCode(54, ['six', '6']);
979 locale.bindKeyCode(55, ['seven', '7']);
980 locale.bindKeyCode(56, ['eight', '8']);
981 locale.bindKeyCode(57, ['nine', '9']); // numpad
983 locale.bindKeyCode(96, ['numzero', 'num0']);
984 locale.bindKeyCode(97, ['numone', 'num1']);
985 locale.bindKeyCode(98, ['numtwo', 'num2']);
986 locale.bindKeyCode(99, ['numthree', 'num3']);
987 locale.bindKeyCode(100, ['numfour', 'num4']);
988 locale.bindKeyCode(101, ['numfive', 'num5']);
989 locale.bindKeyCode(102, ['numsix', 'num6']);
990 locale.bindKeyCode(103, ['numseven', 'num7']);
991 locale.bindKeyCode(104, ['numeight', 'num8']);
992 locale.bindKeyCode(105, ['numnine', 'num9']);
993 locale.bindKeyCode(106, ['nummultiply', 'num*']);
994 locale.bindKeyCode(107, ['numadd', 'num+']);
995 locale.bindKeyCode(108, ['numenter']);
996 locale.bindKeyCode(109, ['numsubtract', 'num-']);
997 locale.bindKeyCode(110, ['numdecimal', 'num.']);
998 locale.bindKeyCode(111, ['numdivide', 'num/']);
999 locale.bindKeyCode(144, ['numlock', 'num']); // function keys
1001 locale.bindKeyCode(112, ['f1']);
1002 locale.bindKeyCode(113, ['f2']);
1003 locale.bindKeyCode(114, ['f3']);
1004 locale.bindKeyCode(115, ['f4']);
1005 locale.bindKeyCode(116, ['f5']);
1006 locale.bindKeyCode(117, ['f6']);
1007 locale.bindKeyCode(118, ['f7']);
1008 locale.bindKeyCode(119, ['f8']);
1009 locale.bindKeyCode(120, ['f9']);
1010 locale.bindKeyCode(121, ['f10']);
1011 locale.bindKeyCode(122, ['f11']);
1012 locale.bindKeyCode(123, ['f12']);
1013 locale.bindKeyCode(124, ['f13']);
1014 locale.bindKeyCode(125, ['f14']);
1015 locale.bindKeyCode(126, ['f15']);
1016 locale.bindKeyCode(127, ['f16']);
1017 locale.bindKeyCode(128, ['f17']);
1018 locale.bindKeyCode(129, ['f18']);
1019 locale.bindKeyCode(130, ['f19']);
1020 locale.bindKeyCode(131, ['f20']);
1021 locale.bindKeyCode(132, ['f21']);
1022 locale.bindKeyCode(133, ['f22']);
1023 locale.bindKeyCode(134, ['f23']);
1024 locale.bindKeyCode(135, ['f24']); // secondary key symbols
1026 locale.bindMacro('shift + `', ['tilde', '~']);
1027 locale.bindMacro('shift + 1', ['exclamation', 'exclamationpoint', '!']);
1028 locale.bindMacro('shift + 2', ['at', '@']);
1029 locale.bindMacro('shift + 3', ['number', '#']);
1030 locale.bindMacro('shift + 4', ['dollar', 'dollars', 'dollarsign', '$']);
1031 locale.bindMacro('shift + 5', ['percent', '%']);
1032 locale.bindMacro('shift + 6', ['caret', '^']);
1033 locale.bindMacro('shift + 7', ['ampersand', 'and', '&']);
1034 locale.bindMacro('shift + 8', ['asterisk', '*']);
1035 locale.bindMacro('shift + 9', ['openparen', '(']);
1036 locale.bindMacro('shift + 0', ['closeparen', ')']);
1037 locale.bindMacro('shift + -', ['underscore', '_']);
1038 locale.bindMacro('shift + =', ['plus', '+']);
1039 locale.bindMacro('shift + [', ['opencurlybrace', 'opencurlybracket', '{']);
1040 locale.bindMacro('shift + ]', ['closecurlybrace', 'closecurlybracket', '}']);
1041 locale.bindMacro('shift + \\', ['verticalbar', '|']);
1042 locale.bindMacro('shift + ;', ['colon', ':']);
1043 locale.bindMacro('shift + \'', ['quotationmark', '\'']);
1044 locale.bindMacro('shift + !,', ['openanglebracket', '<']);
1045 locale.bindMacro('shift + .', ['closeanglebracket', '>']);
1046 locale.bindMacro('shift + /', ['questionmark', '?']);
1048 if (platform.match('Mac')) {
1049 locale.bindMacro('command', ['mod', 'modifier']);
1051 locale.bindMacro('ctrl', ['mod', 'modifier']);
1055 for (var keyCode = 65; keyCode <= 90; keyCode += 1) {
1056 var keyName = String.fromCharCode(keyCode + 32);
1057 var capitalKeyName = String.fromCharCode(keyCode);
1058 locale.bindKeyCode(keyCode, keyName);
1059 locale.bindMacro('shift + ' + keyName, capitalKeyName);
1060 locale.bindMacro('capslock + ' + keyName, capitalKeyName);
1061 } // browser caveats
1064 var semicolonKeyCode = userAgent.match('Firefox') ? 59 : 186;
1065 var dashKeyCode = userAgent.match('Firefox') ? 173 : 189;
1066 var equalKeyCode = userAgent.match('Firefox') ? 61 : 187;
1067 var leftCommandKeyCode;
1068 var rightCommandKeyCode;
1070 if (platform.match('Mac') && (userAgent.match('Safari') || userAgent.match('Chrome'))) {
1071 leftCommandKeyCode = 91;
1072 rightCommandKeyCode = 93;
1073 } else if (platform.match('Mac') && userAgent.match('Opera')) {
1074 leftCommandKeyCode = 17;
1075 rightCommandKeyCode = 17;
1076 } else if (platform.match('Mac') && userAgent.match('Firefox')) {
1077 leftCommandKeyCode = 224;
1078 rightCommandKeyCode = 224;
1081 locale.bindKeyCode(semicolonKeyCode, ['semicolon', ';']);
1082 locale.bindKeyCode(dashKeyCode, ['dash', '-']);
1083 locale.bindKeyCode(equalKeyCode, ['equal', 'equalsign', '=']);
1084 locale.bindKeyCode(leftCommandKeyCode, ['command', 'windows', 'win', 'super', 'leftcommand', 'leftwindows', 'leftwin', 'leftsuper']);
1085 locale.bindKeyCode(rightCommandKeyCode, ['command', 'windows', 'win', 'super', 'rightcommand', 'rightwindows', 'rightwin', 'rightsuper']); // kill keys
1087 locale.setKillKey('command');
1090 var keyboard = new Keyboard();
1091 keyboard.setLocale('us', us);
1092 keyboard.Keyboard = Keyboard;
1093 keyboard.Locale = Locale;
1094 keyboard.KeyCombo = KeyCombo;
1099 //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2V5Ym9hcmQuanMiLCJzb3VyY2VzIjpbIi4uL2xpYi9rZXktY29tYm8uanMiLCIuLi9saWIvbG9jYWxlLmpzIiwiLi4vbGliL2tleWJvYXJkLmpzIiwiLi4vbG9jYWxlcy91cy5qcyIsIi4uL2luZGV4LmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlxuZXhwb3J0IGNsYXNzIEtleUNvbWJvIHtcbiAgY29uc3RydWN0b3Ioa2V5Q29tYm9TdHIpIHtcbiAgICB0aGlzLnNvdXJjZVN0ciA9IGtleUNvbWJvU3RyO1xuICAgIHRoaXMuc3ViQ29tYm9zID0gS2V5Q29tYm8ucGFyc2VDb21ib1N0cihrZXlDb21ib1N0cik7XG4gICAgdGhpcy5rZXlOYW1lcyAgPSB0aGlzLnN1YkNvbWJvcy5yZWR1Y2UoKG1lbW8sIG5leHRTdWJDb21ibykgPT5cbiAgICAgIG1lbW8uY29uY2F0KG5leHRTdWJDb21ibyksIFtdKTtcbiAgfVxuXG4gIGNoZWNrKHByZXNzZWRLZXlOYW1lcykge1xuICAgIGxldCBzdGFydGluZ0tleU5hbWVJbmRleCA9IDA7XG4gICAgZm9yIChsZXQgaSA9IDA7IGkgPCB0aGlzLnN1YkNvbWJvcy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgc3RhcnRpbmdLZXlOYW1lSW5kZXggPSB0aGlzLl9jaGVja1N1YkNvbWJvKFxuICAgICAgICB0aGlzLnN1YkNvbWJvc1tpXSxcbiAgICAgICAgc3RhcnRpbmdLZXlOYW1lSW5kZXgsXG4gICAgICAgIHByZXNzZWRLZ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udFJlcGVhdCkge1xuICAgICAgICAgICAgbGlzdGVuZXIuZXhlY3V0aW5nSGFuZGxlciA9IHRydWU7XG4gICAgICAgICAgICBsaXN0ZW5lci5wcmVzc0hhbmRsZXIuY2FsbCh0aGlzLCBldmVudCk7XG4gICAgICAgICAgICBsaXN0ZW5lci5leGVjdXRpbmdIYW5kbGVyID0gZmFsc2U7XG5cbiAgICAgICAgICAgIGlmIChwcmV2ZW50UmVwZWF0IHx8IGxpc3RlbmVyLnByZXZlbnRSZXBlYXRCeURlZmF1bHQpIHtcbiAgICAgICAgICAgICAgbGlzdGVuZXIucHJldmVudFJlcGVhdCA9IHRydWU7XG4gICAgICAgICAgICAgIHByZXZlbnRSZXBlYXQgICAgICAgICAgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAodGhpcy5fYXBwbGllZExpc3RlbmVycy5pbmRleE9mKGxpc3RlbmVyKSA9PT0gLTEpIHtcbiAgICAgICAgICAgIHRoaXMuX2FwcGxpZWRMaXN0ZW5lcnMucHVzaChsaXN0ZW5lcik7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGtleUNvbWJvKSB7XG4gICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBrZXlDb21iby5rZXlOYW1lcy5sZW5ndGg7IGogKz0gMSkge1xuICAgICAgICAgICAgY29uc3QgaW5kZXggPSBwcmVzc2VkS2V5cy5pbmRleE9mKGtleUNvbWJvLmtleU5hbWVzW2pdKTtcbiAgICAgICAgICAgIGlmIChpbmRleCAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgcHJlc3NlZEtleXMuc3BsaWNlKGluZGV4LCAxKTtcbiAgICAgICAgICAgICAgaiAtPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIF9jbGVhckJpbmRpbmdzKGV2ZW50KSB7XG4gICA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ENBQXhDO0VBQ0FyRSxFQUFBQSxNQUFNLENBQUM2RCxXQUFQLENBQW1CUyxtQkFBbkIsRUFBd0MsQ0FBQyxTQUFELEVBQVksU0FBWixFQUF1QixLQUF2QixFQUE4QixPQUE5QixFQUF1QyxjQUF2QyxFQUF1RCxjQUF2RCxFQUF1RSxVQUF2RSxFQUFtRixZQUFuRixDQUF4QyxFQTNKOEM7O0VBOEo5Q3RFLEVBQUFBLE1BQU0sQ0FBQ2pDLFVBQVAsQ0FBa0IsU0FBbEI7RUFDRDs7TUMzSkt3RyxRQUFRLEdBQUcsSUFBSS9GLFFBQUo7RUFFakIrRixRQUFRLENBQUNDLFNBQVQsQ0FBbUIsSUFBbkIsRUFBeUJaLEVBQXpCO0VBRUFXLFFBQVEsQ0FBQy9GLFFBQVQsR0FBb0JBLFFBQXBCO0VBQ0ErRixRQUFRLENBQUN2SCxNQUFULEdBQWtCQSxNQUFsQjtFQUNBdUgsUUFBUSxDQUFDL0osUUFBVCxHQUFvQkEsUUFBcEI7Ozs7Ozs7OyJ9
1104 /***/ "./node_modules/lodash/lodash.js":
1105 /*!***************************************!*\
1106 !*** ./node_modules/lodash/lodash.js ***!
1107 \***************************************/
1108 /***/ (function(module, exports, __webpack_require__) {
1110 /* module decorator */ module = __webpack_require__.nmd(module);
1111 var __WEBPACK_AMD_DEFINE_RESULT__;/**
1113 * Lodash <https://lodash.com/>
1114 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
1115 * Released under MIT license <https://lodash.com/license>
1116 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
1117 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
1121 /** Used as a safe reference for `undefined` in pre-ES5 environments. */
1124 /** Used as the semantic version number. */
1125 var VERSION = '4.17.21';
1127 /** Used as the size to enable large array optimizations. */
1128 var LARGE_ARRAY_SIZE = 200;
1130 /** Error message constants. */
1131 var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
1132 FUNC_ERROR_TEXT = 'Expected a function',
1133 INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
1135 /** Used to stand-in for `undefined` hash values. */
1136 var HASH_UNDEFINED = '__lodash_hash_undefined__';
1138 /** Used as the maximum memoize cache size. */
1139 var MAX_MEMOIZE_SIZE = 500;
1141 /** Used as the internal argument placeholder. */
1142 var PLACEHOLDER = '__lodash_placeholder__';
1144 /** Used to compose bitmasks for cloning. */
1145 var CLONE_DEEP_FLAG = 1,
1146 CLONE_FLAT_FLAG = 2,
1147 CLONE_SYMBOLS_FLAG = 4;
1149 /** Used to compose bitmasks for value comparisons. */
1150 var COMPARE_PARTIAL_FLAG = 1,
1151 COMPARE_UNORDERED_FLAG = 2;
1153 /** Used to compose bitmasks for function metadata. */
1154 var WRAP_BIND_FLAG = 1,
1155 WRAP_BIND_KEY_FLAG = 2,
1156 WRAP_CURRY_BOUND_FLAG = 4,
1157 WRAP_CURRY_FLAG = 8,
1158 WRAP_CURRY_RIGHT_FLAG = 16,
1159 WRAP_PARTIAL_FLAG = 32,
1160 WRAP_PARTIAL_RIGHT_FLAG = 64,
1161 WRAP_ARY_FLAG = 128,
1162 WRAP_REARG_FLAG = 256,
1163 WRAP_FLIP_FLAG = 512;
1165 /** Used as default options for `_.truncate`. */
1166 var DEFAULT_TRUNC_LENGTH = 30,
1167 DEFAULT_TRUNC_OMISSION = '...';
1169 /** Used to detect hot functions by number of calls within a span of milliseconds. */
1170 var HOT_COUNT = 800,
1173 /** Used to indicate the type of lazy iteratees. */
1174 var LAZY_FILTER_FLAG = 1,
1176 LAZY_WHILE_FLAG = 3;
1178 /** Used as references for various `Number` constants. */
1179 var INFINITY = 1 / 0,
1180 MAX_SAFE_INTEGER = 9007199254740991,
1181 MAX_INTEGER = 1.7976931348623157e+308,
1184 /** Used as references for the maximum length and index of an array. */
1185 var MAX_ARRAY_LENGTH = 4294967295,
1186 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
1187 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
1189 /** Used to associate wrap methods with their bit flags. */
1191 ['ary', WRAP_ARY_FLAG],
1192 ['bind', WRAP_BIND_FLAG],
1193 ['bindKey', WRAP_BIND_KEY_FLAG],
1194 ['curry', WRAP_CURRY_FLAG],
1195 ['curryRight', WRAP_CURRY_RIGHT_FLAG],
1196 ['flip', WRAP_FLIP_FLAG],
1197 ['partial', WRAP_PARTIAL_FLAG],
1198 ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
1199 ['rearg', WRAP_REARG_FLAG]
1202 /** `Object#toString` result references. */
1203 var argsTag = '[object Arguments]',
1204 arrayTag = '[object Array]',
1205 asyncTag = '[object AsyncFunction]',
1206 boolTag = '[object Boolean]',
1207 dateTag = '[object Date]',
1208 domExcTag = '[object DOMException]',
1209 errorTag = '[object Error]',
1210 funcTag = '[object Function]',
1211 genTag = '[object GeneratorFunction]',
1212 mapTag = '[object Map]',
1213 numberTag = '[object Number]',
1214 nullTag = '[object Null]',
1215 objectTag = '[object Object]',
1216 promiseTag = '[object Promise]',
1217 proxyTag = '[object Proxy]',
1218 regexpTag = '[object RegExp]',
1219 setTag = '[object Set]',
1220 stringTag = '[object String]',
1221 symbolTag = '[object Symbol]',
1222 undefinedTag = '[object Undefined]',
1223 weakMapTag = '[object WeakMap]',
1224 weakSetTag = '[object WeakSet]';
1226 var arrayBufferTag = '[object ArrayBuffer]',
1227 dataViewTag = '[object DataView]',
1228 float32Tag = '[object Float32Array]',
1229 float64Tag = '[object Float64Array]',
1230 int8Tag = '[object Int8Array]',
1231 int16Tag = '[object Int16Array]',
1232 int32Tag = '[object Int32Array]',
1233 uint8Tag = '[object Uint8Array]',
1234 uint8ClampedTag = '[object Uint8ClampedArray]',
1235 uint16Tag = '[object Uint16Array]',
1236 uint32Tag = '[object Uint32Array]';
1238 /** Used to match empty string literals in compiled template source. */
1239 var reEmptyStringLeading = /\b__p \+= '';/g,
1240 reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
1241 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
1243 /** Used to match HTML entities and HTML characters. */
1244 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
1245 reUnescapedHtml = /[&<>"']/g,
1246 reHasEscapedHtml = RegExp(reEscapedHtml.source),
1247 reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
1249 /** Used to match template delimiters. */
1250 var reEscape = /<%-([\s\S]+?)%>/g,
1251 reEvaluate = /<%([\s\S]+?)%>/g,
1252 reInterpolate = /<%=([\s\S]+?)%>/g;
1254 /** Used to match property names within property paths. */
1255 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
1256 reIsPlainProp = /^\w*$/,
1257 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1260 * Used to match `RegExp`
1261 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1263 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
1264 reHasRegExpChar = RegExp(reRegExpChar.source);
1266 /** Used to match leading whitespace. */
1267 var reTrimStart = /^\s+/;
1269 /** Used to match a single whitespace character. */
1270 var reWhitespace = /\s/;
1272 /** Used to match wrap detail comments. */
1273 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
1274 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
1275 reSplitDetails = /,? & /;
1277 /** Used to match words composed of alphanumeric characters. */
1278 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
1281 * Used to validate the `validate` option in `_.template` variable.
1283 * Forbids characters which could potentially change the meaning of the function argument definition:
1284 * - "()," (modification of function parameters)
1285 * - "=" (default value)
1286 * - "[]{}" (destructuring of function parameters)
1287 * - "/" (beginning of a comment)
1290 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
1292 /** Used to match backslashes in property paths. */
1293 var reEscapeChar = /\\(\\)?/g;
1297 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
1299 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
1301 /** Used to match `RegExp` flags from their coerced string values. */
1302 var reFlags = /\w*$/;
1304 /** Used to detect bad signed hexadecimal string values. */
1305 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
1307 /** Used to detect binary string values. */
1308 var reIsBinary = /^0b[01]+$/i;
1310 /** Used to detect host constructors (Safari). */
1311 var reIsHostCtor = /^\[object .+?Constructor\]$/;
1313 /** Used to detect octal string values. */
1314 var reIsOctal = /^0o[0-7]+$/i;
1316 /** Used to detect unsigned integer values. */
1317 var reIsUint = /^(?:0|[1-9]\d*)$/;
1319 /** Used to match Latin Unicode letters (excluding mathematical operators). */
1320 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
1322 /** Used to ensure capturing order of template delimiters. */
1323 var reNoMatch = /($^)/;
1325 /** Used to match unescaped characters in compiled string literals. */
1326 var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
1328 /** Used to compose unicode character classes. */
1329 var rsAstralRange = '\\ud800-\\udfff',
1330 rsComboMarksRange = '\\u0300-\\u036f',
1331 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
1332 rsComboSymbolsRange = '\\u20d0-\\u20ff',
1333 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
1334 rsDingbatRange = '\\u2700-\\u27bf',
1335 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
1336 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
1337 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
1338 rsPunctuationRange = '\\u2000-\\u206f',
1339 rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
1340 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
1341 rsVarRange = '\\ufe0e\\ufe0f',
1342 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
1344 /** Used to compose unicode capture groups. */
1345 var rsApos = "['\u2019]",
1346 rsAstral = '[' + rsAstralRange + ']',
1347 rsBreak = '[' + rsBreakRange + ']',
1348 rsCombo = '[' + rsComboRange + ']',
1350 rsDingbat = '[' + rsDingbatRange + ']',
1351 rsLower = '[' + rsLowerRange + ']',
1352 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
1353 rsFitz = '\\ud83c[\\udffb-\\udfff]',
1354 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
1355 rsNonAstral = '[^' + rsAstralRange + ']',
1356 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
1357 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
1358 rsUpper = '[' + rsUpperRange + ']',
1361 /** Used to compose unicode regexes. */
1362 var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
1363 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
1364 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
1365 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
1366 reOptMod = rsModifier + '?',
1367 rsOptVar = '[' + rsVarRange + ']?',
1368 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
1369 rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
1370 rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
1371 rsSeq = rsOptVar + reOptMod + rsOptJoin,
1372 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
1373 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
1375 /** Used to match apostrophes. */
1376 var reApos = RegExp(rsApos, 'g');
1379 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
1380 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
1382 var reComboMark = RegExp(rsCombo, 'g');
1384 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
1385 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
1387 /** Used to match complex or compound words. */
1388 var reUnicodeWord = RegExp([
1389 rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
1390 rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
1391 rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
1392 rsUpper + '+' + rsOptContrUpper,
1399 /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
1400 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
1402 /** Used to detect strings that need a more robust regexp to match words. */
1403 var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
1405 /** Used to assign default `context` object properties. */
1406 var contextProps = [
1407 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
1408 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
1409 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
1410 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
1411 '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
1414 /** Used to make template sourceURLs easier to identify. */
1415 var templateCounter = -1;
1417 /** Used to identify `toStringTag` values of typed arrays. */
1418 var typedArrayTags = {};
1419 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1420 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1421 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1422 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1423 typedArrayTags[uint32Tag] = true;
1424 typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
1425 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
1426 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
1427 typedArrayTags[errorTag] = typedArrayTags[funcTag] =
1428 typedArrayTags[mapTag] = typedArrayTags[numberTag] =
1429 typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
1430 typedArrayTags[setTag] = typedArrayTags[stringTag] =
1431 typedArrayTags[weakMapTag] = false;
1433 /** Used to identify `toStringTag` values supported by `_.clone`. */
1434 var cloneableTags = {};
1435 cloneableTags[argsTag] = cloneableTags[arrayTag] =
1436 cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
1437 cloneableTags[boolTag] = cloneableTags[dateTag] =
1438 cloneableTags[float32Tag] = cloneableTags[float64Tag] =
1439 cloneableTags[int8Tag] = cloneableTags[int16Tag] =
1440 cloneableTags[int32Tag] = cloneableTags[mapTag] =
1441 cloneableTags[numberTag] = cloneableTags[objectTag] =
1442 cloneableTags[regexpTag] = cloneableTags[setTag] =
1443 cloneableTags[stringTag] = cloneableTags[symbolTag] =
1444 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
1445 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
1446 cloneableTags[errorTag] = cloneableTags[funcTag] =
1447 cloneableTags[weakMapTag] = false;
1449 /** Used to map Latin Unicode letters to basic Latin letters. */
1450 var deburredLetters = {
1451 // Latin-1 Supplement block.
1452 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
1453 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
1454 '\xc7': 'C', '\xe7': 'c',
1455 '\xd0': 'D', '\xf0': 'd',
1456 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
1457 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
1458 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
1459 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
1460 '\xd1': 'N', '\xf1': 'n',
1461 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
1462 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
1463 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
1464 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
1465 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
1466 '\xc6': 'Ae', '\xe6': 'ae',
1467 '\xde': 'Th', '\xfe': 'th',
1469 // Latin Extended-A block.
1470 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
1471 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
1472 '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
1473 '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
1474 '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
1475 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
1476 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
1477 '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
1478 '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
1479 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
1480 '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
1481 '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
1482 '\u0134': 'J', '\u0135': 'j',
1483 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
1484 '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
1485 '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
1486 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
1487 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
1488 '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
1489 '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
1490 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
1491 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
1492 '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
1493 '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
1494 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
1495 '\u0163': 't', '\u0165': 't', '\u0167': 't',
1496 '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
1497 '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
1498 '\u0174': 'W', '\u0175': 'w',
1499 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
1500 '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
1501 '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
1502 '\u0132': 'IJ', '\u0133': 'ij',
1503 '\u0152': 'Oe', '\u0153': 'oe',
1504 '\u0149': "'n", '\u017f': 's'
1507 /** Used to map characters to HTML entities. */
1516 /** Used to map HTML entities to characters. */
1517 var htmlUnescapes = {
1525 /** Used to escape characters for inclusion in compiled string literals. */
1526 var stringEscapes = {
1535 /** Built-in method references without a dependency on `root`. */
1536 var freeParseFloat = parseFloat,
1537 freeParseInt = parseInt;
1539 /** Detect free variable `global` from Node.js. */
1540 var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
1542 /** Detect free variable `self`. */
1543 var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
1545 /** Used as a reference to the global object. */
1546 var root = freeGlobal || freeSelf || Function('return this')();
1548 /** Detect free variable `exports`. */
1549 var freeExports = true && exports && !exports.nodeType && exports;
1551 /** Detect free variable `module`. */
1552 var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
1554 /** Detect the popular CommonJS extension `module.exports`. */
1555 var moduleExports = freeModule && freeModule.exports === freeExports;
1557 /** Detect free variable `process` from Node.js. */
1558 var freeProcess = moduleExports && freeGlobal.process;
1560 /** Used to access faster Node.js helpers. */
1561 var nodeUtil = (function() {
1563 // Use `util.types` for Node.js 10+.
1564 var types = freeModule && freeModule.require && freeModule.require('util').types;
1570 // Legacy `process.binding('util')` for Node.js < 10.
1571 return freeProcess && freeProcess.binding && freeProcess.binding('util');
1575 /* Node.js helper references. */
1576 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
1577 nodeIsDate = nodeUtil && nodeUtil.isDate,
1578 nodeIsMap = nodeUtil && nodeUtil.isMap,
1579 nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
1580 nodeIsSet = nodeUtil && nodeUtil.isSet,
1581 nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1583 /*--------------------------------------------------------------------------*/
1586 * A faster alternative to `Function#apply`, this function invokes `func`
1587 * with the `this` binding of `thisArg` and the arguments of `args`.
1590 * @param {Function} func The function to invoke.
1591 * @param {*} thisArg The `this` binding of `func`.
1592 * @param {Array} args The arguments to invoke `func` with.
1593 * @returns {*} Returns the result of `func`.
1595 function apply(func, thisArg, args) {
1596 switch (args.length) {
1597 case 0: return func.call(thisArg);
1598 case 1: return func.call(thisArg, args[0]);
1599 case 2: return func.call(thisArg, args[0], args[1]);
1600 case 3: return func.call(thisArg, args[0], args[1], args[2]);
1602 return func.apply(thisArg, args);
1606 * A specialized version of `baseAggregator` for arrays.
1609 * @param {Array} [array] The array to iterate over.
1610 * @param {Function} setter The function to set `accumulator` values.
1611 * @param {Function} iteratee The iteratee to transform keys.
1612 * @param {Object} accumulator The initial aggregated object.
1613 * @returns {Function} Returns `accumulator`.
1615 function arrayAggregator(array, setter, iteratee, accumulator) {
1617 length = array == null ? 0 : array.length;
1619 while (++index < length) {
1620 var value = array[index];
1621 setter(accumulator, value, iteratee(value), array);
1627 * A specialized version of `_.forEach` for arrays without support for
1628 * iteratee shorthands.
1631 * @param {Array} [array] The array to iterate over.
1632 * @param {Function} iteratee The function invoked per iteration.
1633 * @returns {Array} Returns `array`.
1635 function arrayEach(array, iteratee) {
1637 length = array == null ? 0 : array.length;
1639 while (++index < length) {
1640 if (iteratee(array[index], index, array) === false) {
1648 * A specialized version of `_.forEachRight` for arrays without support for
1649 * iteratee shorthands.
1652 * @param {Array} [array] The array to iterate over.
1653 * @param {Function} iteratee The function invoked per iteration.
1654 * @returns {Array} Returns `array`.
1656 function arrayEachRight(array, iteratee) {
1657 var length = array == null ? 0 : array.length;
1660 if (iteratee(array[length], length, array) === false) {
1668 * A specialized version of `_.every` for arrays without support for
1669 * iteratee shorthands.
1672 * @param {Array} [array] The array to iterate over.
1673 * @param {Function} predicate The function invoked per iteration.
1674 * @returns {boolean} Returns `true` if all elements pass the predicate check,
1677 function arrayEvery(array, predicate) {
1679 length = array == null ? 0 : array.length;
1681 while (++index < length) {
1682 if (!predicate(array[index], index, array)) {
1690 * A specialized version of `_.filter` for arrays without support for
1691 * iteratee shorthands.
1694 * @param {Array} [array] The array to iterate over.
1695 * @param {Function} predicate The function invoked per iteration.
1696 * @returns {Array} Returns the new filtered array.
1698 function arrayFilter(array, predicate) {
1700 length = array == null ? 0 : array.length,
1704 while (++index < length) {
1705 var value = array[index];
1706 if (predicate(value, index, array)) {
1707 result[resIndex++] = value;
1714 * A specialized version of `_.includes` for arrays without support for
1715 * specifying an index to search from.
1718 * @param {Array} [array] The array to inspect.
1719 * @param {*} target The value to search for.
1720 * @returns {boolean} Returns `true` if `target` is found, else `false`.
1722 function arrayIncludes(array, value) {
1723 var length = array == null ? 0 : array.length;
1724 return !!length && baseIndexOf(array, value, 0) > -1;
1728 * This function is like `arrayIncludes` except that it accepts a comparator.
1731 * @param {Array} [array] The array to inspect.
1732 * @param {*} target The value to search for.
1733 * @param {Function} comparator The comparator invoked per element.
1734 * @returns {boolean} Returns `true` if `target` is found, else `false`.
1736 function arrayIncludesWith(array, value, comparator) {
1738 length = array == null ? 0 : array.length;
1740 while (++index < length) {
1741 if (comparator(value, array[index])) {
1749 * A specialized version of `_.map` for arrays without support for iteratee
1753 * @param {Array} [array] The array to iterate over.
1754 * @param {Function} iteratee The function invoked per iteration.
1755 * @returns {Array} Returns the new mapped array.
1757 function arrayMap(array, iteratee) {
1759 length = array == null ? 0 : array.length,
1760 result = Array(length);
1762 while (++index < length) {
1763 result[index] = iteratee(array[index], index, array);
1769 * Appends the elements of `values` to `array`.
1772 * @param {Array} array The array to modify.
1773 * @param {Array} values The values to append.
1774 * @returns {Array} Returns `array`.
1776 function arrayPush(array, values) {
1778 length = values.length,
1779 offset = array.length;
1781 while (++index < length) {
1782 array[offset + index] = values[index];
1788 * A specialized version of `_.reduce` for arrays without support for
1789 * iteratee shorthands.
1792 * @param {Array} [array] The array to iterate over.
1793 * @param {Function} iteratee The function invoked per iteration.
1794 * @param {*} [accumulator] The initial value.
1795 * @param {boolean} [initAccum] Specify using the first element of `array` as
1796 * the initial value.
1797 * @returns {*} Returns the accumulated value.
1799 function arrayReduce(array, iteratee, accumulator, initAccum) {
1801 length = array == null ? 0 : array.length;
1803 if (initAccum && length) {
1804 accumulator = array[++index];
1806 while (++index < length) {
1807 accumulator = iteratee(accumulator, array[index], index, array);
1813 * A specialized version of `_.reduceRight` for arrays without support for
1814 * iteratee shorthands.
1817 * @param {Array} [array] The array to iterate over.
1818 * @param {Function} iteratee The function invoked per iteration.
1819 * @param {*} [accumulator] The initial value.
1820 * @param {boolean} [initAccum] Specify using the last element of `array` as
1821 * the initial value.
1822 * @returns {*} Returns the accumulated value.
1824 function arrayReduceRight(array, iteratee, accumulator, initAccum) {
1825 var length = array == null ? 0 : array.length;
1826 if (initAccum && length) {
1827 accumulator = array[--length];
1830 accumulator = iteratee(accumulator, array[length], length, array);
1836 * A specialized version of `_.some` for arrays without support for iteratee
1840 * @param {Array} [array] The array to iterate over.
1841 * @param {Function} predicate The function invoked per iteration.
1842 * @returns {boolean} Returns `true` if any element passes the predicate check,
1845 function arraySome(array, predicate) {
1847 length = array == null ? 0 : array.length;
1849 while (++index < length) {
1850 if (predicate(array[index], index, array)) {
1858 * Gets the size of an ASCII `string`.
1861 * @param {string} string The string inspect.
1862 * @returns {number} Returns the string size.
1864 var asciiSize = baseProperty('length');
1867 * Converts an ASCII `string` to an array.
1870 * @param {string} string The string to convert.
1871 * @returns {Array} Returns the converted array.
1873 function asciiToArray(string) {
1874 return string.split('');
1878 * Splits an ASCII `string` into an array of its words.
1881 * @param {string} The string to inspect.
1882 * @returns {Array} Returns the words of `string`.
1884 function asciiWords(string) {
1885 return string.match(reAsciiWord) || [];
1889 * The base implementation of methods like `_.findKey` and `_.findLastKey`,
1890 * without support for iteratee shorthands, which iterates over `collection`
1894 * @param {Array|Object} collection The collection to inspect.
1895 * @param {Function} predicate The function invoked per iteration.
1896 * @param {Function} eachFunc The function to iterate over `collection`.
1897 * @returns {*} Returns the found element or its key, else `undefined`.
1899 function baseFindKey(collection, predicate, eachFunc) {
1901 eachFunc(collection, function(value, key, collection) {
1902 if (predicate(value, key, collection)) {
1911 * The base implementation of `_.findIndex` and `_.findLastIndex` without
1912 * support for iteratee shorthands.
1915 * @param {Array} array The array to inspect.
1916 * @param {Function} predicate The function invoked per iteration.
1917 * @param {number} fromIndex The index to search from.
1918 * @param {boolean} [fromRight] Specify iterating from right to left.
1919 * @returns {number} Returns the index of the matched value, else `-1`.
1921 function baseFindIndex(array, predicate, fromIndex, fromRight) {
1922 var length = array.length,
1923 index = fromIndex + (fromRight ? 1 : -1);
1925 while ((fromRight ? index-- : ++index < length)) {
1926 if (predicate(array[index], index, array)) {
1934 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
1937 * @param {Array} array The array to inspect.
1938 * @param {*} value The value to search for.
1939 * @param {number} fromIndex The index to search from.
1940 * @returns {number} Returns the index of the matched value, else `-1`.
1942 function baseIndexOf(array, value, fromIndex) {
1943 return value === value
1944 ? strictIndexOf(array, value, fromIndex)
1945 : baseFindIndex(array, baseIsNaN, fromIndex);
1949 * This function is like `baseIndexOf` except that it accepts a comparator.
1952 * @param {Array} array The array to inspect.
1953 * @param {*} value The value to search for.
1954 * @param {number} fromIndex The index to search from.
1955 * @param {Function} comparator The comparator invoked per element.
1956 * @returns {number} Returns the index of the matched value, else `-1`.
1958 function baseIndexOfWith(array, value, fromIndex, comparator) {
1959 var index = fromIndex - 1,
1960 length = array.length;
1962 while (++index < length) {
1963 if (comparator(array[index], value)) {
1971 * The base implementation of `_.isNaN` without support for number objects.
1974 * @param {*} value The value to check.
1975 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
1977 function baseIsNaN(value) {
1978 return value !== value;
1982 * The base implementation of `_.mean` and `_.meanBy` without support for
1983 * iteratee shorthands.
1986 * @param {Array} array The array to iterate over.
1987 * @param {Function} iteratee The function invoked per iteration.
1988 * @returns {number} Returns the mean.
1990 function baseMean(array, iteratee) {
1991 var length = array == null ? 0 : array.length;
1992 return length ? (baseSum(array, iteratee) / length) : NAN;
1996 * The base implementation of `_.property` without support for deep paths.
1999 * @param {string} key The key of the property to get.
2000 * @returns {Function} Returns the new accessor function.
2002 function baseProperty(key) {
2003 return function(object) {
2004 return object == null ? undefined : object[key];
2009 * The base implementation of `_.propertyOf` without support for deep paths.
2012 * @param {Object} object The object to query.
2013 * @returns {Function} Returns the new accessor function.
2015 function basePropertyOf(object) {
2016 return function(key) {
2017 return object == null ? undefined : object[key];
2022 * The base implementation of `_.reduce` and `_.reduceRight`, without support
2023 * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
2026 * @param {Array|Object} collection The collection to iterate over.
2027 * @param {Function} iteratee The function invoked per iteration.
2028 * @param {*} accumulator The initial value.
2029 * @param {boolean} initAccum Specify using the first or last element of
2030 * `collection` as the initial value.
2031 * @param {Function} eachFunc The function to iterate over `collection`.
2032 * @returns {*} Returns the accumulated value.
2034 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
2035 eachFunc(collection, function(value, index, collection) {
2036 accumulator = initAccum
2037 ? (initAccum = false, value)
2038 : iteratee(accumulator, value, index, collection);
2044 * The base implementation of `_.sortBy` which uses `comparer` to define the
2045 * sort order of `array` and replaces criteria objects with their corresponding
2049 * @param {Array} array The array to sort.
2050 * @param {Function} comparer The function to define sort order.
2051 * @returns {Array} Returns `array`.
2053 function baseSortBy(array, comparer) {
2054 var length = array.length;
2056 array.sort(comparer);
2058 array[length] = array[length].value;
2064 * The base implementation of `_.sum` and `_.sumBy` without support for
2065 * iteratee shorthands.
2068 * @param {Array} array The array to iterate over.
2069 * @param {Function} iteratee The function invoked per iteration.
2070 * @returns {number} Returns the sum.
2072 function baseSum(array, iteratee) {
2075 length = array.length;
2077 while (++index < length) {
2078 var current = iteratee(array[index]);
2079 if (current !== undefined) {
2080 result = result === undefined ? current : (result + current);
2087 * The base implementation of `_.times` without support for iteratee shorthands
2088 * or max array length checks.
2091 * @param {number} n The number of times to invoke `iteratee`.
2092 * @param {Function} iteratee The function invoked per iteration.
2093 * @returns {Array} Returns the array of results.
2095 function baseTimes(n, iteratee) {
2099 while (++index < n) {
2100 result[index] = iteratee(index);
2106 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
2107 * of key-value pairs for `object` corresponding to the property names of `props`.
2110 * @param {Object} object The object to query.
2111 * @param {Array} props The property names to get values for.
2112 * @returns {Object} Returns the key-value pairs.
2114 function baseToPairs(object, props) {
2115 return arrayMap(props, function(key) {
2116 return [key, object[key]];
2121 * The base implementation of `_.trim`.
2124 * @param {string} string The string to trim.
2125 * @returns {string} Returns the trimmed string.
2127 function baseTrim(string) {
2129 ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
2134 * The base implementation of `_.unary` without support for storing metadata.
2137 * @param {Function} func The function to cap arguments for.
2138 * @returns {Function} Returns the new capped function.
2140 function baseUnary(func) {
2141 return function(value) {
2147 * The base implementation of `_.values` and `_.valuesIn` which creates an
2148 * array of `object` property values corresponding to the property names
2152 * @param {Object} object The object to query.
2153 * @param {Array} props The property names to get values for.
2154 * @returns {Object} Returns the array of property values.
2156 function baseValues(object, props) {
2157 return arrayMap(props, function(key) {
2163 * Checks if a `cache` value for `key` exists.
2166 * @param {Object} cache The cache to query.
2167 * @param {string} key The key of the entry to check.
2168 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2170 function cacheHas(cache, key) {
2171 return cache.has(key);
2175 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
2176 * that is not found in the character symbols.
2179 * @param {Array} strSymbols The string symbols to inspect.
2180 * @param {Array} chrSymbols The character symbols to find.
2181 * @returns {number} Returns the index of the first unmatched string symbol.
2183 function charsStartIndex(strSymbols, chrSymbols) {
2185 length = strSymbols.length;
2187 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
2192 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
2193 * that is not found in the character symbols.
2196 * @param {Array} strSymbols The string symbols to inspect.
2197 * @param {Array} chrSymbols The character symbols to find.
2198 * @returns {number} Returns the index of the last unmatched string symbol.
2200 function charsEndIndex(strSymbols, chrSymbols) {
2201 var index = strSymbols.length;
2203 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
2208 * Gets the number of `placeholder` occurrences in `array`.
2211 * @param {Array} array The array to inspect.
2212 * @param {*} placeholder The placeholder to search for.
2213 * @returns {number} Returns the placeholder count.
2215 function countHolders(array, placeholder) {
2216 var length = array.length,
2220 if (array[length] === placeholder) {
2228 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
2229 * letters to basic Latin letters.
2232 * @param {string} letter The matched letter to deburr.
2233 * @returns {string} Returns the deburred letter.
2235 var deburrLetter = basePropertyOf(deburredLetters);
2238 * Used by `_.escape` to convert characters to HTML entities.
2241 * @param {string} chr The matched character to escape.
2242 * @returns {string} Returns the escaped character.
2244 var escapeHtmlChar = basePropertyOf(htmlEscapes);
2247 * Used by `_.template` to escape characters for inclusion in compiled string literals.
2250 * @param {string} chr The matched character to escape.
2251 * @returns {string} Returns the escaped character.
2253 function escapeStringChar(chr) {
2254 return '\\' + stringEscapes[chr];
2258 * Gets the value at `key` of `object`.
2261 * @param {Object} [object] The object to query.
2262 * @param {string} key The key of the property to get.
2263 * @returns {*} Returns the property value.
2265 function getValue(object, key) {
2266 return object == null ? undefined : object[key];
2270 * Checks if `string` contains Unicode symbols.
2273 * @param {string} string The string to inspect.
2274 * @returns {boolean} Returns `true` if a symbol is found, else `false`.
2276 function hasUnicode(string) {
2277 return reHasUnicode.test(string);
2281 * Checks if `string` contains a word composed of Unicode symbols.
2284 * @param {string} string The string to inspect.
2285 * @returns {boolean} Returns `true` if a word is found, else `false`.
2287 function hasUnicodeWord(string) {
2288 return reHasUnicodeWord.test(string);
2292 * Converts `iterator` to an array.
2295 * @param {Object} iterator The iterator to convert.
2296 * @returns {Array} Returns the converted array.
2298 function iteratorToArray(iterator) {
2302 while (!(data = iterator.next()).done) {
2303 result.push(data.value);
2309 * Converts `map` to its key-value pairs.
2312 * @param {Object} map The map to convert.
2313 * @returns {Array} Returns the key-value pairs.
2315 function mapToArray(map) {
2317 result = Array(map.size);
2319 map.forEach(function(value, key) {
2320 result[++index] = [key, value];
2326 * Creates a unary function that invokes `func` with its argument transformed.
2329 * @param {Function} func The function to wrap.
2330 * @param {Function} transform The argument transform.
2331 * @returns {Function} Returns the new function.
2333 function overArg(func, transform) {
2334 return function(arg) {
2335 return func(transform(arg));
2340 * Replaces all `placeholder` elements in `array` with an internal placeholder
2341 * and returns an array of their indexes.
2344 * @param {Array} array The array to modify.
2345 * @param {*} placeholder The placeholder to replace.
2346 * @returns {Array} Returns the new array of placeholder indexes.
2348 function replaceHolders(array, placeholder) {
2350 length = array.length,
2354 while (++index < length) {
2355 var value = array[index];
2356 if (value === placeholder || value === PLACEHOLDER) {
2357 array[index] = PLACEHOLDER;
2358 result[resIndex++] = index;
2365 * Converts `set` to an array of its values.
2368 * @param {Object} set The set to convert.
2369 * @returns {Array} Returns the values.
2371 function setToArray(set) {
2373 result = Array(set.size);
2375 set.forEach(function(value) {
2376 result[++index] = value;
2382 * Converts `set` to its value-value pairs.
2385 * @param {Object} set The set to convert.
2386 * @returns {Array} Returns the value-value pairs.
2388 function setToPairs(set) {
2390 result = Array(set.size);
2392 set.forEach(function(value) {
2393 result[++index] = [value, value];
2399 * A specialized version of `_.indexOf` which performs strict equality
2400 * comparisons of values, i.e. `===`.
2403 * @param {Array} array The array to inspect.
2404 * @param {*} value The value to search for.
2405 * @param {number} fromIndex The index to search from.
2406 * @returns {number} Returns the index of the matched value, else `-1`.
2408 function strictIndexOf(array, value, fromIndex) {
2409 var index = fromIndex - 1,
2410 length = array.length;
2412 while (++index < length) {
2413 if (array[index] === value) {
2421 * A specialized version of `_.lastIndexOf` which performs strict equality
2422 * comparisons of values, i.e. `===`.
2425 * @param {Array} array The array to inspect.
2426 * @param {*} value The value to search for.
2427 * @param {number} fromIndex The index to search from.
2428 * @returns {number} Returns the index of the matched value, else `-1`.
2430 function strictLastIndexOf(array, value, fromIndex) {
2431 var index = fromIndex + 1;
2433 if (array[index] === value) {
2441 * Gets the number of symbols in `string`.
2444 * @param {string} string The string to inspect.
2445 * @returns {number} Returns the string size.
2447 function stringSize(string) {
2448 return hasUnicode(string)
2449 ? unicodeSize(string)
2450 : asciiSize(string);
2454 * Converts `string` to an array.
2457 * @param {string} string The string to convert.
2458 * @returns {Array} Returns the converted array.
2460 function stringToArray(string) {
2461 return hasUnicode(string)
2462 ? unicodeToArray(string)
2463 : asciiToArray(string);
2467 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
2468 * character of `string`.
2471 * @param {string} string The string to inspect.
2472 * @returns {number} Returns the index of the last non-whitespace character.
2474 function trimmedEndIndex(string) {
2475 var index = string.length;
2477 while (index-- && reWhitespace.test(string.charAt(index))) {}
2482 * Used by `_.unescape` to convert HTML entities to characters.
2485 * @param {string} chr The matched character to unescape.
2486 * @returns {string} Returns the unescaped character.
2488 var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
2491 * Gets the size of a Unicode `string`.
2494 * @param {string} string The string inspect.
2495 * @returns {number} Returns the string size.
2497 function unicodeSize(string) {
2498 var result = reUnicode.lastIndex = 0;
2499 while (reUnicode.test(string)) {
2506 * Converts a Unicode `string` to an array.
2509 * @param {string} string The string to convert.
2510 * @returns {Array} Returns the converted array.
2512 function unicodeToArray(string) {
2513 return string.match(reUnicode) || [];
2517 * Splits a Unicode `string` into an array of its words.
2520 * @param {string} The string to inspect.
2521 * @returns {Array} Returns the words of `string`.
2523 function unicodeWords(string) {
2524 return string.match(reUnicodeWord) || [];
2527 /*--------------------------------------------------------------------------*/
2530 * Create a new pristine `lodash` function using the `context` object.
2536 * @param {Object} [context=root] The context object.
2537 * @returns {Function} Returns a new `lodash` function.
2540 * _.mixin({ 'foo': _.constant('foo') });
2542 * var lodash = _.runInContext();
2543 * lodash.mixin({ 'bar': lodash.constant('bar') });
2545 * _.isFunction(_.foo);
2547 * _.isFunction(_.bar);
2550 * lodash.isFunction(lodash.foo);
2552 * lodash.isFunction(lodash.bar);
2555 * // Create a suped-up `defer` in Node.js.
2556 * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
2558 var runInContext = (function runInContext(context) {
2559 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
2561 /** Built-in constructor references. */
2562 var Array = context.Array,
2563 Date = context.Date,
2564 Error = context.Error,
2565 Function = context.Function,
2566 Math = context.Math,
2567 Object = context.Object,
2568 RegExp = context.RegExp,
2569 String = context.String,
2570 TypeError = context.TypeError;
2572 /** Used for built-in method references. */
2573 var arrayProto = Array.prototype,
2574 funcProto = Function.prototype,
2575 objectProto = Object.prototype;
2577 /** Used to detect overreaching core-js shims. */
2578 var coreJsData = context['__core-js_shared__'];
2580 /** Used to resolve the decompiled source of functions. */
2581 var funcToString = funcProto.toString;
2583 /** Used to check objects for own properties. */
2584 var hasOwnProperty = objectProto.hasOwnProperty;
2586 /** Used to generate unique IDs. */
2589 /** Used to detect methods masquerading as native. */
2590 var maskSrcKey = (function() {
2591 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
2592 return uid ? ('Symbol(src)_1.' + uid) : '';
2596 * Used to resolve the
2597 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2600 var nativeObjectToString = objectProto.toString;
2602 /** Used to infer the `Object` constructor. */
2603 var objectCtorString = funcToString.call(Object);
2605 /** Used to restore the original `_` reference in `_.noConflict`. */
2606 var oldDash = root._;
2608 /** Used to detect if a method is native. */
2609 var reIsNative = RegExp('^' +
2610 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
2611 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
2614 /** Built-in value references. */
2615 var Buffer = moduleExports ? context.Buffer : undefined,
2616 Symbol = context.Symbol,
2617 Uint8Array = context.Uint8Array,
2618 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
2619 getPrototype = overArg(Object.getPrototypeOf, Object),
2620 objectCreate = Object.create,
2621 propertyIsEnumerable = objectProto.propertyIsEnumerable,
2622 splice = arrayProto.splice,
2623 spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
2624 symIterator = Symbol ? Symbol.iterator : undefined,
2625 symToStringTag = Symbol ? Symbol.toStringTag : undefined;
2627 var defineProperty = (function() {
2629 var func = getNative(Object, 'defineProperty');
2635 /** Mocked built-ins. */
2636 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
2637 ctxNow = Date && Date.now !== root.Date.now && Date.now,
2638 ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
2640 /* Built-in method references for those with the same name as other `lodash` methods. */
2641 var nativeCeil = Math.ceil,
2642 nativeFloor = Math.floor,
2643 nativeGetSymbols = Object.getOwnPropertySymbols,
2644 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
2645 nativeIsFinite = context.isFinite,
2646 nativeJoin = arrayProto.join,
2647 nativeKeys = overArg(Object.keys, Object),
2648 nativeMax = Math.max,
2649 nativeMin = Math.min,
2650 nativeNow = Date.now,
2651 nativeParseInt = context.parseInt,
2652 nativeRandom = Math.random,
2653 nativeReverse = arrayProto.reverse;
2655 /* Built-in method references that are verified to be native. */
2656 var DataView = getNative(context, 'DataView'),
2657 Map = getNative(context, 'Map'),
2658 Promise = getNative(context, 'Promise'),
2659 Set = getNative(context, 'Set'),
2660 WeakMap = getNative(context, 'WeakMap'),
2661 nativeCreate = getNative(Object, 'create');
2663 /** Used to store function metadata. */
2664 var metaMap = WeakMap && new WeakMap;
2666 /** Used to lookup unminified function names. */
2669 /** Used to detect maps, sets, and weakmaps. */
2670 var dataViewCtorString = toSource(DataView),
2671 mapCtorString = toSource(Map),
2672 promiseCtorString = toSource(Promise),
2673 setCtorString = toSource(Set),
2674 weakMapCtorString = toSource(WeakMap);
2676 /** Used to convert symbols to primitives and strings. */
2677 var symbolProto = Symbol ? Symbol.prototype : undefined,
2678 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
2679 symbolToString = symbolProto ? symbolProto.toString : undefined;
2681 /*------------------------------------------------------------------------*/
2684 * Creates a `lodash` object which wraps `value` to enable implicit method
2685 * chain sequences. Methods that operate on and return arrays, collections,
2686 * and functions can be chained together. Methods that retrieve a single value
2687 * or may return a primitive value will automatically end the chain sequence
2688 * and return the unwrapped value. Otherwise, the value must be unwrapped
2691 * Explicit chain sequences, which must be unwrapped with `_#value`, may be
2692 * enabled using `_.chain`.
2694 * The execution of chained methods is lazy, that is, it's deferred until
2695 * `_#value` is implicitly or explicitly called.
2697 * Lazy evaluation allows several methods to support shortcut fusion.
2698 * Shortcut fusion is an optimization to merge iteratee calls; this avoids
2699 * the creation of intermediate arrays and can greatly reduce the number of
2700 * iteratee executions. Sections of a chain sequence qualify for shortcut
2701 * fusion if the section is applied to an array and iteratees accept only
2702 * one argument. The heuristic for whether a section qualifies for shortcut
2703 * fusion is subject to change.
2705 * Chaining is supported in custom builds as long as the `_#value` method is
2706 * directly or indirectly included in the build.
2708 * In addition to lodash methods, wrappers have `Array` and `String` methods.
2710 * The wrapper `Array` methods are:
2711 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
2713 * The wrapper `String` methods are:
2714 * `replace` and `split`
2716 * The wrapper methods that support shortcut fusion are:
2717 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
2718 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
2719 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
2721 * The chainable wrapper methods are:
2722 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
2723 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
2724 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
2725 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
2726 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
2727 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
2728 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
2729 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
2730 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
2731 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
2732 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
2733 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
2734 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
2735 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
2736 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
2737 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
2738 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
2739 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
2740 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
2741 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
2742 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
2743 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
2744 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
2745 * `zipObject`, `zipObjectDeep`, and `zipWith`
2747 * The wrapper methods that are **not** chainable by default are:
2748 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
2749 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
2750 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
2751 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
2752 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
2753 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
2754 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
2755 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
2756 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
2757 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
2758 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
2759 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
2760 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
2761 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
2762 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
2763 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
2764 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
2765 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
2766 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
2767 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
2768 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
2769 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
2770 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
2771 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
2772 * `upperFirst`, `value`, and `words`
2777 * @param {*} value The value to wrap in a `lodash` instance.
2778 * @returns {Object} Returns the new `lodash` wrapper instance.
2781 * function square(n) {
2785 * var wrapped = _([1, 2, 3]);
2787 * // Returns an unwrapped value.
2788 * wrapped.reduce(_.add);
2791 * // Returns a wrapped value.
2792 * var squares = wrapped.map(square);
2794 * _.isArray(squares);
2797 * _.isArray(squares.value());
2800 function lodash(value) {
2801 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
2802 if (value instanceof LodashWrapper) {
2805 if (hasOwnProperty.call(value, '__wrapped__')) {
2806 return wrapperClone(value);
2809 return new LodashWrapper(value);
2813 * The base implementation of `_.create` without support for assigning
2814 * properties to the created object.
2817 * @param {Object} proto The object to inherit from.
2818 * @returns {Object} Returns the new object.
2820 var baseCreate = (function() {
2821 function object() {}
2822 return function(proto) {
2823 if (!isObject(proto)) {
2827 return objectCreate(proto);
2829 object.prototype = proto;
2830 var result = new object;
2831 object.prototype = undefined;
2837 * The function whose prototype chain sequence wrappers inherit from.
2841 function baseLodash() {
2842 // No operation performed.
2846 * The base constructor for creating `lodash` wrapper objects.
2849 * @param {*} value The value to wrap.
2850 * @param {boolean} [chainAll] Enable explicit method chain sequences.
2852 function LodashWrapper(value, chainAll) {
2853 this.__wrapped__ = value;
2854 this.__actions__ = [];
2855 this.__chain__ = !!chainAll;
2857 this.__values__ = undefined;
2861 * By default, the template delimiters used by lodash are like those in
2862 * embedded Ruby (ERB) as well as ES2015 template strings. Change the
2863 * following template settings to use alternative delimiters.
2869 lodash.templateSettings = {
2872 * Used to detect `data` property values to be HTML-escaped.
2874 * @memberOf _.templateSettings
2880 * Used to detect code to be evaluated.
2882 * @memberOf _.templateSettings
2885 'evaluate': reEvaluate,
2888 * Used to detect `data` property values to inject.
2890 * @memberOf _.templateSettings
2893 'interpolate': reInterpolate,
2896 * Used to reference the data object in the template text.
2898 * @memberOf _.templateSettings
2904 * Used to import variables into the compiled template.
2906 * @memberOf _.templateSettings
2912 * A reference to the `lodash` function.
2914 * @memberOf _.templateSettings.imports
2921 // Ensure wrappers are instances of `baseLodash`.
2922 lodash.prototype = baseLodash.prototype;
2923 lodash.prototype.constructor = lodash;
2925 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
2926 LodashWrapper.prototype.constructor = LodashWrapper;
2928 /*------------------------------------------------------------------------*/
2931 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
2935 * @param {*} value The value to wrap.
2937 function LazyWrapper(value) {
2938 this.__wrapped__ = value;
2939 this.__actions__ = [];
2941 this.__filtered__ = false;
2942 this.__iteratees__ = [];
2943 this.__takeCount__ = MAX_ARRAY_LENGTH;
2944 this.__views__ = [];
2948 * Creates a clone of the lazy wrapper object.
2952 * @memberOf LazyWrapper
2953 * @returns {Object} Returns the cloned `LazyWrapper` object.
2955 function lazyClone() {
2956 var result = new LazyWrapper(this.__wrapped__);
2957 result.__actions__ = copyArray(this.__actions__);
2958 result.__dir__ = this.__dir__;
2959 result.__filtered__ = this.__filtered__;
2960 result.__iteratees__ = copyArray(this.__iteratees__);
2961 result.__takeCount__ = this.__takeCount__;
2962 result.__views__ = copyArray(this.__views__);
2967 * Reverses the direction of lazy iteration.
2971 * @memberOf LazyWrapper
2972 * @returns {Object} Returns the new reversed `LazyWrapper` object.
2974 function lazyReverse() {
2975 if (this.__filtered__) {
2976 var result = new LazyWrapper(this);
2977 result.__dir__ = -1;
2978 result.__filtered__ = true;
2980 result = this.clone();
2981 result.__dir__ *= -1;
2987 * Extracts the unwrapped value from its lazy wrapper.
2991 * @memberOf LazyWrapper
2992 * @returns {*} Returns the unwrapped value.
2994 function lazyValue() {
2995 var array = this.__wrapped__.value(),
2997 isArr = isArray(array),
2999 arrLength = isArr ? array.length : 0,
3000 view = getView(0, arrLength, this.__views__),
3003 length = end - start,
3004 index = isRight ? end : (start - 1),
3005 iteratees = this.__iteratees__,
3006 iterLength = iteratees.length,
3008 takeCount = nativeMin(length, this.__takeCount__);
3010 if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
3011 return baseWrapperValue(array, this.__actions__);
3016 while (length-- && resIndex < takeCount) {
3020 value = array[index];
3022 while (++iterIndex < iterLength) {
3023 var data = iteratees[iterIndex],
3024 iteratee = data.iteratee,
3026 computed = iteratee(value);
3028 if (type == LAZY_MAP_FLAG) {
3030 } else if (!computed) {
3031 if (type == LAZY_FILTER_FLAG) {
3038 result[resIndex++] = value;
3043 // Ensure `LazyWrapper` is an instance of `baseLodash`.
3044 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
3045 LazyWrapper.prototype.constructor = LazyWrapper;
3047 /*------------------------------------------------------------------------*/
3050 * Creates a hash object.
3054 * @param {Array} [entries] The key-value pairs to cache.
3056 function Hash(entries) {
3058 length = entries == null ? 0 : entries.length;
3061 while (++index < length) {
3062 var entry = entries[index];
3063 this.set(entry[0], entry[1]);
3068 * Removes all key-value entries from the hash.
3074 function hashClear() {
3075 this.__data__ = nativeCreate ? nativeCreate(null) : {};
3080 * Removes `key` and its value from the hash.
3085 * @param {Object} hash The hash to modify.
3086 * @param {string} key The key of the value to remove.
3087 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3089 function hashDelete(key) {
3090 var result = this.has(key) && delete this.__data__[key];
3091 this.size -= result ? 1 : 0;
3096 * Gets the hash value for `key`.
3101 * @param {string} key The key of the value to get.
3102 * @returns {*} Returns the entry value.
3104 function hashGet(key) {
3105 var data = this.__data__;
3107 var result = data[key];
3108 return result === HASH_UNDEFINED ? undefined : result;
3110 return hasOwnProperty.call(data, key) ? data[key] : undefined;
3114 * Checks if a hash value for `key` exists.
3119 * @param {string} key The key of the entry to check.
3120 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3122 function hashHas(key) {
3123 var data = this.__data__;
3124 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
3128 * Sets the hash `key` to `value`.
3133 * @param {string} key The key of the value to set.
3134 * @param {*} value The value to set.
3135 * @returns {Object} Returns the hash instance.
3137 function hashSet(key, value) {
3138 var data = this.__data__;
3139 this.size += this.has(key) ? 0 : 1;
3140 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
3144 // Add methods to `Hash`.
3145 Hash.prototype.clear = hashClear;
3146 Hash.prototype['delete'] = hashDelete;
3147 Hash.prototype.get = hashGet;
3148 Hash.prototype.has = hashHas;
3149 Hash.prototype.set = hashSet;
3151 /*------------------------------------------------------------------------*/
3154 * Creates an list cache object.
3158 * @param {Array} [entries] The key-value pairs to cache.
3160 function ListCache(entries) {
3162 length = entries == null ? 0 : entries.length;
3165 while (++index < length) {
3166 var entry = entries[index];
3167 this.set(entry[0], entry[1]);
3172 * Removes all key-value entries from the list cache.
3176 * @memberOf ListCache
3178 function listCacheClear() {
3184 * Removes `key` and its value from the list cache.
3188 * @memberOf ListCache
3189 * @param {string} key The key of the value to remove.
3190 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3192 function listCacheDelete(key) {
3193 var data = this.__data__,
3194 index = assocIndexOf(data, key);
3199 var lastIndex = data.length - 1;
3200 if (index == lastIndex) {
3203 splice.call(data, index, 1);
3210 * Gets the list cache value for `key`.
3214 * @memberOf ListCache
3215 * @param {string} key The key of the value to get.
3216 * @returns {*} Returns the entry value.
3218 function listCacheGet(key) {
3219 var data = this.__data__,
3220 index = assocIndexOf(data, key);
3222 return index < 0 ? undefined : data[index][1];
3226 * Checks if a list cache value for `key` exists.
3230 * @memberOf ListCache
3231 * @param {string} key The key of the entry to check.
3232 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3234 function listCacheHas(key) {
3235 return assocIndexOf(this.__data__, key) > -1;
3239 * Sets the list cache `key` to `value`.
3243 * @memberOf ListCache
3244 * @param {string} key The key of the value to set.
3245 * @param {*} value The value to set.
3246 * @returns {Object} Returns the list cache instance.
3248 function listCacheSet(key, value) {
3249 var data = this.__data__,
3250 index = assocIndexOf(data, key);
3254 data.push([key, value]);
3256 data[index][1] = value;
3261 // Add methods to `ListCache`.
3262 ListCache.prototype.clear = listCacheClear;
3263 ListCache.prototype['delete'] = listCacheDelete;
3264 ListCache.prototype.get = listCacheGet;
3265 ListCache.prototype.has = listCacheHas;
3266 ListCache.prototype.set = listCacheSet;
3268 /*------------------------------------------------------------------------*/
3271 * Creates a map cache object to store key-value pairs.
3275 * @param {Array} [entries] The key-value pairs to cache.
3277 function MapCache(entries) {
3279 length = entries == null ? 0 : entries.length;
3282 while (++index < length) {
3283 var entry = entries[index];
3284 this.set(entry[0], entry[1]);
3289 * Removes all key-value entries from the map.
3293 * @memberOf MapCache
3295 function mapCacheClear() {
3299 'map': new (Map || ListCache),
3305 * Removes `key` and its value from the map.
3309 * @memberOf MapCache
3310 * @param {string} key The key of the value to remove.
3311 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3313 function mapCacheDelete(key) {
3314 var result = getMapData(this, key)['delete'](key);
3315 this.size -= result ? 1 : 0;
3320 * Gets the map value for `key`.
3324 * @memberOf MapCache
3325 * @param {string} key The key of the value to get.
3326 * @returns {*} Returns the entry value.
3328 function mapCacheGet(key) {
3329 return getMapData(this, key).get(key);
3333 * Checks if a map value for `key` exists.
3337 * @memberOf MapCache
3338 * @param {string} key The key of the entry to check.
3339 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3341 function mapCacheHas(key) {
3342 return getMapData(this, key).has(key);
3346 * Sets the map `key` to `value`.
3350 * @memberOf MapCache
3351 * @param {string} key The key of the value to set.
3352 * @param {*} value The value to set.
3353 * @returns {Object} Returns the map cache instance.
3355 function mapCacheSet(key, value) {
3356 var data = getMapData(this, key),
3359 data.set(key, value);
3360 this.size += data.size == size ? 0 : 1;
3364 // Add methods to `MapCache`.
3365 MapCache.prototype.clear = mapCacheClear;
3366 MapCache.prototype['delete'] = mapCacheDelete;
3367 MapCache.prototype.get = mapCacheGet;
3368 MapCache.prototype.has = mapCacheHas;
3369 MapCache.prototype.set = mapCacheSet;
3371 /*------------------------------------------------------------------------*/
3375 * Creates an array cache object to store unique values.
3379 * @param {Array} [values] The values to cache.
3381 function SetCache(values) {
3383 length = values == null ? 0 : values.length;
3385 this.__data__ = new MapCache;
3386 while (++index < length) {
3387 this.add(values[index]);
3392 * Adds `value` to the array cache.
3396 * @memberOf SetCache
3398 * @param {*} value The value to cache.
3399 * @returns {Object} Returns the cache instance.
3401 function setCacheAdd(value) {
3402 this.__data__.set(value, HASH_UNDEFINED);
3407 * Checks if `value` is in the array cache.
3411 * @memberOf SetCache
3412 * @param {*} value The value to search for.
3413 * @returns {number} Returns `true` if `value` is found, else `false`.
3415 function setCacheHas(value) {
3416 return this.__data__.has(value);
3419 // Add methods to `SetCache`.
3420 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
3421 SetCache.prototype.has = setCacheHas;
3423 /*------------------------------------------------------------------------*/
3426 * Creates a stack cache object to store key-value pairs.
3430 * @param {Array} [entries] The key-value pairs to cache.
3432 function Stack(entries) {
3433 var data = this.__data__ = new ListCache(entries);
3434 this.size = data.size;
3438 * Removes all key-value entries from the stack.
3444 function stackClear() {
3445 this.__data__ = new ListCache;
3450 * Removes `key` and its value from the stack.
3455 * @param {string} key The key of the value to remove.
3456 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3458 function stackDelete(key) {
3459 var data = this.__data__,
3460 result = data['delete'](key);
3462 this.size = data.size;
3467 * Gets the stack value for `key`.
3472 * @param {string} key The key of the value to get.
3473 * @returns {*} Returns the entry value.
3475 function stackGet(key) {
3476 return this.__data__.get(key);
3480 * Checks if a stack value for `key` exists.
3485 * @param {string} key The key of the entry to check.
3486 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3488 function stackHas(key) {
3489 return this.__data__.has(key);
3493 * Sets the stack `key` to `value`.
3498 * @param {string} key The key of the value to set.
3499 * @param {*} value The value to set.
3500 * @returns {Object} Returns the stack cache instance.
3502 function stackSet(key, value) {
3503 var data = this.__data__;
3504 if (data instanceof ListCache) {
3505 var pairs = data.__data__;
3506 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
3507 pairs.push([key, value]);
3508 this.size = ++data.size;
3511 data = this.__data__ = new MapCache(pairs);
3513 data.set(key, value);
3514 this.size = data.size;
3518 // Add methods to `Stack`.
3519 Stack.prototype.clear = stackClear;
3520 Stack.prototype['delete'] = stackDelete;
3521 Stack.prototype.get = stackGet;
3522 Stack.prototype.has = stackHas;
3523 Stack.prototype.set = stackSet;
3525 /*------------------------------------------------------------------------*/
3528 * Creates an array of the enumerable property names of the array-like `value`.
3531 * @param {*} value The value to query.
3532 * @param {boolean} inherited Specify returning inherited property names.
3533 * @returns {Array} Returns the array of property names.
3535 function arrayLikeKeys(value, inherited) {
3536 var isArr = isArray(value),
3537 isArg = !isArr && isArguments(value),
3538 isBuff = !isArr && !isArg && isBuffer(value),
3539 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
3540 skipIndexes = isArr || isArg || isBuff || isType,
3541 result = skipIndexes ? baseTimes(value.length, String) : [],
3542 length = result.length;
3544 for (var key in value) {
3545 if ((inherited || hasOwnProperty.call(value, key)) &&
3547 // Safari 9 has enumerable `arguments.length` in strict mode.
3549 // Node.js 0.10 has enumerable non-index properties on buffers.
3550 (isBuff && (key == 'offset' || key == 'parent')) ||
3551 // PhantomJS 2 has enumerable non-index properties on typed arrays.
3552 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
3553 // Skip index properties.
3554 isIndex(key, length)
3563 * A specialized version of `_.sample` for arrays.
3566 * @param {Array} array The array to sample.
3567 * @returns {*} Returns the random element.
3569 function arraySample(array) {
3570 var length = array.length;
3571 return length ? array[baseRandom(0, length - 1)] : undefined;
3575 * A specialized version of `_.sampleSize` for arrays.
3578 * @param {Array} array The array to sample.
3579 * @param {number} n The number of elements to sample.
3580 * @returns {Array} Returns the random elements.
3582 function arraySampleSize(array, n) {
3583 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
3587 * A specialized version of `_.shuffle` for arrays.
3590 * @param {Array} array The array to shuffle.
3591 * @returns {Array} Returns the new shuffled array.
3593 function arrayShuffle(array) {
3594 return shuffleSelf(copyArray(array));
3598 * This function is like `assignValue` except that it doesn't assign
3599 * `undefined` values.
3602 * @param {Object} object The object to modify.
3603 * @param {string} key The key of the property to assign.
3604 * @param {*} value The value to assign.
3606 function assignMergeValue(object, key, value) {
3607 if ((value !== undefined && !eq(object[key], value)) ||
3608 (value === undefined && !(key in object))) {
3609 baseAssignValue(object, key, value);
3614 * Assigns `value` to `key` of `object` if the existing value is not equivalent
3615 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
3616 * for equality comparisons.
3619 * @param {Object} object The object to modify.
3620 * @param {string} key The key of the property to assign.
3621 * @param {*} value The value to assign.
3623 function assignValue(object, key, value) {
3624 var objValue = object[key];
3625 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
3626 (value === undefined && !(key in object))) {
3627 baseAssignValue(object, key, value);
3632 * Gets the index at which the `key` is found in `array` of key-value pairs.
3635 * @param {Array} array The array to inspect.
3636 * @param {*} key The key to search for.
3637 * @returns {number} Returns the index of the matched value, else `-1`.
3639 function assocIndexOf(array, key) {
3640 var length = array.length;
3642 if (eq(array[length][0], key)) {
3650 * Aggregates elements of `collection` on `accumulator` with keys transformed
3651 * by `iteratee` and values set by `setter`.
3654 * @param {Array|Object} collection The collection to iterate over.
3655 * @param {Function} setter The function to set `accumulator` values.
3656 * @param {Function} iteratee The iteratee to transform keys.
3657 * @param {Object} accumulator The initial aggregated object.
3658 * @returns {Function} Returns `accumulator`.
3660 function baseAggregator(collection, setter, iteratee, accumulator) {
3661 baseEach(collection, function(value, key, collection) {
3662 setter(accumulator, value, iteratee(value), collection);
3668 * The base implementation of `_.assign` without support for multiple sources
3669 * or `customizer` functions.
3672 * @param {Object} object The destination object.
3673 * @param {Object} source The source object.
3674 * @returns {Object} Returns `object`.
3676 function baseAssign(object, source) {
3677 return object && copyObject(source, keys(source), object);
3681 * The base implementation of `_.assignIn` without support for multiple sources
3682 * or `customizer` functions.
3685 * @param {Object} object The destination object.
3686 * @param {Object} source The source object.
3687 * @returns {Object} Returns `object`.
3689 function baseAssignIn(object, source) {
3690 return object && copyObject(source, keysIn(source), object);
3694 * The base implementation of `assignValue` and `assignMergeValue` without
3698 * @param {Object} object The object to modify.
3699 * @param {string} key The key of the property to assign.
3700 * @param {*} value The value to assign.
3702 function baseAssignValue(object, key, value) {
3703 if (key == '__proto__' && defineProperty) {
3704 defineProperty(object, key, {
3705 'configurable': true,
3711 object[key] = value;
3716 * The base implementation of `_.at` without support for individual paths.
3719 * @param {Object} object The object to iterate over.
3720 * @param {string[]} paths The property paths to pick.
3721 * @returns {Array} Returns the picked elements.
3723 function baseAt(object, paths) {
3725 length = paths.length,
3726 result = Array(length),
3727 skip = object == null;
3729 while (++index < length) {
3730 result[index] = skip ? undefined : get(object, paths[index]);
3736 * The base implementation of `_.clamp` which doesn't coerce arguments.
3739 * @param {number} number The number to clamp.
3740 * @param {number} [lower] The lower bound.
3741 * @param {number} upper The upper bound.
3742 * @returns {number} Returns the clamped number.
3744 function baseClamp(number, lower, upper) {
3745 if (number === number) {
3746 if (upper !== undefined) {
3747 number = number <= upper ? number : upper;
3749 if (lower !== undefined) {
3750 number = number >= lower ? number : lower;
3757 * The base implementation of `_.clone` and `_.cloneDeep` which tracks
3758 * traversed objects.
3761 * @param {*} value The value to clone.
3762 * @param {boolean} bitmask The bitmask flags.
3764 * 2 - Flatten inherited properties
3766 * @param {Function} [customizer] The function to customize cloning.
3767 * @param {string} [key] The key of `value`.
3768 * @param {Object} [object] The parent object of `value`.
3769 * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
3770 * @returns {*} Returns the cloned value.
3772 function baseClone(value, bitmask, customizer, key, object, stack) {
3774 isDeep = bitmask & CLONE_DEEP_FLAG,
3775 isFlat = bitmask & CLONE_FLAT_FLAG,
3776 isFull = bitmask & CLONE_SYMBOLS_FLAG;
3779 result = object ? customizer(value, key, object, stack) : customizer(value);
3781 if (result !== undefined) {
3784 if (!isObject(value)) {
3787 var isArr = isArray(value);
3789 result = initCloneArray(value);
3791 return copyArray(value, result);
3794 var tag = getTag(value),
3795 isFunc = tag == funcTag || tag == genTag;
3797 if (isBuffer(value)) {
3798 return cloneBuffer(value, isDeep);
3800 if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
3801 result = (isFlat || isFunc) ? {} : initCloneObject(value);
3804 ? copySymbolsIn(value, baseAssignIn(result, value))
3805 : copySymbols(value, baseAssign(result, value));
3808 if (!cloneableTags[tag]) {
3809 return object ? value : {};
3811 result = initCloneByTag(value, tag, isDeep);
3814 // Check for circular references and return its corresponding clone.
3815 stack || (stack = new Stack);
3816 var stacked = stack.get(value);
3820 stack.set(value, result);
3823 value.forEach(function(subValue) {
3824 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
3826 } else if (isMap(value)) {
3827 value.forEach(function(subValue, key) {
3828 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
3832 var keysFunc = isFull
3833 ? (isFlat ? getAllKeysIn : getAllKeys)
3834 : (isFlat ? keysIn : keys);
3836 var props = isArr ? undefined : keysFunc(value);
3837 arrayEach(props || value, function(subValue, key) {
3840 subValue = value[key];
3842 // Recursively populate clone (susceptible to call stack limits).
3843 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
3849 * The base implementation of `_.conforms` which doesn't clone `source`.
3852 * @param {Object} source The object of property predicates to conform to.
3853 * @returns {Function} Returns the new spec function.
3855 function baseConforms(source) {
3856 var props = keys(source);
3857 return function(object) {
3858 return baseConformsTo(object, source, props);
3863 * The base implementation of `_.conformsTo` which accepts `props` to check.
3866 * @param {Object} object The object to inspect.
3867 * @param {Object} source The object of property predicates to conform to.
3868 * @returns {boolean} Returns `true` if `object` conforms, else `false`.
3870 function baseConformsTo(object, source, props) {
3871 var length = props.length;
3872 if (object == null) {
3875 object = Object(object);
3877 var key = props[length],
3878 predicate = source[key],
3879 value = object[key];
3881 if ((value === undefined && !(key in object)) || !predicate(value)) {
3889 * The base implementation of `_.delay` and `_.defer` which accepts `args`
3890 * to provide to `func`.
3893 * @param {Function} func The function to delay.
3894 * @param {number} wait The number of milliseconds to delay invocation.
3895 * @param {Array} args The arguments to provide to `func`.
3896 * @returns {number|Object} Returns the timer id or timeout object.
3898 function baseDelay(func, wait, args) {
3899 if (typeof func != 'function') {
3900 throw new TypeError(FUNC_ERROR_TEXT);
3902 return setTimeout(function() { func.apply(undefined, args); }, wait);
3906 * The base implementation of methods like `_.difference` without support
3907 * for excluding multiple arrays or iteratee shorthands.
3910 * @param {Array} array The array to inspect.
3911 * @param {Array} values The values to exclude.
3912 * @param {Function} [iteratee] The iteratee invoked per element.
3913 * @param {Function} [comparator] The comparator invoked per element.
3914 * @returns {Array} Returns the new array of filtered values.
3916 function baseDifference(array, values, iteratee, comparator) {
3918 includes = arrayIncludes,
3920 length = array.length,
3922 valuesLength = values.length;
3928 values = arrayMap(values, baseUnary(iteratee));
3931 includes = arrayIncludesWith;
3934 else if (values.length >= LARGE_ARRAY_SIZE) {
3935 includes = cacheHas;
3937 values = new SetCache(values);
3940 while (++index < length) {
3941 var value = array[index],
3942 computed = iteratee == null ? value : iteratee(value);
3944 value = (comparator || value !== 0) ? value : 0;
3945 if (isCommon && computed === computed) {
3946 var valuesIndex = valuesLength;
3947 while (valuesIndex--) {
3948 if (values[valuesIndex] === computed) {
3954 else if (!includes(values, computed, comparator)) {
3962 * The base implementation of `_.forEach` without support for iteratee shorthands.
3965 * @param {Array|Object} collection The collection to iterate over.
3966 * @param {Function} iteratee The function invoked per iteration.
3967 * @returns {Array|Object} Returns `collection`.
3969 var baseEach = createBaseEach(baseForOwn);
3972 * The base implementation of `_.forEachRight` without support for iteratee shorthands.
3975 * @param {Array|Object} collection The collection to iterate over.
3976 * @param {Function} iteratee The function invoked per iteration.
3977 * @returns {Array|Object} Returns `collection`.
3979 var baseEachRight = createBaseEach(baseForOwnRight, true);
3982 * The base implementation of `_.every` without support for iteratee shorthands.
3985 * @param {Array|Object} collection The collection to iterate over.
3986 * @param {Function} predicate The function invoked per iteration.
3987 * @returns {boolean} Returns `true` if all elements pass the predicate check,
3990 function baseEvery(collection, predicate) {
3992 baseEach(collection, function(value, index, collection) {
3993 result = !!predicate(value, index, collection);
4000 * The base implementation of methods like `_.max` and `_.min` which accepts a
4001 * `comparator` to determine the extremum value.
4004 * @param {Array} array The array to iterate over.
4005 * @param {Function} iteratee The iteratee invoked per iteration.
4006 * @param {Function} comparator The comparator used to compare values.
4007 * @returns {*} Returns the extremum value.
4009 function baseExtremum(array, iteratee, comparator) {
4011 length = array.length;
4013 while (++index < length) {
4014 var value = array[index],
4015 current = iteratee(value);
4017 if (current != null && (computed === undefined
4018 ? (current === current && !isSymbol(current))
4019 : comparator(current, computed)
4021 var computed = current,
4029 * The base implementation of `_.fill` without an iteratee call guard.
4032 * @param {Array} array The array to fill.
4033 * @param {*} value The value to fill `array` with.
4034 * @param {number} [start=0] The start position.
4035 * @param {number} [end=array.length] The end position.
4036 * @returns {Array} Returns `array`.
4038 function baseFill(array, value, start, end) {
4039 var length = array.length;
4041 start = toInteger(start);
4043 start = -start > length ? 0 : (length + start);
4045 end = (end === undefined || end > length) ? length : toInteger(end);
4049 end = start > end ? 0 : toLength(end);
4050 while (start < end) {
4051 array[start++] = value;
4057 * The base implementation of `_.filter` without support for iteratee shorthands.
4060 * @param {Array|Object} collection The collection to iterate over.
4061 * @param {Function} predicate The function invoked per iteration.
4062 * @returns {Array} Returns the new filtered array.
4064 function baseFilter(collection, predicate) {
4066 baseEach(collection, function(value, index, collection) {
4067 if (predicate(value, index, collection)) {
4075 * The base implementation of `_.flatten` with support for restricting flattening.
4078 * @param {Array} array The array to flatten.
4079 * @param {number} depth The maximum recursion depth.
4080 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
4081 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
4082 * @param {Array} [result=[]] The initial result value.
4083 * @returns {Array} Returns the new flattened array.
4085 function baseFlatten(array, depth, predicate, isStrict, result) {
4087 length = array.length;
4089 predicate || (predicate = isFlattenable);
4090 result || (result = []);
4092 while (++index < length) {
4093 var value = array[index];
4094 if (depth > 0 && predicate(value)) {
4096 // Recursively flatten arrays (susceptible to call stack limits).
4097 baseFlatten(value, depth - 1, predicate, isStrict, result);
4099 arrayPush(result, value);
4101 } else if (!isStrict) {
4102 result[result.length] = value;
4109 * The base implementation of `baseForOwn` which iterates over `object`
4110 * properties returned by `keysFunc` and invokes `iteratee` for each property.
4111 * Iteratee functions may exit iteration early by explicitly returning `false`.
4114 * @param {Object} object The object to iterate over.
4115 * @param {Function} iteratee The function invoked per iteration.
4116 * @param {Function} keysFunc The function to get the keys of `object`.
4117 * @returns {Object} Returns `object`.
4119 var baseFor = createBaseFor();
4122 * This function is like `baseFor` except that it iterates over properties
4123 * in the opposite order.
4126 * @param {Object} object The object to iterate over.
4127 * @param {Function} iteratee The function invoked per iteration.
4128 * @param {Function} keysFunc The function to get the keys of `object`.
4129 * @returns {Object} Returns `object`.
4131 var baseForRight = createBaseFor(true);
4134 * The base implementation of `_.forOwn` without support for iteratee shorthands.
4137 * @param {Object} object The object to iterate over.
4138 * @param {Function} iteratee The function invoked per iteration.
4139 * @returns {Object} Returns `object`.
4141 function baseForOwn(object, iteratee) {
4142 return object && baseFor(object, iteratee, keys);
4146 * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
4149 * @param {Object} object The object to iterate over.
4150 * @param {Function} iteratee The function invoked per iteration.
4151 * @returns {Object} Returns `object`.
4153 function baseForOwnRight(object, iteratee) {
4154 return object && baseForRight(object, iteratee, keys);
4158 * The base implementation of `_.functions` which creates an array of
4159 * `object` function property names filtered from `props`.
4162 * @param {Object} object The object to inspect.
4163 * @param {Array} props The property names to filter.
4164 * @returns {Array} Returns the function names.
4166 function baseFunctions(object, props) {
4167 return arrayFilter(props, function(key) {
4168 return isFunction(object[key]);
4173 * The base implementation of `_.get` without support for default values.
4176 * @param {Object} object The object to query.
4177 * @param {Array|string} path The path of the property to get.
4178 * @returns {*} Returns the resolved value.
4180 function baseGet(object, path) {
4181 path = castPath(path, object);
4184 length = path.length;
4186 while (object != null && index < length) {
4187 object = object[toKey(path[index++])];
4189 return (index && index == length) ? object : undefined;
4193 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
4194 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
4195 * symbols of `object`.
4198 * @param {Object} object The object to query.
4199 * @param {Function} keysFunc The function to get the keys of `object`.
4200 * @param {Function} symbolsFunc The function to get the symbols of `object`.
4201 * @returns {Array} Returns the array of property names and symbols.
4203 function baseGetAllKeys(object, keysFunc, symbolsFunc) {
4204 var result = keysFunc(object);
4205 return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
4209 * The base implementation of `getTag` without fallbacks for buggy environments.
4212 * @param {*} value The value to query.
4213 * @returns {string} Returns the `toStringTag`.
4215 function baseGetTag(value) {
4216 if (value == null) {
4217 return value === undefined ? undefinedTag : nullTag;
4219 return (symToStringTag && symToStringTag in Object(value))
4221 : objectToString(value);
4225 * The base implementation of `_.gt` which doesn't coerce arguments.
4228 * @param {*} value The value to compare.
4229 * @param {*} other The other value to compare.
4230 * @returns {boolean} Returns `true` if `value` is greater than `other`,
4233 function baseGt(value, other) {
4234 return value > other;
4238 * The base implementation of `_.has` without support for deep paths.
4241 * @param {Object} [object] The object to query.
4242 * @param {Array|string} key The key to check.
4243 * @returns {boolean} Returns `true` if `key` exists, else `false`.
4245 function baseHas(object, key) {
4246 return object != null && hasOwnProperty.call(object, key);
4250 * The base implementation of `_.hasIn` without support for deep paths.
4253 * @param {Object} [object] The object to query.
4254 * @param {Array|string} key The key to check.
4255 * @returns {boolean} Returns `true` if `key` exists, else `false`.
4257 function baseHasIn(object, key) {
4258 return object != null && key in Object(object);
4262 * The base implementation of `_.inRange` which doesn't coerce arguments.
4265 * @param {number} number The number to check.
4266 * @param {number} start The start of the range.
4267 * @param {number} end The end of the range.
4268 * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
4270 function baseInRange(number, start, end) {
4271 return number >= nativeMin(start, end) && number < nativeMax(start, end);
4275 * The base implementation of methods like `_.intersection`, without support
4276 * for iteratee shorthands, that accepts an array of arrays to inspect.
4279 * @param {Array} arrays The arrays to inspect.
4280 * @param {Function} [iteratee] The iteratee invoked per element.
4281 * @param {Function} [comparator] The comparator invoked per element.
4282 * @returns {Array} Returns the new array of shared values.
4284 function baseIntersection(arrays, iteratee, comparator) {
4285 var includes = comparator ? arrayIncludesWith : arrayIncludes,
4286 length = arrays[0].length,
4287 othLength = arrays.length,
4288 othIndex = othLength,
4289 caches = Array(othLength),
4290 maxLength = Infinity,
4293 while (othIndex--) {
4294 var array = arrays[othIndex];
4295 if (othIndex && iteratee) {
4296 array = arrayMap(array, baseUnary(iteratee));
4298 maxLength = nativeMin(array.length, maxLength);
4299 caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
4300 ? new SetCache(othIndex && array)
4309 while (++index < length && result.length < maxLength) {
4310 var value = array[index],
4311 computed = iteratee ? iteratee(value) : value;
4313 value = (comparator || value !== 0) ? value : 0;
4315 ? cacheHas(seen, computed)
4316 : includes(result, computed, comparator)
4318 othIndex = othLength;
4319 while (--othIndex) {
4320 var cache = caches[othIndex];
4322 ? cacheHas(cache, computed)
4323 : includes(arrays[othIndex], computed, comparator))
4329 seen.push(computed);
4338 * The base implementation of `_.invert` and `_.invertBy` which inverts
4339 * `object` with values transformed by `iteratee` and set by `setter`.
4342 * @param {Object} object The object to iterate over.
4343 * @param {Function} setter The function to set `accumulator` values.
4344 * @param {Function} iteratee The iteratee to transform values.
4345 * @param {Object} accumulator The initial inverted object.
4346 * @returns {Function} Returns `accumulator`.
4348 function baseInverter(object, setter, iteratee, accumulator) {
4349 baseForOwn(object, function(value, key, object) {
4350 setter(accumulator, iteratee(value), key, object);
4356 * The base implementation of `_.invoke` without support for individual
4360 * @param {Object} object The object to query.
4361 * @param {Array|string} path The path of the method to invoke.
4362 * @param {Array} args The arguments to invoke the method with.
4363 * @returns {*} Returns the result of the invoked method.
4365 function baseInvoke(object, path, args) {
4366 path = castPath(path, object);
4367 object = parent(object, path);
4368 var func = object == null ? object : object[toKey(last(path))];
4369 return func == null ? undefined : apply(func, object, args);
4373 * The base implementation of `_.isArguments`.
4376 * @param {*} value The value to check.
4377 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
4379 function baseIsArguments(value) {
4380 return isObjectLike(value) && baseGetTag(value) == argsTag;
4384 * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
4387 * @param {*} value The value to check.
4388 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
4390 function baseIsArrayBuffer(value) {
4391 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
4395 * The base implementation of `_.isDate` without Node.js optimizations.
4398 * @param {*} value The value to check.
4399 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
4401 function baseIsDate(value) {
4402 return isObjectLike(value) && baseGetTag(value) == dateTag;
4406 * The base implementation of `_.isEqual` which supports partial comparisons
4407 * and tracks traversed objects.
4410 * @param {*} value The value to compare.
4411 * @param {*} other The other value to compare.
4412 * @param {boolean} bitmask The bitmask flags.
4413 * 1 - Unordered comparison
4414 * 2 - Partial comparison
4415 * @param {Function} [customizer] The function to customize comparisons.
4416 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
4417 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
4419 function baseIsEqual(value, other, bitmask, customizer, stack) {
4420 if (value === other) {
4423 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
4424 return value !== value && other !== other;
4426 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
4430 * A specialized version of `baseIsEqual` for arrays and objects which performs
4431 * deep comparisons and tracks traversed objects enabling objects with circular
4432 * references to be compared.
4435 * @param {Object} object The object to compare.
4436 * @param {Object} other The other object to compare.
4437 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
4438 * @param {Function} customizer The function to customize comparisons.
4439 * @param {Function} equalFunc The function to determine equivalents of values.
4440 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
4441 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
4443 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
4444 var objIsArr = isArray(object),
4445 othIsArr = isArray(other),
4446 objTag = objIsArr ? arrayTag : getTag(object),
4447 othTag = othIsArr ? arrayTag : getTag(other);
4449 objTag = objTag == argsTag ? objectTag : objTag;
4450 othTag = othTag == argsTag ? objectTag : othTag;
4452 var objIsObj = objTag == objectTag,
4453 othIsObj = othTag == objectTag,
4454 isSameTag = objTag == othTag;
4456 if (isSameTag && isBuffer(object)) {
4457 if (!isBuffer(other)) {
4463 if (isSameTag && !objIsObj) {
4464 stack || (stack = new Stack);
4465 return (objIsArr || isTypedArray(object))
4466 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
4467 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
4469 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
4470 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
4471 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
4473 if (objIsWrapped || othIsWrapped) {
4474 var objUnwrapped = objIsWrapped ? object.value() : object,
4475 othUnwrapped = othIsWrapped ? other.value() : other;
4477 stack || (stack = new Stack);
4478 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
4484 stack || (stack = new Stack);
4485 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
4489 * The base implementation of `_.isMap` without Node.js optimizations.
4492 * @param {*} value The value to check.
4493 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
4495 function baseIsMap(value) {
4496 return isObjectLike(value) && getTag(value) == mapTag;
4500 * The base implementation of `_.isMatch` without support for iteratee shorthands.
4503 * @param {Object} object The object to inspect.
4504 * @param {Object} source The object of property values to match.
4505 * @param {Array} matchData The property names, values, and compare flags to match.
4506 * @param {Function} [customizer] The function to customize comparisons.
4507 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
4509 function baseIsMatch(object, source, matchData, customizer) {
4510 var index = matchData.length,
4512 noCustomizer = !customizer;
4514 if (object == null) {
4517 object = Object(object);
4519 var data = matchData[index];
4520 if ((noCustomizer && data[2])
4521 ? data[1] !== object[data[0]]
4522 : !(data[0] in object)
4527 while (++index < length) {
4528 data = matchData[index];
4530 objValue = object[key],
4533 if (noCustomizer && data[2]) {
4534 if (objValue === undefined && !(key in object)) {
4538 var stack = new Stack;
4540 var result = customizer(objValue, srcValue, key, object, source, stack);
4542 if (!(result === undefined
4543 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
4554 * The base implementation of `_.isNative` without bad shim checks.
4557 * @param {*} value The value to check.
4558 * @returns {boolean} Returns `true` if `value` is a native function,
4561 function baseIsNative(value) {
4562 if (!isObject(value) || isMasked(value)) {
4565 var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
4566 return pattern.test(toSource(value));
4570 * The base implementation of `_.isRegExp` without Node.js optimizations.
4573 * @param {*} value The value to check.
4574 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
4576 function baseIsRegExp(value) {
4577 return isObjectLike(value) && baseGetTag(value) == regexpTag;
4581 * The base implementation of `_.isSet` without Node.js optimizations.
4584 * @param {*} value The value to check.
4585 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
4587 function baseIsSet(value) {
4588 return isObjectLike(value) && getTag(value) == setTag;
4592 * The base implementation of `_.isTypedArray` without Node.js optimizations.
4595 * @param {*} value The value to check.
4596 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
4598 function baseIsTypedArray(value) {
4599 return isObjectLike(value) &&
4600 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
4604 * The base implementation of `_.iteratee`.
4607 * @param {*} [value=_.identity] The value to convert to an iteratee.
4608 * @returns {Function} Returns the iteratee.
4610 function baseIteratee(value) {
4611 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
4612 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
4613 if (typeof value == 'function') {
4616 if (value == null) {
4619 if (typeof value == 'object') {
4620 return isArray(value)
4621 ? baseMatchesProperty(value[0], value[1])
4622 : baseMatches(value);
4624 return property(value);
4628 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
4631 * @param {Object} object The object to query.
4632 * @returns {Array} Returns the array of property names.
4634 function baseKeys(object) {
4635 if (!isPrototype(object)) {
4636 return nativeKeys(object);
4639 for (var key in Object(object)) {
4640 if (hasOwnProperty.call(object, key) && key != 'constructor') {
4648 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
4651 * @param {Object} object The object to query.
4652 * @returns {Array} Returns the array of property names.
4654 function baseKeysIn(object) {
4655 if (!isObject(object)) {
4656 return nativeKeysIn(object);
4658 var isProto = isPrototype(object),
4661 for (var key in object) {
4662 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
4670 * The base implementation of `_.lt` which doesn't coerce arguments.
4673 * @param {*} value The value to compare.
4674 * @param {*} other The other value to compare.
4675 * @returns {boolean} Returns `true` if `value` is less than `other`,
4678 function baseLt(value, other) {
4679 return value < other;
4683 * The base implementation of `_.map` without support for iteratee shorthands.
4686 * @param {Array|Object} collection The collection to iterate over.
4687 * @param {Function} iteratee The function invoked per iteration.
4688 * @returns {Array} Returns the new mapped array.
4690 function baseMap(collection, iteratee) {
4692 result = isArrayLike(collection) ? Array(collection.length) : [];
4694 baseEach(collection, function(value, key, collection) {
4695 result[++index] = iteratee(value, key, collection);
4701 * The base implementation of `_.matches` which doesn't clone `source`.
4704 * @param {Object} source The object of property values to match.
4705 * @returns {Function} Returns the new spec function.
4707 function baseMatches(source) {
4708 var matchData = getMatchData(source);
4709 if (matchData.length == 1 && matchData[0][2]) {
4710 return matchesStrictComparable(matchData[0][0], matchData[0][1]);
4712 return function(object) {
4713 return object === source || baseIsMatch(object, source, matchData);
4718 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
4721 * @param {string} path The path of the property to get.
4722 * @param {*} srcValue The value to match.
4723 * @returns {Function} Returns the new spec function.
4725 function baseMatchesProperty(path, srcValue) {
4726 if (isKey(path) && isStrictComparable(srcValue)) {
4727 return matchesStrictComparable(toKey(path), srcValue);
4729 return function(object) {
4730 var objValue = get(object, path);
4731 return (objValue === undefined && objValue === srcValue)
4732 ? hasIn(object, path)
4733 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
4738 * The base implementation of `_.merge` without support for multiple sources.
4741 * @param {Object} object The destination object.
4742 * @param {Object} source The source object.
4743 * @param {number} srcIndex The index of `source`.
4744 * @param {Function} [customizer] The function to customize merged values.
4745 * @param {Object} [stack] Tracks traversed source values and their merged
4748 function baseMerge(object, source, srcIndex, customizer, stack) {
4749 if (object === source) {
4752 baseFor(source, function(srcValue, key) {
4753 stack || (stack = new Stack);
4754 if (isObject(srcValue)) {
4755 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
4758 var newValue = customizer
4759 ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
4762 if (newValue === undefined) {
4763 newValue = srcValue;
4765 assignMergeValue(object, key, newValue);
4771 * A specialized version of `baseMerge` for arrays and objects which performs
4772 * deep merges and tracks traversed objects enabling objects with circular
4773 * references to be merged.
4776 * @param {Object} object The destination object.
4777 * @param {Object} source The source object.
4778 * @param {string} key The key of the value to merge.
4779 * @param {number} srcIndex The index of `source`.
4780 * @param {Function} mergeFunc The function to merge values.
4781 * @param {Function} [customizer] The function to customize assigned values.
4782 * @param {Object} [stack] Tracks traversed source values and their merged
4785 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
4786 var objValue = safeGet(object, key),
4787 srcValue = safeGet(source, key),
4788 stacked = stack.get(srcValue);
4791 assignMergeValue(object, key, stacked);
4794 var newValue = customizer
4795 ? customizer(objValue, srcValue, (key + ''), object, source, stack)
4798 var isCommon = newValue === undefined;
4801 var isArr = isArray(srcValue),
4802 isBuff = !isArr && isBuffer(srcValue),
4803 isTyped = !isArr && !isBuff && isTypedArray(srcValue);
4805 newValue = srcValue;
4806 if (isArr || isBuff || isTyped) {
4807 if (isArray(objValue)) {
4808 newValue = objValue;
4810 else if (isArrayLikeObject(objValue)) {
4811 newValue = copyArray(objValue);
4815 newValue = cloneBuffer(srcValue, true);
4819 newValue = cloneTypedArray(srcValue, true);
4825 else if (isPlainObject(srcValue) || isArguments(srcValue)) {
4826 newValue = objValue;
4827 if (isArguments(objValue)) {
4828 newValue = toPlainObject(objValue);
4830 else if (!isObject(objValue) || isFunction(objValue)) {
4831 newValue = initCloneObject(srcValue);
4839 // Recursively merge objects and arrays (susceptible to call stack limits).
4840 stack.set(srcValue, newValue);
4841 mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
4842 stack['delete'](srcValue);
4844 assignMergeValue(object, key, newValue);
4848 * The base implementation of `_.nth` which doesn't coerce arguments.
4851 * @param {Array} array The array to query.
4852 * @param {number} n The index of the element to return.
4853 * @returns {*} Returns the nth element of `array`.
4855 function baseNth(array, n) {
4856 var length = array.length;
4860 n += n < 0 ? length : 0;
4861 return isIndex(n, length) ? array[n] : undefined;
4865 * The base implementation of `_.orderBy` without param guards.
4868 * @param {Array|Object} collection The collection to iterate over.
4869 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
4870 * @param {string[]} orders The sort orders of `iteratees`.
4871 * @returns {Array} Returns the new sorted array.
4873 function baseOrderBy(collection, iteratees, orders) {
4874 if (iteratees.length) {
4875 iteratees = arrayMap(iteratees, function(iteratee) {
4876 if (isArray(iteratee)) {
4877 return function(value) {
4878 return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
4884 iteratees = [identity];
4888 iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
4890 var result = baseMap(collection, function(value, key, collection) {
4891 var criteria = arrayMap(iteratees, function(iteratee) {
4892 return iteratee(value);
4894 return { 'criteria': criteria, 'index': ++index, 'value': value };
4897 return baseSortBy(result, function(object, other) {
4898 return compareMultiple(object, other, orders);
4903 * The base implementation of `_.pick` without support for individual
4904 * property identifiers.
4907 * @param {Object} object The source object.
4908 * @param {string[]} paths The property paths to pick.
4909 * @returns {Object} Returns the new object.
4911 function basePick(object, paths) {
4912 return basePickBy(object, paths, function(value, path) {
4913 return hasIn(object, path);
4918 * The base implementation of `_.pickBy` without support for iteratee shorthands.
4921 * @param {Object} object The source object.
4922 * @param {string[]} paths The property paths to pick.
4923 * @param {Function} predicate The function invoked per property.
4924 * @returns {Object} Returns the new object.
4926 function basePickBy(object, paths, predicate) {
4928 length = paths.length,
4931 while (++index < length) {
4932 var path = paths[index],
4933 value = baseGet(object, path);
4935 if (predicate(value, path)) {
4936 baseSet(result, castPath(path, object), value);
4943 * A specialized version of `baseProperty` which supports deep paths.
4946 * @param {Array|string} path The path of the property to get.
4947 * @returns {Function} Returns the new accessor function.
4949 function basePropertyDeep(path) {
4950 return function(object) {
4951 return baseGet(object, path);
4956 * The base implementation of `_.pullAllBy` without support for iteratee
4960 * @param {Array} array The array to modify.
4961 * @param {Array} values The values to remove.
4962 * @param {Function} [iteratee] The iteratee invoked per element.
4963 * @param {Function} [comparator] The comparator invoked per element.
4964 * @returns {Array} Returns `array`.
4966 function basePullAll(array, values, iteratee, comparator) {
4967 var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
4969 length = values.length,
4972 if (array === values) {
4973 values = copyArray(values);
4976 seen = arrayMap(array, baseUnary(iteratee));
4978 while (++index < length) {
4980 value = values[index],
4981 computed = iteratee ? iteratee(value) : value;
4983 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
4984 if (seen !== array) {
4985 splice.call(seen, fromIndex, 1);
4987 splice.call(array, fromIndex, 1);
4994 * The base implementation of `_.pullAt` without support for individual
4995 * indexes or capturing the removed elements.
4998 * @param {Array} array The array to modify.
4999 * @param {number[]} indexes The indexes of elements to remove.
5000 * @returns {Array} Returns `array`.
5002 function basePullAt(array, indexes) {
5003 var length = array ? indexes.length : 0,
5004 lastIndex = length - 1;
5007 var index = indexes[length];
5008 if (length == lastIndex || index !== previous) {
5009 var previous = index;
5010 if (isIndex(index)) {
5011 splice.call(array, index, 1);
5013 baseUnset(array, index);
5021 * The base implementation of `_.random` without support for returning
5022 * floating-point numbers.
5025 * @param {number} lower The lower bound.
5026 * @param {number} upper The upper bound.
5027 * @returns {number} Returns the random number.
5029 function baseRandom(lower, upper) {
5030 return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
5034 * The base implementation of `_.range` and `_.rangeRight` which doesn't
5038 * @param {number} start The start of the range.
5039 * @param {number} end The end of the range.
5040 * @param {number} step The value to increment or decrement by.
5041 * @param {boolean} [fromRight] Specify iterating from right to left.
5042 * @returns {Array} Returns the range of numbers.
5044 function baseRange(start, end, step, fromRight) {
5046 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
5047 result = Array(length);
5050 result[fromRight ? length : ++index] = start;
5057 * The base implementation of `_.repeat` which doesn't coerce arguments.
5060 * @param {string} string The string to repeat.
5061 * @param {number} n The number of times to repeat the string.
5062 * @returns {string} Returns the repeated string.
5064 function baseRepeat(string, n) {
5066 if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
5069 // Leverage the exponentiation by squaring algorithm for a faster repeat.
5070 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
5075 n = nativeFloor(n / 2);
5085 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
5088 * @param {Function} func The function to apply a rest parameter to.
5089 * @param {number} [start=func.length-1] The start position of the rest parameter.
5090 * @returns {Function} Returns the new function.
5092 function baseRest(func, start) {
5093 return setToString(overRest(func, start, identity), func + '');
5097 * The base implementation of `_.sample`.
5100 * @param {Array|Object} collection The collection to sample.
5101 * @returns {*} Returns the random element.
5103 function baseSample(collection) {
5104 return arraySample(values(collection));
5108 * The base implementation of `_.sampleSize` without param guards.
5111 * @param {Array|Object} collection The collection to sample.
5112 * @param {number} n The number of elements to sample.
5113 * @returns {Array} Returns the random elements.
5115 function baseSampleSize(collection, n) {
5116 var array = values(collection);
5117 return shuffleSelf(array, baseClamp(n, 0, array.length));
5121 * The base implementation of `_.set`.
5124 * @param {Object} object The object to modify.
5125 * @param {Array|string} path The path of the property to set.
5126 * @param {*} value The value to set.
5127 * @param {Function} [customizer] The function to customize path creation.
5128 * @returns {Object} Returns `object`.
5130 function baseSet(object, path, value, customizer) {
5131 if (!isObject(object)) {
5134 path = castPath(path, object);
5137 length = path.length,
5138 lastIndex = length - 1,
5141 while (nested != null && ++index < length) {
5142 var key = toKey(path[index]),
5145 if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
5149 if (index != lastIndex) {
5150 var objValue = nested[key];
5151 newValue = customizer ? customizer(objValue, key, nested) : undefined;
5152 if (newValue === undefined) {
5153 newValue = isObject(objValue)
5155 : (isIndex(path[index + 1]) ? [] : {});
5158 assignValue(nested, key, newValue);
5159 nested = nested[key];
5165 * The base implementation of `setData` without support for hot loop shorting.
5168 * @param {Function} func The function to associate metadata with.
5169 * @param {*} data The metadata.
5170 * @returns {Function} Returns `func`.
5172 var baseSetData = !metaMap ? identity : function(func, data) {
5173 metaMap.set(func, data);
5178 * The base implementation of `setToString` without support for hot loop shorting.
5181 * @param {Function} func The function to modify.
5182 * @param {Function} string The `toString` result.
5183 * @returns {Function} Returns `func`.
5185 var baseSetToString = !defineProperty ? identity : function(func, string) {
5186 return defineProperty(func, 'toString', {
5187 'configurable': true,
5188 'enumerable': false,
5189 'value': constant(string),
5195 * The base implementation of `_.shuffle`.
5198 * @param {Array|Object} collection The collection to shuffle.
5199 * @returns {Array} Returns the new shuffled array.
5201 function baseShuffle(collection) {
5202 return shuffleSelf(values(collection));
5206 * The base implementation of `_.slice` without an iteratee call guard.
5209 * @param {Array} array The array to slice.
5210 * @param {number} [start=0] The start position.
5211 * @param {number} [end=array.length] The end position.
5212 * @returns {Array} Returns the slice of `array`.
5214 function baseSlice(array, start, end) {
5216 length = array.length;
5219 start = -start > length ? 0 : (length + start);
5221 end = end > length ? length : end;
5225 length = start > end ? 0 : ((end - start) >>> 0);
5228 var result = Array(length);
5229 while (++index < length) {
5230 result[index] = array[index + start];
5236 * The base implementation of `_.some` without support for iteratee shorthands.
5239 * @param {Array|Object} collection The collection to iterate over.
5240 * @param {Function} predicate The function invoked per iteration.
5241 * @returns {boolean} Returns `true` if any element passes the predicate check,
5244 function baseSome(collection, predicate) {
5247 baseEach(collection, function(value, index, collection) {
5248 result = predicate(value, index, collection);
5255 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
5256 * performs a binary search of `array` to determine the index at which `value`
5257 * should be inserted into `array` in order to maintain its sort order.
5260 * @param {Array} array The sorted array to inspect.
5261 * @param {*} value The value to evaluate.
5262 * @param {boolean} [retHighest] Specify returning the highest qualified index.
5263 * @returns {number} Returns the index at which `value` should be inserted
5266 function baseSortedIndex(array, value, retHighest) {
5268 high = array == null ? low : array.length;
5270 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
5271 while (low < high) {
5272 var mid = (low + high) >>> 1,
5273 computed = array[mid];
5275 if (computed !== null && !isSymbol(computed) &&
5276 (retHighest ? (computed <= value) : (computed < value))) {
5284 return baseSortedIndexBy(array, value, identity, retHighest);
5288 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
5289 * which invokes `iteratee` for `value` and each element of `array` to compute
5290 * their sort ranking. The iteratee is invoked with one argument; (value).
5293 * @param {Array} array The sorted array to inspect.
5294 * @param {*} value The value to evaluate.
5295 * @param {Function} iteratee The iteratee invoked per element.
5296 * @param {boolean} [retHighest] Specify returning the highest qualified index.
5297 * @returns {number} Returns the index at which `value` should be inserted
5300 function baseSortedIndexBy(array, value, iteratee, retHighest) {
5302 high = array == null ? 0 : array.length;
5307 value = iteratee(value);
5308 var valIsNaN = value !== value,
5309 valIsNull = value === null,
5310 valIsSymbol = isSymbol(value),
5311 valIsUndefined = value === undefined;
5313 while (low < high) {
5314 var mid = nativeFloor((low + high) / 2),
5315 computed = iteratee(array[mid]),
5316 othIsDefined = computed !== undefined,
5317 othIsNull = computed === null,
5318 othIsReflexive = computed === computed,
5319 othIsSymbol = isSymbol(computed);
5322 var setLow = retHighest || othIsReflexive;
5323 } else if (valIsUndefined) {
5324 setLow = othIsReflexive && (retHighest || othIsDefined);
5325 } else if (valIsNull) {
5326 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
5327 } else if (valIsSymbol) {
5328 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
5329 } else if (othIsNull || othIsSymbol) {
5332 setLow = retHighest ? (computed <= value) : (computed < value);
5340 return nativeMin(high, MAX_ARRAY_INDEX);
5344 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
5345 * support for iteratee shorthands.
5348 * @param {Array} array The array to inspect.
5349 * @param {Function} [iteratee] The iteratee invoked per element.
5350 * @returns {Array} Returns the new duplicate free array.
5352 function baseSortedUniq(array, iteratee) {
5354 length = array.length,
5358 while (++index < length) {
5359 var value = array[index],
5360 computed = iteratee ? iteratee(value) : value;
5362 if (!index || !eq(computed, seen)) {
5363 var seen = computed;
5364 result[resIndex++] = value === 0 ? 0 : value;
5371 * The base implementation of `_.toNumber` which doesn't ensure correct
5372 * conversions of binary, hexadecimal, or octal string values.
5375 * @param {*} value The value to process.
5376 * @returns {number} Returns the number.
5378 function baseToNumber(value) {
5379 if (typeof value == 'number') {
5382 if (isSymbol(value)) {
5389 * The base implementation of `_.toString` which doesn't convert nullish
5390 * values to empty strings.
5393 * @param {*} value The value to process.
5394 * @returns {string} Returns the string.
5396 function baseToString(value) {
5397 // Exit early for strings to avoid a performance hit in some environments.
5398 if (typeof value == 'string') {
5401 if (isArray(value)) {
5402 // Recursively convert values (susceptible to call stack limits).
5403 return arrayMap(value, baseToString) + '';
5405 if (isSymbol(value)) {
5406 return symbolToString ? symbolToString.call(value) : '';
5408 var result = (value + '');
5409 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
5413 * The base implementation of `_.uniqBy` without support for iteratee shorthands.
5416 * @param {Array} array The array to inspect.
5417 * @param {Function} [iteratee] The iteratee invoked per element.
5418 * @param {Function} [comparator] The comparator invoked per element.
5419 * @returns {Array} Returns the new duplicate free array.
5421 function baseUniq(array, iteratee, comparator) {
5423 includes = arrayIncludes,
5424 length = array.length,
5431 includes = arrayIncludesWith;
5433 else if (length >= LARGE_ARRAY_SIZE) {
5434 var set = iteratee ? null : createSet(array);
5436 return setToArray(set);
5439 includes = cacheHas;
5440 seen = new SetCache;
5443 seen = iteratee ? [] : result;
5446 while (++index < length) {
5447 var value = array[index],
5448 computed = iteratee ? iteratee(value) : value;
5450 value = (comparator || value !== 0) ? value : 0;
5451 if (isCommon && computed === computed) {
5452 var seenIndex = seen.length;
5453 while (seenIndex--) {
5454 if (seen[seenIndex] === computed) {
5459 seen.push(computed);
5463 else if (!includes(seen, computed, comparator)) {
5464 if (seen !== result) {
5465 seen.push(computed);
5474 * The base implementation of `_.unset`.
5477 * @param {Object} object The object to modify.
5478 * @param {Array|string} path The property path to unset.
5479 * @returns {boolean} Returns `true` if the property is deleted, else `false`.
5481 function baseUnset(object, path) {
5482 path = castPath(path, object);
5483 object = parent(object, path);
5484 return object == null || delete object[toKey(last(path))];
5488 * The base implementation of `_.update`.
5491 * @param {Object} object The object to modify.
5492 * @param {Array|string} path The path of the property to update.
5493 * @param {Function} updater The function to produce the updated value.
5494 * @param {Function} [customizer] The function to customize path creation.
5495 * @returns {Object} Returns `object`.
5497 function baseUpdate(object, path, updater, customizer) {
5498 return baseSet(object, path, updater(baseGet(object, path)), customizer);
5502 * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
5503 * without support for iteratee shorthands.
5506 * @param {Array} array The array to query.
5507 * @param {Function} predicate The function invoked per iteration.
5508 * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
5509 * @param {boolean} [fromRight] Specify iterating from right to left.
5510 * @returns {Array} Returns the slice of `array`.
5512 function baseWhile(array, predicate, isDrop, fromRight) {
5513 var length = array.length,
5514 index = fromRight ? length : -1;
5516 while ((fromRight ? index-- : ++index < length) &&
5517 predicate(array[index], index, array)) {}
5520 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
5521 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
5525 * The base implementation of `wrapperValue` which returns the result of
5526 * performing a sequence of actions on the unwrapped `value`, where each
5527 * successive action is supplied the return value of the previous.
5530 * @param {*} value The unwrapped value.
5531 * @param {Array} actions Actions to perform to resolve the unwrapped value.
5532 * @returns {*} Returns the resolved value.
5534 function baseWrapperValue(value, actions) {
5536 if (result instanceof LazyWrapper) {
5537 result = result.value();
5539 return arrayReduce(actions, function(result, action) {
5540 return action.func.apply(action.thisArg, arrayPush([result], action.args));
5545 * The base implementation of methods like `_.xor`, without support for
5546 * iteratee shorthands, that accepts an array of arrays to inspect.
5549 * @param {Array} arrays The arrays to inspect.
5550 * @param {Function} [iteratee] The iteratee invoked per element.
5551 * @param {Function} [comparator] The comparator invoked per element.
5552 * @returns {Array} Returns the new array of values.
5554 function baseXor(arrays, iteratee, comparator) {
5555 var length = arrays.length;
5557 return length ? baseUniq(arrays[0]) : [];
5560 result = Array(length);
5562 while (++index < length) {
5563 var array = arrays[index],
5566 while (++othIndex < length) {
5567 if (othIndex != index) {
5568 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
5572 return baseUniq(baseFlatten(result, 1), iteratee, comparator);
5576 * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
5579 * @param {Array} props The property identifiers.
5580 * @param {Array} values The property values.
5581 * @param {Function} assignFunc The function to assign values.
5582 * @returns {Object} Returns the new object.
5584 function baseZipObject(props, values, assignFunc) {
5586 length = props.length,
5587 valsLength = values.length,
5590 while (++index < length) {
5591 var value = index < valsLength ? values[index] : undefined;
5592 assignFunc(result, props[index], value);
5598 * Casts `value` to an empty array if it's not an array like object.
5601 * @param {*} value The value to inspect.
5602 * @returns {Array|Object} Returns the cast array-like object.
5604 function castArrayLikeObject(value) {
5605 return isArrayLikeObject(value) ? value : [];
5609 * Casts `value` to `identity` if it's not a function.
5612 * @param {*} value The value to inspect.
5613 * @returns {Function} Returns cast function.
5615 function castFunction(value) {
5616 return typeof value == 'function' ? value : identity;
5620 * Casts `value` to a path array if it's not one.
5623 * @param {*} value The value to inspect.
5624 * @param {Object} [object] The object to query keys on.
5625 * @returns {Array} Returns the cast property path array.
5627 function castPath(value, object) {
5628 if (isArray(value)) {
5631 return isKey(value, object) ? [value] : stringToPath(toString(value));
5635 * A `baseRest` alias which can be replaced with `identity` by module
5636 * replacement plugins.
5640 * @param {Function} func The function to apply a rest parameter to.
5641 * @returns {Function} Returns the new function.
5643 var castRest = baseRest;
5646 * Casts `array` to a slice if it's needed.
5649 * @param {Array} array The array to inspect.
5650 * @param {number} start The start position.
5651 * @param {number} [end=array.length] The end position.
5652 * @returns {Array} Returns the cast slice.
5654 function castSlice(array, start, end) {
5655 var length = array.length;
5656 end = end === undefined ? length : end;
5657 return (!start && end >= length) ? array : baseSlice(array, start, end);
5661 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
5664 * @param {number|Object} id The timer id or timeout object of the timer to clear.
5666 var clearTimeout = ctxClearTimeout || function(id) {
5667 return root.clearTimeout(id);
5671 * Creates a clone of `buffer`.
5674 * @param {Buffer} buffer The buffer to clone.
5675 * @param {boolean} [isDeep] Specify a deep clone.
5676 * @returns {Buffer} Returns the cloned buffer.
5678 function cloneBuffer(buffer, isDeep) {
5680 return buffer.slice();
5682 var length = buffer.length,
5683 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
5685 buffer.copy(result);
5690 * Creates a clone of `arrayBuffer`.
5693 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
5694 * @returns {ArrayBuffer} Returns the cloned array buffer.
5696 function cloneArrayBuffer(arrayBuffer) {
5697 var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
5698 new Uint8Array(result).set(new Uint8Array(arrayBuffer));
5703 * Creates a clone of `dataView`.
5706 * @param {Object} dataView The data view to clone.
5707 * @param {boolean} [isDeep] Specify a deep clone.
5708 * @returns {Object} Returns the cloned data view.
5710 function cloneDataView(dataView, isDeep) {
5711 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
5712 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
5716 * Creates a clone of `regexp`.
5719 * @param {Object} regexp The regexp to clone.
5720 * @returns {Object} Returns the cloned regexp.
5722 function cloneRegExp(regexp) {
5723 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
5724 result.lastIndex = regexp.lastIndex;
5729 * Creates a clone of the `symbol` object.
5732 * @param {Object} symbol The symbol object to clone.
5733 * @returns {Object} Returns the cloned symbol object.
5735 function cloneSymbol(symbol) {
5736 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
5740 * Creates a clone of `typedArray`.
5743 * @param {Object} typedArray The typed array to clone.
5744 * @param {boolean} [isDeep] Specify a deep clone.
5745 * @returns {Object} Returns the cloned typed array.
5747 function cloneTypedArray(typedArray, isDeep) {
5748 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
5749 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
5753 * Compares values to sort them in ascending order.
5756 * @param {*} value The value to compare.
5757 * @param {*} other The other value to compare.
5758 * @returns {number} Returns the sort order indicator for `value`.
5760 function compareAscending(value, other) {
5761 if (value !== other) {
5762 var valIsDefined = value !== undefined,
5763 valIsNull = value === null,
5764 valIsReflexive = value === value,
5765 valIsSymbol = isSymbol(value);
5767 var othIsDefined = other !== undefined,
5768 othIsNull = other === null,
5769 othIsReflexive = other === other,
5770 othIsSymbol = isSymbol(other);
5772 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
5773 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
5774 (valIsNull && othIsDefined && othIsReflexive) ||
5775 (!valIsDefined && othIsReflexive) ||
5779 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
5780 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
5781 (othIsNull && valIsDefined && valIsReflexive) ||
5782 (!othIsDefined && valIsReflexive) ||
5791 * Used by `_.orderBy` to compare multiple properties of a value to another
5792 * and stable sort them.
5794 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
5795 * specify an order of "desc" for descending or "asc" for ascending sort order
5796 * of corresponding values.
5799 * @param {Object} object The object to compare.
5800 * @param {Object} other The other object to compare.
5801 * @param {boolean[]|string[]} orders The order to sort by for each property.
5802 * @returns {number} Returns the sort order indicator for `object`.
5804 function compareMultiple(object, other, orders) {
5806 objCriteria = object.criteria,
5807 othCriteria = other.criteria,
5808 length = objCriteria.length,
5809 ordersLength = orders.length;
5811 while (++index < length) {
5812 var result = compareAscending(objCriteria[index], othCriteria[index]);
5814 if (index >= ordersLength) {
5817 var order = orders[index];
5818 return result * (order == 'desc' ? -1 : 1);
5821 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
5822 // that causes it, under certain circumstances, to provide the same value for
5823 // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
5824 // for more details.
5826 // This also ensures a stable sort in V8 and other engines.
5827 // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
5828 return object.index - other.index;
5832 * Creates an array that is the composition of partially applied arguments,
5833 * placeholders, and provided arguments into a single array of arguments.
5836 * @param {Array} args The provided arguments.
5837 * @param {Array} partials The arguments to prepend to those provided.
5838 * @param {Array} holders The `partials` placeholder indexes.
5839 * @params {boolean} [isCurried] Specify composing for a curried function.
5840 * @returns {Array} Returns the new array of composed arguments.
5842 function composeArgs(args, partials, holders, isCurried) {
5844 argsLength = args.length,
5845 holdersLength = holders.length,
5847 leftLength = partials.length,
5848 rangeLength = nativeMax(argsLength - holdersLength, 0),
5849 result = Array(leftLength + rangeLength),
5850 isUncurried = !isCurried;
5852 while (++leftIndex < leftLength) {
5853 result[leftIndex] = partials[leftIndex];
5855 while (++argsIndex < holdersLength) {
5856 if (isUncurried || argsIndex < argsLength) {
5857 result[holders[argsIndex]] = args[argsIndex];
5860 while (rangeLength--) {
5861 result[leftIndex++] = args[argsIndex++];
5867 * This function is like `composeArgs` except that the arguments composition
5868 * is tailored for `_.partialRight`.
5871 * @param {Array} args The provided arguments.
5872 * @param {Array} partials The arguments to append to those provided.
5873 * @param {Array} holders The `partials` placeholder indexes.
5874 * @params {boolean} [isCurried] Specify composing for a curried function.
5875 * @returns {Array} Returns the new array of composed arguments.
5877 function composeArgsRight(args, partials, holders, isCurried) {
5879 argsLength = args.length,
5881 holdersLength = holders.length,
5883 rightLength = partials.length,
5884 rangeLength = nativeMax(argsLength - holdersLength, 0),
5885 result = Array(rangeLength + rightLength),
5886 isUncurried = !isCurried;
5888 while (++argsIndex < rangeLength) {
5889 result[argsIndex] = args[argsIndex];
5891 var offset = argsIndex;
5892 while (++rightIndex < rightLength) {
5893 result[offset + rightIndex] = partials[rightIndex];
5895 while (++holdersIndex < holdersLength) {
5896 if (isUncurried || argsIndex < argsLength) {
5897 result[offset + holders[holdersIndex]] = args[argsIndex++];
5904 * Copies the values of `source` to `array`.
5907 * @param {Array} source The array to copy values from.
5908 * @param {Array} [array=[]] The array to copy values to.
5909 * @returns {Array} Returns `array`.
5911 function copyArray(source, array) {
5913 length = source.length;
5915 array || (array = Array(length));
5916 while (++index < length) {
5917 array[index] = source[index];
5923 * Copies properties of `source` to `object`.
5926 * @param {Object} source The object to copy properties from.
5927 * @param {Array} props The property identifiers to copy.
5928 * @param {Object} [object={}] The object to copy properties to.
5929 * @param {Function} [customizer] The function to customize copied values.
5930 * @returns {Object} Returns `object`.
5932 function copyObject(source, props, object, customizer) {
5933 var isNew = !object;
5934 object || (object = {});
5937 length = props.length;
5939 while (++index < length) {
5940 var key = props[index];
5942 var newValue = customizer
5943 ? customizer(object[key], source[key], key, object, source)
5946 if (newValue === undefined) {
5947 newValue = source[key];
5950 baseAssignValue(object, key, newValue);
5952 assignValue(object, key, newValue);
5959 * Copies own symbols of `source` to `object`.
5962 * @param {Object} source The object to copy symbols from.
5963 * @param {Object} [object={}] The object to copy symbols to.
5964 * @returns {Object} Returns `object`.
5966 function copySymbols(source, object) {
5967 return copyObject(source, getSymbols(source), object);
5971 * Copies own and inherited symbols of `source` to `object`.
5974 * @param {Object} source The object to copy symbols from.
5975 * @param {Object} [object={}] The object to copy symbols to.
5976 * @returns {Object} Returns `object`.
5978 function copySymbolsIn(source, object) {
5979 return copyObject(source, getSymbolsIn(source), object);
5983 * Creates a function like `_.groupBy`.
5986 * @param {Function} setter The function to set accumulator values.
5987 * @param {Function} [initializer] The accumulator object initializer.
5988 * @returns {Function} Returns the new aggregator function.
5990 function createAggregator(setter, initializer) {
5991 return function(collection, iteratee) {
5992 var func = isArray(collection) ? arrayAggregator : baseAggregator,
5993 accumulator = initializer ? initializer() : {};
5995 return func(collection, setter, getIteratee(iteratee, 2), accumulator);
6000 * Creates a function like `_.assign`.
6003 * @param {Function} assigner The function to assign values.
6004 * @returns {Function} Returns the new assigner function.
6006 function createAssigner(assigner) {
6007 return baseRest(function(object, sources) {
6009 length = sources.length,
6010 customizer = length > 1 ? sources[length - 1] : undefined,
6011 guard = length > 2 ? sources[2] : undefined;
6013 customizer = (assigner.length > 3 && typeof customizer == 'function')
6014 ? (length--, customizer)
6017 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
6018 customizer = length < 3 ? undefined : customizer;
6021 object = Object(object);
6022 while (++index < length) {
6023 var source = sources[index];
6025 assigner(object, source, index, customizer);
6033 * Creates a `baseEach` or `baseEachRight` function.
6036 * @param {Function} eachFunc The function to iterate over a collection.
6037 * @param {boolean} [fromRight] Specify iterating from right to left.
6038 * @returns {Function} Returns the new base function.
6040 function createBaseEach(eachFunc, fromRight) {
6041 return function(collection, iteratee) {
6042 if (collection == null) {
6045 if (!isArrayLike(collection)) {
6046 return eachFunc(collection, iteratee);
6048 var length = collection.length,
6049 index = fromRight ? length : -1,
6050 iterable = Object(collection);
6052 while ((fromRight ? index-- : ++index < length)) {
6053 if (iteratee(iterable[index], index, iterable) === false) {
6062 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
6065 * @param {boolean} [fromRight] Specify iterating from right to left.
6066 * @returns {Function} Returns the new base function.
6068 function createBaseFor(fromRight) {
6069 return function(object, iteratee, keysFunc) {
6071 iterable = Object(object),
6072 props = keysFunc(object),
6073 length = props.length;
6076 var key = props[fromRight ? length : ++index];
6077 if (iteratee(iterable[key], key, iterable) === false) {
6086 * Creates a function that wraps `func` to invoke it with the optional `this`
6087 * binding of `thisArg`.
6090 * @param {Function} func The function to wrap.
6091 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6092 * @param {*} [thisArg] The `this` binding of `func`.
6093 * @returns {Function} Returns the new wrapped function.
6095 function createBind(func, bitmask, thisArg) {
6096 var isBind = bitmask & WRAP_BIND_FLAG,
6097 Ctor = createCtor(func);
6099 function wrapper() {
6100 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
6101 return fn.apply(isBind ? thisArg : this, arguments);
6107 * Creates a function like `_.lowerFirst`.
6110 * @param {string} methodName The name of the `String` case method to use.
6111 * @returns {Function} Returns the new case function.
6113 function createCaseFirst(methodName) {
6114 return function(string) {
6115 string = toString(string);
6117 var strSymbols = hasUnicode(string)
6118 ? stringToArray(string)
6121 var chr = strSymbols
6125 var trailing = strSymbols
6126 ? castSlice(strSymbols, 1).join('')
6129 return chr[methodName]() + trailing;
6134 * Creates a function like `_.camelCase`.
6137 * @param {Function} callback The function to combine each word.
6138 * @returns {Function} Returns the new compounder function.
6140 function createCompounder(callback) {
6141 return function(string) {
6142 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
6147 * Creates a function that produces an instance of `Ctor` regardless of
6148 * whether it was invoked as part of a `new` expression or by `call` or `apply`.
6151 * @param {Function} Ctor The constructor to wrap.
6152 * @returns {Function} Returns the new wrapped function.
6154 function createCtor(Ctor) {
6156 // Use a `switch` statement to work with class constructors. See
6157 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
6158 // for more details.
6159 var args = arguments;
6160 switch (args.length) {
6161 case 0: return new Ctor;
6162 case 1: return new Ctor(args[0]);
6163 case 2: return new Ctor(args[0], args[1]);
6164 case 3: return new Ctor(args[0], args[1], args[2]);
6165 case 4: return new Ctor(args[0], args[1], args[2], args[3]);
6166 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
6167 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
6168 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
6170 var thisBinding = baseCreate(Ctor.prototype),
6171 result = Ctor.apply(thisBinding, args);
6173 // Mimic the constructor's `return` behavior.
6174 // See https://es5.github.io/#x13.2.2 for more details.
6175 return isObject(result) ? result : thisBinding;
6180 * Creates a function that wraps `func` to enable currying.
6183 * @param {Function} func The function to wrap.
6184 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6185 * @param {number} arity The arity of `func`.
6186 * @returns {Function} Returns the new wrapped function.
6188 function createCurry(func, bitmask, arity) {
6189 var Ctor = createCtor(func);
6191 function wrapper() {
6192 var length = arguments.length,
6193 args = Array(length),
6195 placeholder = getHolder(wrapper);
6198 args[index] = arguments[index];
6200 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
6202 : replaceHolders(args, placeholder);
6204 length -= holders.length;
6205 if (length < arity) {
6206 return createRecurry(
6207 func, bitmask, createHybrid, wrapper.placeholder, undefined,
6208 args, holders, undefined, undefined, arity - length);
6210 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
6211 return apply(fn, this, args);
6217 * Creates a `_.find` or `_.findLast` function.
6220 * @param {Function} findIndexFunc The function to find the collection index.
6221 * @returns {Function} Returns the new find function.
6223 function createFind(findIndexFunc) {
6224 return function(collection, predicate, fromIndex) {
6225 var iterable = Object(collection);
6226 if (!isArrayLike(collection)) {
6227 var iteratee = getIteratee(predicate, 3);
6228 collection = keys(collection);
6229 predicate = function(key) { return iteratee(iterable[key], key, iterable); };
6231 var index = findIndexFunc(collection, predicate, fromIndex);
6232 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
6237 * Creates a `_.flow` or `_.flowRight` function.
6240 * @param {boolean} [fromRight] Specify iterating from right to left.
6241 * @returns {Function} Returns the new flow function.
6243 function createFlow(fromRight) {
6244 return flatRest(function(funcs) {
6245 var length = funcs.length,
6247 prereq = LodashWrapper.prototype.thru;
6253 var func = funcs[index];
6254 if (typeof func != 'function') {
6255 throw new TypeError(FUNC_ERROR_TEXT);
6257 if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
6258 var wrapper = new LodashWrapper([], true);
6261 index = wrapper ? index : length;
6262 while (++index < length) {
6263 func = funcs[index];
6265 var funcName = getFuncName(func),
6266 data = funcName == 'wrapper' ? getData(func) : undefined;
6268 if (data && isLaziable(data[0]) &&
6269 data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
6270 !data[4].length && data[9] == 1
6272 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
6274 wrapper = (func.length == 1 && isLaziable(func))
6275 ? wrapper[funcName]()
6276 : wrapper.thru(func);
6280 var args = arguments,
6283 if (wrapper && args.length == 1 && isArray(value)) {
6284 return wrapper.plant(value).value();
6287 result = length ? funcs[index].apply(this, args) : value;
6289 while (++index < length) {
6290 result = funcs[index].call(this, result);
6298 * Creates a function that wraps `func` to invoke it with optional `this`
6299 * binding of `thisArg`, partial application, and currying.
6302 * @param {Function|string} func The function or method name to wrap.
6303 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6304 * @param {*} [thisArg] The `this` binding of `func`.
6305 * @param {Array} [partials] The arguments to prepend to those provided to
6307 * @param {Array} [holders] The `partials` placeholder indexes.
6308 * @param {Array} [partialsRight] The arguments to append to those provided
6309 * to the new function.
6310 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
6311 * @param {Array} [argPos] The argument positions of the new function.
6312 * @param {number} [ary] The arity cap of `func`.
6313 * @param {number} [arity] The arity of `func`.
6314 * @returns {Function} Returns the new wrapped function.
6316 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
6317 var isAry = bitmask & WRAP_ARY_FLAG,
6318 isBind = bitmask & WRAP_BIND_FLAG,
6319 isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
6320 isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
6321 isFlip = bitmask & WRAP_FLIP_FLAG,
6322 Ctor = isBindKey ? undefined : createCtor(func);
6324 function wrapper() {
6325 var length = arguments.length,
6326 args = Array(length),
6330 args[index] = arguments[index];
6333 var placeholder = getHolder(wrapper),
6334 holdersCount = countHolders(args, placeholder);
6337 args = composeArgs(args, partials, holders, isCurried);
6339 if (partialsRight) {
6340 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
6342 length -= holdersCount;
6343 if (isCurried && length < arity) {
6344 var newHolders = replaceHolders(args, placeholder);
6345 return createRecurry(
6346 func, bitmask, createHybrid, wrapper.placeholder, thisArg,
6347 args, newHolders, argPos, ary, arity - length
6350 var thisBinding = isBind ? thisArg : this,
6351 fn = isBindKey ? thisBinding[func] : func;
6353 length = args.length;
6355 args = reorder(args, argPos);
6356 } else if (isFlip && length > 1) {
6359 if (isAry && ary < length) {
6362 if (this && this !== root && this instanceof wrapper) {
6363 fn = Ctor || createCtor(fn);
6365 return fn.apply(thisBinding, args);
6371 * Creates a function like `_.invertBy`.
6374 * @param {Function} setter The function to set accumulator values.
6375 * @param {Function} toIteratee The function to resolve iteratees.
6376 * @returns {Function} Returns the new inverter function.
6378 function createInverter(setter, toIteratee) {
6379 return function(object, iteratee) {
6380 return baseInverter(object, setter, toIteratee(iteratee), {});
6385 * Creates a function that performs a mathematical operation on two values.
6388 * @param {Function} operator The function to perform the operation.
6389 * @param {number} [defaultValue] The value used for `undefined` arguments.
6390 * @returns {Function} Returns the new mathematical operation function.
6392 function createMathOperation(operator, defaultValue) {
6393 return function(value, other) {
6395 if (value === undefined && other === undefined) {
6396 return defaultValue;
6398 if (value !== undefined) {
6401 if (other !== undefined) {
6402 if (result === undefined) {
6405 if (typeof value == 'string' || typeof other == 'string') {
6406 value = baseToString(value);
6407 other = baseToString(other);
6409 value = baseToNumber(value);
6410 other = baseToNumber(other);
6412 result = operator(value, other);
6419 * Creates a function like `_.over`.
6422 * @param {Function} arrayFunc The function to iterate over iteratees.
6423 * @returns {Function} Returns the new over function.
6425 function createOver(arrayFunc) {
6426 return flatRest(function(iteratees) {
6427 iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
6428 return baseRest(function(args) {
6430 return arrayFunc(iteratees, function(iteratee) {
6431 return apply(iteratee, thisArg, args);
6438 * Creates the padding for `string` based on `length`. The `chars` string
6439 * is truncated if the number of characters exceeds `length`.
6442 * @param {number} length The padding length.
6443 * @param {string} [chars=' '] The string used as padding.
6444 * @returns {string} Returns the padding for `string`.
6446 function createPadding(length, chars) {
6447 chars = chars === undefined ? ' ' : baseToString(chars);
6449 var charsLength = chars.length;
6450 if (charsLength < 2) {
6451 return charsLength ? baseRepeat(chars, length) : chars;
6453 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
6454 return hasUnicode(chars)
6455 ? castSlice(stringToArray(result), 0, length).join('')
6456 : result.slice(0, length);
6460 * Creates a function that wraps `func` to invoke it with the `this` binding
6461 * of `thisArg` and `partials` prepended to the arguments it receives.
6464 * @param {Function} func The function to wrap.
6465 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6466 * @param {*} thisArg The `this` binding of `func`.
6467 * @param {Array} partials The arguments to prepend to those provided to
6469 * @returns {Function} Returns the new wrapped function.
6471 function createPartial(func, bitmask, thisArg, partials) {
6472 var isBind = bitmask & WRAP_BIND_FLAG,
6473 Ctor = createCtor(func);
6475 function wrapper() {
6477 argsLength = arguments.length,
6479 leftLength = partials.length,
6480 args = Array(leftLength + argsLength),
6481 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
6483 while (++leftIndex < leftLength) {
6484 args[leftIndex] = partials[leftIndex];
6486 while (argsLength--) {
6487 args[leftIndex++] = arguments[++argsIndex];
6489 return apply(fn, isBind ? thisArg : this, args);
6495 * Creates a `_.range` or `_.rangeRight` function.
6498 * @param {boolean} [fromRight] Specify iterating from right to left.
6499 * @returns {Function} Returns the new range function.
6501 function createRange(fromRight) {
6502 return function(start, end, step) {
6503 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
6504 end = step = undefined;
6506 // Ensure the sign of `-0` is preserved.
6507 start = toFinite(start);
6508 if (end === undefined) {
6512 end = toFinite(end);
6514 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
6515 return baseRange(start, end, step, fromRight);
6520 * Creates a function that performs a relational operation on two values.
6523 * @param {Function} operator The function to perform the operation.
6524 * @returns {Function} Returns the new relational operation function.
6526 function createRelationalOperation(operator) {
6527 return function(value, other) {
6528 if (!(typeof value == 'string' && typeof other == 'string')) {
6529 value = toNumber(value);
6530 other = toNumber(other);
6532 return operator(value, other);
6537 * Creates a function that wraps `func` to continue currying.
6540 * @param {Function} func The function to wrap.
6541 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6542 * @param {Function} wrapFunc The function to create the `func` wrapper.
6543 * @param {*} placeholder The placeholder value.
6544 * @param {*} [thisArg] The `this` binding of `func`.
6545 * @param {Array} [partials] The arguments to prepend to those provided to
6547 * @param {Array} [holders] The `partials` placeholder indexes.
6548 * @param {Array} [argPos] The argument positions of the new function.
6549 * @param {number} [ary] The arity cap of `func`.
6550 * @param {number} [arity] The arity of `func`.
6551 * @returns {Function} Returns the new wrapped function.
6553 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
6554 var isCurry = bitmask & WRAP_CURRY_FLAG,
6555 newHolders = isCurry ? holders : undefined,
6556 newHoldersRight = isCurry ? undefined : holders,
6557 newPartials = isCurry ? partials : undefined,
6558 newPartialsRight = isCurry ? undefined : partials;
6560 bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
6561 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
6563 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
6564 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
6567 func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
6568 newHoldersRight, argPos, ary, arity
6571 var result = wrapFunc.apply(undefined, newData);
6572 if (isLaziable(func)) {
6573 setData(result, newData);
6575 result.placeholder = placeholder;
6576 return setWrapToString(result, func, bitmask);
6580 * Creates a function like `_.round`.
6583 * @param {string} methodName The name of the `Math` method to use when rounding.
6584 * @returns {Function} Returns the new round function.
6586 function createRound(methodName) {
6587 var func = Math[methodName];
6588 return function(number, precision) {
6589 number = toNumber(number);
6590 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
6591 if (precision && nativeIsFinite(number)) {
6592 // Shift with exponential notation to avoid floating-point issues.
6593 // See [MDN](https://mdn.io/round#Examples) for more details.
6594 var pair = (toString(number) + 'e').split('e'),
6595 value = func(pair[0] + 'e' + (+pair[1] + precision));
6597 pair = (toString(value) + 'e').split('e');
6598 return +(pair[0] + 'e' + (+pair[1] - precision));
6600 return func(number);
6605 * Creates a set object of `values`.
6608 * @param {Array} values The values to add to the set.
6609 * @returns {Object} Returns the new set.
6611 var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
6612 return new Set(values);
6616 * Creates a `_.toPairs` or `_.toPairsIn` function.
6619 * @param {Function} keysFunc The function to get the keys of a given object.
6620 * @returns {Function} Returns the new pairs function.
6622 function createToPairs(keysFunc) {
6623 return function(object) {
6624 var tag = getTag(object);
6625 if (tag == mapTag) {
6626 return mapToArray(object);
6628 if (tag == setTag) {
6629 return setToPairs(object);
6631 return baseToPairs(object, keysFunc(object));
6636 * Creates a function that either curries or invokes `func` with optional
6637 * `this` binding and partially applied arguments.
6640 * @param {Function|string} func The function or method name to wrap.
6641 * @param {number} bitmask The bitmask flags.
6644 * 4 - `_.curry` or `_.curryRight` of a bound function
6646 * 16 - `_.curryRight`
6648 * 64 - `_.partialRight`
6652 * @param {*} [thisArg] The `this` binding of `func`.
6653 * @param {Array} [partials] The arguments to be partially applied.
6654 * @param {Array} [holders] The `partials` placeholder indexes.
6655 * @param {Array} [argPos] The argument positions of the new function.
6656 * @param {number} [ary] The arity cap of `func`.
6657 * @param {number} [arity] The arity of `func`.
6658 * @returns {Function} Returns the new wrapped function.
6660 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
6661 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
6662 if (!isBindKey && typeof func != 'function') {
6663 throw new TypeError(FUNC_ERROR_TEXT);
6665 var length = partials ? partials.length : 0;
6667 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
6668 partials = holders = undefined;
6670 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
6671 arity = arity === undefined ? arity : toInteger(arity);
6672 length -= holders ? holders.length : 0;
6674 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
6675 var partialsRight = partials,
6676 holdersRight = holders;
6678 partials = holders = undefined;
6680 var data = isBindKey ? undefined : getData(func);
6683 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
6688 mergeData(newData, data);
6691 bitmask = newData[1];
6692 thisArg = newData[2];
6693 partials = newData[3];
6694 holders = newData[4];
6695 arity = newData[9] = newData[9] === undefined
6696 ? (isBindKey ? 0 : func.length)
6697 : nativeMax(newData[9] - length, 0);
6699 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
6700 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
6702 if (!bitmask || bitmask == WRAP_BIND_FLAG) {
6703 var result = createBind(func, bitmask, thisArg);
6704 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
6705 result = createCurry(func, bitmask, arity);
6706 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
6707 result = createPartial(func, bitmask, thisArg, partials);
6709 result = createHybrid.apply(undefined, newData);
6711 var setter = data ? baseSetData : setData;
6712 return setWrapToString(setter(result, newData), func, bitmask);
6716 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
6717 * of source objects to the destination object for all destination properties
6718 * that resolve to `undefined`.
6721 * @param {*} objValue The destination value.
6722 * @param {*} srcValue The source value.
6723 * @param {string} key The key of the property to assign.
6724 * @param {Object} object The parent object of `objValue`.
6725 * @returns {*} Returns the value to assign.
6727 function customDefaultsAssignIn(objValue, srcValue, key, object) {
6728 if (objValue === undefined ||
6729 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
6736 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
6737 * objects into destination objects that are passed thru.
6740 * @param {*} objValue The destination value.
6741 * @param {*} srcValue The source value.
6742 * @param {string} key The key of the property to merge.
6743 * @param {Object} object The parent object of `objValue`.
6744 * @param {Object} source The parent object of `srcValue`.
6745 * @param {Object} [stack] Tracks traversed source values and their merged
6747 * @returns {*} Returns the value to assign.
6749 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
6750 if (isObject(objValue) && isObject(srcValue)) {
6751 // Recursively merge objects and arrays (susceptible to call stack limits).
6752 stack.set(srcValue, objValue);
6753 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
6754 stack['delete'](srcValue);
6760 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
6764 * @param {*} value The value to inspect.
6765 * @param {string} key The key of the property to inspect.
6766 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
6768 function customOmitClone(value) {
6769 return isPlainObject(value) ? undefined : value;
6773 * A specialized version of `baseIsEqualDeep` for arrays with support for
6774 * partial deep comparisons.
6777 * @param {Array} array The array to compare.
6778 * @param {Array} other The other array to compare.
6779 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
6780 * @param {Function} customizer The function to customize comparisons.
6781 * @param {Function} equalFunc The function to determine equivalents of values.
6782 * @param {Object} stack Tracks traversed `array` and `other` objects.
6783 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
6785 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
6786 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
6787 arrLength = array.length,
6788 othLength = other.length;
6790 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
6793 // Check that cyclic values are equal.
6794 var arrStacked = stack.get(array);
6795 var othStacked = stack.get(other);
6796 if (arrStacked && othStacked) {
6797 return arrStacked == other && othStacked == array;
6801 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
6803 stack.set(array, other);
6804 stack.set(other, array);
6806 // Ignore non-index properties.
6807 while (++index < arrLength) {
6808 var arrValue = array[index],
6809 othValue = other[index];
6812 var compared = isPartial
6813 ? customizer(othValue, arrValue, index, other, array, stack)
6814 : customizer(arrValue, othValue, index, array, other, stack);
6816 if (compared !== undefined) {
6823 // Recursively compare arrays (susceptible to call stack limits).
6825 if (!arraySome(other, function(othValue, othIndex) {
6826 if (!cacheHas(seen, othIndex) &&
6827 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
6828 return seen.push(othIndex);
6835 arrValue === othValue ||
6836 equalFunc(arrValue, othValue, bitmask, customizer, stack)
6842 stack['delete'](array);
6843 stack['delete'](other);
6848 * A specialized version of `baseIsEqualDeep` for comparing objects of
6849 * the same `toStringTag`.
6851 * **Note:** This function only supports comparing values with tags of
6852 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
6855 * @param {Object} object The object to compare.
6856 * @param {Object} other The other object to compare.
6857 * @param {string} tag The `toStringTag` of the objects to compare.
6858 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
6859 * @param {Function} customizer The function to customize comparisons.
6860 * @param {Function} equalFunc The function to determine equivalents of values.
6861 * @param {Object} stack Tracks traversed `object` and `other` objects.
6862 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
6864 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
6867 if ((object.byteLength != other.byteLength) ||
6868 (object.byteOffset != other.byteOffset)) {
6871 object = object.buffer;
6872 other = other.buffer;
6874 case arrayBufferTag:
6875 if ((object.byteLength != other.byteLength) ||
6876 !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
6884 // Coerce booleans to `1` or `0` and dates to milliseconds.
6885 // Invalid dates are coerced to `NaN`.
6886 return eq(+object, +other);
6889 return object.name == other.name && object.message == other.message;
6893 // Coerce regexes to strings and treat strings, primitives and objects,
6894 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
6895 // for more details.
6896 return object == (other + '');
6899 var convert = mapToArray;
6902 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
6903 convert || (convert = setToArray);
6905 if (object.size != other.size && !isPartial) {
6908 // Assume cyclic values are equal.
6909 var stacked = stack.get(object);
6911 return stacked == other;
6913 bitmask |= COMPARE_UNORDERED_FLAG;
6915 // Recursively compare objects (susceptible to call stack limits).
6916 stack.set(object, other);
6917 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
6918 stack['delete'](object);
6922 if (symbolValueOf) {
6923 return symbolValueOf.call(object) == symbolValueOf.call(other);
6930 * A specialized version of `baseIsEqualDeep` for objects with support for
6931 * partial deep comparisons.
6934 * @param {Object} object The object to compare.
6935 * @param {Object} other The other object to compare.
6936 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
6937 * @param {Function} customizer The function to customize comparisons.
6938 * @param {Function} equalFunc The function to determine equivalents of values.
6939 * @param {Object} stack Tracks traversed `object` and `other` objects.
6940 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
6942 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
6943 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
6944 objProps = getAllKeys(object),
6945 objLength = objProps.length,
6946 othProps = getAllKeys(other),
6947 othLength = othProps.length;
6949 if (objLength != othLength && !isPartial) {
6952 var index = objLength;
6954 var key = objProps[index];
6955 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
6959 // Check that cyclic values are equal.
6960 var objStacked = stack.get(object);
6961 var othStacked = stack.get(other);
6962 if (objStacked && othStacked) {
6963 return objStacked == other && othStacked == object;
6966 stack.set(object, other);
6967 stack.set(other, object);
6969 var skipCtor = isPartial;
6970 while (++index < objLength) {
6971 key = objProps[index];
6972 var objValue = object[key],
6973 othValue = other[key];
6976 var compared = isPartial
6977 ? customizer(othValue, objValue, key, other, object, stack)
6978 : customizer(objValue, othValue, key, object, other, stack);
6980 // Recursively compare objects (susceptible to call stack limits).
6981 if (!(compared === undefined
6982 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
6988 skipCtor || (skipCtor = key == 'constructor');
6990 if (result && !skipCtor) {
6991 var objCtor = object.constructor,
6992 othCtor = other.constructor;
6994 // Non `Object` object instances with different constructors are not equal.
6995 if (objCtor != othCtor &&
6996 ('constructor' in object && 'constructor' in other) &&
6997 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
6998 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
7002 stack['delete'](object);
7003 stack['delete'](other);
7008 * A specialized version of `baseRest` which flattens the rest array.
7011 * @param {Function} func The function to apply a rest parameter to.
7012 * @returns {Function} Returns the new function.
7014 function flatRest(func) {
7015 return setToString(overRest(func, undefined, flatten), func + '');
7019 * Creates an array of own enumerable property names and symbols of `object`.
7022 * @param {Object} object The object to query.
7023 * @returns {Array} Returns the array of property names and symbols.
7025 function getAllKeys(object) {
7026 return baseGetAllKeys(object, keys, getSymbols);
7030 * Creates an array of own and inherited enumerable property names and
7031 * symbols of `object`.
7034 * @param {Object} object The object to query.
7035 * @returns {Array} Returns the array of property names and symbols.
7037 function getAllKeysIn(object) {
7038 return baseGetAllKeys(object, keysIn, getSymbolsIn);
7042 * Gets metadata for `func`.
7045 * @param {Function} func The function to query.
7046 * @returns {*} Returns the metadata for `func`.
7048 var getData = !metaMap ? noop : function(func) {
7049 return metaMap.get(func);
7053 * Gets the name of `func`.
7056 * @param {Function} func The function to query.
7057 * @returns {string} Returns the function name.
7059 function getFuncName(func) {
7060 var result = (func.name + ''),
7061 array = realNames[result],
7062 length = hasOwnProperty.call(realNames, result) ? array.length : 0;
7065 var data = array[length],
7066 otherFunc = data.func;
7067 if (otherFunc == null || otherFunc == func) {
7075 * Gets the argument placeholder value for `func`.
7078 * @param {Function} func The function to inspect.
7079 * @returns {*} Returns the placeholder value.
7081 function getHolder(func) {
7082 var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
7083 return object.placeholder;
7087 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
7088 * this function returns the custom method, otherwise it returns `baseIteratee`.
7089 * If arguments are provided, the chosen function is invoked with them and
7090 * its result is returned.
7093 * @param {*} [value] The value to convert to an iteratee.
7094 * @param {number} [arity] The arity of the created iteratee.
7095 * @returns {Function} Returns the chosen function or its result.
7097 function getIteratee() {
7098 var result = lodash.iteratee || iteratee;
7099 result = result === iteratee ? baseIteratee : result;
7100 return arguments.length ? result(arguments[0], arguments[1]) : result;
7104 * Gets the data for `map`.
7107 * @param {Object} map The map to query.
7108 * @param {string} key The reference key.
7109 * @returns {*} Returns the map data.
7111 function getMapData(map, key) {
7112 var data = map.__data__;
7113 return isKeyable(key)
7114 ? data[typeof key == 'string' ? 'string' : 'hash']
7119 * Gets the property names, values, and compare flags of `object`.
7122 * @param {Object} object The object to query.
7123 * @returns {Array} Returns the match data of `object`.
7125 function getMatchData(object) {
7126 var result = keys(object),
7127 length = result.length;
7130 var key = result[length],
7131 value = object[key];
7133 result[length] = [key, value, isStrictComparable(value)];
7139 * Gets the native function at `key` of `object`.
7142 * @param {Object} object The object to query.
7143 * @param {string} key The key of the method to get.
7144 * @returns {*} Returns the function if it's native, else `undefined`.
7146 function getNative(object, key) {
7147 var value = getValue(object, key);
7148 return baseIsNative(value) ? value : undefined;
7152 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
7155 * @param {*} value The value to query.
7156 * @returns {string} Returns the raw `toStringTag`.
7158 function getRawTag(value) {
7159 var isOwn = hasOwnProperty.call(value, symToStringTag),
7160 tag = value[symToStringTag];
7163 value[symToStringTag] = undefined;
7164 var unmasked = true;
7167 var result = nativeObjectToString.call(value);
7170 value[symToStringTag] = tag;
7172 delete value[symToStringTag];
7179 * Creates an array of the own enumerable symbols of `object`.
7182 * @param {Object} object The object to query.
7183 * @returns {Array} Returns the array of symbols.
7185 var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
7186 if (object == null) {
7189 object = Object(object);
7190 return arrayFilter(nativeGetSymbols(object), function(symbol) {
7191 return propertyIsEnumerable.call(object, symbol);
7196 * Creates an array of the own and inherited enumerable symbols of `object`.
7199 * @param {Object} object The object to query.
7200 * @returns {Array} Returns the array of symbols.
7202 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
7205 arrayPush(result, getSymbols(object));
7206 object = getPrototype(object);
7212 * Gets the `toStringTag` of `value`.
7215 * @param {*} value The value to query.
7216 * @returns {string} Returns the `toStringTag`.
7218 var getTag = baseGetTag;
7220 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
7221 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
7222 (Map && getTag(new Map) != mapTag) ||
7223 (Promise && getTag(Promise.resolve()) != promiseTag) ||
7224 (Set && getTag(new Set) != setTag) ||
7225 (WeakMap && getTag(new WeakMap) != weakMapTag)) {
7226 getTag = function(value) {
7227 var result = baseGetTag(value),
7228 Ctor = result == objectTag ? value.constructor : undefined,
7229 ctorString = Ctor ? toSource(Ctor) : '';
7232 switch (ctorString) {
7233 case dataViewCtorString: return dataViewTag;
7234 case mapCtorString: return mapTag;
7235 case promiseCtorString: return promiseTag;
7236 case setCtorString: return setTag;
7237 case weakMapCtorString: return weakMapTag;
7245 * Gets the view, applying any `transforms` to the `start` and `end` positions.
7248 * @param {number} start The start of the view.
7249 * @param {number} end The end of the view.
7250 * @param {Array} transforms The transformations to apply to the view.
7251 * @returns {Object} Returns an object containing the `start` and `end`
7252 * positions of the view.
7254 function getView(start, end, transforms) {
7256 length = transforms.length;
7258 while (++index < length) {
7259 var data = transforms[index],
7262 switch (data.type) {
7263 case 'drop': start += size; break;
7264 case 'dropRight': end -= size; break;
7265 case 'take': end = nativeMin(end, start + size); break;
7266 case 'takeRight': start = nativeMax(start, end - size); break;
7269 return { 'start': start, 'end': end };
7273 * Extracts wrapper details from the `source` body comment.
7276 * @param {string} source The source to inspect.
7277 * @returns {Array} Returns the wrapper details.
7279 function getWrapDetails(source) {
7280 var match = source.match(reWrapDetails);
7281 return match ? match[1].split(reSplitDetails) : [];
7285 * Checks if `path` exists on `object`.
7288 * @param {Object} object The object to query.
7289 * @param {Array|string} path The path to check.
7290 * @param {Function} hasFunc The function to check properties.
7291 * @returns {boolean} Returns `true` if `path` exists, else `false`.
7293 function hasPath(object, path, hasFunc) {
7294 path = castPath(path, object);
7297 length = path.length,
7300 while (++index < length) {
7301 var key = toKey(path[index]);
7302 if (!(result = object != null && hasFunc(object, key))) {
7305 object = object[key];
7307 if (result || ++index != length) {
7310 length = object == null ? 0 : object.length;
7311 return !!length && isLength(length) && isIndex(key, length) &&
7312 (isArray(object) || isArguments(object));
7316 * Initializes an array clone.
7319 * @param {Array} array The array to clone.
7320 * @returns {Array} Returns the initialized clone.
7322 function initCloneArray(array) {
7323 var length = array.length,
7324 result = new array.constructor(length);
7326 // Add properties assigned by `RegExp#exec`.
7327 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
7328 result.index = array.index;
7329 result.input = array.input;
7335 * Initializes an object clone.
7338 * @param {Object} object The object to clone.
7339 * @returns {Object} Returns the initialized clone.
7341 function initCloneObject(object) {
7342 return (typeof object.constructor == 'function' && !isPrototype(object))
7343 ? baseCreate(getPrototype(object))
7348 * Initializes an object clone based on its `toStringTag`.
7350 * **Note:** This function only supports cloning values with tags of
7351 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
7354 * @param {Object} object The object to clone.
7355 * @param {string} tag The `toStringTag` of the object to clone.
7356 * @param {boolean} [isDeep] Specify a deep clone.
7357 * @returns {Object} Returns the initialized clone.
7359 function initCloneByTag(object, tag, isDeep) {
7360 var Ctor = object.constructor;
7362 case arrayBufferTag:
7363 return cloneArrayBuffer(object);
7367 return new Ctor(+object);
7370 return cloneDataView(object, isDeep);
7372 case float32Tag: case float64Tag:
7373 case int8Tag: case int16Tag: case int32Tag:
7374 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
7375 return cloneTypedArray(object, isDeep);
7382 return new Ctor(object);
7385 return cloneRegExp(object);
7391 return cloneSymbol(object);
7396 * Inserts wrapper `details` in a comment at the top of the `source` body.
7399 * @param {string} source The source to modify.
7400 * @returns {Array} details The details to insert.
7401 * @returns {string} Returns the modified source.
7403 function insertWrapDetails(source, details) {
7404 var length = details.length;
7408 var lastIndex = length - 1;
7409 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
7410 details = details.join(length > 2 ? ', ' : ' ');
7411 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
7415 * Checks if `value` is a flattenable `arguments` object or array.
7418 * @param {*} value The value to check.
7419 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
7421 function isFlattenable(value) {
7422 return isArray(value) || isArguments(value) ||
7423 !!(spreadableSymbol && value && value[spreadableSymbol]);
7427 * Checks if `value` is a valid array-like index.
7430 * @param {*} value The value to check.
7431 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
7432 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
7434 function isIndex(value, length) {
7435 var type = typeof value;
7436 length = length == null ? MAX_SAFE_INTEGER : length;
7439 (type == 'number' ||
7440 (type != 'symbol' && reIsUint.test(value))) &&
7441 (value > -1 && value % 1 == 0 && value < length);
7445 * Checks if the given arguments are from an iteratee call.
7448 * @param {*} value The potential iteratee value argument.
7449 * @param {*} index The potential iteratee index or key argument.
7450 * @param {*} object The potential iteratee object argument.
7451 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
7454 function isIterateeCall(value, index, object) {
7455 if (!isObject(object)) {
7458 var type = typeof index;
7459 if (type == 'number'
7460 ? (isArrayLike(object) && isIndex(index, object.length))
7461 : (type == 'string' && index in object)
7463 return eq(object[index], value);
7469 * Checks if `value` is a property name and not a property path.
7472 * @param {*} value The value to check.
7473 * @param {Object} [object] The object to query keys on.
7474 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
7476 function isKey(value, object) {
7477 if (isArray(value)) {
7480 var type = typeof value;
7481 if (type == 'number' || type == 'symbol' || type == 'boolean' ||
7482 value == null || isSymbol(value)) {
7485 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
7486 (object != null && value in Object(object));
7490 * Checks if `value` is suitable for use as unique object key.
7493 * @param {*} value The value to check.
7494 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
7496 function isKeyable(value) {
7497 var type = typeof value;
7498 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
7499 ? (value !== '__proto__')
7504 * Checks if `func` has a lazy counterpart.
7507 * @param {Function} func The function to check.
7508 * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
7511 function isLaziable(func) {
7512 var funcName = getFuncName(func),
7513 other = lodash[funcName];
7515 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
7518 if (func === other) {
7521 var data = getData(other);
7522 return !!data && func === data[0];
7526 * Checks if `func` has its source masked.
7529 * @param {Function} func The function to check.
7530 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
7532 function isMasked(func) {
7533 return !!maskSrcKey && (maskSrcKey in func);
7537 * Checks if `func` is capable of being masked.
7540 * @param {*} value The value to check.
7541 * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
7543 var isMaskable = coreJsData ? isFunction : stubFalse;
7546 * Checks if `value` is likely a prototype object.
7549 * @param {*} value The value to check.
7550 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
7552 function isPrototype(value) {
7553 var Ctor = value && value.constructor,
7554 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
7556 return value === proto;
7560 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
7563 * @param {*} value The value to check.
7564 * @returns {boolean} Returns `true` if `value` if suitable for strict
7565 * equality comparisons, else `false`.
7567 function isStrictComparable(value) {
7568 return value === value && !isObject(value);
7572 * A specialized version of `matchesProperty` for source values suitable
7573 * for strict equality comparisons, i.e. `===`.
7576 * @param {string} key The key of the property to get.
7577 * @param {*} srcValue The value to match.
7578 * @returns {Function} Returns the new spec function.
7580 function matchesStrictComparable(key, srcValue) {
7581 return function(object) {
7582 if (object == null) {
7585 return object[key] === srcValue &&
7586 (srcValue !== undefined || (key in Object(object)));
7591 * A specialized version of `_.memoize` which clears the memoized function's
7592 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
7595 * @param {Function} func The function to have its output memoized.
7596 * @returns {Function} Returns the new memoized function.
7598 function memoizeCapped(func) {
7599 var result = memoize(func, function(key) {
7600 if (cache.size === MAX_MEMOIZE_SIZE) {
7606 var cache = result.cache;
7611 * Merges the function metadata of `source` into `data`.
7613 * Merging metadata reduces the number of wrappers used to invoke a function.
7614 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
7615 * may be applied regardless of execution order. Methods like `_.ary` and
7616 * `_.rearg` modify function arguments, making the order in which they are
7617 * executed important, preventing the merging of metadata. However, we make
7618 * an exception for a safe combined case where curried functions have `_.ary`
7619 * and or `_.rearg` applied.
7622 * @param {Array} data The destination metadata.
7623 * @param {Array} source The source metadata.
7624 * @returns {Array} Returns `data`.
7626 function mergeData(data, source) {
7627 var bitmask = data[1],
7628 srcBitmask = source[1],
7629 newBitmask = bitmask | srcBitmask,
7630 isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
7633 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
7634 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
7635 ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
7637 // Exit early if metadata can't be merged.
7638 if (!(isCommon || isCombo)) {
7641 // Use source `thisArg` if available.
7642 if (srcBitmask & WRAP_BIND_FLAG) {
7643 data[2] = source[2];
7644 // Set when currying a bound function.
7645 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
7647 // Compose partial arguments.
7648 var value = source[3];
7650 var partials = data[3];
7651 data[3] = partials ? composeArgs(partials, value, source[4]) : value;
7652 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
7654 // Compose partial right arguments.
7658 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
7659 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
7661 // Use source `argPos` if available.
7666 // Use source `ary` if it's smaller.
7667 if (srcBitmask & WRAP_ARY_FLAG) {
7668 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
7670 // Use source `arity` if one is not provided.
7671 if (data[9] == null) {
7672 data[9] = source[9];
7674 // Use source `func` and merge bitmasks.
7675 data[0] = source[0];
7676 data[1] = newBitmask;
7682 * This function is like
7683 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
7684 * except that it includes inherited enumerable properties.
7687 * @param {Object} object The object to query.
7688 * @returns {Array} Returns the array of property names.
7690 function nativeKeysIn(object) {
7692 if (object != null) {
7693 for (var key in Object(object)) {
7701 * Converts `value` to a string using `Object.prototype.toString`.
7704 * @param {*} value The value to convert.
7705 * @returns {string} Returns the converted string.
7707 function objectToString(value) {
7708 return nativeObjectToString.call(value);
7712 * A specialized version of `baseRest` which transforms the rest array.
7715 * @param {Function} func The function to apply a rest parameter to.
7716 * @param {number} [start=func.length-1] The start position of the rest parameter.
7717 * @param {Function} transform The rest array transform.
7718 * @returns {Function} Returns the new function.
7720 function overRest(func, start, transform) {
7721 start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
7723 var args = arguments,
7725 length = nativeMax(args.length - start, 0),
7726 array = Array(length);
7728 while (++index < length) {
7729 array[index] = args[start + index];
7732 var otherArgs = Array(start + 1);
7733 while (++index < start) {
7734 otherArgs[index] = args[index];
7736 otherArgs[start] = transform(array);
7737 return apply(func, this, otherArgs);
7742 * Gets the parent value at `path` of `object`.
7745 * @param {Object} object The object to query.
7746 * @param {Array} path The path to get the parent value of.
7747 * @returns {*} Returns the parent value.
7749 function parent(object, path) {
7750 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
7754 * Reorder `array` according to the specified indexes where the element at
7755 * the first index is assigned as the first element, the element at
7756 * the second index is assigned as the second element, and so on.
7759 * @param {Array} array The array to reorder.
7760 * @param {Array} indexes The arranged array indexes.
7761 * @returns {Array} Returns `array`.
7763 function reorder(array, indexes) {
7764 var arrLength = array.length,
7765 length = nativeMin(indexes.length, arrLength),
7766 oldArray = copyArray(array);
7769 var index = indexes[length];
7770 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
7776 * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
7779 * @param {Object} object The object to query.
7780 * @param {string} key The key of the property to get.
7781 * @returns {*} Returns the property value.
7783 function safeGet(object, key) {
7784 if (key === 'constructor' && typeof object[key] === 'function') {
7788 if (key == '__proto__') {
7796 * Sets metadata for `func`.
7798 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
7799 * period of time, it will trip its breaker and transition to an identity
7800 * function to avoid garbage collection pauses in V8. See
7801 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
7805 * @param {Function} func The function to associate metadata with.
7806 * @param {*} data The metadata.
7807 * @returns {Function} Returns `func`.
7809 var setData = shortOut(baseSetData);
7812 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
7815 * @param {Function} func The function to delay.
7816 * @param {number} wait The number of milliseconds to delay invocation.
7817 * @returns {number|Object} Returns the timer id or timeout object.
7819 var setTimeout = ctxSetTimeout || function(func, wait) {
7820 return root.setTimeout(func, wait);
7824 * Sets the `toString` method of `func` to return `string`.
7827 * @param {Function} func The function to modify.
7828 * @param {Function} string The `toString` result.
7829 * @returns {Function} Returns `func`.
7831 var setToString = shortOut(baseSetToString);
7834 * Sets the `toString` method of `wrapper` to mimic the source of `reference`
7835 * with wrapper details in a comment at the top of the source body.
7838 * @param {Function} wrapper The function to modify.
7839 * @param {Function} reference The reference function.
7840 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
7841 * @returns {Function} Returns `wrapper`.
7843 function setWrapToString(wrapper, reference, bitmask) {
7844 var source = (reference + '');
7845 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
7849 * Creates a function that'll short out and invoke `identity` instead
7850 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
7854 * @param {Function} func The function to restrict.
7855 * @returns {Function} Returns the new shortable function.
7857 function shortOut(func) {
7862 var stamp = nativeNow(),
7863 remaining = HOT_SPAN - (stamp - lastCalled);
7866 if (remaining > 0) {
7867 if (++count >= HOT_COUNT) {
7868 return arguments[0];
7873 return func.apply(undefined, arguments);
7878 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
7881 * @param {Array} array The array to shuffle.
7882 * @param {number} [size=array.length] The size of `array`.
7883 * @returns {Array} Returns `array`.
7885 function shuffleSelf(array, size) {
7887 length = array.length,
7888 lastIndex = length - 1;
7890 size = size === undefined ? length : size;
7891 while (++index < size) {
7892 var rand = baseRandom(index, lastIndex),
7893 value = array[rand];
7895 array[rand] = array[index];
7896 array[index] = value;
7898 array.length = size;
7903 * Converts `string` to a property path array.
7906 * @param {string} string The string to convert.
7907 * @returns {Array} Returns the property path array.
7909 var stringToPath = memoizeCapped(function(string) {
7911 if (string.charCodeAt(0) === 46 /* . */) {
7914 string.replace(rePropName, function(match, number, quote, subString) {
7915 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
7921 * Converts `value` to a string key if it's not a string or symbol.
7924 * @param {*} value The value to inspect.
7925 * @returns {string|symbol} Returns the key.
7927 function toKey(value) {
7928 if (typeof value == 'string' || isSymbol(value)) {
7931 var result = (value + '');
7932 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
7936 * Converts `func` to its source code.
7939 * @param {Function} func The function to convert.
7940 * @returns {string} Returns the source code.
7942 function toSource(func) {
7945 return funcToString.call(func);
7955 * Updates wrapper `details` based on `bitmask` flags.
7958 * @returns {Array} details The details to modify.
7959 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
7960 * @returns {Array} Returns `details`.
7962 function updateWrapDetails(details, bitmask) {
7963 arrayEach(wrapFlags, function(pair) {
7964 var value = '_.' + pair[0];
7965 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
7966 details.push(value);
7969 return details.sort();
7973 * Creates a clone of `wrapper`.
7976 * @param {Object} wrapper The wrapper to clone.
7977 * @returns {Object} Returns the cloned wrapper.
7979 function wrapperClone(wrapper) {
7980 if (wrapper instanceof LazyWrapper) {
7981 return wrapper.clone();
7983 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
7984 result.__actions__ = copyArray(wrapper.__actions__);
7985 result.__index__ = wrapper.__index__;
7986 result.__values__ = wrapper.__values__;
7990 /*------------------------------------------------------------------------*/
7993 * Creates an array of elements split into groups the length of `size`.
7994 * If `array` can't be split evenly, the final chunk will be the remaining
8001 * @param {Array} array The array to process.
8002 * @param {number} [size=1] The length of each chunk
8003 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8004 * @returns {Array} Returns the new array of chunks.
8007 * _.chunk(['a', 'b', 'c', 'd'], 2);
8008 * // => [['a', 'b'], ['c', 'd']]
8010 * _.chunk(['a', 'b', 'c', 'd'], 3);
8011 * // => [['a', 'b', 'c'], ['d']]
8013 function chunk(array, size, guard) {
8014 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
8017 size = nativeMax(toInteger(size), 0);
8019 var length = array == null ? 0 : array.length;
8020 if (!length || size < 1) {
8025 result = Array(nativeCeil(length / size));
8027 while (index < length) {
8028 result[resIndex++] = baseSlice(array, index, (index += size));
8034 * Creates an array with all falsey values removed. The values `false`, `null`,
8035 * `0`, `""`, `undefined`, and `NaN` are falsey.
8041 * @param {Array} array The array to compact.
8042 * @returns {Array} Returns the new array of filtered values.
8045 * _.compact([0, 1, false, 2, '', 3]);
8048 function compact(array) {
8050 length = array == null ? 0 : array.length,
8054 while (++index < length) {
8055 var value = array[index];
8057 result[resIndex++] = value;
8064 * Creates a new array concatenating `array` with any additional arrays
8071 * @param {Array} array The array to concatenate.
8072 * @param {...*} [values] The values to concatenate.
8073 * @returns {Array} Returns the new concatenated array.
8077 * var other = _.concat(array, 2, [3], [[4]]);
8079 * console.log(other);
8080 * // => [1, 2, 3, [4]]
8082 * console.log(array);
8086 var length = arguments.length;
8090 var args = Array(length - 1),
8091 array = arguments[0],
8095 args[index - 1] = arguments[index];
8097 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
8101 * Creates an array of `array` values not included in the other given arrays
8102 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8103 * for equality comparisons. The order and references of result values are
8104 * determined by the first array.
8106 * **Note:** Unlike `_.pullAll`, this method returns a new array.
8112 * @param {Array} array The array to inspect.
8113 * @param {...Array} [values] The values to exclude.
8114 * @returns {Array} Returns the new array of filtered values.
8115 * @see _.without, _.xor
8118 * _.difference([2, 1], [2, 3]);
8121 var difference = baseRest(function(array, values) {
8122 return isArrayLikeObject(array)
8123 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
8128 * This method is like `_.difference` except that it accepts `iteratee` which
8129 * is invoked for each element of `array` and `values` to generate the criterion
8130 * by which they're compared. The order and references of result values are
8131 * determined by the first array. The iteratee is invoked with one argument:
8134 * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
8140 * @param {Array} array The array to inspect.
8141 * @param {...Array} [values] The values to exclude.
8142 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8143 * @returns {Array} Returns the new array of filtered values.
8146 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
8149 * // The `_.property` iteratee shorthand.
8150 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
8151 * // => [{ 'x': 2 }]
8153 var differenceBy = baseRest(function(array, values) {
8154 var iteratee = last(values);
8155 if (isArrayLikeObject(iteratee)) {
8156 iteratee = undefined;
8158 return isArrayLikeObject(array)
8159 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
8164 * This method is like `_.difference` except that it accepts `comparator`
8165 * which is invoked to compare elements of `array` to `values`. The order and
8166 * references of result values are determined by the first array. The comparator
8167 * is invoked with two arguments: (arrVal, othVal).
8169 * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
8175 * @param {Array} array The array to inspect.
8176 * @param {...Array} [values] The values to exclude.
8177 * @param {Function} [comparator] The comparator invoked per element.
8178 * @returns {Array} Returns the new array of filtered values.
8181 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
8183 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
8184 * // => [{ 'x': 2, 'y': 1 }]
8186 var differenceWith = baseRest(function(array, values) {
8187 var comparator = last(values);
8188 if (isArrayLikeObject(comparator)) {
8189 comparator = undefined;
8191 return isArrayLikeObject(array)
8192 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
8197 * Creates a slice of `array` with `n` elements dropped from the beginning.
8203 * @param {Array} array The array to query.
8204 * @param {number} [n=1] The number of elements to drop.
8205 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8206 * @returns {Array} Returns the slice of `array`.
8209 * _.drop([1, 2, 3]);
8212 * _.drop([1, 2, 3], 2);
8215 * _.drop([1, 2, 3], 5);
8218 * _.drop([1, 2, 3], 0);
8221 function drop(array, n, guard) {
8222 var length = array == null ? 0 : array.length;
8226 n = (guard || n === undefined) ? 1 : toInteger(n);
8227 return baseSlice(array, n < 0 ? 0 : n, length);
8231 * Creates a slice of `array` with `n` elements dropped from the end.
8237 * @param {Array} array The array to query.
8238 * @param {number} [n=1] The number of elements to drop.
8239 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8240 * @returns {Array} Returns the slice of `array`.
8243 * _.dropRight([1, 2, 3]);
8246 * _.dropRight([1, 2, 3], 2);
8249 * _.dropRight([1, 2, 3], 5);
8252 * _.dropRight([1, 2, 3], 0);
8255 function dropRight(array, n, guard) {
8256 var length = array == null ? 0 : array.length;
8260 n = (guard || n === undefined) ? 1 : toInteger(n);
8262 return baseSlice(array, 0, n < 0 ? 0 : n);
8266 * Creates a slice of `array` excluding elements dropped from the end.
8267 * Elements are dropped until `predicate` returns falsey. The predicate is
8268 * invoked with three arguments: (value, index, array).
8274 * @param {Array} array The array to query.
8275 * @param {Function} [predicate=_.identity] The function invoked per iteration.
8276 * @returns {Array} Returns the slice of `array`.
8280 * { 'user': 'barney', 'active': true },
8281 * { 'user': 'fred', 'active': false },
8282 * { 'user': 'pebbles', 'active': false }
8285 * _.dropRightWhile(users, function(o) { return !o.active; });
8286 * // => objects for ['barney']
8288 * // The `_.matches` iteratee shorthand.
8289 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
8290 * // => objects for ['barney', 'fred']
8292 * // The `_.matchesProperty` iteratee shorthand.
8293 * _.dropRightWhile(users, ['active', false]);
8294 * // => objects for ['barney']
8296 * // The `_.property` iteratee shorthand.
8297 * _.dropRightWhile(users, 'active');
8298 * // => objects for ['barney', 'fred', 'pebbles']
8300 function dropRightWhile(array, predicate) {
8301 return (array && array.length)
8302 ? baseWhile(array, getIteratee(predicate, 3), true, true)
8307 * Creates a slice of `array` excluding elements dropped from the beginning.
8308 * Elements are dropped until `predicate` returns falsey. The predicate is
8309 * invoked with three arguments: (value, index, array).
8315 * @param {Array} array The array to query.
8316 * @param {Function} [predicate=_.identity] The function invoked per iteration.
8317 * @returns {Array} Returns the slice of `array`.
8321 * { 'user': 'barney', 'active': false },
8322 * { 'user': 'fred', 'active': false },
8323 * { 'user': 'pebbles', 'active': true }
8326 * _.dropWhile(users, function(o) { return !o.active; });
8327 * // => objects for ['pebbles']
8329 * // The `_.matches` iteratee shorthand.
8330 * _.dropWhile(users, { 'user': 'barney', 'active': false });
8331 * // => objects for ['fred', 'pebbles']
8333 * // The `_.matchesProperty` iteratee shorthand.
8334 * _.dropWhile(users, ['active', false]);
8335 * // => objects for ['pebbles']
8337 * // The `_.property` iteratee shorthand.
8338 * _.dropWhile(users, 'active');
8339 * // => objects for ['barney', 'fred', 'pebbles']
8341 function dropWhile(array, predicate) {
8342 return (array && array.length)
8343 ? baseWhile(array, getIteratee(predicate, 3), true)
8348 * Fills elements of `array` with `value` from `start` up to, but not
8351 * **Note:** This method mutates `array`.
8357 * @param {Array} array The array to fill.
8358 * @param {*} value The value to fill `array` with.
8359 * @param {number} [start=0] The start position.
8360 * @param {number} [end=array.length] The end position.
8361 * @returns {Array} Returns `array`.
8364 * var array = [1, 2, 3];
8366 * _.fill(array, 'a');
8367 * console.log(array);
8368 * // => ['a', 'a', 'a']
8370 * _.fill(Array(3), 2);
8373 * _.fill([4, 6, 8, 10], '*', 1, 3);
8374 * // => [4, '*', '*', 10]
8376 function fill(array, value, start, end) {
8377 var length = array == null ? 0 : array.length;
8381 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
8385 return baseFill(array, value, start, end);
8389 * This method is like `_.find` except that it returns the index of the first
8390 * element `predicate` returns truthy for instead of the element itself.
8396 * @param {Array} array The array to inspect.
8397 * @param {Function} [predicate=_.identity] The function invoked per iteration.
8398 * @param {number} [fromIndex=0] The index to search from.
8399 * @returns {number} Returns the index of the found element, else `-1`.
8403 * { 'user': 'barney', 'active': false },
8404 * { 'user': 'fred', 'active': false },
8405 * { 'user': 'pebbles', 'active': true }
8408 * _.findIndex(users, function(o) { return o.user == 'barney'; });
8411 * // The `_.matches` iteratee shorthand.
8412 * _.findIndex(users, { 'user': 'fred', 'active': false });
8415 * // The `_.matchesProperty` iteratee shorthand.
8416 * _.findIndex(users, ['active', false]);
8419 * // The `_.property` iteratee shorthand.
8420 * _.findIndex(users, 'active');
8423 function findIndex(array, predicate, fromIndex) {
8424 var length = array == null ? 0 : array.length;
8428 var index = fromIndex == null ? 0 : toInteger(fromIndex);
8430 index = nativeMax(length + index, 0);
8432 return baseFindIndex(array, getIteratee(predicate, 3), index);
8436 * This method is like `_.findIndex` except that it iterates over elements
8437 * of `collection` from right to left.
8443 * @param {Array} array The array to inspect.
8444 * @param {Function} [predicate=_.identity] The function invoked per iteration.
8445 * @param {number} [fromIndex=array.length-1] The index to search from.
8446 * @returns {number} Returns the index of the found element, else `-1`.
8450 * { 'user': 'barney', 'active': true },
8451 * { 'user': 'fred', 'active': false },
8452 * { 'user': 'pebbles', 'active': false }
8455 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
8458 * // The `_.matches` iteratee shorthand.
8459 * _.findLastIndex(users, { 'user': 'barney', 'active': true });
8462 * // The `_.matchesProperty` iteratee shorthand.
8463 * _.findLastIndex(users, ['active', false]);
8466 * // The `_.property` iteratee shorthand.
8467 * _.findLastIndex(users, 'active');
8470 function findLastIndex(array, predicate, fromIndex) {
8471 var length = array == null ? 0 : array.length;
8475 var index = length - 1;
8476 if (fromIndex !== undefined) {
8477 index = toInteger(fromIndex);
8478 index = fromIndex < 0
8479 ? nativeMax(length + index, 0)
8480 : nativeMin(index, length - 1);
8482 return baseFindIndex(array, getIteratee(predicate, 3), index, true);
8486 * Flattens `array` a single level deep.
8492 * @param {Array} array The array to flatten.
8493 * @returns {Array} Returns the new flattened array.
8496 * _.flatten([1, [2, [3, [4]], 5]]);
8497 * // => [1, 2, [3, [4]], 5]
8499 function flatten(array) {
8500 var length = array == null ? 0 : array.length;
8501 return length ? baseFlatten(array, 1) : [];
8505 * Recursively flattens `array`.
8511 * @param {Array} array The array to flatten.
8512 * @returns {Array} Returns the new flattened array.
8515 * _.flattenDeep([1, [2, [3, [4]], 5]]);
8516 * // => [1, 2, 3, 4, 5]
8518 function flattenDeep(array) {
8519 var length = array == null ? 0 : array.length;
8520 return length ? baseFlatten(array, INFINITY) : [];
8524 * Recursively flatten `array` up to `depth` times.
8530 * @param {Array} array The array to flatten.
8531 * @param {number} [depth=1] The maximum recursion depth.
8532 * @returns {Array} Returns the new flattened array.
8535 * var array = [1, [2, [3, [4]], 5]];
8537 * _.flattenDepth(array, 1);
8538 * // => [1, 2, [3, [4]], 5]
8540 * _.flattenDepth(array, 2);
8541 * // => [1, 2, 3, [4], 5]
8543 function flattenDepth(array, depth) {
8544 var length = array == null ? 0 : array.length;
8548 depth = depth === undefined ? 1 : toInteger(depth);
8549 return baseFlatten(array, depth);
8553 * The inverse of `_.toPairs`; this method returns an object composed
8554 * from key-value `pairs`.
8560 * @param {Array} pairs The key-value pairs.
8561 * @returns {Object} Returns the new object.
8564 * _.fromPairs([['a', 1], ['b', 2]]);
8565 * // => { 'a': 1, 'b': 2 }
8567 function fromPairs(pairs) {
8569 length = pairs == null ? 0 : pairs.length,
8572 while (++index < length) {
8573 var pair = pairs[index];
8574 result[pair[0]] = pair[1];
8580 * Gets the first element of `array`.
8587 * @param {Array} array The array to query.
8588 * @returns {*} Returns the first element of `array`.
8591 * _.head([1, 2, 3]);
8597 function head(array) {
8598 return (array && array.length) ? array[0] : undefined;
8602 * Gets the index at which the first occurrence of `value` is found in `array`
8603 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8604 * for equality comparisons. If `fromIndex` is negative, it's used as the
8605 * offset from the end of `array`.
8611 * @param {Array} array The array to inspect.
8612 * @param {*} value The value to search for.
8613 * @param {number} [fromIndex=0] The index to search from.
8614 * @returns {number} Returns the index of the matched value, else `-1`.
8617 * _.indexOf([1, 2, 1, 2], 2);
8620 * // Search from the `fromIndex`.
8621 * _.indexOf([1, 2, 1, 2], 2, 2);
8624 function indexOf(array, value, fromIndex) {
8625 var length = array == null ? 0 : array.length;
8629 var index = fromIndex == null ? 0 : toInteger(fromIndex);
8631 index = nativeMax(length + index, 0);
8633 return baseIndexOf(array, value, index);
8637 * Gets all but the last element of `array`.
8643 * @param {Array} array The array to query.
8644 * @returns {Array} Returns the slice of `array`.
8647 * _.initial([1, 2, 3]);
8650 function initial(array) {
8651 var length = array == null ? 0 : array.length;
8652 return length ? baseSlice(array, 0, -1) : [];
8656 * Creates an array of unique values that are included in all given arrays
8657 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8658 * for equality comparisons. The order and references of result values are
8659 * determined by the first array.
8665 * @param {...Array} [arrays] The arrays to inspect.
8666 * @returns {Array} Returns the new array of intersecting values.
8669 * _.intersection([2, 1], [2, 3]);
8672 var intersection = baseRest(function(arrays) {
8673 var mapped = arrayMap(arrays, castArrayLikeObject);
8674 return (mapped.length && mapped[0] === arrays[0])
8675 ? baseIntersection(mapped)
8680 * This method is like `_.intersection` except that it accepts `iteratee`
8681 * which is invoked for each element of each `arrays` to generate the criterion
8682 * by which they're compared. The order and references of result values are
8683 * determined by the first array. The iteratee is invoked with one argument:
8690 * @param {...Array} [arrays] The arrays to inspect.
8691 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8692 * @returns {Array} Returns the new array of intersecting values.
8695 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
8698 * // The `_.property` iteratee shorthand.
8699 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
8700 * // => [{ 'x': 1 }]
8702 var intersectionBy = baseRest(function(arrays) {
8703 var iteratee = last(arrays),
8704 mapped = arrayMap(arrays, castArrayLikeObject);
8706 if (iteratee === last(mapped)) {
8707 iteratee = undefined;
8711 return (mapped.length && mapped[0] === arrays[0])
8712 ? baseIntersection(mapped, getIteratee(iteratee, 2))
8717 * This method is like `_.intersection` except that it accepts `comparator`
8718 * which is invoked to compare elements of `arrays`. The order and references
8719 * of result values are determined by the first array. The comparator is
8720 * invoked with two arguments: (arrVal, othVal).
8726 * @param {...Array} [arrays] The arrays to inspect.
8727 * @param {Function} [comparator] The comparator invoked per element.
8728 * @returns {Array} Returns the new array of intersecting values.
8731 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
8732 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
8734 * _.intersectionWith(objects, others, _.isEqual);
8735 * // => [{ 'x': 1, 'y': 2 }]
8737 var intersectionWith = baseRest(function(arrays) {
8738 var comparator = last(arrays),
8739 mapped = arrayMap(arrays, castArrayLikeObject);
8741 comparator = typeof comparator == 'function' ? comparator : undefined;
8745 return (mapped.length && mapped[0] === arrays[0])
8746 ? baseIntersection(mapped, undefined, comparator)
8751 * Converts all elements in `array` into a string separated by `separator`.
8757 * @param {Array} array The array to convert.
8758 * @param {string} [separator=','] The element separator.
8759 * @returns {string} Returns the joined string.
8762 * _.join(['a', 'b', 'c'], '~');
8765 function join(array, separator) {
8766 return array == null ? '' : nativeJoin.call(array, separator);
8770 * Gets the last element of `array`.
8776 * @param {Array} array The array to query.
8777 * @returns {*} Returns the last element of `array`.
8780 * _.last([1, 2, 3]);
8783 function last(array) {
8784 var length = array == null ? 0 : array.length;
8785 return length ? array[length - 1] : undefined;
8789 * This method is like `_.indexOf` except that it iterates over elements of
8790 * `array` from right to left.
8796 * @param {Array} array The array to inspect.
8797 * @param {*} value The value to search for.
8798 * @param {number} [fromIndex=array.length-1] The index to search from.
8799 * @returns {number} Returns the index of the matched value, else `-1`.
8802 * _.lastIndexOf([1, 2, 1, 2], 2);
8805 * // Search from the `fromIndex`.
8806 * _.lastIndexOf([1, 2, 1, 2], 2, 2);
8809 function lastIndexOf(array, value, fromIndex) {
8810 var length = array == null ? 0 : array.length;
8815 if (fromIndex !== undefined) {
8816 index = toInteger(fromIndex);
8817 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
8819 return value === value
8820 ? strictLastIndexOf(array, value, index)
8821 : baseFindIndex(array, baseIsNaN, index, true);
8825 * Gets the element at index `n` of `array`. If `n` is negative, the nth
8826 * element from the end is returned.
8832 * @param {Array} array The array to query.
8833 * @param {number} [n=0] The index of the element to return.
8834 * @returns {*} Returns the nth element of `array`.
8837 * var array = ['a', 'b', 'c', 'd'];
8845 function nth(array, n) {
8846 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
8850 * Removes all given values from `array` using
8851 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8852 * for equality comparisons.
8854 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
8855 * to remove elements from an array by predicate.
8861 * @param {Array} array The array to modify.
8862 * @param {...*} [values] The values to remove.
8863 * @returns {Array} Returns `array`.
8866 * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
8868 * _.pull(array, 'a', 'c');
8869 * console.log(array);
8872 var pull = baseRest(pullAll);
8875 * This method is like `_.pull` except that it accepts an array of values to remove.
8877 * **Note:** Unlike `_.difference`, this method mutates `array`.
8883 * @param {Array} array The array to modify.
8884 * @param {Array} values The values to remove.
8885 * @returns {Array} Returns `array`.
8888 * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
8890 * _.pullAll(array, ['a', 'c']);
8891 * console.log(array);
8894 function pullAll(array, values) {
8895 return (array && array.length && values && values.length)
8896 ? basePullAll(array, values)
8901 * This method is like `_.pullAll` except that it accepts `iteratee` which is
8902 * invoked for each element of `array` and `values` to generate the criterion
8903 * by which they're compared. The iteratee is invoked with one argument: (value).
8905 * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
8911 * @param {Array} array The array to modify.
8912 * @param {Array} values The values to remove.
8913 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8914 * @returns {Array} Returns `array`.
8917 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
8919 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
8920 * console.log(array);
8921 * // => [{ 'x': 2 }]
8923 function pullAllBy(array, values, iteratee) {
8924 return (array && array.length && values && values.length)
8925 ? basePullAll(array, values, getIteratee(iteratee, 2))
8930 * This method is like `_.pullAll` except that it accepts `comparator` which
8931 * is invoked to compare elements of `array` to `values`. The comparator is
8932 * invoked with two arguments: (arrVal, othVal).
8934 * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
8940 * @param {Array} array The array to modify.
8941 * @param {Array} values The values to remove.
8942 * @param {Function} [comparator] The comparator invoked per element.
8943 * @returns {Array} Returns `array`.
8946 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
8948 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
8949 * console.log(array);
8950 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
8952 function pullAllWith(array, values, comparator) {
8953 return (array && array.length && values && values.length)
8954 ? basePullAll(array, values, undefined, comparator)
8959 * Removes elements from `array` corresponding to `indexes` and returns an
8960 * array of removed elements.
8962 * **Note:** Unlike `_.at`, this method mutates `array`.
8968 * @param {Array} array The array to modify.
8969 * @param {...(number|number[])} [indexes] The indexes of elements to remove.
8970 * @returns {Array} Returns the new array of removed elements.
8973 * var array = ['a', 'b', 'c', 'd'];
8974 * var pulled = _.pullAt(array, [1, 3]);
8976 * console.log(array);
8979 * console.log(pulled);
8982 var pullAt = flatRest(function(array, indexes) {
8983 var length = array == null ? 0 : array.length,
8984 result = baseAt(array, indexes);
8986 basePullAt(array, arrayMap(indexes, function(index) {
8987 return isIndex(index, length) ? +index : index;
8988 }).sort(compareAscending));
8994 * Removes all elements from `array` that `predicate` returns truthy for
8995 * and returns an array of the removed elements. The predicate is invoked
8996 * with three arguments: (value, index, array).
8998 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
8999 * to pull elements from an array by value.
9005 * @param {Array} array The array to modify.
9006 * @param {Function} [predicate=_.identity] The function invoked per iteration.
9007 * @returns {Array} Returns the new array of removed elements.
9010 * var array = [1, 2, 3, 4];
9011 * var evens = _.remove(array, function(n) {
9012 * return n % 2 == 0;
9015 * console.log(array);
9018 * console.log(evens);
9021 function remove(array, predicate) {
9023 if (!(array && array.length)) {
9028 length = array.length;
9030 predicate = getIteratee(predicate, 3);
9031 while (++index < length) {
9032 var value = array[index];
9033 if (predicate(value, index, array)) {
9035 indexes.push(index);
9038 basePullAt(array, indexes);
9043 * Reverses `array` so that the first element becomes the last, the second
9044 * element becomes the second to last, and so on.
9046 * **Note:** This method mutates `array` and is based on
9047 * [`Array#reverse`](https://mdn.io/Array/reverse).
9053 * @param {Array} array The array to modify.
9054 * @returns {Array} Returns `array`.
9057 * var array = [1, 2, 3];
9062 * console.log(array);
9065 function reverse(array) {
9066 return array == null ? array : nativeReverse.call(array);
9070 * Creates a slice of `array` from `start` up to, but not including, `end`.
9072 * **Note:** This method is used instead of
9073 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
9080 * @param {Array} array The array to slice.
9081 * @param {number} [start=0] The start position.
9082 * @param {number} [end=array.length] The end position.
9083 * @returns {Array} Returns the slice of `array`.
9085 function slice(array, start, end) {
9086 var length = array == null ? 0 : array.length;
9090 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
9095 start = start == null ? 0 : toInteger(start);
9096 end = end === undefined ? length : toInteger(end);
9098 return baseSlice(array, start, end);
9102 * Uses a binary search to determine the lowest index at which `value`
9103 * should be inserted into `array` in order to maintain its sort order.
9109 * @param {Array} array The sorted array to inspect.
9110 * @param {*} value The value to evaluate.
9111 * @returns {number} Returns the index at which `value` should be inserted
9115 * _.sortedIndex([30, 50], 40);
9118 function sortedIndex(array, value) {
9119 return baseSortedIndex(array, value);
9123 * This method is like `_.sortedIndex` except that it accepts `iteratee`
9124 * which is invoked for `value` and each element of `array` to compute their
9125 * sort ranking. The iteratee is invoked with one argument: (value).
9131 * @param {Array} array The sorted array to inspect.
9132 * @param {*} value The value to evaluate.
9133 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
9134 * @returns {number} Returns the index at which `value` should be inserted
9138 * var objects = [{ 'x': 4 }, { 'x': 5 }];
9140 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
9143 * // The `_.property` iteratee shorthand.
9144 * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
9147 function sortedIndexBy(array, value, iteratee) {
9148 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
9152 * This method is like `_.indexOf` except that it performs a binary
9153 * search on a sorted `array`.
9159 * @param {Array} array The array to inspect.
9160 * @param {*} value The value to search for.
9161 * @returns {number} Returns the index of the matched value, else `-1`.
9164 * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
9167 function sortedIndexOf(array, value) {
9168 var length = array == null ? 0 : array.length;
9170 var index = baseSortedIndex(array, value);
9171 if (index < length && eq(array[index], value)) {
9179 * This method is like `_.sortedIndex` except that it returns the highest
9180 * index at which `value` should be inserted into `array` in order to
9181 * maintain its sort order.
9187 * @param {Array} array The sorted array to inspect.
9188 * @param {*} value The value to evaluate.
9189 * @returns {number} Returns the index at which `value` should be inserted
9193 * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
9196 function sortedLastIndex(array, value) {
9197 return baseSortedIndex(array, value, true);
9201 * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
9202 * which is invoked for `value` and each element of `array` to compute their
9203 * sort ranking. The iteratee is invoked with one argument: (value).
9209 * @param {Array} array The sorted array to inspect.
9210 * @param {*} value The value to evaluate.
9211 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
9212 * @returns {number} Returns the index at which `value` should be inserted
9216 * var objects = [{ 'x': 4 }, { 'x': 5 }];
9218 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
9221 * // The `_.property` iteratee shorthand.
9222 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
9225 function sortedLastIndexBy(array, value, iteratee) {
9226 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
9230 * This method is like `_.lastIndexOf` except that it performs a binary
9231 * search on a sorted `array`.
9237 * @param {Array} array The array to inspect.
9238 * @param {*} value The value to search for.
9239 * @returns {number} Returns the index of the matched value, else `-1`.
9242 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
9245 function sortedLastIndexOf(array, value) {
9246 var length = array == null ? 0 : array.length;
9248 var index = baseSortedIndex(array, value, true) - 1;
9249 if (eq(array[index], value)) {
9257 * This method is like `_.uniq` except that it's designed and optimized
9258 * for sorted arrays.
9264 * @param {Array} array The array to inspect.
9265 * @returns {Array} Returns the new duplicate free array.
9268 * _.sortedUniq([1, 1, 2]);
9271 function sortedUniq(array) {
9272 return (array && array.length)
9273 ? baseSortedUniq(array)
9278 * This method is like `_.uniqBy` except that it's designed and optimized
9279 * for sorted arrays.
9285 * @param {Array} array The array to inspect.
9286 * @param {Function} [iteratee] The iteratee invoked per element.
9287 * @returns {Array} Returns the new duplicate free array.
9290 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
9293 function sortedUniqBy(array, iteratee) {
9294 return (array && array.length)
9295 ? baseSortedUniq(array, getIteratee(iteratee, 2))
9300 * Gets all but the first element of `array`.
9306 * @param {Array} array The array to query.
9307 * @returns {Array} Returns the slice of `array`.
9310 * _.tail([1, 2, 3]);
9313 function tail(array) {
9314 var length = array == null ? 0 : array.length;
9315 return length ? baseSlice(array, 1, length) : [];
9319 * Creates a slice of `array` with `n` elements taken from the beginning.
9325 * @param {Array} array The array to query.
9326 * @param {number} [n=1] The number of elements to take.
9327 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
9328 * @returns {Array} Returns the slice of `array`.
9331 * _.take([1, 2, 3]);
9334 * _.take([1, 2, 3], 2);
9337 * _.take([1, 2, 3], 5);
9340 * _.take([1, 2, 3], 0);
9343 function take(array, n, guard) {
9344 if (!(array && array.length)) {
9347 n = (guard || n === undefined) ? 1 : toInteger(n);
9348 return baseSlice(array, 0, n < 0 ? 0 : n);
9352 * Creates a slice of `array` with `n` elements taken from the end.
9358 * @param {Array} array The array to query.
9359 * @param {number} [n=1] The number of elements to take.
9360 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
9361 * @returns {Array} Returns the slice of `array`.
9364 * _.takeRight([1, 2, 3]);
9367 * _.takeRight([1, 2, 3], 2);
9370 * _.takeRight([1, 2, 3], 5);
9373 * _.takeRight([1, 2, 3], 0);
9376 function takeRight(array, n, guard) {
9377 var length = array == null ? 0 : array.length;
9381 n = (guard || n === undefined) ? 1 : toInteger(n);
9383 return baseSlice(array, n < 0 ? 0 : n, length);
9387 * Creates a slice of `array` with elements taken from the end. Elements are
9388 * taken until `predicate` returns falsey. The predicate is invoked with
9389 * three arguments: (value, index, array).
9395 * @param {Array} array The array to query.
9396 * @param {Function} [predicate=_.identity] The function invoked per iteration.
9397 * @returns {Array} Returns the slice of `array`.
9401 * { 'user': 'barney', 'active': true },
9402 * { 'user': 'fred', 'active': false },
9403 * { 'user': 'pebbles', 'active': false }
9406 * _.takeRightWhile(users, function(o) { return !o.active; });
9407 * // => objects for ['fred', 'pebbles']
9409 * // The `_.matches` iteratee shorthand.
9410 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
9411 * // => objects for ['pebbles']
9413 * // The `_.matchesProperty` iteratee shorthand.
9414 * _.takeRightWhile(users, ['active', false]);
9415 * // => objects for ['fred', 'pebbles']
9417 * // The `_.property` iteratee shorthand.
9418 * _.takeRightWhile(users, 'active');
9421 function takeRightWhile(array, predicate) {
9422 return (array && array.length)
9423 ? baseWhile(array, getIteratee(predicate, 3), false, true)
9428 * Creates a slice of `array` with elements taken from the beginning. Elements
9429 * are taken until `predicate` returns falsey. The predicate is invoked with
9430 * three arguments: (value, index, array).
9436 * @param {Array} array The array to query.
9437 * @param {Function} [predicate=_.identity] The function invoked per iteration.
9438 * @returns {Array} Returns the slice of `array`.
9442 * { 'user': 'barney', 'active': false },
9443 * { 'user': 'fred', 'active': false },
9444 * { 'user': 'pebbles', 'active': true }
9447 * _.takeWhile(users, function(o) { return !o.active; });
9448 * // => objects for ['barney', 'fred']
9450 * // The `_.matches` iteratee shorthand.
9451 * _.takeWhile(users, { 'user': 'barney', 'active': false });
9452 * // => objects for ['barney']
9454 * // The `_.matchesProperty` iteratee shorthand.
9455 * _.takeWhile(users, ['active', false]);
9456 * // => objects for ['barney', 'fred']
9458 * // The `_.property` iteratee shorthand.
9459 * _.takeWhile(users, 'active');
9462 function takeWhile(array, predicate) {
9463 return (array && array.length)
9464 ? baseWhile(array, getIteratee(predicate, 3))
9469 * Creates an array of unique values, in order, from all given arrays using
9470 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
9471 * for equality comparisons.
9477 * @param {...Array} [arrays] The arrays to inspect.
9478 * @returns {Array} Returns the new array of combined values.
9481 * _.union([2], [1, 2]);
9484 var union = baseRest(function(arrays) {
9485 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
9489 * This method is like `_.union` except that it accepts `iteratee` which is
9490 * invoked for each element of each `arrays` to generate the criterion by
9491 * which uniqueness is computed. Result values are chosen from the first
9492 * array in which the value occurs. The iteratee is invoked with one argument:
9499 * @param {...Array} [arrays] The arrays to inspect.
9500 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
9501 * @returns {Array} Returns the new array of combined values.
9504 * _.unionBy([2.1], [1.2, 2.3], Math.floor);
9507 * // The `_.property` iteratee shorthand.
9508 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
9509 * // => [{ 'x': 1 }, { 'x': 2 }]
9511 var unionBy = baseRest(function(arrays) {
9512 var iteratee = last(arrays);
9513 if (isArrayLikeObject(iteratee)) {
9514 iteratee = undefined;
9516 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
9520 * This method is like `_.union` except that it accepts `comparator` which
9521 * is invoked to compare elements of `arrays`. Result values are chosen from
9522 * the first array in which the value occurs. The comparator is invoked
9523 * with two arguments: (arrVal, othVal).
9529 * @param {...Array} [arrays] The arrays to inspect.
9530 * @param {Function} [comparator] The comparator invoked per element.
9531 * @returns {Array} Returns the new array of combined values.
9534 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
9535 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
9537 * _.unionWith(objects, others, _.isEqual);
9538 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
9540 var unionWith = baseRest(function(arrays) {
9541 var comparator = last(arrays);
9542 comparator = typeof comparator == 'function' ? comparator : undefined;
9543 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
9547 * Creates a duplicate-free version of an array, using
9548 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
9549 * for equality comparisons, in which only the first occurrence of each element
9550 * is kept. The order of result values is determined by the order they occur
9557 * @param {Array} array The array to inspect.
9558 * @returns {Array} Returns the new duplicate free array.
9561 * _.uniq([2, 1, 2]);
9564 function uniq(array) {
9565 return (array && array.length) ? baseUniq(array) : [];
9569 * This method is like `_.uniq` except that it accepts `iteratee` which is
9570 * invoked for each element in `array` to generate the criterion by which
9571 * uniqueness is computed. The order of result values is determined by the
9572 * order they occur in the array. The iteratee is invoked with one argument:
9579 * @param {Array} array The array to inspect.
9580 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
9581 * @returns {Array} Returns the new duplicate free array.
9584 * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
9587 * // The `_.property` iteratee shorthand.
9588 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
9589 * // => [{ 'x': 1 }, { 'x': 2 }]
9591 function uniqBy(array, iteratee) {
9592 return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
9596 * This method is like `_.uniq` except that it accepts `comparator` which
9597 * is invoked to compare elements of `array`. The order of result values is
9598 * determined by the order they occur in the array.The comparator is invoked
9599 * with two arguments: (arrVal, othVal).
9605 * @param {Array} array The array to inspect.
9606 * @param {Function} [comparator] The comparator invoked per element.
9607 * @returns {Array} Returns the new duplicate free array.
9610 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
9612 * _.uniqWith(objects, _.isEqual);
9613 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
9615 function uniqWith(array, comparator) {
9616 comparator = typeof comparator == 'function' ? comparator : undefined;
9617 return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
9621 * This method is like `_.zip` except that it accepts an array of grouped
9622 * elements and creates an array regrouping the elements to their pre-zip
9629 * @param {Array} array The array of grouped elements to process.
9630 * @returns {Array} Returns the new array of regrouped elements.
9633 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
9634 * // => [['a', 1, true], ['b', 2, false]]
9637 * // => [['a', 'b'], [1, 2], [true, false]]
9639 function unzip(array) {
9640 if (!(array && array.length)) {
9644 array = arrayFilter(array, function(group) {
9645 if (isArrayLikeObject(group)) {
9646 length = nativeMax(group.length, length);
9650 return baseTimes(length, function(index) {
9651 return arrayMap(array, baseProperty(index));
9656 * This method is like `_.unzip` except that it accepts `iteratee` to specify
9657 * how regrouped values should be combined. The iteratee is invoked with the
9658 * elements of each group: (...group).
9664 * @param {Array} array The array of grouped elements to process.
9665 * @param {Function} [iteratee=_.identity] The function to combine
9667 * @returns {Array} Returns the new array of regrouped elements.
9670 * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
9671 * // => [[1, 10, 100], [2, 20, 200]]
9673 * _.unzipWith(zipped, _.add);
9674 * // => [3, 30, 300]
9676 function unzipWith(array, iteratee) {
9677 if (!(array && array.length)) {
9680 var result = unzip(array);
9681 if (iteratee == null) {
9684 return arrayMap(result, function(group) {
9685 return apply(iteratee, undefined, group);
9690 * Creates an array excluding all given values using
9691 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
9692 * for equality comparisons.
9694 * **Note:** Unlike `_.pull`, this method returns a new array.
9700 * @param {Array} array The array to inspect.
9701 * @param {...*} [values] The values to exclude.
9702 * @returns {Array} Returns the new array of filtered values.
9703 * @see _.difference, _.xor
9706 * _.without([2, 1, 2, 3], 1, 2);
9709 var without = baseRest(function(array, values) {
9710 return isArrayLikeObject(array)
9711 ? baseDifference(array, values)
9716 * Creates an array of unique values that is the
9717 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
9718 * of the given arrays. The order of result values is determined by the order
9719 * they occur in the arrays.
9725 * @param {...Array} [arrays] The arrays to inspect.
9726 * @returns {Array} Returns the new array of filtered values.
9727 * @see _.difference, _.without
9730 * _.xor([2, 1], [2, 3]);
9733 var xor = baseRest(function(arrays) {
9734 return baseXor(arrayFilter(arrays, isArrayLikeObject));
9738 * This method is like `_.xor` except that it accepts `iteratee` which is
9739 * invoked for each element of each `arrays` to generate the criterion by
9740 * which by which they're compared. The order of result values is determined
9741 * by the order they occur in the arrays. The iteratee is invoked with one
9742 * argument: (value).
9748 * @param {...Array} [arrays] The arrays to inspect.
9749 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
9750 * @returns {Array} Returns the new array of filtered values.
9753 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
9756 * // The `_.property` iteratee shorthand.
9757 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
9758 * // => [{ 'x': 2 }]
9760 var xorBy = baseRest(function(arrays) {
9761 var iteratee = last(arrays);
9762 if (isArrayLikeObject(iteratee)) {
9763 iteratee = undefined;
9765 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
9769 * This method is like `_.xor` except that it accepts `comparator` which is
9770 * invoked to compare elements of `arrays`. The order of result values is
9771 * determined by the order they occur in the arrays. The comparator is invoked
9772 * with two arguments: (arrVal, othVal).
9778 * @param {...Array} [arrays] The arrays to inspect.
9779 * @param {Function} [comparator] The comparator invoked per element.
9780 * @returns {Array} Returns the new array of filtered values.
9783 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
9784 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
9786 * _.xorWith(objects, others, _.isEqual);
9787 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
9789 var xorWith = baseRest(function(arrays) {
9790 var comparator = last(arrays);
9791 comparator = typeof comparator == 'function' ? comparator : undefined;
9792 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
9796 * Creates an array of grouped elements, the first of which contains the
9797 * first elements of the given arrays, the second of which contains the
9798 * second elements of the given arrays, and so on.
9804 * @param {...Array} [arrays] The arrays to process.
9805 * @returns {Array} Returns the new array of grouped elements.
9808 * _.zip(['a', 'b'], [1, 2], [true, false]);
9809 * // => [['a', 1, true], ['b', 2, false]]
9811 var zip = baseRest(unzip);
9814 * This method is like `_.fromPairs` except that it accepts two arrays,
9815 * one of property identifiers and one of corresponding values.
9821 * @param {Array} [props=[]] The property identifiers.
9822 * @param {Array} [values=[]] The property values.
9823 * @returns {Object} Returns the new object.
9826 * _.zipObject(['a', 'b'], [1, 2]);
9827 * // => { 'a': 1, 'b': 2 }
9829 function zipObject(props, values) {
9830 return baseZipObject(props || [], values || [], assignValue);
9834 * This method is like `_.zipObject` except that it supports property paths.
9840 * @param {Array} [props=[]] The property identifiers.
9841 * @param {Array} [values=[]] The property values.
9842 * @returns {Object} Returns the new object.
9845 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
9846 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
9848 function zipObjectDeep(props, values) {
9849 return baseZipObject(props || [], values || [], baseSet);
9853 * This method is like `_.zip` except that it accepts `iteratee` to specify
9854 * how grouped values should be combined. The iteratee is invoked with the
9855 * elements of each group: (...group).
9861 * @param {...Array} [arrays] The arrays to process.
9862 * @param {Function} [iteratee=_.identity] The function to combine
9864 * @returns {Array} Returns the new array of grouped elements.
9867 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
9872 var zipWith = baseRest(function(arrays) {
9873 var length = arrays.length,
9874 iteratee = length > 1 ? arrays[length - 1] : undefined;
9876 iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
9877 return unzipWith(arrays, iteratee);
9880 /*------------------------------------------------------------------------*/
9883 * Creates a `lodash` wrapper instance that wraps `value` with explicit method
9884 * chain sequences enabled. The result of such sequences must be unwrapped
9891 * @param {*} value The value to wrap.
9892 * @returns {Object} Returns the new `lodash` wrapper instance.
9896 * { 'user': 'barney', 'age': 36 },
9897 * { 'user': 'fred', 'age': 40 },
9898 * { 'user': 'pebbles', 'age': 1 }
9904 * .map(function(o) {
9905 * return o.user + ' is ' + o.age;
9909 * // => 'pebbles is 1'
9911 function chain(value) {
9912 var result = lodash(value);
9913 result.__chain__ = true;
9918 * This method invokes `interceptor` and returns `value`. The interceptor
9919 * is invoked with one argument; (value). The purpose of this method is to
9920 * "tap into" a method chain sequence in order to modify intermediate results.
9926 * @param {*} value The value to provide to `interceptor`.
9927 * @param {Function} interceptor The function to invoke.
9928 * @returns {*} Returns `value`.
9932 * .tap(function(array) {
9933 * // Mutate input array.
9940 function tap(value, interceptor) {
9946 * This method is like `_.tap` except that it returns the result of `interceptor`.
9947 * The purpose of this method is to "pass thru" values replacing intermediate
9948 * results in a method chain sequence.
9954 * @param {*} value The value to provide to `interceptor`.
9955 * @param {Function} interceptor The function to invoke.
9956 * @returns {*} Returns the result of `interceptor`.
9962 * .thru(function(value) {
9968 function thru(value, interceptor) {
9969 return interceptor(value);
9973 * This method is the wrapper version of `_.at`.
9979 * @param {...(string|string[])} [paths] The property paths to pick.
9980 * @returns {Object} Returns the new `lodash` wrapper instance.
9983 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
9985 * _(object).at(['a[0].b.c', 'a[1]']).value();
9988 var wrapperAt = flatRest(function(paths) {
9989 var length = paths.length,
9990 start = length ? paths[0] : 0,
9991 value = this.__wrapped__,
9992 interceptor = function(object) { return baseAt(object, paths); };
9994 if (length > 1 || this.__actions__.length ||
9995 !(value instanceof LazyWrapper) || !isIndex(start)) {
9996 return this.thru(interceptor);
9998 value = value.slice(start, +start + (length ? 1 : 0));
9999 value.__actions__.push({
10001 'args': [interceptor],
10002 'thisArg': undefined
10004 return new LodashWrapper(value, this.__chain__).thru(function(array) {
10005 if (length && !array.length) {
10006 array.push(undefined);
10013 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
10019 * @returns {Object} Returns the new `lodash` wrapper instance.
10023 * { 'user': 'barney', 'age': 36 },
10024 * { 'user': 'fred', 'age': 40 }
10027 * // A sequence without explicit chaining.
10029 * // => { 'user': 'barney', 'age': 36 }
10031 * // A sequence with explicit chaining.
10037 * // => { 'user': 'barney' }
10039 function wrapperChain() {
10040 return chain(this);
10044 * Executes the chain sequence and returns the wrapped result.
10050 * @returns {Object} Returns the new `lodash` wrapper instance.
10053 * var array = [1, 2];
10054 * var wrapped = _(array).push(3);
10056 * console.log(array);
10059 * wrapped = wrapped.commit();
10060 * console.log(array);
10066 * console.log(array);
10069 function wrapperCommit() {
10070 return new LodashWrapper(this.value(), this.__chain__);
10074 * Gets the next value on a wrapped object following the
10075 * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
10081 * @returns {Object} Returns the next iterator value.
10084 * var wrapped = _([1, 2]);
10087 * // => { 'done': false, 'value': 1 }
10090 * // => { 'done': false, 'value': 2 }
10093 * // => { 'done': true, 'value': undefined }
10095 function wrapperNext() {
10096 if (this.__values__ === undefined) {
10097 this.__values__ = toArray(this.value());
10099 var done = this.__index__ >= this.__values__.length,
10100 value = done ? undefined : this.__values__[this.__index__++];
10102 return { 'done': done, 'value': value };
10106 * Enables the wrapper to be iterable.
10108 * @name Symbol.iterator
10112 * @returns {Object} Returns the wrapper object.
10115 * var wrapped = _([1, 2]);
10117 * wrapped[Symbol.iterator]() === wrapped;
10120 * Array.from(wrapped);
10123 function wrapperToIterator() {
10128 * Creates a clone of the chain sequence planting `value` as the wrapped value.
10134 * @param {*} value The value to plant.
10135 * @returns {Object} Returns the new `lodash` wrapper instance.
10138 * function square(n) {
10142 * var wrapped = _([1, 2]).map(square);
10143 * var other = wrapped.plant([3, 4]);
10151 function wrapperPlant(value) {
10155 while (parent instanceof baseLodash) {
10156 var clone = wrapperClone(parent);
10157 clone.__index__ = 0;
10158 clone.__values__ = undefined;
10160 previous.__wrapped__ = clone;
10164 var previous = clone;
10165 parent = parent.__wrapped__;
10167 previous.__wrapped__ = value;
10172 * This method is the wrapper version of `_.reverse`.
10174 * **Note:** This method mutates the wrapped array.
10180 * @returns {Object} Returns the new `lodash` wrapper instance.
10183 * var array = [1, 2, 3];
10185 * _(array).reverse().value()
10188 * console.log(array);
10191 function wrapperReverse() {
10192 var value = this.__wrapped__;
10193 if (value instanceof LazyWrapper) {
10194 var wrapped = value;
10195 if (this.__actions__.length) {
10196 wrapped = new LazyWrapper(this);
10198 wrapped = wrapped.reverse();
10199 wrapped.__actions__.push({
10202 'thisArg': undefined
10204 return new LodashWrapper(wrapped, this.__chain__);
10206 return this.thru(reverse);
10210 * Executes the chain sequence to resolve the unwrapped value.
10215 * @alias toJSON, valueOf
10217 * @returns {*} Returns the resolved unwrapped value.
10220 * _([1, 2, 3]).value();
10223 function wrapperValue() {
10224 return baseWrapperValue(this.__wrapped__, this.__actions__);
10227 /*------------------------------------------------------------------------*/
10230 * Creates an object composed of keys generated from the results of running
10231 * each element of `collection` thru `iteratee`. The corresponding value of
10232 * each key is the number of times the key was returned by `iteratee`. The
10233 * iteratee is invoked with one argument: (value).
10238 * @category Collection
10239 * @param {Array|Object} collection The collection to iterate over.
10240 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
10241 * @returns {Object} Returns the composed aggregate object.
10244 * _.countBy([6.1, 4.2, 6.3], Math.floor);
10245 * // => { '4': 1, '6': 2 }
10247 * // The `_.property` iteratee shorthand.
10248 * _.countBy(['one', 'two', 'three'], 'length');
10249 * // => { '3': 2, '5': 1 }
10251 var countBy = createAggregator(function(result, value, key) {
10252 if (hasOwnProperty.call(result, key)) {
10255 baseAssignValue(result, key, 1);
10260 * Checks if `predicate` returns truthy for **all** elements of `collection`.
10261 * Iteration is stopped once `predicate` returns falsey. The predicate is
10262 * invoked with three arguments: (value, index|key, collection).
10264 * **Note:** This method returns `true` for
10265 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
10266 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
10267 * elements of empty collections.
10272 * @category Collection
10273 * @param {Array|Object} collection The collection to iterate over.
10274 * @param {Function} [predicate=_.identity] The function invoked per iteration.
10275 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10276 * @returns {boolean} Returns `true` if all elements pass the predicate check,
10280 * _.every([true, 1, null, 'yes'], Boolean);
10284 * { 'user': 'barney', 'age': 36, 'active': false },
10285 * { 'user': 'fred', 'age': 40, 'active': false }
10288 * // The `_.matches` iteratee shorthand.
10289 * _.every(users, { 'user': 'barney', 'active': false });
10292 * // The `_.matchesProperty` iteratee shorthand.
10293 * _.every(users, ['active', false]);
10296 * // The `_.property` iteratee shorthand.
10297 * _.every(users, 'active');
10300 function every(collection, predicate, guard) {
10301 var func = isArray(collection) ? arrayEvery : baseEvery;
10302 if (guard && isIterateeCall(collection, predicate, guard)) {
10303 predicate = undefined;
10305 return func(collection, getIteratee(predicate, 3));
10309 * Iterates over elements of `collection`, returning an array of all elements
10310 * `predicate` returns truthy for. The predicate is invoked with three
10311 * arguments: (value, index|key, collection).
10313 * **Note:** Unlike `_.remove`, this method returns a new array.
10318 * @category Collection
10319 * @param {Array|Object} collection The collection to iterate over.
10320 * @param {Function} [predicate=_.identity] The function invoked per iteration.
10321 * @returns {Array} Returns the new filtered array.
10326 * { 'user': 'barney', 'age': 36, 'active': true },
10327 * { 'user': 'fred', 'age': 40, 'active': false }
10330 * _.filter(users, function(o) { return !o.active; });
10331 * // => objects for ['fred']
10333 * // The `_.matches` iteratee shorthand.
10334 * _.filter(users, { 'age': 36, 'active': true });
10335 * // => objects for ['barney']
10337 * // The `_.matchesProperty` iteratee shorthand.
10338 * _.filter(users, ['active', false]);
10339 * // => objects for ['fred']
10341 * // The `_.property` iteratee shorthand.
10342 * _.filter(users, 'active');
10343 * // => objects for ['barney']
10345 * // Combining several predicates using `_.overEvery` or `_.overSome`.
10346 * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
10347 * // => objects for ['fred', 'barney']
10349 function filter(collection, predicate) {
10350 var func = isArray(collection) ? arrayFilter : baseFilter;
10351 return func(collection, getIteratee(predicate, 3));
10355 * Iterates over elements of `collection`, returning the first element
10356 * `predicate` returns truthy for. The predicate is invoked with three
10357 * arguments: (value, index|key, collection).
10362 * @category Collection
10363 * @param {Array|Object} collection The collection to inspect.
10364 * @param {Function} [predicate=_.identity] The function invoked per iteration.
10365 * @param {number} [fromIndex=0] The index to search from.
10366 * @returns {*} Returns the matched element, else `undefined`.
10370 * { 'user': 'barney', 'age': 36, 'active': true },
10371 * { 'user': 'fred', 'age': 40, 'active': false },
10372 * { 'user': 'pebbles', 'age': 1, 'active': true }
10375 * _.find(users, function(o) { return o.age < 40; });
10376 * // => object for 'barney'
10378 * // The `_.matches` iteratee shorthand.
10379 * _.find(users, { 'age': 1, 'active': true });
10380 * // => object for 'pebbles'
10382 * // The `_.matchesProperty` iteratee shorthand.
10383 * _.find(users, ['active', false]);
10384 * // => object for 'fred'
10386 * // The `_.property` iteratee shorthand.
10387 * _.find(users, 'active');
10388 * // => object for 'barney'
10390 var find = createFind(findIndex);
10393 * This method is like `_.find` except that it iterates over elements of
10394 * `collection` from right to left.
10399 * @category Collection
10400 * @param {Array|Object} collection The collection to inspect.
10401 * @param {Function} [predicate=_.identity] The function invoked per iteration.
10402 * @param {number} [fromIndex=collection.length-1] The index to search from.
10403 * @returns {*} Returns the matched element, else `undefined`.
10406 * _.findLast([1, 2, 3, 4], function(n) {
10407 * return n % 2 == 1;
10411 var findLast = createFind(findLastIndex);
10414 * Creates a flattened array of values by running each element in `collection`
10415 * thru `iteratee` and flattening the mapped results. The iteratee is invoked
10416 * with three arguments: (value, index|key, collection).
10421 * @category Collection
10422 * @param {Array|Object} collection The collection to iterate over.
10423 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10424 * @returns {Array} Returns the new flattened array.
10427 * function duplicate(n) {
10431 * _.flatMap([1, 2], duplicate);
10432 * // => [1, 1, 2, 2]
10434 function flatMap(collection, iteratee) {
10435 return baseFlatten(map(collection, iteratee), 1);
10439 * This method is like `_.flatMap` except that it recursively flattens the
10445 * @category Collection
10446 * @param {Array|Object} collection The collection to iterate over.
10447 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10448 * @returns {Array} Returns the new flattened array.
10451 * function duplicate(n) {
10452 * return [[[n, n]]];
10455 * _.flatMapDeep([1, 2], duplicate);
10456 * // => [1, 1, 2, 2]
10458 function flatMapDeep(collection, iteratee) {
10459 return baseFlatten(map(collection, iteratee), INFINITY);
10463 * This method is like `_.flatMap` except that it recursively flattens the
10464 * mapped results up to `depth` times.
10469 * @category Collection
10470 * @param {Array|Object} collection The collection to iterate over.
10471 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10472 * @param {number} [depth=1] The maximum recursion depth.
10473 * @returns {Array} Returns the new flattened array.
10476 * function duplicate(n) {
10477 * return [[[n, n]]];
10480 * _.flatMapDepth([1, 2], duplicate, 2);
10481 * // => [[1, 1], [2, 2]]
10483 function flatMapDepth(collection, iteratee, depth) {
10484 depth = depth === undefined ? 1 : toInteger(depth);
10485 return baseFlatten(map(collection, iteratee), depth);
10489 * Iterates over elements of `collection` and invokes `iteratee` for each element.
10490 * The iteratee is invoked with three arguments: (value, index|key, collection).
10491 * Iteratee functions may exit iteration early by explicitly returning `false`.
10493 * **Note:** As with other "Collections" methods, objects with a "length"
10494 * property are iterated like arrays. To avoid this behavior use `_.forIn`
10495 * or `_.forOwn` for object iteration.
10501 * @category Collection
10502 * @param {Array|Object} collection The collection to iterate over.
10503 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10504 * @returns {Array|Object} Returns `collection`.
10505 * @see _.forEachRight
10508 * _.forEach([1, 2], function(value) {
10509 * console.log(value);
10511 * // => Logs `1` then `2`.
10513 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
10514 * console.log(key);
10516 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
10518 function forEach(collection, iteratee) {
10519 var func = isArray(collection) ? arrayEach : baseEach;
10520 return func(collection, getIteratee(iteratee, 3));
10524 * This method is like `_.forEach` except that it iterates over elements of
10525 * `collection` from right to left.
10531 * @category Collection
10532 * @param {Array|Object} collection The collection to iterate over.
10533 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10534 * @returns {Array|Object} Returns `collection`.
10538 * _.forEachRight([1, 2], function(value) {
10539 * console.log(value);
10541 * // => Logs `2` then `1`.
10543 function forEachRight(collection, iteratee) {
10544 var func = isArray(collection) ? arrayEachRight : baseEachRight;
10545 return func(collection, getIteratee(iteratee, 3));
10549 * Creates an object composed of keys generated from the results of running
10550 * each element of `collection` thru `iteratee`. The order of grouped values
10551 * is determined by the order they occur in `collection`. The corresponding
10552 * value of each key is an array of elements responsible for generating the
10553 * key. The iteratee is invoked with one argument: (value).
10558 * @category Collection
10559 * @param {Array|Object} collection The collection to iterate over.
10560 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
10561 * @returns {Object} Returns the composed aggregate object.
10564 * _.groupBy([6.1, 4.2, 6.3], Math.floor);
10565 * // => { '4': [4.2], '6': [6.1, 6.3] }
10567 * // The `_.property` iteratee shorthand.
10568 * _.groupBy(['one', 'two', 'three'], 'length');
10569 * // => { '3': ['one', 'two'], '5': ['three'] }
10571 var groupBy = createAggregator(function(result, value, key) {
10572 if (hasOwnProperty.call(result, key)) {
10573 result[key].push(value);
10575 baseAssignValue(result, key, [value]);
10580 * Checks if `value` is in `collection`. If `collection` is a string, it's
10581 * checked for a substring of `value`, otherwise
10582 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
10583 * is used for equality comparisons. If `fromIndex` is negative, it's used as
10584 * the offset from the end of `collection`.
10589 * @category Collection
10590 * @param {Array|Object|string} collection The collection to inspect.
10591 * @param {*} value The value to search for.
10592 * @param {number} [fromIndex=0] The index to search from.
10593 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
10594 * @returns {boolean} Returns `true` if `value` is found, else `false`.
10597 * _.includes([1, 2, 3], 1);
10600 * _.includes([1, 2, 3], 1, 2);
10603 * _.includes({ 'a': 1, 'b': 2 }, 1);
10606 * _.includes('abcd', 'bc');
10609 function includes(collection, value, fromIndex, guard) {
10610 collection = isArrayLike(collection) ? collection : values(collection);
10611 fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
10613 var length = collection.length;
10614 if (fromIndex < 0) {
10615 fromIndex = nativeMax(length + fromIndex, 0);
10617 return isString(collection)
10618 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
10619 : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
10623 * Invokes the method at `path` of each element in `collection`, returning
10624 * an array of the results of each invoked method. Any additional arguments
10625 * are provided to each invoked method. If `path` is a function, it's invoked
10626 * for, and `this` bound to, each element in `collection`.
10631 * @category Collection
10632 * @param {Array|Object} collection The collection to iterate over.
10633 * @param {Array|Function|string} path The path of the method to invoke or
10634 * the function invoked per iteration.
10635 * @param {...*} [args] The arguments to invoke each method with.
10636 * @returns {Array} Returns the array of results.
10639 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
10640 * // => [[1, 5, 7], [1, 2, 3]]
10642 * _.invokeMap([123, 456], String.prototype.split, '');
10643 * // => [['1', '2', '3'], ['4', '5', '6']]
10645 var invokeMap = baseRest(function(collection, path, args) {
10647 isFunc = typeof path == 'function',
10648 result = isArrayLike(collection) ? Array(collection.length) : [];
10650 baseEach(collection, function(value) {
10651 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
10657 * Creates an object composed of keys generated from the results of running
10658 * each element of `collection` thru `iteratee`. The corresponding value of
10659 * each key is the last element responsible for generating the key. The
10660 * iteratee is invoked with one argument: (value).
10665 * @category Collection
10666 * @param {Array|Object} collection The collection to iterate over.
10667 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
10668 * @returns {Object} Returns the composed aggregate object.
10672 * { 'dir': 'left', 'code': 97 },
10673 * { 'dir': 'right', 'code': 100 }
10676 * _.keyBy(array, function(o) {
10677 * return String.fromCharCode(o.code);
10679 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
10681 * _.keyBy(array, 'dir');
10682 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
10684 var keyBy = createAggregator(function(result, value, key) {
10685 baseAssignValue(result, key, value);
10689 * Creates an array of values by running each element in `collection` thru
10690 * `iteratee`. The iteratee is invoked with three arguments:
10691 * (value, index|key, collection).
10693 * Many lodash methods are guarded to work as iteratees for methods like
10694 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
10696 * The guarded methods are:
10697 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
10698 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
10699 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
10700 * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
10705 * @category Collection
10706 * @param {Array|Object} collection The collection to iterate over.
10707 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10708 * @returns {Array} Returns the new mapped array.
10711 * function square(n) {
10715 * _.map([4, 8], square);
10718 * _.map({ 'a': 4, 'b': 8 }, square);
10719 * // => [16, 64] (iteration order is not guaranteed)
10722 * { 'user': 'barney' },
10723 * { 'user': 'fred' }
10726 * // The `_.property` iteratee shorthand.
10727 * _.map(users, 'user');
10728 * // => ['barney', 'fred']
10730 function map(collection, iteratee) {
10731 var func = isArray(collection) ? arrayMap : baseMap;
10732 return func(collection, getIteratee(iteratee, 3));
10736 * This method is like `_.sortBy` except that it allows specifying the sort
10737 * orders of the iteratees to sort by. If `orders` is unspecified, all values
10738 * are sorted in ascending order. Otherwise, specify an order of "desc" for
10739 * descending or "asc" for ascending sort order of corresponding values.
10744 * @category Collection
10745 * @param {Array|Object} collection The collection to iterate over.
10746 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
10747 * The iteratees to sort by.
10748 * @param {string[]} [orders] The sort orders of `iteratees`.
10749 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
10750 * @returns {Array} Returns the new sorted array.
10754 * { 'user': 'fred', 'age': 48 },
10755 * { 'user': 'barney', 'age': 34 },
10756 * { 'user': 'fred', 'age': 40 },
10757 * { 'user': 'barney', 'age': 36 }
10760 * // Sort by `user` in ascending order and by `age` in descending order.
10761 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
10762 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
10764 function orderBy(collection, iteratees, orders, guard) {
10765 if (collection == null) {
10768 if (!isArray(iteratees)) {
10769 iteratees = iteratees == null ? [] : [iteratees];
10771 orders = guard ? undefined : orders;
10772 if (!isArray(orders)) {
10773 orders = orders == null ? [] : [orders];
10775 return baseOrderBy(collection, iteratees, orders);
10779 * Creates an array of elements split into two groups, the first of which
10780 * contains elements `predicate` returns truthy for, the second of which
10781 * contains elements `predicate` returns falsey for. The predicate is
10782 * invoked with one argument: (value).
10787 * @category Collection
10788 * @param {Array|Object} collection The collection to iterate over.
10789 * @param {Function} [predicate=_.identity] The function invoked per iteration.
10790 * @returns {Array} Returns the array of grouped elements.
10794 * { 'user': 'barney', 'age': 36, 'active': false },
10795 * { 'user': 'fred', 'age': 40, 'active': true },
10796 * { 'user': 'pebbles', 'age': 1, 'active': false }
10799 * _.partition(users, function(o) { return o.active; });
10800 * // => objects for [['fred'], ['barney', 'pebbles']]
10802 * // The `_.matches` iteratee shorthand.
10803 * _.partition(users, { 'age': 1, 'active': false });
10804 * // => objects for [['pebbles'], ['barney', 'fred']]
10806 * // The `_.matchesProperty` iteratee shorthand.
10807 * _.partition(users, ['active', false]);
10808 * // => objects for [['barney', 'pebbles'], ['fred']]
10810 * // The `_.property` iteratee shorthand.
10811 * _.partition(users, 'active');
10812 * // => objects for [['fred'], ['barney', 'pebbles']]
10814 var partition = createAggregator(function(result, value, key) {
10815 result[key ? 0 : 1].push(value);
10816 }, function() { return [[], []]; });
10819 * Reduces `collection` to a value which is the accumulated result of running
10820 * each element in `collection` thru `iteratee`, where each successive
10821 * invocation is supplied the return value of the previous. If `accumulator`
10822 * is not given, the first element of `collection` is used as the initial
10823 * value. The iteratee is invoked with four arguments:
10824 * (accumulator, value, index|key, collection).
10826 * Many lodash methods are guarded to work as iteratees for methods like
10827 * `_.reduce`, `_.reduceRight`, and `_.transform`.
10829 * The guarded methods are:
10830 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
10836 * @category Collection
10837 * @param {Array|Object} collection The collection to iterate over.
10838 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10839 * @param {*} [accumulator] The initial value.
10840 * @returns {*} Returns the accumulated value.
10841 * @see _.reduceRight
10844 * _.reduce([1, 2], function(sum, n) {
10849 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
10850 * (result[value] || (result[value] = [])).push(key);
10853 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
10855 function reduce(collection, iteratee, accumulator) {
10856 var func = isArray(collection) ? arrayReduce : baseReduce,
10857 initAccum = arguments.length < 3;
10859 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
10863 * This method is like `_.reduce` except that it iterates over elements of
10864 * `collection` from right to left.
10869 * @category Collection
10870 * @param {Array|Object} collection The collection to iterate over.
10871 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10872 * @param {*} [accumulator] The initial value.
10873 * @returns {*} Returns the accumulated value.
10877 * var array = [[0, 1], [2, 3], [4, 5]];
10879 * _.reduceRight(array, function(flattened, other) {
10880 * return flattened.concat(other);
10882 * // => [4, 5, 2, 3, 0, 1]
10884 function reduceRight(collection, iteratee, accumulator) {
10885 var func = isArray(collection) ? arrayReduceRight : baseReduce,
10886 initAccum = arguments.length < 3;
10888 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
10892 * The opposite of `_.filter`; this method returns the elements of `collection`
10893 * that `predicate` does **not** return truthy for.
10898 * @category Collection
10899 * @param {Array|Object} collection The collection to iterate over.
10900 * @param {Function} [predicate=_.identity] The function invoked per iteration.
10901 * @returns {Array} Returns the new filtered array.
10906 * { 'user': 'barney', 'age': 36, 'active': false },
10907 * { 'user': 'fred', 'age': 40, 'active': true }
10910 * _.reject(users, function(o) { return !o.active; });
10911 * // => objects for ['fred']
10913 * // The `_.matches` iteratee shorthand.
10914 * _.reject(users, { 'age': 40, 'active': true });
10915 * // => objects for ['barney']
10917 * // The `_.matchesProperty` iteratee shorthand.
10918 * _.reject(users, ['active', false]);
10919 * // => objects for ['fred']
10921 * // The `_.property` iteratee shorthand.
10922 * _.reject(users, 'active');
10923 * // => objects for ['barney']
10925 function reject(collection, predicate) {
10926 var func = isArray(collection) ? arrayFilter : baseFilter;
10927 return func(collection, negate(getIteratee(predicate, 3)));
10931 * Gets a random element from `collection`.
10936 * @category Collection
10937 * @param {Array|Object} collection The collection to sample.
10938 * @returns {*} Returns the random element.
10941 * _.sample([1, 2, 3, 4]);
10944 function sample(collection) {
10945 var func = isArray(collection) ? arraySample : baseSample;
10946 return func(collection);
10950 * Gets `n` random elements at unique keys from `collection` up to the
10951 * size of `collection`.
10956 * @category Collection
10957 * @param {Array|Object} collection The collection to sample.
10958 * @param {number} [n=1] The number of elements to sample.
10959 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10960 * @returns {Array} Returns the random elements.
10963 * _.sampleSize([1, 2, 3], 2);
10966 * _.sampleSize([1, 2, 3], 4);
10969 function sampleSize(collection, n, guard) {
10970 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
10975 var func = isArray(collection) ? arraySampleSize : baseSampleSize;
10976 return func(collection, n);
10980 * Creates an array of shuffled values, using a version of the
10981 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
10986 * @category Collection
10987 * @param {Array|Object} collection The collection to shuffle.
10988 * @returns {Array} Returns the new shuffled array.
10991 * _.shuffle([1, 2, 3, 4]);
10992 * // => [4, 1, 3, 2]
10994 function shuffle(collection) {
10995 var func = isArray(collection) ? arrayShuffle : baseShuffle;
10996 return func(collection);
11000 * Gets the size of `collection` by returning its length for array-like
11001 * values or the number of own enumerable string keyed properties for objects.
11006 * @category Collection
11007 * @param {Array|Object|string} collection The collection to inspect.
11008 * @returns {number} Returns the collection size.
11011 * _.size([1, 2, 3]);
11014 * _.size({ 'a': 1, 'b': 2 });
11017 * _.size('pebbles');
11020 function size(collection) {
11021 if (collection == null) {
11024 if (isArrayLike(collection)) {
11025 return isString(collection) ? stringSize(collection) : collection.length;
11027 var tag = getTag(collection);
11028 if (tag == mapTag || tag == setTag) {
11029 return collection.size;
11031 return baseKeys(collection).length;
11035 * Checks if `predicate` returns truthy for **any** element of `collection`.
11036 * Iteration is stopped once `predicate` returns truthy. The predicate is
11037 * invoked with three arguments: (value, index|key, collection).
11042 * @category Collection
11043 * @param {Array|Object} collection The collection to iterate over.
11044 * @param {Function} [predicate=_.identity] The function invoked per iteration.
11045 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
11046 * @returns {boolean} Returns `true` if any element passes the predicate check,
11050 * _.some([null, 0, 'yes', false], Boolean);
11054 * { 'user': 'barney', 'active': true },
11055 * { 'user': 'fred', 'active': false }
11058 * // The `_.matches` iteratee shorthand.
11059 * _.some(users, { 'user': 'barney', 'active': false });
11062 * // The `_.matchesProperty` iteratee shorthand.
11063 * _.some(users, ['active', false]);
11066 * // The `_.property` iteratee shorthand.
11067 * _.some(users, 'active');
11070 function some(collection, predicate, guard) {
11071 var func = isArray(collection) ? arraySome : baseSome;
11072 if (guard && isIterateeCall(collection, predicate, guard)) {
11073 predicate = undefined;
11075 return func(collection, getIteratee(predicate, 3));
11079 * Creates an array of elements, sorted in ascending order by the results of
11080 * running each element in a collection thru each iteratee. This method
11081 * performs a stable sort, that is, it preserves the original sort order of
11082 * equal elements. The iteratees are invoked with one argument: (value).
11087 * @category Collection
11088 * @param {Array|Object} collection The collection to iterate over.
11089 * @param {...(Function|Function[])} [iteratees=[_.identity]]
11090 * The iteratees to sort by.
11091 * @returns {Array} Returns the new sorted array.
11095 * { 'user': 'fred', 'age': 48 },
11096 * { 'user': 'barney', 'age': 36 },
11097 * { 'user': 'fred', 'age': 30 },
11098 * { 'user': 'barney', 'age': 34 }
11101 * _.sortBy(users, [function(o) { return o.user; }]);
11102 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
11104 * _.sortBy(users, ['user', 'age']);
11105 * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
11107 var sortBy = baseRest(function(collection, iteratees) {
11108 if (collection == null) {
11111 var length = iteratees.length;
11112 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
11114 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
11115 iteratees = [iteratees[0]];
11117 return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
11120 /*------------------------------------------------------------------------*/
11123 * Gets the timestamp of the number of milliseconds that have elapsed since
11124 * the Unix epoch (1 January 1970 00:00:00 UTC).
11130 * @returns {number} Returns the timestamp.
11133 * _.defer(function(stamp) {
11134 * console.log(_.now() - stamp);
11136 * // => Logs the number of milliseconds it took for the deferred invocation.
11138 var now = ctxNow || function() {
11139 return root.Date.now();
11142 /*------------------------------------------------------------------------*/
11145 * The opposite of `_.before`; this method creates a function that invokes
11146 * `func` once it's called `n` or more times.
11151 * @category Function
11152 * @param {number} n The number of calls before `func` is invoked.
11153 * @param {Function} func The function to restrict.
11154 * @returns {Function} Returns the new restricted function.
11157 * var saves = ['profile', 'settings'];
11159 * var done = _.after(saves.length, function() {
11160 * console.log('done saving!');
11163 * _.forEach(saves, function(type) {
11164 * asyncSave({ 'type': type, 'complete': done });
11166 * // => Logs 'done saving!' after the two async saves have completed.
11168 function after(n, func) {
11169 if (typeof func != 'function') {
11170 throw new TypeError(FUNC_ERROR_TEXT);
11173 return function() {
11175 return func.apply(this, arguments);
11181 * Creates a function that invokes `func`, with up to `n` arguments,
11182 * ignoring any additional arguments.
11187 * @category Function
11188 * @param {Function} func The function to cap arguments for.
11189 * @param {number} [n=func.length] The arity cap.
11190 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
11191 * @returns {Function} Returns the new capped function.
11194 * _.map(['6', '8', '10'], _.ary(parseInt, 1));
11197 function ary(func, n, guard) {
11198 n = guard ? undefined : n;
11199 n = (func && n == null) ? func.length : n;
11200 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
11204 * Creates a function that invokes `func`, with the `this` binding and arguments
11205 * of the created function, while it's called less than `n` times. Subsequent
11206 * calls to the created function return the result of the last `func` invocation.
11211 * @category Function
11212 * @param {number} n The number of calls at which `func` is no longer invoked.
11213 * @param {Function} func The function to restrict.
11214 * @returns {Function} Returns the new restricted function.
11217 * jQuery(element).on('click', _.before(5, addContactToList));
11218 * // => Allows adding up to 4 contacts to the list.
11220 function before(n, func) {
11222 if (typeof func != 'function') {
11223 throw new TypeError(FUNC_ERROR_TEXT);
11226 return function() {
11228 result = func.apply(this, arguments);
11238 * Creates a function that invokes `func` with the `this` binding of `thisArg`
11239 * and `partials` prepended to the arguments it receives.
11241 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
11242 * may be used as a placeholder for partially applied arguments.
11244 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
11245 * property of bound functions.
11250 * @category Function
11251 * @param {Function} func The function to bind.
11252 * @param {*} thisArg The `this` binding of `func`.
11253 * @param {...*} [partials] The arguments to be partially applied.
11254 * @returns {Function} Returns the new bound function.
11257 * function greet(greeting, punctuation) {
11258 * return greeting + ' ' + this.user + punctuation;
11261 * var object = { 'user': 'fred' };
11263 * var bound = _.bind(greet, object, 'hi');
11267 * // Bound with placeholders.
11268 * var bound = _.bind(greet, object, _, '!');
11272 var bind = baseRest(function(func, thisArg, partials) {
11273 var bitmask = WRAP_BIND_FLAG;
11274 if (partials.length) {
11275 var holders = replaceHolders(partials, getHolder(bind));
11276 bitmask |= WRAP_PARTIAL_FLAG;
11278 return createWrap(func, bitmask, thisArg, partials, holders);
11282 * Creates a function that invokes the method at `object[key]` with `partials`
11283 * prepended to the arguments it receives.
11285 * This method differs from `_.bind` by allowing bound functions to reference
11286 * methods that may be redefined or don't yet exist. See
11287 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
11288 * for more details.
11290 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
11291 * builds, may be used as a placeholder for partially applied arguments.
11296 * @category Function
11297 * @param {Object} object The object to invoke the method on.
11298 * @param {string} key The key of the method.
11299 * @param {...*} [partials] The arguments to be partially applied.
11300 * @returns {Function} Returns the new bound function.
11305 * 'greet': function(greeting, punctuation) {
11306 * return greeting + ' ' + this.user + punctuation;
11310 * var bound = _.bindKey(object, 'greet', 'hi');
11314 * object.greet = function(greeting, punctuation) {
11315 * return greeting + 'ya ' + this.user + punctuation;
11319 * // => 'hiya fred!'
11321 * // Bound with placeholders.
11322 * var bound = _.bindKey(object, 'greet', _, '!');
11324 * // => 'hiya fred!'
11326 var bindKey = baseRest(function(object, key, partials) {
11327 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
11328 if (partials.length) {
11329 var holders = replaceHolders(partials, getHolder(bindKey));
11330 bitmask |= WRAP_PARTIAL_FLAG;
11332 return createWrap(key, bitmask, object, partials, holders);
11336 * Creates a function that accepts arguments of `func` and either invokes
11337 * `func` returning its result, if at least `arity` number of arguments have
11338 * been provided, or returns a function that accepts the remaining `func`
11339 * arguments, and so on. The arity of `func` may be specified if `func.length`
11340 * is not sufficient.
11342 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
11343 * may be used as a placeholder for provided arguments.
11345 * **Note:** This method doesn't set the "length" property of curried functions.
11350 * @category Function
11351 * @param {Function} func The function to curry.
11352 * @param {number} [arity=func.length] The arity of `func`.
11353 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
11354 * @returns {Function} Returns the new curried function.
11357 * var abc = function(a, b, c) {
11358 * return [a, b, c];
11361 * var curried = _.curry(abc);
11363 * curried(1)(2)(3);
11366 * curried(1, 2)(3);
11369 * curried(1, 2, 3);
11372 * // Curried with placeholders.
11373 * curried(1)(_, 3)(2);
11376 function curry(func, arity, guard) {
11377 arity = guard ? undefined : arity;
11378 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
11379 result.placeholder = curry.placeholder;
11384 * This method is like `_.curry` except that arguments are applied to `func`
11385 * in the manner of `_.partialRight` instead of `_.partial`.
11387 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
11388 * builds, may be used as a placeholder for provided arguments.
11390 * **Note:** This method doesn't set the "length" property of curried functions.
11395 * @category Function
11396 * @param {Function} func The function to curry.
11397 * @param {number} [arity=func.length] The arity of `func`.
11398 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
11399 * @returns {Function} Returns the new curried function.
11402 * var abc = function(a, b, c) {
11403 * return [a, b, c];
11406 * var curried = _.curryRight(abc);
11408 * curried(3)(2)(1);
11411 * curried(2, 3)(1);
11414 * curried(1, 2, 3);
11417 * // Curried with placeholders.
11418 * curried(3)(1, _)(2);
11421 function curryRight(func, arity, guard) {
11422 arity = guard ? undefined : arity;
11423 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
11424 result.placeholder = curryRight.placeholder;
11429 * Creates a debounced function that delays invoking `func` until after `wait`
11430 * milliseconds have elapsed since the last time the debounced function was
11431 * invoked. The debounced function comes with a `cancel` method to cancel
11432 * delayed `func` invocations and a `flush` method to immediately invoke them.
11433 * Provide `options` to indicate whether `func` should be invoked on the
11434 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
11435 * with the last arguments provided to the debounced function. Subsequent
11436 * calls to the debounced function return the result of the last `func`
11439 * **Note:** If `leading` and `trailing` options are `true`, `func` is
11440 * invoked on the trailing edge of the timeout only if the debounced function
11441 * is invoked more than once during the `wait` timeout.
11443 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
11444 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
11446 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
11447 * for details over the differences between `_.debounce` and `_.throttle`.
11452 * @category Function
11453 * @param {Function} func The function to debounce.
11454 * @param {number} [wait=0] The number of milliseconds to delay.
11455 * @param {Object} [options={}] The options object.
11456 * @param {boolean} [options.leading=false]
11457 * Specify invoking on the leading edge of the timeout.
11458 * @param {number} [options.maxWait]
11459 * The maximum time `func` is allowed to be delayed before it's invoked.
11460 * @param {boolean} [options.trailing=true]
11461 * Specify invoking on the trailing edge of the timeout.
11462 * @returns {Function} Returns the new debounced function.
11465 * // Avoid costly calculations while the window size is in flux.
11466 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
11468 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
11469 * jQuery(element).on('click', _.debounce(sendMail, 300, {
11471 * 'trailing': false
11474 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
11475 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
11476 * var source = new EventSource('/stream');
11477 * jQuery(source).on('message', debounced);
11479 * // Cancel the trailing debounced invocation.
11480 * jQuery(window).on('popstate', debounced.cancel);
11482 function debounce(func, wait, options) {
11489 lastInvokeTime = 0,
11494 if (typeof func != 'function') {
11495 throw new TypeError(FUNC_ERROR_TEXT);
11497 wait = toNumber(wait) || 0;
11498 if (isObject(options)) {
11499 leading = !!options.leading;
11500 maxing = 'maxWait' in options;
11501 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
11502 trailing = 'trailing' in options ? !!options.trailing : trailing;
11505 function invokeFunc(time) {
11506 var args = lastArgs,
11507 thisArg = lastThis;
11509 lastArgs = lastThis = undefined;
11510 lastInvokeTime = time;
11511 result = func.apply(thisArg, args);
11515 function leadingEdge(time) {
11516 // Reset any `maxWait` timer.
11517 lastInvokeTime = time;
11518 // Start the timer for the trailing edge.
11519 timerId = setTimeout(timerExpired, wait);
11520 // Invoke the leading edge.
11521 return leading ? invokeFunc(time) : result;
11524 function remainingWait(time) {
11525 var timeSinceLastCall = time - lastCallTime,
11526 timeSinceLastInvoke = time - lastInvokeTime,
11527 timeWaiting = wait - timeSinceLastCall;
11530 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
11534 function shouldInvoke(time) {
11535 var timeSinceLastCall = time - lastCallTime,
11536 timeSinceLastInvoke = time - lastInvokeTime;
11538 // Either this is the first call, activity has stopped and we're at the
11539 // trailing edge, the system time has gone backwards and we're treating
11540 // it as the trailing edge, or we've hit the `maxWait` limit.
11541 return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
11542 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
11545 function timerExpired() {
11547 if (shouldInvoke(time)) {
11548 return trailingEdge(time);
11550 // Restart the timer.
11551 timerId = setTimeout(timerExpired, remainingWait(time));
11554 function trailingEdge(time) {
11555 timerId = undefined;
11557 // Only invoke if we have `lastArgs` which means `func` has been
11558 // debounced at least once.
11559 if (trailing && lastArgs) {
11560 return invokeFunc(time);
11562 lastArgs = lastThis = undefined;
11566 function cancel() {
11567 if (timerId !== undefined) {
11568 clearTimeout(timerId);
11570 lastInvokeTime = 0;
11571 lastArgs = lastCallTime = lastThis = timerId = undefined;
11575 return timerId === undefined ? result : trailingEdge(now());
11578 function debounced() {
11580 isInvoking = shouldInvoke(time);
11582 lastArgs = arguments;
11584 lastCallTime = time;
11587 if (timerId === undefined) {
11588 return leadingEdge(lastCallTime);
11591 // Handle invocations in a tight loop.
11592 clearTimeout(timerId);
11593 timerId = setTimeout(timerExpired, wait);
11594 return invokeFunc(lastCallTime);
11597 if (timerId === undefined) {
11598 timerId = setTimeout(timerExpired, wait);
11602 debounced.cancel = cancel;
11603 debounced.flush = flush;
11608 * Defers invoking the `func` until the current call stack has cleared. Any
11609 * additional arguments are provided to `func` when it's invoked.
11614 * @category Function
11615 * @param {Function} func The function to defer.
11616 * @param {...*} [args] The arguments to invoke `func` with.
11617 * @returns {number} Returns the timer id.
11620 * _.defer(function(text) {
11621 * console.log(text);
11623 * // => Logs 'deferred' after one millisecond.
11625 var defer = baseRest(function(func, args) {
11626 return baseDelay(func, 1, args);
11630 * Invokes `func` after `wait` milliseconds. Any additional arguments are
11631 * provided to `func` when it's invoked.
11636 * @category Function
11637 * @param {Function} func The function to delay.
11638 * @param {number} wait The number of milliseconds to delay invocation.
11639 * @param {...*} [args] The arguments to invoke `func` with.
11640 * @returns {number} Returns the timer id.
11643 * _.delay(function(text) {
11644 * console.log(text);
11645 * }, 1000, 'later');
11646 * // => Logs 'later' after one second.
11648 var delay = baseRest(function(func, wait, args) {
11649 return baseDelay(func, toNumber(wait) || 0, args);
11653 * Creates a function that invokes `func` with arguments reversed.
11658 * @category Function
11659 * @param {Function} func The function to flip arguments for.
11660 * @returns {Function} Returns the new flipped function.
11663 * var flipped = _.flip(function() {
11664 * return _.toArray(arguments);
11667 * flipped('a', 'b', 'c', 'd');
11668 * // => ['d', 'c', 'b', 'a']
11670 function flip(func) {
11671 return createWrap(func, WRAP_FLIP_FLAG);
11675 * Creates a function that memoizes the result of `func`. If `resolver` is
11676 * provided, it determines the cache key for storing the result based on the
11677 * arguments provided to the memoized function. By default, the first argument
11678 * provided to the memoized function is used as the map cache key. The `func`
11679 * is invoked with the `this` binding of the memoized function.
11681 * **Note:** The cache is exposed as the `cache` property on the memoized
11682 * function. Its creation may be customized by replacing the `_.memoize.Cache`
11683 * constructor with one whose instances implement the
11684 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
11685 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
11690 * @category Function
11691 * @param {Function} func The function to have its output memoized.
11692 * @param {Function} [resolver] The function to resolve the cache key.
11693 * @returns {Function} Returns the new memoized function.
11696 * var object = { 'a': 1, 'b': 2 };
11697 * var other = { 'c': 3, 'd': 4 };
11699 * var values = _.memoize(_.values);
11710 * // Modify the result cache.
11711 * values.cache.set(object, ['a', 'b']);
11715 * // Replace `_.memoize.Cache`.
11716 * _.memoize.Cache = WeakMap;
11718 function memoize(func, resolver) {
11719 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
11720 throw new TypeError(FUNC_ERROR_TEXT);
11722 var memoized = function() {
11723 var args = arguments,
11724 key = resolver ? resolver.apply(this, args) : args[0],
11725 cache = memoized.cache;
11727 if (cache.has(key)) {
11728 return cache.get(key);
11730 var result = func.apply(this, args);
11731 memoized.cache = cache.set(key, result) || cache;
11734 memoized.cache = new (memoize.Cache || MapCache);
11738 // Expose `MapCache`.
11739 memoize.Cache = MapCache;
11742 * Creates a function that negates the result of the predicate `func`. The
11743 * `func` predicate is invoked with the `this` binding and arguments of the
11744 * created function.
11749 * @category Function
11750 * @param {Function} predicate The predicate to negate.
11751 * @returns {Function} Returns the new negated function.
11754 * function isEven(n) {
11755 * return n % 2 == 0;
11758 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
11761 function negate(predicate) {
11762 if (typeof predicate != 'function') {
11763 throw new TypeError(FUNC_ERROR_TEXT);
11765 return function() {
11766 var args = arguments;
11767 switch (args.length) {
11768 case 0: return !predicate.call(this);
11769 case 1: return !predicate.call(this, args[0]);
11770 case 2: return !predicate.call(this, args[0], args[1]);
11771 case 3: return !predicate.call(this, args[0], args[1], args[2]);
11773 return !predicate.apply(this, args);
11778 * Creates a function that is restricted to invoking `func` once. Repeat calls
11779 * to the function return the value of the first invocation. The `func` is
11780 * invoked with the `this` binding and arguments of the created function.
11785 * @category Function
11786 * @param {Function} func The function to restrict.
11787 * @returns {Function} Returns the new restricted function.
11790 * var initialize = _.once(createApplication);
11793 * // => `createApplication` is invoked once
11795 function once(func) {
11796 return before(2, func);
11800 * Creates a function that invokes `func` with its arguments transformed.
11805 * @category Function
11806 * @param {Function} func The function to wrap.
11807 * @param {...(Function|Function[])} [transforms=[_.identity]]
11808 * The argument transforms.
11809 * @returns {Function} Returns the new function.
11812 * function doubled(n) {
11816 * function square(n) {
11820 * var func = _.overArgs(function(x, y) {
11822 * }, [square, doubled]);
11830 var overArgs = castRest(function(func, transforms) {
11831 transforms = (transforms.length == 1 && isArray(transforms[0]))
11832 ? arrayMap(transforms[0], baseUnary(getIteratee()))
11833 : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
11835 var funcsLength = transforms.length;
11836 return baseRest(function(args) {
11838 length = nativeMin(args.length, funcsLength);
11840 while (++index < length) {
11841 args[index] = transforms[index].call(this, args[index]);
11843 return apply(func, this, args);
11848 * Creates a function that invokes `func` with `partials` prepended to the
11849 * arguments it receives. This method is like `_.bind` except it does **not**
11850 * alter the `this` binding.
11852 * The `_.partial.placeholder` value, which defaults to `_` in monolithic
11853 * builds, may be used as a placeholder for partially applied arguments.
11855 * **Note:** This method doesn't set the "length" property of partially
11856 * applied functions.
11861 * @category Function
11862 * @param {Function} func The function to partially apply arguments to.
11863 * @param {...*} [partials] The arguments to be partially applied.
11864 * @returns {Function} Returns the new partially applied function.
11867 * function greet(greeting, name) {
11868 * return greeting + ' ' + name;
11871 * var sayHelloTo = _.partial(greet, 'hello');
11872 * sayHelloTo('fred');
11873 * // => 'hello fred'
11875 * // Partially applied with placeholders.
11876 * var greetFred = _.partial(greet, _, 'fred');
11880 var partial = baseRest(function(func, partials) {
11881 var holders = replaceHolders(partials, getHolder(partial));
11882 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
11886 * This method is like `_.partial` except that partially applied arguments
11887 * are appended to the arguments it receives.
11889 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
11890 * builds, may be used as a placeholder for partially applied arguments.
11892 * **Note:** This method doesn't set the "length" property of partially
11893 * applied functions.
11898 * @category Function
11899 * @param {Function} func The function to partially apply arguments to.
11900 * @param {...*} [partials] The arguments to be partially applied.
11901 * @returns {Function} Returns the new partially applied function.
11904 * function greet(greeting, name) {
11905 * return greeting + ' ' + name;
11908 * var greetFred = _.partialRight(greet, 'fred');
11912 * // Partially applied with placeholders.
11913 * var sayHelloTo = _.partialRight(greet, 'hello', _);
11914 * sayHelloTo('fred');
11915 * // => 'hello fred'
11917 var partialRight = baseRest(function(func, partials) {
11918 var holders = replaceHolders(partials, getHolder(partialRight));
11919 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
11923 * Creates a function that invokes `func` with arguments arranged according
11924 * to the specified `indexes` where the argument value at the first index is
11925 * provided as the first argument, the argument value at the second index is
11926 * provided as the second argument, and so on.
11931 * @category Function
11932 * @param {Function} func The function to rearrange arguments for.
11933 * @param {...(number|number[])} indexes The arranged argument indexes.
11934 * @returns {Function} Returns the new function.
11937 * var rearged = _.rearg(function(a, b, c) {
11938 * return [a, b, c];
11941 * rearged('b', 'c', 'a')
11942 * // => ['a', 'b', 'c']
11944 var rearg = flatRest(function(func, indexes) {
11945 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
11949 * Creates a function that invokes `func` with the `this` binding of the
11950 * created function and arguments from `start` and beyond provided as
11953 * **Note:** This method is based on the
11954 * [rest parameter](https://mdn.io/rest_parameters).
11959 * @category Function
11960 * @param {Function} func The function to apply a rest parameter to.
11961 * @param {number} [start=func.length-1] The start position of the rest parameter.
11962 * @returns {Function} Returns the new function.
11965 * var say = _.rest(function(what, names) {
11966 * return what + ' ' + _.initial(names).join(', ') +
11967 * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
11970 * say('hello', 'fred', 'barney', 'pebbles');
11971 * // => 'hello fred, barney, & pebbles'
11973 function rest(func, start) {
11974 if (typeof func != 'function') {
11975 throw new TypeError(FUNC_ERROR_TEXT);
11977 start = start === undefined ? start : toInteger(start);
11978 return baseRest(func, start);
11982 * Creates a function that invokes `func` with the `this` binding of the
11983 * create function and an array of arguments much like
11984 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
11986 * **Note:** This method is based on the
11987 * [spread operator](https://mdn.io/spread_operator).
11992 * @category Function
11993 * @param {Function} func The function to spread arguments over.
11994 * @param {number} [start=0] The start position of the spread.
11995 * @returns {Function} Returns the new function.
11998 * var say = _.spread(function(who, what) {
11999 * return who + ' says ' + what;
12002 * say(['fred', 'hello']);
12003 * // => 'fred says hello'
12005 * var numbers = Promise.all([
12006 * Promise.resolve(40),
12007 * Promise.resolve(36)
12010 * numbers.then(_.spread(function(x, y) {
12013 * // => a Promise of 76
12015 function spread(func, start) {
12016 if (typeof func != 'function') {
12017 throw new TypeError(FUNC_ERROR_TEXT);
12019 start = start == null ? 0 : nativeMax(toInteger(start), 0);
12020 return baseRest(function(args) {
12021 var array = args[start],
12022 otherArgs = castSlice(args, 0, start);
12025 arrayPush(otherArgs, array);
12027 return apply(func, this, otherArgs);
12032 * Creates a throttled function that only invokes `func` at most once per
12033 * every `wait` milliseconds. The throttled function comes with a `cancel`
12034 * method to cancel delayed `func` invocations and a `flush` method to
12035 * immediately invoke them. Provide `options` to indicate whether `func`
12036 * should be invoked on the leading and/or trailing edge of the `wait`
12037 * timeout. The `func` is invoked with the last arguments provided to the
12038 * throttled function. Subsequent calls to the throttled function return the
12039 * result of the last `func` invocation.
12041 * **Note:** If `leading` and `trailing` options are `true`, `func` is
12042 * invoked on the trailing edge of the timeout only if the throttled function
12043 * is invoked more than once during the `wait` timeout.
12045 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
12046 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
12048 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
12049 * for details over the differences between `_.throttle` and `_.debounce`.
12054 * @category Function
12055 * @param {Function} func The function to throttle.
12056 * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
12057 * @param {Object} [options={}] The options object.
12058 * @param {boolean} [options.leading=true]
12059 * Specify invoking on the leading edge of the timeout.
12060 * @param {boolean} [options.trailing=true]
12061 * Specify invoking on the trailing edge of the timeout.
12062 * @returns {Function} Returns the new throttled function.
12065 * // Avoid excessively updating the position while scrolling.
12066 * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
12068 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
12069 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
12070 * jQuery(element).on('click', throttled);
12072 * // Cancel the trailing throttled invocation.
12073 * jQuery(window).on('popstate', throttled.cancel);
12075 function throttle(func, wait, options) {
12076 var leading = true,
12079 if (typeof func != 'function') {
12080 throw new TypeError(FUNC_ERROR_TEXT);
12082 if (isObject(options)) {
12083 leading = 'leading' in options ? !!options.leading : leading;
12084 trailing = 'trailing' in options ? !!options.trailing : trailing;
12086 return debounce(func, wait, {
12087 'leading': leading,
12089 'trailing': trailing
12094 * Creates a function that accepts up to one argument, ignoring any
12095 * additional arguments.
12100 * @category Function
12101 * @param {Function} func The function to cap arguments for.
12102 * @returns {Function} Returns the new capped function.
12105 * _.map(['6', '8', '10'], _.unary(parseInt));
12108 function unary(func) {
12109 return ary(func, 1);
12113 * Creates a function that provides `value` to `wrapper` as its first
12114 * argument. Any additional arguments provided to the function are appended
12115 * to those provided to the `wrapper`. The wrapper is invoked with the `this`
12116 * binding of the created function.
12121 * @category Function
12122 * @param {*} value The value to wrap.
12123 * @param {Function} [wrapper=identity] The wrapper function.
12124 * @returns {Function} Returns the new function.
12127 * var p = _.wrap(_.escape, function(func, text) {
12128 * return '<p>' + func(text) + '</p>';
12131 * p('fred, barney, & pebbles');
12132 * // => '<p>fred, barney, & pebbles</p>'
12134 function wrap(value, wrapper) {
12135 return partial(castFunction(wrapper), value);
12138 /*------------------------------------------------------------------------*/
12141 * Casts `value` as an array if it's not one.
12147 * @param {*} value The value to inspect.
12148 * @returns {Array} Returns the cast array.
12154 * _.castArray({ 'a': 1 });
12155 * // => [{ 'a': 1 }]
12157 * _.castArray('abc');
12160 * _.castArray(null);
12163 * _.castArray(undefined);
12164 * // => [undefined]
12169 * var array = [1, 2, 3];
12170 * console.log(_.castArray(array) === array);
12173 function castArray() {
12174 if (!arguments.length) {
12177 var value = arguments[0];
12178 return isArray(value) ? value : [value];
12182 * Creates a shallow clone of `value`.
12184 * **Note:** This method is loosely based on the
12185 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
12186 * and supports cloning arrays, array buffers, booleans, date objects, maps,
12187 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
12188 * arrays. The own enumerable properties of `arguments` objects are cloned
12189 * as plain objects. An empty object is returned for uncloneable values such
12190 * as error objects, functions, DOM nodes, and WeakMaps.
12196 * @param {*} value The value to clone.
12197 * @returns {*} Returns the cloned value.
12201 * var objects = [{ 'a': 1 }, { 'b': 2 }];
12203 * var shallow = _.clone(objects);
12204 * console.log(shallow[0] === objects[0]);
12207 function clone(value) {
12208 return baseClone(value, CLONE_SYMBOLS_FLAG);
12212 * This method is like `_.clone` except that it accepts `customizer` which
12213 * is invoked to produce the cloned value. If `customizer` returns `undefined`,
12214 * cloning is handled by the method instead. The `customizer` is invoked with
12215 * up to four arguments; (value [, index|key, object, stack]).
12221 * @param {*} value The value to clone.
12222 * @param {Function} [customizer] The function to customize cloning.
12223 * @returns {*} Returns the cloned value.
12224 * @see _.cloneDeepWith
12227 * function customizer(value) {
12228 * if (_.isElement(value)) {
12229 * return value.cloneNode(false);
12233 * var el = _.cloneWith(document.body, customizer);
12235 * console.log(el === document.body);
12237 * console.log(el.nodeName);
12239 * console.log(el.childNodes.length);
12242 function cloneWith(value, customizer) {
12243 customizer = typeof customizer == 'function' ? customizer : undefined;
12244 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
12248 * This method is like `_.clone` except that it recursively clones `value`.
12254 * @param {*} value The value to recursively clone.
12255 * @returns {*} Returns the deep cloned value.
12259 * var objects = [{ 'a': 1 }, { 'b': 2 }];
12261 * var deep = _.cloneDeep(objects);
12262 * console.log(deep[0] === objects[0]);
12265 function cloneDeep(value) {
12266 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
12270 * This method is like `_.cloneWith` except that it recursively clones `value`.
12276 * @param {*} value The value to recursively clone.
12277 * @param {Function} [customizer] The function to customize cloning.
12278 * @returns {*} Returns the deep cloned value.
12282 * function customizer(value) {
12283 * if (_.isElement(value)) {
12284 * return value.cloneNode(true);
12288 * var el = _.cloneDeepWith(document.body, customizer);
12290 * console.log(el === document.body);
12292 * console.log(el.nodeName);
12294 * console.log(el.childNodes.length);
12297 function cloneDeepWith(value, customizer) {
12298 customizer = typeof customizer == 'function' ? customizer : undefined;
12299 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
12303 * Checks if `object` conforms to `source` by invoking the predicate
12304 * properties of `source` with the corresponding property values of `object`.
12306 * **Note:** This method is equivalent to `_.conforms` when `source` is
12307 * partially applied.
12313 * @param {Object} object The object to inspect.
12314 * @param {Object} source The object of property predicates to conform to.
12315 * @returns {boolean} Returns `true` if `object` conforms, else `false`.
12318 * var object = { 'a': 1, 'b': 2 };
12320 * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
12323 * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
12326 function conformsTo(object, source) {
12327 return source == null || baseConformsTo(object, source, keys(source));
12332 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
12333 * comparison between two values to determine if they are equivalent.
12339 * @param {*} value The value to compare.
12340 * @param {*} other The other value to compare.
12341 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
12344 * var object = { 'a': 1 };
12345 * var other = { 'a': 1 };
12347 * _.eq(object, object);
12350 * _.eq(object, other);
12356 * _.eq('a', Object('a'));
12362 function eq(value, other) {
12363 return value === other || (value !== value && other !== other);
12367 * Checks if `value` is greater than `other`.
12373 * @param {*} value The value to compare.
12374 * @param {*} other The other value to compare.
12375 * @returns {boolean} Returns `true` if `value` is greater than `other`,
12389 var gt = createRelationalOperation(baseGt);
12392 * Checks if `value` is greater than or equal to `other`.
12398 * @param {*} value The value to compare.
12399 * @param {*} other The other value to compare.
12400 * @returns {boolean} Returns `true` if `value` is greater than or equal to
12401 * `other`, else `false`.
12414 var gte = createRelationalOperation(function(value, other) {
12415 return value >= other;
12419 * Checks if `value` is likely an `arguments` object.
12425 * @param {*} value The value to check.
12426 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
12430 * _.isArguments(function() { return arguments; }());
12433 * _.isArguments([1, 2, 3]);
12436 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
12437 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
12438 !propertyIsEnumerable.call(value, 'callee');
12442 * Checks if `value` is classified as an `Array` object.
12448 * @param {*} value The value to check.
12449 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
12452 * _.isArray([1, 2, 3]);
12455 * _.isArray(document.body.children);
12458 * _.isArray('abc');
12461 * _.isArray(_.noop);
12464 var isArray = Array.isArray;
12467 * Checks if `value` is classified as an `ArrayBuffer` object.
12473 * @param {*} value The value to check.
12474 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
12477 * _.isArrayBuffer(new ArrayBuffer(2));
12480 * _.isArrayBuffer(new Array(2));
12483 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
12486 * Checks if `value` is array-like. A value is considered array-like if it's
12487 * not a function and has a `value.length` that's an integer greater than or
12488 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
12494 * @param {*} value The value to check.
12495 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
12498 * _.isArrayLike([1, 2, 3]);
12501 * _.isArrayLike(document.body.children);
12504 * _.isArrayLike('abc');
12507 * _.isArrayLike(_.noop);
12510 function isArrayLike(value) {
12511 return value != null && isLength(value.length) && !isFunction(value);
12515 * This method is like `_.isArrayLike` except that it also checks if `value`
12522 * @param {*} value The value to check.
12523 * @returns {boolean} Returns `true` if `value` is an array-like object,
12527 * _.isArrayLikeObject([1, 2, 3]);
12530 * _.isArrayLikeObject(document.body.children);
12533 * _.isArrayLikeObject('abc');
12536 * _.isArrayLikeObject(_.noop);
12539 function isArrayLikeObject(value) {
12540 return isObjectLike(value) && isArrayLike(value);
12544 * Checks if `value` is classified as a boolean primitive or object.
12550 * @param {*} value The value to check.
12551 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
12554 * _.isBoolean(false);
12557 * _.isBoolean(null);
12560 function isBoolean(value) {
12561 return value === true || value === false ||
12562 (isObjectLike(value) && baseGetTag(value) == boolTag);
12566 * Checks if `value` is a buffer.
12572 * @param {*} value The value to check.
12573 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
12576 * _.isBuffer(new Buffer(2));
12579 * _.isBuffer(new Uint8Array(2));
12582 var isBuffer = nativeIsBuffer || stubFalse;
12585 * Checks if `value` is classified as a `Date` object.
12591 * @param {*} value The value to check.
12592 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
12595 * _.isDate(new Date);
12598 * _.isDate('Mon April 23 2012');
12601 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
12604 * Checks if `value` is likely a DOM element.
12610 * @param {*} value The value to check.
12611 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
12614 * _.isElement(document.body);
12617 * _.isElement('<body>');
12620 function isElement(value) {
12621 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
12625 * Checks if `value` is an empty object, collection, map, or set.
12627 * Objects are considered empty if they have no own enumerable string keyed
12630 * Array-like values such as `arguments` objects, arrays, buffers, strings, or
12631 * jQuery-like collections are considered empty if they have a `length` of `0`.
12632 * Similarly, maps and sets are considered empty if they have a `size` of `0`.
12638 * @param {*} value The value to check.
12639 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
12651 * _.isEmpty([1, 2, 3]);
12654 * _.isEmpty({ 'a': 1 });
12657 function isEmpty(value) {
12658 if (value == null) {
12661 if (isArrayLike(value) &&
12662 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
12663 isBuffer(value) || isTypedArray(value) || isArguments(value))) {
12664 return !value.length;
12666 var tag = getTag(value);
12667 if (tag == mapTag || tag == setTag) {
12668 return !value.size;
12670 if (isPrototype(value)) {
12671 return !baseKeys(value).length;
12673 for (var key in value) {
12674 if (hasOwnProperty.call(value, key)) {
12682 * Performs a deep comparison between two values to determine if they are
12685 * **Note:** This method supports comparing arrays, array buffers, booleans,
12686 * date objects, error objects, maps, numbers, `Object` objects, regexes,
12687 * sets, strings, symbols, and typed arrays. `Object` objects are compared
12688 * by their own, not inherited, enumerable properties. Functions and DOM
12689 * nodes are compared by strict equality, i.e. `===`.
12695 * @param {*} value The value to compare.
12696 * @param {*} other The other value to compare.
12697 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
12700 * var object = { 'a': 1 };
12701 * var other = { 'a': 1 };
12703 * _.isEqual(object, other);
12706 * object === other;
12709 function isEqual(value, other) {
12710 return baseIsEqual(value, other);
12714 * This method is like `_.isEqual` except that it accepts `customizer` which
12715 * is invoked to compare values. If `customizer` returns `undefined`, comparisons
12716 * are handled by the method instead. The `customizer` is invoked with up to
12717 * six arguments: (objValue, othValue [, index|key, object, other, stack]).
12723 * @param {*} value The value to compare.
12724 * @param {*} other The other value to compare.
12725 * @param {Function} [customizer] The function to customize comparisons.
12726 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
12729 * function isGreeting(value) {
12730 * return /^h(?:i|ello)$/.test(value);
12733 * function customizer(objValue, othValue) {
12734 * if (isGreeting(objValue) && isGreeting(othValue)) {
12739 * var array = ['hello', 'goodbye'];
12740 * var other = ['hi', 'goodbye'];
12742 * _.isEqualWith(array, other, customizer);
12745 function isEqualWith(value, other, customizer) {
12746 customizer = typeof customizer == 'function' ? customizer : undefined;
12747 var result = customizer ? customizer(value, other) : undefined;
12748 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
12752 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
12753 * `SyntaxError`, `TypeError`, or `URIError` object.
12759 * @param {*} value The value to check.
12760 * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
12763 * _.isError(new Error);
12766 * _.isError(Error);
12769 function isError(value) {
12770 if (!isObjectLike(value)) {
12773 var tag = baseGetTag(value);
12774 return tag == errorTag || tag == domExcTag ||
12775 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
12779 * Checks if `value` is a finite primitive number.
12781 * **Note:** This method is based on
12782 * [`Number.isFinite`](https://mdn.io/Number/isFinite).
12788 * @param {*} value The value to check.
12789 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
12795 * _.isFinite(Number.MIN_VALUE);
12798 * _.isFinite(Infinity);
12804 function isFinite(value) {
12805 return typeof value == 'number' && nativeIsFinite(value);
12809 * Checks if `value` is classified as a `Function` object.
12815 * @param {*} value The value to check.
12816 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
12822 * _.isFunction(/abc/);
12825 function isFunction(value) {
12826 if (!isObject(value)) {
12829 // The use of `Object#toString` avoids issues with the `typeof` operator
12830 // in Safari 9 which returns 'object' for typed arrays and other constructors.
12831 var tag = baseGetTag(value);
12832 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
12836 * Checks if `value` is an integer.
12838 * **Note:** This method is based on
12839 * [`Number.isInteger`](https://mdn.io/Number/isInteger).
12845 * @param {*} value The value to check.
12846 * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
12852 * _.isInteger(Number.MIN_VALUE);
12855 * _.isInteger(Infinity);
12858 * _.isInteger('3');
12861 function isInteger(value) {
12862 return typeof value == 'number' && value == toInteger(value);
12866 * Checks if `value` is a valid array-like length.
12868 * **Note:** This method is loosely based on
12869 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
12875 * @param {*} value The value to check.
12876 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
12882 * _.isLength(Number.MIN_VALUE);
12885 * _.isLength(Infinity);
12891 function isLength(value) {
12892 return typeof value == 'number' &&
12893 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
12897 * Checks if `value` is the
12898 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
12899 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
12905 * @param {*} value The value to check.
12906 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
12912 * _.isObject([1, 2, 3]);
12915 * _.isObject(_.noop);
12918 * _.isObject(null);
12921 function isObject(value) {
12922 var type = typeof value;
12923 return value != null && (type == 'object' || type == 'function');
12927 * Checks if `value` is object-like. A value is object-like if it's not `null`
12928 * and has a `typeof` result of "object".
12934 * @param {*} value The value to check.
12935 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
12938 * _.isObjectLike({});
12941 * _.isObjectLike([1, 2, 3]);
12944 * _.isObjectLike(_.noop);
12947 * _.isObjectLike(null);
12950 function isObjectLike(value) {
12951 return value != null && typeof value == 'object';
12955 * Checks if `value` is classified as a `Map` object.
12961 * @param {*} value The value to check.
12962 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
12965 * _.isMap(new Map);
12968 * _.isMap(new WeakMap);
12971 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
12974 * Performs a partial deep comparison between `object` and `source` to
12975 * determine if `object` contains equivalent property values.
12977 * **Note:** This method is equivalent to `_.matches` when `source` is
12978 * partially applied.
12980 * Partial comparisons will match empty array and empty object `source`
12981 * values against any array or object value, respectively. See `_.isEqual`
12982 * for a list of supported value comparisons.
12988 * @param {Object} object The object to inspect.
12989 * @param {Object} source The object of property values to match.
12990 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
12993 * var object = { 'a': 1, 'b': 2 };
12995 * _.isMatch(object, { 'b': 2 });
12998 * _.isMatch(object, { 'b': 1 });
13001 function isMatch(object, source) {
13002 return object === source || baseIsMatch(object, source, getMatchData(source));
13006 * This method is like `_.isMatch` except that it accepts `customizer` which
13007 * is invoked to compare values. If `customizer` returns `undefined`, comparisons
13008 * are handled by the method instead. The `customizer` is invoked with five
13009 * arguments: (objValue, srcValue, index|key, object, source).
13015 * @param {Object} object The object to inspect.
13016 * @param {Object} source The object of property values to match.
13017 * @param {Function} [customizer] The function to customize comparisons.
13018 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
13021 * function isGreeting(value) {
13022 * return /^h(?:i|ello)$/.test(value);
13025 * function customizer(objValue, srcValue) {
13026 * if (isGreeting(objValue) && isGreeting(srcValue)) {
13031 * var object = { 'greeting': 'hello' };
13032 * var source = { 'greeting': 'hi' };
13034 * _.isMatchWith(object, source, customizer);
13037 function isMatchWith(object, source, customizer) {
13038 customizer = typeof customizer == 'function' ? customizer : undefined;
13039 return baseIsMatch(object, source, getMatchData(source), customizer);
13043 * Checks if `value` is `NaN`.
13045 * **Note:** This method is based on
13046 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
13047 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
13048 * `undefined` and other non-number values.
13054 * @param {*} value The value to check.
13055 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
13061 * _.isNaN(new Number(NaN));
13064 * isNaN(undefined);
13067 * _.isNaN(undefined);
13070 function isNaN(value) {
13071 // An `NaN` primitive is the only value that is not equal to itself.
13072 // Perform the `toStringTag` check first to avoid errors with some
13073 // ActiveX objects in IE.
13074 return isNumber(value) && value != +value;
13078 * Checks if `value` is a pristine native function.
13080 * **Note:** This method can't reliably detect native functions in the presence
13081 * of the core-js package because core-js circumvents this kind of detection.
13082 * Despite multiple requests, the core-js maintainer has made it clear: any
13083 * attempt to fix the detection will be obstructed. As a result, we're left
13084 * with little choice but to throw an error. Unfortunately, this also affects
13085 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
13086 * which rely on core-js.
13092 * @param {*} value The value to check.
13093 * @returns {boolean} Returns `true` if `value` is a native function,
13097 * _.isNative(Array.prototype.push);
13103 function isNative(value) {
13104 if (isMaskable(value)) {
13105 throw new Error(CORE_ERROR_TEXT);
13107 return baseIsNative(value);
13111 * Checks if `value` is `null`.
13117 * @param {*} value The value to check.
13118 * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
13124 * _.isNull(void 0);
13127 function isNull(value) {
13128 return value === null;
13132 * Checks if `value` is `null` or `undefined`.
13138 * @param {*} value The value to check.
13139 * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
13151 function isNil(value) {
13152 return value == null;
13156 * Checks if `value` is classified as a `Number` primitive or object.
13158 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
13159 * classified as numbers, use the `_.isFinite` method.
13165 * @param {*} value The value to check.
13166 * @returns {boolean} Returns `true` if `value` is a number, else `false`.
13172 * _.isNumber(Number.MIN_VALUE);
13175 * _.isNumber(Infinity);
13181 function isNumber(value) {
13182 return typeof value == 'number' ||
13183 (isObjectLike(value) && baseGetTag(value) == numberTag);
13187 * Checks if `value` is a plain object, that is, an object created by the
13188 * `Object` constructor or one with a `[[Prototype]]` of `null`.
13194 * @param {*} value The value to check.
13195 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
13202 * _.isPlainObject(new Foo);
13205 * _.isPlainObject([1, 2, 3]);
13208 * _.isPlainObject({ 'x': 0, 'y': 0 });
13211 * _.isPlainObject(Object.create(null));
13214 function isPlainObject(value) {
13215 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
13218 var proto = getPrototype(value);
13219 if (proto === null) {
13222 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
13223 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
13224 funcToString.call(Ctor) == objectCtorString;
13228 * Checks if `value` is classified as a `RegExp` object.
13234 * @param {*} value The value to check.
13235 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
13238 * _.isRegExp(/abc/);
13241 * _.isRegExp('/abc/');
13244 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
13247 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
13248 * double precision number which isn't the result of a rounded unsafe integer.
13250 * **Note:** This method is based on
13251 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
13257 * @param {*} value The value to check.
13258 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
13261 * _.isSafeInteger(3);
13264 * _.isSafeInteger(Number.MIN_VALUE);
13267 * _.isSafeInteger(Infinity);
13270 * _.isSafeInteger('3');
13273 function isSafeInteger(value) {
13274 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
13278 * Checks if `value` is classified as a `Set` object.
13284 * @param {*} value The value to check.
13285 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
13288 * _.isSet(new Set);
13291 * _.isSet(new WeakSet);
13294 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
13297 * Checks if `value` is classified as a `String` primitive or object.
13303 * @param {*} value The value to check.
13304 * @returns {boolean} Returns `true` if `value` is a string, else `false`.
13307 * _.isString('abc');
13313 function isString(value) {
13314 return typeof value == 'string' ||
13315 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
13319 * Checks if `value` is classified as a `Symbol` primitive or object.
13325 * @param {*} value The value to check.
13326 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
13329 * _.isSymbol(Symbol.iterator);
13332 * _.isSymbol('abc');
13335 function isSymbol(value) {
13336 return typeof value == 'symbol' ||
13337 (isObjectLike(value) && baseGetTag(value) == symbolTag);
13341 * Checks if `value` is classified as a typed array.
13347 * @param {*} value The value to check.
13348 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
13351 * _.isTypedArray(new Uint8Array);
13354 * _.isTypedArray([]);
13357 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
13360 * Checks if `value` is `undefined`.
13366 * @param {*} value The value to check.
13367 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
13370 * _.isUndefined(void 0);
13373 * _.isUndefined(null);
13376 function isUndefined(value) {
13377 return value === undefined;
13381 * Checks if `value` is classified as a `WeakMap` object.
13387 * @param {*} value The value to check.
13388 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
13391 * _.isWeakMap(new WeakMap);
13394 * _.isWeakMap(new Map);
13397 function isWeakMap(value) {
13398 return isObjectLike(value) && getTag(value) == weakMapTag;
13402 * Checks if `value` is classified as a `WeakSet` object.
13408 * @param {*} value The value to check.
13409 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
13412 * _.isWeakSet(new WeakSet);
13415 * _.isWeakSet(new Set);
13418 function isWeakSet(value) {
13419 return isObjectLike(value) && baseGetTag(value) == weakSetTag;
13423 * Checks if `value` is less than `other`.
13429 * @param {*} value The value to compare.
13430 * @param {*} other The other value to compare.
13431 * @returns {boolean} Returns `true` if `value` is less than `other`,
13445 var lt = createRelationalOperation(baseLt);
13448 * Checks if `value` is less than or equal to `other`.
13454 * @param {*} value The value to compare.
13455 * @param {*} other The other value to compare.
13456 * @returns {boolean} Returns `true` if `value` is less than or equal to
13457 * `other`, else `false`.
13470 var lte = createRelationalOperation(function(value, other) {
13471 return value <= other;
13475 * Converts `value` to an array.
13481 * @param {*} value The value to convert.
13482 * @returns {Array} Returns the converted array.
13485 * _.toArray({ 'a': 1, 'b': 2 });
13488 * _.toArray('abc');
13489 * // => ['a', 'b', 'c']
13497 function toArray(value) {
13501 if (isArrayLike(value)) {
13502 return isString(value) ? stringToArray(value) : copyArray(value);
13504 if (symIterator && value[symIterator]) {
13505 return iteratorToArray(value[symIterator]());
13507 var tag = getTag(value),
13508 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
13510 return func(value);
13514 * Converts `value` to a finite number.
13520 * @param {*} value The value to convert.
13521 * @returns {number} Returns the converted number.
13527 * _.toFinite(Number.MIN_VALUE);
13530 * _.toFinite(Infinity);
13531 * // => 1.7976931348623157e+308
13533 * _.toFinite('3.2');
13536 function toFinite(value) {
13538 return value === 0 ? value : 0;
13540 value = toNumber(value);
13541 if (value === INFINITY || value === -INFINITY) {
13542 var sign = (value < 0 ? -1 : 1);
13543 return sign * MAX_INTEGER;
13545 return value === value ? value : 0;
13549 * Converts `value` to an integer.
13551 * **Note:** This method is loosely based on
13552 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
13558 * @param {*} value The value to convert.
13559 * @returns {number} Returns the converted integer.
13562 * _.toInteger(3.2);
13565 * _.toInteger(Number.MIN_VALUE);
13568 * _.toInteger(Infinity);
13569 * // => 1.7976931348623157e+308
13571 * _.toInteger('3.2');
13574 function toInteger(value) {
13575 var result = toFinite(value),
13576 remainder = result % 1;
13578 return result === result ? (remainder ? result - remainder : result) : 0;
13582 * Converts `value` to an integer suitable for use as the length of an
13583 * array-like object.
13585 * **Note:** This method is based on
13586 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
13592 * @param {*} value The value to convert.
13593 * @returns {number} Returns the converted integer.
13599 * _.toLength(Number.MIN_VALUE);
13602 * _.toLength(Infinity);
13605 * _.toLength('3.2');
13608 function toLength(value) {
13609 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
13613 * Converts `value` to a number.
13619 * @param {*} value The value to process.
13620 * @returns {number} Returns the number.
13626 * _.toNumber(Number.MIN_VALUE);
13629 * _.toNumber(Infinity);
13632 * _.toNumber('3.2');
13635 function toNumber(value) {
13636 if (typeof value == 'number') {
13639 if (isSymbol(value)) {
13642 if (isObject(value)) {
13643 var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
13644 value = isObject(other) ? (other + '') : other;
13646 if (typeof value != 'string') {
13647 return value === 0 ? value : +value;
13649 value = baseTrim(value);
13650 var isBinary = reIsBinary.test(value);
13651 return (isBinary || reIsOctal.test(value))
13652 ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
13653 : (reIsBadHex.test(value) ? NAN : +value);
13657 * Converts `value` to a plain object flattening inherited enumerable string
13658 * keyed properties of `value` to own properties of the plain object.
13664 * @param {*} value The value to convert.
13665 * @returns {Object} Returns the converted plain object.
13672 * Foo.prototype.c = 3;
13674 * _.assign({ 'a': 1 }, new Foo);
13675 * // => { 'a': 1, 'b': 2 }
13677 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
13678 * // => { 'a': 1, 'b': 2, 'c': 3 }
13680 function toPlainObject(value) {
13681 return copyObject(value, keysIn(value));
13685 * Converts `value` to a safe integer. A safe integer can be compared and
13686 * represented correctly.
13692 * @param {*} value The value to convert.
13693 * @returns {number} Returns the converted integer.
13696 * _.toSafeInteger(3.2);
13699 * _.toSafeInteger(Number.MIN_VALUE);
13702 * _.toSafeInteger(Infinity);
13703 * // => 9007199254740991
13705 * _.toSafeInteger('3.2');
13708 function toSafeInteger(value) {
13710 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
13711 : (value === 0 ? value : 0);
13715 * Converts `value` to a string. An empty string is returned for `null`
13716 * and `undefined` values. The sign of `-0` is preserved.
13722 * @param {*} value The value to convert.
13723 * @returns {string} Returns the converted string.
13726 * _.toString(null);
13732 * _.toString([1, 2, 3]);
13735 function toString(value) {
13736 return value == null ? '' : baseToString(value);
13739 /*------------------------------------------------------------------------*/
13742 * Assigns own enumerable string keyed properties of source objects to the
13743 * destination object. Source objects are applied from left to right.
13744 * Subsequent sources overwrite property assignments of previous sources.
13746 * **Note:** This method mutates `object` and is loosely based on
13747 * [`Object.assign`](https://mdn.io/Object/assign).
13753 * @param {Object} object The destination object.
13754 * @param {...Object} [sources] The source objects.
13755 * @returns {Object} Returns `object`.
13767 * Foo.prototype.b = 2;
13768 * Bar.prototype.d = 4;
13770 * _.assign({ 'a': 0 }, new Foo, new Bar);
13771 * // => { 'a': 1, 'c': 3 }
13773 var assign = createAssigner(function(object, source) {
13774 if (isPrototype(source) || isArrayLike(source)) {
13775 copyObject(source, keys(source), object);
13778 for (var key in source) {
13779 if (hasOwnProperty.call(source, key)) {
13780 assignValue(object, key, source[key]);
13786 * This method is like `_.assign` except that it iterates over own and
13787 * inherited source properties.
13789 * **Note:** This method mutates `object`.
13796 * @param {Object} object The destination object.
13797 * @param {...Object} [sources] The source objects.
13798 * @returns {Object} Returns `object`.
13810 * Foo.prototype.b = 2;
13811 * Bar.prototype.d = 4;
13813 * _.assignIn({ 'a': 0 }, new Foo, new Bar);
13814 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
13816 var assignIn = createAssigner(function(object, source) {
13817 copyObject(source, keysIn(source), object);
13821 * This method is like `_.assignIn` except that it accepts `customizer`
13822 * which is invoked to produce the assigned values. If `customizer` returns
13823 * `undefined`, assignment is handled by the method instead. The `customizer`
13824 * is invoked with five arguments: (objValue, srcValue, key, object, source).
13826 * **Note:** This method mutates `object`.
13831 * @alias extendWith
13833 * @param {Object} object The destination object.
13834 * @param {...Object} sources The source objects.
13835 * @param {Function} [customizer] The function to customize assigned values.
13836 * @returns {Object} Returns `object`.
13837 * @see _.assignWith
13840 * function customizer(objValue, srcValue) {
13841 * return _.isUndefined(objValue) ? srcValue : objValue;
13844 * var defaults = _.partialRight(_.assignInWith, customizer);
13846 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
13847 * // => { 'a': 1, 'b': 2 }
13849 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
13850 copyObject(source, keysIn(source), object, customizer);
13854 * This method is like `_.assign` except that it accepts `customizer`
13855 * which is invoked to produce the assigned values. If `customizer` returns
13856 * `undefined`, assignment is handled by the method instead. The `customizer`
13857 * is invoked with five arguments: (objValue, srcValue, key, object, source).
13859 * **Note:** This method mutates `object`.
13865 * @param {Object} object The destination object.
13866 * @param {...Object} sources The source objects.
13867 * @param {Function} [customizer] The function to customize assigned values.
13868 * @returns {Object} Returns `object`.
13869 * @see _.assignInWith
13872 * function customizer(objValue, srcValue) {
13873 * return _.isUndefined(objValue) ? srcValue : objValue;
13876 * var defaults = _.partialRight(_.assignWith, customizer);
13878 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
13879 * // => { 'a': 1, 'b': 2 }
13881 var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
13882 copyObject(source, keys(source), object, customizer);
13886 * Creates an array of values corresponding to `paths` of `object`.
13892 * @param {Object} object The object to iterate over.
13893 * @param {...(string|string[])} [paths] The property paths to pick.
13894 * @returns {Array} Returns the picked values.
13897 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
13899 * _.at(object, ['a[0].b.c', 'a[1]']);
13902 var at = flatRest(baseAt);
13905 * Creates an object that inherits from the `prototype` object. If a
13906 * `properties` object is given, its own enumerable string keyed properties
13907 * are assigned to the created object.
13913 * @param {Object} prototype The object to inherit from.
13914 * @param {Object} [properties] The properties to assign to the object.
13915 * @returns {Object} Returns the new object.
13918 * function Shape() {
13923 * function Circle() {
13924 * Shape.call(this);
13927 * Circle.prototype = _.create(Shape.prototype, {
13928 * 'constructor': Circle
13931 * var circle = new Circle;
13932 * circle instanceof Circle;
13935 * circle instanceof Shape;
13938 function create(prototype, properties) {
13939 var result = baseCreate(prototype);
13940 return properties == null ? result : baseAssign(result, properties);
13944 * Assigns own and inherited enumerable string keyed properties of source
13945 * objects to the destination object for all destination properties that
13946 * resolve to `undefined`. Source objects are applied from left to right.
13947 * Once a property is set, additional values of the same property are ignored.
13949 * **Note:** This method mutates `object`.
13955 * @param {Object} object The destination object.
13956 * @param {...Object} [sources] The source objects.
13957 * @returns {Object} Returns `object`.
13958 * @see _.defaultsDeep
13961 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
13962 * // => { 'a': 1, 'b': 2 }
13964 var defaults = baseRest(function(object, sources) {
13965 object = Object(object);
13968 var length = sources.length;
13969 var guard = length > 2 ? sources[2] : undefined;
13971 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
13975 while (++index < length) {
13976 var source = sources[index];
13977 var props = keysIn(source);
13978 var propsIndex = -1;
13979 var propsLength = props.length;
13981 while (++propsIndex < propsLength) {
13982 var key = props[propsIndex];
13983 var value = object[key];
13985 if (value === undefined ||
13986 (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
13987 object[key] = source[key];
13996 * This method is like `_.defaults` except that it recursively assigns
13997 * default properties.
13999 * **Note:** This method mutates `object`.
14005 * @param {Object} object The destination object.
14006 * @param {...Object} [sources] The source objects.
14007 * @returns {Object} Returns `object`.
14011 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
14012 * // => { 'a': { 'b': 2, 'c': 3 } }
14014 var defaultsDeep = baseRest(function(args) {
14015 args.push(undefined, customDefaultsMerge);
14016 return apply(mergeWith, undefined, args);
14020 * This method is like `_.find` except that it returns the key of the first
14021 * element `predicate` returns truthy for instead of the element itself.
14027 * @param {Object} object The object to inspect.
14028 * @param {Function} [predicate=_.identity] The function invoked per iteration.
14029 * @returns {string|undefined} Returns the key of the matched element,
14030 * else `undefined`.
14034 * 'barney': { 'age': 36, 'active': true },
14035 * 'fred': { 'age': 40, 'active': false },
14036 * 'pebbles': { 'age': 1, 'active': true }
14039 * _.findKey(users, function(o) { return o.age < 40; });
14040 * // => 'barney' (iteration order is not guaranteed)
14042 * // The `_.matches` iteratee shorthand.
14043 * _.findKey(users, { 'age': 1, 'active': true });
14046 * // The `_.matchesProperty` iteratee shorthand.
14047 * _.findKey(users, ['active', false]);
14050 * // The `_.property` iteratee shorthand.
14051 * _.findKey(users, 'active');
14054 function findKey(object, predicate) {
14055 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
14059 * This method is like `_.findKey` except that it iterates over elements of
14060 * a collection in the opposite order.
14066 * @param {Object} object The object to inspect.
14067 * @param {Function} [predicate=_.identity] The function invoked per iteration.
14068 * @returns {string|undefined} Returns the key of the matched element,
14069 * else `undefined`.
14073 * 'barney': { 'age': 36, 'active': true },
14074 * 'fred': { 'age': 40, 'active': false },
14075 * 'pebbles': { 'age': 1, 'active': true }
14078 * _.findLastKey(users, function(o) { return o.age < 40; });
14079 * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
14081 * // The `_.matches` iteratee shorthand.
14082 * _.findLastKey(users, { 'age': 36, 'active': true });
14085 * // The `_.matchesProperty` iteratee shorthand.
14086 * _.findLastKey(users, ['active', false]);
14089 * // The `_.property` iteratee shorthand.
14090 * _.findLastKey(users, 'active');
14093 function findLastKey(object, predicate) {
14094 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
14098 * Iterates over own and inherited enumerable string keyed properties of an
14099 * object and invokes `iteratee` for each property. The iteratee is invoked
14100 * with three arguments: (value, key, object). Iteratee functions may exit
14101 * iteration early by explicitly returning `false`.
14107 * @param {Object} object The object to iterate over.
14108 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
14109 * @returns {Object} Returns `object`.
14110 * @see _.forInRight
14118 * Foo.prototype.c = 3;
14120 * _.forIn(new Foo, function(value, key) {
14121 * console.log(key);
14123 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
14125 function forIn(object, iteratee) {
14126 return object == null
14128 : baseFor(object, getIteratee(iteratee, 3), keysIn);
14132 * This method is like `_.forIn` except that it iterates over properties of
14133 * `object` in the opposite order.
14139 * @param {Object} object The object to iterate over.
14140 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
14141 * @returns {Object} Returns `object`.
14150 * Foo.prototype.c = 3;
14152 * _.forInRight(new Foo, function(value, key) {
14153 * console.log(key);
14155 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
14157 function forInRight(object, iteratee) {
14158 return object == null
14160 : baseForRight(object, getIteratee(iteratee, 3), keysIn);
14164 * Iterates over own enumerable string keyed properties of an object and
14165 * invokes `iteratee` for each property. The iteratee is invoked with three
14166 * arguments: (value, key, object). Iteratee functions may exit iteration
14167 * early by explicitly returning `false`.
14173 * @param {Object} object The object to iterate over.
14174 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
14175 * @returns {Object} Returns `object`.
14176 * @see _.forOwnRight
14184 * Foo.prototype.c = 3;
14186 * _.forOwn(new Foo, function(value, key) {
14187 * console.log(key);
14189 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
14191 function forOwn(object, iteratee) {
14192 return object && baseForOwn(object, getIteratee(iteratee, 3));
14196 * This method is like `_.forOwn` except that it iterates over properties of
14197 * `object` in the opposite order.
14203 * @param {Object} object The object to iterate over.
14204 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
14205 * @returns {Object} Returns `object`.
14214 * Foo.prototype.c = 3;
14216 * _.forOwnRight(new Foo, function(value, key) {
14217 * console.log(key);
14219 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
14221 function forOwnRight(object, iteratee) {
14222 return object && baseForOwnRight(object, getIteratee(iteratee, 3));
14226 * Creates an array of function property names from own enumerable properties
14233 * @param {Object} object The object to inspect.
14234 * @returns {Array} Returns the function names.
14235 * @see _.functionsIn
14239 * this.a = _.constant('a');
14240 * this.b = _.constant('b');
14243 * Foo.prototype.c = _.constant('c');
14245 * _.functions(new Foo);
14248 function functions(object) {
14249 return object == null ? [] : baseFunctions(object, keys(object));
14253 * Creates an array of function property names from own and inherited
14254 * enumerable properties of `object`.
14260 * @param {Object} object The object to inspect.
14261 * @returns {Array} Returns the function names.
14266 * this.a = _.constant('a');
14267 * this.b = _.constant('b');
14270 * Foo.prototype.c = _.constant('c');
14272 * _.functionsIn(new Foo);
14273 * // => ['a', 'b', 'c']
14275 function functionsIn(object) {
14276 return object == null ? [] : baseFunctions(object, keysIn(object));
14280 * Gets the value at `path` of `object`. If the resolved value is
14281 * `undefined`, the `defaultValue` is returned in its place.
14287 * @param {Object} object The object to query.
14288 * @param {Array|string} path The path of the property to get.
14289 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
14290 * @returns {*} Returns the resolved value.
14293 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
14295 * _.get(object, 'a[0].b.c');
14298 * _.get(object, ['a', '0', 'b', 'c']);
14301 * _.get(object, 'a.b.c', 'default');
14304 function get(object, path, defaultValue) {
14305 var result = object == null ? undefined : baseGet(object, path);
14306 return result === undefined ? defaultValue : result;
14310 * Checks if `path` is a direct property of `object`.
14316 * @param {Object} object The object to query.
14317 * @param {Array|string} path The path to check.
14318 * @returns {boolean} Returns `true` if `path` exists, else `false`.
14321 * var object = { 'a': { 'b': 2 } };
14322 * var other = _.create({ 'a': _.create({ 'b': 2 }) });
14324 * _.has(object, 'a');
14327 * _.has(object, 'a.b');
14330 * _.has(object, ['a', 'b']);
14333 * _.has(other, 'a');
14336 function has(object, path) {
14337 return object != null && hasPath(object, path, baseHas);
14341 * Checks if `path` is a direct or inherited property of `object`.
14347 * @param {Object} object The object to query.
14348 * @param {Array|string} path The path to check.
14349 * @returns {boolean} Returns `true` if `path` exists, else `false`.
14352 * var object = _.create({ 'a': _.create({ 'b': 2 }) });
14354 * _.hasIn(object, 'a');
14357 * _.hasIn(object, 'a.b');
14360 * _.hasIn(object, ['a', 'b']);
14363 * _.hasIn(object, 'b');
14366 function hasIn(object, path) {
14367 return object != null && hasPath(object, path, baseHasIn);
14371 * Creates an object composed of the inverted keys and values of `object`.
14372 * If `object` contains duplicate values, subsequent values overwrite
14373 * property assignments of previous values.
14379 * @param {Object} object The object to invert.
14380 * @returns {Object} Returns the new inverted object.
14383 * var object = { 'a': 1, 'b': 2, 'c': 1 };
14385 * _.invert(object);
14386 * // => { '1': 'c', '2': 'b' }
14388 var invert = createInverter(function(result, value, key) {
14389 if (value != null &&
14390 typeof value.toString != 'function') {
14391 value = nativeObjectToString.call(value);
14394 result[value] = key;
14395 }, constant(identity));
14398 * This method is like `_.invert` except that the inverted object is generated
14399 * from the results of running each element of `object` thru `iteratee`. The
14400 * corresponding inverted value of each inverted key is an array of keys
14401 * responsible for generating the inverted value. The iteratee is invoked
14402 * with one argument: (value).
14408 * @param {Object} object The object to invert.
14409 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
14410 * @returns {Object} Returns the new inverted object.
14413 * var object = { 'a': 1, 'b': 2, 'c': 1 };
14415 * _.invertBy(object);
14416 * // => { '1': ['a', 'c'], '2': ['b'] }
14418 * _.invertBy(object, function(value) {
14419 * return 'group' + value;
14421 * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
14423 var invertBy = createInverter(function(result, value, key) {
14424 if (value != null &&
14425 typeof value.toString != 'function') {
14426 value = nativeObjectToString.call(value);
14429 if (hasOwnProperty.call(result, value)) {
14430 result[value].push(key);
14432 result[value] = [key];
14437 * Invokes the method at `path` of `object`.
14443 * @param {Object} object The object to query.
14444 * @param {Array|string} path The path of the method to invoke.
14445 * @param {...*} [args] The arguments to invoke the method with.
14446 * @returns {*} Returns the result of the invoked method.
14449 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
14451 * _.invoke(object, 'a[0].b.c.slice', 1, 3);
14454 var invoke = baseRest(baseInvoke);
14457 * Creates an array of the own enumerable property names of `object`.
14459 * **Note:** Non-object values are coerced to objects. See the
14460 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
14461 * for more details.
14467 * @param {Object} object The object to query.
14468 * @returns {Array} Returns the array of property names.
14476 * Foo.prototype.c = 3;
14479 * // => ['a', 'b'] (iteration order is not guaranteed)
14484 function keys(object) {
14485 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
14489 * Creates an array of the own and inherited enumerable property names of `object`.
14491 * **Note:** Non-object values are coerced to objects.
14497 * @param {Object} object The object to query.
14498 * @returns {Array} Returns the array of property names.
14506 * Foo.prototype.c = 3;
14508 * _.keysIn(new Foo);
14509 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
14511 function keysIn(object) {
14512 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
14516 * The opposite of `_.mapValues`; this method creates an object with the
14517 * same values as `object` and keys generated by running each own enumerable
14518 * string keyed property of `object` thru `iteratee`. The iteratee is invoked
14519 * with three arguments: (value, key, object).
14525 * @param {Object} object The object to iterate over.
14526 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
14527 * @returns {Object} Returns the new mapped object.
14531 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
14532 * return key + value;
14534 * // => { 'a1': 1, 'b2': 2 }
14536 function mapKeys(object, iteratee) {
14538 iteratee = getIteratee(iteratee, 3);
14540 baseForOwn(object, function(value, key, object) {
14541 baseAssignValue(result, iteratee(value, key, object), value);
14547 * Creates an object with the same keys as `object` and values generated
14548 * by running each own enumerable string keyed property of `object` thru
14549 * `iteratee`. The iteratee is invoked with three arguments:
14550 * (value, key, object).
14556 * @param {Object} object The object to iterate over.
14557 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
14558 * @returns {Object} Returns the new mapped object.
14563 * 'fred': { 'user': 'fred', 'age': 40 },
14564 * 'pebbles': { 'user': 'pebbles', 'age': 1 }
14567 * _.mapValues(users, function(o) { return o.age; });
14568 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
14570 * // The `_.property` iteratee shorthand.
14571 * _.mapValues(users, 'age');
14572 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
14574 function mapValues(object, iteratee) {
14576 iteratee = getIteratee(iteratee, 3);
14578 baseForOwn(object, function(value, key, object) {
14579 baseAssignValue(result, key, iteratee(value, key, object));
14585 * This method is like `_.assign` except that it recursively merges own and
14586 * inherited enumerable string keyed properties of source objects into the
14587 * destination object. Source properties that resolve to `undefined` are
14588 * skipped if a destination value exists. Array and plain object properties
14589 * are merged recursively. Other objects and value types are overridden by
14590 * assignment. Source objects are applied from left to right. Subsequent
14591 * sources overwrite property assignments of previous sources.
14593 * **Note:** This method mutates `object`.
14599 * @param {Object} object The destination object.
14600 * @param {...Object} [sources] The source objects.
14601 * @returns {Object} Returns `object`.
14605 * 'a': [{ 'b': 2 }, { 'd': 4 }]
14609 * 'a': [{ 'c': 3 }, { 'e': 5 }]
14612 * _.merge(object, other);
14613 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
14615 var merge = createAssigner(function(object, source, srcIndex) {
14616 baseMerge(object, source, srcIndex);
14620 * This method is like `_.merge` except that it accepts `customizer` which
14621 * is invoked to produce the merged values of the destination and source
14622 * properties. If `customizer` returns `undefined`, merging is handled by the
14623 * method instead. The `customizer` is invoked with six arguments:
14624 * (objValue, srcValue, key, object, source, stack).
14626 * **Note:** This method mutates `object`.
14632 * @param {Object} object The destination object.
14633 * @param {...Object} sources The source objects.
14634 * @param {Function} customizer The function to customize assigned values.
14635 * @returns {Object} Returns `object`.
14638 * function customizer(objValue, srcValue) {
14639 * if (_.isArray(objValue)) {
14640 * return objValue.concat(srcValue);
14644 * var object = { 'a': [1], 'b': [2] };
14645 * var other = { 'a': [3], 'b': [4] };
14647 * _.mergeWith(object, other, customizer);
14648 * // => { 'a': [1, 3], 'b': [2, 4] }
14650 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
14651 baseMerge(object, source, srcIndex, customizer);
14655 * The opposite of `_.pick`; this method creates an object composed of the
14656 * own and inherited enumerable property paths of `object` that are not omitted.
14658 * **Note:** This method is considerably slower than `_.pick`.
14664 * @param {Object} object The source object.
14665 * @param {...(string|string[])} [paths] The property paths to omit.
14666 * @returns {Object} Returns the new object.
14669 * var object = { 'a': 1, 'b': '2', 'c': 3 };
14671 * _.omit(object, ['a', 'c']);
14672 * // => { 'b': '2' }
14674 var omit = flatRest(function(object, paths) {
14676 if (object == null) {
14679 var isDeep = false;
14680 paths = arrayMap(paths, function(path) {
14681 path = castPath(path, object);
14682 isDeep || (isDeep = path.length > 1);
14685 copyObject(object, getAllKeysIn(object), result);
14687 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
14689 var length = paths.length;
14691 baseUnset(result, paths[length]);
14697 * The opposite of `_.pickBy`; this method creates an object composed of
14698 * the own and inherited enumerable string keyed properties of `object` that
14699 * `predicate` doesn't return truthy for. The predicate is invoked with two
14700 * arguments: (value, key).
14706 * @param {Object} object The source object.
14707 * @param {Function} [predicate=_.identity] The function invoked per property.
14708 * @returns {Object} Returns the new object.
14711 * var object = { 'a': 1, 'b': '2', 'c': 3 };
14713 * _.omitBy(object, _.isNumber);
14714 * // => { 'b': '2' }
14716 function omitBy(object, predicate) {
14717 return pickBy(object, negate(getIteratee(predicate)));
14721 * Creates an object composed of the picked `object` properties.
14727 * @param {Object} object The source object.
14728 * @param {...(string|string[])} [paths] The property paths to pick.
14729 * @returns {Object} Returns the new object.
14732 * var object = { 'a': 1, 'b': '2', 'c': 3 };
14734 * _.pick(object, ['a', 'c']);
14735 * // => { 'a': 1, 'c': 3 }
14737 var pick = flatRest(function(object, paths) {
14738 return object == null ? {} : basePick(object, paths);
14742 * Creates an object composed of the `object` properties `predicate` returns
14743 * truthy for. The predicate is invoked with two arguments: (value, key).
14749 * @param {Object} object The source object.
14750 * @param {Function} [predicate=_.identity] The function invoked per property.
14751 * @returns {Object} Returns the new object.
14754 * var object = { 'a': 1, 'b': '2', 'c': 3 };
14756 * _.pickBy(object, _.isNumber);
14757 * // => { 'a': 1, 'c': 3 }
14759 function pickBy(object, predicate) {
14760 if (object == null) {
14763 var props = arrayMap(getAllKeysIn(object), function(prop) {
14766 predicate = getIteratee(predicate);
14767 return basePickBy(object, props, function(value, path) {
14768 return predicate(value, path[0]);
14773 * This method is like `_.get` except that if the resolved value is a
14774 * function it's invoked with the `this` binding of its parent object and
14775 * its result is returned.
14781 * @param {Object} object The object to query.
14782 * @param {Array|string} path The path of the property to resolve.
14783 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
14784 * @returns {*} Returns the resolved value.
14787 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
14789 * _.result(object, 'a[0].b.c1');
14792 * _.result(object, 'a[0].b.c2');
14795 * _.result(object, 'a[0].b.c3', 'default');
14798 * _.result(object, 'a[0].b.c3', _.constant('default'));
14801 function result(object, path, defaultValue) {
14802 path = castPath(path, object);
14805 length = path.length;
14807 // Ensure the loop is entered when path is empty.
14810 object = undefined;
14812 while (++index < length) {
14813 var value = object == null ? undefined : object[toKey(path[index])];
14814 if (value === undefined) {
14816 value = defaultValue;
14818 object = isFunction(value) ? value.call(object) : value;
14824 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
14825 * it's created. Arrays are created for missing index properties while objects
14826 * are created for all other missing properties. Use `_.setWith` to customize
14829 * **Note:** This method mutates `object`.
14835 * @param {Object} object The object to modify.
14836 * @param {Array|string} path The path of the property to set.
14837 * @param {*} value The value to set.
14838 * @returns {Object} Returns `object`.
14841 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
14843 * _.set(object, 'a[0].b.c', 4);
14844 * console.log(object.a[0].b.c);
14847 * _.set(object, ['x', '0', 'y', 'z'], 5);
14848 * console.log(object.x[0].y.z);
14851 function set(object, path, value) {
14852 return object == null ? object : baseSet(object, path, value);
14856 * This method is like `_.set` except that it accepts `customizer` which is
14857 * invoked to produce the objects of `path`. If `customizer` returns `undefined`
14858 * path creation is handled by the method instead. The `customizer` is invoked
14859 * with three arguments: (nsValue, key, nsObject).
14861 * **Note:** This method mutates `object`.
14867 * @param {Object} object The object to modify.
14868 * @param {Array|string} path The path of the property to set.
14869 * @param {*} value The value to set.
14870 * @param {Function} [customizer] The function to customize assigned values.
14871 * @returns {Object} Returns `object`.
14876 * _.setWith(object, '[0][1]', 'a', Object);
14877 * // => { '0': { '1': 'a' } }
14879 function setWith(object, path, value, customizer) {
14880 customizer = typeof customizer == 'function' ? customizer : undefined;
14881 return object == null ? object : baseSet(object, path, value, customizer);
14885 * Creates an array of own enumerable string keyed-value pairs for `object`
14886 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
14887 * entries are returned.
14894 * @param {Object} object The object to query.
14895 * @returns {Array} Returns the key-value pairs.
14903 * Foo.prototype.c = 3;
14905 * _.toPairs(new Foo);
14906 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
14908 var toPairs = createToPairs(keys);
14911 * Creates an array of own and inherited enumerable string keyed-value pairs
14912 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
14913 * or set, its entries are returned.
14920 * @param {Object} object The object to query.
14921 * @returns {Array} Returns the key-value pairs.
14929 * Foo.prototype.c = 3;
14931 * _.toPairsIn(new Foo);
14932 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
14934 var toPairsIn = createToPairs(keysIn);
14937 * An alternative to `_.reduce`; this method transforms `object` to a new
14938 * `accumulator` object which is the result of running each of its own
14939 * enumerable string keyed properties thru `iteratee`, with each invocation
14940 * potentially mutating the `accumulator` object. If `accumulator` is not
14941 * provided, a new object with the same `[[Prototype]]` will be used. The
14942 * iteratee is invoked with four arguments: (accumulator, value, key, object).
14943 * Iteratee functions may exit iteration early by explicitly returning `false`.
14949 * @param {Object} object The object to iterate over.
14950 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
14951 * @param {*} [accumulator] The custom accumulator value.
14952 * @returns {*} Returns the accumulated value.
14955 * _.transform([2, 3, 4], function(result, n) {
14956 * result.push(n *= n);
14957 * return n % 2 == 0;
14961 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
14962 * (result[value] || (result[value] = [])).push(key);
14964 * // => { '1': ['a', 'c'], '2': ['b'] }
14966 function transform(object, iteratee, accumulator) {
14967 var isArr = isArray(object),
14968 isArrLike = isArr || isBuffer(object) || isTypedArray(object);
14970 iteratee = getIteratee(iteratee, 4);
14971 if (accumulator == null) {
14972 var Ctor = object && object.constructor;
14974 accumulator = isArr ? new Ctor : [];
14976 else if (isObject(object)) {
14977 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
14983 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
14984 return iteratee(accumulator, value, index, object);
14986 return accumulator;
14990 * Removes the property at `path` of `object`.
14992 * **Note:** This method mutates `object`.
14998 * @param {Object} object The object to modify.
14999 * @param {Array|string} path The path of the property to unset.
15000 * @returns {boolean} Returns `true` if the property is deleted, else `false`.
15003 * var object = { 'a': [{ 'b': { 'c': 7 } }] };
15004 * _.unset(object, 'a[0].b.c');
15007 * console.log(object);
15008 * // => { 'a': [{ 'b': {} }] };
15010 * _.unset(object, ['a', '0', 'b', 'c']);
15013 * console.log(object);
15014 * // => { 'a': [{ 'b': {} }] };
15016 function unset(object, path) {
15017 return object == null ? true : baseUnset(object, path);
15021 * This method is like `_.set` except that accepts `updater` to produce the
15022 * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
15023 * is invoked with one argument: (value).
15025 * **Note:** This method mutates `object`.
15031 * @param {Object} object The object to modify.
15032 * @param {Array|string} path The path of the property to set.
15033 * @param {Function} updater The function to produce the updated value.
15034 * @returns {Object} Returns `object`.
15037 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
15039 * _.update(object, 'a[0].b.c', function(n) { return n * n; });
15040 * console.log(object.a[0].b.c);
15043 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
15044 * console.log(object.x[0].y.z);
15047 function update(object, path, updater) {
15048 return object == null ? object : baseUpdate(object, path, castFunction(updater));
15052 * This method is like `_.update` except that it accepts `customizer` which is
15053 * invoked to produce the objects of `path`. If `customizer` returns `undefined`
15054 * path creation is handled by the method instead. The `customizer` is invoked
15055 * with three arguments: (nsValue, key, nsObject).
15057 * **Note:** This method mutates `object`.
15063 * @param {Object} object The object to modify.
15064 * @param {Array|string} path The path of the property to set.
15065 * @param {Function} updater The function to produce the updated value.
15066 * @param {Function} [customizer] The function to customize assigned values.
15067 * @returns {Object} Returns `object`.
15072 * _.updateWith(object, '[0][1]', _.constant('a'), Object);
15073 * // => { '0': { '1': 'a' } }
15075 function updateWith(object, path, updater, customizer) {
15076 customizer = typeof customizer == 'function' ? customizer : undefined;
15077 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
15081 * Creates an array of the own enumerable string keyed property values of `object`.
15083 * **Note:** Non-object values are coerced to objects.
15089 * @param {Object} object The object to query.
15090 * @returns {Array} Returns the array of property values.
15098 * Foo.prototype.c = 3;
15100 * _.values(new Foo);
15101 * // => [1, 2] (iteration order is not guaranteed)
15106 function values(object) {
15107 return object == null ? [] : baseValues(object, keys(object));
15111 * Creates an array of the own and inherited enumerable string keyed property
15112 * values of `object`.
15114 * **Note:** Non-object values are coerced to objects.
15120 * @param {Object} object The object to query.
15121 * @returns {Array} Returns the array of property values.
15129 * Foo.prototype.c = 3;
15131 * _.valuesIn(new Foo);
15132 * // => [1, 2, 3] (iteration order is not guaranteed)
15134 function valuesIn(object) {
15135 return object == null ? [] : baseValues(object, keysIn(object));
15138 /*------------------------------------------------------------------------*/
15141 * Clamps `number` within the inclusive `lower` and `upper` bounds.
15147 * @param {number} number The number to clamp.
15148 * @param {number} [lower] The lower bound.
15149 * @param {number} upper The upper bound.
15150 * @returns {number} Returns the clamped number.
15153 * _.clamp(-10, -5, 5);
15156 * _.clamp(10, -5, 5);
15159 function clamp(number, lower, upper) {
15160 if (upper === undefined) {
15164 if (upper !== undefined) {
15165 upper = toNumber(upper);
15166 upper = upper === upper ? upper : 0;
15168 if (lower !== undefined) {
15169 lower = toNumber(lower);
15170 lower = lower === lower ? lower : 0;
15172 return baseClamp(toNumber(number), lower, upper);
15176 * Checks if `n` is between `start` and up to, but not including, `end`. If
15177 * `end` is not specified, it's set to `start` with `start` then set to `0`.
15178 * If `start` is greater than `end` the params are swapped to support
15185 * @param {number} number The number to check.
15186 * @param {number} [start=0] The start of the range.
15187 * @param {number} end The end of the range.
15188 * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
15189 * @see _.range, _.rangeRight
15192 * _.inRange(3, 2, 4);
15204 * _.inRange(1.2, 2);
15207 * _.inRange(5.2, 4);
15210 * _.inRange(-3, -2, -6);
15213 function inRange(number, start, end) {
15214 start = toFinite(start);
15215 if (end === undefined) {
15219 end = toFinite(end);
15221 number = toNumber(number);
15222 return baseInRange(number, start, end);
15226 * Produces a random number between the inclusive `lower` and `upper` bounds.
15227 * If only one argument is provided a number between `0` and the given number
15228 * is returned. If `floating` is `true`, or either `lower` or `upper` are
15229 * floats, a floating-point number is returned instead of an integer.
15231 * **Note:** JavaScript follows the IEEE-754 standard for resolving
15232 * floating-point values which can produce unexpected results.
15238 * @param {number} [lower=0] The lower bound.
15239 * @param {number} [upper=1] The upper bound.
15240 * @param {boolean} [floating] Specify returning a floating-point number.
15241 * @returns {number} Returns the random number.
15245 * // => an integer between 0 and 5
15248 * // => also an integer between 0 and 5
15250 * _.random(5, true);
15251 * // => a floating-point number between 0 and 5
15253 * _.random(1.2, 5.2);
15254 * // => a floating-point number between 1.2 and 5.2
15256 function random(lower, upper, floating) {
15257 if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
15258 upper = floating = undefined;
15260 if (floating === undefined) {
15261 if (typeof upper == 'boolean') {
15265 else if (typeof lower == 'boolean') {
15270 if (lower === undefined && upper === undefined) {
15275 lower = toFinite(lower);
15276 if (upper === undefined) {
15280 upper = toFinite(upper);
15283 if (lower > upper) {
15288 if (floating || lower % 1 || upper % 1) {
15289 var rand = nativeRandom();
15290 return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
15292 return baseRandom(lower, upper);
15295 /*------------------------------------------------------------------------*/
15298 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
15304 * @param {string} [string=''] The string to convert.
15305 * @returns {string} Returns the camel cased string.
15308 * _.camelCase('Foo Bar');
15311 * _.camelCase('--foo-bar--');
15314 * _.camelCase('__FOO_BAR__');
15317 var camelCase = createCompounder(function(result, word, index) {
15318 word = word.toLowerCase();
15319 return result + (index ? capitalize(word) : word);
15323 * Converts the first character of `string` to upper case and the remaining
15330 * @param {string} [string=''] The string to capitalize.
15331 * @returns {string} Returns the capitalized string.
15334 * _.capitalize('FRED');
15337 function capitalize(string) {
15338 return upperFirst(toString(string).toLowerCase());
15342 * Deburrs `string` by converting
15343 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
15344 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
15345 * letters to basic Latin letters and removing
15346 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
15352 * @param {string} [string=''] The string to deburr.
15353 * @returns {string} Returns the deburred string.
15356 * _.deburr('déjà vu');
15359 function deburr(string) {
15360 string = toString(string);
15361 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
15365 * Checks if `string` ends with the given target string.
15371 * @param {string} [string=''] The string to inspect.
15372 * @param {string} [target] The string to search for.
15373 * @param {number} [position=string.length] The position to search up to.
15374 * @returns {boolean} Returns `true` if `string` ends with `target`,
15378 * _.endsWith('abc', 'c');
15381 * _.endsWith('abc', 'b');
15384 * _.endsWith('abc', 'b', 2);
15387 function endsWith(string, target, position) {
15388 string = toString(string);
15389 target = baseToString(target);
15391 var length = string.length;
15392 position = position === undefined
15394 : baseClamp(toInteger(position), 0, length);
15396 var end = position;
15397 position -= target.length;
15398 return position >= 0 && string.slice(position, end) == target;
15402 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
15403 * corresponding HTML entities.
15405 * **Note:** No other characters are escaped. To escape additional
15406 * characters use a third-party library like [_he_](https://mths.be/he).
15408 * Though the ">" character is escaped for symmetry, characters like
15409 * ">" and "/" don't need escaping in HTML and have no special meaning
15410 * unless they're part of a tag or unquoted attribute value. See
15411 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
15412 * (under "semi-related fun fact") for more details.
15414 * When working with HTML you should always
15415 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
15422 * @param {string} [string=''] The string to escape.
15423 * @returns {string} Returns the escaped string.
15426 * _.escape('fred, barney, & pebbles');
15427 * // => 'fred, barney, & pebbles'
15429 function escape(string) {
15430 string = toString(string);
15431 return (string && reHasUnescapedHtml.test(string))
15432 ? string.replace(reUnescapedHtml, escapeHtmlChar)
15437 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
15438 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
15444 * @param {string} [string=''] The string to escape.
15445 * @returns {string} Returns the escaped string.
15448 * _.escapeRegExp('[lodash](https://lodash.com/)');
15449 * // => '\[lodash\]\(https://lodash\.com/\)'
15451 function escapeRegExp(string) {
15452 string = toString(string);
15453 return (string && reHasRegExpChar.test(string))
15454 ? string.replace(reRegExpChar, '\\$&')
15459 * Converts `string` to
15460 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
15466 * @param {string} [string=''] The string to convert.
15467 * @returns {string} Returns the kebab cased string.
15470 * _.kebabCase('Foo Bar');
15473 * _.kebabCase('fooBar');
15476 * _.kebabCase('__FOO_BAR__');
15479 var kebabCase = createCompounder(function(result, word, index) {
15480 return result + (index ? '-' : '') + word.toLowerCase();
15484 * Converts `string`, as space separated words, to lower case.
15490 * @param {string} [string=''] The string to convert.
15491 * @returns {string} Returns the lower cased string.
15494 * _.lowerCase('--Foo-Bar--');
15497 * _.lowerCase('fooBar');
15500 * _.lowerCase('__FOO_BAR__');
15503 var lowerCase = createCompounder(function(result, word, index) {
15504 return result + (index ? ' ' : '') + word.toLowerCase();
15508 * Converts the first character of `string` to lower case.
15514 * @param {string} [string=''] The string to convert.
15515 * @returns {string} Returns the converted string.
15518 * _.lowerFirst('Fred');
15521 * _.lowerFirst('FRED');
15524 var lowerFirst = createCaseFirst('toLowerCase');
15527 * Pads `string` on the left and right sides if it's shorter than `length`.
15528 * Padding characters are truncated if they can't be evenly divided by `length`.
15534 * @param {string} [string=''] The string to pad.
15535 * @param {number} [length=0] The padding length.
15536 * @param {string} [chars=' '] The string used as padding.
15537 * @returns {string} Returns the padded string.
15543 * _.pad('abc', 8, '_-');
15549 function pad(string, length, chars) {
15550 string = toString(string);
15551 length = toInteger(length);
15553 var strLength = length ? stringSize(string) : 0;
15554 if (!length || strLength >= length) {
15557 var mid = (length - strLength) / 2;
15559 createPadding(nativeFloor(mid), chars) +
15561 createPadding(nativeCeil(mid), chars)
15566 * Pads `string` on the right side if it's shorter than `length`. Padding
15567 * characters are truncated if they exceed `length`.
15573 * @param {string} [string=''] The string to pad.
15574 * @param {number} [length=0] The padding length.
15575 * @param {string} [chars=' '] The string used as padding.
15576 * @returns {string} Returns the padded string.
15579 * _.padEnd('abc', 6);
15582 * _.padEnd('abc', 6, '_-');
15585 * _.padEnd('abc', 3);
15588 function padEnd(string, length, chars) {
15589 string = toString(string);
15590 length = toInteger(length);
15592 var strLength = length ? stringSize(string) : 0;
15593 return (length && strLength < length)
15594 ? (string + createPadding(length - strLength, chars))
15599 * Pads `string` on the left side if it's shorter than `length`. Padding
15600 * characters are truncated if they exceed `length`.
15606 * @param {string} [string=''] The string to pad.
15607 * @param {number} [length=0] The padding length.
15608 * @param {string} [chars=' '] The string used as padding.
15609 * @returns {string} Returns the padded string.
15612 * _.padStart('abc', 6);
15615 * _.padStart('abc', 6, '_-');
15618 * _.padStart('abc', 3);
15621 function padStart(string, length, chars) {
15622 string = toString(string);
15623 length = toInteger(length);
15625 var strLength = length ? stringSize(string) : 0;
15626 return (length && strLength < length)
15627 ? (createPadding(length - strLength, chars) + string)
15632 * Converts `string` to an integer of the specified radix. If `radix` is
15633 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
15634 * hexadecimal, in which case a `radix` of `16` is used.
15636 * **Note:** This method aligns with the
15637 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
15643 * @param {string} string The string to convert.
15644 * @param {number} [radix=10] The radix to interpret `value` by.
15645 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15646 * @returns {number} Returns the converted integer.
15649 * _.parseInt('08');
15652 * _.map(['6', '08', '10'], _.parseInt);
15655 function parseInt(string, radix, guard) {
15656 if (guard || radix == null) {
15658 } else if (radix) {
15661 return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
15665 * Repeats the given string `n` times.
15671 * @param {string} [string=''] The string to repeat.
15672 * @param {number} [n=1] The number of times to repeat the string.
15673 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15674 * @returns {string} Returns the repeated string.
15677 * _.repeat('*', 3);
15680 * _.repeat('abc', 2);
15683 * _.repeat('abc', 0);
15686 function repeat(string, n, guard) {
15687 if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
15692 return baseRepeat(toString(string), n);
15696 * Replaces matches for `pattern` in `string` with `replacement`.
15698 * **Note:** This method is based on
15699 * [`String#replace`](https://mdn.io/String/replace).
15705 * @param {string} [string=''] The string to modify.
15706 * @param {RegExp|string} pattern The pattern to replace.
15707 * @param {Function|string} replacement The match replacement.
15708 * @returns {string} Returns the modified string.
15711 * _.replace('Hi Fred', 'Fred', 'Barney');
15712 * // => 'Hi Barney'
15714 function replace() {
15715 var args = arguments,
15716 string = toString(args[0]);
15718 return args.length < 3 ? string : string.replace(args[1], args[2]);
15722 * Converts `string` to
15723 * [snake case](https://en.wikipedia.org/wiki/Snake_case).
15729 * @param {string} [string=''] The string to convert.
15730 * @returns {string} Returns the snake cased string.
15733 * _.snakeCase('Foo Bar');
15736 * _.snakeCase('fooBar');
15739 * _.snakeCase('--FOO-BAR--');
15742 var snakeCase = createCompounder(function(result, word, index) {
15743 return result + (index ? '_' : '') + word.toLowerCase();
15747 * Splits `string` by `separator`.
15749 * **Note:** This method is based on
15750 * [`String#split`](https://mdn.io/String/split).
15756 * @param {string} [string=''] The string to split.
15757 * @param {RegExp|string} separator The separator pattern to split by.
15758 * @param {number} [limit] The length to truncate results to.
15759 * @returns {Array} Returns the string segments.
15762 * _.split('a-b-c', '-', 2);
15765 function split(string, separator, limit) {
15766 if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
15767 separator = limit = undefined;
15769 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
15773 string = toString(string);
15775 typeof separator == 'string' ||
15776 (separator != null && !isRegExp(separator))
15778 separator = baseToString(separator);
15779 if (!separator && hasUnicode(string)) {
15780 return castSlice(stringToArray(string), 0, limit);
15783 return string.split(separator, limit);
15787 * Converts `string` to
15788 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
15794 * @param {string} [string=''] The string to convert.
15795 * @returns {string} Returns the start cased string.
15798 * _.startCase('--foo-bar--');
15801 * _.startCase('fooBar');
15804 * _.startCase('__FOO_BAR__');
15807 var startCase = createCompounder(function(result, word, index) {
15808 return result + (index ? ' ' : '') + upperFirst(word);
15812 * Checks if `string` starts with the given target string.
15818 * @param {string} [string=''] The string to inspect.
15819 * @param {string} [target] The string to search for.
15820 * @param {number} [position=0] The position to search from.
15821 * @returns {boolean} Returns `true` if `string` starts with `target`,
15825 * _.startsWith('abc', 'a');
15828 * _.startsWith('abc', 'b');
15831 * _.startsWith('abc', 'b', 1);
15834 function startsWith(string, target, position) {
15835 string = toString(string);
15836 position = position == null
15838 : baseClamp(toInteger(position), 0, string.length);
15840 target = baseToString(target);
15841 return string.slice(position, position + target.length) == target;
15845 * Creates a compiled template function that can interpolate data properties
15846 * in "interpolate" delimiters, HTML-escape interpolated data properties in
15847 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
15848 * properties may be accessed as free variables in the template. If a setting
15849 * object is given, it takes precedence over `_.templateSettings` values.
15851 * **Note:** In the development build `_.template` utilizes
15852 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
15853 * for easier debugging.
15855 * For more information on precompiling templates see
15856 * [lodash's custom builds documentation](https://lodash.com/custom-builds).
15858 * For more information on Chrome extension sandboxes see
15859 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
15865 * @param {string} [string=''] The template string.
15866 * @param {Object} [options={}] The options object.
15867 * @param {RegExp} [options.escape=_.templateSettings.escape]
15868 * The HTML "escape" delimiter.
15869 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
15870 * The "evaluate" delimiter.
15871 * @param {Object} [options.imports=_.templateSettings.imports]
15872 * An object to import into the template as free variables.
15873 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
15874 * The "interpolate" delimiter.
15875 * @param {string} [options.sourceURL='lodash.templateSources[n]']
15876 * The sourceURL of the compiled template.
15877 * @param {string} [options.variable='obj']
15878 * The data object variable name.
15879 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15880 * @returns {Function} Returns the compiled template function.
15883 * // Use the "interpolate" delimiter to create a compiled template.
15884 * var compiled = _.template('hello <%= user %>!');
15885 * compiled({ 'user': 'fred' });
15886 * // => 'hello fred!'
15888 * // Use the HTML "escape" delimiter to escape data property values.
15889 * var compiled = _.template('<b><%- value %></b>');
15890 * compiled({ 'value': '<script>' });
15891 * // => '<b><script></b>'
15893 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
15894 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
15895 * compiled({ 'users': ['fred', 'barney'] });
15896 * // => '<li>fred</li><li>barney</li>'
15898 * // Use the internal `print` function in "evaluate" delimiters.
15899 * var compiled = _.template('<% print("hello " + user); %>!');
15900 * compiled({ 'user': 'barney' });
15901 * // => 'hello barney!'
15903 * // Use the ES template literal delimiter as an "interpolate" delimiter.
15904 * // Disable support by replacing the "interpolate" delimiter.
15905 * var compiled = _.template('hello ${ user }!');
15906 * compiled({ 'user': 'pebbles' });
15907 * // => 'hello pebbles!'
15909 * // Use backslashes to treat delimiters as plain text.
15910 * var compiled = _.template('<%= "\\<%- value %\\>" %>');
15911 * compiled({ 'value': 'ignored' });
15912 * // => '<%- value %>'
15914 * // Use the `imports` option to import `jQuery` as `jq`.
15915 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
15916 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
15917 * compiled({ 'users': ['fred', 'barney'] });
15918 * // => '<li>fred</li><li>barney</li>'
15920 * // Use the `sourceURL` option to specify a custom sourceURL for the template.
15921 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
15923 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
15925 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
15926 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
15928 * // => function(data) {
15929 * // var __t, __p = '';
15930 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
15934 * // Use custom template delimiters.
15935 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
15936 * var compiled = _.template('hello {{ user }}!');
15937 * compiled({ 'user': 'mustache' });
15938 * // => 'hello mustache!'
15940 * // Use the `source` property to inline compiled templates for meaningful
15941 * // line numbers in error messages and stack traces.
15942 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
15944 * "main": ' + _.template(mainText).source + '\
15948 function template(string, options, guard) {
15949 // Based on John Resig's `tmpl` implementation
15950 // (http://ejohn.org/blog/javascript-micro-templating/)
15951 // and Laura Doktorova's doT.js (https://github.com/olado/doT).
15952 var settings = lodash.templateSettings;
15954 if (guard && isIterateeCall(string, options, guard)) {
15955 options = undefined;
15957 string = toString(string);
15958 options = assignInWith({}, options, settings, customDefaultsAssignIn);
15960 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
15961 importsKeys = keys(imports),
15962 importsValues = baseValues(imports, importsKeys);
15967 interpolate = options.interpolate || reNoMatch,
15968 source = "__p += '";
15970 // Compile the regexp to match each delimiter.
15971 var reDelimiters = RegExp(
15972 (options.escape || reNoMatch).source + '|' +
15973 interpolate.source + '|' +
15974 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
15975 (options.evaluate || reNoMatch).source + '|$'
15978 // Use a sourceURL for easier debugging.
15979 // The sourceURL gets injected into the source that's eval-ed, so be careful
15980 // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
15981 // and escape the comment, thus injecting code that gets evaled.
15982 var sourceURL = '//# sourceURL=' +
15983 (hasOwnProperty.call(options, 'sourceURL')
15984 ? (options.sourceURL + '').replace(/\s/g, ' ')
15985 : ('lodash.templateSources[' + (++templateCounter) + ']')
15988 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
15989 interpolateValue || (interpolateValue = esTemplateValue);
15991 // Escape characters that can't be included in string literals.
15992 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
15994 // Replace delimiters with snippets.
15997 source += "' +\n__e(" + escapeValue + ") +\n'";
15999 if (evaluateValue) {
16000 isEvaluating = true;
16001 source += "';\n" + evaluateValue + ";\n__p += '";
16003 if (interpolateValue) {
16004 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
16006 index = offset + match.length;
16008 // The JS engine embedded in Adobe products needs `match` returned in
16009 // order to produce the correct `offset` value.
16015 // If `variable` is not specified wrap a with-statement around the generated
16016 // code to add the data object to the top of the scope chain.
16017 var variable = hasOwnProperty.call(options, 'variable') && options.variable;
16019 source = 'with (obj) {\n' + source + '\n}\n';
16021 // Throw an error if a forbidden character was found in `variable`, to prevent
16022 // potential command injection attacks.
16023 else if (reForbiddenIdentifierChars.test(variable)) {
16024 throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
16027 // Cleanup code by stripping empty strings.
16028 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
16029 .replace(reEmptyStringMiddle, '$1')
16030 .replace(reEmptyStringTrailing, '$1;');
16032 // Frame code as the function body.
16033 source = 'function(' + (variable || 'obj') + ') {\n' +
16036 : 'obj || (obj = {});\n'
16038 "var __t, __p = ''" +
16040 ? ', __e = _.escape'
16044 ? ', __j = Array.prototype.join;\n' +
16045 "function print() { __p += __j.call(arguments, '') }\n"
16051 var result = attempt(function() {
16052 return Function(importsKeys, sourceURL + 'return ' + source)
16053 .apply(undefined, importsValues);
16056 // Provide the compiled function's source by its `toString` method or
16057 // the `source` property as a convenience for inlining compiled templates.
16058 result.source = source;
16059 if (isError(result)) {
16066 * Converts `string`, as a whole, to lower case just like
16067 * [String#toLowerCase](https://mdn.io/toLowerCase).
16073 * @param {string} [string=''] The string to convert.
16074 * @returns {string} Returns the lower cased string.
16077 * _.toLower('--Foo-Bar--');
16078 * // => '--foo-bar--'
16080 * _.toLower('fooBar');
16083 * _.toLower('__FOO_BAR__');
16084 * // => '__foo_bar__'
16086 function toLower(value) {
16087 return toString(value).toLowerCase();
16091 * Converts `string`, as a whole, to upper case just like
16092 * [String#toUpperCase](https://mdn.io/toUpperCase).
16098 * @param {string} [string=''] The string to convert.
16099 * @returns {string} Returns the upper cased string.
16102 * _.toUpper('--foo-bar--');
16103 * // => '--FOO-BAR--'
16105 * _.toUpper('fooBar');
16108 * _.toUpper('__foo_bar__');
16109 * // => '__FOO_BAR__'
16111 function toUpper(value) {
16112 return toString(value).toUpperCase();
16116 * Removes leading and trailing whitespace or specified characters from `string`.
16122 * @param {string} [string=''] The string to trim.
16123 * @param {string} [chars=whitespace] The characters to trim.
16124 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
16125 * @returns {string} Returns the trimmed string.
16131 * _.trim('-_-abc-_-', '_-');
16134 * _.map([' foo ', ' bar '], _.trim);
16135 * // => ['foo', 'bar']
16137 function trim(string, chars, guard) {
16138 string = toString(string);
16139 if (string && (guard || chars === undefined)) {
16140 return baseTrim(string);
16142 if (!string || !(chars = baseToString(chars))) {
16145 var strSymbols = stringToArray(string),
16146 chrSymbols = stringToArray(chars),
16147 start = charsStartIndex(strSymbols, chrSymbols),
16148 end = charsEndIndex(strSymbols, chrSymbols) + 1;
16150 return castSlice(strSymbols, start, end).join('');
16154 * Removes trailing whitespace or specified characters from `string`.
16160 * @param {string} [string=''] The string to trim.
16161 * @param {string} [chars=whitespace] The characters to trim.
16162 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
16163 * @returns {string} Returns the trimmed string.
16166 * _.trimEnd(' abc ');
16169 * _.trimEnd('-_-abc-_-', '_-');
16172 function trimEnd(string, chars, guard) {
16173 string = toString(string);
16174 if (string && (guard || chars === undefined)) {
16175 return string.slice(0, trimmedEndIndex(string) + 1);
16177 if (!string || !(chars = baseToString(chars))) {
16180 var strSymbols = stringToArray(string),
16181 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
16183 return castSlice(strSymbols, 0, end).join('');
16187 * Removes leading whitespace or specified characters from `string`.
16193 * @param {string} [string=''] The string to trim.
16194 * @param {string} [chars=whitespace] The characters to trim.
16195 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
16196 * @returns {string} Returns the trimmed string.
16199 * _.trimStart(' abc ');
16202 * _.trimStart('-_-abc-_-', '_-');
16205 function trimStart(string, chars, guard) {
16206 string = toString(string);
16207 if (string && (guard || chars === undefined)) {
16208 return string.replace(reTrimStart, '');
16210 if (!string || !(chars = baseToString(chars))) {
16213 var strSymbols = stringToArray(string),
16214 start = charsStartIndex(strSymbols, stringToArray(chars));
16216 return castSlice(strSymbols, start).join('');
16220 * Truncates `string` if it's longer than the given maximum string length.
16221 * The last characters of the truncated string are replaced with the omission
16222 * string which defaults to "...".
16228 * @param {string} [string=''] The string to truncate.
16229 * @param {Object} [options={}] The options object.
16230 * @param {number} [options.length=30] The maximum string length.
16231 * @param {string} [options.omission='...'] The string to indicate text is omitted.
16232 * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
16233 * @returns {string} Returns the truncated string.
16236 * _.truncate('hi-diddly-ho there, neighborino');
16237 * // => 'hi-diddly-ho there, neighbo...'
16239 * _.truncate('hi-diddly-ho there, neighborino', {
16243 * // => 'hi-diddly-ho there,...'
16245 * _.truncate('hi-diddly-ho there, neighborino', {
16247 * 'separator': /,? +/
16249 * // => 'hi-diddly-ho there...'
16251 * _.truncate('hi-diddly-ho there, neighborino', {
16252 * 'omission': ' [...]'
16254 * // => 'hi-diddly-ho there, neig [...]'
16256 function truncate(string, options) {
16257 var length = DEFAULT_TRUNC_LENGTH,
16258 omission = DEFAULT_TRUNC_OMISSION;
16260 if (isObject(options)) {
16261 var separator = 'separator' in options ? options.separator : separator;
16262 length = 'length' in options ? toInteger(options.length) : length;
16263 omission = 'omission' in options ? baseToString(options.omission) : omission;
16265 string = toString(string);
16267 var strLength = string.length;
16268 if (hasUnicode(string)) {
16269 var strSymbols = stringToArray(string);
16270 strLength = strSymbols.length;
16272 if (length >= strLength) {
16275 var end = length - stringSize(omission);
16279 var result = strSymbols
16280 ? castSlice(strSymbols, 0, end).join('')
16281 : string.slice(0, end);
16283 if (separator === undefined) {
16284 return result + omission;
16287 end += (result.length - end);
16289 if (isRegExp(separator)) {
16290 if (string.slice(end).search(separator)) {
16292 substring = result;
16294 if (!separator.global) {
16295 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
16297 separator.lastIndex = 0;
16298 while ((match = separator.exec(substring))) {
16299 var newEnd = match.index;
16301 result = result.slice(0, newEnd === undefined ? end : newEnd);
16303 } else if (string.indexOf(baseToString(separator), end) != end) {
16304 var index = result.lastIndexOf(separator);
16306 result = result.slice(0, index);
16309 return result + omission;
16313 * The inverse of `_.escape`; this method converts the HTML entities
16314 * `&`, `<`, `>`, `"`, and `'` in `string` to
16315 * their corresponding characters.
16317 * **Note:** No other HTML entities are unescaped. To unescape additional
16318 * HTML entities use a third-party library like [_he_](https://mths.be/he).
16324 * @param {string} [string=''] The string to unescape.
16325 * @returns {string} Returns the unescaped string.
16328 * _.unescape('fred, barney, & pebbles');
16329 * // => 'fred, barney, & pebbles'
16331 function unescape(string) {
16332 string = toString(string);
16333 return (string && reHasEscapedHtml.test(string))
16334 ? string.replace(reEscapedHtml, unescapeHtmlChar)
16339 * Converts `string`, as space separated words, to upper case.
16345 * @param {string} [string=''] The string to convert.
16346 * @returns {string} Returns the upper cased string.
16349 * _.upperCase('--foo-bar');
16352 * _.upperCase('fooBar');
16355 * _.upperCase('__foo_bar__');
16358 var upperCase = createCompounder(function(result, word, index) {
16359 return result + (index ? ' ' : '') + word.toUpperCase();
16363 * Converts the first character of `string` to upper case.
16369 * @param {string} [string=''] The string to convert.
16370 * @returns {string} Returns the converted string.
16373 * _.upperFirst('fred');
16376 * _.upperFirst('FRED');
16379 var upperFirst = createCaseFirst('toUpperCase');
16382 * Splits `string` into an array of its words.
16388 * @param {string} [string=''] The string to inspect.
16389 * @param {RegExp|string} [pattern] The pattern to match words.
16390 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
16391 * @returns {Array} Returns the words of `string`.
16394 * _.words('fred, barney, & pebbles');
16395 * // => ['fred', 'barney', 'pebbles']
16397 * _.words('fred, barney, & pebbles', /[^, ]+/g);
16398 * // => ['fred', 'barney', '&', 'pebbles']
16400 function words(string, pattern, guard) {
16401 string = toString(string);
16402 pattern = guard ? undefined : pattern;
16404 if (pattern === undefined) {
16405 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
16407 return string.match(pattern) || [];
16410 /*------------------------------------------------------------------------*/
16413 * Attempts to invoke `func`, returning either the result or the caught error
16414 * object. Any additional arguments are provided to `func` when it's invoked.
16420 * @param {Function} func The function to attempt.
16421 * @param {...*} [args] The arguments to invoke `func` with.
16422 * @returns {*} Returns the `func` result or error object.
16425 * // Avoid throwing errors for invalid selectors.
16426 * var elements = _.attempt(function(selector) {
16427 * return document.querySelectorAll(selector);
16430 * if (_.isError(elements)) {
16434 var attempt = baseRest(function(func, args) {
16436 return apply(func, undefined, args);
16438 return isError(e) ? e : new Error(e);
16443 * Binds methods of an object to the object itself, overwriting the existing
16446 * **Note:** This method doesn't set the "length" property of bound functions.
16452 * @param {Object} object The object to bind and assign the bound methods to.
16453 * @param {...(string|string[])} methodNames The object method names to bind.
16454 * @returns {Object} Returns `object`.
16459 * 'click': function() {
16460 * console.log('clicked ' + this.label);
16464 * _.bindAll(view, ['click']);
16465 * jQuery(element).on('click', view.click);
16466 * // => Logs 'clicked docs' when clicked.
16468 var bindAll = flatRest(function(object, methodNames) {
16469 arrayEach(methodNames, function(key) {
16471 baseAssignValue(object, key, bind(object[key], object));
16477 * Creates a function that iterates over `pairs` and invokes the corresponding
16478 * function of the first predicate to return truthy. The predicate-function
16479 * pairs are invoked with the `this` binding and arguments of the created
16486 * @param {Array} pairs The predicate-function pairs.
16487 * @returns {Function} Returns the new composite function.
16490 * var func = _.cond([
16491 * [_.matches({ 'a': 1 }), _.constant('matches A')],
16492 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
16493 * [_.stubTrue, _.constant('no match')]
16496 * func({ 'a': 1, 'b': 2 });
16497 * // => 'matches A'
16499 * func({ 'a': 0, 'b': 1 });
16500 * // => 'matches B'
16502 * func({ 'a': '1', 'b': '2' });
16505 function cond(pairs) {
16506 var length = pairs == null ? 0 : pairs.length,
16507 toIteratee = getIteratee();
16509 pairs = !length ? [] : arrayMap(pairs, function(pair) {
16510 if (typeof pair[1] != 'function') {
16511 throw new TypeError(FUNC_ERROR_TEXT);
16513 return [toIteratee(pair[0]), pair[1]];
16516 return baseRest(function(args) {
16518 while (++index < length) {
16519 var pair = pairs[index];
16520 if (apply(pair[0], this, args)) {
16521 return apply(pair[1], this, args);
16528 * Creates a function that invokes the predicate properties of `source` with
16529 * the corresponding property values of a given object, returning `true` if
16530 * all predicates return truthy, else `false`.
16532 * **Note:** The created function is equivalent to `_.conformsTo` with
16533 * `source` partially applied.
16539 * @param {Object} source The object of property predicates to conform to.
16540 * @returns {Function} Returns the new spec function.
16544 * { 'a': 2, 'b': 1 },
16545 * { 'a': 1, 'b': 2 }
16548 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
16549 * // => [{ 'a': 1, 'b': 2 }]
16551 function conforms(source) {
16552 return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
16556 * Creates a function that returns `value`.
16562 * @param {*} value The value to return from the new function.
16563 * @returns {Function} Returns the new constant function.
16566 * var objects = _.times(2, _.constant({ 'a': 1 }));
16568 * console.log(objects);
16569 * // => [{ 'a': 1 }, { 'a': 1 }]
16571 * console.log(objects[0] === objects[1]);
16574 function constant(value) {
16575 return function() {
16581 * Checks `value` to determine whether a default value should be returned in
16582 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
16589 * @param {*} value The value to check.
16590 * @param {*} defaultValue The default value.
16591 * @returns {*} Returns the resolved value.
16594 * _.defaultTo(1, 10);
16597 * _.defaultTo(undefined, 10);
16600 function defaultTo(value, defaultValue) {
16601 return (value == null || value !== value) ? defaultValue : value;
16605 * Creates a function that returns the result of invoking the given functions
16606 * with the `this` binding of the created function, where each successive
16607 * invocation is supplied the return value of the previous.
16613 * @param {...(Function|Function[])} [funcs] The functions to invoke.
16614 * @returns {Function} Returns the new composite function.
16618 * function square(n) {
16622 * var addSquare = _.flow([_.add, square]);
16626 var flow = createFlow();
16629 * This method is like `_.flow` except that it creates a function that
16630 * invokes the given functions from right to left.
16636 * @param {...(Function|Function[])} [funcs] The functions to invoke.
16637 * @returns {Function} Returns the new composite function.
16641 * function square(n) {
16645 * var addSquare = _.flowRight([square, _.add]);
16649 var flowRight = createFlow(true);
16652 * This method returns the first argument it receives.
16658 * @param {*} value Any value.
16659 * @returns {*} Returns `value`.
16662 * var object = { 'a': 1 };
16664 * console.log(_.identity(object) === object);
16667 function identity(value) {
16672 * Creates a function that invokes `func` with the arguments of the created
16673 * function. If `func` is a property name, the created function returns the
16674 * property value for a given element. If `func` is an array or object, the
16675 * created function returns `true` for elements that contain the equivalent
16676 * source properties, otherwise it returns `false`.
16682 * @param {*} [func=_.identity] The value to convert to a callback.
16683 * @returns {Function} Returns the callback.
16687 * { 'user': 'barney', 'age': 36, 'active': true },
16688 * { 'user': 'fred', 'age': 40, 'active': false }
16691 * // The `_.matches` iteratee shorthand.
16692 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
16693 * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
16695 * // The `_.matchesProperty` iteratee shorthand.
16696 * _.filter(users, _.iteratee(['user', 'fred']));
16697 * // => [{ 'user': 'fred', 'age': 40 }]
16699 * // The `_.property` iteratee shorthand.
16700 * _.map(users, _.iteratee('user'));
16701 * // => ['barney', 'fred']
16703 * // Create custom iteratee shorthands.
16704 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
16705 * return !_.isRegExp(func) ? iteratee(func) : function(string) {
16706 * return func.test(string);
16710 * _.filter(['abc', 'def'], /ef/);
16713 function iteratee(func) {
16714 return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
16718 * Creates a function that performs a partial deep comparison between a given
16719 * object and `source`, returning `true` if the given object has equivalent
16720 * property values, else `false`.
16722 * **Note:** The created function is equivalent to `_.isMatch` with `source`
16723 * partially applied.
16725 * Partial comparisons will match empty array and empty object `source`
16726 * values against any array or object value, respectively. See `_.isEqual`
16727 * for a list of supported value comparisons.
16729 * **Note:** Multiple values can be checked by combining several matchers
16730 * using `_.overSome`
16736 * @param {Object} source The object of property values to match.
16737 * @returns {Function} Returns the new spec function.
16741 * { 'a': 1, 'b': 2, 'c': 3 },
16742 * { 'a': 4, 'b': 5, 'c': 6 }
16745 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
16746 * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
16748 * // Checking for several possible values
16749 * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
16750 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
16752 function matches(source) {
16753 return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
16757 * Creates a function that performs a partial deep comparison between the
16758 * value at `path` of a given object to `srcValue`, returning `true` if the
16759 * object value is equivalent, else `false`.
16761 * **Note:** Partial comparisons will match empty array and empty object
16762 * `srcValue` values against any array or object value, respectively. See
16763 * `_.isEqual` for a list of supported value comparisons.
16765 * **Note:** Multiple values can be checked by combining several matchers
16766 * using `_.overSome`
16772 * @param {Array|string} path The path of the property to get.
16773 * @param {*} srcValue The value to match.
16774 * @returns {Function} Returns the new spec function.
16778 * { 'a': 1, 'b': 2, 'c': 3 },
16779 * { 'a': 4, 'b': 5, 'c': 6 }
16782 * _.find(objects, _.matchesProperty('a', 4));
16783 * // => { 'a': 4, 'b': 5, 'c': 6 }
16785 * // Checking for several possible values
16786 * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
16787 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
16789 function matchesProperty(path, srcValue) {
16790 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
16794 * Creates a function that invokes the method at `path` of a given object.
16795 * Any additional arguments are provided to the invoked method.
16801 * @param {Array|string} path The path of the method to invoke.
16802 * @param {...*} [args] The arguments to invoke the method with.
16803 * @returns {Function} Returns the new invoker function.
16807 * { 'a': { 'b': _.constant(2) } },
16808 * { 'a': { 'b': _.constant(1) } }
16811 * _.map(objects, _.method('a.b'));
16814 * _.map(objects, _.method(['a', 'b']));
16817 var method = baseRest(function(path, args) {
16818 return function(object) {
16819 return baseInvoke(object, path, args);
16824 * The opposite of `_.method`; this method creates a function that invokes
16825 * the method at a given path of `object`. Any additional arguments are
16826 * provided to the invoked method.
16832 * @param {Object} object The object to query.
16833 * @param {...*} [args] The arguments to invoke the method with.
16834 * @returns {Function} Returns the new invoker function.
16837 * var array = _.times(3, _.constant),
16838 * object = { 'a': array, 'b': array, 'c': array };
16840 * _.map(['a[2]', 'c[0]'], _.methodOf(object));
16843 * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
16846 var methodOf = baseRest(function(object, args) {
16847 return function(path) {
16848 return baseInvoke(object, path, args);
16853 * Adds all own enumerable string keyed function properties of a source
16854 * object to the destination object. If `object` is a function, then methods
16855 * are added to its prototype as well.
16857 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
16858 * avoid conflicts caused by modifying the original.
16864 * @param {Function|Object} [object=lodash] The destination object.
16865 * @param {Object} source The object of functions to add.
16866 * @param {Object} [options={}] The options object.
16867 * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
16868 * @returns {Function|Object} Returns `object`.
16871 * function vowels(string) {
16872 * return _.filter(string, function(v) {
16873 * return /[aeiou]/i.test(v);
16877 * _.mixin({ 'vowels': vowels });
16878 * _.vowels('fred');
16881 * _('fred').vowels().value();
16884 * _.mixin({ 'vowels': vowels }, { 'chain': false });
16885 * _('fred').vowels();
16888 function mixin(object, source, options) {
16889 var props = keys(source),
16890 methodNames = baseFunctions(source, props);
16892 if (options == null &&
16893 !(isObject(source) && (methodNames.length || !props.length))) {
16897 methodNames = baseFunctions(source, keys(source));
16899 var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
16900 isFunc = isFunction(object);
16902 arrayEach(methodNames, function(methodName) {
16903 var func = source[methodName];
16904 object[methodName] = func;
16906 object.prototype[methodName] = function() {
16907 var chainAll = this.__chain__;
16908 if (chain || chainAll) {
16909 var result = object(this.__wrapped__),
16910 actions = result.__actions__ = copyArray(this.__actions__);
16912 actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
16913 result.__chain__ = chainAll;
16916 return func.apply(object, arrayPush([this.value()], arguments));
16925 * Reverts the `_` variable to its previous value and returns a reference to
16926 * the `lodash` function.
16932 * @returns {Function} Returns the `lodash` function.
16935 * var lodash = _.noConflict();
16937 function noConflict() {
16938 if (root._ === this) {
16945 * This method returns `undefined`.
16953 * _.times(2, _.noop);
16954 * // => [undefined, undefined]
16957 // No operation performed.
16961 * Creates a function that gets the argument at index `n`. If `n` is negative,
16962 * the nth argument from the end is returned.
16968 * @param {number} [n=0] The index of the argument to return.
16969 * @returns {Function} Returns the new pass-thru function.
16972 * var func = _.nthArg(1);
16973 * func('a', 'b', 'c', 'd');
16976 * var func = _.nthArg(-2);
16977 * func('a', 'b', 'c', 'd');
16980 function nthArg(n) {
16982 return baseRest(function(args) {
16983 return baseNth(args, n);
16988 * Creates a function that invokes `iteratees` with the arguments it receives
16989 * and returns their results.
16995 * @param {...(Function|Function[])} [iteratees=[_.identity]]
16996 * The iteratees to invoke.
16997 * @returns {Function} Returns the new function.
17000 * var func = _.over([Math.max, Math.min]);
17002 * func(1, 2, 3, 4);
17005 var over = createOver(arrayMap);
17008 * Creates a function that checks if **all** of the `predicates` return
17009 * truthy when invoked with the arguments it receives.
17011 * Following shorthands are possible for providing predicates.
17012 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
17013 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
17019 * @param {...(Function|Function[])} [predicates=[_.identity]]
17020 * The predicates to check.
17021 * @returns {Function} Returns the new function.
17024 * var func = _.overEvery([Boolean, isFinite]);
17035 var overEvery = createOver(arrayEvery);
17038 * Creates a function that checks if **any** of the `predicates` return
17039 * truthy when invoked with the arguments it receives.
17041 * Following shorthands are possible for providing predicates.
17042 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
17043 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
17049 * @param {...(Function|Function[])} [predicates=[_.identity]]
17050 * The predicates to check.
17051 * @returns {Function} Returns the new function.
17054 * var func = _.overSome([Boolean, isFinite]);
17065 * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
17066 * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
17068 var overSome = createOver(arraySome);
17071 * Creates a function that returns the value at `path` of a given object.
17077 * @param {Array|string} path The path of the property to get.
17078 * @returns {Function} Returns the new accessor function.
17082 * { 'a': { 'b': 2 } },
17083 * { 'a': { 'b': 1 } }
17086 * _.map(objects, _.property('a.b'));
17089 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
17092 function property(path) {
17093 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
17097 * The opposite of `_.property`; this method creates a function that returns
17098 * the value at a given path of `object`.
17104 * @param {Object} object The object to query.
17105 * @returns {Function} Returns the new accessor function.
17108 * var array = [0, 1, 2],
17109 * object = { 'a': array, 'b': array, 'c': array };
17111 * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
17114 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
17117 function propertyOf(object) {
17118 return function(path) {
17119 return object == null ? undefined : baseGet(object, path);
17124 * Creates an array of numbers (positive and/or negative) progressing from
17125 * `start` up to, but not including, `end`. A step of `-1` is used if a negative
17126 * `start` is specified without an `end` or `step`. If `end` is not specified,
17127 * it's set to `start` with `start` then set to `0`.
17129 * **Note:** JavaScript follows the IEEE-754 standard for resolving
17130 * floating-point values which can produce unexpected results.
17136 * @param {number} [start=0] The start of the range.
17137 * @param {number} end The end of the range.
17138 * @param {number} [step=1] The value to increment or decrement by.
17139 * @returns {Array} Returns the range of numbers.
17140 * @see _.inRange, _.rangeRight
17144 * // => [0, 1, 2, 3]
17147 * // => [0, -1, -2, -3]
17150 * // => [1, 2, 3, 4]
17152 * _.range(0, 20, 5);
17153 * // => [0, 5, 10, 15]
17155 * _.range(0, -4, -1);
17156 * // => [0, -1, -2, -3]
17158 * _.range(1, 4, 0);
17164 var range = createRange();
17167 * This method is like `_.range` except that it populates values in
17168 * descending order.
17174 * @param {number} [start=0] The start of the range.
17175 * @param {number} end The end of the range.
17176 * @param {number} [step=1] The value to increment or decrement by.
17177 * @returns {Array} Returns the range of numbers.
17178 * @see _.inRange, _.range
17182 * // => [3, 2, 1, 0]
17184 * _.rangeRight(-4);
17185 * // => [-3, -2, -1, 0]
17187 * _.rangeRight(1, 5);
17188 * // => [4, 3, 2, 1]
17190 * _.rangeRight(0, 20, 5);
17191 * // => [15, 10, 5, 0]
17193 * _.rangeRight(0, -4, -1);
17194 * // => [-3, -2, -1, 0]
17196 * _.rangeRight(1, 4, 0);
17202 var rangeRight = createRange(true);
17205 * This method returns a new empty array.
17211 * @returns {Array} Returns the new empty array.
17214 * var arrays = _.times(2, _.stubArray);
17216 * console.log(arrays);
17219 * console.log(arrays[0] === arrays[1]);
17222 function stubArray() {
17227 * This method returns `false`.
17233 * @returns {boolean} Returns `false`.
17236 * _.times(2, _.stubFalse);
17237 * // => [false, false]
17239 function stubFalse() {
17244 * This method returns a new empty object.
17250 * @returns {Object} Returns the new empty object.
17253 * var objects = _.times(2, _.stubObject);
17255 * console.log(objects);
17258 * console.log(objects[0] === objects[1]);
17261 function stubObject() {
17266 * This method returns an empty string.
17272 * @returns {string} Returns the empty string.
17275 * _.times(2, _.stubString);
17278 function stubString() {
17283 * This method returns `true`.
17289 * @returns {boolean} Returns `true`.
17292 * _.times(2, _.stubTrue);
17293 * // => [true, true]
17295 function stubTrue() {
17300 * Invokes the iteratee `n` times, returning an array of the results of
17301 * each invocation. The iteratee is invoked with one argument; (index).
17307 * @param {number} n The number of times to invoke `iteratee`.
17308 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
17309 * @returns {Array} Returns the array of results.
17312 * _.times(3, String);
17313 * // => ['0', '1', '2']
17315 * _.times(4, _.constant(0));
17316 * // => [0, 0, 0, 0]
17318 function times(n, iteratee) {
17320 if (n < 1 || n > MAX_SAFE_INTEGER) {
17323 var index = MAX_ARRAY_LENGTH,
17324 length = nativeMin(n, MAX_ARRAY_LENGTH);
17326 iteratee = getIteratee(iteratee);
17327 n -= MAX_ARRAY_LENGTH;
17329 var result = baseTimes(length, iteratee);
17330 while (++index < n) {
17337 * Converts `value` to a property path array.
17343 * @param {*} value The value to convert.
17344 * @returns {Array} Returns the new property path array.
17347 * _.toPath('a.b.c');
17348 * // => ['a', 'b', 'c']
17350 * _.toPath('a[0].b.c');
17351 * // => ['a', '0', 'b', 'c']
17353 function toPath(value) {
17354 if (isArray(value)) {
17355 return arrayMap(value, toKey);
17357 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
17361 * Generates a unique ID. If `prefix` is given, the ID is appended to it.
17367 * @param {string} [prefix=''] The value to prefix the ID with.
17368 * @returns {string} Returns the unique ID.
17371 * _.uniqueId('contact_');
17372 * // => 'contact_104'
17377 function uniqueId(prefix) {
17378 var id = ++idCounter;
17379 return toString(prefix) + id;
17382 /*------------------------------------------------------------------------*/
17385 * Adds two numbers.
17391 * @param {number} augend The first number in an addition.
17392 * @param {number} addend The second number in an addition.
17393 * @returns {number} Returns the total.
17399 var add = createMathOperation(function(augend, addend) {
17400 return augend + addend;
17404 * Computes `number` rounded up to `precision`.
17410 * @param {number} number The number to round up.
17411 * @param {number} [precision=0] The precision to round up to.
17412 * @returns {number} Returns the rounded up number.
17418 * _.ceil(6.004, 2);
17421 * _.ceil(6040, -2);
17424 var ceil = createRound('ceil');
17427 * Divide two numbers.
17433 * @param {number} dividend The first number in a division.
17434 * @param {number} divisor The second number in a division.
17435 * @returns {number} Returns the quotient.
17441 var divide = createMathOperation(function(dividend, divisor) {
17442 return dividend / divisor;
17446 * Computes `number` rounded down to `precision`.
17452 * @param {number} number The number to round down.
17453 * @param {number} [precision=0] The precision to round down to.
17454 * @returns {number} Returns the rounded down number.
17460 * _.floor(0.046, 2);
17463 * _.floor(4060, -2);
17466 var floor = createRound('floor');
17469 * Computes the maximum value of `array`. If `array` is empty or falsey,
17470 * `undefined` is returned.
17476 * @param {Array} array The array to iterate over.
17477 * @returns {*} Returns the maximum value.
17480 * _.max([4, 2, 8, 6]);
17486 function max(array) {
17487 return (array && array.length)
17488 ? baseExtremum(array, identity, baseGt)
17493 * This method is like `_.max` except that it accepts `iteratee` which is
17494 * invoked for each element in `array` to generate the criterion by which
17495 * the value is ranked. The iteratee is invoked with one argument: (value).
17501 * @param {Array} array The array to iterate over.
17502 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
17503 * @returns {*} Returns the maximum value.
17506 * var objects = [{ 'n': 1 }, { 'n': 2 }];
17508 * _.maxBy(objects, function(o) { return o.n; });
17511 * // The `_.property` iteratee shorthand.
17512 * _.maxBy(objects, 'n');
17515 function maxBy(array, iteratee) {
17516 return (array && array.length)
17517 ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
17522 * Computes the mean of the values in `array`.
17528 * @param {Array} array The array to iterate over.
17529 * @returns {number} Returns the mean.
17532 * _.mean([4, 2, 8, 6]);
17535 function mean(array) {
17536 return baseMean(array, identity);
17540 * This method is like `_.mean` except that it accepts `iteratee` which is
17541 * invoked for each element in `array` to generate the value to be averaged.
17542 * The iteratee is invoked with one argument: (value).
17548 * @param {Array} array The array to iterate over.
17549 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
17550 * @returns {number} Returns the mean.
17553 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
17555 * _.meanBy(objects, function(o) { return o.n; });
17558 * // The `_.property` iteratee shorthand.
17559 * _.meanBy(objects, 'n');
17562 function meanBy(array, iteratee) {
17563 return baseMean(array, getIteratee(iteratee, 2));
17567 * Computes the minimum value of `array`. If `array` is empty or falsey,
17568 * `undefined` is returned.
17574 * @param {Array} array The array to iterate over.
17575 * @returns {*} Returns the minimum value.
17578 * _.min([4, 2, 8, 6]);
17584 function min(array) {
17585 return (array && array.length)
17586 ? baseExtremum(array, identity, baseLt)
17591 * This method is like `_.min` except that it accepts `iteratee` which is
17592 * invoked for each element in `array` to generate the criterion by which
17593 * the value is ranked. The iteratee is invoked with one argument: (value).
17599 * @param {Array} array The array to iterate over.
17600 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
17601 * @returns {*} Returns the minimum value.
17604 * var objects = [{ 'n': 1 }, { 'n': 2 }];
17606 * _.minBy(objects, function(o) { return o.n; });
17609 * // The `_.property` iteratee shorthand.
17610 * _.minBy(objects, 'n');
17613 function minBy(array, iteratee) {
17614 return (array && array.length)
17615 ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
17620 * Multiply two numbers.
17626 * @param {number} multiplier The first number in a multiplication.
17627 * @param {number} multiplicand The second number in a multiplication.
17628 * @returns {number} Returns the product.
17631 * _.multiply(6, 4);
17634 var multiply = createMathOperation(function(multiplier, multiplicand) {
17635 return multiplier * multiplicand;
17639 * Computes `number` rounded to `precision`.
17645 * @param {number} number The number to round.
17646 * @param {number} [precision=0] The precision to round to.
17647 * @returns {number} Returns the rounded number.
17653 * _.round(4.006, 2);
17656 * _.round(4060, -2);
17659 var round = createRound('round');
17662 * Subtract two numbers.
17668 * @param {number} minuend The first number in a subtraction.
17669 * @param {number} subtrahend The second number in a subtraction.
17670 * @returns {number} Returns the difference.
17673 * _.subtract(6, 4);
17676 var subtract = createMathOperation(function(minuend, subtrahend) {
17677 return minuend - subtrahend;
17681 * Computes the sum of the values in `array`.
17687 * @param {Array} array The array to iterate over.
17688 * @returns {number} Returns the sum.
17691 * _.sum([4, 2, 8, 6]);
17694 function sum(array) {
17695 return (array && array.length)
17696 ? baseSum(array, identity)
17701 * This method is like `_.sum` except that it accepts `iteratee` which is
17702 * invoked for each element in `array` to generate the value to be summed.
17703 * The iteratee is invoked with one argument: (value).
17709 * @param {Array} array The array to iterate over.
17710 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
17711 * @returns {number} Returns the sum.
17714 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
17716 * _.sumBy(objects, function(o) { return o.n; });
17719 * // The `_.property` iteratee shorthand.
17720 * _.sumBy(objects, 'n');
17723 function sumBy(array, iteratee) {
17724 return (array && array.length)
17725 ? baseSum(array, getIteratee(iteratee, 2))
17729 /*------------------------------------------------------------------------*/
17731 // Add methods that return wrapped values in chain sequences.
17732 lodash.after = after;
17734 lodash.assign = assign;
17735 lodash.assignIn = assignIn;
17736 lodash.assignInWith = assignInWith;
17737 lodash.assignWith = assignWith;
17739 lodash.before = before;
17740 lodash.bind = bind;
17741 lodash.bindAll = bindAll;
17742 lodash.bindKey = bindKey;
17743 lodash.castArray = castArray;
17744 lodash.chain = chain;
17745 lodash.chunk = chunk;
17746 lodash.compact = compact;
17747 lodash.concat = concat;
17748 lodash.cond = cond;
17749 lodash.conforms = conforms;
17750 lodash.constant = constant;
17751 lodash.countBy = countBy;
17752 lodash.create = create;
17753 lodash.curry = curry;
17754 lodash.curryRight = curryRight;
17755 lodash.debounce = debounce;
17756 lodash.defaults = defaults;
17757 lodash.defaultsDeep = defaultsDeep;
17758 lodash.defer = defer;
17759 lodash.delay = delay;
17760 lodash.difference = difference;
17761 lodash.differenceBy = differenceBy;
17762 lodash.differenceWith = differenceWith;
17763 lodash.drop = drop;
17764 lodash.dropRight = dropRight;
17765 lodash.dropRightWhile = dropRightWhile;
17766 lodash.dropWhile = dropWhile;
17767 lodash.fill = fill;
17768 lodash.filter = filter;
17769 lodash.flatMap = flatMap;
17770 lodash.flatMapDeep = flatMapDeep;
17771 lodash.flatMapDepth = flatMapDepth;
17772 lodash.flatten = flatten;
17773 lodash.flattenDeep = flattenDeep;
17774 lodash.flattenDepth = flattenDepth;
17775 lodash.flip = flip;
17776 lodash.flow = flow;
17777 lodash.flowRight = flowRight;
17778 lodash.fromPairs = fromPairs;
17779 lodash.functions = functions;
17780 lodash.functionsIn = functionsIn;
17781 lodash.groupBy = groupBy;
17782 lodash.initial = initial;
17783 lodash.intersection = intersection;
17784 lodash.intersectionBy = intersectionBy;
17785 lodash.intersectionWith = intersectionWith;
17786 lodash.invert = invert;
17787 lodash.invertBy = invertBy;
17788 lodash.invokeMap = invokeMap;
17789 lodash.iteratee = iteratee;
17790 lodash.keyBy = keyBy;
17791 lodash.keys = keys;
17792 lodash.keysIn = keysIn;
17794 lodash.mapKeys = mapKeys;
17795 lodash.mapValues = mapValues;
17796 lodash.matches = matches;
17797 lodash.matchesProperty = matchesProperty;
17798 lodash.memoize = memoize;
17799 lodash.merge = merge;
17800 lodash.mergeWith = mergeWith;
17801 lodash.method = method;
17802 lodash.methodOf = methodOf;
17803 lodash.mixin = mixin;
17804 lodash.negate = negate;
17805 lodash.nthArg = nthArg;
17806 lodash.omit = omit;
17807 lodash.omitBy = omitBy;
17808 lodash.once = once;
17809 lodash.orderBy = orderBy;
17810 lodash.over = over;
17811 lodash.overArgs = overArgs;
17812 lodash.overEvery = overEvery;
17813 lodash.overSome = overSome;
17814 lodash.partial = partial;
17815 lodash.partialRight = partialRight;
17816 lodash.partition = partition;
17817 lodash.pick = pick;
17818 lodash.pickBy = pickBy;
17819 lodash.property = property;
17820 lodash.propertyOf = propertyOf;
17821 lodash.pull = pull;
17822 lodash.pullAll = pullAll;
17823 lodash.pullAllBy = pullAllBy;
17824 lodash.pullAllWith = pullAllWith;
17825 lodash.pullAt = pullAt;
17826 lodash.range = range;
17827 lodash.rangeRight = rangeRight;
17828 lodash.rearg = rearg;
17829 lodash.reject = reject;
17830 lodash.remove = remove;
17831 lodash.rest = rest;
17832 lodash.reverse = reverse;
17833 lodash.sampleSize = sampleSize;
17835 lodash.setWith = setWith;
17836 lodash.shuffle = shuffle;
17837 lodash.slice = slice;
17838 lodash.sortBy = sortBy;
17839 lodash.sortedUniq = sortedUniq;
17840 lodash.sortedUniqBy = sortedUniqBy;
17841 lodash.split = split;
17842 lodash.spread = spread;
17843 lodash.tail = tail;
17844 lodash.take = take;
17845 lodash.takeRight = takeRight;
17846 lodash.takeRightWhile = takeRightWhile;
17847 lodash.takeWhile = takeWhile;
17849 lodash.throttle = throttle;
17850 lodash.thru = thru;
17851 lodash.toArray = toArray;
17852 lodash.toPairs = toPairs;
17853 lodash.toPairsIn = toPairsIn;
17854 lodash.toPath = toPath;
17855 lodash.toPlainObject = toPlainObject;
17856 lodash.transform = transform;
17857 lodash.unary = unary;
17858 lodash.union = union;
17859 lodash.unionBy = unionBy;
17860 lodash.unionWith = unionWith;
17861 lodash.uniq = uniq;
17862 lodash.uniqBy = uniqBy;
17863 lodash.uniqWith = uniqWith;
17864 lodash.unset = unset;
17865 lodash.unzip = unzip;
17866 lodash.unzipWith = unzipWith;
17867 lodash.update = update;
17868 lodash.updateWith = updateWith;
17869 lodash.values = values;
17870 lodash.valuesIn = valuesIn;
17871 lodash.without = without;
17872 lodash.words = words;
17873 lodash.wrap = wrap;
17875 lodash.xorBy = xorBy;
17876 lodash.xorWith = xorWith;
17878 lodash.zipObject = zipObject;
17879 lodash.zipObjectDeep = zipObjectDeep;
17880 lodash.zipWith = zipWith;
17883 lodash.entries = toPairs;
17884 lodash.entriesIn = toPairsIn;
17885 lodash.extend = assignIn;
17886 lodash.extendWith = assignInWith;
17888 // Add methods to `lodash.prototype`.
17889 mixin(lodash, lodash);
17891 /*------------------------------------------------------------------------*/
17893 // Add methods that return unwrapped values in chain sequences.
17895 lodash.attempt = attempt;
17896 lodash.camelCase = camelCase;
17897 lodash.capitalize = capitalize;
17898 lodash.ceil = ceil;
17899 lodash.clamp = clamp;
17900 lodash.clone = clone;
17901 lodash.cloneDeep = cloneDeep;
17902 lodash.cloneDeepWith = cloneDeepWith;
17903 lodash.cloneWith = cloneWith;
17904 lodash.conformsTo = conformsTo;
17905 lodash.deburr = deburr;
17906 lodash.defaultTo = defaultTo;
17907 lodash.divide = divide;
17908 lodash.endsWith = endsWith;
17910 lodash.escape = escape;
17911 lodash.escapeRegExp = escapeRegExp;
17912 lodash.every = every;
17913 lodash.find = find;
17914 lodash.findIndex = findIndex;
17915 lodash.findKey = findKey;
17916 lodash.findLast = findLast;
17917 lodash.findLastIndex = findLastIndex;
17918 lodash.findLastKey = findLastKey;
17919 lodash.floor = floor;
17920 lodash.forEach = forEach;
17921 lodash.forEachRight = forEachRight;
17922 lodash.forIn = forIn;
17923 lodash.forInRight = forInRight;
17924 lodash.forOwn = forOwn;
17925 lodash.forOwnRight = forOwnRight;
17930 lodash.hasIn = hasIn;
17931 lodash.head = head;
17932 lodash.identity = identity;
17933 lodash.includes = includes;
17934 lodash.indexOf = indexOf;
17935 lodash.inRange = inRange;
17936 lodash.invoke = invoke;
17937 lodash.isArguments = isArguments;
17938 lodash.isArray = isArray;
17939 lodash.isArrayBuffer = isArrayBuffer;
17940 lodash.isArrayLike = isArrayLike;
17941 lodash.isArrayLikeObject = isArrayLikeObject;
17942 lodash.isBoolean = isBoolean;
17943 lodash.isBuffer = isBuffer;
17944 lodash.isDate = isDate;
17945 lodash.isElement = isElement;
17946 lodash.isEmpty = isEmpty;
17947 lodash.isEqual = isEqual;
17948 lodash.isEqualWith = isEqualWith;
17949 lodash.isError = isError;
17950 lodash.isFinite = isFinite;
17951 lodash.isFunction = isFunction;
17952 lodash.isInteger = isInteger;
17953 lodash.isLength = isLength;
17954 lodash.isMap = isMap;
17955 lodash.isMatch = isMatch;
17956 lodash.isMatchWith = isMatchWith;
17957 lodash.isNaN = isNaN;
17958 lodash.isNative = isNative;
17959 lodash.isNil = isNil;
17960 lodash.isNull = isNull;
17961 lodash.isNumber = isNumber;
17962 lodash.isObject = isObject;
17963 lodash.isObjectLike = isObjectLike;
17964 lodash.isPlainObject = isPlainObject;
17965 lodash.isRegExp = isRegExp;
17966 lodash.isSafeInteger = isSafeInteger;
17967 lodash.isSet = isSet;
17968 lodash.isString = isString;
17969 lodash.isSymbol = isSymbol;
17970 lodash.isTypedArray = isTypedArray;
17971 lodash.isUndefined = isUndefined;
17972 lodash.isWeakMap = isWeakMap;
17973 lodash.isWeakSet = isWeakSet;
17974 lodash.join = join;
17975 lodash.kebabCase = kebabCase;
17976 lodash.last = last;
17977 lodash.lastIndexOf = lastIndexOf;
17978 lodash.lowerCase = lowerCase;
17979 lodash.lowerFirst = lowerFirst;
17983 lodash.maxBy = maxBy;
17984 lodash.mean = mean;
17985 lodash.meanBy = meanBy;
17987 lodash.minBy = minBy;
17988 lodash.stubArray = stubArray;
17989 lodash.stubFalse = stubFalse;
17990 lodash.stubObject = stubObject;
17991 lodash.stubString = stubString;
17992 lodash.stubTrue = stubTrue;
17993 lodash.multiply = multiply;
17995 lodash.noConflict = noConflict;
17996 lodash.noop = noop;
17999 lodash.padEnd = padEnd;
18000 lodash.padStart = padStart;
18001 lodash.parseInt = parseInt;
18002 lodash.random = random;
18003 lodash.reduce = reduce;
18004 lodash.reduceRight = reduceRight;
18005 lodash.repeat = repeat;
18006 lodash.replace = replace;
18007 lodash.result = result;
18008 lodash.round = round;
18009 lodash.runInContext = runInContext;
18010 lodash.sample = sample;
18011 lodash.size = size;
18012 lodash.snakeCase = snakeCase;
18013 lodash.some = some;
18014 lodash.sortedIndex = sortedIndex;
18015 lodash.sortedIndexBy = sortedIndexBy;
18016 lodash.sortedIndexOf = sortedIndexOf;
18017 lodash.sortedLastIndex = sortedLastIndex;
18018 lodash.sortedLastIndexBy = sortedLastIndexBy;
18019 lodash.sortedLastIndexOf = sortedLastIndexOf;
18020 lodash.startCase = startCase;
18021 lodash.startsWith = startsWith;
18022 lodash.subtract = subtract;
18024 lodash.sumBy = sumBy;
18025 lodash.template = template;
18026 lodash.times = times;
18027 lodash.toFinite = toFinite;
18028 lodash.toInteger = toInteger;
18029 lodash.toLength = toLength;
18030 lodash.toLower = toLower;
18031 lodash.toNumber = toNumber;
18032 lodash.toSafeInteger = toSafeInteger;
18033 lodash.toString = toString;
18034 lodash.toUpper = toUpper;
18035 lodash.trim = trim;
18036 lodash.trimEnd = trimEnd;
18037 lodash.trimStart = trimStart;
18038 lodash.truncate = truncate;
18039 lodash.unescape = unescape;
18040 lodash.uniqueId = uniqueId;
18041 lodash.upperCase = upperCase;
18042 lodash.upperFirst = upperFirst;
18045 lodash.each = forEach;
18046 lodash.eachRight = forEachRight;
18047 lodash.first = head;
18049 mixin(lodash, (function() {
18051 baseForOwn(lodash, function(func, methodName) {
18052 if (!hasOwnProperty.call(lodash.prototype, methodName)) {
18053 source[methodName] = func;
18057 }()), { 'chain': false });
18059 /*------------------------------------------------------------------------*/
18062 * The semantic version number.
18068 lodash.VERSION = VERSION;
18070 // Assign default placeholders.
18071 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
18072 lodash[methodName].placeholder = lodash;
18075 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
18076 arrayEach(['drop', 'take'], function(methodName, index) {
18077 LazyWrapper.prototype[methodName] = function(n) {
18078 n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
18080 var result = (this.__filtered__ && !index)
18081 ? new LazyWrapper(this)
18084 if (result.__filtered__) {
18085 result.__takeCount__ = nativeMin(n, result.__takeCount__);
18087 result.__views__.push({
18088 'size': nativeMin(n, MAX_ARRAY_LENGTH),
18089 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
18095 LazyWrapper.prototype[methodName + 'Right'] = function(n) {
18096 return this.reverse()[methodName](n).reverse();
18100 // Add `LazyWrapper` methods that accept an `iteratee` value.
18101 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
18102 var type = index + 1,
18103 isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
18105 LazyWrapper.prototype[methodName] = function(iteratee) {
18106 var result = this.clone();
18107 result.__iteratees__.push({
18108 'iteratee': getIteratee(iteratee, 3),
18111 result.__filtered__ = result.__filtered__ || isFilter;
18116 // Add `LazyWrapper` methods for `_.head` and `_.last`.
18117 arrayEach(['head', 'last'], function(methodName, index) {
18118 var takeName = 'take' + (index ? 'Right' : '');
18120 LazyWrapper.prototype[methodName] = function() {
18121 return this[takeName](1).value()[0];
18125 // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
18126 arrayEach(['initial', 'tail'], function(methodName, index) {
18127 var dropName = 'drop' + (index ? '' : 'Right');
18129 LazyWrapper.prototype[methodName] = function() {
18130 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
18134 LazyWrapper.prototype.compact = function() {
18135 return this.filter(identity);
18138 LazyWrapper.prototype.find = function(predicate) {
18139 return this.filter(predicate).head();
18142 LazyWrapper.prototype.findLast = function(predicate) {
18143 return this.reverse().find(predicate);
18146 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
18147 if (typeof path == 'function') {
18148 return new LazyWrapper(this);
18150 return this.map(function(value) {
18151 return baseInvoke(value, path, args);
18155 LazyWrapper.prototype.reject = function(predicate) {
18156 return this.filter(negate(getIteratee(predicate)));
18159 LazyWrapper.prototype.slice = function(start, end) {
18160 start = toInteger(start);
18163 if (result.__filtered__ && (start > 0 || end < 0)) {
18164 return new LazyWrapper(result);
18167 result = result.takeRight(-start);
18168 } else if (start) {
18169 result = result.drop(start);
18171 if (end !== undefined) {
18172 end = toInteger(end);
18173 result = end < 0 ? result.dropRight(-end) : result.take(end - start);
18178 LazyWrapper.prototype.takeRightWhile = function(predicate) {
18179 return this.reverse().takeWhile(predicate).reverse();
18182 LazyWrapper.prototype.toArray = function() {
18183 return this.take(MAX_ARRAY_LENGTH);
18186 // Add `LazyWrapper` methods to `lodash.prototype`.
18187 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
18188 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
18189 isTaker = /^(?:head|last)$/.test(methodName),
18190 lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
18191 retUnwrapped = isTaker || /^find/.test(methodName);
18196 lodash.prototype[methodName] = function() {
18197 var value = this.__wrapped__,
18198 args = isTaker ? [1] : arguments,
18199 isLazy = value instanceof LazyWrapper,
18200 iteratee = args[0],
18201 useLazy = isLazy || isArray(value);
18203 var interceptor = function(value) {
18204 var result = lodashFunc.apply(lodash, arrayPush([value], args));
18205 return (isTaker && chainAll) ? result[0] : result;
18208 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
18209 // Avoid lazy use if the iteratee has a "length" value other than `1`.
18210 isLazy = useLazy = false;
18212 var chainAll = this.__chain__,
18213 isHybrid = !!this.__actions__.length,
18214 isUnwrapped = retUnwrapped && !chainAll,
18215 onlyLazy = isLazy && !isHybrid;
18217 if (!retUnwrapped && useLazy) {
18218 value = onlyLazy ? value : new LazyWrapper(this);
18219 var result = func.apply(value, args);
18220 result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
18221 return new LodashWrapper(result, chainAll);
18223 if (isUnwrapped && onlyLazy) {
18224 return func.apply(this, args);
18226 result = this.thru(interceptor);
18227 return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
18231 // Add `Array` methods to `lodash.prototype`.
18232 arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
18233 var func = arrayProto[methodName],
18234 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
18235 retUnwrapped = /^(?:pop|shift)$/.test(methodName);
18237 lodash.prototype[methodName] = function() {
18238 var args = arguments;
18239 if (retUnwrapped && !this.__chain__) {
18240 var value = this.value();
18241 return func.apply(isArray(value) ? value : [], args);
18243 return this[chainName](function(value) {
18244 return func.apply(isArray(value) ? value : [], args);
18249 // Map minified method names to their real names.
18250 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
18251 var lodashFunc = lodash[methodName];
18253 var key = lodashFunc.name + '';
18254 if (!hasOwnProperty.call(realNames, key)) {
18255 realNames[key] = [];
18257 realNames[key].push({ 'name': methodName, 'func': lodashFunc });
18261 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
18266 // Add methods to `LazyWrapper`.
18267 LazyWrapper.prototype.clone = lazyClone;
18268 LazyWrapper.prototype.reverse = lazyReverse;
18269 LazyWrapper.prototype.value = lazyValue;
18271 // Add chain sequence methods to the `lodash` wrapper.
18272 lodash.prototype.at = wrapperAt;
18273 lodash.prototype.chain = wrapperChain;
18274 lodash.prototype.commit = wrapperCommit;
18275 lodash.prototype.next = wrapperNext;
18276 lodash.prototype.plant = wrapperPlant;
18277 lodash.prototype.reverse = wrapperReverse;
18278 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
18280 // Add lazy aliases.
18281 lodash.prototype.first = lodash.prototype.head;
18284 lodash.prototype[symIterator] = wrapperToIterator;
18289 /*--------------------------------------------------------------------------*/
18292 var _ = runInContext();
18294 // Some AMD build optimizers, like r.js, check for condition patterns like:
18296 // Expose Lodash on the global object to prevent errors when Lodash is
18297 // loaded by a script tag in the presence of an AMD loader.
18298 // See http://requirejs.org/docs/errors.html#mismatch for more details.
18299 // Use `_.noConflict` to remove Lodash from the global object.
18302 // Define as an anonymous module so, through path mapping, it can be
18303 // referenced as the "underscore" module.
18304 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
18306 }).call(exports, __webpack_require__, exports, module),
18307 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
18309 // Check for `exports` after `define` in case a build optimizer adds it.
18316 /***/ "./src/client.ts":
18317 /*!***********************!*\
18318 !*** ./src/client.ts ***!
18319 \***********************/
18320 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
18324 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18325 if (k2 === undefined) k2 = k;
18326 var desc = Object.getOwnPropertyDescriptor(m, k);
18327 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18328 desc = { enumerable: true, get: function() { return m[k]; } };
18330 Object.defineProperty(o, k2, desc);
18331 }) : (function(o, m, k, k2) {
18332 if (k2 === undefined) k2 = k;
18335 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18336 Object.defineProperty(o, "default", { enumerable: true, value: v });
18337 }) : function(o, v) {
18340 var __importStar = (this && this.__importStar) || function (mod) {
18341 if (mod && mod.__esModule) return mod;
18343 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18344 __setModuleDefault(result, mod);
18347 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18348 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18349 return new (P || (P = Promise))(function (resolve, reject) {
18350 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18351 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18352 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18353 step((generator = generator.apply(thisArg, _arguments || [])).next());
18356 var __importDefault = (this && this.__importDefault) || function (mod) {
18357 return (mod && mod.__esModule) ? mod : { "default": mod };
18359 Object.defineProperty(exports, "__esModule", ({ value: true }));
18360 const outline_1 = __webpack_require__(/*! ./outline */ "./src/outline.ts");
18361 const cursor_1 = __webpack_require__(/*! ./cursor */ "./src/cursor.ts");
18362 const keyboardjs_1 = __importDefault(__webpack_require__(/*! keyboardjs */ "./node_modules/keyboardjs/dist/keyboard.js"));
18363 const rawOutline = __importStar(__webpack_require__(/*! ./test-data.json */ "./src/test-data.json"));
18364 const help_1 = __webpack_require__(/*! help */ "./src/help.ts");
18365 const search_1 = __webpack_require__(/*! ./search */ "./src/search.ts");
18366 let outlineData = rawOutline;
18367 if (localStorage.getItem('activeOutline')) {
18368 const outlineId = localStorage.getItem('activeOutline');
18369 outlineData = JSON.parse(localStorage.getItem(outlineId));
18371 const state = new Map();
18372 const outline = new outline_1.Outline(outlineData);
18373 outliner().innerHTML = outline.render();
18374 const cursor = new cursor_1.Cursor();
18375 cursor.set('.node');
18376 const search = new search_1.Search();
18377 function outliner() {
18378 return document.querySelector('#outliner');
18380 document.getElementById('display-help').addEventListener('click', e => {
18381 e.preventDefault();
18382 e.stopPropagation();
18383 (0, help_1.showHelp)();
18385 keyboardjs_1.default.withContext('navigation', () => {
18386 keyboardjs_1.default.bind('j', e => {
18387 const sibling = cursor.get().nextElementSibling;
18390 const res = outline.swapNodeWithNextSibling(cursor.getIdOfNode());
18391 const html = outline.renderNode(res.parentNode);
18392 if (res.parentNode.id === '000000') {
18393 cursor.get().parentElement.innerHTML = html;
18396 cursor.get().parentElement.outerHTML = html;
18398 cursor.set(`#id-${res.targetNode.id}`);
18402 cursor.set(`#id-${sibling.getAttribute('data-id')}`);
18406 keyboardjs_1.default.bind('shift + /', e => {
18407 (0, help_1.showHelp)();
18409 keyboardjs_1.default.bind('k', e => {
18410 const sibling = cursor.get().previousElementSibling;
18411 if (sibling && !sibling.classList.contains('nodeContent')) {
18413 const res = outline.swapNodeWithPreviousSibling(cursor.getIdOfNode());
18414 const html = outline.renderNode(res.parentNode);
18415 if (res.parentNode.id === '000000') {
18416 cursor.get().parentElement.innerHTML = html;
18419 cursor.get().parentElement.outerHTML = html;
18421 cursor.set(`#id-${res.targetNode.id}`);
18425 cursor.set(`#id-${sibling.getAttribute('data-id')}`);
18429 keyboardjs_1.default.bind('l', e => {
18430 if (cursor.isNodeCollapsed()) {
18434 const res = outline.lowerNodeToChild(cursor.getIdOfNode());
18435 const html = outline.renderNode(res.oldParentNode);
18436 if (res.oldParentNode.id === '000000') {
18437 cursor.get().parentElement.innerHTML = html;
18440 cursor.get().parentElement.outerHTML = html;
18442 cursor.set(`#id-${res.targetNode.id}`);
18445 const children = cursor.get().querySelector('.node');
18447 cursor.set(`#id-${children.getAttribute('data-id')}`);
18451 keyboardjs_1.default.bind('h', e => {
18452 const parent = cursor.get().parentElement;
18453 if (parent && parent.classList.contains('node')) {
18455 if (outline.data.tree.children.map(n => n.id).includes(cursor.getIdOfNode())) {
18458 const res = outline.liftNodeToParent(cursor.getIdOfNode());
18459 const html = outline.renderNode(res.parentNode);
18460 if (res.parentNode.id === '000000') {
18461 cursor.get().parentElement.parentElement.innerHTML = html;
18464 cursor.get().parentElement.parentElement.outerHTML = html;
18466 cursor.set(`#id-${res.targetNode.id}`);
18470 cursor.set(`#id-${parent.getAttribute('data-id')}`);
18474 keyboardjs_1.default.bind('z', e => {
18475 if (cursor.isNodeExpanded()) {
18477 outline.fold(cursor.getIdOfNode());
18479 else if (cursor.isNodeCollapsed()) {
18481 outline.unfold(cursor.getIdOfNode());
18485 keyboardjs_1.default.bind('shift + 4', e => {
18486 e.preventDefault();
18487 cursor.get().classList.add('hidden-cursor');
18488 const contentNode = cursor.get().querySelector('.nodeContent');
18489 contentNode.innerHTML = outline.data.contentNodes[cursor.getIdOfNode()].content;
18490 contentNode.contentEditable = "true";
18491 const range = document.createRange();
18492 range.selectNodeContents(contentNode);
18493 range.collapse(false);
18494 const selection = window.getSelection();
18495 selection.removeAllRanges();
18496 selection.addRange(range);
18497 contentNode.focus();
18498 keyboardjs_1.default.setContext('editing');
18500 keyboardjs_1.default.bind('i', e => {
18501 e.preventDefault();
18502 cursor.get().classList.add('hidden-cursor');
18503 const contentNode = cursor.get().querySelector('.nodeContent');
18504 contentNode.innerHTML = outline.data.contentNodes[cursor.getIdOfNode()].content;
18505 contentNode.contentEditable = "true";
18506 contentNode.focus();
18507 keyboardjs_1.default.setContext('editing');
18509 keyboardjs_1.default.bind('shift + x', e => {
18510 e.preventDefault();
18511 cursor.get().classList.toggle('strikethrough');
18512 outline.data.contentNodes[cursor.getIdOfNode()].strikethrough = cursor.get().classList.contains('strikethrough');
18515 keyboardjs_1.default.bind('tab', e => {
18516 e.preventDefault();
18517 const res = outline.createChildNode(cursor.getIdOfNode());
18518 const html = outline.renderNode(res.parentNode);
18519 cursor.get().outerHTML = html;
18520 cursor.set(`#id-${res.node.id}`);
18523 keyboardjs_1.default.bind('enter', e => {
18527 e.preventDefault();
18529 const res = outline.createSiblingNode(cursor.getIdOfNode());
18530 const html = outline.renderNode(res.parentNode);
18531 if (res.parentNode.id === '000000') {
18532 cursor.get().parentElement.innerHTML = html;
18535 cursor.get().parentElement.outerHTML = html;
18537 cursor.set(`#id-${res.node.id}`);
18540 keyboardjs_1.default.bind('d', e => {
18544 const res = outline.removeNode(cursor.getIdOfNode());
18545 const html = outline.renderNode(res.parentNode);
18546 const prevSibling = cursor.get().previousElementSibling;
18547 const nextSibling = cursor.get().nextElementSibling;
18548 if (res.parentNode.id === '000000') {
18549 cursor.get().parentElement.innerHTML = html;
18552 cursor.get().parentElement.outerHTML = html;
18554 if (prevSibling.getAttribute('data-id')) {
18555 cursor.set(`#id-${prevSibling.getAttribute('data-id')}`);
18557 else if (nextSibling.getAttribute('data-id')) {
18558 cursor.set(`#id-${nextSibling.getAttribute('data-id')}`);
18561 console.log(res.parentNode.id);
18562 cursor.set(`#id-${res.parentNode.id}`);
18567 keyboardjs_1.default.withContext('editing', () => {
18568 keyboardjs_1.default.bind(['esc', 'enter'], e => {
18569 cursor.get().classList.remove('hidden-cursor');
18570 const contentNode = cursor.get().querySelector('.nodeContent');
18571 contentNode.contentEditable = "false";
18572 contentNode.blur();
18573 keyboardjs_1.default.setContext('navigation');
18574 outline.updateContent(cursor.getIdOfNode(), contentNode.innerHTML.trim());
18575 contentNode.innerHTML = outline.renderContent(cursor.getIdOfNode());
18579 keyboardjs_1.default.setContext('navigation');
18580 search.createIndex({
18585 strikethrough: "boolean"
18586 }).then(() => __awaiter(void 0, void 0, void 0, function* () {
18587 yield search.indexBatch(outline.data.contentNodes);
18588 search.bindEvents();
18590 function recursivelyExpand(start) {
18591 if (start.classList.contains('node')) {
18592 if (start.classList.contains('collapsed')) {
18593 start.classList.remove('collapsed');
18594 start.classList.add('expanded');
18595 outline.unfold(start.getAttribute('data-id'));
18597 if (start.parentElement) {
18598 recursivelyExpand(start.parentElement);
18602 search.onTermSelection = (docId) => {
18603 recursivelyExpand(document.getElementById(`id-${docId}`).parentElement);
18604 cursor.set(`#id-${docId}`);
18607 function saveImmediate() {
18608 localStorage.setItem(outline.data.id, JSON.stringify(outline.data));
18609 localStorage.setItem('activeOutline', outline.data.id);
18610 console.log('saved...', outline.data);
18611 state.delete('saveTimeout');
18614 if (!state.has('saveTimeout')) {
18615 state.set('saveTimeout', setTimeout(saveImmediate, 2000));
18623 /***/ "./src/cursor.ts":
18624 /*!***********************!*\
18625 !*** ./src/cursor.ts ***!
18626 \***********************/
18627 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
18631 Object.defineProperty(exports, "__esModule", ({ value: true }));
18632 exports.Cursor = void 0;
18633 const dom_1 = __webpack_require__(/*! dom */ "./src/dom.ts");
18638 return document.querySelector('.cursor');
18641 return this.get().getAttribute('data-id');
18644 const el = this.get();
18646 el.classList.remove('cursor');
18651 const el = document.querySelector(elementId);
18653 el.classList.add('cursor');
18654 if (!(0, dom_1.isVisible)(el)) {
18655 el.scrollIntoView(true);
18660 this.get().classList.remove('expanded');
18661 this.get().classList.add('collapsed');
18664 this.get().classList.remove('collapsed');
18665 this.get().classList.add('expanded');
18667 isNodeCollapsed() {
18668 return this.get().classList.contains('collapsed');
18671 return this.get().classList.contains('expanded');
18674 exports.Cursor = Cursor;
18679 /***/ "./src/dom.ts":
18680 /*!********************!*\
18681 !*** ./src/dom.ts ***!
18682 \********************/
18683 /***/ ((__unused_webpack_module, exports) => {
18687 Object.defineProperty(exports, "__esModule", ({ value: true }));
18688 exports.isVisible = void 0;
18689 function isVisible(element) {
18690 const rect = element.getBoundingClientRect();
18691 return (rect.top >= 0 &&
18693 rect.top <= (window.innerHeight || document.documentElement.clientHeight) &&
18694 rect.right <= (window.innerWidth || document.documentElement.clientWidth));
18696 exports.isVisible = isVisible;
18701 /***/ "./src/help.ts":
18702 /*!*********************!*\
18703 !*** ./src/help.ts ***!
18704 \*********************/
18705 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
18709 var __importDefault = (this && this.__importDefault) || function (mod) {
18710 return (mod && mod.__esModule) ? mod : { "default": mod };
18712 Object.defineProperty(exports, "__esModule", ({ value: true }));
18713 exports.showHelp = void 0;
18714 const keyboardjs_1 = __importDefault(__webpack_require__(/*! keyboardjs */ "./node_modules/keyboardjs/dist/keyboard.js"));
18715 const lodash_1 = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
18716 const keyboardCommands = {
18717 'h': 'Move the cursor to the Parent Element of the current node',
18718 'l': 'Move the cursor to the first Child Element of the current node',
18719 'j': 'Move the cursor to the next sibling of the current node',
18720 'k': 'Move the cursor to the previous sibling of the current node',
18721 'enter': 'Add a new node as a sibling to the current node',
18722 'tab': 'Add a new node as the child of the current node',
18723 'shift + j': 'Swap the current node with next sibling node',
18724 'shift + k': 'Swap the current node with the previous sibling node',
18725 'shift + h': 'Lift the current node to be a sibling of the parent node',
18726 'shift + l': 'Lower the current node to be a child of the previous sibling node',
18727 'shift + d': 'Delete the current node',
18728 'shift + f': 'Open the search modal',
18729 'i': 'Enter "edit" mode, and place the cursor at the start of the editable content',
18730 '$': 'Enter "edit" mode, and place the cursor at the end of the editable content',
18731 'escape': 'Exit the current mode and return to "navigation" mode',
18732 '?': 'Display this help dialogue'
18734 const modalHTML = `
18735 <div class="modal">
18736 <div class="modal-content">
18746 ${(0, lodash_1.map)(keyboardCommands, (text, key) => {
18763 function showHelp() {
18764 document.querySelector('body').innerHTML += modalHTML;
18765 keyboardjs_1.default.setContext('help');
18767 exports.showHelp = showHelp;
18768 keyboardjs_1.default.withContext('help', () => {
18769 keyboardjs_1.default.bind('escape', e => {
18770 document.querySelector('.modal').remove();
18771 keyboardjs_1.default.setContext('navigation');
18778 /***/ "./src/outline.ts":
18779 /*!************************!*\
18780 !*** ./src/outline.ts ***!
18781 \************************/
18782 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
18786 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18787 if (k2 === undefined) k2 = k;
18788 var desc = Object.getOwnPropertyDescriptor(m, k);
18789 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18790 desc = { enumerable: true, get: function() { return m[k]; } };
18792 Object.defineProperty(o, k2, desc);
18793 }) : (function(o, m, k, k2) {
18794 if (k2 === undefined) k2 = k;
18797 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18798 Object.defineProperty(o, "default", { enumerable: true, value: v });
18799 }) : function(o, v) {
18802 var __importStar = (this && this.__importStar) || function (mod) {
18803 if (mod && mod.__esModule) return mod;
18805 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18806 __setModuleDefault(result, mod);
18809 Object.defineProperty(exports, "__esModule", ({ value: true }));
18810 exports.Outline = void 0;
18811 const _ = __importStar(__webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"));
18812 const uuid_1 = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/commonjs-browser/index.js");
18813 const marked_1 = __webpack_require__(/*! marked */ "./node_modules/marked/lib/marked.cjs");
18816 constructor(outlineData) {
18817 this.data = outlineData;
18819 findNodeInTree(root, id, action, runState = false) {
18820 let run = runState;
18824 _.each(root.children, (childNode, idx) => {
18825 if (childNode.id === id) {
18826 action(childNode, root);
18830 else if (childNode.children) {
18831 this.findNodeInTree(childNode, id, action, run);
18836 this.findNodeInTree(this.data.tree, nodeId, item => {
18837 item.collapsed = true;
18841 this.findNodeInTree(this.data.tree, nodeId, item => {
18842 item.collapsed = false;
18845 flattenOutlineTreeChildren(tree) {
18846 return tree.children.map(node => node.id);
18848 liftNodeToParent(nodeId) {
18850 let targetNode, parentNode;
18851 this.findNodeInTree(this.data.tree, nodeId, (tNode, pNode) => {
18852 targetNode = tNode;
18853 this.findNodeInTree(this.data.tree, pNode.id, (originalParentNode, newParentNode) => {
18858 parentNode = newParentNode;
18860 const flatId = newParentNode.children.map(n => n.id);
18861 const originalNodePosition = originalParentNode.children.map(n => n.id).indexOf(targetNode.id);
18862 const newNodePosition = flatId.indexOf(originalParentNode.id);
18863 originalParentNode.children.splice(originalNodePosition, 1);
18864 newParentNode.children.splice(newNodePosition + 1, 0, targetNode);
18872 lowerNodeToChild(nodeId) {
18874 let targetNode, newParentNode, oldParentNode;
18875 this.findNodeInTree(this.data.tree, nodeId, (tNode, pNode) => {
18880 targetNode = tNode;
18881 let idList = pNode.children.map(n => n.id);
18882 if (idList.length === 1) {
18885 const position = idList.indexOf(targetNode.id);
18886 const prevSiblingPosition = position - 1;
18887 pNode.children[prevSiblingPosition].children.splice(0, 0, targetNode);
18888 pNode.children.splice(position, 1);
18889 newParentNode = pNode.children[prevSiblingPosition];
18890 oldParentNode = pNode;
18898 swapNodeWithNextSibling(nodeId) {
18899 let targetNode, parentNode;
18900 this.findNodeInTree(this.data.tree, nodeId, (tNode, pNode) => {
18901 targetNode = tNode;
18902 parentNode = pNode;
18903 const flatId = parentNode.children.map(n => n.id);
18904 const nodePosition = flatId.indexOf(targetNode.id);
18905 if (nodePosition === (flatId.length - 1)) {
18908 parentNode.children.splice(nodePosition, 1);
18909 parentNode.children.splice(nodePosition + 1, 0, targetNode);
18916 swapNodeWithPreviousSibling(nodeId) {
18917 let targetNode, parentNode;
18918 this.findNodeInTree(this.data.tree, nodeId, (tNode, pNode) => {
18919 targetNode = tNode;
18920 parentNode = pNode;
18921 const flatId = parentNode.children.map(n => n.id);
18922 const nodePosition = flatId.indexOf(targetNode.id);
18923 if (nodePosition === 0) {
18926 parentNode.children.splice(nodePosition, 1);
18927 parentNode.children.splice(nodePosition - 1, 0, targetNode);
18934 createSiblingNode(targetNode, nodeData) {
18935 const outlineNode = nodeData || {
18936 id: (0, uuid_1.v4)(),
18937 created: Date.now(),
18940 strikethrough: false
18942 this.data.contentNodes[outlineNode.id] = outlineNode;
18944 this.findNodeInTree(this.data.tree, targetNode, (node, parent) => {
18945 const position = parent.children.map(n => n.id).indexOf(targetNode);
18946 parent.children.splice(position + 1, 0, {
18947 id: outlineNode.id,
18951 parentNode = parent;
18958 createChildNode(currentNode, nodeId) {
18959 const node = nodeId ? this.data.contentNodes[nodeId] :
18961 id: (0, uuid_1.v4)(),
18962 created: Date.now(),
18965 strikethrough: false
18968 this.data.contentNodes[node.id] = node;
18971 this.findNodeInTree(this.data.tree, currentNode, (foundNode, parent) => {
18972 foundNode.children.unshift({
18977 parentNode = foundNode;
18984 removeNode(nodeId) {
18986 let removedNode, parentNode;
18987 this.findNodeInTree(this.data.tree, nodeId, (tNode, pNode) => {
18992 removedNode = tNode;
18993 parentNode = pNode;
18994 let position = parentNode.children.map(n => n.id).indexOf(tNode.id);
18995 parentNode.children.splice(position, 1);
19002 updateContent(id, content) {
19003 if (!this.data.contentNodes[id]) {
19004 throw new Error('Invalid node');
19006 this.data.contentNodes[id].content = content;
19008 renderContent(nodeId) {
19009 let node = this.data.contentNodes[nodeId];
19011 switch (node.type) {
19013 content = marked_1.marked.parse(node.content);
19016 content = node.content;
19022 if (node.id === '000000') {
19023 return this.render();
19025 const collapse = node.collapsed ? 'collapsed' : 'expanded';
19026 const content = this.data.contentNodes[node.id] || {
19028 created: Date.now(),
19031 strikethrough: false
19033 const strikethrough = content.strikethrough ? 'strikethrough' : '';
19034 let html = `<div class="node ${collapse} ${strikethrough}" data-id="${node.id}" id="id-${node.id}">
19035 <div class="nodeContent" data-type="${content.type}">
19036 ${this.renderContent(node.id)}
19038 ${node.children.length ? _.map(node.children, this.renderNode.bind(this)).join("\n") : ''}
19043 return _.map(this.data.tree.children, this.renderNode.bind(this)).join("\n");
19046 exports.Outline = Outline;
19051 /***/ "./src/search.ts":
19052 /*!***********************!*\
19053 !*** ./src/search.ts ***!
19054 \***********************/
19055 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
19059 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
19060 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19061 return new (P || (P = Promise))(function (resolve, reject) {
19062 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19063 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19064 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19065 step((generator = generator.apply(thisArg, _arguments || [])).next());
19068 var __importDefault = (this && this.__importDefault) || function (mod) {
19069 return (mod && mod.__esModule) ? mod : { "default": mod };
19071 Object.defineProperty(exports, "__esModule", ({ value: true }));
19072 exports.Search = void 0;
19073 const lyra_1 = __webpack_require__(/*! @lyrasearch/lyra */ "./node_modules/@lyrasearch/lyra/dist/cjs/index.cjs");
19074 const lodash_1 = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
19075 const keyboardjs_1 = __importDefault(__webpack_require__(/*! keyboardjs */ "./node_modules/keyboardjs/dist/keyboard.js"));
19076 const dom_1 = __webpack_require__(/*! dom */ "./src/dom.ts");
19077 const searchModal = `
19078 <div class="modal">
19079 <div class="modal-content" id="search">
19080 <input type="text" id="search-query" placeholder="enter fuzzy search terms">
19081 <ul id="search-results">
19088 this.state = 'notready';
19090 createIndex(schema) {
19091 return __awaiter(this, void 0, void 0, function* () {
19092 this.db = yield (0, lyra_1.create)({
19095 this.state = 'ready';
19099 keyboardjs_1.default.withContext('search', () => {
19100 keyboardjs_1.default.bind('escape', e => {
19101 document.querySelector('.modal').remove();
19102 keyboardjs_1.default.setContext('navigation');
19104 keyboardjs_1.default.bind('down', e => {
19105 e.preventDefault();
19106 document.getElementById('search-query').blur();
19107 const el = document.querySelector('.search-result.selected');
19108 if (el.nextElementSibling) {
19109 el.classList.remove('selected');
19110 el.nextElementSibling.classList.add('selected');
19111 if (!(0, dom_1.isVisible)(el.nextElementSibling)) {
19112 el.nextElementSibling.scrollIntoView();
19116 keyboardjs_1.default.bind('up', e => {
19117 e.preventDefault();
19118 const el = document.querySelector('.search-result.selected');
19119 if (el.previousElementSibling) {
19120 el.classList.remove('selected');
19121 el.previousElementSibling.classList.add('selected');
19122 if (!(0, dom_1.isVisible)(el.previousElementSibling)) {
19123 el.previousElementSibling.scrollIntoView();
19127 keyboardjs_1.default.bind('enter', e => {
19128 const el = document.querySelector('.search-result.selected');
19129 const docId = el.getAttribute('data-id');
19130 document.querySelector('.modal').remove();
19131 keyboardjs_1.default.setContext('navigation');
19132 if (this.onTermSelection) {
19133 this.onTermSelection(docId);
19137 keyboardjs_1.default.withContext('navigation', () => {
19138 keyboardjs_1.default.bind('shift + f', e => {
19139 e.preventDefault();
19140 e.stopPropagation();
19141 document.querySelector('body').innerHTML += searchModal;
19142 const el = document.getElementById('search-query');
19144 el.addEventListener('keyup', this.debounceSearch.bind(this));
19145 keyboardjs_1.default.setContext('search');
19149 debounceSearch(e) {
19150 if (this.debounce) {
19151 clearInterval(this.debounce);
19153 const el = e.target;
19154 const query = el.value.toString().trim();
19155 if (query.length) {
19156 this.debounce = setTimeout(() => {
19157 this.displaySearch(query, e);
19161 displaySearch(terms, e) {
19162 return __awaiter(this, void 0, void 0, function* () {
19166 const res = yield this.search(terms);
19167 const resultContainer = document.getElementById('search-results');
19168 if (res.hits.length === 0) {
19169 resultContainer.innerHTML = '<li><em>No Results</em></li>';
19172 const html = res.hits.map((doc, idx) => {
19173 const content = doc.document.content.toString();
19174 const display = content.substring(0, 100);
19176 <li class="search-result ${idx === 0 ? 'selected' : ''}" data-id="${doc.id}">${display}${content.length > display.length ? '...' : ''}</li>
19179 resultContainer.innerHTML = html.join("\n");
19183 return (0, lyra_1.insert)(this.db, doc);
19186 return (0, lyra_1.insertBatch)(this.db, (0, lodash_1.map)(docs, doc => doc));
19189 return (0, lyra_1.search)(this.db, {
19191 properties: ["content"]
19195 exports.Search = Search;
19200 /***/ "./node_modules/uuid/dist/commonjs-browser/index.js":
19201 /*!**********************************************************!*\
19202 !*** ./node_modules/uuid/dist/commonjs-browser/index.js ***!
19203 \**********************************************************/
19204 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
19209 Object.defineProperty(exports, "__esModule", ({
19212 Object.defineProperty(exports, "NIL", ({
19214 get: function get() {
19215 return _nil.default;
19218 Object.defineProperty(exports, "parse", ({
19220 get: function get() {
19221 return _parse.default;
19224 Object.defineProperty(exports, "stringify", ({
19226 get: function get() {
19227 return _stringify.default;
19230 Object.defineProperty(exports, "v1", ({
19232 get: function get() {
19236 Object.defineProperty(exports, "v3", ({
19238 get: function get() {
19239 return _v2.default;
19242 Object.defineProperty(exports, "v4", ({
19244 get: function get() {
19245 return _v3.default;
19248 Object.defineProperty(exports, "v5", ({
19250 get: function get() {
19251 return _v4.default;
19254 Object.defineProperty(exports, "validate", ({
19256 get: function get() {
19257 return _validate.default;
19260 Object.defineProperty(exports, "version", ({
19262 get: function get() {
19263 return _version.default;
19267 var _v = _interopRequireDefault(__webpack_require__(/*! ./v1.js */ "./node_modules/uuid/dist/commonjs-browser/v1.js"));
19269 var _v2 = _interopRequireDefault(__webpack_require__(/*! ./v3.js */ "./node_modules/uuid/dist/commonjs-browser/v3.js"));
19271 var _v3 = _interopRequireDefault(__webpack_require__(/*! ./v4.js */ "./node_modules/uuid/dist/commonjs-browser/v4.js"));
19273 var _v4 = _interopRequireDefault(__webpack_require__(/*! ./v5.js */ "./node_modules/uuid/dist/commonjs-browser/v5.js"));
19275 var _nil = _interopRequireDefault(__webpack_require__(/*! ./nil.js */ "./node_modules/uuid/dist/commonjs-browser/nil.js"));
19277 var _version = _interopRequireDefault(__webpack_require__(/*! ./version.js */ "./node_modules/uuid/dist/commonjs-browser/version.js"));
19279 var _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/commonjs-browser/validate.js"));
19281 var _stringify = _interopRequireDefault(__webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/commonjs-browser/stringify.js"));
19283 var _parse = _interopRequireDefault(__webpack_require__(/*! ./parse.js */ "./node_modules/uuid/dist/commonjs-browser/parse.js"));
19285 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19289 /***/ "./node_modules/uuid/dist/commonjs-browser/md5.js":
19290 /*!********************************************************!*\
19291 !*** ./node_modules/uuid/dist/commonjs-browser/md5.js ***!
19292 \********************************************************/
19293 /***/ ((__unused_webpack_module, exports) => {
19298 Object.defineProperty(exports, "__esModule", ({
19301 exports["default"] = void 0;
19304 * Browser-compatible JavaScript MD5
19306 * Modification of JavaScript MD5
19307 * https://github.com/blueimp/JavaScript-MD5
19309 * Copyright 2011, Sebastian Tschan
19310 * https://blueimp.net
19312 * Licensed under the MIT license:
19313 * https://opensource.org/licenses/MIT
19316 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
19317 * Digest Algorithm, as defined in RFC 1321.
19318 * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
19319 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
19320 * Distributed under the BSD License
19321 * See http://pajhome.org.uk/crypt/md5 for more info.
19323 function md5(bytes) {
19324 if (typeof bytes === 'string') {
19325 const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
19327 bytes = new Uint8Array(msg.length);
19329 for (let i = 0; i < msg.length; ++i) {
19330 bytes[i] = msg.charCodeAt(i);
19334 return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
19337 * Convert an array of little-endian words to an array of bytes
19341 function md5ToHexEncodedArray(input) {
19343 const length32 = input.length * 32;
19344 const hexTab = '0123456789abcdef';
19346 for (let i = 0; i < length32; i += 8) {
19347 const x = input[i >> 5] >>> i % 32 & 0xff;
19348 const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
19355 * Calculate output length with padding and bit length
19359 function getOutputLength(inputLength8) {
19360 return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;
19363 * Calculate the MD5 of an array of little-endian words, and a bit length.
19367 function wordsToMd5(x, len) {
19368 /* append padding */
19369 x[len >> 5] |= 0x80 << len % 32;
19370 x[getOutputLength(len) - 1] = len;
19371 let a = 1732584193;
19372 let b = -271733879;
19373 let c = -1732584194;
19376 for (let i = 0; i < x.length; i += 16) {
19381 a = md5ff(a, b, c, d, x[i], 7, -680876936);
19382 d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
19383 c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
19384 b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
19385 a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
19386 d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
19387 c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
19388 b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
19389 a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
19390 d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
19391 c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
19392 b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
19393 a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
19394 d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
19395 c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
19396 b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
19397 a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
19398 d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
19399 c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
19400 b = md5gg(b, c, d, a, x[i], 20, -373897302);
19401 a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
19402 d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
19403 c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
19404 b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
19405 a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
19406 d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
19407 c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
19408 b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
19409 a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
19410 d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
19411 c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
19412 b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
19413 a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
19414 d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
19415 c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
19416 b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
19417 a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
19418 d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
19419 c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
19420 b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
19421 a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
19422 d = md5hh(d, a, b, c, x[i], 11, -358537222);
19423 c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
19424 b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
19425 a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
19426 d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
19427 c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
19428 b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
19429 a = md5ii(a, b, c, d, x[i], 6, -198630844);
19430 d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
19431 c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
19432 b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
19433 a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
19434 d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
19435 c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
19436 b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
19437 a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
19438 d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
19439 c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
19440 b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
19441 a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
19442 d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
19443 c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
19444 b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
19445 a = safeAdd(a, olda);
19446 b = safeAdd(b, oldb);
19447 c = safeAdd(c, oldc);
19448 d = safeAdd(d, oldd);
19451 return [a, b, c, d];
19454 * Convert an array bytes to an array of little-endian words
19455 * Characters >255 have their high-byte silently ignored.
19459 function bytesToWords(input) {
19460 if (input.length === 0) {
19464 const length8 = input.length * 8;
19465 const output = new Uint32Array(getOutputLength(length8));
19467 for (let i = 0; i < length8; i += 8) {
19468 output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
19474 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
19475 * to work around bugs in some JS interpreters.
19479 function safeAdd(x, y) {
19480 const lsw = (x & 0xffff) + (y & 0xffff);
19481 const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
19482 return msw << 16 | lsw & 0xffff;
19485 * Bitwise rotate a 32-bit number to the left.
19489 function bitRotateLeft(num, cnt) {
19490 return num << cnt | num >>> 32 - cnt;
19493 * These functions implement the four basic operations the algorithm uses.
19497 function md5cmn(q, a, b, x, s, t) {
19498 return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
19501 function md5ff(a, b, c, d, x, s, t) {
19502 return md5cmn(b & c | ~b & d, a, b, x, s, t);
19505 function md5gg(a, b, c, d, x, s, t) {
19506 return md5cmn(b & d | c & ~d, a, b, x, s, t);
19509 function md5hh(a, b, c, d, x, s, t) {
19510 return md5cmn(b ^ c ^ d, a, b, x, s, t);
19513 function md5ii(a, b, c, d, x, s, t) {
19514 return md5cmn(c ^ (b | ~d), a, b, x, s, t);
19517 var _default = md5;
19518 exports["default"] = _default;
19522 /***/ "./node_modules/uuid/dist/commonjs-browser/native.js":
19523 /*!***********************************************************!*\
19524 !*** ./node_modules/uuid/dist/commonjs-browser/native.js ***!
19525 \***********************************************************/
19526 /***/ ((__unused_webpack_module, exports) => {
19531 Object.defineProperty(exports, "__esModule", ({
19534 exports["default"] = void 0;
19535 const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
19539 exports["default"] = _default;
19543 /***/ "./node_modules/uuid/dist/commonjs-browser/nil.js":
19544 /*!********************************************************!*\
19545 !*** ./node_modules/uuid/dist/commonjs-browser/nil.js ***!
19546 \********************************************************/
19547 /***/ ((__unused_webpack_module, exports) => {
19552 Object.defineProperty(exports, "__esModule", ({
19555 exports["default"] = void 0;
19556 var _default = '00000000-0000-0000-0000-000000000000';
19557 exports["default"] = _default;
19561 /***/ "./node_modules/uuid/dist/commonjs-browser/parse.js":
19562 /*!**********************************************************!*\
19563 !*** ./node_modules/uuid/dist/commonjs-browser/parse.js ***!
19564 \**********************************************************/
19565 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
19570 Object.defineProperty(exports, "__esModule", ({
19573 exports["default"] = void 0;
19575 var _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/commonjs-browser/validate.js"));
19577 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19579 function parse(uuid) {
19580 if (!(0, _validate.default)(uuid)) {
19581 throw TypeError('Invalid UUID');
19585 const arr = new Uint8Array(16); // Parse ########-....-....-....-............
19587 arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
19588 arr[1] = v >>> 16 & 0xff;
19589 arr[2] = v >>> 8 & 0xff;
19590 arr[3] = v & 0xff; // Parse ........-####-....-....-............
19592 arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
19593 arr[5] = v & 0xff; // Parse ........-....-####-....-............
19595 arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
19596 arr[7] = v & 0xff; // Parse ........-....-....-####-............
19598 arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
19599 arr[9] = v & 0xff; // Parse ........-....-....-....-############
19600 // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
19602 arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
19603 arr[11] = v / 0x100000000 & 0xff;
19604 arr[12] = v >>> 24 & 0xff;
19605 arr[13] = v >>> 16 & 0xff;
19606 arr[14] = v >>> 8 & 0xff;
19607 arr[15] = v & 0xff;
19611 var _default = parse;
19612 exports["default"] = _default;
19616 /***/ "./node_modules/uuid/dist/commonjs-browser/regex.js":
19617 /*!**********************************************************!*\
19618 !*** ./node_modules/uuid/dist/commonjs-browser/regex.js ***!
19619 \**********************************************************/
19620 /***/ ((__unused_webpack_module, exports) => {
19625 Object.defineProperty(exports, "__esModule", ({
19628 exports["default"] = void 0;
19629 var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
19630 exports["default"] = _default;
19634 /***/ "./node_modules/uuid/dist/commonjs-browser/rng.js":
19635 /*!********************************************************!*\
19636 !*** ./node_modules/uuid/dist/commonjs-browser/rng.js ***!
19637 \********************************************************/
19638 /***/ ((__unused_webpack_module, exports) => {
19643 Object.defineProperty(exports, "__esModule", ({
19646 exports["default"] = rng;
19647 // Unique ID creation requires a high quality random # generator. In the browser we therefore
19648 // require the crypto API and do not support built-in fallback to lower quality random number
19649 // generators (like Math.random()).
19650 let getRandomValues;
19651 const rnds8 = new Uint8Array(16);
19654 // lazy load so that environments that need to polyfill have a chance to do so
19655 if (!getRandomValues) {
19656 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
19657 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
19659 if (!getRandomValues) {
19660 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
19664 return getRandomValues(rnds8);
19669 /***/ "./node_modules/uuid/dist/commonjs-browser/sha1.js":
19670 /*!*********************************************************!*\
19671 !*** ./node_modules/uuid/dist/commonjs-browser/sha1.js ***!
19672 \*********************************************************/
19673 /***/ ((__unused_webpack_module, exports) => {
19678 Object.defineProperty(exports, "__esModule", ({
19681 exports["default"] = void 0;
19683 // Adapted from Chris Veness' SHA1 code at
19684 // http://www.movable-type.co.uk/scripts/sha1.html
19685 function f(s, x, y, z) {
19688 return x & y ^ ~x & z;
19694 return x & y ^ x & z ^ y & z;
19701 function ROTL(x, n) {
19702 return x << n | x >>> 32 - n;
19705 function sha1(bytes) {
19706 const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
19707 const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
19709 if (typeof bytes === 'string') {
19710 const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
19714 for (let i = 0; i < msg.length; ++i) {
19715 bytes.push(msg.charCodeAt(i));
19717 } else if (!Array.isArray(bytes)) {
19718 // Convert Array-like to Array
19719 bytes = Array.prototype.slice.call(bytes);
19723 const l = bytes.length / 4 + 2;
19724 const N = Math.ceil(l / 16);
19725 const M = new Array(N);
19727 for (let i = 0; i < N; ++i) {
19728 const arr = new Uint32Array(16);
19730 for (let j = 0; j < 16; ++j) {
19731 arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
19737 M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
19738 M[N - 1][14] = Math.floor(M[N - 1][14]);
19739 M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
19741 for (let i = 0; i < N; ++i) {
19742 const W = new Uint32Array(80);
19744 for (let t = 0; t < 16; ++t) {
19748 for (let t = 16; t < 80; ++t) {
19749 W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
19758 for (let t = 0; t < 80; ++t) {
19759 const s = Math.floor(t / 20);
19760 const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
19763 c = ROTL(b, 30) >>> 0;
19768 H[0] = H[0] + a >>> 0;
19769 H[1] = H[1] + b >>> 0;
19770 H[2] = H[2] + c >>> 0;
19771 H[3] = H[3] + d >>> 0;
19772 H[4] = H[4] + e >>> 0;
19775 return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
19778 var _default = sha1;
19779 exports["default"] = _default;
19783 /***/ "./node_modules/uuid/dist/commonjs-browser/stringify.js":
19784 /*!**************************************************************!*\
19785 !*** ./node_modules/uuid/dist/commonjs-browser/stringify.js ***!
19786 \**************************************************************/
19787 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
19792 Object.defineProperty(exports, "__esModule", ({
19795 exports["default"] = void 0;
19796 exports.unsafeStringify = unsafeStringify;
19798 var _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/commonjs-browser/validate.js"));
19800 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19803 * Convert array of 16 byte values to UUID string format of the form:
19804 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
19806 const byteToHex = [];
19808 for (let i = 0; i < 256; ++i) {
19809 byteToHex.push((i + 0x100).toString(16).slice(1));
19812 function unsafeStringify(arr, offset = 0) {
19813 // Note: Be careful editing this code! It's been tuned for performance
19814 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
19815 return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
19818 function stringify(arr, offset = 0) {
19819 const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
19820 // of the following:
19821 // - One or more input array values don't map to a hex octet (leading to
19822 // "undefined" in the uuid)
19823 // - Invalid input values for the RFC `version` or `variant` fields
19825 if (!(0, _validate.default)(uuid)) {
19826 throw TypeError('Stringified UUID is invalid');
19832 var _default = stringify;
19833 exports["default"] = _default;
19837 /***/ "./node_modules/uuid/dist/commonjs-browser/v1.js":
19838 /*!*******************************************************!*\
19839 !*** ./node_modules/uuid/dist/commonjs-browser/v1.js ***!
19840 \*******************************************************/
19841 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
19846 Object.defineProperty(exports, "__esModule", ({
19849 exports["default"] = void 0;
19851 var _rng = _interopRequireDefault(__webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/commonjs-browser/rng.js"));
19853 var _stringify = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/commonjs-browser/stringify.js");
19855 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19857 // **`v1()` - Generate time-based UUID**
19859 // Inspired by https://github.com/LiosK/UUID.js
19860 // and http://docs.python.org/library/uuid.html
19863 let _clockseq; // Previous uuid creation time
19866 let _lastMSecs = 0;
19867 let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
19869 function v1(options, buf, offset) {
19870 let i = buf && offset || 0;
19871 const b = buf || new Array(16);
19872 options = options || {};
19873 let node = options.node || _nodeId;
19874 let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
19875 // specified. We do this lazily to minimize issues related to insufficient
19876 // system entropy. See #189
19878 if (node == null || clockseq == null) {
19879 const seedBytes = options.random || (options.rng || _rng.default)();
19881 if (node == null) {
19882 // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
19883 node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
19886 if (clockseq == null) {
19887 // Per 4.2.2, randomize (14 bit) clockseq
19888 clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
19890 } // UUID timestamps are 100 nano-second units since the Gregorian epoch,
19891 // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
19892 // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
19893 // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
19896 let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
19897 // cycle to simulate higher resolution clock
19899 let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
19901 const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
19903 if (dt < 0 && options.clockseq === undefined) {
19904 clockseq = clockseq + 1 & 0x3fff;
19905 } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
19909 if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
19911 } // Per 4.2.1.2 Throw error if too many uuids are requested
19914 if (nsecs >= 10000) {
19915 throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
19918 _lastMSecs = msecs;
19919 _lastNSecs = nsecs;
19920 _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
19922 msecs += 12219292800000; // `time_low`
19924 const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
19925 b[i++] = tl >>> 24 & 0xff;
19926 b[i++] = tl >>> 16 & 0xff;
19927 b[i++] = tl >>> 8 & 0xff;
19928 b[i++] = tl & 0xff; // `time_mid`
19930 const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
19931 b[i++] = tmh >>> 8 & 0xff;
19932 b[i++] = tmh & 0xff; // `time_high_and_version`
19934 b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
19936 b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
19938 b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
19940 b[i++] = clockseq & 0xff; // `node`
19942 for (let n = 0; n < 6; ++n) {
19943 b[i + n] = node[n];
19946 return buf || (0, _stringify.unsafeStringify)(b);
19950 exports["default"] = _default;
19954 /***/ "./node_modules/uuid/dist/commonjs-browser/v3.js":
19955 /*!*******************************************************!*\
19956 !*** ./node_modules/uuid/dist/commonjs-browser/v3.js ***!
19957 \*******************************************************/
19958 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
19963 Object.defineProperty(exports, "__esModule", ({
19966 exports["default"] = void 0;
19968 var _v = _interopRequireDefault(__webpack_require__(/*! ./v35.js */ "./node_modules/uuid/dist/commonjs-browser/v35.js"));
19970 var _md = _interopRequireDefault(__webpack_require__(/*! ./md5.js */ "./node_modules/uuid/dist/commonjs-browser/md5.js"));
19972 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19974 const v3 = (0, _v.default)('v3', 0x30, _md.default);
19976 exports["default"] = _default;
19980 /***/ "./node_modules/uuid/dist/commonjs-browser/v35.js":
19981 /*!********************************************************!*\
19982 !*** ./node_modules/uuid/dist/commonjs-browser/v35.js ***!
19983 \********************************************************/
19984 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
19989 Object.defineProperty(exports, "__esModule", ({
19992 exports.URL = exports.DNS = void 0;
19993 exports["default"] = v35;
19995 var _stringify = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/commonjs-browser/stringify.js");
19997 var _parse = _interopRequireDefault(__webpack_require__(/*! ./parse.js */ "./node_modules/uuid/dist/commonjs-browser/parse.js"));
19999 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20001 function stringToBytes(str) {
20002 str = unescape(encodeURIComponent(str)); // UTF8 escape
20006 for (let i = 0; i < str.length; ++i) {
20007 bytes.push(str.charCodeAt(i));
20013 const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
20015 const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
20018 function v35(name, version, hashfunc) {
20019 function generateUUID(value, namespace, buf, offset) {
20022 if (typeof value === 'string') {
20023 value = stringToBytes(value);
20026 if (typeof namespace === 'string') {
20027 namespace = (0, _parse.default)(namespace);
20030 if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
20031 throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
20032 } // Compute hash of namespace and value, Per 4.3
20033 // Future: Use spread syntax when supported on all platforms, e.g. `bytes =
20034 // hashfunc([...namespace, ... value])`
20037 let bytes = new Uint8Array(16 + value.length);
20038 bytes.set(namespace);
20039 bytes.set(value, namespace.length);
20040 bytes = hashfunc(bytes);
20041 bytes[6] = bytes[6] & 0x0f | version;
20042 bytes[8] = bytes[8] & 0x3f | 0x80;
20045 offset = offset || 0;
20047 for (let i = 0; i < 16; ++i) {
20048 buf[offset + i] = bytes[i];
20054 return (0, _stringify.unsafeStringify)(bytes);
20055 } // Function#name is not settable on some platforms (#270)
20059 generateUUID.name = name; // eslint-disable-next-line no-empty
20060 } catch (err) {} // For CommonJS default export support
20063 generateUUID.DNS = DNS;
20064 generateUUID.URL = URL;
20065 return generateUUID;
20070 /***/ "./node_modules/uuid/dist/commonjs-browser/v4.js":
20071 /*!*******************************************************!*\
20072 !*** ./node_modules/uuid/dist/commonjs-browser/v4.js ***!
20073 \*******************************************************/
20074 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
20079 Object.defineProperty(exports, "__esModule", ({
20082 exports["default"] = void 0;
20084 var _native = _interopRequireDefault(__webpack_require__(/*! ./native.js */ "./node_modules/uuid/dist/commonjs-browser/native.js"));
20086 var _rng = _interopRequireDefault(__webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/commonjs-browser/rng.js"));
20088 var _stringify = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/commonjs-browser/stringify.js");
20090 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20092 function v4(options, buf, offset) {
20093 if (_native.default.randomUUID && !buf && !options) {
20094 return _native.default.randomUUID();
20097 options = options || {};
20099 const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
20102 rnds[6] = rnds[6] & 0x0f | 0x40;
20103 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
20106 offset = offset || 0;
20108 for (let i = 0; i < 16; ++i) {
20109 buf[offset + i] = rnds[i];
20115 return (0, _stringify.unsafeStringify)(rnds);
20119 exports["default"] = _default;
20123 /***/ "./node_modules/uuid/dist/commonjs-browser/v5.js":
20124 /*!*******************************************************!*\
20125 !*** ./node_modules/uuid/dist/commonjs-browser/v5.js ***!
20126 \*******************************************************/
20127 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
20132 Object.defineProperty(exports, "__esModule", ({
20135 exports["default"] = void 0;
20137 var _v = _interopRequireDefault(__webpack_require__(/*! ./v35.js */ "./node_modules/uuid/dist/commonjs-browser/v35.js"));
20139 var _sha = _interopRequireDefault(__webpack_require__(/*! ./sha1.js */ "./node_modules/uuid/dist/commonjs-browser/sha1.js"));
20141 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20143 const v5 = (0, _v.default)('v5', 0x50, _sha.default);
20145 exports["default"] = _default;
20149 /***/ "./node_modules/uuid/dist/commonjs-browser/validate.js":
20150 /*!*************************************************************!*\
20151 !*** ./node_modules/uuid/dist/commonjs-browser/validate.js ***!
20152 \*************************************************************/
20153 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
20158 Object.defineProperty(exports, "__esModule", ({
20161 exports["default"] = void 0;
20163 var _regex = _interopRequireDefault(__webpack_require__(/*! ./regex.js */ "./node_modules/uuid/dist/commonjs-browser/regex.js"));
20165 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20167 function validate(uuid) {
20168 return typeof uuid === 'string' && _regex.default.test(uuid);
20171 var _default = validate;
20172 exports["default"] = _default;
20176 /***/ "./node_modules/uuid/dist/commonjs-browser/version.js":
20177 /*!************************************************************!*\
20178 !*** ./node_modules/uuid/dist/commonjs-browser/version.js ***!
20179 \************************************************************/
20180 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
20185 Object.defineProperty(exports, "__esModule", ({
20188 exports["default"] = void 0;
20190 var _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/commonjs-browser/validate.js"));
20192 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20194 function version(uuid) {
20195 if (!(0, _validate.default)(uuid)) {
20196 throw TypeError('Invalid UUID');
20199 return parseInt(uuid.slice(14, 15), 16);
20202 var _default = version;
20203 exports["default"] = _default;
20207 /***/ "./node_modules/@lyrasearch/lyra/dist/cjs/index.cjs":
20208 /*!**********************************************************!*\
20209 !*** ./node_modules/@lyrasearch/lyra/dist/cjs/index.cjs ***!
20210 \**********************************************************/
20211 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
20215 Object.defineProperty(exports, "__esModule", ({
20218 function _export(target, all) {
20219 for(var name in all)Object.defineProperty(target, name, {
20225 create: ()=>create,
20226 insert: ()=>insert,
20227 insertWithHooks: ()=>insertWithHooks,
20228 insertBatch: ()=>insertBatch,
20229 remove: ()=>remove,
20230 search: ()=>search,
20233 requireLyra: ()=>requireLyra
20237 let _esmInsertWithHooks;
20238 let _esmInsertBatch;
20243 async function create(...args) {
20245 const imported = await Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_node_js-node_modules_lyrasearch_lyra_dis-426440"), __webpack_require__.e("node_modules_lyrasearch_lyra_dist_methods_create_js")]).then(__webpack_require__.bind(__webpack_require__, /*! ../methods/create.js */ "./node_modules/@lyrasearch/lyra/dist/methods/create.js"));
20246 _esmCreate = imported.create;
20248 return _esmCreate(...args);
20250 async function insert(...args) {
20252 const imported = await Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_radix_js"), __webpack_require__.e("node_modules_lyrasearch_lyra_dist_methods_insert_js-node_modules_lyrasearch_lyra_dist_radix-t-7cfd98")]).then(__webpack_require__.bind(__webpack_require__, /*! ../methods/insert.js */ "./node_modules/@lyrasearch/lyra/dist/methods/insert.js"));
20253 _esmInsert = imported.insert;
20255 return _esmInsert(...args);
20257 async function insertWithHooks(...args) {
20258 if (!_esmInsertWithHooks) {
20259 const imported = await Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_radix_js"), __webpack_require__.e("node_modules_lyrasearch_lyra_dist_methods_insert_js-node_modules_lyrasearch_lyra_dist_radix-t-7cfd98")]).then(__webpack_require__.bind(__webpack_require__, /*! ../methods/insert.js */ "./node_modules/@lyrasearch/lyra/dist/methods/insert.js"));
20260 _esmInsertWithHooks = imported.insertWithHooks;
20262 return _esmInsertWithHooks(...args);
20264 async function insertBatch(...args) {
20265 if (!_esmInsertBatch) {
20266 const imported = await Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_radix_js"), __webpack_require__.e("node_modules_lyrasearch_lyra_dist_methods_insert_js-node_modules_lyrasearch_lyra_dist_radix-t-7cfd98")]).then(__webpack_require__.bind(__webpack_require__, /*! ../methods/insert.js */ "./node_modules/@lyrasearch/lyra/dist/methods/insert.js"));
20267 _esmInsertBatch = imported.insertBatch;
20269 return _esmInsertBatch(...args);
20271 async function remove(...args) {
20273 const imported = await Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_node_js-node_modules_lyrasearch_lyra_dis-426440"), __webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_radix_js"), __webpack_require__.e("node_modules_lyrasearch_lyra_dist_methods_remove_js")]).then(__webpack_require__.bind(__webpack_require__, /*! ../methods/remove.js */ "./node_modules/@lyrasearch/lyra/dist/methods/remove.js"));
20274 _esmRemove = imported.remove;
20276 return _esmRemove(...args);
20278 async function search(...args) {
20280 const imported = await Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_node_js-node_modules_lyrasearch_lyra_dis-426440"), __webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_radix_js"), __webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_methods_search_js")]).then(__webpack_require__.bind(__webpack_require__, /*! ../methods/search.js */ "./node_modules/@lyrasearch/lyra/dist/methods/search.js"));
20281 _esmSearch = imported.search;
20283 return _esmSearch(...args);
20285 async function save(...args) {
20287 const imported = await __webpack_require__.e(/*! import() */ "node_modules_lyrasearch_lyra_dist_methods_save_js").then(__webpack_require__.bind(__webpack_require__, /*! ../methods/save.js */ "./node_modules/@lyrasearch/lyra/dist/methods/save.js"));
20288 _esmSave = imported.save;
20290 return _esmSave(...args);
20292 async function load(...args) {
20294 const imported = await __webpack_require__.e(/*! import() */ "node_modules_lyrasearch_lyra_dist_methods_load_js").then(__webpack_require__.bind(__webpack_require__, /*! ../methods/load.js */ "./node_modules/@lyrasearch/lyra/dist/methods/load.js"));
20295 _esmLoad = imported.load;
20297 return _esmLoad(...args);
20299 function requireLyra(callback) {
20300 Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_node_js-node_modules_lyrasearch_lyra_dis-426440"), __webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_radix-tree_radix_js"), __webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_methods_search_js"), __webpack_require__.e("vendors-node_modules_lyrasearch_lyra_dist_index_js")]).then(__webpack_require__.bind(__webpack_require__, /*! ../index.js */ "./node_modules/@lyrasearch/lyra/dist/index.js")).then((loaded)=>setTimeout(()=>callback(undefined, loaded), 1)).catch((error)=>setTimeout(()=>callback(error), 1));
20303 //# sourceMappingURL=index.js.map
20307 /***/ "./node_modules/marked/lib/marked.cjs":
20308 /*!********************************************!*\
20309 !*** ./node_modules/marked/lib/marked.cjs ***!
20310 \********************************************/
20311 /***/ ((__unused_webpack_module, exports) => {
20315 * marked v4.2.12 - a markdown parser
20316 * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
20317 * https://github.com/markedjs/marked
20321 * DO NOT EDIT THIS FILE
20322 * The code in this file is generated from files in ./src/
20327 function _defineProperties(target, props) {
20328 for (var i = 0; i < props.length; i++) {
20329 var descriptor = props[i];
20330 descriptor.enumerable = descriptor.enumerable || false;
20331 descriptor.configurable = true;
20332 if ("value" in descriptor) descriptor.writable = true;
20333 Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
20336 function _createClass(Constructor, protoProps, staticProps) {
20337 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
20338 if (staticProps) _defineProperties(Constructor, staticProps);
20339 Object.defineProperty(Constructor, "prototype", {
20342 return Constructor;
20344 function _unsupportedIterableToArray(o, minLen) {
20346 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
20347 var n = Object.prototype.toString.call(o).slice(8, -1);
20348 if (n === "Object" && o.constructor) n = o.constructor.name;
20349 if (n === "Map" || n === "Set") return Array.from(o);
20350 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
20352 function _arrayLikeToArray(arr, len) {
20353 if (len == null || len > arr.length) len = arr.length;
20354 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
20357 function _createForOfIteratorHelperLoose(o, allowArrayLike) {
20358 var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
20359 if (it) return (it = it.call(o)).next.bind(it);
20360 if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
20363 return function () {
20364 if (i >= o.length) return {
20373 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
20375 function _toPrimitive(input, hint) {
20376 if (typeof input !== "object" || input === null) return input;
20377 var prim = input[Symbol.toPrimitive];
20378 if (prim !== undefined) {
20379 var res = prim.call(input, hint || "default");
20380 if (typeof res !== "object") return res;
20381 throw new TypeError("@@toPrimitive must return a primitive value.");
20383 return (hint === "string" ? String : Number)(input);
20385 function _toPropertyKey(arg) {
20386 var key = _toPrimitive(arg, "string");
20387 return typeof key === "symbol" ? key : String(key);
20390 function getDefaults() {
20400 langPrefix: 'language-',
20407 smartypants: false,
20413 exports.defaults = getDefaults();
20414 function changeDefaults(newDefaults) {
20415 exports.defaults = newDefaults;
20421 var escapeTest = /[&<>"']/;
20422 var escapeReplace = new RegExp(escapeTest.source, 'g');
20423 var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
20424 var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
20425 var escapeReplacements = {
20432 var getEscapeReplacement = function getEscapeReplacement(ch) {
20433 return escapeReplacements[ch];
20435 function escape(html, encode) {
20437 if (escapeTest.test(html)) {
20438 return html.replace(escapeReplace, getEscapeReplacement);
20441 if (escapeTestNoEncode.test(html)) {
20442 return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
20447 var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
20450 * @param {string} html
20452 function unescape(html) {
20453 // explicitly match decimal, hex, and named HTML entities
20454 return html.replace(unescapeTest, function (_, n) {
20455 n = n.toLowerCase();
20456 if (n === 'colon') return ':';
20457 if (n.charAt(0) === '#') {
20458 return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
20463 var caret = /(^|[^\[])\^/g;
20466 * @param {string | RegExp} regex
20467 * @param {string} opt
20469 function edit(regex, opt) {
20470 regex = typeof regex === 'string' ? regex : regex.source;
20473 replace: function replace(name, val) {
20474 val = val.source || val;
20475 val = val.replace(caret, '$1');
20476 regex = regex.replace(name, val);
20479 getRegex: function getRegex() {
20480 return new RegExp(regex, opt);
20485 var nonWordAndColonTest = /[^\w:]/g;
20486 var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
20489 * @param {boolean} sanitize
20490 * @param {string} base
20491 * @param {string} href
20493 function cleanUrl(sanitize, base, href) {
20497 prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
20501 if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
20505 if (base && !originIndependentUrl.test(href)) {
20506 href = resolveUrl(base, href);
20509 href = encodeURI(href).replace(/%25/g, '%');
20516 var justDomain = /^[^:]+:\/*[^/]*$/;
20517 var protocol = /^([^:]+:)[\s\S]*$/;
20518 var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
20521 * @param {string} base
20522 * @param {string} href
20524 function resolveUrl(base, href) {
20525 if (!baseUrls[' ' + base]) {
20526 // we can ignore everything in base after the last slash of its path component,
20527 // but we might need to add _that_
20528 // https://tools.ietf.org/html/rfc3986#section-3
20529 if (justDomain.test(base)) {
20530 baseUrls[' ' + base] = base + '/';
20532 baseUrls[' ' + base] = rtrim(base, '/', true);
20535 base = baseUrls[' ' + base];
20536 var relativeBase = base.indexOf(':') === -1;
20537 if (href.substring(0, 2) === '//') {
20538 if (relativeBase) {
20541 return base.replace(protocol, '$1') + href;
20542 } else if (href.charAt(0) === '/') {
20543 if (relativeBase) {
20546 return base.replace(domain, '$1') + href;
20548 return base + href;
20552 exec: function noopTest() {}
20554 function merge(obj) {
20558 for (; i < arguments.length; i++) {
20559 target = arguments[i];
20560 for (key in target) {
20561 if (Object.prototype.hasOwnProperty.call(target, key)) {
20562 obj[key] = target[key];
20568 function splitCells(tableRow, count) {
20569 // ensure that every cell-delimiting pipe has a space
20570 // before it to distinguish it from an escaped pipe
20571 var row = tableRow.replace(/\|/g, function (match, offset, str) {
20572 var escaped = false,
20574 while (--curr >= 0 && str[curr] === '\\') {
20575 escaped = !escaped;
20578 // odd number of slashes means | is escaped
20579 // so we leave it alone
20582 // add space before unescaped |
20586 cells = row.split(/ \|/);
20589 // First/last cell in a row cannot be empty if it has no leading/trailing pipe
20590 if (!cells[0].trim()) {
20593 if (cells.length > 0 && !cells[cells.length - 1].trim()) {
20596 if (cells.length > count) {
20597 cells.splice(count);
20599 while (cells.length < count) {
20603 for (; i < cells.length; i++) {
20604 // leading or trailing whitespace is ignored per the gfm spec
20605 cells[i] = cells[i].trim().replace(/\\\|/g, '|');
20611 * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
20612 * /c*$/ is vulnerable to REDOS.
20614 * @param {string} str
20615 * @param {string} c
20616 * @param {boolean} invert Remove suffix of non-c chars instead. Default falsey.
20618 function rtrim(str, c, invert) {
20619 var l = str.length;
20624 // Length of suffix matching the invert condition.
20627 // Step left until we fail to match the invert condition.
20628 while (suffLen < l) {
20629 var currChar = str.charAt(l - suffLen - 1);
20630 if (currChar === c && !invert) {
20632 } else if (currChar !== c && invert) {
20638 return str.slice(0, l - suffLen);
20640 function findClosingBracket(str, b) {
20641 if (str.indexOf(b[1]) === -1) {
20644 var l = str.length;
20647 for (; i < l; i++) {
20648 if (str[i] === '\\') {
20650 } else if (str[i] === b[0]) {
20652 } else if (str[i] === b[1]) {
20661 function checkSanitizeDeprecation(opt) {
20662 if (opt && opt.sanitize && !opt.silent) {
20663 console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
20667 // copied from https://stackoverflow.com/a/5450113/806777
20669 * @param {string} pattern
20670 * @param {number} count
20672 function repeatString(pattern, count) {
20677 while (count > 1) {
20682 pattern += pattern;
20684 return result + pattern;
20687 function outputLink(cap, link, raw, lexer) {
20688 var href = link.href;
20689 var title = link.title ? escape(link.title) : null;
20690 var text = cap[1].replace(/\\([\[\]])/g, '$1');
20691 if (cap[0].charAt(0) !== '!') {
20692 lexer.state.inLink = true;
20699 tokens: lexer.inlineTokens(text)
20701 lexer.state.inLink = false;
20712 function indentCodeCompensation(raw, text) {
20713 var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
20714 if (matchIndentToCode === null) {
20717 var indentToCode = matchIndentToCode[1];
20718 return text.split('\n').map(function (node) {
20719 var matchIndentInNode = node.match(/^\s+/);
20720 if (matchIndentInNode === null) {
20723 var indentInNode = matchIndentInNode[0];
20724 if (indentInNode.length >= indentToCode.length) {
20725 return node.slice(indentToCode.length);
20734 var Tokenizer = /*#__PURE__*/function () {
20735 function Tokenizer(options) {
20736 this.options = options || exports.defaults;
20738 var _proto = Tokenizer.prototype;
20739 _proto.space = function space(src) {
20740 var cap = this.rules.block.newline.exec(src);
20741 if (cap && cap[0].length > 0) {
20748 _proto.code = function code(src) {
20749 var cap = this.rules.block.code.exec(src);
20751 var text = cap[0].replace(/^ {1,4}/gm, '');
20755 codeBlockStyle: 'indented',
20756 text: !this.options.pedantic ? rtrim(text, '\n') : text
20760 _proto.fences = function fences(src) {
20761 var cap = this.rules.block.fences.exec(src);
20764 var text = indentCodeCompensation(raw, cap[3] || '');
20768 lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, '$1') : cap[2],
20773 _proto.heading = function heading(src) {
20774 var cap = this.rules.block.heading.exec(src);
20776 var text = cap[2].trim();
20778 // remove trailing #s
20779 if (/#$/.test(text)) {
20780 var trimmed = rtrim(text, '#');
20781 if (this.options.pedantic) {
20782 text = trimmed.trim();
20783 } else if (!trimmed || / $/.test(trimmed)) {
20784 // CommonMark requires space before trailing #s
20785 text = trimmed.trim();
20791 depth: cap[1].length,
20793 tokens: this.lexer.inline(text)
20797 _proto.hr = function hr(src) {
20798 var cap = this.rules.block.hr.exec(src);
20806 _proto.blockquote = function blockquote(src) {
20807 var cap = this.rules.block.blockquote.exec(src);
20809 var text = cap[0].replace(/^ *>[ \t]?/gm, '');
20810 var top = this.lexer.state.top;
20811 this.lexer.state.top = true;
20812 var tokens = this.lexer.blockTokens(text);
20813 this.lexer.state.top = top;
20815 type: 'blockquote',
20822 _proto.list = function list(src) {
20823 var cap = this.rules.block.list.exec(src);
20825 var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
20826 var bull = cap[1].trim();
20827 var isordered = bull.length > 1;
20831 ordered: isordered,
20832 start: isordered ? +bull.slice(0, -1) : '',
20836 bull = isordered ? "\\d{1,9}\\" + bull.slice(-1) : "\\" + bull;
20837 if (this.options.pedantic) {
20838 bull = isordered ? bull : '[*+-]';
20841 // Get next list item
20842 var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[\t ][^\\n]*)?(?:\\n|$))");
20844 // Check if current bullet point can start a new List Item
20847 if (!(cap = itemRegex.exec(src))) {
20850 if (this.rules.block.hr.test(src)) {
20851 // End list if bullet was actually HR (possibly move into itemRegex?)
20855 src = src.substring(raw.length);
20856 line = cap[2].split('\n', 1)[0].replace(/^\t+/, function (t) {
20857 return ' '.repeat(3 * t.length);
20859 nextLine = src.split('\n', 1)[0];
20860 if (this.options.pedantic) {
20862 itemContents = line.trimLeft();
20864 indent = cap[2].search(/[^ ]/); // Find first non-space char
20865 indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
20866 itemContents = line.slice(indent);
20867 indent += cap[1].length;
20870 if (!line && /^ *$/.test(nextLine)) {
20871 // Items begin with at most one blank line
20872 raw += nextLine + '\n';
20873 src = src.substring(nextLine.length + 1);
20877 var nextBulletRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))");
20878 var hrRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)");
20879 var fencesBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:```|~~~)");
20880 var headingBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}#");
20882 // Check if following lines should be included in List Item
20884 rawLine = src.split('\n', 1)[0];
20885 nextLine = rawLine;
20887 // Re-align to follow commonmark nesting rules
20888 if (this.options.pedantic) {
20889 nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
20892 // End list item if found code fences
20893 if (fencesBeginRegex.test(nextLine)) {
20897 // End list item if found start of new heading
20898 if (headingBeginRegex.test(nextLine)) {
20902 // End list item if found start of new bullet
20903 if (nextBulletRegex.test(nextLine)) {
20907 // Horizontal rule found
20908 if (hrRegex.test(src)) {
20911 if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
20912 // Dedent if possible
20913 itemContents += '\n' + nextLine.slice(indent);
20915 // not enough indentation
20920 // paragraph continuation unless last line was a different block level element
20921 if (line.search(/[^ ]/) >= 4) {
20922 // indented code block
20925 if (fencesBeginRegex.test(line)) {
20928 if (headingBeginRegex.test(line)) {
20931 if (hrRegex.test(line)) {
20934 itemContents += '\n' + nextLine;
20936 if (!blankLine && !nextLine.trim()) {
20937 // Check if current line is blank
20940 raw += rawLine + '\n';
20941 src = src.substring(rawLine.length + 1);
20942 line = nextLine.slice(indent);
20946 // If the previous item ended with a blank line, the list is loose
20947 if (endsWithBlankLine) {
20949 } else if (/\n *\n *$/.test(raw)) {
20950 endsWithBlankLine = true;
20954 // Check for task list items
20955 if (this.options.gfm) {
20956 istask = /^\[[ xX]\] /.exec(itemContents);
20958 ischecked = istask[0] !== '[ ] ';
20959 itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
20966 checked: ischecked,
20973 // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
20974 list.items[list.items.length - 1].raw = raw.trimRight();
20975 list.items[list.items.length - 1].text = itemContents.trimRight();
20976 list.raw = list.raw.trimRight();
20977 var l = list.items.length;
20979 // Item child tokens handled here at end because we needed to have the final item to trim it first
20980 for (i = 0; i < l; i++) {
20981 this.lexer.state.top = false;
20982 list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
20984 // Check if list should be loose
20985 var spacers = list.items[i].tokens.filter(function (t) {
20986 return t.type === 'space';
20988 var hasMultipleLineBreaks = spacers.length > 0 && spacers.some(function (t) {
20989 return /\n.*\n/.test(t.raw);
20991 list.loose = hasMultipleLineBreaks;
20995 // Set all items to loose if list is loose
20997 for (i = 0; i < l; i++) {
20998 list.items[i].loose = true;
21004 _proto.html = function html(src) {
21005 var cap = this.rules.block.html.exec(src);
21010 pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
21013 if (this.options.sanitize) {
21014 var text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
21015 token.type = 'paragraph';
21017 token.tokens = this.lexer.inline(text);
21022 _proto.def = function def(src) {
21023 var cap = this.rules.block.def.exec(src);
21025 var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
21026 var href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline._escapes, '$1') : '';
21027 var title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, '$1') : cap[3];
21037 _proto.table = function table(src) {
21038 var cap = this.rules.block.table.exec(src);
21042 header: splitCells(cap[1]).map(function (c) {
21047 align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
21048 rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
21050 if (item.header.length === item.align.length) {
21052 var l = item.align.length;
21054 for (i = 0; i < l; i++) {
21055 if (/^ *-+: *$/.test(item.align[i])) {
21056 item.align[i] = 'right';
21057 } else if (/^ *:-+: *$/.test(item.align[i])) {
21058 item.align[i] = 'center';
21059 } else if (/^ *:-+ *$/.test(item.align[i])) {
21060 item.align[i] = 'left';
21062 item.align[i] = null;
21065 l = item.rows.length;
21066 for (i = 0; i < l; i++) {
21067 item.rows[i] = splitCells(item.rows[i], item.header.length).map(function (c) {
21074 // parse child tokens inside headers and cells
21076 // header child tokens
21077 l = item.header.length;
21078 for (j = 0; j < l; j++) {
21079 item.header[j].tokens = this.lexer.inline(item.header[j].text);
21082 // cell child tokens
21083 l = item.rows.length;
21084 for (j = 0; j < l; j++) {
21085 row = item.rows[j];
21086 for (k = 0; k < row.length; k++) {
21087 row[k].tokens = this.lexer.inline(row[k].text);
21094 _proto.lheading = function lheading(src) {
21095 var cap = this.rules.block.lheading.exec(src);
21100 depth: cap[2].charAt(0) === '=' ? 1 : 2,
21102 tokens: this.lexer.inline(cap[1])
21106 _proto.paragraph = function paragraph(src) {
21107 var cap = this.rules.block.paragraph.exec(src);
21109 var text = cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1];
21114 tokens: this.lexer.inline(text)
21118 _proto.text = function text(src) {
21119 var cap = this.rules.block.text.exec(src);
21125 tokens: this.lexer.inline(cap[0])
21129 _proto.escape = function escape$1(src) {
21130 var cap = this.rules.inline.escape.exec(src);
21135 text: escape(cap[1])
21139 _proto.tag = function tag(src) {
21140 var cap = this.rules.inline.tag.exec(src);
21142 if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
21143 this.lexer.state.inLink = true;
21144 } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
21145 this.lexer.state.inLink = false;
21147 if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
21148 this.lexer.state.inRawBlock = true;
21149 } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
21150 this.lexer.state.inRawBlock = false;
21153 type: this.options.sanitize ? 'text' : 'html',
21155 inLink: this.lexer.state.inLink,
21156 inRawBlock: this.lexer.state.inRawBlock,
21157 text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]
21161 _proto.link = function link(src) {
21162 var cap = this.rules.inline.link.exec(src);
21164 var trimmedUrl = cap[2].trim();
21165 if (!this.options.pedantic && /^</.test(trimmedUrl)) {
21166 // commonmark requires matching angle brackets
21167 if (!/>$/.test(trimmedUrl)) {
21171 // ending angle bracket cannot be escaped
21172 var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
21173 if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
21177 // find closing parenthesis
21178 var lastParenIndex = findClosingBracket(cap[2], '()');
21179 if (lastParenIndex > -1) {
21180 var start = cap[0].indexOf('!') === 0 ? 5 : 4;
21181 var linkLen = start + cap[1].length + lastParenIndex;
21182 cap[2] = cap[2].substring(0, lastParenIndex);
21183 cap[0] = cap[0].substring(0, linkLen).trim();
21189 if (this.options.pedantic) {
21190 // split pedantic href and title
21191 var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
21197 title = cap[3] ? cap[3].slice(1, -1) : '';
21199 href = href.trim();
21200 if (/^</.test(href)) {
21201 if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
21202 // pedantic allows starting angle bracket without ending angle bracket
21203 href = href.slice(1);
21205 href = href.slice(1, -1);
21208 return outputLink(cap, {
21209 href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
21210 title: title ? title.replace(this.rules.inline._escapes, '$1') : title
21211 }, cap[0], this.lexer);
21214 _proto.reflink = function reflink(src, links) {
21216 if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
21217 var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
21218 link = links[link.toLowerCase()];
21220 var text = cap[0].charAt(0);
21227 return outputLink(cap, link, cap[0], this.lexer);
21230 _proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
21231 if (prevChar === void 0) {
21234 var match = this.rules.inline.emStrong.lDelim.exec(src);
21235 if (!match) return;
21237 // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
21238 if (match[3] && prevChar.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4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ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\u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EC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\u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\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/)) return;
21239 var nextChar = match[1] || match[2] || '';
21240 if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) {
21241 var lLength = match[0].length - 1;
21244 delimTotal = lLength,
21246 var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
21247 endReg.lastIndex = 0;
21249 // Clip maskedSrc to same section of string as src (move to lexer?)
21250 maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
21251 while ((match = endReg.exec(maskedSrc)) != null) {
21252 rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
21253 if (!rDelim) continue; // skip single * in __abc*abc__
21255 rLength = rDelim.length;
21256 if (match[3] || match[4]) {
21257 // found another Left Delim
21258 delimTotal += rLength;
21260 } else if (match[5] || match[6]) {
21261 // either Left or Right Delim
21262 if (lLength % 3 && !((lLength + rLength) % 3)) {
21263 midDelimTotal += rLength;
21264 continue; // CommonMark Emphasis Rules 9-10
21268 delimTotal -= rLength;
21269 if (delimTotal > 0) continue; // Haven't found enough closing delimiters
21271 // Remove extra characters. *a*** -> *a*
21272 rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
21273 var raw = src.slice(0, lLength + match.index + (match[0].length - rDelim.length) + rLength);
21275 // Create `em` if smallest delimiter has odd char count. *a***
21276 if (Math.min(lLength, rLength) % 2) {
21277 var _text = raw.slice(1, -1);
21282 tokens: this.lexer.inlineTokens(_text)
21286 // Create 'strong' if smallest delimiter has even char count. **a***
21287 var text = raw.slice(2, -2);
21292 tokens: this.lexer.inlineTokens(text)
21297 _proto.codespan = function codespan(src) {
21298 var cap = this.rules.inline.code.exec(src);
21300 var text = cap[2].replace(/\n/g, ' ');
21301 var hasNonSpaceChars = /[^ ]/.test(text);
21302 var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
21303 if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
21304 text = text.substring(1, text.length - 1);
21306 text = escape(text, true);
21314 _proto.br = function br(src) {
21315 var cap = this.rules.inline.br.exec(src);
21323 _proto.del = function del(src) {
21324 var cap = this.rules.inline.del.exec(src);
21330 tokens: this.lexer.inlineTokens(cap[2])
21334 _proto.autolink = function autolink(src, mangle) {
21335 var cap = this.rules.inline.autolink.exec(src);
21338 if (cap[2] === '@') {
21339 text = escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
21340 href = 'mailto:' + text;
21342 text = escape(cap[1]);
21358 _proto.url = function url(src, mangle) {
21360 if (cap = this.rules.inline.url.exec(src)) {
21362 if (cap[2] === '@') {
21363 text = escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
21364 href = 'mailto:' + text;
21366 // do extended autolink path validation
21369 prevCapZero = cap[0];
21370 cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
21371 } while (prevCapZero !== cap[0]);
21372 text = escape(cap[0]);
21373 if (cap[1] === 'www.') {
21374 href = 'http://' + cap[0];
21392 _proto.inlineText = function inlineText(src, smartypants) {
21393 var cap = this.rules.inline.text.exec(src);
21396 if (this.lexer.state.inRawBlock) {
21397 text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
21399 text = escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
21412 * Block-Level Grammar
21415 newline: /^(?: *(?:\n|$))+/,
21416 code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
21417 fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
21418 hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
21419 heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
21420 blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
21421 list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
21422 html: '^ {0,3}(?:' // optional indentation
21423 + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
21424 + '|comment[^\\n]*(\\n+|$)' // (2)
21425 + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
21426 + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
21427 + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
21428 + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
21429 + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
21430 + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
21432 def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
21434 lheading: /^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
21435 // regex template, placeholders will be replaced according to different paragraph
21436 // interruption rules of commonmark and the original markdown spec:
21437 _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
21440 block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
21441 block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
21442 block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
21443 block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
21444 block.listItemStart = edit(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
21445 block.list = edit(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
21446 block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
21447 block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
21448 block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
21449 block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
21450 .replace('|table', '').replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
21451 .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
21453 block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
21456 * Normal Block Grammar
21459 block.normal = merge({}, block);
21462 * GFM Block Grammar
21465 block.gfm = merge({}, block.normal, {
21466 table: '^ *([^\\n ].*\\|.*)\\n' // Header
21467 + ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?' // Align
21468 + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
21471 block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
21472 .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
21474 block.gfm.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
21475 .replace('table', block.gfm.table) // interrupt paragraphs with table
21476 .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
21477 .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
21480 * Pedantic grammar (original John Gruber's loose markdown specification)
21483 block.pedantic = merge({}, block.normal, {
21484 html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
21485 + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
21486 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
21487 heading: /^(#{1,6})(.*)(?:\n+|$)/,
21489 // fences not supported
21490 lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
21491 paragraph: edit(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
21495 * Inline-Level Grammar
21498 escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
21499 autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
21501 tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
21502 + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
21503 + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
21504 + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
21505 + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
21507 link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
21508 reflink: /^!?\[(label)\]\[(ref)\]/,
21509 nolink: /^!?\[(ref)\](?:\[\])?/,
21510 reflinkSearch: 'reflink|nolink(?!\\()',
21512 lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
21513 // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
21514 // () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
21515 rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,
21516 rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
21519 code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
21520 br: /^( {2,}|\\)\n(?!\s*$)/,
21522 text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
21523 punctuation: /^([\spunctuation])/
21526 // list of punctuation marks from CommonMark spec
21527 // without * and _ to handle the different emphasis markers * and _
21528 inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
21529 inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
21531 // sequences em should skip over [title](link), `code`, <html>
21532 inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
21533 // lookbehind is not available on Safari as of version 16
21534 // inline.escapedEmSt = /(?<=(?:^|[^\\)(?:\\[^])*)\\[*_]/g;
21535 inline.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
21536 inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
21537 inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
21538 inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g').replace(/punct/g, inline._punctuation).getRegex();
21539 inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'g').replace(/punct/g, inline._punctuation).getRegex();
21540 inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
21541 inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
21542 inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
21543 inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
21544 inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
21545 inline.tag = edit(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
21546 inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
21547 inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
21548 inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
21549 inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
21550 inline.reflink = edit(inline.reflink).replace('label', inline._label).replace('ref', block._label).getRegex();
21551 inline.nolink = edit(inline.nolink).replace('ref', block._label).getRegex();
21552 inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
21555 * Normal Inline Grammar
21558 inline.normal = merge({}, inline);
21561 * Pedantic Inline Grammar
21564 inline.pedantic = merge({}, inline.normal, {
21567 middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
21568 endAst: /\*\*(?!\*)/g,
21573 middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
21574 endAst: /\*(?!\*)/g,
21577 link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
21578 reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
21582 * GFM Inline Grammar
21585 inline.gfm = merge({}, inline.normal, {
21586 escape: edit(inline.escape).replace('])', '~|])').getRegex(),
21587 _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
21588 url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
21589 _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
21590 del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
21591 text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
21593 inline.gfm.url = edit(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
21595 * GFM + Line Breaks Inline Grammar
21598 inline.breaks = merge({}, inline.gfm, {
21599 br: edit(inline.br).replace('{2,}', '*').getRegex(),
21600 text: edit(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
21604 * smartypants text replacement
21605 * @param {string} text
21607 function smartypants(text) {
21610 .replace(/---/g, "\u2014")
21612 .replace(/--/g, "\u2013")
21614 .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018")
21615 // closing singles & apostrophes
21616 .replace(/'/g, "\u2019")
21618 .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C")
21620 .replace(/"/g, "\u201D")
21622 .replace(/\.{3}/g, "\u2026");
21626 * mangle email addresses
21627 * @param {string} text
21629 function mangle(text) {
21633 var l = text.length;
21634 for (i = 0; i < l; i++) {
21635 ch = text.charCodeAt(i);
21636 if (Math.random() > 0.5) {
21637 ch = 'x' + ch.toString(16);
21639 out += '&#' + ch + ';';
21647 var Lexer = /*#__PURE__*/function () {
21648 function Lexer(options) {
21650 this.tokens.links = Object.create(null);
21651 this.options = options || exports.defaults;
21652 this.options.tokenizer = this.options.tokenizer || new Tokenizer();
21653 this.tokenizer = this.options.tokenizer;
21654 this.tokenizer.options = this.options;
21655 this.tokenizer.lexer = this;
21656 this.inlineQueue = [];
21663 block: block.normal,
21664 inline: inline.normal
21666 if (this.options.pedantic) {
21667 rules.block = block.pedantic;
21668 rules.inline = inline.pedantic;
21669 } else if (this.options.gfm) {
21670 rules.block = block.gfm;
21671 if (this.options.breaks) {
21672 rules.inline = inline.breaks;
21674 rules.inline = inline.gfm;
21677 this.tokenizer.rules = rules;
21684 * Static Lex Method
21686 Lexer.lex = function lex(src, options) {
21687 var lexer = new Lexer(options);
21688 return lexer.lex(src);
21692 * Static Lex Inline Method
21694 Lexer.lexInline = function lexInline(src, options) {
21695 var lexer = new Lexer(options);
21696 return lexer.inlineTokens(src);
21702 var _proto = Lexer.prototype;
21703 _proto.lex = function lex(src) {
21704 src = src.replace(/\r\n|\r/g, '\n');
21705 this.blockTokens(src, this.tokens);
21707 while (next = this.inlineQueue.shift()) {
21708 this.inlineTokens(next.src, next.tokens);
21710 return this.tokens;
21716 _proto.blockTokens = function blockTokens(src, tokens) {
21718 if (tokens === void 0) {
21721 if (this.options.pedantic) {
21722 src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
21724 src = src.replace(/^( *)(\t+)/gm, function (_, leading, tabs) {
21725 return leading + ' '.repeat(tabs.length);
21728 var token, lastToken, cutSrc, lastParagraphClipped;
21730 if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(function (extTokenizer) {
21731 if (token = extTokenizer.call({
21734 src = src.substring(token.raw.length);
21735 tokens.push(token);
21744 if (token = this.tokenizer.space(src)) {
21745 src = src.substring(token.raw.length);
21746 if (token.raw.length === 1 && tokens.length > 0) {
21747 // if there's a single \n as a spacer, it's terminating the last line,
21748 // so move it there so that we don't get unecessary paragraph tags
21749 tokens[tokens.length - 1].raw += '\n';
21751 tokens.push(token);
21757 if (token = this.tokenizer.code(src)) {
21758 src = src.substring(token.raw.length);
21759 lastToken = tokens[tokens.length - 1];
21760 // An indented code block cannot interrupt a paragraph.
21761 if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
21762 lastToken.raw += '\n' + token.raw;
21763 lastToken.text += '\n' + token.text;
21764 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
21766 tokens.push(token);
21772 if (token = this.tokenizer.fences(src)) {
21773 src = src.substring(token.raw.length);
21774 tokens.push(token);
21779 if (token = this.tokenizer.heading(src)) {
21780 src = src.substring(token.raw.length);
21781 tokens.push(token);
21786 if (token = this.tokenizer.hr(src)) {
21787 src = src.substring(token.raw.length);
21788 tokens.push(token);
21793 if (token = this.tokenizer.blockquote(src)) {
21794 src = src.substring(token.raw.length);
21795 tokens.push(token);
21800 if (token = this.tokenizer.list(src)) {
21801 src = src.substring(token.raw.length);
21802 tokens.push(token);
21807 if (token = this.tokenizer.html(src)) {
21808 src = src.substring(token.raw.length);
21809 tokens.push(token);
21814 if (token = this.tokenizer.def(src)) {
21815 src = src.substring(token.raw.length);
21816 lastToken = tokens[tokens.length - 1];
21817 if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
21818 lastToken.raw += '\n' + token.raw;
21819 lastToken.text += '\n' + token.raw;
21820 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
21821 } else if (!this.tokens.links[token.tag]) {
21822 this.tokens.links[token.tag] = {
21831 if (token = this.tokenizer.table(src)) {
21832 src = src.substring(token.raw.length);
21833 tokens.push(token);
21838 if (token = this.tokenizer.lheading(src)) {
21839 src = src.substring(token.raw.length);
21840 tokens.push(token);
21844 // top-level paragraph
21845 // prevent paragraph consuming extensions by clipping 'src' to extension start
21847 if (this.options.extensions && this.options.extensions.startBlock) {
21849 var startIndex = Infinity;
21850 var tempSrc = src.slice(1);
21851 var tempStart = void 0;
21852 _this.options.extensions.startBlock.forEach(function (getStartIndex) {
21853 tempStart = getStartIndex.call({
21856 if (typeof tempStart === 'number' && tempStart >= 0) {
21857 startIndex = Math.min(startIndex, tempStart);
21860 if (startIndex < Infinity && startIndex >= 0) {
21861 cutSrc = src.substring(0, startIndex + 1);
21865 if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
21866 lastToken = tokens[tokens.length - 1];
21867 if (lastParagraphClipped && lastToken.type === 'paragraph') {
21868 lastToken.raw += '\n' + token.raw;
21869 lastToken.text += '\n' + token.text;
21870 this.inlineQueue.pop();
21871 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
21873 tokens.push(token);
21875 lastParagraphClipped = cutSrc.length !== src.length;
21876 src = src.substring(token.raw.length);
21881 if (token = this.tokenizer.text(src)) {
21882 src = src.substring(token.raw.length);
21883 lastToken = tokens[tokens.length - 1];
21884 if (lastToken && lastToken.type === 'text') {
21885 lastToken.raw += '\n' + token.raw;
21886 lastToken.text += '\n' + token.text;
21887 this.inlineQueue.pop();
21888 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
21890 tokens.push(token);
21895 var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
21896 if (this.options.silent) {
21897 console.error(errMsg);
21900 throw new Error(errMsg);
21904 this.state.top = true;
21907 _proto.inline = function inline(src, tokens) {
21908 if (tokens === void 0) {
21911 this.inlineQueue.push({
21921 _proto.inlineTokens = function inlineTokens(src, tokens) {
21923 if (tokens === void 0) {
21926 var token, lastToken, cutSrc;
21928 // String with links masked to avoid interference with em and strong
21929 var maskedSrc = src;
21931 var keepPrevChar, prevChar;
21933 // Mask out reflinks
21934 if (this.tokens.links) {
21935 var links = Object.keys(this.tokens.links);
21936 if (links.length > 0) {
21937 while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
21938 if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
21939 maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
21944 // Mask out other blocks
21945 while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
21946 maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
21949 // Mask out escaped em & strong delimiters
21950 while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
21951 maskedSrc = maskedSrc.slice(0, match.index + match[0].length - 2) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
21952 this.tokenizer.rules.inline.escapedEmSt.lastIndex--;
21955 if (!keepPrevChar) {
21958 keepPrevChar = false;
21961 if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(function (extTokenizer) {
21962 if (token = extTokenizer.call({
21965 src = src.substring(token.raw.length);
21966 tokens.push(token);
21975 if (token = this.tokenizer.escape(src)) {
21976 src = src.substring(token.raw.length);
21977 tokens.push(token);
21982 if (token = this.tokenizer.tag(src)) {
21983 src = src.substring(token.raw.length);
21984 lastToken = tokens[tokens.length - 1];
21985 if (lastToken && token.type === 'text' && lastToken.type === 'text') {
21986 lastToken.raw += token.raw;
21987 lastToken.text += token.text;
21989 tokens.push(token);
21995 if (token = this.tokenizer.link(src)) {
21996 src = src.substring(token.raw.length);
21997 tokens.push(token);
22002 if (token = this.tokenizer.reflink(src, this.tokens.links)) {
22003 src = src.substring(token.raw.length);
22004 lastToken = tokens[tokens.length - 1];
22005 if (lastToken && token.type === 'text' && lastToken.type === 'text') {
22006 lastToken.raw += token.raw;
22007 lastToken.text += token.text;
22009 tokens.push(token);
22015 if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
22016 src = src.substring(token.raw.length);
22017 tokens.push(token);
22022 if (token = this.tokenizer.codespan(src)) {
22023 src = src.substring(token.raw.length);
22024 tokens.push(token);
22029 if (token = this.tokenizer.br(src)) {
22030 src = src.substring(token.raw.length);
22031 tokens.push(token);
22036 if (token = this.tokenizer.del(src)) {
22037 src = src.substring(token.raw.length);
22038 tokens.push(token);
22043 if (token = this.tokenizer.autolink(src, mangle)) {
22044 src = src.substring(token.raw.length);
22045 tokens.push(token);
22050 if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
22051 src = src.substring(token.raw.length);
22052 tokens.push(token);
22057 // prevent inlineText consuming extensions by clipping 'src' to extension start
22059 if (this.options.extensions && this.options.extensions.startInline) {
22061 var startIndex = Infinity;
22062 var tempSrc = src.slice(1);
22063 var tempStart = void 0;
22064 _this2.options.extensions.startInline.forEach(function (getStartIndex) {
22065 tempStart = getStartIndex.call({
22068 if (typeof tempStart === 'number' && tempStart >= 0) {
22069 startIndex = Math.min(startIndex, tempStart);
22072 if (startIndex < Infinity && startIndex >= 0) {
22073 cutSrc = src.substring(0, startIndex + 1);
22077 if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
22078 src = src.substring(token.raw.length);
22079 if (token.raw.slice(-1) !== '_') {
22080 // Track prevChar before string of ____ started
22081 prevChar = token.raw.slice(-1);
22083 keepPrevChar = true;
22084 lastToken = tokens[tokens.length - 1];
22085 if (lastToken && lastToken.type === 'text') {
22086 lastToken.raw += token.raw;
22087 lastToken.text += token.text;
22089 tokens.push(token);
22094 var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
22095 if (this.options.silent) {
22096 console.error(errMsg);
22099 throw new Error(errMsg);
22105 _createClass(Lexer, null, [{
22107 get: function get() {
22120 var Renderer = /*#__PURE__*/function () {
22121 function Renderer(options) {
22122 this.options = options || exports.defaults;
22124 var _proto = Renderer.prototype;
22125 _proto.code = function code(_code, infostring, escaped) {
22126 var lang = (infostring || '').match(/\S*/)[0];
22127 if (this.options.highlight) {
22128 var out = this.options.highlight(_code, lang);
22129 if (out != null && out !== _code) {
22134 _code = _code.replace(/\n$/, '') + '\n';
22136 return '<pre><code>' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
22138 return '<pre><code class="' + this.options.langPrefix + escape(lang) + '">' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
22142 * @param {string} quote
22144 _proto.blockquote = function blockquote(quote) {
22145 return "<blockquote>\n" + quote + "</blockquote>\n";
22147 _proto.html = function html(_html) {
22152 * @param {string} text
22153 * @param {string} level
22154 * @param {string} raw
22155 * @param {any} slugger
22157 _proto.heading = function heading(text, level, raw, slugger) {
22158 if (this.options.headerIds) {
22159 var id = this.options.headerPrefix + slugger.slug(raw);
22160 return "<h" + level + " id=\"" + id + "\">" + text + "</h" + level + ">\n";
22164 return "<h" + level + ">" + text + "</h" + level + ">\n";
22166 _proto.hr = function hr() {
22167 return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
22169 _proto.list = function list(body, ordered, start) {
22170 var type = ordered ? 'ol' : 'ul',
22171 startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
22172 return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
22176 * @param {string} text
22178 _proto.listitem = function listitem(text) {
22179 return "<li>" + text + "</li>\n";
22181 _proto.checkbox = function checkbox(checked) {
22182 return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
22186 * @param {string} text
22188 _proto.paragraph = function paragraph(text) {
22189 return "<p>" + text + "</p>\n";
22193 * @param {string} header
22194 * @param {string} body
22196 _proto.table = function table(header, body) {
22197 if (body) body = "<tbody>" + body + "</tbody>";
22198 return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
22202 * @param {string} content
22204 _proto.tablerow = function tablerow(content) {
22205 return "<tr>\n" + content + "</tr>\n";
22207 _proto.tablecell = function tablecell(content, flags) {
22208 var type = flags.header ? 'th' : 'td';
22209 var tag = flags.align ? "<" + type + " align=\"" + flags.align + "\">" : "<" + type + ">";
22210 return tag + content + ("</" + type + ">\n");
22214 * span level renderer
22215 * @param {string} text
22217 _proto.strong = function strong(text) {
22218 return "<strong>" + text + "</strong>";
22222 * @param {string} text
22224 _proto.em = function em(text) {
22225 return "<em>" + text + "</em>";
22229 * @param {string} text
22231 _proto.codespan = function codespan(text) {
22232 return "<code>" + text + "</code>";
22234 _proto.br = function br() {
22235 return this.options.xhtml ? '<br/>' : '<br>';
22239 * @param {string} text
22241 _proto.del = function del(text) {
22242 return "<del>" + text + "</del>";
22246 * @param {string} href
22247 * @param {string} title
22248 * @param {string} text
22250 _proto.link = function link(href, title, text) {
22251 href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
22252 if (href === null) {
22255 var out = '<a href="' + href + '"';
22257 out += ' title="' + title + '"';
22259 out += '>' + text + '</a>';
22264 * @param {string} href
22265 * @param {string} title
22266 * @param {string} text
22268 _proto.image = function image(href, title, text) {
22269 href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
22270 if (href === null) {
22273 var out = "<img src=\"" + href + "\" alt=\"" + text + "\"";
22275 out += " title=\"" + title + "\"";
22277 out += this.options.xhtml ? '/>' : '>';
22280 _proto.text = function text(_text) {
22288 * returns only the textual part of the token
22290 var TextRenderer = /*#__PURE__*/function () {
22291 function TextRenderer() {}
22292 var _proto = TextRenderer.prototype;
22293 // no need for block level renderers
22294 _proto.strong = function strong(text) {
22297 _proto.em = function em(text) {
22300 _proto.codespan = function codespan(text) {
22303 _proto.del = function del(text) {
22306 _proto.html = function html(text) {
22309 _proto.text = function text(_text) {
22312 _proto.link = function link(href, title, text) {
22315 _proto.image = function image(href, title, text) {
22318 _proto.br = function br() {
22321 return TextRenderer;
22325 * Slugger generates header id
22327 var Slugger = /*#__PURE__*/function () {
22328 function Slugger() {
22333 * @param {string} value
22335 var _proto = Slugger.prototype;
22336 _proto.serialize = function serialize(value) {
22337 return value.toLowerCase().trim()
22338 // remove html tags
22339 .replace(/<[!\/a-z].*?>/ig, '')
22340 // remove unwanted chars
22341 .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
22345 * Finds the next safe (unique) slug to use
22346 * @param {string} originalSlug
22347 * @param {boolean} isDryRun
22349 _proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
22350 var slug = originalSlug;
22351 var occurenceAccumulator = 0;
22352 if (this.seen.hasOwnProperty(slug)) {
22353 occurenceAccumulator = this.seen[originalSlug];
22355 occurenceAccumulator++;
22356 slug = originalSlug + '-' + occurenceAccumulator;
22357 } while (this.seen.hasOwnProperty(slug));
22360 this.seen[originalSlug] = occurenceAccumulator;
22361 this.seen[slug] = 0;
22367 * Convert string to unique id
22368 * @param {object} [options]
22369 * @param {boolean} [options.dryrun] Generates the next unique slug without
22370 * updating the internal accumulator.
22372 _proto.slug = function slug(value, options) {
22373 if (options === void 0) {
22376 var slug = this.serialize(value);
22377 return this.getNextSafeSlug(slug, options.dryrun);
22383 * Parsing & Compiling
22385 var Parser = /*#__PURE__*/function () {
22386 function Parser(options) {
22387 this.options = options || exports.defaults;
22388 this.options.renderer = this.options.renderer || new Renderer();
22389 this.renderer = this.options.renderer;
22390 this.renderer.options = this.options;
22391 this.textRenderer = new TextRenderer();
22392 this.slugger = new Slugger();
22396 * Static Parse Method
22398 Parser.parse = function parse(tokens, options) {
22399 var parser = new Parser(options);
22400 return parser.parse(tokens);
22404 * Static Parse Inline Method
22406 Parser.parseInline = function parseInline(tokens, options) {
22407 var parser = new Parser(options);
22408 return parser.parseInline(tokens);
22414 var _proto = Parser.prototype;
22415 _proto.parse = function parse(tokens, top) {
22416 if (top === void 0) {
22439 var l = tokens.length;
22440 for (i = 0; i < l; i++) {
22443 // Run any renderer extensions
22444 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
22445 ret = this.options.extensions.renderers[token.type].call({
22448 if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
22453 switch (token.type) {
22460 out += this.renderer.hr();
22465 out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
22470 out += this.renderer.code(token.text, token.lang, token.escaped);
22479 l2 = token.header.length;
22480 for (j = 0; j < l2; j++) {
22481 cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), {
22483 align: token.align[j]
22486 header += this.renderer.tablerow(cell);
22488 l2 = token.rows.length;
22489 for (j = 0; j < l2; j++) {
22490 row = token.rows[j];
22493 for (k = 0; k < l3; k++) {
22494 cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
22496 align: token.align[k]
22499 body += this.renderer.tablerow(cell);
22501 out += this.renderer.table(header, body);
22506 body = this.parse(token.tokens);
22507 out += this.renderer.blockquote(body);
22512 ordered = token.ordered;
22513 start = token.start;
22514 loose = token.loose;
22515 l2 = token.items.length;
22517 for (j = 0; j < l2; j++) {
22518 item = token.items[j];
22519 checked = item.checked;
22523 checkbox = this.renderer.checkbox(checked);
22525 if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
22526 item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
22527 if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
22528 item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
22531 item.tokens.unshift({
22537 itemBody += checkbox;
22540 itemBody += this.parse(item.tokens, loose);
22541 body += this.renderer.listitem(itemBody, task, checked);
22543 out += this.renderer.list(body, ordered, start);
22548 // TODO parse inline content if parameter markdown=1
22549 out += this.renderer.html(token.text);
22554 out += this.renderer.paragraph(this.parseInline(token.tokens));
22559 body = token.tokens ? this.parseInline(token.tokens) : token.text;
22560 while (i + 1 < l && tokens[i + 1].type === 'text') {
22561 token = tokens[++i];
22562 body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
22564 out += top ? this.renderer.paragraph(body) : body;
22569 var errMsg = 'Token with "' + token.type + '" type was not found.';
22570 if (this.options.silent) {
22571 console.error(errMsg);
22574 throw new Error(errMsg);
22583 * Parse Inline Tokens
22585 _proto.parseInline = function parseInline(tokens, renderer) {
22586 renderer = renderer || this.renderer;
22591 var l = tokens.length;
22592 for (i = 0; i < l; i++) {
22595 // Run any renderer extensions
22596 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
22597 ret = this.options.extensions.renderers[token.type].call({
22600 if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
22605 switch (token.type) {
22608 out += renderer.text(token.text);
22613 out += renderer.html(token.text);
22618 out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
22623 out += renderer.image(token.href, token.title, token.text);
22628 out += renderer.strong(this.parseInline(token.tokens, renderer));
22633 out += renderer.em(this.parseInline(token.tokens, renderer));
22638 out += renderer.codespan(token.text);
22643 out += renderer.br();
22648 out += renderer.del(this.parseInline(token.tokens, renderer));
22653 out += renderer.text(token.text);
22658 var errMsg = 'Token with "' + token.type + '" type was not found.';
22659 if (this.options.silent) {
22660 console.error(errMsg);
22663 throw new Error(errMsg);
22676 function marked(src, opt, callback) {
22677 // throw error in case of non string input
22678 if (typeof src === 'undefined' || src === null) {
22679 throw new Error('marked(): input parameter is undefined or null');
22681 if (typeof src !== 'string') {
22682 throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
22684 if (typeof opt === 'function') {
22688 opt = merge({}, marked.defaults, opt || {});
22689 checkSanitizeDeprecation(opt);
22691 var highlight = opt.highlight;
22694 tokens = Lexer.lex(src, opt);
22696 return callback(e);
22698 var done = function done(err) {
22702 if (opt.walkTokens) {
22703 marked.walkTokens(tokens, opt.walkTokens);
22705 out = Parser.parse(tokens, opt);
22710 opt.highlight = highlight;
22711 return err ? callback(err) : callback(null, out);
22713 if (!highlight || highlight.length < 3) {
22716 delete opt.highlight;
22717 if (!tokens.length) return done();
22719 marked.walkTokens(tokens, function (token) {
22720 if (token.type === 'code') {
22722 setTimeout(function () {
22723 highlight(token.text, token.lang, function (err, code) {
22727 if (code != null && code !== token.text) {
22729 token.escaped = true;
22732 if (pending === 0) {
22739 if (pending === 0) {
22744 function onError(e) {
22745 e.message += '\nPlease report this to https://github.com/markedjs/marked.';
22747 return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
22752 var _tokens = Lexer.lex(src, opt);
22753 if (opt.walkTokens) {
22755 return Promise.all(marked.walkTokens(_tokens, opt.walkTokens)).then(function () {
22756 return Parser.parse(_tokens, opt);
22757 })["catch"](onError);
22759 marked.walkTokens(_tokens, opt.walkTokens);
22761 return Parser.parse(_tokens, opt);
22771 marked.options = marked.setOptions = function (opt) {
22772 merge(marked.defaults, opt);
22773 changeDefaults(marked.defaults);
22776 marked.getDefaults = getDefaults;
22777 marked.defaults = exports.defaults;
22783 marked.use = function () {
22784 var extensions = marked.defaults.extensions || {
22788 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22789 args[_key] = arguments[_key];
22791 args.forEach(function (pack) {
22792 // copy options to new object
22793 var opts = merge({}, pack);
22795 // set async to true if it was set to true before
22796 opts.async = marked.defaults.async || opts.async;
22798 // ==-- Parse "addon" extensions --== //
22799 if (pack.extensions) {
22800 pack.extensions.forEach(function (ext) {
22802 throw new Error('extension name required');
22804 if (ext.renderer) {
22805 // Renderer extensions
22806 var prevRenderer = extensions.renderers[ext.name];
22807 if (prevRenderer) {
22808 // Replace extension with func to run new extension but fall back if false
22809 extensions.renderers[ext.name] = function () {
22810 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
22811 args[_key2] = arguments[_key2];
22813 var ret = ext.renderer.apply(this, args);
22814 if (ret === false) {
22815 ret = prevRenderer.apply(this, args);
22820 extensions.renderers[ext.name] = ext.renderer;
22823 if (ext.tokenizer) {
22824 // Tokenizer Extensions
22825 if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
22826 throw new Error("extension level must be 'block' or 'inline'");
22828 if (extensions[ext.level]) {
22829 extensions[ext.level].unshift(ext.tokenizer);
22831 extensions[ext.level] = [ext.tokenizer];
22834 // Function to check for start of token
22835 if (ext.level === 'block') {
22836 if (extensions.startBlock) {
22837 extensions.startBlock.push(ext.start);
22839 extensions.startBlock = [ext.start];
22841 } else if (ext.level === 'inline') {
22842 if (extensions.startInline) {
22843 extensions.startInline.push(ext.start);
22845 extensions.startInline = [ext.start];
22850 if (ext.childTokens) {
22851 // Child tokens to be visited by walkTokens
22852 extensions.childTokens[ext.name] = ext.childTokens;
22855 opts.extensions = extensions;
22858 // ==-- Parse "overwrite" extensions --== //
22859 if (pack.renderer) {
22861 var renderer = marked.defaults.renderer || new Renderer();
22862 var _loop = function _loop(prop) {
22863 var prevRenderer = renderer[prop];
22864 // Replace renderer with func to run extension, but fall back if false
22865 renderer[prop] = function () {
22866 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
22867 args[_key3] = arguments[_key3];
22869 var ret = pack.renderer[prop].apply(renderer, args);
22870 if (ret === false) {
22871 ret = prevRenderer.apply(renderer, args);
22876 for (var prop in pack.renderer) {
22879 opts.renderer = renderer;
22882 if (pack.tokenizer) {
22884 var tokenizer = marked.defaults.tokenizer || new Tokenizer();
22885 var _loop2 = function _loop2(prop) {
22886 var prevTokenizer = tokenizer[prop];
22887 // Replace tokenizer with func to run extension, but fall back if false
22888 tokenizer[prop] = function () {
22889 for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
22890 args[_key4] = arguments[_key4];
22892 var ret = pack.tokenizer[prop].apply(tokenizer, args);
22893 if (ret === false) {
22894 ret = prevTokenizer.apply(tokenizer, args);
22899 for (var prop in pack.tokenizer) {
22902 opts.tokenizer = tokenizer;
22906 // ==-- Parse WalkTokens extensions --== //
22907 if (pack.walkTokens) {
22908 var _walkTokens = marked.defaults.walkTokens;
22909 opts.walkTokens = function (token) {
22911 values.push(pack.walkTokens.call(this, token));
22913 values = values.concat(_walkTokens.call(this, token));
22918 marked.setOptions(opts);
22923 * Run callback for every token
22926 marked.walkTokens = function (tokens, callback) {
22928 var _loop3 = function _loop3() {
22929 var token = _step.value;
22930 values = values.concat(callback.call(marked, token));
22931 switch (token.type) {
22934 for (var _iterator2 = _createForOfIteratorHelperLoose(token.header), _step2; !(_step2 = _iterator2()).done;) {
22935 var cell = _step2.value;
22936 values = values.concat(marked.walkTokens(cell.tokens, callback));
22938 for (var _iterator3 = _createForOfIteratorHelperLoose(token.rows), _step3; !(_step3 = _iterator3()).done;) {
22939 var row = _step3.value;
22940 for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
22941 var _cell = _step4.value;
22942 values = values.concat(marked.walkTokens(_cell.tokens, callback));
22949 values = values.concat(marked.walkTokens(token.items, callback));
22954 if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
22955 // Walk any extensions
22956 marked.defaults.extensions.childTokens[token.type].forEach(function (childTokens) {
22957 values = values.concat(marked.walkTokens(token[childTokens], callback));
22959 } else if (token.tokens) {
22960 values = values.concat(marked.walkTokens(token.tokens, callback));
22965 for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
22973 * @param {string} src
22975 marked.parseInline = function (src, opt) {
22976 // throw error in case of non string input
22977 if (typeof src === 'undefined' || src === null) {
22978 throw new Error('marked.parseInline(): input parameter is undefined or null');
22980 if (typeof src !== 'string') {
22981 throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
22983 opt = merge({}, marked.defaults, opt || {});
22984 checkSanitizeDeprecation(opt);
22986 var tokens = Lexer.lexInline(src, opt);
22987 if (opt.walkTokens) {
22988 marked.walkTokens(tokens, opt.walkTokens);
22990 return Parser.parseInline(tokens, opt);
22992 e.message += '\nPlease report this to https://github.com/markedjs/marked.';
22994 return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
23003 marked.Parser = Parser;
23004 marked.parser = Parser.parse;
23005 marked.Renderer = Renderer;
23006 marked.TextRenderer = TextRenderer;
23007 marked.Lexer = Lexer;
23008 marked.lexer = Lexer.lex;
23009 marked.Tokenizer = Tokenizer;
23010 marked.Slugger = Slugger;
23011 marked.parse = marked;
23012 var options = marked.options;
23013 var setOptions = marked.setOptions;
23014 var use = marked.use;
23015 var walkTokens = marked.walkTokens;
23016 var parseInline = marked.parseInline;
23017 var parse = marked;
23018 var parser = Parser.parse;
23019 var lexer = Lexer.lex;
23021 exports.Lexer = Lexer;
23022 exports.Parser = Parser;
23023 exports.Renderer = Renderer;
23024 exports.Slugger = Slugger;
23025 exports.TextRenderer = TextRenderer;
23026 exports.Tokenizer = Tokenizer;
23027 exports.getDefaults = getDefaults;
23028 exports.lexer = lexer;
23029 exports.marked = marked;
23030 exports.options = options;
23031 exports.parse = parse;
23032 exports.parseInline = parseInline;
23033 exports.parser = parser;
23034 exports.setOptions = setOptions;
23036 exports.walkTokens = walkTokens;
23041 /***/ "./src/test-data.json":
23042 /*!****************************!*\
23043 !*** ./src/test-data.json ***!
23044 \****************************/
23045 /***/ ((module) => {
23048 module.exports = JSON.parse('{"id":"000000","name":"Sample","created":"1674409747467","tree":{"id":"000000","collapsed":false,"children":[{"id":"000001","collapsed":false,"children":[]},{"id":"1dc4c363-7440-4661-bbc5-7e995dc6ba71","collapsed":false,"children":[]},{"id":"e067419d-85c3-422d-b8c4-41690be4450d","collapsed":false,"children":[{"id":"6addd61d-d12f-4a27-a471-513becfff006","children":[],"collapsed":false}]},{"id":"2ab706de-fea9-42a0-a900-e88b2950ceb3","collapsed":false,"children":[{"id":"27c14755-ff26-4931-a676-b48cd958b781","children":[{"id":"116f8e0f-ab62-450f-914e-5ca0956a457f","children":[],"collapsed":false}],"collapsed":true},{"id":"d69efd32-fbf5-4b80-8a36-af1cb2af7b80","children":[{"id":"b5a55548-f65d-496a-8bea-6b6ba8296e21","children":[],"collapsed":false}],"collapsed":true},{"id":"2f67d730-c71b-4823-a986-fa510d9408e1","children":[{"id":"40194ea5-9c28-4adb-bffe-4f59e7eca666","children":[],"collapsed":false}],"collapsed":true}]},{"id":"21df5e96-d770-43f0-8bd1-1b01ab4626f9","collapsed":false,"children":[]},{"id":"89c3267b-0114-4138-98a8-443b28d2e679","collapsed":false,"children":[{"id":"6b457d6b-0228-41b7-bbba-6c0ba3b54f4d","collapsed":false,"children":[{"id":"bad021fc-24d1-4560-8321-042c28d438a8","collapsed":false,"children":[]}]},{"id":"9690699a-cb7d-4123-8fa5-f7a58a191a08","children":[{"id":"2831a7aa-7291-4ebc-997f-5572e767f5c0","children":[],"collapsed":false}],"collapsed":false},{"id":"88d336be-4910-4d74-b79a-441894af956d","collapsed":false,"children":[{"id":"eb7fd6d7-b3fe-46e5-814c-655a6eec2ba4","children":[],"collapsed":false}]},{"id":"51b2f235-b979-4d74-ad83-3e8b6152bb4a","collapsed":false,"children":[{"id":"9c576012-7e8f-4d2b-b58b-1886eba43341","children":[],"collapsed":false}]}]},{"id":"ef04ea02-aed6-4295-9117-2dcc45506f3a","collapsed":false,"children":[{"id":"255bfdfc-9260-4cb1-9dcd-15f2c9eca2b2","children":[{"id":"40b53a6f-0f43-40c2-b6d3-486982fc9d48","children":[{"id":"724d0e33-fe2c-459e-9e75-e3311809ba36","children":[],"collapsed":false},{"id":"588a65fd-69dd-4bb4-a819-f8c7f05a1d69","collapsed":false,"children":[]},{"id":"13ea01fb-339d-4e65-9fad-123d72830efb","collapsed":false,"children":[]},{"id":"a941538b-6834-4a65-b297-50036b89a41f","collapsed":false,"children":[]}],"collapsed":false},{"id":"80b86062-a197-4adf-baa4-56a5953e0a77","collapsed":false,"children":[{"id":"c09a5876-f825-4cb0-9a56-2916e28f9d02","children":[],"collapsed":false}]}],"collapsed":false}]}]},"contentNodes":{"000001":{"id":"000001","created":1674409747467,"type":"text","content":"**Welcome to my Outliner**<br>"},"e067419d-85c3-422d-b8c4-41690be4450d":{"id":"e067419d-85c3-422d-b8c4-41690be4450d","created":1674412571215,"type":"text","content":"This is my attempt to build a \\"home base\\" piece of software for myself. The goal is to be able to use this tool to serve as a way to write long-form content, manage my website, and keep notes + references. <br>"},"21df5e96-d770-43f0-8bd1-1b01ab4626f9":{"id":"21df5e96-d770-43f0-8bd1-1b01ab4626f9","created":1674412689419,"type":"text","content":"---"},"89c3267b-0114-4138-98a8-443b28d2e679":{"id":"89c3267b-0114-4138-98a8-443b28d2e679","created":1674412690374,"type":"text","content":"**FAQ**"},"9690699a-cb7d-4123-8fa5-f7a58a191a08":{"id":"9690699a-cb7d-4123-8fa5-f7a58a191a08","created":1674412696214,"type":"text","content":"**Why should I use this?**<br>"},"2831a7aa-7291-4ebc-997f-5572e767f5c0":{"id":"2831a7aa-7291-4ebc-997f-5572e767f5c0","created":1674412702948,"type":"text","content":"You shouldn\'t. This isn\'t a piece of software for you - it\'s for me. You may find some use for it, but you also may not. Along the way features will be introduced that likely break things for you.<br>"},"51b2f235-b979-4d74-ad83-3e8b6152bb4a":{"id":"51b2f235-b979-4d74-ad83-3e8b6152bb4a","created":1674412786944,"type":"text","content":"**Ok I used it, but my data is trapped?**<br>"},"9c576012-7e8f-4d2b-b58b-1886eba43341":{"id":"9c576012-7e8f-4d2b-b58b-1886eba43341","created":1674412794788,"type":"text","content":"I\'ll be adding the ability to export the entire thing as OPML, so that there\'s some interop between this and all of [Dave Winer\'s](https://scripting.com) tooling. Hopefully that\'s enough. At some point I\'m going to also introduce support for [RemoteStorage](https://remotestorage.io) which is a project that I\'ve previous contributed to in the past, but have mostly been neglecting lately. I\'m hoping between those two options that\'ll be enough for \\"backups\\" of data.<br>"},"88d336be-4910-4d74-b79a-441894af956d":{"id":"88d336be-4910-4d74-b79a-441894af956d","created":1674412890012,"type":"text","content":"**If I use this, does this mean you have access to all my data?**<br>"},"eb7fd6d7-b3fe-46e5-814c-655a6eec2ba4":{"id":"eb7fd6d7-b3fe-46e5-814c-655a6eec2ba4","created":1674412907752,"type":"text","content":"No. I\'m trying to keep this entirely \\"static\\" and \\"offline first\\". You should be able to use this without concern that I\'ll be watching what you type. Like I said - this is primarily a tool for me, and I already have access to all of my content.<br>"},"bad021fc-24d1-4560-8321-042c28d438a8":{"id":"bad021fc-24d1-4560-8321-042c28d438a8","created":1674491030563,"type":"text","content":"An outliner is simply a tool that allows for \\"infinite\\" hierarchy. You can create nested nodes, move them around, and generally treat it like a big old bulleted list. It seem silly, but being able to sort your list whenever you feel like is a huge deal. <br>"},"1dc4c363-7440-4661-bbc5-7e995dc6ba71":{"id":"1dc4c363-7440-4661-bbc5-7e995dc6ba71","created":1674491120429,"type":"text","content":"I\'ve long been a user of [Dave Winer\'s](https://scripting.com) outliner tools for the last decade since I first discovered Outliners. They\'ve been a massive benefit to me as I attempt to organize my thoughts across a variety of subjects. I\'ve also always struggled to adopt existing tooling as I found that they were ALMOST what I wanted.<br>"},"6addd61d-d12f-4a27-a471-513becfff006":{"id":"6addd61d-d12f-4a27-a471-513becfff006","created":1674491272253,"type":"text","content":"![Thumbs Up](http://www.tmsauto.com/wp-content/uploads/3-thumbs-up.jpg)<br>"},"ef04ea02-aed6-4295-9117-2dcc45506f3a":{"id":"ef04ea02-aed6-4295-9117-2dcc45506f3a","created":1674494561538,"type":"text","content":"**Changelog**"},"255bfdfc-9260-4cb1-9dcd-15f2c9eca2b2":{"id":"255bfdfc-9260-4cb1-9dcd-15f2c9eca2b2","created":1674494572205,"type":"text","content":"**2023-01-23 - Initial Release**<br>"},"40b53a6f-0f43-40c2-b6d3-486982fc9d48":{"id":"40b53a6f-0f43-40c2-b6d3-486982fc9d48","created":1674494588998,"type":"text","content":"The outliner supports all standard outliner functionality<br>"},"850bac59-c64f-4884-a24c-a10cad6b38c2":{"id":"850bac59-c64f-4884-a24c-a10cad6b38c2","created":1674494607269,"type":"text","content":"---"},"cccd8044-92b6-4e89-887c-2f979f4e0cab":{"id":"cccd8044-92b6-4e89-887c-2f979f4e0cab","created":1674494607378,"type":"text","content":"---"},"724d0e33-fe2c-459e-9e75-e3311809ba36":{"id":"724d0e33-fe2c-459e-9e75-e3311809ba36","created":1674496047585,"type":"text","content":"Ability to create/remove nodes at the same level or as children of the selected node<br>"},"588a65fd-69dd-4bb4-a819-f8c7f05a1d69":{"id":"588a65fd-69dd-4bb4-a819-f8c7f05a1d69","created":1674496066859,"type":"text","content":"Ability to move nodes up and down within the same level<br>"},"13ea01fb-339d-4e65-9fad-123d72830efb":{"id":"13ea01fb-339d-4e65-9fad-123d72830efb","created":1674496078557,"type":"text","content":"Ability to lift/lower nodes in the hierarchy<br>"},"80b86062-a197-4adf-baa4-56a5953e0a77":{"id":"80b86062-a197-4adf-baa4-56a5953e0a77","created":1674496103163,"type":"text","content":"**Known Issues**<br>"},"c09a5876-f825-4cb0-9a56-2916e28f9d02":{"id":"c09a5876-f825-4cb0-9a56-2916e28f9d02","created":1674496115316,"type":"text","content":"The `findNodeInTree` method seems to jump through the list multiple times and needs to be properly terminated. There\'s a hack in place right now that stops it from triggering the handler multiple times, but it would be good to get that fixed<br>"},"a941538b-6834-4a65-b297-50036b89a41f":{"id":"a941538b-6834-4a65-b297-50036b89a41f","created":1674496226731,"type":"text","content":"Ability to fold/unfold nodes to hide/display nested content<br>"},"6b457d6b-0228-41b7-bbba-6c0ba3b54f4d":{"id":"6b457d6b-0228-41b7-bbba-6c0ba3b54f4d","created":1674499489509,"type":"text","content":"**What is an outliner?**<br>"},"2ab706de-fea9-42a0-a900-e88b2950ceb3":{"id":"2ab706de-fea9-42a0-a900-e88b2950ceb3","created":1674504320041,"type":"text","content":"**Features**<br>"},"27c14755-ff26-4931-a676-b48cd958b781":{"id":"27c14755-ff26-4931-a676-b48cd958b781","created":1674504328945,"type":"text","content":"- [x] A simple keyboard-navigated outliner where each node supports Markdown<br>"},"116f8e0f-ab62-450f-914e-5ca0956a457f":{"id":"116f8e0f-ab62-450f-914e-5ca0956a457f","created":1674504343967,"type":"text","content":"This is probably the single biggest difference from other outliners - and it really is a simple change. The text nodes are all markdown - so by default it supports anything that would render via [marked.js](https://marked.js.org/). <br>"},"974ebeda-2d49-4a31-9bcc-666c6b910702":{"id":"974ebeda-2d49-4a31-9bcc-666c6b910702","created":1674504414730,"type":"text","content":"Roadmap<br>"},"b00509a3-694a-4159-b9f0-fdc11e1e04e3":{"id":"b00509a3-694a-4159-b9f0-fdc11e1e04e3","created":1674504415116,"type":"text","content":"---"},"3c51e000-8bf7-469d-94e5-4480b980993c":{"id":"3c51e000-8bf7-469d-94e5-4480b980993c","created":1674504438403,"type":"text","content":"---"},"0da3090a-9a6f-4b3f-9607-0e97bd4318f5":{"id":"0da3090a-9a6f-4b3f-9607-0e97bd4318f5","created":1674504442196,"type":"text","content":"Current"},"d69efd32-fbf5-4b80-8a36-af1cb2af7b80":{"id":"d69efd32-fbf5-4b80-8a36-af1cb2af7b80","created":1674504453605,"type":"text","content":"- [ ] Search!"},"b5a55548-f65d-496a-8bea-6b6ba8296e21":{"id":"b5a55548-f65d-496a-8bea-6b6ba8296e21","created":1674504458424,"type":"text","content":"This is the most important one. The ability to fuzzy search across the entirety of the document and jump to any node possible. When I was working with Fargo + Little Outliner, I tried building extensions that would allow me to do this - but they never quite worked as I envisioned. I\'m hoping to provide a full fuzzy-text search system<br>"},"315c3870-a6c2-49b6-89b1-8c9e0a950b4c":{"id":"315c3870-a6c2-49b6-89b1-8c9e0a950b4c","created":1674504522443,"type":"text","content":"---"},"4f84fa9b-bc13-43fa-9e31-cf4a0c976d27":{"id":"4f84fa9b-bc13-43fa-9e31-cf4a0c976d27","created":1674504522958,"type":"text","content":"---"},"2f67d730-c71b-4823-a986-fa510d9408e1":{"id":"2f67d730-c71b-4823-a986-fa510d9408e1","created":1674504531115,"type":"text","content":"- [ ] Export Data<br>"},"bb64c043-b69f-49f8-bde4-9018822d929b":{"id":"bb64c043-b69f-49f8-bde4-9018822d929b","created":1674504546666,"type":"text","content":"Being able to \\"publish\\" a node and <br>"},"40194ea5-9c28-4adb-bffe-4f59e7eca666":{"id":"40194ea5-9c28-4adb-bffe-4f59e7eca666","created":1674504558701,"type":"text","content":"Being able to export the data to OPML at any point will go a long way to ensuring that the tool never locks me in if I decide to leave<br>"},"82956c9c-33d1-44e1-aca7-298cdfc4c72c":{"id":"82956c9c-33d1-44e1-aca7-298cdfc4c72c","created":1674504834120,"type":"text","content":"---"},"a1f74891-c98b-4fc2-a7ce-c18b2ad2b8d0":{"id":"a1f74891-c98b-4fc2-a7ce-c18b2ad2b8d0","created":1674504838755,"type":"text","content":"---"},"e1e60a99-74da-436c-b140-ce8c10832889":{"id":"e1e60a99-74da-436c-b140-ce8c10832889","created":1674504891810,"type":"text","content":"---"},"de5fd362-402e-4769-8429-9fecab882da0":{"id":"de5fd362-402e-4769-8429-9fecab882da0","created":1674504894934,"type":"text","content":"---"},"de9ca950-e7c0-4f10-b65e-a5cf9000a618":{"id":"de9ca950-e7c0-4f10-b65e-a5cf9000a618","created":1674504899904,"type":"text","content":"---"},"8f1a787f-01b5-4b72-8308-8a3fe0a96383":{"id":"8f1a787f-01b5-4b72-8308-8a3fe0a96383","created":1674504923176,"type":"text","content":"eys"}}}');
23053 /************************************************************************/
23054 /******/ // The module cache
23055 /******/ var __webpack_module_cache__ = {};
23057 /******/ // The require function
23058 /******/ function __webpack_require__(moduleId) {
23059 /******/ // Check if module is in cache
23060 /******/ var cachedModule = __webpack_module_cache__[moduleId];
23061 /******/ if (cachedModule !== undefined) {
23062 /******/ return cachedModule.exports;
23064 /******/ // Create a new module (and put it into the cache)
23065 /******/ var module = __webpack_module_cache__[moduleId] = {
23066 /******/ id: moduleId,
23067 /******/ loaded: false,
23068 /******/ exports: {}
23071 /******/ // Execute the module function
23072 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
23074 /******/ // Flag the module as loaded
23075 /******/ module.loaded = true;
23077 /******/ // Return the exports of the module
23078 /******/ return module.exports;
23081 /******/ // expose the modules object (__webpack_modules__)
23082 /******/ __webpack_require__.m = __webpack_modules__;
23084 /************************************************************************/
23085 /******/ /* webpack/runtime/define property getters */
23087 /******/ // define getter functions for harmony exports
23088 /******/ __webpack_require__.d = (exports, definition) => {
23089 /******/ for(var key in definition) {
23090 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
23091 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
23097 /******/ /* webpack/runtime/ensure chunk */
23099 /******/ __webpack_require__.f = {};
23100 /******/ // This file contains only the entry chunk.
23101 /******/ // The chunk loading function for additional chunks
23102 /******/ __webpack_require__.e = (chunkId) => {
23103 /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
23104 /******/ __webpack_require__.f[key](chunkId, promises);
23105 /******/ return promises;
23110 /******/ /* webpack/runtime/get javascript chunk filename */
23112 /******/ // This function allow to reference async chunks
23113 /******/ __webpack_require__.u = (chunkId) => {
23114 /******/ // return url for filenames based on template
23115 /******/ return "" + chunkId + ".bundle.js";
23119 /******/ /* webpack/runtime/global */
23121 /******/ __webpack_require__.g = (function() {
23122 /******/ if (typeof globalThis === 'object') return globalThis;
23124 /******/ return this || new Function('return this')();
23125 /******/ } catch (e) {
23126 /******/ if (typeof window === 'object') return window;
23131 /******/ /* webpack/runtime/hasOwnProperty shorthand */
23133 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
23136 /******/ /* webpack/runtime/load script */
23138 /******/ var inProgress = {};
23139 /******/ var dataWebpackPrefix = "outline-browser:";
23140 /******/ // loadScript function to load a script via script tag
23141 /******/ __webpack_require__.l = (url, done, key, chunkId) => {
23142 /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
23143 /******/ var script, needAttach;
23144 /******/ if(key !== undefined) {
23145 /******/ var scripts = document.getElementsByTagName("script");
23146 /******/ for(var i = 0; i < scripts.length; i++) {
23147 /******/ var s = scripts[i];
23148 /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
23151 /******/ if(!script) {
23152 /******/ needAttach = true;
23153 /******/ script = document.createElement('script');
23155 /******/ script.charset = 'utf-8';
23156 /******/ script.timeout = 120;
23157 /******/ if (__webpack_require__.nc) {
23158 /******/ script.setAttribute("nonce", __webpack_require__.nc);
23160 /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
23161 /******/ script.src = url;
23163 /******/ inProgress[url] = [done];
23164 /******/ var onScriptComplete = (prev, event) => {
23165 /******/ // avoid mem leaks in IE.
23166 /******/ script.onerror = script.onload = null;
23167 /******/ clearTimeout(timeout);
23168 /******/ var doneFns = inProgress[url];
23169 /******/ delete inProgress[url];
23170 /******/ script.parentNode && script.parentNode.removeChild(script);
23171 /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
23172 /******/ if(prev) return prev(event);
23174 /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
23175 /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
23176 /******/ script.onload = onScriptComplete.bind(null, script.onload);
23177 /******/ needAttach && document.head.appendChild(script);
23181 /******/ /* webpack/runtime/make namespace object */
23183 /******/ // define __esModule on exports
23184 /******/ __webpack_require__.r = (exports) => {
23185 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
23186 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
23188 /******/ Object.defineProperty(exports, '__esModule', { value: true });
23192 /******/ /* webpack/runtime/node module decorator */
23194 /******/ __webpack_require__.nmd = (module) => {
23195 /******/ module.paths = [];
23196 /******/ if (!module.children) module.children = [];
23197 /******/ return module;
23201 /******/ /* webpack/runtime/publicPath */
23203 /******/ var scriptUrl;
23204 /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
23205 /******/ var document = __webpack_require__.g.document;
23206 /******/ if (!scriptUrl && document) {
23207 /******/ if (document.currentScript)
23208 /******/ scriptUrl = document.currentScript.src
23209 /******/ if (!scriptUrl) {
23210 /******/ var scripts = document.getElementsByTagName("script");
23211 /******/ if(scripts.length) scriptUrl = scripts[scripts.length - 1].src
23214 /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
23215 /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
23216 /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
23217 /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
23218 /******/ __webpack_require__.p = scriptUrl;
23221 /******/ /* webpack/runtime/jsonp chunk loading */
23223 /******/ // no baseURI
23225 /******/ // object to store loaded and loading chunks
23226 /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
23227 /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
23228 /******/ var installedChunks = {
23232 /******/ __webpack_require__.f.j = (chunkId, promises) => {
23233 /******/ // JSONP chunk loading for javascript
23234 /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
23235 /******/ if(installedChunkData !== 0) { // 0 means "already installed".
23237 /******/ // a Promise means "currently loading".
23238 /******/ if(installedChunkData) {
23239 /******/ promises.push(installedChunkData[2]);
23241 /******/ if(true) { // all chunks have JS
23242 /******/ // setup Promise in chunk cache
23243 /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
23244 /******/ promises.push(installedChunkData[2] = promise);
23246 /******/ // start chunk loading
23247 /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
23248 /******/ // create error before stack unwound to get useful stacktrace later
23249 /******/ var error = new Error();
23250 /******/ var loadingEnded = (event) => {
23251 /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
23252 /******/ installedChunkData = installedChunks[chunkId];
23253 /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
23254 /******/ if(installedChunkData) {
23255 /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
23256 /******/ var realSrc = event && event.target && event.target.src;
23257 /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
23258 /******/ error.name = 'ChunkLoadError';
23259 /******/ error.type = errorType;
23260 /******/ error.request = realSrc;
23261 /******/ installedChunkData[1](error);
23265 /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
23266 /******/ } else installedChunks[chunkId] = 0;
23271 /******/ // no prefetching
23273 /******/ // no preloaded
23277 /******/ // no HMR manifest
23279 /******/ // no on chunks loaded
23281 /******/ // install a JSONP callback for chunk loading
23282 /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
23283 /******/ var [chunkIds, moreModules, runtime] = data;
23284 /******/ // add "moreModules" to the modules object,
23285 /******/ // then flag all "chunkIds" as loaded and fire callback
23286 /******/ var moduleId, chunkId, i = 0;
23287 /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
23288 /******/ for(moduleId in moreModules) {
23289 /******/ if(__webpack_require__.o(moreModules, moduleId)) {
23290 /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
23293 /******/ if(runtime) var result = runtime(__webpack_require__);
23295 /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
23296 /******/ for(;i < chunkIds.length; i++) {
23297 /******/ chunkId = chunkIds[i];
23298 /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
23299 /******/ installedChunks[chunkId][0]();
23301 /******/ installedChunks[chunkId] = 0;
23306 /******/ var chunkLoadingGlobal = self["webpackChunkoutline_browser"] = self["webpackChunkoutline_browser"] || [];
23307 /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
23308 /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
23311 /************************************************************************/
23313 /******/ // startup
23314 /******/ // Load entry module and return exports
23315 /******/ // This entry module is referenced by other modules so it can't be inlined
23316 /******/ var __webpack_exports__ = __webpack_require__("./src/client.ts");