PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / assets / js / atomic-widgets-form-handler.js

atomic-widgets-form-handler.js in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at assets/js/atomic-widgets-form-handler.js

17,434 lines 585.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";
2
3 (function() {
4
5 //#region \0rolldown/runtime.js
6 var __defProp = Object.defineProperty;
7 var __name = (target, value) => __defProp(target, "name", {
8 value,
9 configurable: true
10 });
11 var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
12
13 //#endregion
14
15 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectWithoutPropertiesLoose.js
16 function _objectWithoutPropertiesLoose(r, e) {
17 if (null == r) return {};
18 var t = {};
19 for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
20 if (e.includes(n)) continue;
21 t[n] = r[n];
22 }
23 return t;
24 }
25
26 //#endregion
27 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectWithoutProperties.js
28 function _objectWithoutProperties(e, t) {
29 if (null == e) return {};
30 var o;
31 var r;
32 var i = _objectWithoutPropertiesLoose(e, t);
33 if (Object.getOwnPropertySymbols) {
34 var s = Object.getOwnPropertySymbols(e);
35 for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
36 }
37 return i;
38 }
39
40 //#endregion
41 //#region \0@oxc-project+runtime@0.140.0/helpers/esm/asyncToGenerator.js
42 function asyncGeneratorStep(n, t, e, r, o, a, c) {
43 try {
44 var i = n[a](c);
45 var u = i.value;
46 } catch (n) {
47 e(n);
48 return;
49 }
50 i.done ? t(u) : Promise.resolve(u).then(r, o);
51 }
52 function _asyncToGenerator(n) {
53 return function() {
54 var t = this;
55 var e = arguments;
56 return new Promise(function(r, o) {
57 var a = n.apply(t, e);
58 function _next(n) {
59 asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
60 }
61 function _throw(n) {
62 asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
63 }
64 _next(void 0);
65 });
66 };
67 }
68
69 //#endregion
70 //#region node_modules/@babel/runtime/helpers/interopRequireDefault.js
71 var require_interopRequireDefault = /* @__PURE__ */ __commonJSMin(((exports, module) => {
72 function _interopRequireDefault(e) {
73 return e && e.__esModule ? e : { "default": e };
74 }
75 module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
76 }));
77
78 //#endregion
79 //#region node_modules/core-js/internals/global-this.js
80 var require_global_this = /* @__PURE__ */ __commonJSMin(((exports, module) => {
81 var check = function(it) {
82 return it && it.Math === Math && it;
83 };
84 module.exports = check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || check(typeof self == "object" && self) || check(typeof global == "object" && global) || check(typeof exports == "object" && exports) || (function() {
85 return this;
86 })() || Function("return this")();
87 }));
88
89 //#endregion
90 //#region node_modules/core-js/internals/fails.js
91 var require_fails = /* @__PURE__ */ __commonJSMin(((exports, module) => {
92 module.exports = function(exec) {
93 try {
94 return !!exec();
95 } catch (error) {
96 return true;
97 }
98 };
99 }));
100
101 //#endregion
102 //#region node_modules/core-js/internals/descriptors.js
103 var require_descriptors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
104 var fails = require_fails();
105 module.exports = !fails(function() {
106 return Object.defineProperty({}, 1, { get: function() {
107 return 7;
108 } })[1] !== 7;
109 });
110 }));
111
112 //#endregion
113 //#region node_modules/core-js/internals/function-bind-native.js
114 var require_function_bind_native = /* @__PURE__ */ __commonJSMin(((exports, module) => {
115 var fails = require_fails();
116 module.exports = !fails(function() {
117 var test = (function() {}).bind();
118 return typeof test != "function" || test.hasOwnProperty("prototype");
119 });
120 }));
121
122 //#endregion
123 //#region node_modules/core-js/internals/function-call.js
124 var require_function_call = /* @__PURE__ */ __commonJSMin(((exports, module) => {
125 var NATIVE_BIND = require_function_bind_native();
126 var call = Function.prototype.call;
127 module.exports = NATIVE_BIND ? call.bind(call) : function() {
128 return call.apply(call, arguments);
129 };
130 }));
131
132 //#endregion
133 //#region node_modules/core-js/internals/object-property-is-enumerable.js
134 var require_object_property_is_enumerable = /* @__PURE__ */ __commonJSMin(((exports) => {
135 var $propertyIsEnumerable = {}.propertyIsEnumerable;
136 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
137 var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
138 exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
139 var descriptor = getOwnPropertyDescriptor(this, V);
140 return !!descriptor && descriptor.enumerable;
141 } : $propertyIsEnumerable;
142 }));
143
144 //#endregion
145 //#region node_modules/core-js/internals/create-property-descriptor.js
146 var require_create_property_descriptor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
147 module.exports = function(bitmap, value) {
148 return {
149 enumerable: !(bitmap & 1),
150 configurable: !(bitmap & 2),
151 writable: !(bitmap & 4),
152 value
153 };
154 };
155 }));
156
157 //#endregion
158 //#region node_modules/core-js/internals/function-uncurry-this.js
159 var require_function_uncurry_this = /* @__PURE__ */ __commonJSMin(((exports, module) => {
160 var NATIVE_BIND = require_function_bind_native();
161 var FunctionPrototype = Function.prototype;
162 var call = FunctionPrototype.call;
163 var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
164 module.exports = NATIVE_BIND ? uncurryThisWithBind : function(fn) {
165 return function() {
166 return call.apply(fn, arguments);
167 };
168 };
169 }));
170
171 //#endregion
172 //#region node_modules/core-js/internals/classof-raw.js
173 var require_classof_raw = /* @__PURE__ */ __commonJSMin(((exports, module) => {
174 var uncurryThis = require_function_uncurry_this();
175 var toString = uncurryThis({}.toString);
176 var stringSlice = uncurryThis("".slice);
177 module.exports = function(it) {
178 return stringSlice(toString(it), 8, -1);
179 };
180 }));
181
182 //#endregion
183 //#region node_modules/core-js/internals/indexed-object.js
184 var require_indexed_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
185 var uncurryThis = require_function_uncurry_this();
186 var fails = require_fails();
187 var classof = require_classof_raw();
188 var $Object = Object;
189 var split = uncurryThis("".split);
190 module.exports = fails(function() {
191 return !$Object("z").propertyIsEnumerable(0);
192 }) ? function(it) {
193 return classof(it) === "String" ? split(it, "") : $Object(it);
194 } : $Object;
195 }));
196
197 //#endregion
198 //#region node_modules/core-js/internals/is-null-or-undefined.js
199 var require_is_null_or_undefined = /* @__PURE__ */ __commonJSMin(((exports, module) => {
200 module.exports = function(it) {
201 return it === null || it === void 0;
202 };
203 }));
204
205 //#endregion
206 //#region node_modules/core-js/internals/require-object-coercible.js
207 var require_require_object_coercible = /* @__PURE__ */ __commonJSMin(((exports, module) => {
208 var isNullOrUndefined = require_is_null_or_undefined();
209 var $TypeError = TypeError;
210 module.exports = function(it) {
211 if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
212 return it;
213 };
214 }));
215
216 //#endregion
217 //#region node_modules/core-js/internals/to-indexed-object.js
218 var require_to_indexed_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
219 var IndexedObject = require_indexed_object();
220 var requireObjectCoercible = require_require_object_coercible();
221 module.exports = function(it) {
222 return IndexedObject(requireObjectCoercible(it));
223 };
224 }));
225
226 //#endregion
227 //#region node_modules/core-js/internals/is-callable.js
228 var require_is_callable = /* @__PURE__ */ __commonJSMin(((exports, module) => {
229 var documentAll = typeof document == "object" && document.all;
230 module.exports = typeof documentAll == "undefined" && documentAll !== void 0 ? function(argument) {
231 return typeof argument == "function" || argument === documentAll;
232 } : function(argument) {
233 return typeof argument == "function";
234 };
235 }));
236
237 //#endregion
238 //#region node_modules/core-js/internals/is-object.js
239 var require_is_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
240 var isCallable = require_is_callable();
241 module.exports = function(it) {
242 return typeof it == "object" ? it !== null : isCallable(it);
243 };
244 }));
245
246 //#endregion
247 //#region node_modules/core-js/internals/get-built-in.js
248 var require_get_built_in = /* @__PURE__ */ __commonJSMin(((exports, module) => {
249 var globalThis = require_global_this();
250 var isCallable = require_is_callable();
251 var aFunction = function(argument) {
252 return isCallable(argument) ? argument : void 0;
253 };
254 module.exports = function(namespace, method) {
255 return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method];
256 };
257 }));
258
259 //#endregion
260 //#region node_modules/core-js/internals/object-is-prototype-of.js
261 var require_object_is_prototype_of = /* @__PURE__ */ __commonJSMin(((exports, module) => {
262 var uncurryThis = require_function_uncurry_this();
263 module.exports = uncurryThis({}.isPrototypeOf);
264 }));
265
266 //#endregion
267 //#region node_modules/core-js/internals/environment-user-agent.js
268 var require_environment_user_agent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
269 var navigator = require_global_this().navigator;
270 var userAgent = navigator && navigator.userAgent;
271 module.exports = userAgent ? String(userAgent) : "";
272 }));
273
274 //#endregion
275 //#region node_modules/core-js/internals/environment-v8-version.js
276 var require_environment_v8_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
277 var globalThis = require_global_this();
278 var userAgent = require_environment_user_agent();
279 var process = globalThis.process;
280 var Deno = globalThis.Deno;
281 var versions = process && process.versions || Deno && Deno.version;
282 var v8 = versions && versions.v8;
283 var match;
284 var version;
285 if (v8) {
286 match = v8.split(".");
287 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
288 }
289 if (!version && userAgent) {
290 match = userAgent.match(/Edge\/(\d+)/);
291 if (!match || match[1] >= 74) {
292 match = userAgent.match(/Chrome\/(\d+)/);
293 if (match) version = +match[1];
294 }
295 }
296 module.exports = version;
297 }));
298
299 //#endregion
300 //#region node_modules/core-js/internals/symbol-constructor-detection.js
301 var require_symbol_constructor_detection = /* @__PURE__ */ __commonJSMin(((exports, module) => {
302 var V8_VERSION = require_environment_v8_version();
303 var fails = require_fails();
304 var $String = require_global_this().String;
305 module.exports = !!Object.getOwnPropertySymbols && !fails(function() {
306 var symbol = Symbol("symbol detection");
307 return !$String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
308 });
309 }));
310
311 //#endregion
312 //#region node_modules/core-js/internals/use-symbol-as-uid.js
313 var require_use_symbol_as_uid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
314 var NATIVE_SYMBOL = require_symbol_constructor_detection();
315 module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol";
316 }));
317
318 //#endregion
319 //#region node_modules/core-js/internals/is-symbol.js
320 var require_is_symbol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
321 var getBuiltIn = require_get_built_in();
322 var isCallable = require_is_callable();
323 var isPrototypeOf = require_object_is_prototype_of();
324 var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
325 var $Object = Object;
326 module.exports = USE_SYMBOL_AS_UID ? function(it) {
327 return typeof it == "symbol";
328 } : function(it) {
329 var $Symbol = getBuiltIn("Symbol");
330 return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
331 };
332 }));
333
334 //#endregion
335 //#region node_modules/core-js/internals/try-to-string.js
336 var require_try_to_string = /* @__PURE__ */ __commonJSMin(((exports, module) => {
337 var $String = String;
338 module.exports = function(argument) {
339 try {
340 return $String(argument);
341 } catch (error) {
342 return "Object";
343 }
344 };
345 }));
346
347 //#endregion
348 //#region node_modules/core-js/internals/a-callable.js
349 var require_a_callable = /* @__PURE__ */ __commonJSMin(((exports, module) => {
350 var isCallable = require_is_callable();
351 var tryToString = require_try_to_string();
352 var $TypeError = TypeError;
353 module.exports = function(argument) {
354 if (isCallable(argument)) return argument;
355 throw new $TypeError(tryToString(argument) + " is not a function");
356 };
357 }));
358
359 //#endregion
360 //#region node_modules/core-js/internals/get-method.js
361 var require_get_method = /* @__PURE__ */ __commonJSMin(((exports, module) => {
362 var aCallable = require_a_callable();
363 var isNullOrUndefined = require_is_null_or_undefined();
364 module.exports = function(V, P) {
365 var func = V[P];
366 return isNullOrUndefined(func) ? void 0 : aCallable(func);
367 };
368 }));
369
370 //#endregion
371 //#region node_modules/core-js/internals/ordinary-to-primitive.js
372 var require_ordinary_to_primitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
373 var call = require_function_call();
374 var isCallable = require_is_callable();
375 var isObject = require_is_object();
376 var $TypeError = TypeError;
377 module.exports = function(input, pref) {
378 var fn;
379 var val;
380 if (pref === "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
381 if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
382 if (pref !== "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
383 throw new $TypeError("Can't convert object to primitive value");
384 };
385 }));
386
387 //#endregion
388 //#region node_modules/core-js/internals/is-pure.js
389 var require_is_pure = /* @__PURE__ */ __commonJSMin(((exports, module) => {
390 module.exports = false;
391 }));
392
393 //#endregion
394 //#region node_modules/core-js/internals/define-global-property.js
395 var require_define_global_property = /* @__PURE__ */ __commonJSMin(((exports, module) => {
396 var globalThis = require_global_this();
397 var defineProperty = Object.defineProperty;
398 module.exports = function(key, value) {
399 try {
400 defineProperty(globalThis, key, {
401 value,
402 configurable: true,
403 writable: true
404 });
405 } catch (error) {
406 globalThis[key] = value;
407 }
408 return value;
409 };
410 }));
411
412 //#endregion
413 //#region node_modules/core-js/internals/shared-store.js
414 var require_shared_store = /* @__PURE__ */ __commonJSMin(((exports, module) => {
415 var IS_PURE = require_is_pure();
416 var globalThis = require_global_this();
417 var defineGlobalProperty = require_define_global_property();
418 var SHARED = "__core-js_shared__";
419 var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
420 (store.versions || (store.versions = [])).push({
421 version: "3.46.0",
422 mode: IS_PURE ? "pure" : "global",
423 copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",
424 license: "https://github.com/zloirock/core-js/blob/v3.46.0/LICENSE",
425 source: "https://github.com/zloirock/core-js"
426 });
427 }));
428
429 //#endregion
430 //#region node_modules/core-js/internals/shared.js
431 var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
432 var store = require_shared_store();
433 module.exports = function(key, value) {
434 return store[key] || (store[key] = value || {});
435 };
436 }));
437
438 //#endregion
439 //#region node_modules/core-js/internals/to-object.js
440 var require_to_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
441 var requireObjectCoercible = require_require_object_coercible();
442 var $Object = Object;
443 module.exports = function(argument) {
444 return $Object(requireObjectCoercible(argument));
445 };
446 }));
447
448 //#endregion
449 //#region node_modules/core-js/internals/has-own-property.js
450 var require_has_own_property = /* @__PURE__ */ __commonJSMin(((exports, module) => {
451 var uncurryThis = require_function_uncurry_this();
452 var toObject = require_to_object();
453 var hasOwnProperty = uncurryThis({}.hasOwnProperty);
454 module.exports = Object.hasOwn || function hasOwn(it, key) {
455 return hasOwnProperty(toObject(it), key);
456 };
457 }));
458
459 //#endregion
460 //#region node_modules/core-js/internals/uid.js
461 var require_uid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
462 var uncurryThis = require_function_uncurry_this();
463 var id = 0;
464 var postfix = Math.random();
465 var toString = uncurryThis(1.1.toString);
466 module.exports = function(key) {
467 return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString(++id + postfix, 36);
468 };
469 }));
470
471 //#endregion
472 //#region node_modules/core-js/internals/well-known-symbol.js
473 var require_well_known_symbol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
474 var globalThis = require_global_this();
475 var shared = require_shared();
476 var hasOwn = require_has_own_property();
477 var uid = require_uid();
478 var NATIVE_SYMBOL = require_symbol_constructor_detection();
479 var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
480 var Symbol = globalThis.Symbol;
481 var WellKnownSymbolsStore = shared("wks");
482 var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol["for"] || Symbol : Symbol && Symbol.withoutSetter || uid;
483 module.exports = function(name) {
484 if (!hasOwn(WellKnownSymbolsStore, name)) WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name) ? Symbol[name] : createWellKnownSymbol("Symbol." + name);
485 return WellKnownSymbolsStore[name];
486 };
487 }));
488
489 //#endregion
490 //#region node_modules/core-js/internals/to-primitive.js
491 var require_to_primitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
492 var call = require_function_call();
493 var isObject = require_is_object();
494 var isSymbol = require_is_symbol();
495 var getMethod = require_get_method();
496 var ordinaryToPrimitive = require_ordinary_to_primitive();
497 var wellKnownSymbol = require_well_known_symbol();
498 var $TypeError = TypeError;
499 var TO_PRIMITIVE = wellKnownSymbol("toPrimitive");
500 module.exports = function(input, pref) {
501 if (!isObject(input) || isSymbol(input)) return input;
502 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
503 var result;
504 if (exoticToPrim) {
505 if (pref === void 0) pref = "default";
506 result = call(exoticToPrim, input, pref);
507 if (!isObject(result) || isSymbol(result)) return result;
508 throw new $TypeError("Can't convert object to primitive value");
509 }
510 if (pref === void 0) pref = "number";
511 return ordinaryToPrimitive(input, pref);
512 };
513 }));
514
515 //#endregion
516 //#region node_modules/core-js/internals/to-property-key.js
517 var require_to_property_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
518 var toPrimitive = require_to_primitive();
519 var isSymbol = require_is_symbol();
520 module.exports = function(argument) {
521 var key = toPrimitive(argument, "string");
522 return isSymbol(key) ? key : key + "";
523 };
524 }));
525
526 //#endregion
527 //#region node_modules/core-js/internals/document-create-element.js
528 var require_document_create_element = /* @__PURE__ */ __commonJSMin(((exports, module) => {
529 var globalThis = require_global_this();
530 var isObject = require_is_object();
531 var document = globalThis.document;
532 var EXISTS = isObject(document) && isObject(document.createElement);
533 module.exports = function(it) {
534 return EXISTS ? document.createElement(it) : {};
535 };
536 }));
537
538 //#endregion
539 //#region node_modules/core-js/internals/ie8-dom-define.js
540 var require_ie8_dom_define = /* @__PURE__ */ __commonJSMin(((exports, module) => {
541 var DESCRIPTORS = require_descriptors();
542 var fails = require_fails();
543 var createElement = require_document_create_element();
544 module.exports = !DESCRIPTORS && !fails(function() {
545 return Object.defineProperty(createElement("div"), "a", { get: function() {
546 return 7;
547 } }).a !== 7;
548 });
549 }));
550
551 //#endregion
552 //#region node_modules/core-js/internals/object-get-own-property-descriptor.js
553 var require_object_get_own_property_descriptor = /* @__PURE__ */ __commonJSMin(((exports) => {
554 var DESCRIPTORS = require_descriptors();
555 var call = require_function_call();
556 var propertyIsEnumerableModule = require_object_property_is_enumerable();
557 var createPropertyDescriptor = require_create_property_descriptor();
558 var toIndexedObject = require_to_indexed_object();
559 var toPropertyKey = require_to_property_key();
560 var hasOwn = require_has_own_property();
561 var IE8_DOM_DEFINE = require_ie8_dom_define();
562 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
563 exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
564 O = toIndexedObject(O);
565 P = toPropertyKey(P);
566 if (IE8_DOM_DEFINE) try {
567 return $getOwnPropertyDescriptor(O, P);
568 } catch (error) {}
569 if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
570 };
571 }));
572
573 //#endregion
574 //#region node_modules/core-js/internals/v8-prototype-define-bug.js
575 var require_v8_prototype_define_bug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
576 var DESCRIPTORS = require_descriptors();
577 var fails = require_fails();
578 module.exports = DESCRIPTORS && fails(function() {
579 return Object.defineProperty(function() {}, "prototype", {
580 value: 42,
581 writable: false
582 }).prototype !== 42;
583 });
584 }));
585
586 //#endregion
587 //#region node_modules/core-js/internals/an-object.js
588 var require_an_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
589 var isObject = require_is_object();
590 var $String = String;
591 var $TypeError = TypeError;
592 module.exports = function(argument) {
593 if (isObject(argument)) return argument;
594 throw new $TypeError($String(argument) + " is not an object");
595 };
596 }));
597
598 //#endregion
599 //#region node_modules/core-js/internals/object-define-property.js
600 var require_object_define_property = /* @__PURE__ */ __commonJSMin(((exports) => {
601 var DESCRIPTORS = require_descriptors();
602 var IE8_DOM_DEFINE = require_ie8_dom_define();
603 var V8_PROTOTYPE_DEFINE_BUG = require_v8_prototype_define_bug();
604 var anObject = require_an_object();
605 var toPropertyKey = require_to_property_key();
606 var $TypeError = TypeError;
607 var $defineProperty = Object.defineProperty;
608 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
609 var ENUMERABLE = "enumerable";
610 var CONFIGURABLE = "configurable";
611 var WRITABLE = "writable";
612 exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
613 anObject(O);
614 P = toPropertyKey(P);
615 anObject(Attributes);
616 if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
617 var current = $getOwnPropertyDescriptor(O, P);
618 if (current && current[WRITABLE]) {
619 O[P] = Attributes.value;
620 Attributes = {
621 configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
622 enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
623 writable: false
624 };
625 }
626 }
627 return $defineProperty(O, P, Attributes);
628 } : $defineProperty : function defineProperty(O, P, Attributes) {
629 anObject(O);
630 P = toPropertyKey(P);
631 anObject(Attributes);
632 if (IE8_DOM_DEFINE) try {
633 return $defineProperty(O, P, Attributes);
634 } catch (error) {}
635 if ("get" in Attributes || "set" in Attributes) throw new $TypeError("Accessors not supported");
636 if ("value" in Attributes) O[P] = Attributes.value;
637 return O;
638 };
639 }));
640
641 //#endregion
642 //#region node_modules/core-js/internals/create-non-enumerable-property.js
643 var require_create_non_enumerable_property = /* @__PURE__ */ __commonJSMin(((exports, module) => {
644 var DESCRIPTORS = require_descriptors();
645 var definePropertyModule = require_object_define_property();
646 var createPropertyDescriptor = require_create_property_descriptor();
647 module.exports = DESCRIPTORS ? function(object, key, value) {
648 return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
649 } : function(object, key, value) {
650 object[key] = value;
651 return object;
652 };
653 }));
654
655 //#endregion
656 //#region node_modules/core-js/internals/function-name.js
657 var require_function_name = /* @__PURE__ */ __commonJSMin(((exports, module) => {
658 var DESCRIPTORS = require_descriptors();
659 var hasOwn = require_has_own_property();
660 var FunctionPrototype = Function.prototype;
661 var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
662 var EXISTS = hasOwn(FunctionPrototype, "name");
663 var PROPER = EXISTS && (function something() {}).name === "something";
664 var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable);
665 module.exports = {
666 EXISTS,
667 PROPER,
668 CONFIGURABLE
669 };
670 }));
671
672 //#endregion
673 //#region node_modules/core-js/internals/inspect-source.js
674 var require_inspect_source = /* @__PURE__ */ __commonJSMin(((exports, module) => {
675 var uncurryThis = require_function_uncurry_this();
676 var isCallable = require_is_callable();
677 var store = require_shared_store();
678 var functionToString = uncurryThis(Function.toString);
679 if (!isCallable(store.inspectSource)) store.inspectSource = function(it) {
680 return functionToString(it);
681 };
682 module.exports = store.inspectSource;
683 }));
684
685 //#endregion
686 //#region node_modules/core-js/internals/weak-map-basic-detection.js
687 var require_weak_map_basic_detection = /* @__PURE__ */ __commonJSMin(((exports, module) => {
688 var globalThis = require_global_this();
689 var isCallable = require_is_callable();
690 var WeakMap = globalThis.WeakMap;
691 module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
692 }));
693
694 //#endregion
695 //#region node_modules/core-js/internals/shared-key.js
696 var require_shared_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
697 var shared = require_shared();
698 var uid = require_uid();
699 var keys = shared("keys");
700 module.exports = function(key) {
701 return keys[key] || (keys[key] = uid(key));
702 };
703 }));
704
705 //#endregion
706 //#region node_modules/core-js/internals/hidden-keys.js
707 var require_hidden_keys = /* @__PURE__ */ __commonJSMin(((exports, module) => {
708 module.exports = {};
709 }));
710
711 //#endregion
712 //#region node_modules/core-js/internals/internal-state.js
713 var require_internal_state = /* @__PURE__ */ __commonJSMin(((exports, module) => {
714 var NATIVE_WEAK_MAP = require_weak_map_basic_detection();
715 var globalThis = require_global_this();
716 var isObject = require_is_object();
717 var createNonEnumerableProperty = require_create_non_enumerable_property();
718 var hasOwn = require_has_own_property();
719 var shared = require_shared_store();
720 var sharedKey = require_shared_key();
721 var hiddenKeys = require_hidden_keys();
722 var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
723 var TypeError = globalThis.TypeError;
724 var WeakMap = globalThis.WeakMap;
725 var set;
726 var get;
727 var has;
728 var enforce = function(it) {
729 return has(it) ? get(it) : set(it, {});
730 };
731 var getterFor = function(TYPE) {
732 return function(it) {
733 var state;
734 if (!isObject(it) || (state = get(it)).type !== TYPE) throw new TypeError("Incompatible receiver, " + TYPE + " required");
735 return state;
736 };
737 };
738 if (NATIVE_WEAK_MAP || shared.state) {
739 var store = shared.state || (shared.state = new WeakMap());
740 store.get = store.get;
741 store.has = store.has;
742 store.set = store.set;
743 set = function(it, metadata) {
744 if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
745 metadata.facade = it;
746 store.set(it, metadata);
747 return metadata;
748 };
749 get = function(it) {
750 return store.get(it) || {};
751 };
752 has = function(it) {
753 return store.has(it);
754 };
755 } else {
756 var STATE = sharedKey("state");
757 hiddenKeys[STATE] = true;
758 set = function(it, metadata) {
759 if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
760 metadata.facade = it;
761 createNonEnumerableProperty(it, STATE, metadata);
762 return metadata;
763 };
764 get = function(it) {
765 return hasOwn(it, STATE) ? it[STATE] : {};
766 };
767 has = function(it) {
768 return hasOwn(it, STATE);
769 };
770 }
771 module.exports = {
772 set,
773 get,
774 has,
775 enforce,
776 getterFor
777 };
778 }));
779
780 //#endregion
781 //#region node_modules/core-js/internals/make-built-in.js
782 var require_make_built_in = /* @__PURE__ */ __commonJSMin(((exports, module) => {
783 var uncurryThis = require_function_uncurry_this();
784 var fails = require_fails();
785 var isCallable = require_is_callable();
786 var hasOwn = require_has_own_property();
787 var DESCRIPTORS = require_descriptors();
788 var CONFIGURABLE_FUNCTION_NAME = require_function_name().CONFIGURABLE;
789 var inspectSource = require_inspect_source();
790 var InternalStateModule = require_internal_state();
791 var enforceInternalState = InternalStateModule.enforce;
792 var getInternalState = InternalStateModule.get;
793 var $String = String;
794 var defineProperty = Object.defineProperty;
795 var stringSlice = uncurryThis("".slice);
796 var replace = uncurryThis("".replace);
797 var join = uncurryThis([].join);
798 var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
799 return defineProperty(function() {}, "length", { value: 8 }).length !== 8;
800 });
801 var TEMPLATE = String(String).split("String");
802 var makeBuiltIn = module.exports = function(value, name, options) {
803 if (stringSlice($String(name), 0, 7) === "Symbol(") name = "[" + replace($String(name), /^Symbol\(([^)]*)\).*$/, "$1") + "]";
804 if (options && options.getter) name = "get " + name;
805 if (options && options.setter) name = "set " + name;
806 if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) if (DESCRIPTORS) defineProperty(value, "name", {
807 value: name,
808 configurable: true
809 });
810 else value.name = name;
811 if (CONFIGURABLE_LENGTH && options && hasOwn(options, "arity") && value.length !== options.arity) defineProperty(value, "length", { value: options.arity });
812 try {
813 if (options && hasOwn(options, "constructor") && options.constructor) {
814 if (DESCRIPTORS) defineProperty(value, "prototype", { writable: false });
815 } else if (value.prototype) value.prototype = void 0;
816 } catch (error) {}
817 var state = enforceInternalState(value);
818 if (!hasOwn(state, "source")) state.source = join(TEMPLATE, typeof name == "string" ? name : "");
819 return value;
820 };
821 Function.prototype.toString = makeBuiltIn(function toString() {
822 return isCallable(this) && getInternalState(this).source || inspectSource(this);
823 }, "toString");
824 }));
825
826 //#endregion
827 //#region node_modules/core-js/internals/define-built-in.js
828 var require_define_built_in = /* @__PURE__ */ __commonJSMin(((exports, module) => {
829 var isCallable = require_is_callable();
830 var definePropertyModule = require_object_define_property();
831 var makeBuiltIn = require_make_built_in();
832 var defineGlobalProperty = require_define_global_property();
833 module.exports = function(O, key, value, options) {
834 if (!options) options = {};
835 var simple = options.enumerable;
836 var name = options.name !== void 0 ? options.name : key;
837 if (isCallable(value)) makeBuiltIn(value, name, options);
838 if (options.global) if (simple) O[key] = value;
839 else defineGlobalProperty(key, value);
840 else {
841 try {
842 if (!options.unsafe) delete O[key];
843 else if (O[key]) simple = true;
844 } catch (error) {}
845 if (simple) O[key] = value;
846 else definePropertyModule.f(O, key, {
847 value,
848 enumerable: false,
849 configurable: !options.nonConfigurable,
850 writable: !options.nonWritable
851 });
852 }
853 return O;
854 };
855 }));
856
857 //#endregion
858 //#region node_modules/core-js/internals/math-trunc.js
859 var require_math_trunc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
860 var ceil = Math.ceil;
861 var floor = Math.floor;
862 module.exports = Math.trunc || function trunc(x) {
863 var n = +x;
864 return (n > 0 ? floor : ceil)(n);
865 };
866 }));
867
868 //#endregion
869 //#region node_modules/core-js/internals/to-integer-or-infinity.js
870 var require_to_integer_or_infinity = /* @__PURE__ */ __commonJSMin(((exports, module) => {
871 var trunc = require_math_trunc();
872 module.exports = function(argument) {
873 var number = +argument;
874 return number !== number || number === 0 ? 0 : trunc(number);
875 };
876 }));
877
878 //#endregion
879 //#region node_modules/core-js/internals/to-absolute-index.js
880 var require_to_absolute_index = /* @__PURE__ */ __commonJSMin(((exports, module) => {
881 var toIntegerOrInfinity = require_to_integer_or_infinity();
882 var max = Math.max;
883 var min = Math.min;
884 module.exports = function(index, length) {
885 var integer = toIntegerOrInfinity(index);
886 return integer < 0 ? max(integer + length, 0) : min(integer, length);
887 };
888 }));
889
890 //#endregion
891 //#region node_modules/core-js/internals/to-length.js
892 var require_to_length = /* @__PURE__ */ __commonJSMin(((exports, module) => {
893 var toIntegerOrInfinity = require_to_integer_or_infinity();
894 var min = Math.min;
895 module.exports = function(argument) {
896 var len = toIntegerOrInfinity(argument);
897 return len > 0 ? min(len, 9007199254740991) : 0;
898 };
899 }));
900
901 //#endregion
902 //#region node_modules/core-js/internals/length-of-array-like.js
903 var require_length_of_array_like = /* @__PURE__ */ __commonJSMin(((exports, module) => {
904 var toLength = require_to_length();
905 module.exports = function(obj) {
906 return toLength(obj.length);
907 };
908 }));
909
910 //#endregion
911 //#region node_modules/core-js/internals/array-includes.js
912 var require_array_includes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
913 var toIndexedObject = require_to_indexed_object();
914 var toAbsoluteIndex = require_to_absolute_index();
915 var lengthOfArrayLike = require_length_of_array_like();
916 var createMethod = function(IS_INCLUDES) {
917 return function($this, el, fromIndex) {
918 var O = toIndexedObject($this);
919 var length = lengthOfArrayLike(O);
920 if (length === 0) return !IS_INCLUDES && -1;
921 var index = toAbsoluteIndex(fromIndex, length);
922 var value;
923 if (IS_INCLUDES && el !== el) while (length > index) {
924 value = O[index++];
925 if (value !== value) return true;
926 }
927 else for (; length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
928 return !IS_INCLUDES && -1;
929 };
930 };
931 module.exports = {
932 includes: createMethod(true),
933 indexOf: createMethod(false)
934 };
935 }));
936
937 //#endregion
938 //#region node_modules/core-js/internals/object-keys-internal.js
939 var require_object_keys_internal = /* @__PURE__ */ __commonJSMin(((exports, module) => {
940 var uncurryThis = require_function_uncurry_this();
941 var hasOwn = require_has_own_property();
942 var toIndexedObject = require_to_indexed_object();
943 var indexOf = require_array_includes().indexOf;
944 var hiddenKeys = require_hidden_keys();
945 var push = uncurryThis([].push);
946 module.exports = function(object, names) {
947 var O = toIndexedObject(object);
948 var i = 0;
949 var result = [];
950 var key;
951 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
952 while (names.length > i) if (hasOwn(O, key = names[i++])) ~indexOf(result, key) || push(result, key);
953 return result;
954 };
955 }));
956
957 //#endregion
958 //#region node_modules/core-js/internals/enum-bug-keys.js
959 var require_enum_bug_keys = /* @__PURE__ */ __commonJSMin(((exports, module) => {
960 module.exports = [
961 "constructor",
962 "hasOwnProperty",
963 "isPrototypeOf",
964 "propertyIsEnumerable",
965 "toLocaleString",
966 "toString",
967 "valueOf"
968 ];
969 }));
970
971 //#endregion
972 //#region node_modules/core-js/internals/object-get-own-property-names.js
973 var require_object_get_own_property_names = /* @__PURE__ */ __commonJSMin(((exports) => {
974 var internalObjectKeys = require_object_keys_internal();
975 var hiddenKeys = require_enum_bug_keys().concat("length", "prototype");
976 exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
977 return internalObjectKeys(O, hiddenKeys);
978 };
979 }));
980
981 //#endregion
982 //#region node_modules/core-js/internals/object-get-own-property-symbols.js
983 var require_object_get_own_property_symbols = /* @__PURE__ */ __commonJSMin(((exports) => {
984 exports.f = Object.getOwnPropertySymbols;
985 }));
986
987 //#endregion
988 //#region node_modules/core-js/internals/own-keys.js
989 var require_own_keys = /* @__PURE__ */ __commonJSMin(((exports, module) => {
990 var getBuiltIn = require_get_built_in();
991 var uncurryThis = require_function_uncurry_this();
992 var getOwnPropertyNamesModule = require_object_get_own_property_names();
993 var getOwnPropertySymbolsModule = require_object_get_own_property_symbols();
994 var anObject = require_an_object();
995 var concat = uncurryThis([].concat);
996 module.exports = getBuiltIn("Reflect", "ownKeys") || function ownKeys(it) {
997 var keys = getOwnPropertyNamesModule.f(anObject(it));
998 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
999 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
1000 };
1001 }));
1002
1003 //#endregion
1004 //#region node_modules/core-js/internals/copy-constructor-properties.js
1005 var require_copy_constructor_properties = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1006 var hasOwn = require_has_own_property();
1007 var ownKeys = require_own_keys();
1008 var getOwnPropertyDescriptorModule = require_object_get_own_property_descriptor();
1009 var definePropertyModule = require_object_define_property();
1010 module.exports = function(target, source, exceptions) {
1011 var keys = ownKeys(source);
1012 var defineProperty = definePropertyModule.f;
1013 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1014 for (var i = 0; i < keys.length; i++) {
1015 var key = keys[i];
1016 if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1017 }
1018 };
1019 }));
1020
1021 //#endregion
1022 //#region node_modules/core-js/internals/is-forced.js
1023 var require_is_forced = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1024 var fails = require_fails();
1025 var isCallable = require_is_callable();
1026 var replacement = /#|\.prototype\./;
1027 var isForced = function(feature, detection) {
1028 var value = data[normalize(feature)];
1029 return value === POLYFILL ? true : value === NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
1030 };
1031 var normalize = isForced.normalize = function(string) {
1032 return String(string).replace(replacement, ".").toLowerCase();
1033 };
1034 var data = isForced.data = {};
1035 var NATIVE = isForced.NATIVE = "N";
1036 var POLYFILL = isForced.POLYFILL = "P";
1037 module.exports = isForced;
1038 }));
1039
1040 //#endregion
1041 //#region node_modules/core-js/internals/export.js
1042 var require_export = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1043 var globalThis = require_global_this();
1044 var getOwnPropertyDescriptor = require_object_get_own_property_descriptor().f;
1045 var createNonEnumerableProperty = require_create_non_enumerable_property();
1046 var defineBuiltIn = require_define_built_in();
1047 var defineGlobalProperty = require_define_global_property();
1048 var copyConstructorProperties = require_copy_constructor_properties();
1049 var isForced = require_is_forced();
1050 module.exports = function(options, source) {
1051 var TARGET = options.target;
1052 var GLOBAL = options.global;
1053 var STATIC = options.stat;
1054 var FORCED;
1055 var target;
1056 var key;
1057 var targetProperty;
1058 var sourceProperty;
1059 var descriptor;
1060 if (GLOBAL) target = globalThis;
1061 else if (STATIC) target = globalThis[TARGET] || defineGlobalProperty(TARGET, {});
1062 else target = globalThis[TARGET] && globalThis[TARGET].prototype;
1063 if (target) for (key in source) {
1064 sourceProperty = source[key];
1065 if (options.dontCallGetSet) {
1066 descriptor = getOwnPropertyDescriptor(target, key);
1067 targetProperty = descriptor && descriptor.value;
1068 } else targetProperty = target[key];
1069 FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced);
1070 if (!FORCED && targetProperty !== void 0) {
1071 if (typeof sourceProperty == typeof targetProperty) continue;
1072 copyConstructorProperties(sourceProperty, targetProperty);
1073 }
1074 if (options.sham || targetProperty && targetProperty.sham) createNonEnumerableProperty(sourceProperty, "sham", true);
1075 defineBuiltIn(target, key, sourceProperty, options);
1076 }
1077 };
1078 }));
1079
1080 //#endregion
1081 //#region node_modules/core-js/internals/object-keys.js
1082 var require_object_keys = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1083 var internalObjectKeys = require_object_keys_internal();
1084 var enumBugKeys = require_enum_bug_keys();
1085 module.exports = Object.keys || function keys(O) {
1086 return internalObjectKeys(O, enumBugKeys);
1087 };
1088 }));
1089
1090 //#endregion
1091 //#region node_modules/core-js/internals/object-define-properties.js
1092 var require_object_define_properties = /* @__PURE__ */ __commonJSMin(((exports) => {
1093 var DESCRIPTORS = require_descriptors();
1094 var V8_PROTOTYPE_DEFINE_BUG = require_v8_prototype_define_bug();
1095 var definePropertyModule = require_object_define_property();
1096 var anObject = require_an_object();
1097 var toIndexedObject = require_to_indexed_object();
1098 var objectKeys = require_object_keys();
1099 exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1100 anObject(O);
1101 var props = toIndexedObject(Properties);
1102 var keys = objectKeys(Properties);
1103 var length = keys.length;
1104 var index = 0;
1105 var key;
1106 while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
1107 return O;
1108 };
1109 }));
1110
1111 //#endregion
1112 //#region node_modules/core-js/internals/html.js
1113 var require_html = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1114 var getBuiltIn = require_get_built_in();
1115 module.exports = getBuiltIn("document", "documentElement");
1116 }));
1117
1118 //#endregion
1119 //#region node_modules/core-js/internals/object-create.js
1120 var require_object_create = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1121 var anObject = require_an_object();
1122 var definePropertiesModule = require_object_define_properties();
1123 var enumBugKeys = require_enum_bug_keys();
1124 var hiddenKeys = require_hidden_keys();
1125 var html = require_html();
1126 var documentCreateElement = require_document_create_element();
1127 var sharedKey = require_shared_key();
1128 var GT = ">";
1129 var LT = "<";
1130 var PROTOTYPE = "prototype";
1131 var SCRIPT = "script";
1132 var IE_PROTO = sharedKey("IE_PROTO");
1133 var EmptyConstructor = function() {};
1134 var scriptTag = function(content) {
1135 return LT + SCRIPT + GT + content + LT + "/" + SCRIPT + GT;
1136 };
1137 var NullProtoObjectViaActiveX = function(activeXDocument) {
1138 activeXDocument.write(scriptTag(""));
1139 activeXDocument.close();
1140 var temp = activeXDocument.parentWindow.Object;
1141 activeXDocument = null;
1142 return temp;
1143 };
1144 var NullProtoObjectViaIFrame = function() {
1145 var iframe = documentCreateElement("iframe");
1146 var JS = "java" + SCRIPT + ":";
1147 var iframeDocument;
1148 iframe.style.display = "none";
1149 html.appendChild(iframe);
1150 iframe.src = String(JS);
1151 iframeDocument = iframe.contentWindow.document;
1152 iframeDocument.open();
1153 iframeDocument.write(scriptTag("document.F=Object"));
1154 iframeDocument.close();
1155 return iframeDocument.F;
1156 };
1157 var activeXDocument;
1158 var NullProtoObject = function() {
1159 try {
1160 activeXDocument = new ActiveXObject("htmlfile");
1161 } catch (error) {}
1162 NullProtoObject = typeof document != "undefined" ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument);
1163 var length = enumBugKeys.length;
1164 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1165 return NullProtoObject();
1166 };
1167 hiddenKeys[IE_PROTO] = true;
1168 module.exports = Object.create || function create(O, Properties) {
1169 var result;
1170 if (O !== null) {
1171 EmptyConstructor[PROTOTYPE] = anObject(O);
1172 result = new EmptyConstructor();
1173 EmptyConstructor[PROTOTYPE] = null;
1174 result[IE_PROTO] = O;
1175 } else result = NullProtoObject();
1176 return Properties === void 0 ? result : definePropertiesModule.f(result, Properties);
1177 };
1178 }));
1179
1180 //#endregion
1181 //#region node_modules/core-js/internals/add-to-unscopables.js
1182 var require_add_to_unscopables = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1183 var wellKnownSymbol = require_well_known_symbol();
1184 var create = require_object_create();
1185 var defineProperty = require_object_define_property().f;
1186 var UNSCOPABLES = wellKnownSymbol("unscopables");
1187 var ArrayPrototype = Array.prototype;
1188 if (ArrayPrototype[UNSCOPABLES] === void 0) defineProperty(ArrayPrototype, UNSCOPABLES, {
1189 configurable: true,
1190 value: create(null)
1191 });
1192 module.exports = function(key) {
1193 ArrayPrototype[UNSCOPABLES][key] = true;
1194 };
1195 }));
1196
1197 //#endregion
1198 //#region node_modules/core-js/modules/es.array.includes.js
1199 var require_es_array_includes = /* @__PURE__ */ __commonJSMin((() => {
1200 var $ = require_export();
1201 var $includes = require_array_includes().includes;
1202 var fails = require_fails();
1203 var addToUnscopables = require_add_to_unscopables();
1204 $({
1205 target: "Array",
1206 proto: true,
1207 forced: fails(function() {
1208 return !Array(1).includes();
1209 })
1210 }, { includes: function includes(el) {
1211 return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0);
1212 } });
1213 addToUnscopables("includes");
1214 }));
1215
1216 //#endregion
1217 //#region node_modules/core-js/internals/is-array.js
1218 var require_is_array = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1219 var classof = require_classof_raw();
1220 module.exports = Array.isArray || function isArray(argument) {
1221 return classof(argument) === "Array";
1222 };
1223 }));
1224
1225 //#endregion
1226 //#region node_modules/core-js/internals/array-set-length.js
1227 var require_array_set_length = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1228 var DESCRIPTORS = require_descriptors();
1229 var isArray = require_is_array();
1230 var $TypeError = TypeError;
1231 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1232 var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function() {
1233 if (this !== void 0) return true;
1234 try {
1235 Object.defineProperty([], "length", { writable: false }).length = 1;
1236 } catch (error) {
1237 return error instanceof TypeError;
1238 }
1239 }();
1240 module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function(O, length) {
1241 if (isArray(O) && !getOwnPropertyDescriptor(O, "length").writable) throw new $TypeError("Cannot set read only .length");
1242 return O.length = length;
1243 } : function(O, length) {
1244 return O.length = length;
1245 };
1246 }));
1247
1248 //#endregion
1249 //#region node_modules/core-js/internals/does-not-exceed-safe-integer.js
1250 var require_does_not_exceed_safe_integer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1251 var $TypeError = TypeError;
1252 var MAX_SAFE_INTEGER = 9007199254740991;
1253 module.exports = function(it) {
1254 if (it > MAX_SAFE_INTEGER) throw $TypeError("Maximum allowed index exceeded");
1255 return it;
1256 };
1257 }));
1258
1259 //#endregion
1260 //#region node_modules/core-js/modules/es.array.push.js
1261 var require_es_array_push = /* @__PURE__ */ __commonJSMin((() => {
1262 var $ = require_export();
1263 var toObject = require_to_object();
1264 var lengthOfArrayLike = require_length_of_array_like();
1265 var setArrayLength = require_array_set_length();
1266 var doesNotExceedSafeInteger = require_does_not_exceed_safe_integer();
1267 var INCORRECT_TO_LENGTH = require_fails()(function() {
1268 return [].push.call({ length: 4294967296 }, 1) !== 4294967297;
1269 });
1270 var properErrorOnNonWritableLength = function() {
1271 try {
1272 Object.defineProperty([], "length", { writable: false }).push();
1273 } catch (error) {
1274 return error instanceof TypeError;
1275 }
1276 };
1277 $({
1278 target: "Array",
1279 proto: true,
1280 arity: 1,
1281 forced: INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength()
1282 }, { push: function push(item) {
1283 var O = toObject(this);
1284 var len = lengthOfArrayLike(O);
1285 var argCount = arguments.length;
1286 doesNotExceedSafeInteger(len + argCount);
1287 for (var i = 0; i < argCount; i++) {
1288 O[len] = arguments[i];
1289 len++;
1290 }
1291 setArrayLength(O, len);
1292 return len;
1293 } });
1294 }));
1295
1296 //#endregion
1297 //#region node_modules/core-js/internals/an-instance.js
1298 var require_an_instance = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1299 var isPrototypeOf = require_object_is_prototype_of();
1300 var $TypeError = TypeError;
1301 module.exports = function(it, Prototype) {
1302 if (isPrototypeOf(Prototype, it)) return it;
1303 throw new $TypeError("Incorrect invocation");
1304 };
1305 }));
1306
1307 //#endregion
1308 //#region node_modules/core-js/internals/correct-prototype-getter.js
1309 var require_correct_prototype_getter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1310 var fails = require_fails();
1311 module.exports = !fails(function() {
1312 function F() {}
1313 F.prototype.constructor = null;
1314 return Object.getPrototypeOf(new F()) !== F.prototype;
1315 });
1316 }));
1317
1318 //#endregion
1319 //#region node_modules/core-js/internals/object-get-prototype-of.js
1320 var require_object_get_prototype_of = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1321 var hasOwn = require_has_own_property();
1322 var isCallable = require_is_callable();
1323 var toObject = require_to_object();
1324 var sharedKey = require_shared_key();
1325 var CORRECT_PROTOTYPE_GETTER = require_correct_prototype_getter();
1326 var IE_PROTO = sharedKey("IE_PROTO");
1327 var $Object = Object;
1328 var ObjectPrototype = $Object.prototype;
1329 module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function(O) {
1330 var object = toObject(O);
1331 if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
1332 var constructor = object.constructor;
1333 if (isCallable(constructor) && object instanceof constructor) return constructor.prototype;
1334 return object instanceof $Object ? ObjectPrototype : null;
1335 };
1336 }));
1337
1338 //#endregion
1339 //#region node_modules/core-js/internals/define-built-in-accessor.js
1340 var require_define_built_in_accessor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1341 var makeBuiltIn = require_make_built_in();
1342 var defineProperty = require_object_define_property();
1343 module.exports = function(target, name, descriptor) {
1344 if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1345 if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1346 return defineProperty.f(target, name, descriptor);
1347 };
1348 }));
1349
1350 //#endregion
1351 //#region node_modules/core-js/internals/create-property.js
1352 var require_create_property = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1353 var DESCRIPTORS = require_descriptors();
1354 var definePropertyModule = require_object_define_property();
1355 var createPropertyDescriptor = require_create_property_descriptor();
1356 module.exports = function(object, key, value) {
1357 if (DESCRIPTORS) definePropertyModule.f(object, key, createPropertyDescriptor(0, value));
1358 else object[key] = value;
1359 };
1360 }));
1361
1362 //#endregion
1363 //#region node_modules/core-js/internals/iterators-core.js
1364 var require_iterators_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1365 var fails = require_fails();
1366 var isCallable = require_is_callable();
1367 var isObject = require_is_object();
1368 var create = require_object_create();
1369 var getPrototypeOf = require_object_get_prototype_of();
1370 var defineBuiltIn = require_define_built_in();
1371 var wellKnownSymbol = require_well_known_symbol();
1372 var IS_PURE = require_is_pure();
1373 var ITERATOR = wellKnownSymbol("iterator");
1374 var BUGGY_SAFARI_ITERATORS = false;
1375 var IteratorPrototype;
1376 var PrototypeOfArrayIteratorPrototype;
1377 var arrayIterator;
1378 if ([].keys) {
1379 arrayIterator = [].keys();
1380 if (!("next" in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
1381 else {
1382 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
1383 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
1384 }
1385 }
1386 if (!isObject(IteratorPrototype) || fails(function() {
1387 var test = {};
1388 return IteratorPrototype[ITERATOR].call(test) !== test;
1389 })) IteratorPrototype = {};
1390 else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
1391 if (!isCallable(IteratorPrototype[ITERATOR])) defineBuiltIn(IteratorPrototype, ITERATOR, function() {
1392 return this;
1393 });
1394 module.exports = {
1395 IteratorPrototype,
1396 BUGGY_SAFARI_ITERATORS
1397 };
1398 }));
1399
1400 //#endregion
1401 //#region node_modules/core-js/modules/es.iterator.constructor.js
1402 var require_es_iterator_constructor = /* @__PURE__ */ __commonJSMin((() => {
1403 var $ = require_export();
1404 var globalThis = require_global_this();
1405 var anInstance = require_an_instance();
1406 var anObject = require_an_object();
1407 var isCallable = require_is_callable();
1408 var getPrototypeOf = require_object_get_prototype_of();
1409 var defineBuiltInAccessor = require_define_built_in_accessor();
1410 var createProperty = require_create_property();
1411 var fails = require_fails();
1412 var hasOwn = require_has_own_property();
1413 var wellKnownSymbol = require_well_known_symbol();
1414 var IteratorPrototype = require_iterators_core().IteratorPrototype;
1415 var DESCRIPTORS = require_descriptors();
1416 var IS_PURE = require_is_pure();
1417 var CONSTRUCTOR = "constructor";
1418 var ITERATOR = "Iterator";
1419 var TO_STRING_TAG = wellKnownSymbol("toStringTag");
1420 var $TypeError = TypeError;
1421 var NativeIterator = globalThis[ITERATOR];
1422 var FORCED = IS_PURE || !isCallable(NativeIterator) || NativeIterator.prototype !== IteratorPrototype || !fails(function() {
1423 NativeIterator({});
1424 });
1425 var IteratorConstructor = function Iterator() {
1426 anInstance(this, IteratorPrototype);
1427 if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError("Abstract class Iterator not directly constructable");
1428 };
1429 var defineIteratorPrototypeAccessor = function(key, value) {
1430 if (DESCRIPTORS) defineBuiltInAccessor(IteratorPrototype, key, {
1431 configurable: true,
1432 get: function() {
1433 return value;
1434 },
1435 set: function(replacement) {
1436 anObject(this);
1437 if (this === IteratorPrototype) throw new $TypeError("You can't redefine this property");
1438 if (hasOwn(this, key)) this[key] = replacement;
1439 else createProperty(this, key, replacement);
1440 }
1441 });
1442 else IteratorPrototype[key] = value;
1443 };
1444 if (!hasOwn(IteratorPrototype, TO_STRING_TAG)) defineIteratorPrototypeAccessor(TO_STRING_TAG, ITERATOR);
1445 if (FORCED || !hasOwn(IteratorPrototype, CONSTRUCTOR) || IteratorPrototype[CONSTRUCTOR] === Object) defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);
1446 IteratorConstructor.prototype = IteratorPrototype;
1447 $({
1448 global: true,
1449 constructor: true,
1450 forced: FORCED
1451 }, { Iterator: IteratorConstructor });
1452 }));
1453
1454 //#endregion
1455 //#region node_modules/core-js/modules/esnext.iterator.constructor.js
1456 var require_esnext_iterator_constructor = /* @__PURE__ */ __commonJSMin((() => {
1457 require_es_iterator_constructor();
1458 }));
1459
1460 //#endregion
1461 //#region node_modules/core-js/internals/function-uncurry-this-clause.js
1462 var require_function_uncurry_this_clause = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1463 var classofRaw = require_classof_raw();
1464 var uncurryThis = require_function_uncurry_this();
1465 module.exports = function(fn) {
1466 if (classofRaw(fn) === "Function") return uncurryThis(fn);
1467 };
1468 }));
1469
1470 //#endregion
1471 //#region node_modules/core-js/internals/function-bind-context.js
1472 var require_function_bind_context = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1473 var uncurryThis = require_function_uncurry_this_clause();
1474 var aCallable = require_a_callable();
1475 var NATIVE_BIND = require_function_bind_native();
1476 var bind = uncurryThis(uncurryThis.bind);
1477 module.exports = function(fn, that) {
1478 aCallable(fn);
1479 return that === void 0 ? fn : NATIVE_BIND ? bind(fn, that) : function() {
1480 return fn.apply(that, arguments);
1481 };
1482 };
1483 }));
1484
1485 //#endregion
1486 //#region node_modules/core-js/internals/iterators.js
1487 var require_iterators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1488 module.exports = {};
1489 }));
1490
1491 //#endregion
1492 //#region node_modules/core-js/internals/is-array-iterator-method.js
1493 var require_is_array_iterator_method = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1494 var wellKnownSymbol = require_well_known_symbol();
1495 var Iterators = require_iterators();
1496 var ITERATOR = wellKnownSymbol("iterator");
1497 var ArrayPrototype = Array.prototype;
1498 module.exports = function(it) {
1499 return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
1500 };
1501 }));
1502
1503 //#endregion
1504 //#region node_modules/core-js/internals/to-string-tag-support.js
1505 var require_to_string_tag_support = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1506 var TO_STRING_TAG = require_well_known_symbol()("toStringTag");
1507 var test = {};
1508 test[TO_STRING_TAG] = "z";
1509 module.exports = String(test) === "[object z]";
1510 }));
1511
1512 //#endregion
1513 //#region node_modules/core-js/internals/classof.js
1514 var require_classof = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1515 var TO_STRING_TAG_SUPPORT = require_to_string_tag_support();
1516 var isCallable = require_is_callable();
1517 var classofRaw = require_classof_raw();
1518 var TO_STRING_TAG = require_well_known_symbol()("toStringTag");
1519 var $Object = Object;
1520 var CORRECT_ARGUMENTS = classofRaw(function() {
1521 return arguments;
1522 }()) === "Arguments";
1523 var tryGet = function(it, key) {
1524 try {
1525 return it[key];
1526 } catch (error) {}
1527 };
1528 module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
1529 var O;
1530 var tag;
1531 var result;
1532 return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) === "Object" && isCallable(O.callee) ? "Arguments" : result;
1533 };
1534 }));
1535
1536 //#endregion
1537 //#region node_modules/core-js/internals/get-iterator-method.js
1538 var require_get_iterator_method = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1539 var classof = require_classof();
1540 var getMethod = require_get_method();
1541 var isNullOrUndefined = require_is_null_or_undefined();
1542 var Iterators = require_iterators();
1543 var ITERATOR = require_well_known_symbol()("iterator");
1544 module.exports = function(it) {
1545 if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR) || getMethod(it, "@@iterator") || Iterators[classof(it)];
1546 };
1547 }));
1548
1549 //#endregion
1550 //#region node_modules/core-js/internals/get-iterator.js
1551 var require_get_iterator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1552 var call = require_function_call();
1553 var aCallable = require_a_callable();
1554 var anObject = require_an_object();
1555 var tryToString = require_try_to_string();
1556 var getIteratorMethod = require_get_iterator_method();
1557 var $TypeError = TypeError;
1558 module.exports = function(argument, usingIterator) {
1559 var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
1560 if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
1561 throw new $TypeError(tryToString(argument) + " is not iterable");
1562 };
1563 }));
1564
1565 //#endregion
1566 //#region node_modules/core-js/internals/iterator-close.js
1567 var require_iterator_close = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1568 var call = require_function_call();
1569 var anObject = require_an_object();
1570 var getMethod = require_get_method();
1571 module.exports = function(iterator, kind, value) {
1572 var innerResult;
1573 var innerError;
1574 anObject(iterator);
1575 try {
1576 innerResult = getMethod(iterator, "return");
1577 if (!innerResult) {
1578 if (kind === "throw") throw value;
1579 return value;
1580 }
1581 innerResult = call(innerResult, iterator);
1582 } catch (error) {
1583 innerError = true;
1584 innerResult = error;
1585 }
1586 if (kind === "throw") throw value;
1587 if (innerError) throw innerResult;
1588 anObject(innerResult);
1589 return value;
1590 };
1591 }));
1592
1593 //#endregion
1594 //#region node_modules/core-js/internals/iterate.js
1595 var require_iterate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1596 var bind = require_function_bind_context();
1597 var call = require_function_call();
1598 var anObject = require_an_object();
1599 var tryToString = require_try_to_string();
1600 var isArrayIteratorMethod = require_is_array_iterator_method();
1601 var lengthOfArrayLike = require_length_of_array_like();
1602 var isPrototypeOf = require_object_is_prototype_of();
1603 var getIterator = require_get_iterator();
1604 var getIteratorMethod = require_get_iterator_method();
1605 var iteratorClose = require_iterator_close();
1606 var $TypeError = TypeError;
1607 var Result = function(stopped, result) {
1608 this.stopped = stopped;
1609 this.result = result;
1610 };
1611 var ResultPrototype = Result.prototype;
1612 module.exports = function(iterable, unboundFunction, options) {
1613 var that = options && options.that;
1614 var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1615 var IS_RECORD = !!(options && options.IS_RECORD);
1616 var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1617 var INTERRUPTED = !!(options && options.INTERRUPTED);
1618 var fn = bind(unboundFunction, that);
1619 var iterator;
1620 var iterFn;
1621 var index;
1622 var length;
1623 var result;
1624 var next;
1625 var step;
1626 var stop = function(condition) {
1627 if (iterator) iteratorClose(iterator, "normal");
1628 return new Result(true, condition);
1629 };
1630 var callFn = function(value) {
1631 if (AS_ENTRIES) {
1632 anObject(value);
1633 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1634 }
1635 return INTERRUPTED ? fn(value, stop) : fn(value);
1636 };
1637 if (IS_RECORD) iterator = iterable.iterator;
1638 else if (IS_ITERATOR) iterator = iterable;
1639 else {
1640 iterFn = getIteratorMethod(iterable);
1641 if (!iterFn) throw new $TypeError(tryToString(iterable) + " is not iterable");
1642 if (isArrayIteratorMethod(iterFn)) {
1643 for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
1644 result = callFn(iterable[index]);
1645 if (result && isPrototypeOf(ResultPrototype, result)) return result;
1646 }
1647 return new Result(false);
1648 }
1649 iterator = getIterator(iterable, iterFn);
1650 }
1651 next = IS_RECORD ? iterable.next : iterator.next;
1652 while (!(step = call(next, iterator)).done) {
1653 try {
1654 result = callFn(step.value);
1655 } catch (error) {
1656 iteratorClose(iterator, "throw", error);
1657 }
1658 if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result)) return result;
1659 }
1660 return new Result(false);
1661 };
1662 }));
1663
1664 //#endregion
1665 //#region node_modules/core-js/internals/get-iterator-direct.js
1666 var require_get_iterator_direct = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1667 module.exports = function(obj) {
1668 return {
1669 iterator: obj,
1670 next: obj.next,
1671 done: false
1672 };
1673 };
1674 }));
1675
1676 //#endregion
1677 //#region node_modules/core-js/internals/iterator-helper-without-closing-on-early-error.js
1678 var require_iterator_helper_without_closing_on_early_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1679 var globalThis = require_global_this();
1680 module.exports = function(METHOD_NAME, ExpectedError) {
1681 var Iterator = globalThis.Iterator;
1682 var IteratorPrototype = Iterator && Iterator.prototype;
1683 var method = IteratorPrototype && IteratorPrototype[METHOD_NAME];
1684 var CLOSED = false;
1685 if (method) try {
1686 method.call({
1687 next: function() {
1688 return { done: true };
1689 },
1690 "return": function() {
1691 CLOSED = true;
1692 }
1693 }, -1);
1694 } catch (error) {
1695 if (!(error instanceof ExpectedError)) CLOSED = false;
1696 }
1697 if (!CLOSED) return method;
1698 };
1699 }));
1700
1701 //#endregion
1702 //#region node_modules/core-js/modules/es.iterator.every.js
1703 var require_es_iterator_every = /* @__PURE__ */ __commonJSMin((() => {
1704 var $ = require_export();
1705 var call = require_function_call();
1706 var iterate = require_iterate();
1707 var aCallable = require_a_callable();
1708 var anObject = require_an_object();
1709 var getIteratorDirect = require_get_iterator_direct();
1710 var iteratorClose = require_iterator_close();
1711 var everyWithoutClosingOnEarlyError = require_iterator_helper_without_closing_on_early_error()("every", TypeError);
1712 $({
1713 target: "Iterator",
1714 proto: true,
1715 real: true,
1716 forced: everyWithoutClosingOnEarlyError
1717 }, { every: function every(predicate) {
1718 anObject(this);
1719 try {
1720 aCallable(predicate);
1721 } catch (error) {
1722 iteratorClose(this, "throw", error);
1723 }
1724 if (everyWithoutClosingOnEarlyError) return call(everyWithoutClosingOnEarlyError, this, predicate);
1725 var record = getIteratorDirect(this);
1726 var counter = 0;
1727 return !iterate(record, function(value, stop) {
1728 if (!predicate(value, counter++)) return stop();
1729 }, {
1730 IS_RECORD: true,
1731 INTERRUPTED: true
1732 }).stopped;
1733 } });
1734 }));
1735
1736 //#endregion
1737 //#region node_modules/core-js/modules/esnext.iterator.every.js
1738 var require_esnext_iterator_every = /* @__PURE__ */ __commonJSMin((() => {
1739 require_es_iterator_every();
1740 }));
1741
1742 //#endregion
1743 //#region node_modules/core-js/internals/define-built-ins.js
1744 var require_define_built_ins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1745 var defineBuiltIn = require_define_built_in();
1746 module.exports = function(target, src, options) {
1747 for (var key in src) defineBuiltIn(target, key, src[key], options);
1748 return target;
1749 };
1750 }));
1751
1752 //#endregion
1753 //#region node_modules/core-js/internals/create-iter-result-object.js
1754 var require_create_iter_result_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1755 module.exports = function(value, done) {
1756 return {
1757 value,
1758 done
1759 };
1760 };
1761 }));
1762
1763 //#endregion
1764 //#region node_modules/core-js/internals/iterator-close-all.js
1765 var require_iterator_close_all = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1766 var iteratorClose = require_iterator_close();
1767 module.exports = function(iters, kind, value) {
1768 for (var i = iters.length - 1; i >= 0; i--) {
1769 if (iters[i] === void 0) continue;
1770 try {
1771 value = iteratorClose(iters[i].iterator, kind, value);
1772 } catch (error) {
1773 kind = "throw";
1774 value = error;
1775 }
1776 }
1777 if (kind === "throw") throw value;
1778 return value;
1779 };
1780 }));
1781
1782 //#endregion
1783 //#region node_modules/core-js/internals/iterator-create-proxy.js
1784 var require_iterator_create_proxy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1785 var call = require_function_call();
1786 var create = require_object_create();
1787 var createNonEnumerableProperty = require_create_non_enumerable_property();
1788 var defineBuiltIns = require_define_built_ins();
1789 var wellKnownSymbol = require_well_known_symbol();
1790 var InternalStateModule = require_internal_state();
1791 var getMethod = require_get_method();
1792 var IteratorPrototype = require_iterators_core().IteratorPrototype;
1793 var createIterResultObject = require_create_iter_result_object();
1794 var iteratorClose = require_iterator_close();
1795 var iteratorCloseAll = require_iterator_close_all();
1796 var TO_STRING_TAG = wellKnownSymbol("toStringTag");
1797 var ITERATOR_HELPER = "IteratorHelper";
1798 var WRAP_FOR_VALID_ITERATOR = "WrapForValidIterator";
1799 var NORMAL = "normal";
1800 var THROW = "throw";
1801 var setInternalState = InternalStateModule.set;
1802 var createIteratorProxyPrototype = function(IS_ITERATOR) {
1803 var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);
1804 return defineBuiltIns(create(IteratorPrototype), {
1805 next: function next() {
1806 var state = getInternalState(this);
1807 if (IS_ITERATOR) return state.nextHandler();
1808 if (state.done) return createIterResultObject(void 0, true);
1809 try {
1810 var result = state.nextHandler();
1811 return state.returnHandlerResult ? result : createIterResultObject(result, state.done);
1812 } catch (error) {
1813 state.done = true;
1814 throw error;
1815 }
1816 },
1817 "return": function() {
1818 var state = getInternalState(this);
1819 var iterator = state.iterator;
1820 state.done = true;
1821 if (IS_ITERATOR) {
1822 var returnMethod = getMethod(iterator, "return");
1823 return returnMethod ? call(returnMethod, iterator) : createIterResultObject(void 0, true);
1824 }
1825 if (state.inner) try {
1826 iteratorClose(state.inner.iterator, NORMAL);
1827 } catch (error) {
1828 return iteratorClose(iterator, THROW, error);
1829 }
1830 if (state.openIters) try {
1831 iteratorCloseAll(state.openIters, NORMAL);
1832 } catch (error) {
1833 return iteratorClose(iterator, THROW, error);
1834 }
1835 if (iterator) iteratorClose(iterator, NORMAL);
1836 return createIterResultObject(void 0, true);
1837 }
1838 });
1839 };
1840 var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);
1841 var IteratorHelperPrototype = createIteratorProxyPrototype(false);
1842 createNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, "Iterator Helper");
1843 module.exports = function(nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) {
1844 var IteratorProxy = function Iterator(record, state) {
1845 if (state) {
1846 state.iterator = record.iterator;
1847 state.next = record.next;
1848 } else state = record;
1849 state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
1850 state.returnHandlerResult = !!RETURN_HANDLER_RESULT;
1851 state.nextHandler = nextHandler;
1852 state.counter = 0;
1853 state.done = false;
1854 setInternalState(this, state);
1855 };
1856 IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;
1857 return IteratorProxy;
1858 };
1859 }));
1860
1861 //#endregion
1862 //#region node_modules/core-js/internals/call-with-safe-iteration-closing.js
1863 var require_call_with_safe_iteration_closing = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1864 var anObject = require_an_object();
1865 var iteratorClose = require_iterator_close();
1866 module.exports = function(iterator, fn, value, ENTRIES) {
1867 try {
1868 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
1869 } catch (error) {
1870 iteratorClose(iterator, "throw", error);
1871 }
1872 };
1873 }));
1874
1875 //#endregion
1876 //#region node_modules/core-js/internals/iterator-helper-throws-on-invalid-iterator.js
1877 var require_iterator_helper_throws_on_invalid_iterator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1878 module.exports = function(methodName, argument) {
1879 var method = typeof Iterator == "function" && Iterator.prototype[methodName];
1880 if (method) try {
1881 method.call({ next: null }, argument).next();
1882 } catch (error) {
1883 return true;
1884 }
1885 };
1886 }));
1887
1888 //#endregion
1889 //#region node_modules/core-js/modules/es.iterator.filter.js
1890 var require_es_iterator_filter = /* @__PURE__ */ __commonJSMin((() => {
1891 var $ = require_export();
1892 var call = require_function_call();
1893 var aCallable = require_a_callable();
1894 var anObject = require_an_object();
1895 var getIteratorDirect = require_get_iterator_direct();
1896 var createIteratorProxy = require_iterator_create_proxy();
1897 var callWithSafeIterationClosing = require_call_with_safe_iteration_closing();
1898 var IS_PURE = require_is_pure();
1899 var iteratorClose = require_iterator_close();
1900 var iteratorHelperThrowsOnInvalidIterator = require_iterator_helper_throws_on_invalid_iterator();
1901 var iteratorHelperWithoutClosingOnEarlyError = require_iterator_helper_without_closing_on_early_error();
1902 var FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator("filter", function() {});
1903 var filterWithoutClosingOnEarlyError = !IS_PURE && !FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR && iteratorHelperWithoutClosingOnEarlyError("filter", TypeError);
1904 var FORCED = IS_PURE || FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR || filterWithoutClosingOnEarlyError;
1905 var IteratorProxy = createIteratorProxy(function() {
1906 var iterator = this.iterator;
1907 var predicate = this.predicate;
1908 var next = this.next;
1909 var result;
1910 var done;
1911 var value;
1912 while (true) {
1913 result = anObject(call(next, iterator));
1914 done = this.done = !!result.done;
1915 if (done) return;
1916 value = result.value;
1917 if (callWithSafeIterationClosing(iterator, predicate, [value, this.counter++], true)) return value;
1918 }
1919 });
1920 $({
1921 target: "Iterator",
1922 proto: true,
1923 real: true,
1924 forced: FORCED
1925 }, { filter: function filter(predicate) {
1926 anObject(this);
1927 try {
1928 aCallable(predicate);
1929 } catch (error) {
1930 iteratorClose(this, "throw", error);
1931 }
1932 if (filterWithoutClosingOnEarlyError) return call(filterWithoutClosingOnEarlyError, this, predicate);
1933 return new IteratorProxy(getIteratorDirect(this), { predicate });
1934 } });
1935 }));
1936
1937 //#endregion
1938 //#region node_modules/core-js/modules/esnext.iterator.filter.js
1939 var require_esnext_iterator_filter = /* @__PURE__ */ __commonJSMin((() => {
1940 require_es_iterator_filter();
1941 }));
1942
1943 //#endregion
1944 //#region node_modules/core-js/modules/es.iterator.for-each.js
1945 var require_es_iterator_for_each = /* @__PURE__ */ __commonJSMin((() => {
1946 var $ = require_export();
1947 var call = require_function_call();
1948 var iterate = require_iterate();
1949 var aCallable = require_a_callable();
1950 var anObject = require_an_object();
1951 var getIteratorDirect = require_get_iterator_direct();
1952 var iteratorClose = require_iterator_close();
1953 var forEachWithoutClosingOnEarlyError = require_iterator_helper_without_closing_on_early_error()("forEach", TypeError);
1954 $({
1955 target: "Iterator",
1956 proto: true,
1957 real: true,
1958 forced: forEachWithoutClosingOnEarlyError
1959 }, { forEach: function forEach(fn) {
1960 anObject(this);
1961 try {
1962 aCallable(fn);
1963 } catch (error) {
1964 iteratorClose(this, "throw", error);
1965 }
1966 if (forEachWithoutClosingOnEarlyError) return call(forEachWithoutClosingOnEarlyError, this, fn);
1967 var record = getIteratorDirect(this);
1968 var counter = 0;
1969 iterate(record, function(value) {
1970 fn(value, counter++);
1971 }, { IS_RECORD: true });
1972 } });
1973 }));
1974
1975 //#endregion
1976 //#region node_modules/core-js/modules/esnext.iterator.for-each.js
1977 var require_esnext_iterator_for_each = /* @__PURE__ */ __commonJSMin((() => {
1978 require_es_iterator_for_each();
1979 }));
1980
1981 //#endregion
1982 //#region node_modules/core-js/modules/es.iterator.map.js
1983 var require_es_iterator_map = /* @__PURE__ */ __commonJSMin((() => {
1984 var $ = require_export();
1985 var call = require_function_call();
1986 var aCallable = require_a_callable();
1987 var anObject = require_an_object();
1988 var getIteratorDirect = require_get_iterator_direct();
1989 var createIteratorProxy = require_iterator_create_proxy();
1990 var callWithSafeIterationClosing = require_call_with_safe_iteration_closing();
1991 var iteratorClose = require_iterator_close();
1992 var iteratorHelperThrowsOnInvalidIterator = require_iterator_helper_throws_on_invalid_iterator();
1993 var iteratorHelperWithoutClosingOnEarlyError = require_iterator_helper_without_closing_on_early_error();
1994 var IS_PURE = require_is_pure();
1995 var MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator("map", function() {});
1996 var mapWithoutClosingOnEarlyError = !IS_PURE && !MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR && iteratorHelperWithoutClosingOnEarlyError("map", TypeError);
1997 var FORCED = IS_PURE || MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || mapWithoutClosingOnEarlyError;
1998 var IteratorProxy = createIteratorProxy(function() {
1999 var iterator = this.iterator;
2000 var result = anObject(call(this.next, iterator));
2001 if (!(this.done = !!result.done)) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);
2002 });
2003 $({
2004 target: "Iterator",
2005 proto: true,
2006 real: true,
2007 forced: FORCED
2008 }, { map: function map(mapper) {
2009 anObject(this);
2010 try {
2011 aCallable(mapper);
2012 } catch (error) {
2013 iteratorClose(this, "throw", error);
2014 }
2015 if (mapWithoutClosingOnEarlyError) return call(mapWithoutClosingOnEarlyError, this, mapper);
2016 return new IteratorProxy(getIteratorDirect(this), { mapper });
2017 } });
2018 }));
2019
2020 //#endregion
2021 //#region node_modules/core-js/modules/esnext.iterator.map.js
2022 var require_esnext_iterator_map = /* @__PURE__ */ __commonJSMin((() => {
2023 require_es_iterator_map();
2024 }));
2025
2026 //#endregion
2027 //#region modules/atomic-widgets/assets/js/frontend/utils.js
2028 var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
2029 Object.defineProperty(exports, "__esModule", { value: true });
2030 exports.WHITELIST_FILTER = exports.REGISTRATION_SELECTOR = exports.LINK_ACTIONS_EDITOR_WHITELIST = exports.ATOMIC_FORM_SELECTOR = exports.ATOMIC_FORM_FIELD_SELECTOR = exports.ACTION_LINK_SELECTOR = void 0;
2031 exports.getAlpineId = getAlpineId;
2032 exports.getPostId = getPostId;
2033 exports.isEditorContext = isEditorContext;
2034 exports.ATOMIC_FORM_SELECTOR = "[data-element_type=\"e-form\"]";
2035 exports.ATOMIC_FORM_FIELD_SELECTOR = "input[data-interaction-id], textarea[data-interaction-id], select[data-interaction-id]";
2036 exports.LINK_ACTIONS_EDITOR_WHITELIST = ["off_canvas", "lightbox"];
2037 exports.WHITELIST_FILTER = "frontend/handlers/atomic-widgets/link-actions-whitelist";
2038 var ACTION_LINK_SELECTOR = exports.ACTION_LINK_SELECTOR = "[data-action-link]";
2039 exports.REGISTRATION_SELECTOR = `${ACTION_LINK_SELECTOR}, :has(> ${ACTION_LINK_SELECTOR})`;
2040 var ELEMENTOR_DOCUMENT_SELECTOR = "[data-elementor-id]";
2041 function isEditorContext() {
2042 var _window$parent;
2043 return !!window.elementor || !!((_window$parent = window.parent) === null || _window$parent === void 0 ? void 0 : _window$parent.elementor);
2044 }
2045 function getPostId(element) {
2046 var _element$closest;
2047 var _elementorFrontend;
2048 const innerDocumentId = element === null || element === void 0 || (_element$closest = element.closest) === null || _element$closest === void 0 || (_element$closest = _element$closest.call(element, ELEMENTOR_DOCUMENT_SELECTOR)) === null || _element$closest === void 0 || (_element$closest = _element$closest.dataset) === null || _element$closest === void 0 ? void 0 : _element$closest.elementorId;
2049 const ownerDocument = (_elementorFrontend = elementorFrontend) === null || _elementorFrontend === void 0 || (_elementorFrontend = _elementorFrontend.config) === null || _elementorFrontend === void 0 || (_elementorFrontend = _elementorFrontend.post) === null || _elementorFrontend === void 0 ? void 0 : _elementorFrontend.id;
2050 return innerDocumentId || ownerDocument || null;
2051 }
2052 function getAlpineId(element) {
2053 return element.getAttribute("x-data");
2054 }
2055 }));
2056
2057 //#endregion
2058 //#region node_modules/lodash/lodash.js
2059 var require_lodash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2060 /**
2061 * @license
2062 * Lodash <https://lodash.com/>
2063 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
2064 * Released under MIT license <https://lodash.com/license>
2065 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
2066 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
2067 */
2068 (function() {
2069 /** Used as a safe reference for `undefined` in pre-ES5 environments. */
2070 var undefined;
2071 /** Used as the semantic version number. */
2072 var VERSION = "4.18.1";
2073 /** Used as the size to enable large array optimizations. */
2074 var LARGE_ARRAY_SIZE = 200;
2075 /** Error message constants. */
2076 var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
2077 var FUNC_ERROR_TEXT = "Expected a function";
2078 var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
2079 var INVALID_TEMPL_IMPORTS_ERROR_TEXT = "Invalid `imports` option passed into `_.template`";
2080 /** Used to stand-in for `undefined` hash values. */
2081 var HASH_UNDEFINED = "__lodash_hash_undefined__";
2082 /** Used as the maximum memoize cache size. */
2083 var MAX_MEMOIZE_SIZE = 500;
2084 /** Used as the internal argument placeholder. */
2085 var PLACEHOLDER = "__lodash_placeholder__";
2086 /** Used to compose bitmasks for cloning. */
2087 var CLONE_DEEP_FLAG = 1;
2088 var CLONE_FLAT_FLAG = 2;
2089 var CLONE_SYMBOLS_FLAG = 4;
2090 /** Used to compose bitmasks for value comparisons. */
2091 var COMPARE_PARTIAL_FLAG = 1;
2092 var COMPARE_UNORDERED_FLAG = 2;
2093 /** Used to compose bitmasks for function metadata. */
2094 var WRAP_BIND_FLAG = 1;
2095 var WRAP_BIND_KEY_FLAG = 2;
2096 var WRAP_CURRY_BOUND_FLAG = 4;
2097 var WRAP_CURRY_FLAG = 8;
2098 var WRAP_CURRY_RIGHT_FLAG = 16;
2099 var WRAP_PARTIAL_FLAG = 32;
2100 var WRAP_PARTIAL_RIGHT_FLAG = 64;
2101 var WRAP_ARY_FLAG = 128;
2102 var WRAP_REARG_FLAG = 256;
2103 var WRAP_FLIP_FLAG = 512;
2104 /** Used as default options for `_.truncate`. */
2105 var DEFAULT_TRUNC_LENGTH = 30;
2106 var DEFAULT_TRUNC_OMISSION = "...";
2107 /** Used to detect hot functions by number of calls within a span of milliseconds. */
2108 var HOT_COUNT = 800;
2109 var HOT_SPAN = 16;
2110 /** Used to indicate the type of lazy iteratees. */
2111 var LAZY_FILTER_FLAG = 1;
2112 var LAZY_MAP_FLAG = 2;
2113 var LAZY_WHILE_FLAG = 3;
2114 /** Used as references for various `Number` constants. */
2115 var INFINITY = Infinity;
2116 var MAX_SAFE_INTEGER = 9007199254740991;
2117 var MAX_INTEGER = 17976931348623157e292;
2118 var NAN = NaN;
2119 /** Used as references for the maximum length and index of an array. */
2120 var MAX_ARRAY_LENGTH = 4294967295;
2121 var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
2122 var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
2123 /** Used to associate wrap methods with their bit flags. */
2124 var wrapFlags = [
2125 ["ary", WRAP_ARY_FLAG],
2126 ["bind", WRAP_BIND_FLAG],
2127 ["bindKey", WRAP_BIND_KEY_FLAG],
2128 ["curry", WRAP_CURRY_FLAG],
2129 ["curryRight", WRAP_CURRY_RIGHT_FLAG],
2130 ["flip", WRAP_FLIP_FLAG],
2131 ["partial", WRAP_PARTIAL_FLAG],
2132 ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
2133 ["rearg", WRAP_REARG_FLAG]
2134 ];
2135 /** `Object#toString` result references. */
2136 var argsTag = "[object Arguments]";
2137 var arrayTag = "[object Array]";
2138 var asyncTag = "[object AsyncFunction]";
2139 var boolTag = "[object Boolean]";
2140 var dateTag = "[object Date]";
2141 var domExcTag = "[object DOMException]";
2142 var errorTag = "[object Error]";
2143 var funcTag = "[object Function]";
2144 var genTag = "[object GeneratorFunction]";
2145 var mapTag = "[object Map]";
2146 var numberTag = "[object Number]";
2147 var nullTag = "[object Null]";
2148 var objectTag = "[object Object]";
2149 var promiseTag = "[object Promise]";
2150 var proxyTag = "[object Proxy]";
2151 var regexpTag = "[object RegExp]";
2152 var setTag = "[object Set]";
2153 var stringTag = "[object String]";
2154 var symbolTag = "[object Symbol]";
2155 var undefinedTag = "[object Undefined]";
2156 var weakMapTag = "[object WeakMap]";
2157 var weakSetTag = "[object WeakSet]";
2158 var arrayBufferTag = "[object ArrayBuffer]";
2159 var dataViewTag = "[object DataView]";
2160 var float32Tag = "[object Float32Array]";
2161 var float64Tag = "[object Float64Array]";
2162 var int8Tag = "[object Int8Array]";
2163 var int16Tag = "[object Int16Array]";
2164 var int32Tag = "[object Int32Array]";
2165 var uint8Tag = "[object Uint8Array]";
2166 var uint8ClampedTag = "[object Uint8ClampedArray]";
2167 var uint16Tag = "[object Uint16Array]";
2168 var uint32Tag = "[object Uint32Array]";
2169 /** Used to match empty string literals in compiled template source. */
2170 var reEmptyStringLeading = /\b__p \+= '';/g;
2171 var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
2172 var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
2173 /** Used to match HTML entities and HTML characters. */
2174 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
2175 var reUnescapedHtml = /[&<>"']/g;
2176 var reHasEscapedHtml = RegExp(reEscapedHtml.source);
2177 var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
2178 /** Used to match template delimiters. */
2179 var reEscape = /<%-([\s\S]+?)%>/g;
2180 var reEvaluate = /<%([\s\S]+?)%>/g;
2181 var reInterpolate = /<%=([\s\S]+?)%>/g;
2182 /** Used to match property names within property paths. */
2183 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
2184 var reIsPlainProp = /^\w*$/;
2185 var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
2186 /**
2187 * Used to match `RegExp`
2188 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
2189 */
2190 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
2191 var reHasRegExpChar = RegExp(reRegExpChar.source);
2192 /** Used to match leading whitespace. */
2193 var reTrimStart = /^\s+/;
2194 /** Used to match a single whitespace character. */
2195 var reWhitespace = /\s/;
2196 /** Used to match wrap detail comments. */
2197 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
2198 var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
2199 var reSplitDetails = /,? & /;
2200 /** Used to match words composed of alphanumeric characters. */
2201 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
2202 /**
2203 * Used to validate the `validate` option in `_.template` variable.
2204 *
2205 * Forbids characters which could potentially change the meaning of the function argument definition:
2206 * - "()," (modification of function parameters)
2207 * - "=" (default value)
2208 * - "[]{}" (destructuring of function parameters)
2209 * - "/" (beginning of a comment)
2210 * - whitespace
2211 */
2212 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
2213 /** Used to match backslashes in property paths. */
2214 var reEscapeChar = /\\(\\)?/g;
2215 /**
2216 * Used to match
2217 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
2218 */
2219 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
2220 /** Used to match `RegExp` flags from their coerced string values. */
2221 var reFlags = /\w*$/;
2222 /** Used to detect bad signed hexadecimal string values. */
2223 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
2224 /** Used to detect binary string values. */
2225 var reIsBinary = /^0b[01]+$/i;
2226 /** Used to detect host constructors (Safari). */
2227 var reIsHostCtor = /^\[object .+?Constructor\]$/;
2228 /** Used to detect octal string values. */
2229 var reIsOctal = /^0o[0-7]+$/i;
2230 /** Used to detect unsigned integer values. */
2231 var reIsUint = /^(?:0|[1-9]\d*)$/;
2232 /** Used to match Latin Unicode letters (excluding mathematical operators). */
2233 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
2234 /** Used to ensure capturing order of template delimiters. */
2235 var reNoMatch = /($^)/;
2236 /** Used to match unescaped characters in compiled string literals. */
2237 var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
2238 /** Used to compose unicode character classes. */
2239 var rsAstralRange = "\\ud800-\\udfff";
2240 var rsComboRange = "\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff";
2241 var rsDingbatRange = "\\u2700-\\u27bf";
2242 var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
2243 var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
2244 var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
2245 var rsPunctuationRange = "\\u2000-\\u206f";
2246 var 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";
2247 var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
2248 var rsVarRange = "\\ufe0e\\ufe0f";
2249 var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
2250 /** Used to compose unicode capture groups. */
2251 var rsApos = "['’]";
2252 var rsAstral = "[" + rsAstralRange + "]";
2253 var rsBreak = "[" + rsBreakRange + "]";
2254 var rsCombo = "[" + rsComboRange + "]";
2255 var rsDigits = "\\d+";
2256 var rsDingbat = "[" + rsDingbatRange + "]";
2257 var rsLower = "[" + rsLowerRange + "]";
2258 var rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
2259 var rsFitz = "\\ud83c[\\udffb-\\udfff]";
2260 var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
2261 var rsNonAstral = "[^" + rsAstralRange + "]";
2262 var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
2263 var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
2264 var rsUpper = "[" + rsUpperRange + "]";
2265 var rsZWJ = "\\u200d";
2266 /** Used to compose unicode regexes. */
2267 var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
2268 var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
2269 var rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
2270 var rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
2271 var reOptMod = rsModifier + "?";
2272 var rsOptVar = "[" + rsVarRange + "]?";
2273 var rsOptJoin = "(?:" + rsZWJ + "(?:" + [
2274 rsNonAstral,
2275 rsRegional,
2276 rsSurrPair
2277 ].join("|") + ")" + rsOptVar + reOptMod + ")*";
2278 var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
2279 var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
2280 var rsSeq = rsOptVar + reOptMod + rsOptJoin;
2281 var rsEmoji = "(?:" + [
2282 rsDingbat,
2283 rsRegional,
2284 rsSurrPair
2285 ].join("|") + ")" + rsSeq;
2286 var rsSymbol = "(?:" + [
2287 rsNonAstral + rsCombo + "?",
2288 rsCombo,
2289 rsRegional,
2290 rsSurrPair,
2291 rsAstral
2292 ].join("|") + ")";
2293 /** Used to match apostrophes. */
2294 var reApos = RegExp(rsApos, "g");
2295 /**
2296 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
2297 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
2298 */
2299 var reComboMark = RegExp(rsCombo, "g");
2300 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
2301 var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
2302 /** Used to match complex or compound words. */
2303 var reUnicodeWord = RegExp([
2304 rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [
2305 rsBreak,
2306 rsUpper,
2307 "$"
2308 ].join("|") + ")",
2309 rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [
2310 rsBreak,
2311 rsUpper + rsMiscLower,
2312 "$"
2313 ].join("|") + ")",
2314 rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
2315 rsUpper + "+" + rsOptContrUpper,
2316 rsOrdUpper,
2317 rsOrdLower,
2318 rsDigits,
2319 rsEmoji
2320 ].join("|"), "g");
2321 /** 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/). */
2322 var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
2323 /** Used to detect strings that need a more robust regexp to match words. */
2324 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 ]/;
2325 /** Used to assign default `context` object properties. */
2326 var contextProps = [
2327 "Array",
2328 "Buffer",
2329 "DataView",
2330 "Date",
2331 "Error",
2332 "Float32Array",
2333 "Float64Array",
2334 "Function",
2335 "Int8Array",
2336 "Int16Array",
2337 "Int32Array",
2338 "Map",
2339 "Math",
2340 "Object",
2341 "Promise",
2342 "RegExp",
2343 "Set",
2344 "String",
2345 "Symbol",
2346 "TypeError",
2347 "Uint8Array",
2348 "Uint8ClampedArray",
2349 "Uint16Array",
2350 "Uint32Array",
2351 "WeakMap",
2352 "_",
2353 "clearTimeout",
2354 "isFinite",
2355 "parseInt",
2356 "setTimeout"
2357 ];
2358 /** Used to make template sourceURLs easier to identify. */
2359 var templateCounter = -1;
2360 /** Used to identify `toStringTag` values of typed arrays. */
2361 var typedArrayTags = {};
2362 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
2363 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
2364 /** Used to identify `toStringTag` values supported by `_.clone`. */
2365 var cloneableTags = {};
2366 cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
2367 cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
2368 /** Used to map Latin Unicode letters to basic Latin letters. */
2369 var deburredLetters = {
2370 "À": "A",
2371 "Á": "A",
2372 "Â": "A",
2373 "Ã": "A",
2374 "Ä": "A",
2375 "Å": "A",
2376 "à": "a",
2377 "á": "a",
2378 "â": "a",
2379 "ã": "a",
2380 "ä": "a",
2381 "å": "a",
2382 "Ç": "C",
2383 "ç": "c",
2384 "Ð": "D",
2385 "ð": "d",
2386 "È": "E",
2387 "É": "E",
2388 "Ê": "E",
2389 "Ë": "E",
2390 "è": "e",
2391 "é": "e",
2392 "ê": "e",
2393 "ë": "e",
2394 "Ì": "I",
2395 "Í": "I",
2396 "Î": "I",
2397 "Ï": "I",
2398 "ì": "i",
2399 "í": "i",
2400 "î": "i",
2401 "ï": "i",
2402 "Ñ": "N",
2403 "ñ": "n",
2404 "Ò": "O",
2405 "Ó": "O",
2406 "Ô": "O",
2407 "Õ": "O",
2408 "Ö": "O",
2409 "Ø": "O",
2410 "ò": "o",
2411 "ó": "o",
2412 "ô": "o",
2413 "õ": "o",
2414 "ö": "o",
2415 "ø": "o",
2416 "Ù": "U",
2417 "Ú": "U",
2418 "Û": "U",
2419 "Ü": "U",
2420 "ù": "u",
2421 "ú": "u",
2422 "û": "u",
2423 "ü": "u",
2424 "Ý": "Y",
2425 "ý": "y",
2426 "ÿ": "y",
2427 "Æ": "Ae",
2428 "æ": "ae",
2429 "Þ": "Th",
2430 "þ": "th",
2431 "ß": "ss",
2432 "Ā": "A",
2433 "Ă": "A",
2434 "Ą": "A",
2435 "ā": "a",
2436 "ă": "a",
2437 "ą": "a",
2438 "Ć": "C",
2439 "Ĉ": "C",
2440 "Ċ": "C",
2441 "Č": "C",
2442 "ć": "c",
2443 "ĉ": "c",
2444 "ċ": "c",
2445 "č": "c",
2446 "Ď": "D",
2447 "Đ": "D",
2448 "ď": "d",
2449 "đ": "d",
2450 "Ē": "E",
2451 "Ĕ": "E",
2452 "Ė": "E",
2453 "Ę": "E",
2454 "Ě": "E",
2455 "ē": "e",
2456 "ĕ": "e",
2457 "ė": "e",
2458 "ę": "e",
2459 "ě": "e",
2460 "Ĝ": "G",
2461 "Ğ": "G",
2462 "Ġ": "G",
2463 "Ģ": "G",
2464 "ĝ": "g",
2465 "ğ": "g",
2466 "ġ": "g",
2467 "ģ": "g",
2468 "Ĥ": "H",
2469 "Ħ": "H",
2470 "ĥ": "h",
2471 "ħ": "h",
2472 "Ĩ": "I",
2473 "Ī": "I",
2474 "Ĭ": "I",
2475 "Į": "I",
2476 "İ": "I",
2477 "ĩ": "i",
2478 "ī": "i",
2479 "ĭ": "i",
2480 "į": "i",
2481 "ı": "i",
2482 "Ĵ": "J",
2483 "ĵ": "j",
2484 "Ķ": "K",
2485 "ķ": "k",
2486 "ĸ": "k",
2487 "Ĺ": "L",
2488 "Ļ": "L",
2489 "Ľ": "L",
2490 "Ŀ": "L",
2491 "Ł": "L",
2492 "ĺ": "l",
2493 "ļ": "l",
2494 "ľ": "l",
2495 "ŀ": "l",
2496 "ł": "l",
2497 "Ń": "N",
2498 "Ņ": "N",
2499 "Ň": "N",
2500 "Ŋ": "N",
2501 "ń": "n",
2502 "ņ": "n",
2503 "ň": "n",
2504 "ŋ": "n",
2505 "Ō": "O",
2506 "Ŏ": "O",
2507 "Ő": "O",
2508 "ō": "o",
2509 "ŏ": "o",
2510 "ő": "o",
2511 "Ŕ": "R",
2512 "Ŗ": "R",
2513 "Ř": "R",
2514 "ŕ": "r",
2515 "ŗ": "r",
2516 "ř": "r",
2517 "Ś": "S",
2518 "Ŝ": "S",
2519 "Ş": "S",
2520 "Š": "S",
2521 "ś": "s",
2522 "ŝ": "s",
2523 "ş": "s",
2524 "š": "s",
2525 "Ţ": "T",
2526 "Ť": "T",
2527 "Ŧ": "T",
2528 "ţ": "t",
2529 "ť": "t",
2530 "ŧ": "t",
2531 "Ũ": "U",
2532 "Ū": "U",
2533 "Ŭ": "U",
2534 "Ů": "U",
2535 "Ű": "U",
2536 "Ų": "U",
2537 "ũ": "u",
2538 "ū": "u",
2539 "ŭ": "u",
2540 "ů": "u",
2541 "ű": "u",
2542 "ų": "u",
2543 "Ŵ": "W",
2544 "ŵ": "w",
2545 "Ŷ": "Y",
2546 "ŷ": "y",
2547 "Ÿ": "Y",
2548 "Ź": "Z",
2549 "Ż": "Z",
2550 "Ž": "Z",
2551 "ź": "z",
2552 "ż": "z",
2553 "ž": "z",
2554 "IJ": "IJ",
2555 "ij": "ij",
2556 "Œ": "Oe",
2557 "œ": "oe",
2558 "ʼn": "'n",
2559 "ſ": "s"
2560 };
2561 /** Used to map characters to HTML entities. */
2562 var htmlEscapes = {
2563 "&": "&amp;",
2564 "<": "&lt;",
2565 ">": "&gt;",
2566 "\"": "&quot;",
2567 "'": "&#39;"
2568 };
2569 /** Used to map HTML entities to characters. */
2570 var htmlUnescapes = {
2571 "&amp;": "&",
2572 "&lt;": "<",
2573 "&gt;": ">",
2574 "&quot;": "\"",
2575 "&#39;": "'"
2576 };
2577 /** Used to escape characters for inclusion in compiled string literals. */
2578 var stringEscapes = {
2579 "\\": "\\",
2580 "'": "'",
2581 "\n": "n",
2582 "\r": "r",
2583 "\u2028": "u2028",
2584 "\u2029": "u2029"
2585 };
2586 /** Built-in method references without a dependency on `root`. */
2587 var freeParseFloat = parseFloat;
2588 var freeParseInt = parseInt;
2589 /** Detect free variable `global` from Node.js. */
2590 var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
2591 /** Detect free variable `self`. */
2592 var freeSelf = typeof self == "object" && self && self.Object === Object && self;
2593 /** Used as a reference to the global object. */
2594 var root = freeGlobal || freeSelf || Function("return this")();
2595 /** Detect free variable `exports`. */
2596 var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
2597 /** Detect free variable `module`. */
2598 var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
2599 /** Detect the popular CommonJS extension `module.exports`. */
2600 var moduleExports = freeModule && freeModule.exports === freeExports;
2601 /** Detect free variable `process` from Node.js. */
2602 var freeProcess = moduleExports && freeGlobal.process;
2603 /** Used to access faster Node.js helpers. */
2604 var nodeUtil = function() {
2605 try {
2606 var types = freeModule && freeModule.require && freeModule.require("util").types;
2607 if (types) return types;
2608 return freeProcess && freeProcess.binding && freeProcess.binding("util");
2609 } catch (e) {}
2610 }();
2611 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
2612 var nodeIsDate = nodeUtil && nodeUtil.isDate;
2613 var nodeIsMap = nodeUtil && nodeUtil.isMap;
2614 var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
2615 var nodeIsSet = nodeUtil && nodeUtil.isSet;
2616 var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
2617 /**
2618 * A faster alternative to `Function#apply`, this function invokes `func`
2619 * with the `this` binding of `thisArg` and the arguments of `args`.
2620 *
2621 * @private
2622 * @param {Function} func The function to invoke.
2623 * @param {*} thisArg The `this` binding of `func`.
2624 * @param {Array} args The arguments to invoke `func` with.
2625 * @returns {*} Returns the result of `func`.
2626 */
2627 function apply(func, thisArg, args) {
2628 switch (args.length) {
2629 case 0: return func.call(thisArg);
2630 case 1: return func.call(thisArg, args[0]);
2631 case 2: return func.call(thisArg, args[0], args[1]);
2632 case 3: return func.call(thisArg, args[0], args[1], args[2]);
2633 }
2634 return func.apply(thisArg, args);
2635 }
2636 /**
2637 * A specialized version of `baseAggregator` for arrays.
2638 *
2639 * @private
2640 * @param {Array} [array] The array to iterate over.
2641 * @param {Function} setter The function to set `accumulator` values.
2642 * @param {Function} iteratee The iteratee to transform keys.
2643 * @param {Object} accumulator The initial aggregated object.
2644 * @returns {Function} Returns `accumulator`.
2645 */
2646 function arrayAggregator(array, setter, iteratee, accumulator) {
2647 var index = -1;
2648 var length = array == null ? 0 : array.length;
2649 while (++index < length) {
2650 var value = array[index];
2651 setter(accumulator, value, iteratee(value), array);
2652 }
2653 return accumulator;
2654 }
2655 /**
2656 * A specialized version of `_.forEach` for arrays without support for
2657 * iteratee shorthands.
2658 *
2659 * @private
2660 * @param {Array} [array] The array to iterate over.
2661 * @param {Function} iteratee The function invoked per iteration.
2662 * @returns {Array} Returns `array`.
2663 */
2664 function arrayEach(array, iteratee) {
2665 var index = -1;
2666 var length = array == null ? 0 : array.length;
2667 while (++index < length) if (iteratee(array[index], index, array) === false) break;
2668 return array;
2669 }
2670 /**
2671 * A specialized version of `_.forEachRight` for arrays without support for
2672 * iteratee shorthands.
2673 *
2674 * @private
2675 * @param {Array} [array] The array to iterate over.
2676 * @param {Function} iteratee The function invoked per iteration.
2677 * @returns {Array} Returns `array`.
2678 */
2679 function arrayEachRight(array, iteratee) {
2680 var length = array == null ? 0 : array.length;
2681 while (length--) if (iteratee(array[length], length, array) === false) break;
2682 return array;
2683 }
2684 /**
2685 * A specialized version of `_.every` for arrays without support for
2686 * iteratee shorthands.
2687 *
2688 * @private
2689 * @param {Array} [array] The array to iterate over.
2690 * @param {Function} predicate The function invoked per iteration.
2691 * @returns {boolean} Returns `true` if all elements pass the predicate check,
2692 * else `false`.
2693 */
2694 function arrayEvery(array, predicate) {
2695 var index = -1;
2696 var length = array == null ? 0 : array.length;
2697 while (++index < length) if (!predicate(array[index], index, array)) return false;
2698 return true;
2699 }
2700 /**
2701 * A specialized version of `_.filter` for arrays without support for
2702 * iteratee shorthands.
2703 *
2704 * @private
2705 * @param {Array} [array] The array to iterate over.
2706 * @param {Function} predicate The function invoked per iteration.
2707 * @returns {Array} Returns the new filtered array.
2708 */
2709 function arrayFilter(array, predicate) {
2710 var index = -1;
2711 var length = array == null ? 0 : array.length;
2712 var resIndex = 0;
2713 var result = [];
2714 while (++index < length) {
2715 var value = array[index];
2716 if (predicate(value, index, array)) result[resIndex++] = value;
2717 }
2718 return result;
2719 }
2720 /**
2721 * A specialized version of `_.includes` for arrays without support for
2722 * specifying an index to search from.
2723 *
2724 * @private
2725 * @param {Array} [array] The array to inspect.
2726 * @param {*} target The value to search for.
2727 * @returns {boolean} Returns `true` if `target` is found, else `false`.
2728 */
2729 function arrayIncludes(array, value) {
2730 return !!(array == null ? 0 : array.length) && baseIndexOf(array, value, 0) > -1;
2731 }
2732 /**
2733 * This function is like `arrayIncludes` except that it accepts a comparator.
2734 *
2735 * @private
2736 * @param {Array} [array] The array to inspect.
2737 * @param {*} target The value to search for.
2738 * @param {Function} comparator The comparator invoked per element.
2739 * @returns {boolean} Returns `true` if `target` is found, else `false`.
2740 */
2741 function arrayIncludesWith(array, value, comparator) {
2742 var index = -1;
2743 var length = array == null ? 0 : array.length;
2744 while (++index < length) if (comparator(value, array[index])) return true;
2745 return false;
2746 }
2747 /**
2748 * A specialized version of `_.map` for arrays without support for iteratee
2749 * shorthands.
2750 *
2751 * @private
2752 * @param {Array} [array] The array to iterate over.
2753 * @param {Function} iteratee The function invoked per iteration.
2754 * @returns {Array} Returns the new mapped array.
2755 */
2756 function arrayMap(array, iteratee) {
2757 var index = -1;
2758 var length = array == null ? 0 : array.length;
2759 var result = Array(length);
2760 while (++index < length) result[index] = iteratee(array[index], index, array);
2761 return result;
2762 }
2763 /**
2764 * Appends the elements of `values` to `array`.
2765 *
2766 * @private
2767 * @param {Array} array The array to modify.
2768 * @param {Array} values The values to append.
2769 * @returns {Array} Returns `array`.
2770 */
2771 function arrayPush(array, values) {
2772 var index = -1;
2773 var length = values.length;
2774 var offset = array.length;
2775 while (++index < length) array[offset + index] = values[index];
2776 return array;
2777 }
2778 /**
2779 * A specialized version of `_.reduce` for arrays without support for
2780 * iteratee shorthands.
2781 *
2782 * @private
2783 * @param {Array} [array] The array to iterate over.
2784 * @param {Function} iteratee The function invoked per iteration.
2785 * @param {*} [accumulator] The initial value.
2786 * @param {boolean} [initAccum] Specify using the first element of `array` as
2787 * the initial value.
2788 * @returns {*} Returns the accumulated value.
2789 */
2790 function arrayReduce(array, iteratee, accumulator, initAccum) {
2791 var index = -1;
2792 var length = array == null ? 0 : array.length;
2793 if (initAccum && length) accumulator = array[++index];
2794 while (++index < length) accumulator = iteratee(accumulator, array[index], index, array);
2795 return accumulator;
2796 }
2797 /**
2798 * A specialized version of `_.reduceRight` for arrays without support for
2799 * iteratee shorthands.
2800 *
2801 * @private
2802 * @param {Array} [array] The array to iterate over.
2803 * @param {Function} iteratee The function invoked per iteration.
2804 * @param {*} [accumulator] The initial value.
2805 * @param {boolean} [initAccum] Specify using the last element of `array` as
2806 * the initial value.
2807 * @returns {*} Returns the accumulated value.
2808 */
2809 function arrayReduceRight(array, iteratee, accumulator, initAccum) {
2810 var length = array == null ? 0 : array.length;
2811 if (initAccum && length) accumulator = array[--length];
2812 while (length--) accumulator = iteratee(accumulator, array[length], length, array);
2813 return accumulator;
2814 }
2815 /**
2816 * A specialized version of `_.some` for arrays without support for iteratee
2817 * shorthands.
2818 *
2819 * @private
2820 * @param {Array} [array] The array to iterate over.
2821 * @param {Function} predicate The function invoked per iteration.
2822 * @returns {boolean} Returns `true` if any element passes the predicate check,
2823 * else `false`.
2824 */
2825 function arraySome(array, predicate) {
2826 var index = -1;
2827 var length = array == null ? 0 : array.length;
2828 while (++index < length) if (predicate(array[index], index, array)) return true;
2829 return false;
2830 }
2831 /**
2832 * Gets the size of an ASCII `string`.
2833 *
2834 * @private
2835 * @param {string} string The string inspect.
2836 * @returns {number} Returns the string size.
2837 */
2838 var asciiSize = baseProperty("length");
2839 /**
2840 * Converts an ASCII `string` to an array.
2841 *
2842 * @private
2843 * @param {string} string The string to convert.
2844 * @returns {Array} Returns the converted array.
2845 */
2846 function asciiToArray(string) {
2847 return string.split("");
2848 }
2849 /**
2850 * Splits an ASCII `string` into an array of its words.
2851 *
2852 * @private
2853 * @param {string} The string to inspect.
2854 * @returns {Array} Returns the words of `string`.
2855 */
2856 function asciiWords(string) {
2857 return string.match(reAsciiWord) || [];
2858 }
2859 /**
2860 * The base implementation of methods like `_.findKey` and `_.findLastKey`,
2861 * without support for iteratee shorthands, which iterates over `collection`
2862 * using `eachFunc`.
2863 *
2864 * @private
2865 * @param {Array|Object} collection The collection to inspect.
2866 * @param {Function} predicate The function invoked per iteration.
2867 * @param {Function} eachFunc The function to iterate over `collection`.
2868 * @returns {*} Returns the found element or its key, else `undefined`.
2869 */
2870 function baseFindKey(collection, predicate, eachFunc) {
2871 var result;
2872 eachFunc(collection, function(value, key, collection) {
2873 if (predicate(value, key, collection)) {
2874 result = key;
2875 return false;
2876 }
2877 });
2878 return result;
2879 }
2880 /**
2881 * The base implementation of `_.findIndex` and `_.findLastIndex` without
2882 * support for iteratee shorthands.
2883 *
2884 * @private
2885 * @param {Array} array The array to inspect.
2886 * @param {Function} predicate The function invoked per iteration.
2887 * @param {number} fromIndex The index to search from.
2888 * @param {boolean} [fromRight] Specify iterating from right to left.
2889 * @returns {number} Returns the index of the matched value, else `-1`.
2890 */
2891 function baseFindIndex(array, predicate, fromIndex, fromRight) {
2892 var length = array.length;
2893 var index = fromIndex + (fromRight ? 1 : -1);
2894 while (fromRight ? index-- : ++index < length) if (predicate(array[index], index, array)) return index;
2895 return -1;
2896 }
2897 /**
2898 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
2899 *
2900 * @private
2901 * @param {Array} array The array to inspect.
2902 * @param {*} value The value to search for.
2903 * @param {number} fromIndex The index to search from.
2904 * @returns {number} Returns the index of the matched value, else `-1`.
2905 */
2906 function baseIndexOf(array, value, fromIndex) {
2907 return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
2908 }
2909 /**
2910 * This function is like `baseIndexOf` except that it accepts a comparator.
2911 *
2912 * @private
2913 * @param {Array} array The array to inspect.
2914 * @param {*} value The value to search for.
2915 * @param {number} fromIndex The index to search from.
2916 * @param {Function} comparator The comparator invoked per element.
2917 * @returns {number} Returns the index of the matched value, else `-1`.
2918 */
2919 function baseIndexOfWith(array, value, fromIndex, comparator) {
2920 var index = fromIndex - 1;
2921 var length = array.length;
2922 while (++index < length) if (comparator(array[index], value)) return index;
2923 return -1;
2924 }
2925 /**
2926 * The base implementation of `_.isNaN` without support for number objects.
2927 *
2928 * @private
2929 * @param {*} value The value to check.
2930 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
2931 */
2932 function baseIsNaN(value) {
2933 return value !== value;
2934 }
2935 /**
2936 * The base implementation of `_.mean` and `_.meanBy` without support for
2937 * iteratee shorthands.
2938 *
2939 * @private
2940 * @param {Array} array The array to iterate over.
2941 * @param {Function} iteratee The function invoked per iteration.
2942 * @returns {number} Returns the mean.
2943 */
2944 function baseMean(array, iteratee) {
2945 var length = array == null ? 0 : array.length;
2946 return length ? baseSum(array, iteratee) / length : NAN;
2947 }
2948 /**
2949 * The base implementation of `_.property` without support for deep paths.
2950 *
2951 * @private
2952 * @param {string} key The key of the property to get.
2953 * @returns {Function} Returns the new accessor function.
2954 */
2955 function baseProperty(key) {
2956 return function(object) {
2957 return object == null ? undefined : object[key];
2958 };
2959 }
2960 /**
2961 * The base implementation of `_.propertyOf` without support for deep paths.
2962 *
2963 * @private
2964 * @param {Object} object The object to query.
2965 * @returns {Function} Returns the new accessor function.
2966 */
2967 function basePropertyOf(object) {
2968 return function(key) {
2969 return object == null ? undefined : object[key];
2970 };
2971 }
2972 /**
2973 * The base implementation of `_.reduce` and `_.reduceRight`, without support
2974 * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
2975 *
2976 * @private
2977 * @param {Array|Object} collection The collection to iterate over.
2978 * @param {Function} iteratee The function invoked per iteration.
2979 * @param {*} accumulator The initial value.
2980 * @param {boolean} initAccum Specify using the first or last element of
2981 * `collection` as the initial value.
2982 * @param {Function} eachFunc The function to iterate over `collection`.
2983 * @returns {*} Returns the accumulated value.
2984 */
2985 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
2986 eachFunc(collection, function(value, index, collection) {
2987 accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection);
2988 });
2989 return accumulator;
2990 }
2991 /**
2992 * The base implementation of `_.sortBy` which uses `comparer` to define the
2993 * sort order of `array` and replaces criteria objects with their corresponding
2994 * values.
2995 *
2996 * @private
2997 * @param {Array} array The array to sort.
2998 * @param {Function} comparer The function to define sort order.
2999 * @returns {Array} Returns `array`.
3000 */
3001 function baseSortBy(array, comparer) {
3002 var length = array.length;
3003 array.sort(comparer);
3004 while (length--) array[length] = array[length].value;
3005 return array;
3006 }
3007 /**
3008 * The base implementation of `_.sum` and `_.sumBy` without support for
3009 * iteratee shorthands.
3010 *
3011 * @private
3012 * @param {Array} array The array to iterate over.
3013 * @param {Function} iteratee The function invoked per iteration.
3014 * @returns {number} Returns the sum.
3015 */
3016 function baseSum(array, iteratee) {
3017 var result;
3018 var index = -1;
3019 var length = array.length;
3020 while (++index < length) {
3021 var current = iteratee(array[index]);
3022 if (current !== undefined) result = result === undefined ? current : result + current;
3023 }
3024 return result;
3025 }
3026 /**
3027 * The base implementation of `_.times` without support for iteratee shorthands
3028 * or max array length checks.
3029 *
3030 * @private
3031 * @param {number} n The number of times to invoke `iteratee`.
3032 * @param {Function} iteratee The function invoked per iteration.
3033 * @returns {Array} Returns the array of results.
3034 */
3035 function baseTimes(n, iteratee) {
3036 var index = -1;
3037 var result = Array(n);
3038 while (++index < n) result[index] = iteratee(index);
3039 return result;
3040 }
3041 /**
3042 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
3043 * of key-value pairs for `object` corresponding to the property names of `props`.
3044 *
3045 * @private
3046 * @param {Object} object The object to query.
3047 * @param {Array} props The property names to get values for.
3048 * @returns {Object} Returns the key-value pairs.
3049 */
3050 function baseToPairs(object, props) {
3051 return arrayMap(props, function(key) {
3052 return [key, object[key]];
3053 });
3054 }
3055 /**
3056 * The base implementation of `_.trim`.
3057 *
3058 * @private
3059 * @param {string} string The string to trim.
3060 * @returns {string} Returns the trimmed string.
3061 */
3062 function baseTrim(string) {
3063 return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
3064 }
3065 /**
3066 * The base implementation of `_.unary` without support for storing metadata.
3067 *
3068 * @private
3069 * @param {Function} func The function to cap arguments for.
3070 * @returns {Function} Returns the new capped function.
3071 */
3072 function baseUnary(func) {
3073 return function(value) {
3074 return func(value);
3075 };
3076 }
3077 /**
3078 * The base implementation of `_.values` and `_.valuesIn` which creates an
3079 * array of `object` property values corresponding to the property names
3080 * of `props`.
3081 *
3082 * @private
3083 * @param {Object} object The object to query.
3084 * @param {Array} props The property names to get values for.
3085 * @returns {Object} Returns the array of property values.
3086 */
3087 function baseValues(object, props) {
3088 return arrayMap(props, function(key) {
3089 return object[key];
3090 });
3091 }
3092 /**
3093 * Checks if a `cache` value for `key` exists.
3094 *
3095 * @private
3096 * @param {Object} cache The cache to query.
3097 * @param {string} key The key of the entry to check.
3098 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3099 */
3100 function cacheHas(cache, key) {
3101 return cache.has(key);
3102 }
3103 /**
3104 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
3105 * that is not found in the character symbols.
3106 *
3107 * @private
3108 * @param {Array} strSymbols The string symbols to inspect.
3109 * @param {Array} chrSymbols The character symbols to find.
3110 * @returns {number} Returns the index of the first unmatched string symbol.
3111 */
3112 function charsStartIndex(strSymbols, chrSymbols) {
3113 var index = -1;
3114 var length = strSymbols.length;
3115 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1);
3116 return index;
3117 }
3118 /**
3119 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
3120 * that is not found in the character symbols.
3121 *
3122 * @private
3123 * @param {Array} strSymbols The string symbols to inspect.
3124 * @param {Array} chrSymbols The character symbols to find.
3125 * @returns {number} Returns the index of the last unmatched string symbol.
3126 */
3127 function charsEndIndex(strSymbols, chrSymbols) {
3128 var index = strSymbols.length;
3129 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1);
3130 return index;
3131 }
3132 /**
3133 * Gets the number of `placeholder` occurrences in `array`.
3134 *
3135 * @private
3136 * @param {Array} array The array to inspect.
3137 * @param {*} placeholder The placeholder to search for.
3138 * @returns {number} Returns the placeholder count.
3139 */
3140 function countHolders(array, placeholder) {
3141 var length = array.length;
3142 var result = 0;
3143 while (length--) if (array[length] === placeholder) ++result;
3144 return result;
3145 }
3146 /**
3147 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
3148 * letters to basic Latin letters.
3149 *
3150 * @private
3151 * @param {string} letter The matched letter to deburr.
3152 * @returns {string} Returns the deburred letter.
3153 */
3154 var deburrLetter = basePropertyOf(deburredLetters);
3155 /**
3156 * Used by `_.escape` to convert characters to HTML entities.
3157 *
3158 * @private
3159 * @param {string} chr The matched character to escape.
3160 * @returns {string} Returns the escaped character.
3161 */
3162 var escapeHtmlChar = basePropertyOf(htmlEscapes);
3163 /**
3164 * Used by `_.template` to escape characters for inclusion in compiled string literals.
3165 *
3166 * @private
3167 * @param {string} chr The matched character to escape.
3168 * @returns {string} Returns the escaped character.
3169 */
3170 function escapeStringChar(chr) {
3171 return "\\" + stringEscapes[chr];
3172 }
3173 /**
3174 * Gets the value at `key` of `object`.
3175 *
3176 * @private
3177 * @param {Object} [object] The object to query.
3178 * @param {string} key The key of the property to get.
3179 * @returns {*} Returns the property value.
3180 */
3181 function getValue(object, key) {
3182 return object == null ? undefined : object[key];
3183 }
3184 /**
3185 * Checks if `string` contains Unicode symbols.
3186 *
3187 * @private
3188 * @param {string} string The string to inspect.
3189 * @returns {boolean} Returns `true` if a symbol is found, else `false`.
3190 */
3191 function hasUnicode(string) {
3192 return reHasUnicode.test(string);
3193 }
3194 /**
3195 * Checks if `string` contains a word composed of Unicode symbols.
3196 *
3197 * @private
3198 * @param {string} string The string to inspect.
3199 * @returns {boolean} Returns `true` if a word is found, else `false`.
3200 */
3201 function hasUnicodeWord(string) {
3202 return reHasUnicodeWord.test(string);
3203 }
3204 /**
3205 * Converts `iterator` to an array.
3206 *
3207 * @private
3208 * @param {Object} iterator The iterator to convert.
3209 * @returns {Array} Returns the converted array.
3210 */
3211 function iteratorToArray(iterator) {
3212 var data;
3213 var result = [];
3214 while (!(data = iterator.next()).done) result.push(data.value);
3215 return result;
3216 }
3217 /**
3218 * Converts `map` to its key-value pairs.
3219 *
3220 * @private
3221 * @param {Object} map The map to convert.
3222 * @returns {Array} Returns the key-value pairs.
3223 */
3224 function mapToArray(map) {
3225 var index = -1;
3226 var result = Array(map.size);
3227 map.forEach(function(value, key) {
3228 result[++index] = [key, value];
3229 });
3230 return result;
3231 }
3232 /**
3233 * Creates a unary function that invokes `func` with its argument transformed.
3234 *
3235 * @private
3236 * @param {Function} func The function to wrap.
3237 * @param {Function} transform The argument transform.
3238 * @returns {Function} Returns the new function.
3239 */
3240 function overArg(func, transform) {
3241 return function(arg) {
3242 return func(transform(arg));
3243 };
3244 }
3245 /**
3246 * Replaces all `placeholder` elements in `array` with an internal placeholder
3247 * and returns an array of their indexes.
3248 *
3249 * @private
3250 * @param {Array} array The array to modify.
3251 * @param {*} placeholder The placeholder to replace.
3252 * @returns {Array} Returns the new array of placeholder indexes.
3253 */
3254 function replaceHolders(array, placeholder) {
3255 var index = -1;
3256 var length = array.length;
3257 var resIndex = 0;
3258 var result = [];
3259 while (++index < length) {
3260 var value = array[index];
3261 if (value === placeholder || value === PLACEHOLDER) {
3262 array[index] = PLACEHOLDER;
3263 result[resIndex++] = index;
3264 }
3265 }
3266 return result;
3267 }
3268 /**
3269 * Converts `set` to an array of its values.
3270 *
3271 * @private
3272 * @param {Object} set The set to convert.
3273 * @returns {Array} Returns the values.
3274 */
3275 function setToArray(set) {
3276 var index = -1;
3277 var result = Array(set.size);
3278 set.forEach(function(value) {
3279 result[++index] = value;
3280 });
3281 return result;
3282 }
3283 /**
3284 * Converts `set` to its value-value pairs.
3285 *
3286 * @private
3287 * @param {Object} set The set to convert.
3288 * @returns {Array} Returns the value-value pairs.
3289 */
3290 function setToPairs(set) {
3291 var index = -1;
3292 var result = Array(set.size);
3293 set.forEach(function(value) {
3294 result[++index] = [value, value];
3295 });
3296 return result;
3297 }
3298 /**
3299 * A specialized version of `_.indexOf` which performs strict equality
3300 * comparisons of values, i.e. `===`.
3301 *
3302 * @private
3303 * @param {Array} array The array to inspect.
3304 * @param {*} value The value to search for.
3305 * @param {number} fromIndex The index to search from.
3306 * @returns {number} Returns the index of the matched value, else `-1`.
3307 */
3308 function strictIndexOf(array, value, fromIndex) {
3309 var index = fromIndex - 1;
3310 var length = array.length;
3311 while (++index < length) if (array[index] === value) return index;
3312 return -1;
3313 }
3314 /**
3315 * A specialized version of `_.lastIndexOf` which performs strict equality
3316 * comparisons of values, i.e. `===`.
3317 *
3318 * @private
3319 * @param {Array} array The array to inspect.
3320 * @param {*} value The value to search for.
3321 * @param {number} fromIndex The index to search from.
3322 * @returns {number} Returns the index of the matched value, else `-1`.
3323 */
3324 function strictLastIndexOf(array, value, fromIndex) {
3325 var index = fromIndex + 1;
3326 while (index--) if (array[index] === value) return index;
3327 return index;
3328 }
3329 /**
3330 * Gets the number of symbols in `string`.
3331 *
3332 * @private
3333 * @param {string} string The string to inspect.
3334 * @returns {number} Returns the string size.
3335 */
3336 function stringSize(string) {
3337 return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
3338 }
3339 /**
3340 * Converts `string` to an array.
3341 *
3342 * @private
3343 * @param {string} string The string to convert.
3344 * @returns {Array} Returns the converted array.
3345 */
3346 function stringToArray(string) {
3347 return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
3348 }
3349 /**
3350 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
3351 * character of `string`.
3352 *
3353 * @private
3354 * @param {string} string The string to inspect.
3355 * @returns {number} Returns the index of the last non-whitespace character.
3356 */
3357 function trimmedEndIndex(string) {
3358 var index = string.length;
3359 while (index-- && reWhitespace.test(string.charAt(index)));
3360 return index;
3361 }
3362 /**
3363 * Used by `_.unescape` to convert HTML entities to characters.
3364 *
3365 * @private
3366 * @param {string} chr The matched character to unescape.
3367 * @returns {string} Returns the unescaped character.
3368 */
3369 var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
3370 /**
3371 * Gets the size of a Unicode `string`.
3372 *
3373 * @private
3374 * @param {string} string The string inspect.
3375 * @returns {number} Returns the string size.
3376 */
3377 function unicodeSize(string) {
3378 var result = reUnicode.lastIndex = 0;
3379 while (reUnicode.test(string)) ++result;
3380 return result;
3381 }
3382 /**
3383 * Converts a Unicode `string` to an array.
3384 *
3385 * @private
3386 * @param {string} string The string to convert.
3387 * @returns {Array} Returns the converted array.
3388 */
3389 function unicodeToArray(string) {
3390 return string.match(reUnicode) || [];
3391 }
3392 /**
3393 * Splits a Unicode `string` into an array of its words.
3394 *
3395 * @private
3396 * @param {string} The string to inspect.
3397 * @returns {Array} Returns the words of `string`.
3398 */
3399 function unicodeWords(string) {
3400 return string.match(reUnicodeWord) || [];
3401 }
3402 var _ = (function runInContext(context) {
3403 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
3404 /** Built-in constructor references. */
3405 var Array = context.Array;
3406 var Date = context.Date;
3407 var Error = context.Error;
3408 var Function = context.Function;
3409 var Math = context.Math;
3410 var Object = context.Object;
3411 var RegExp = context.RegExp;
3412 var String = context.String;
3413 var TypeError = context.TypeError;
3414 /** Used for built-in method references. */
3415 var arrayProto = Array.prototype;
3416 var funcProto = Function.prototype;
3417 var objectProto = Object.prototype;
3418 /** Used to detect overreaching core-js shims. */
3419 var coreJsData = context["__core-js_shared__"];
3420 /** Used to resolve the decompiled source of functions. */
3421 var funcToString = funcProto.toString;
3422 /** Used to check objects for own properties. */
3423 var hasOwnProperty = objectProto.hasOwnProperty;
3424 /** Used to generate unique IDs. */
3425 var idCounter = 0;
3426 /** Used to detect methods masquerading as native. */
3427 var maskSrcKey = function() {
3428 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
3429 return uid ? "Symbol(src)_1." + uid : "";
3430 }();
3431 /**
3432 * Used to resolve the
3433 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
3434 * of values.
3435 */
3436 var nativeObjectToString = objectProto.toString;
3437 /** Used to infer the `Object` constructor. */
3438 var objectCtorString = funcToString.call(Object);
3439 /** Used to restore the original `_` reference in `_.noConflict`. */
3440 var oldDash = root._;
3441 /** Used to detect if a method is native. */
3442 var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
3443 /** Built-in value references. */
3444 var Buffer = moduleExports ? context.Buffer : undefined;
3445 var Symbol = context.Symbol;
3446 var Uint8Array = context.Uint8Array;
3447 var allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
3448 var getPrototype = overArg(Object.getPrototypeOf, Object);
3449 var objectCreate = Object.create;
3450 var propertyIsEnumerable = objectProto.propertyIsEnumerable;
3451 var splice = arrayProto.splice;
3452 var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
3453 var symIterator = Symbol ? Symbol.iterator : undefined;
3454 var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
3455 var defineProperty = function() {
3456 try {
3457 var func = getNative(Object, "defineProperty");
3458 func({}, "", {});
3459 return func;
3460 } catch (e) {}
3461 }();
3462 /** Mocked built-ins. */
3463 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout;
3464 var ctxNow = Date && Date.now !== root.Date.now && Date.now;
3465 var ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
3466 var nativeCeil = Math.ceil;
3467 var nativeFloor = Math.floor;
3468 var nativeGetSymbols = Object.getOwnPropertySymbols;
3469 var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
3470 var nativeIsFinite = context.isFinite;
3471 var nativeJoin = arrayProto.join;
3472 var nativeKeys = overArg(Object.keys, Object);
3473 var nativeMax = Math.max;
3474 var nativeMin = Math.min;
3475 var nativeNow = Date.now;
3476 var nativeParseInt = context.parseInt;
3477 var nativeRandom = Math.random;
3478 var nativeReverse = arrayProto.reverse;
3479 var DataView = getNative(context, "DataView");
3480 var Map = getNative(context, "Map");
3481 var Promise = getNative(context, "Promise");
3482 var Set = getNative(context, "Set");
3483 var WeakMap = getNative(context, "WeakMap");
3484 var nativeCreate = getNative(Object, "create");
3485 /** Used to store function metadata. */
3486 var metaMap = WeakMap && new WeakMap();
3487 /** Used to lookup unminified function names. */
3488 var realNames = {};
3489 /** Used to detect maps, sets, and weakmaps. */
3490 var dataViewCtorString = toSource(DataView);
3491 var mapCtorString = toSource(Map);
3492 var promiseCtorString = toSource(Promise);
3493 var setCtorString = toSource(Set);
3494 var weakMapCtorString = toSource(WeakMap);
3495 /** Used to convert symbols to primitives and strings. */
3496 var symbolProto = Symbol ? Symbol.prototype : undefined;
3497 var symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
3498 var symbolToString = symbolProto ? symbolProto.toString : undefined;
3499 /**
3500 * Creates a `lodash` object which wraps `value` to enable implicit method
3501 * chain sequences. Methods that operate on and return arrays, collections,
3502 * and functions can be chained together. Methods that retrieve a single value
3503 * or may return a primitive value will automatically end the chain sequence
3504 * and return the unwrapped value. Otherwise, the value must be unwrapped
3505 * with `_#value`.
3506 *
3507 * Explicit chain sequences, which must be unwrapped with `_#value`, may be
3508 * enabled using `_.chain`.
3509 *
3510 * The execution of chained methods is lazy, that is, it's deferred until
3511 * `_#value` is implicitly or explicitly called.
3512 *
3513 * Lazy evaluation allows several methods to support shortcut fusion.
3514 * Shortcut fusion is an optimization to merge iteratee calls; this avoids
3515 * the creation of intermediate arrays and can greatly reduce the number of
3516 * iteratee executions. Sections of a chain sequence qualify for shortcut
3517 * fusion if the section is applied to an array and iteratees accept only
3518 * one argument. The heuristic for whether a section qualifies for shortcut
3519 * fusion is subject to change.
3520 *
3521 * Chaining is supported in custom builds as long as the `_#value` method is
3522 * directly or indirectly included in the build.
3523 *
3524 * In addition to lodash methods, wrappers have `Array` and `String` methods.
3525 *
3526 * The wrapper `Array` methods are:
3527 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
3528 *
3529 * The wrapper `String` methods are:
3530 * `replace` and `split`
3531 *
3532 * The wrapper methods that support shortcut fusion are:
3533 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
3534 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
3535 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
3536 *
3537 * The chainable wrapper methods are:
3538 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
3539 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
3540 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
3541 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
3542 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
3543 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
3544 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
3545 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
3546 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
3547 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
3548 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
3549 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
3550 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
3551 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
3552 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
3553 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
3554 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
3555 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
3556 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
3557 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
3558 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
3559 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
3560 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
3561 * `zipObject`, `zipObjectDeep`, and `zipWith`
3562 *
3563 * The wrapper methods that are **not** chainable by default are:
3564 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
3565 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
3566 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
3567 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
3568 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
3569 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
3570 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
3571 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
3572 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
3573 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
3574 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
3575 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
3576 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
3577 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
3578 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
3579 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
3580 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
3581 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
3582 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
3583 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
3584 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
3585 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
3586 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
3587 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
3588 * `upperFirst`, `value`, and `words`
3589 *
3590 * @name _
3591 * @constructor
3592 * @category Seq
3593 * @param {*} value The value to wrap in a `lodash` instance.
3594 * @returns {Object} Returns the new `lodash` wrapper instance.
3595 * @example
3596 *
3597 * function square(n) {
3598 * return n * n;
3599 * }
3600 *
3601 * var wrapped = _([1, 2, 3]);
3602 *
3603 * // Returns an unwrapped value.
3604 * wrapped.reduce(_.add);
3605 * // => 6
3606 *
3607 * // Returns a wrapped value.
3608 * var squares = wrapped.map(square);
3609 *
3610 * _.isArray(squares);
3611 * // => false
3612 *
3613 * _.isArray(squares.value());
3614 * // => true
3615 */
3616 function lodash(value) {
3617 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
3618 if (value instanceof LodashWrapper) return value;
3619 if (hasOwnProperty.call(value, "__wrapped__")) return wrapperClone(value);
3620 }
3621 return new LodashWrapper(value);
3622 }
3623 /**
3624 * The base implementation of `_.create` without support for assigning
3625 * properties to the created object.
3626 *
3627 * @private
3628 * @param {Object} proto The object to inherit from.
3629 * @returns {Object} Returns the new object.
3630 */
3631 var baseCreate = function() {
3632 function object() {}
3633 return function(proto) {
3634 if (!isObject(proto)) return {};
3635 if (objectCreate) return objectCreate(proto);
3636 object.prototype = proto;
3637 var result = new object();
3638 object.prototype = undefined;
3639 return result;
3640 };
3641 }();
3642 /**
3643 * The function whose prototype chain sequence wrappers inherit from.
3644 *
3645 * @private
3646 */
3647 function baseLodash() {}
3648 /**
3649 * The base constructor for creating `lodash` wrapper objects.
3650 *
3651 * @private
3652 * @param {*} value The value to wrap.
3653 * @param {boolean} [chainAll] Enable explicit method chain sequences.
3654 */
3655 function LodashWrapper(value, chainAll) {
3656 this.__wrapped__ = value;
3657 this.__actions__ = [];
3658 this.__chain__ = !!chainAll;
3659 this.__index__ = 0;
3660 this.__values__ = undefined;
3661 }
3662 /**
3663 * By default, the template delimiters used by lodash are like those in
3664 * embedded Ruby (ERB) as well as ES2015 template strings. Change the
3665 * following template settings to use alternative delimiters.
3666 *
3667 * **Security:** See
3668 * [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md)
3669 * — `_.template` is insecure and will be removed in v5.
3670 *
3671 * @static
3672 * @memberOf _
3673 * @type {Object}
3674 */
3675 lodash.templateSettings = {
3676 /**
3677 * Used to detect `data` property values to be HTML-escaped.
3678 *
3679 * @memberOf _.templateSettings
3680 * @type {RegExp}
3681 */
3682 "escape": reEscape,
3683 /**
3684 * Used to detect code to be evaluated.
3685 *
3686 * @memberOf _.templateSettings
3687 * @type {RegExp}
3688 */
3689 "evaluate": reEvaluate,
3690 /**
3691 * Used to detect `data` property values to inject.
3692 *
3693 * @memberOf _.templateSettings
3694 * @type {RegExp}
3695 */
3696 "interpolate": reInterpolate,
3697 /**
3698 * Used to reference the data object in the template text.
3699 *
3700 * @memberOf _.templateSettings
3701 * @type {string}
3702 */
3703 "variable": "",
3704 /**
3705 * Used to import variables into the compiled template.
3706 *
3707 * @memberOf _.templateSettings
3708 * @type {Object}
3709 */
3710 "imports": {
3711 /**
3712 * A reference to the `lodash` function.
3713 *
3714 * @memberOf _.templateSettings.imports
3715 * @type {Function}
3716 */
3717 "_": lodash }
3718 };
3719 lodash.prototype = baseLodash.prototype;
3720 lodash.prototype.constructor = lodash;
3721 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
3722 LodashWrapper.prototype.constructor = LodashWrapper;
3723 /**
3724 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
3725 *
3726 * @private
3727 * @constructor
3728 * @param {*} value The value to wrap.
3729 */
3730 function LazyWrapper(value) {
3731 this.__wrapped__ = value;
3732 this.__actions__ = [];
3733 this.__dir__ = 1;
3734 this.__filtered__ = false;
3735 this.__iteratees__ = [];
3736 this.__takeCount__ = MAX_ARRAY_LENGTH;
3737 this.__views__ = [];
3738 }
3739 /**
3740 * Creates a clone of the lazy wrapper object.
3741 *
3742 * @private
3743 * @name clone
3744 * @memberOf LazyWrapper
3745 * @returns {Object} Returns the cloned `LazyWrapper` object.
3746 */
3747 function lazyClone() {
3748 var result = new LazyWrapper(this.__wrapped__);
3749 result.__actions__ = copyArray(this.__actions__);
3750 result.__dir__ = this.__dir__;
3751 result.__filtered__ = this.__filtered__;
3752 result.__iteratees__ = copyArray(this.__iteratees__);
3753 result.__takeCount__ = this.__takeCount__;
3754 result.__views__ = copyArray(this.__views__);
3755 return result;
3756 }
3757 /**
3758 * Reverses the direction of lazy iteration.
3759 *
3760 * @private
3761 * @name reverse
3762 * @memberOf LazyWrapper
3763 * @returns {Object} Returns the new reversed `LazyWrapper` object.
3764 */
3765 function lazyReverse() {
3766 if (this.__filtered__) {
3767 var result = new LazyWrapper(this);
3768 result.__dir__ = -1;
3769 result.__filtered__ = true;
3770 } else {
3771 result = this.clone();
3772 result.__dir__ *= -1;
3773 }
3774 return result;
3775 }
3776 /**
3777 * Extracts the unwrapped value from its lazy wrapper.
3778 *
3779 * @private
3780 * @name value
3781 * @memberOf LazyWrapper
3782 * @returns {*} Returns the unwrapped value.
3783 */
3784 function lazyValue() {
3785 var array = this.__wrapped__.value();
3786 var dir = this.__dir__;
3787 var isArr = isArray(array);
3788 var isRight = dir < 0;
3789 var arrLength = isArr ? array.length : 0;
3790 var view = getView(0, arrLength, this.__views__);
3791 var start = view.start;
3792 var end = view.end;
3793 var length = end - start;
3794 var index = isRight ? end : start - 1;
3795 var iteratees = this.__iteratees__;
3796 var iterLength = iteratees.length;
3797 var resIndex = 0;
3798 var takeCount = nativeMin(length, this.__takeCount__);
3799 if (!isArr || !isRight && arrLength == length && takeCount == length) return baseWrapperValue(array, this.__actions__);
3800 var result = [];
3801 outer: while (length-- && resIndex < takeCount) {
3802 index += dir;
3803 var iterIndex = -1;
3804 var value = array[index];
3805 while (++iterIndex < iterLength) {
3806 var data = iteratees[iterIndex];
3807 var iteratee = data.iteratee;
3808 var type = data.type;
3809 var computed = iteratee(value);
3810 if (type == LAZY_MAP_FLAG) value = computed;
3811 else if (!computed) if (type == LAZY_FILTER_FLAG) continue outer;
3812 else break outer;
3813 }
3814 result[resIndex++] = value;
3815 }
3816 return result;
3817 }
3818 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
3819 LazyWrapper.prototype.constructor = LazyWrapper;
3820 /**
3821 * Creates a hash object.
3822 *
3823 * @private
3824 * @constructor
3825 * @param {Array} [entries] The key-value pairs to cache.
3826 */
3827 function Hash(entries) {
3828 var index = -1;
3829 var length = entries == null ? 0 : entries.length;
3830 this.clear();
3831 while (++index < length) {
3832 var entry = entries[index];
3833 this.set(entry[0], entry[1]);
3834 }
3835 }
3836 /**
3837 * Removes all key-value entries from the hash.
3838 *
3839 * @private
3840 * @name clear
3841 * @memberOf Hash
3842 */
3843 function hashClear() {
3844 this.__data__ = nativeCreate ? nativeCreate(null) : {};
3845 this.size = 0;
3846 }
3847 /**
3848 * Removes `key` and its value from the hash.
3849 *
3850 * @private
3851 * @name delete
3852 * @memberOf Hash
3853 * @param {Object} hash The hash to modify.
3854 * @param {string} key The key of the value to remove.
3855 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3856 */
3857 function hashDelete(key) {
3858 var result = this.has(key) && delete this.__data__[key];
3859 this.size -= result ? 1 : 0;
3860 return result;
3861 }
3862 /**
3863 * Gets the hash value for `key`.
3864 *
3865 * @private
3866 * @name get
3867 * @memberOf Hash
3868 * @param {string} key The key of the value to get.
3869 * @returns {*} Returns the entry value.
3870 */
3871 function hashGet(key) {
3872 var data = this.__data__;
3873 if (nativeCreate) {
3874 var result = data[key];
3875 return result === HASH_UNDEFINED ? undefined : result;
3876 }
3877 return hasOwnProperty.call(data, key) ? data[key] : undefined;
3878 }
3879 /**
3880 * Checks if a hash value for `key` exists.
3881 *
3882 * @private
3883 * @name has
3884 * @memberOf Hash
3885 * @param {string} key The key of the entry to check.
3886 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3887 */
3888 function hashHas(key) {
3889 var data = this.__data__;
3890 return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
3891 }
3892 /**
3893 * Sets the hash `key` to `value`.
3894 *
3895 * @private
3896 * @name set
3897 * @memberOf Hash
3898 * @param {string} key The key of the value to set.
3899 * @param {*} value The value to set.
3900 * @returns {Object} Returns the hash instance.
3901 */
3902 function hashSet(key, value) {
3903 var data = this.__data__;
3904 this.size += this.has(key) ? 0 : 1;
3905 data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
3906 return this;
3907 }
3908 Hash.prototype.clear = hashClear;
3909 Hash.prototype["delete"] = hashDelete;
3910 Hash.prototype.get = hashGet;
3911 Hash.prototype.has = hashHas;
3912 Hash.prototype.set = hashSet;
3913 /**
3914 * Creates an list cache object.
3915 *
3916 * @private
3917 * @constructor
3918 * @param {Array} [entries] The key-value pairs to cache.
3919 */
3920 function ListCache(entries) {
3921 var index = -1;
3922 var length = entries == null ? 0 : entries.length;
3923 this.clear();
3924 while (++index < length) {
3925 var entry = entries[index];
3926 this.set(entry[0], entry[1]);
3927 }
3928 }
3929 /**
3930 * Removes all key-value entries from the list cache.
3931 *
3932 * @private
3933 * @name clear
3934 * @memberOf ListCache
3935 */
3936 function listCacheClear() {
3937 this.__data__ = [];
3938 this.size = 0;
3939 }
3940 /**
3941 * Removes `key` and its value from the list cache.
3942 *
3943 * @private
3944 * @name delete
3945 * @memberOf ListCache
3946 * @param {string} key The key of the value to remove.
3947 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3948 */
3949 function listCacheDelete(key) {
3950 var data = this.__data__;
3951 var index = assocIndexOf(data, key);
3952 if (index < 0) return false;
3953 if (index == data.length - 1) data.pop();
3954 else splice.call(data, index, 1);
3955 --this.size;
3956 return true;
3957 }
3958 /**
3959 * Gets the list cache value for `key`.
3960 *
3961 * @private
3962 * @name get
3963 * @memberOf ListCache
3964 * @param {string} key The key of the value to get.
3965 * @returns {*} Returns the entry value.
3966 */
3967 function listCacheGet(key) {
3968 var data = this.__data__;
3969 var index = assocIndexOf(data, key);
3970 return index < 0 ? undefined : data[index][1];
3971 }
3972 /**
3973 * Checks if a list cache value for `key` exists.
3974 *
3975 * @private
3976 * @name has
3977 * @memberOf ListCache
3978 * @param {string} key The key of the entry to check.
3979 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3980 */
3981 function listCacheHas(key) {
3982 return assocIndexOf(this.__data__, key) > -1;
3983 }
3984 /**
3985 * Sets the list cache `key` to `value`.
3986 *
3987 * @private
3988 * @name set
3989 * @memberOf ListCache
3990 * @param {string} key The key of the value to set.
3991 * @param {*} value The value to set.
3992 * @returns {Object} Returns the list cache instance.
3993 */
3994 function listCacheSet(key, value) {
3995 var data = this.__data__;
3996 var index = assocIndexOf(data, key);
3997 if (index < 0) {
3998 ++this.size;
3999 data.push([key, value]);
4000 } else data[index][1] = value;
4001 return this;
4002 }
4003 ListCache.prototype.clear = listCacheClear;
4004 ListCache.prototype["delete"] = listCacheDelete;
4005 ListCache.prototype.get = listCacheGet;
4006 ListCache.prototype.has = listCacheHas;
4007 ListCache.prototype.set = listCacheSet;
4008 /**
4009 * Creates a map cache object to store key-value pairs.
4010 *
4011 * @private
4012 * @constructor
4013 * @param {Array} [entries] The key-value pairs to cache.
4014 */
4015 function MapCache(entries) {
4016 var index = -1;
4017 var length = entries == null ? 0 : entries.length;
4018 this.clear();
4019 while (++index < length) {
4020 var entry = entries[index];
4021 this.set(entry[0], entry[1]);
4022 }
4023 }
4024 /**
4025 * Removes all key-value entries from the map.
4026 *
4027 * @private
4028 * @name clear
4029 * @memberOf MapCache
4030 */
4031 function mapCacheClear() {
4032 this.size = 0;
4033 this.__data__ = {
4034 "hash": new Hash(),
4035 "map": new (Map || ListCache)(),
4036 "string": new Hash()
4037 };
4038 }
4039 /**
4040 * Removes `key` and its value from the map.
4041 *
4042 * @private
4043 * @name delete
4044 * @memberOf MapCache
4045 * @param {string} key The key of the value to remove.
4046 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
4047 */
4048 function mapCacheDelete(key) {
4049 var result = getMapData(this, key)["delete"](key);
4050 this.size -= result ? 1 : 0;
4051 return result;
4052 }
4053 /**
4054 * Gets the map value for `key`.
4055 *
4056 * @private
4057 * @name get
4058 * @memberOf MapCache
4059 * @param {string} key The key of the value to get.
4060 * @returns {*} Returns the entry value.
4061 */
4062 function mapCacheGet(key) {
4063 return getMapData(this, key).get(key);
4064 }
4065 /**
4066 * Checks if a map value for `key` exists.
4067 *
4068 * @private
4069 * @name has
4070 * @memberOf MapCache
4071 * @param {string} key The key of the entry to check.
4072 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
4073 */
4074 function mapCacheHas(key) {
4075 return getMapData(this, key).has(key);
4076 }
4077 /**
4078 * Sets the map `key` to `value`.
4079 *
4080 * @private
4081 * @name set
4082 * @memberOf MapCache
4083 * @param {string} key The key of the value to set.
4084 * @param {*} value The value to set.
4085 * @returns {Object} Returns the map cache instance.
4086 */
4087 function mapCacheSet(key, value) {
4088 var data = getMapData(this, key);
4089 var size = data.size;
4090 data.set(key, value);
4091 this.size += data.size == size ? 0 : 1;
4092 return this;
4093 }
4094 MapCache.prototype.clear = mapCacheClear;
4095 MapCache.prototype["delete"] = mapCacheDelete;
4096 MapCache.prototype.get = mapCacheGet;
4097 MapCache.prototype.has = mapCacheHas;
4098 MapCache.prototype.set = mapCacheSet;
4099 /**
4100 *
4101 * Creates an array cache object to store unique values.
4102 *
4103 * @private
4104 * @constructor
4105 * @param {Array} [values] The values to cache.
4106 */
4107 function SetCache(values) {
4108 var index = -1;
4109 var length = values == null ? 0 : values.length;
4110 this.__data__ = new MapCache();
4111 while (++index < length) this.add(values[index]);
4112 }
4113 /**
4114 * Adds `value` to the array cache.
4115 *
4116 * @private
4117 * @name add
4118 * @memberOf SetCache
4119 * @alias push
4120 * @param {*} value The value to cache.
4121 * @returns {Object} Returns the cache instance.
4122 */
4123 function setCacheAdd(value) {
4124 this.__data__.set(value, HASH_UNDEFINED);
4125 return this;
4126 }
4127 /**
4128 * Checks if `value` is in the array cache.
4129 *
4130 * @private
4131 * @name has
4132 * @memberOf SetCache
4133 * @param {*} value The value to search for.
4134 * @returns {boolean} Returns `true` if `value` is found, else `false`.
4135 */
4136 function setCacheHas(value) {
4137 return this.__data__.has(value);
4138 }
4139 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
4140 SetCache.prototype.has = setCacheHas;
4141 /**
4142 * Creates a stack cache object to store key-value pairs.
4143 *
4144 * @private
4145 * @constructor
4146 * @param {Array} [entries] The key-value pairs to cache.
4147 */
4148 function Stack(entries) {
4149 var data = this.__data__ = new ListCache(entries);
4150 this.size = data.size;
4151 }
4152 /**
4153 * Removes all key-value entries from the stack.
4154 *
4155 * @private
4156 * @name clear
4157 * @memberOf Stack
4158 */
4159 function stackClear() {
4160 this.__data__ = new ListCache();
4161 this.size = 0;
4162 }
4163 /**
4164 * Removes `key` and its value from the stack.
4165 *
4166 * @private
4167 * @name delete
4168 * @memberOf Stack
4169 * @param {string} key The key of the value to remove.
4170 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
4171 */
4172 function stackDelete(key) {
4173 var data = this.__data__;
4174 var result = data["delete"](key);
4175 this.size = data.size;
4176 return result;
4177 }
4178 /**
4179 * Gets the stack value for `key`.
4180 *
4181 * @private
4182 * @name get
4183 * @memberOf Stack
4184 * @param {string} key The key of the value to get.
4185 * @returns {*} Returns the entry value.
4186 */
4187 function stackGet(key) {
4188 return this.__data__.get(key);
4189 }
4190 /**
4191 * Checks if a stack value for `key` exists.
4192 *
4193 * @private
4194 * @name has
4195 * @memberOf Stack
4196 * @param {string} key The key of the entry to check.
4197 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
4198 */
4199 function stackHas(key) {
4200 return this.__data__.has(key);
4201 }
4202 /**
4203 * Sets the stack `key` to `value`.
4204 *
4205 * @private
4206 * @name set
4207 * @memberOf Stack
4208 * @param {string} key The key of the value to set.
4209 * @param {*} value The value to set.
4210 * @returns {Object} Returns the stack cache instance.
4211 */
4212 function stackSet(key, value) {
4213 var data = this.__data__;
4214 if (data instanceof ListCache) {
4215 var pairs = data.__data__;
4216 if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
4217 pairs.push([key, value]);
4218 this.size = ++data.size;
4219 return this;
4220 }
4221 data = this.__data__ = new MapCache(pairs);
4222 }
4223 data.set(key, value);
4224 this.size = data.size;
4225 return this;
4226 }
4227 Stack.prototype.clear = stackClear;
4228 Stack.prototype["delete"] = stackDelete;
4229 Stack.prototype.get = stackGet;
4230 Stack.prototype.has = stackHas;
4231 Stack.prototype.set = stackSet;
4232 /**
4233 * Creates an array of the enumerable property names of the array-like `value`.
4234 *
4235 * @private
4236 * @param {*} value The value to query.
4237 * @param {boolean} inherited Specify returning inherited property names.
4238 * @returns {Array} Returns the array of property names.
4239 */
4240 function arrayLikeKeys(value, inherited) {
4241 var isArr = isArray(value);
4242 var isArg = !isArr && isArguments(value);
4243 var isBuff = !isArr && !isArg && isBuffer(value);
4244 var isType = !isArr && !isArg && !isBuff && isTypedArray(value);
4245 var skipIndexes = isArr || isArg || isBuff || isType;
4246 var result = skipIndexes ? baseTimes(value.length, String) : [];
4247 var length = result.length;
4248 for (var key in value) if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) result.push(key);
4249 return result;
4250 }
4251 /**
4252 * A specialized version of `_.sample` for arrays.
4253 *
4254 * @private
4255 * @param {Array} array The array to sample.
4256 * @returns {*} Returns the random element.
4257 */
4258 function arraySample(array) {
4259 var length = array.length;
4260 return length ? array[baseRandom(0, length - 1)] : undefined;
4261 }
4262 /**
4263 * A specialized version of `_.sampleSize` for arrays.
4264 *
4265 * @private
4266 * @param {Array} array The array to sample.
4267 * @param {number} n The number of elements to sample.
4268 * @returns {Array} Returns the random elements.
4269 */
4270 function arraySampleSize(array, n) {
4271 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
4272 }
4273 /**
4274 * A specialized version of `_.shuffle` for arrays.
4275 *
4276 * @private
4277 * @param {Array} array The array to shuffle.
4278 * @returns {Array} Returns the new shuffled array.
4279 */
4280 function arrayShuffle(array) {
4281 return shuffleSelf(copyArray(array));
4282 }
4283 /**
4284 * This function is like `assignValue` except that it doesn't assign
4285 * `undefined` values.
4286 *
4287 * @private
4288 * @param {Object} object The object to modify.
4289 * @param {string} key The key of the property to assign.
4290 * @param {*} value The value to assign.
4291 */
4292 function assignMergeValue(object, key, value) {
4293 if (value !== undefined && !eq(object[key], value) || value === undefined && !(key in object)) baseAssignValue(object, key, value);
4294 }
4295 /**
4296 * Assigns `value` to `key` of `object` if the existing value is not equivalent
4297 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
4298 * for equality comparisons.
4299 *
4300 * @private
4301 * @param {Object} object The object to modify.
4302 * @param {string} key The key of the property to assign.
4303 * @param {*} value The value to assign.
4304 */
4305 function assignValue(object, key, value) {
4306 var objValue = object[key];
4307 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) baseAssignValue(object, key, value);
4308 }
4309 /**
4310 * Gets the index at which the `key` is found in `array` of key-value pairs.
4311 *
4312 * @private
4313 * @param {Array} array The array to inspect.
4314 * @param {*} key The key to search for.
4315 * @returns {number} Returns the index of the matched value, else `-1`.
4316 */
4317 function assocIndexOf(array, key) {
4318 var length = array.length;
4319 while (length--) if (eq(array[length][0], key)) return length;
4320 return -1;
4321 }
4322 /**
4323 * Aggregates elements of `collection` on `accumulator` with keys transformed
4324 * by `iteratee` and values set by `setter`.
4325 *
4326 * @private
4327 * @param {Array|Object} collection The collection to iterate over.
4328 * @param {Function} setter The function to set `accumulator` values.
4329 * @param {Function} iteratee The iteratee to transform keys.
4330 * @param {Object} accumulator The initial aggregated object.
4331 * @returns {Function} Returns `accumulator`.
4332 */
4333 function baseAggregator(collection, setter, iteratee, accumulator) {
4334 baseEach(collection, function(value, key, collection) {
4335 setter(accumulator, value, iteratee(value), collection);
4336 });
4337 return accumulator;
4338 }
4339 /**
4340 * The base implementation of `_.assign` without support for multiple sources
4341 * or `customizer` functions.
4342 *
4343 * @private
4344 * @param {Object} object The destination object.
4345 * @param {Object} source The source object.
4346 * @returns {Object} Returns `object`.
4347 */
4348 function baseAssign(object, source) {
4349 return object && copyObject(source, keys(source), object);
4350 }
4351 /**
4352 * The base implementation of `_.assignIn` without support for multiple sources
4353 * or `customizer` functions.
4354 *
4355 * @private
4356 * @param {Object} object The destination object.
4357 * @param {Object} source The source object.
4358 * @returns {Object} Returns `object`.
4359 */
4360 function baseAssignIn(object, source) {
4361 return object && copyObject(source, keysIn(source), object);
4362 }
4363 /**
4364 * The base implementation of `assignValue` and `assignMergeValue` without
4365 * value checks.
4366 *
4367 * @private
4368 * @param {Object} object The object to modify.
4369 * @param {string} key The key of the property to assign.
4370 * @param {*} value The value to assign.
4371 */
4372 function baseAssignValue(object, key, value) {
4373 if (key == "__proto__" && defineProperty) defineProperty(object, key, {
4374 "configurable": true,
4375 "enumerable": true,
4376 "value": value,
4377 "writable": true
4378 });
4379 else object[key] = value;
4380 }
4381 /**
4382 * The base implementation of `_.at` without support for individual paths.
4383 *
4384 * @private
4385 * @param {Object} object The object to iterate over.
4386 * @param {string[]} paths The property paths to pick.
4387 * @returns {Array} Returns the picked elements.
4388 */
4389 function baseAt(object, paths) {
4390 var index = -1;
4391 var length = paths.length;
4392 var result = Array(length);
4393 var skip = object == null;
4394 while (++index < length) result[index] = skip ? undefined : get(object, paths[index]);
4395 return result;
4396 }
4397 /**
4398 * The base implementation of `_.clamp` which doesn't coerce arguments.
4399 *
4400 * @private
4401 * @param {number} number The number to clamp.
4402 * @param {number} [lower] The lower bound.
4403 * @param {number} upper The upper bound.
4404 * @returns {number} Returns the clamped number.
4405 */
4406 function baseClamp(number, lower, upper) {
4407 if (number === number) {
4408 if (upper !== undefined) number = number <= upper ? number : upper;
4409 if (lower !== undefined) number = number >= lower ? number : lower;
4410 }
4411 return number;
4412 }
4413 /**
4414 * The base implementation of `_.clone` and `_.cloneDeep` which tracks
4415 * traversed objects.
4416 *
4417 * @private
4418 * @param {*} value The value to clone.
4419 * @param {boolean} bitmask The bitmask flags.
4420 * 1 - Deep clone
4421 * 2 - Flatten inherited properties
4422 * 4 - Clone symbols
4423 * @param {Function} [customizer] The function to customize cloning.
4424 * @param {string} [key] The key of `value`.
4425 * @param {Object} [object] The parent object of `value`.
4426 * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
4427 * @returns {*} Returns the cloned value.
4428 */
4429 function baseClone(value, bitmask, customizer, key, object, stack) {
4430 var result;
4431 var isDeep = bitmask & CLONE_DEEP_FLAG;
4432 var isFlat = bitmask & CLONE_FLAT_FLAG;
4433 var isFull = bitmask & CLONE_SYMBOLS_FLAG;
4434 if (customizer) result = object ? customizer(value, key, object, stack) : customizer(value);
4435 if (result !== undefined) return result;
4436 if (!isObject(value)) return value;
4437 var isArr = isArray(value);
4438 if (isArr) {
4439 result = initCloneArray(value);
4440 if (!isDeep) return copyArray(value, result);
4441 } else {
4442 var tag = getTag(value);
4443 var isFunc = tag == funcTag || tag == genTag;
4444 if (isBuffer(value)) return cloneBuffer(value, isDeep);
4445 if (tag == objectTag || tag == argsTag || isFunc && !object) {
4446 result = isFlat || isFunc ? {} : initCloneObject(value);
4447 if (!isDeep) return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
4448 } else {
4449 if (!cloneableTags[tag]) return object ? value : {};
4450 result = initCloneByTag(value, tag, isDeep);
4451 }
4452 }
4453 stack || (stack = new Stack());
4454 var stacked = stack.get(value);
4455 if (stacked) return stacked;
4456 stack.set(value, result);
4457 if (isSet(value)) value.forEach(function(subValue) {
4458 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
4459 });
4460 else if (isMap(value)) value.forEach(function(subValue, key) {
4461 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
4462 });
4463 var props = isArr ? undefined : (isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys)(value);
4464 arrayEach(props || value, function(subValue, key) {
4465 if (props) {
4466 key = subValue;
4467 subValue = value[key];
4468 }
4469 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
4470 });
4471 return result;
4472 }
4473 /**
4474 * The base implementation of `_.conforms` which doesn't clone `source`.
4475 *
4476 * @private
4477 * @param {Object} source The object of property predicates to conform to.
4478 * @returns {Function} Returns the new spec function.
4479 */
4480 function baseConforms(source) {
4481 var props = keys(source);
4482 return function(object) {
4483 return baseConformsTo(object, source, props);
4484 };
4485 }
4486 /**
4487 * The base implementation of `_.conformsTo` which accepts `props` to check.
4488 *
4489 * @private
4490 * @param {Object} object The object to inspect.
4491 * @param {Object} source The object of property predicates to conform to.
4492 * @returns {boolean} Returns `true` if `object` conforms, else `false`.
4493 */
4494 function baseConformsTo(object, source, props) {
4495 var length = props.length;
4496 if (object == null) return !length;
4497 object = Object(object);
4498 while (length--) {
4499 var key = props[length];
4500 var predicate = source[key];
4501 var value = object[key];
4502 if (value === undefined && !(key in object) || !predicate(value)) return false;
4503 }
4504 return true;
4505 }
4506 /**
4507 * The base implementation of `_.delay` and `_.defer` which accepts `args`
4508 * to provide to `func`.
4509 *
4510 * @private
4511 * @param {Function} func The function to delay.
4512 * @param {number} wait The number of milliseconds to delay invocation.
4513 * @param {Array} args The arguments to provide to `func`.
4514 * @returns {number|Object} Returns the timer id or timeout object.
4515 */
4516 function baseDelay(func, wait, args) {
4517 if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
4518 return setTimeout(function() {
4519 func.apply(undefined, args);
4520 }, wait);
4521 }
4522 /**
4523 * The base implementation of methods like `_.difference` without support
4524 * for excluding multiple arrays or iteratee shorthands.
4525 *
4526 * @private
4527 * @param {Array} array The array to inspect.
4528 * @param {Array} values The values to exclude.
4529 * @param {Function} [iteratee] The iteratee invoked per element.
4530 * @param {Function} [comparator] The comparator invoked per element.
4531 * @returns {Array} Returns the new array of filtered values.
4532 */
4533 function baseDifference(array, values, iteratee, comparator) {
4534 var index = -1;
4535 var includes = arrayIncludes;
4536 var isCommon = true;
4537 var length = array.length;
4538 var result = [];
4539 var valuesLength = values.length;
4540 if (!length) return result;
4541 if (iteratee) values = arrayMap(values, baseUnary(iteratee));
4542 if (comparator) {
4543 includes = arrayIncludesWith;
4544 isCommon = false;
4545 } else if (values.length >= LARGE_ARRAY_SIZE) {
4546 includes = cacheHas;
4547 isCommon = false;
4548 values = new SetCache(values);
4549 }
4550 outer: while (++index < length) {
4551 var value = array[index];
4552 var computed = iteratee == null ? value : iteratee(value);
4553 value = comparator || value !== 0 ? value : 0;
4554 if (isCommon && computed === computed) {
4555 var valuesIndex = valuesLength;
4556 while (valuesIndex--) if (values[valuesIndex] === computed) continue outer;
4557 result.push(value);
4558 } else if (!includes(values, computed, comparator)) result.push(value);
4559 }
4560 return result;
4561 }
4562 /**
4563 * The base implementation of `_.forEach` without support for iteratee shorthands.
4564 *
4565 * @private
4566 * @param {Array|Object} collection The collection to iterate over.
4567 * @param {Function} iteratee The function invoked per iteration.
4568 * @returns {Array|Object} Returns `collection`.
4569 */
4570 var baseEach = createBaseEach(baseForOwn);
4571 /**
4572 * The base implementation of `_.forEachRight` without support for iteratee shorthands.
4573 *
4574 * @private
4575 * @param {Array|Object} collection The collection to iterate over.
4576 * @param {Function} iteratee The function invoked per iteration.
4577 * @returns {Array|Object} Returns `collection`.
4578 */
4579 var baseEachRight = createBaseEach(baseForOwnRight, true);
4580 /**
4581 * The base implementation of `_.every` without support for iteratee shorthands.
4582 *
4583 * @private
4584 * @param {Array|Object} collection The collection to iterate over.
4585 * @param {Function} predicate The function invoked per iteration.
4586 * @returns {boolean} Returns `true` if all elements pass the predicate check,
4587 * else `false`
4588 */
4589 function baseEvery(collection, predicate) {
4590 var result = true;
4591 baseEach(collection, function(value, index, collection) {
4592 result = !!predicate(value, index, collection);
4593 return result;
4594 });
4595 return result;
4596 }
4597 /**
4598 * The base implementation of methods like `_.max` and `_.min` which accepts a
4599 * `comparator` to determine the extremum value.
4600 *
4601 * @private
4602 * @param {Array} array The array to iterate over.
4603 * @param {Function} iteratee The iteratee invoked per iteration.
4604 * @param {Function} comparator The comparator used to compare values.
4605 * @returns {*} Returns the extremum value.
4606 */
4607 function baseExtremum(array, iteratee, comparator) {
4608 var index = -1;
4609 var length = array.length;
4610 while (++index < length) {
4611 var value = array[index];
4612 var current = iteratee(value);
4613 if (current != null && (computed === undefined ? current === current && !isSymbol(current) : comparator(current, computed))) {
4614 var computed = current;
4615 var result = value;
4616 }
4617 }
4618 return result;
4619 }
4620 /**
4621 * The base implementation of `_.fill` without an iteratee call guard.
4622 *
4623 * @private
4624 * @param {Array} array The array to fill.
4625 * @param {*} value The value to fill `array` with.
4626 * @param {number} [start=0] The start position.
4627 * @param {number} [end=array.length] The end position.
4628 * @returns {Array} Returns `array`.
4629 */
4630 function baseFill(array, value, start, end) {
4631 var length = array.length;
4632 start = toInteger(start);
4633 if (start < 0) start = -start > length ? 0 : length + start;
4634 end = end === undefined || end > length ? length : toInteger(end);
4635 if (end < 0) end += length;
4636 end = start > end ? 0 : toLength(end);
4637 while (start < end) array[start++] = value;
4638 return array;
4639 }
4640 /**
4641 * The base implementation of `_.filter` without support for iteratee shorthands.
4642 *
4643 * @private
4644 * @param {Array|Object} collection The collection to iterate over.
4645 * @param {Function} predicate The function invoked per iteration.
4646 * @returns {Array} Returns the new filtered array.
4647 */
4648 function baseFilter(collection, predicate) {
4649 var result = [];
4650 baseEach(collection, function(value, index, collection) {
4651 if (predicate(value, index, collection)) result.push(value);
4652 });
4653 return result;
4654 }
4655 /**
4656 * The base implementation of `_.flatten` with support for restricting flattening.
4657 *
4658 * @private
4659 * @param {Array} array The array to flatten.
4660 * @param {number} depth The maximum recursion depth.
4661 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
4662 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
4663 * @param {Array} [result=[]] The initial result value.
4664 * @returns {Array} Returns the new flattened array.
4665 */
4666 function baseFlatten(array, depth, predicate, isStrict, result) {
4667 var index = -1;
4668 var length = array.length;
4669 predicate || (predicate = isFlattenable);
4670 result || (result = []);
4671 while (++index < length) {
4672 var value = array[index];
4673 if (depth > 0 && predicate(value)) if (depth > 1) baseFlatten(value, depth - 1, predicate, isStrict, result);
4674 else arrayPush(result, value);
4675 else if (!isStrict) result[result.length] = value;
4676 }
4677 return result;
4678 }
4679 /**
4680 * The base implementation of `baseForOwn` which iterates over `object`
4681 * properties returned by `keysFunc` and invokes `iteratee` for each property.
4682 * Iteratee functions may exit iteration early by explicitly returning `false`.
4683 *
4684 * @private
4685 * @param {Object} object The object to iterate over.
4686 * @param {Function} iteratee The function invoked per iteration.
4687 * @param {Function} keysFunc The function to get the keys of `object`.
4688 * @returns {Object} Returns `object`.
4689 */
4690 var baseFor = createBaseFor();
4691 /**
4692 * This function is like `baseFor` except that it iterates over properties
4693 * in the opposite order.
4694 *
4695 * @private
4696 * @param {Object} object The object to iterate over.
4697 * @param {Function} iteratee The function invoked per iteration.
4698 * @param {Function} keysFunc The function to get the keys of `object`.
4699 * @returns {Object} Returns `object`.
4700 */
4701 var baseForRight = createBaseFor(true);
4702 /**
4703 * The base implementation of `_.forOwn` without support for iteratee shorthands.
4704 *
4705 * @private
4706 * @param {Object} object The object to iterate over.
4707 * @param {Function} iteratee The function invoked per iteration.
4708 * @returns {Object} Returns `object`.
4709 */
4710 function baseForOwn(object, iteratee) {
4711 return object && baseFor(object, iteratee, keys);
4712 }
4713 /**
4714 * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
4715 *
4716 * @private
4717 * @param {Object} object The object to iterate over.
4718 * @param {Function} iteratee The function invoked per iteration.
4719 * @returns {Object} Returns `object`.
4720 */
4721 function baseForOwnRight(object, iteratee) {
4722 return object && baseForRight(object, iteratee, keys);
4723 }
4724 /**
4725 * The base implementation of `_.functions` which creates an array of
4726 * `object` function property names filtered from `props`.
4727 *
4728 * @private
4729 * @param {Object} object The object to inspect.
4730 * @param {Array} props The property names to filter.
4731 * @returns {Array} Returns the function names.
4732 */
4733 function baseFunctions(object, props) {
4734 return arrayFilter(props, function(key) {
4735 return isFunction(object[key]);
4736 });
4737 }
4738 /**
4739 * The base implementation of `_.get` without support for default values.
4740 *
4741 * @private
4742 * @param {Object} object The object to query.
4743 * @param {Array|string} path The path of the property to get.
4744 * @returns {*} Returns the resolved value.
4745 */
4746 function baseGet(object, path) {
4747 path = castPath(path, object);
4748 var index = 0;
4749 var length = path.length;
4750 while (object != null && index < length) object = object[toKey(path[index++])];
4751 return index && index == length ? object : undefined;
4752 }
4753 /**
4754 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
4755 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
4756 * symbols of `object`.
4757 *
4758 * @private
4759 * @param {Object} object The object to query.
4760 * @param {Function} keysFunc The function to get the keys of `object`.
4761 * @param {Function} symbolsFunc The function to get the symbols of `object`.
4762 * @returns {Array} Returns the array of property names and symbols.
4763 */
4764 function baseGetAllKeys(object, keysFunc, symbolsFunc) {
4765 var result = keysFunc(object);
4766 return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
4767 }
4768 /**
4769 * The base implementation of `getTag` without fallbacks for buggy environments.
4770 *
4771 * @private
4772 * @param {*} value The value to query.
4773 * @returns {string} Returns the `toStringTag`.
4774 */
4775 function baseGetTag(value) {
4776 if (value == null) return value === undefined ? undefinedTag : nullTag;
4777 return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
4778 }
4779 /**
4780 * The base implementation of `_.gt` which doesn't coerce arguments.
4781 *
4782 * @private
4783 * @param {*} value The value to compare.
4784 * @param {*} other The other value to compare.
4785 * @returns {boolean} Returns `true` if `value` is greater than `other`,
4786 * else `false`.
4787 */
4788 function baseGt(value, other) {
4789 return value > other;
4790 }
4791 /**
4792 * The base implementation of `_.has` without support for deep paths.
4793 *
4794 * @private
4795 * @param {Object} [object] The object to query.
4796 * @param {Array|string} key The key to check.
4797 * @returns {boolean} Returns `true` if `key` exists, else `false`.
4798 */
4799 function baseHas(object, key) {
4800 return object != null && hasOwnProperty.call(object, key);
4801 }
4802 /**
4803 * The base implementation of `_.hasIn` without support for deep paths.
4804 *
4805 * @private
4806 * @param {Object} [object] The object to query.
4807 * @param {Array|string} key The key to check.
4808 * @returns {boolean} Returns `true` if `key` exists, else `false`.
4809 */
4810 function baseHasIn(object, key) {
4811 return object != null && key in Object(object);
4812 }
4813 /**
4814 * The base implementation of `_.inRange` which doesn't coerce arguments.
4815 *
4816 * @private
4817 * @param {number} number The number to check.
4818 * @param {number} start The start of the range.
4819 * @param {number} end The end of the range.
4820 * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
4821 */
4822 function baseInRange(number, start, end) {
4823 return number >= nativeMin(start, end) && number < nativeMax(start, end);
4824 }
4825 /**
4826 * The base implementation of methods like `_.intersection`, without support
4827 * for iteratee shorthands, that accepts an array of arrays to inspect.
4828 *
4829 * @private
4830 * @param {Array} arrays The arrays to inspect.
4831 * @param {Function} [iteratee] The iteratee invoked per element.
4832 * @param {Function} [comparator] The comparator invoked per element.
4833 * @returns {Array} Returns the new array of shared values.
4834 */
4835 function baseIntersection(arrays, iteratee, comparator) {
4836 var includes = comparator ? arrayIncludesWith : arrayIncludes;
4837 var length = arrays[0].length;
4838 var othLength = arrays.length;
4839 var othIndex = othLength;
4840 var caches = Array(othLength);
4841 var maxLength = Infinity;
4842 var result = [];
4843 while (othIndex--) {
4844 var array = arrays[othIndex];
4845 if (othIndex && iteratee) array = arrayMap(array, baseUnary(iteratee));
4846 maxLength = nativeMin(array.length, maxLength);
4847 caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined;
4848 }
4849 array = arrays[0];
4850 var index = -1;
4851 var seen = caches[0];
4852 outer: while (++index < length && result.length < maxLength) {
4853 var value = array[index];
4854 var computed = iteratee ? iteratee(value) : value;
4855 value = comparator || value !== 0 ? value : 0;
4856 if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
4857 othIndex = othLength;
4858 while (--othIndex) {
4859 var cache = caches[othIndex];
4860 if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) continue outer;
4861 }
4862 if (seen) seen.push(computed);
4863 result.push(value);
4864 }
4865 }
4866 return result;
4867 }
4868 /**
4869 * The base implementation of `_.invert` and `_.invertBy` which inverts
4870 * `object` with values transformed by `iteratee` and set by `setter`.
4871 *
4872 * @private
4873 * @param {Object} object The object to iterate over.
4874 * @param {Function} setter The function to set `accumulator` values.
4875 * @param {Function} iteratee The iteratee to transform values.
4876 * @param {Object} accumulator The initial inverted object.
4877 * @returns {Function} Returns `accumulator`.
4878 */
4879 function baseInverter(object, setter, iteratee, accumulator) {
4880 baseForOwn(object, function(value, key, object) {
4881 setter(accumulator, iteratee(value), key, object);
4882 });
4883 return accumulator;
4884 }
4885 /**
4886 * The base implementation of `_.invoke` without support for individual
4887 * method arguments.
4888 *
4889 * @private
4890 * @param {Object} object The object to query.
4891 * @param {Array|string} path The path of the method to invoke.
4892 * @param {Array} args The arguments to invoke the method with.
4893 * @returns {*} Returns the result of the invoked method.
4894 */
4895 function baseInvoke(object, path, args) {
4896 path = castPath(path, object);
4897 object = parent(object, path);
4898 var func = object == null ? object : object[toKey(last(path))];
4899 return func == null ? undefined : apply(func, object, args);
4900 }
4901 /**
4902 * The base implementation of `_.isArguments`.
4903 *
4904 * @private
4905 * @param {*} value The value to check.
4906 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
4907 */
4908 function baseIsArguments(value) {
4909 return isObjectLike(value) && baseGetTag(value) == argsTag;
4910 }
4911 /**
4912 * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
4913 *
4914 * @private
4915 * @param {*} value The value to check.
4916 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
4917 */
4918 function baseIsArrayBuffer(value) {
4919 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
4920 }
4921 /**
4922 * The base implementation of `_.isDate` without Node.js optimizations.
4923 *
4924 * @private
4925 * @param {*} value The value to check.
4926 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
4927 */
4928 function baseIsDate(value) {
4929 return isObjectLike(value) && baseGetTag(value) == dateTag;
4930 }
4931 /**
4932 * The base implementation of `_.isEqual` which supports partial comparisons
4933 * and tracks traversed objects.
4934 *
4935 * @private
4936 * @param {*} value The value to compare.
4937 * @param {*} other The other value to compare.
4938 * @param {boolean} bitmask The bitmask flags.
4939 * 1 - Unordered comparison
4940 * 2 - Partial comparison
4941 * @param {Function} [customizer] The function to customize comparisons.
4942 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
4943 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
4944 */
4945 function baseIsEqual(value, other, bitmask, customizer, stack) {
4946 if (value === other) return true;
4947 if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) return value !== value && other !== other;
4948 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
4949 }
4950 /**
4951 * A specialized version of `baseIsEqual` for arrays and objects which performs
4952 * deep comparisons and tracks traversed objects enabling objects with circular
4953 * references to be compared.
4954 *
4955 * @private
4956 * @param {Object} object The object to compare.
4957 * @param {Object} other The other object to compare.
4958 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
4959 * @param {Function} customizer The function to customize comparisons.
4960 * @param {Function} equalFunc The function to determine equivalents of values.
4961 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
4962 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
4963 */
4964 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
4965 var objIsArr = isArray(object);
4966 var othIsArr = isArray(other);
4967 var objTag = objIsArr ? arrayTag : getTag(object);
4968 var othTag = othIsArr ? arrayTag : getTag(other);
4969 objTag = objTag == argsTag ? objectTag : objTag;
4970 othTag = othTag == argsTag ? objectTag : othTag;
4971 var objIsObj = objTag == objectTag;
4972 var othIsObj = othTag == objectTag;
4973 var isSameTag = objTag == othTag;
4974 if (isSameTag && isBuffer(object)) {
4975 if (!isBuffer(other)) return false;
4976 objIsArr = true;
4977 objIsObj = false;
4978 }
4979 if (isSameTag && !objIsObj) {
4980 stack || (stack = new Stack());
4981 return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
4982 }
4983 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
4984 var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__");
4985 var othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
4986 if (objIsWrapped || othIsWrapped) {
4987 var objUnwrapped = objIsWrapped ? object.value() : object;
4988 var othUnwrapped = othIsWrapped ? other.value() : other;
4989 stack || (stack = new Stack());
4990 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
4991 }
4992 }
4993 if (!isSameTag) return false;
4994 stack || (stack = new Stack());
4995 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
4996 }
4997 /**
4998 * The base implementation of `_.isMap` without Node.js optimizations.
4999 *
5000 * @private
5001 * @param {*} value The value to check.
5002 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
5003 */
5004 function baseIsMap(value) {
5005 return isObjectLike(value) && getTag(value) == mapTag;
5006 }
5007 /**
5008 * The base implementation of `_.isMatch` without support for iteratee shorthands.
5009 *
5010 * @private
5011 * @param {Object} object The object to inspect.
5012 * @param {Object} source The object of property values to match.
5013 * @param {Array} matchData The property names, values, and compare flags to match.
5014 * @param {Function} [customizer] The function to customize comparisons.
5015 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
5016 */
5017 function baseIsMatch(object, source, matchData, customizer) {
5018 var index = matchData.length;
5019 var length = index;
5020 var noCustomizer = !customizer;
5021 if (object == null) return !length;
5022 object = Object(object);
5023 while (index--) {
5024 var data = matchData[index];
5025 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) return false;
5026 }
5027 while (++index < length) {
5028 data = matchData[index];
5029 var key = data[0];
5030 var objValue = object[key];
5031 var srcValue = data[1];
5032 if (noCustomizer && data[2]) {
5033 if (objValue === undefined && !(key in object)) return false;
5034 } else {
5035 var stack = new Stack();
5036 if (customizer) var result = customizer(objValue, srcValue, key, object, source, stack);
5037 if (!(result === undefined ? baseIsEqual(srcValue, objValue, 3, customizer, stack) : result)) return false;
5038 }
5039 }
5040 return true;
5041 }
5042 /**
5043 * The base implementation of `_.isNative` without bad shim checks.
5044 *
5045 * @private
5046 * @param {*} value The value to check.
5047 * @returns {boolean} Returns `true` if `value` is a native function,
5048 * else `false`.
5049 */
5050 function baseIsNative(value) {
5051 if (!isObject(value) || isMasked(value)) return false;
5052 return (isFunction(value) ? reIsNative : reIsHostCtor).test(toSource(value));
5053 }
5054 /**
5055 * The base implementation of `_.isRegExp` without Node.js optimizations.
5056 *
5057 * @private
5058 * @param {*} value The value to check.
5059 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
5060 */
5061 function baseIsRegExp(value) {
5062 return isObjectLike(value) && baseGetTag(value) == regexpTag;
5063 }
5064 /**
5065 * The base implementation of `_.isSet` without Node.js optimizations.
5066 *
5067 * @private
5068 * @param {*} value The value to check.
5069 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
5070 */
5071 function baseIsSet(value) {
5072 return isObjectLike(value) && getTag(value) == setTag;
5073 }
5074 /**
5075 * The base implementation of `_.isTypedArray` without Node.js optimizations.
5076 *
5077 * @private
5078 * @param {*} value The value to check.
5079 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
5080 */
5081 function baseIsTypedArray(value) {
5082 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
5083 }
5084 /**
5085 * The base implementation of `_.iteratee`.
5086 *
5087 * @private
5088 * @param {*} [value=_.identity] The value to convert to an iteratee.
5089 * @returns {Function} Returns the iteratee.
5090 */
5091 function baseIteratee(value) {
5092 if (typeof value == "function") return value;
5093 if (value == null) return identity;
5094 if (typeof value == "object") return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
5095 return property(value);
5096 }
5097 /**
5098 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
5099 *
5100 * @private
5101 * @param {Object} object The object to query.
5102 * @returns {Array} Returns the array of property names.
5103 */
5104 function baseKeys(object) {
5105 if (!isPrototype(object)) return nativeKeys(object);
5106 var result = [];
5107 for (var key in Object(object)) if (hasOwnProperty.call(object, key) && key != "constructor") result.push(key);
5108 return result;
5109 }
5110 /**
5111 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
5112 *
5113 * @private
5114 * @param {Object} object The object to query.
5115 * @returns {Array} Returns the array of property names.
5116 */
5117 function baseKeysIn(object) {
5118 if (!isObject(object)) return nativeKeysIn(object);
5119 var isProto = isPrototype(object);
5120 var result = [];
5121 for (var key in object) if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) result.push(key);
5122 return result;
5123 }
5124 /**
5125 * The base implementation of `_.lt` which doesn't coerce arguments.
5126 *
5127 * @private
5128 * @param {*} value The value to compare.
5129 * @param {*} other The other value to compare.
5130 * @returns {boolean} Returns `true` if `value` is less than `other`,
5131 * else `false`.
5132 */
5133 function baseLt(value, other) {
5134 return value < other;
5135 }
5136 /**
5137 * The base implementation of `_.map` without support for iteratee shorthands.
5138 *
5139 * @private
5140 * @param {Array|Object} collection The collection to iterate over.
5141 * @param {Function} iteratee The function invoked per iteration.
5142 * @returns {Array} Returns the new mapped array.
5143 */
5144 function baseMap(collection, iteratee) {
5145 var index = -1;
5146 var result = isArrayLike(collection) ? Array(collection.length) : [];
5147 baseEach(collection, function(value, key, collection) {
5148 result[++index] = iteratee(value, key, collection);
5149 });
5150 return result;
5151 }
5152 /**
5153 * The base implementation of `_.matches` which doesn't clone `source`.
5154 *
5155 * @private
5156 * @param {Object} source The object of property values to match.
5157 * @returns {Function} Returns the new spec function.
5158 */
5159 function baseMatches(source) {
5160 var matchData = getMatchData(source);
5161 if (matchData.length == 1 && matchData[0][2]) return matchesStrictComparable(matchData[0][0], matchData[0][1]);
5162 return function(object) {
5163 return object === source || baseIsMatch(object, source, matchData);
5164 };
5165 }
5166 /**
5167 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
5168 *
5169 * @private
5170 * @param {string} path The path of the property to get.
5171 * @param {*} srcValue The value to match.
5172 * @returns {Function} Returns the new spec function.
5173 */
5174 function baseMatchesProperty(path, srcValue) {
5175 if (isKey(path) && isStrictComparable(srcValue)) return matchesStrictComparable(toKey(path), srcValue);
5176 return function(object) {
5177 var objValue = get(object, path);
5178 return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, 3);
5179 };
5180 }
5181 /**
5182 * The base implementation of `_.merge` without support for multiple sources.
5183 *
5184 * @private
5185 * @param {Object} object The destination object.
5186 * @param {Object} source The source object.
5187 * @param {number} srcIndex The index of `source`.
5188 * @param {Function} [customizer] The function to customize merged values.
5189 * @param {Object} [stack] Tracks traversed source values and their merged
5190 * counterparts.
5191 */
5192 function baseMerge(object, source, srcIndex, customizer, stack) {
5193 if (object === source) return;
5194 baseFor(source, function(srcValue, key) {
5195 stack || (stack = new Stack());
5196 if (isObject(srcValue)) baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
5197 else {
5198 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined;
5199 if (newValue === undefined) newValue = srcValue;
5200 assignMergeValue(object, key, newValue);
5201 }
5202 }, keysIn);
5203 }
5204 /**
5205 * A specialized version of `baseMerge` for arrays and objects which performs
5206 * deep merges and tracks traversed objects enabling objects with circular
5207 * references to be merged.
5208 *
5209 * @private
5210 * @param {Object} object The destination object.
5211 * @param {Object} source The source object.
5212 * @param {string} key The key of the value to merge.
5213 * @param {number} srcIndex The index of `source`.
5214 * @param {Function} mergeFunc The function to merge values.
5215 * @param {Function} [customizer] The function to customize assigned values.
5216 * @param {Object} [stack] Tracks traversed source values and their merged
5217 * counterparts.
5218 */
5219 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
5220 var objValue = safeGet(object, key);
5221 var srcValue = safeGet(source, key);
5222 var stacked = stack.get(srcValue);
5223 if (stacked) {
5224 assignMergeValue(object, key, stacked);
5225 return;
5226 }
5227 var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined;
5228 var isCommon = newValue === undefined;
5229 if (isCommon) {
5230 var isArr = isArray(srcValue);
5231 var isBuff = !isArr && isBuffer(srcValue);
5232 var isTyped = !isArr && !isBuff && isTypedArray(srcValue);
5233 newValue = srcValue;
5234 if (isArr || isBuff || isTyped) if (isArray(objValue)) newValue = objValue;
5235 else if (isArrayLikeObject(objValue)) newValue = copyArray(objValue);
5236 else if (isBuff) {
5237 isCommon = false;
5238 newValue = cloneBuffer(srcValue, true);
5239 } else if (isTyped) {
5240 isCommon = false;
5241 newValue = cloneTypedArray(srcValue, true);
5242 } else newValue = [];
5243 else if (isPlainObject(srcValue) || isArguments(srcValue)) {
5244 newValue = objValue;
5245 if (isArguments(objValue)) newValue = toPlainObject(objValue);
5246 else if (!isObject(objValue) || isFunction(objValue)) newValue = initCloneObject(srcValue);
5247 } else isCommon = false;
5248 }
5249 if (isCommon) {
5250 stack.set(srcValue, newValue);
5251 mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
5252 stack["delete"](srcValue);
5253 }
5254 assignMergeValue(object, key, newValue);
5255 }
5256 /**
5257 * The base implementation of `_.nth` which doesn't coerce arguments.
5258 *
5259 * @private
5260 * @param {Array} array The array to query.
5261 * @param {number} n The index of the element to return.
5262 * @returns {*} Returns the nth element of `array`.
5263 */
5264 function baseNth(array, n) {
5265 var length = array.length;
5266 if (!length) return;
5267 n += n < 0 ? length : 0;
5268 return isIndex(n, length) ? array[n] : undefined;
5269 }
5270 /**
5271 * The base implementation of `_.orderBy` without param guards.
5272 *
5273 * @private
5274 * @param {Array|Object} collection The collection to iterate over.
5275 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
5276 * @param {string[]} orders The sort orders of `iteratees`.
5277 * @returns {Array} Returns the new sorted array.
5278 */
5279 function baseOrderBy(collection, iteratees, orders) {
5280 if (iteratees.length) iteratees = arrayMap(iteratees, function(iteratee) {
5281 if (isArray(iteratee)) return function(value) {
5282 return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
5283 };
5284 return iteratee;
5285 });
5286 else iteratees = [identity];
5287 var index = -1;
5288 iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
5289 return baseSortBy(baseMap(collection, function(value, key, collection) {
5290 return {
5291 "criteria": arrayMap(iteratees, function(iteratee) {
5292 return iteratee(value);
5293 }),
5294 "index": ++index,
5295 "value": value
5296 };
5297 }), function(object, other) {
5298 return compareMultiple(object, other, orders);
5299 });
5300 }
5301 /**
5302 * The base implementation of `_.pick` without support for individual
5303 * property identifiers.
5304 *
5305 * @private
5306 * @param {Object} object The source object.
5307 * @param {string[]} paths The property paths to pick.
5308 * @returns {Object} Returns the new object.
5309 */
5310 function basePick(object, paths) {
5311 return basePickBy(object, paths, function(value, path) {
5312 return hasIn(object, path);
5313 });
5314 }
5315 /**
5316 * The base implementation of `_.pickBy` without support for iteratee shorthands.
5317 *
5318 * @private
5319 * @param {Object} object The source object.
5320 * @param {string[]} paths The property paths to pick.
5321 * @param {Function} predicate The function invoked per property.
5322 * @returns {Object} Returns the new object.
5323 */
5324 function basePickBy(object, paths, predicate) {
5325 var index = -1;
5326 var length = paths.length;
5327 var result = {};
5328 while (++index < length) {
5329 var path = paths[index];
5330 var value = baseGet(object, path);
5331 if (predicate(value, path)) baseSet(result, castPath(path, object), value);
5332 }
5333 return result;
5334 }
5335 /**
5336 * A specialized version of `baseProperty` which supports deep paths.
5337 *
5338 * @private
5339 * @param {Array|string} path The path of the property to get.
5340 * @returns {Function} Returns the new accessor function.
5341 */
5342 function basePropertyDeep(path) {
5343 return function(object) {
5344 return baseGet(object, path);
5345 };
5346 }
5347 /**
5348 * The base implementation of `_.pullAllBy` without support for iteratee
5349 * shorthands.
5350 *
5351 * @private
5352 * @param {Array} array The array to modify.
5353 * @param {Array} values The values to remove.
5354 * @param {Function} [iteratee] The iteratee invoked per element.
5355 * @param {Function} [comparator] The comparator invoked per element.
5356 * @returns {Array} Returns `array`.
5357 */
5358 function basePullAll(array, values, iteratee, comparator) {
5359 var indexOf = comparator ? baseIndexOfWith : baseIndexOf;
5360 var index = -1;
5361 var length = values.length;
5362 var seen = array;
5363 if (array === values) values = copyArray(values);
5364 if (iteratee) seen = arrayMap(array, baseUnary(iteratee));
5365 while (++index < length) {
5366 var fromIndex = 0;
5367 var value = values[index];
5368 var computed = iteratee ? iteratee(value) : value;
5369 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
5370 if (seen !== array) splice.call(seen, fromIndex, 1);
5371 splice.call(array, fromIndex, 1);
5372 }
5373 }
5374 return array;
5375 }
5376 /**
5377 * The base implementation of `_.pullAt` without support for individual
5378 * indexes or capturing the removed elements.
5379 *
5380 * @private
5381 * @param {Array} array The array to modify.
5382 * @param {number[]} indexes The indexes of elements to remove.
5383 * @returns {Array} Returns `array`.
5384 */
5385 function basePullAt(array, indexes) {
5386 var length = array ? indexes.length : 0;
5387 var lastIndex = length - 1;
5388 while (length--) {
5389 var index = indexes[length];
5390 if (length == lastIndex || index !== previous) {
5391 var previous = index;
5392 if (isIndex(index)) splice.call(array, index, 1);
5393 else baseUnset(array, index);
5394 }
5395 }
5396 return array;
5397 }
5398 /**
5399 * The base implementation of `_.random` without support for returning
5400 * floating-point numbers.
5401 *
5402 * @private
5403 * @param {number} lower The lower bound.
5404 * @param {number} upper The upper bound.
5405 * @returns {number} Returns the random number.
5406 */
5407 function baseRandom(lower, upper) {
5408 return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
5409 }
5410 /**
5411 * The base implementation of `_.range` and `_.rangeRight` which doesn't
5412 * coerce arguments.
5413 *
5414 * @private
5415 * @param {number} start The start of the range.
5416 * @param {number} end The end of the range.
5417 * @param {number} step The value to increment or decrement by.
5418 * @param {boolean} [fromRight] Specify iterating from right to left.
5419 * @returns {Array} Returns the range of numbers.
5420 */
5421 function baseRange(start, end, step, fromRight) {
5422 var index = -1;
5423 var length = nativeMax(nativeCeil((end - start) / (step || 1)), 0);
5424 var result = Array(length);
5425 while (length--) {
5426 result[fromRight ? length : ++index] = start;
5427 start += step;
5428 }
5429 return result;
5430 }
5431 /**
5432 * The base implementation of `_.repeat` which doesn't coerce arguments.
5433 *
5434 * @private
5435 * @param {string} string The string to repeat.
5436 * @param {number} n The number of times to repeat the string.
5437 * @returns {string} Returns the repeated string.
5438 */
5439 function baseRepeat(string, n) {
5440 var result = "";
5441 if (!string || n < 1 || n > MAX_SAFE_INTEGER) return result;
5442 do {
5443 if (n % 2) result += string;
5444 n = nativeFloor(n / 2);
5445 if (n) string += string;
5446 } while (n);
5447 return result;
5448 }
5449 /**
5450 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
5451 *
5452 * @private
5453 * @param {Function} func The function to apply a rest parameter to.
5454 * @param {number} [start=func.length-1] The start position of the rest parameter.
5455 * @returns {Function} Returns the new function.
5456 */
5457 function baseRest(func, start) {
5458 return setToString(overRest(func, start, identity), func + "");
5459 }
5460 /**
5461 * The base implementation of `_.sample`.
5462 *
5463 * @private
5464 * @param {Array|Object} collection The collection to sample.
5465 * @returns {*} Returns the random element.
5466 */
5467 function baseSample(collection) {
5468 return arraySample(values(collection));
5469 }
5470 /**
5471 * The base implementation of `_.sampleSize` without param guards.
5472 *
5473 * @private
5474 * @param {Array|Object} collection The collection to sample.
5475 * @param {number} n The number of elements to sample.
5476 * @returns {Array} Returns the random elements.
5477 */
5478 function baseSampleSize(collection, n) {
5479 var array = values(collection);
5480 return shuffleSelf(array, baseClamp(n, 0, array.length));
5481 }
5482 /**
5483 * The base implementation of `_.set`.
5484 *
5485 * @private
5486 * @param {Object} object The object to modify.
5487 * @param {Array|string} path The path of the property to set.
5488 * @param {*} value The value to set.
5489 * @param {Function} [customizer] The function to customize path creation.
5490 * @returns {Object} Returns `object`.
5491 */
5492 function baseSet(object, path, value, customizer) {
5493 if (!isObject(object)) return object;
5494 path = castPath(path, object);
5495 var index = -1;
5496 var length = path.length;
5497 var lastIndex = length - 1;
5498 var nested = object;
5499 while (nested != null && ++index < length) {
5500 var key = toKey(path[index]);
5501 var newValue = value;
5502 if (key === "__proto__" || key === "constructor" || key === "prototype") return object;
5503 if (index != lastIndex) {
5504 var objValue = nested[key];
5505 newValue = customizer ? customizer(objValue, key, nested) : undefined;
5506 if (newValue === undefined) newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
5507 }
5508 assignValue(nested, key, newValue);
5509 nested = nested[key];
5510 }
5511 return object;
5512 }
5513 /**
5514 * The base implementation of `setData` without support for hot loop shorting.
5515 *
5516 * @private
5517 * @param {Function} func The function to associate metadata with.
5518 * @param {*} data The metadata.
5519 * @returns {Function} Returns `func`.
5520 */
5521 var baseSetData = !metaMap ? identity : function(func, data) {
5522 metaMap.set(func, data);
5523 return func;
5524 };
5525 /**
5526 * The base implementation of `setToString` without support for hot loop shorting.
5527 *
5528 * @private
5529 * @param {Function} func The function to modify.
5530 * @param {Function} string The `toString` result.
5531 * @returns {Function} Returns `func`.
5532 */
5533 var baseSetToString = !defineProperty ? identity : function(func, string) {
5534 return defineProperty(func, "toString", {
5535 "configurable": true,
5536 "enumerable": false,
5537 "value": constant(string),
5538 "writable": true
5539 });
5540 };
5541 /**
5542 * The base implementation of `_.shuffle`.
5543 *
5544 * @private
5545 * @param {Array|Object} collection The collection to shuffle.
5546 * @returns {Array} Returns the new shuffled array.
5547 */
5548 function baseShuffle(collection) {
5549 return shuffleSelf(values(collection));
5550 }
5551 /**
5552 * The base implementation of `_.slice` without an iteratee call guard.
5553 *
5554 * @private
5555 * @param {Array} array The array to slice.
5556 * @param {number} [start=0] The start position.
5557 * @param {number} [end=array.length] The end position.
5558 * @returns {Array} Returns the slice of `array`.
5559 */
5560 function baseSlice(array, start, end) {
5561 var index = -1;
5562 var length = array.length;
5563 if (start < 0) start = -start > length ? 0 : length + start;
5564 end = end > length ? length : end;
5565 if (end < 0) end += length;
5566 length = start > end ? 0 : end - start >>> 0;
5567 start >>>= 0;
5568 var result = Array(length);
5569 while (++index < length) result[index] = array[index + start];
5570 return result;
5571 }
5572 /**
5573 * The base implementation of `_.some` without support for iteratee shorthands.
5574 *
5575 * @private
5576 * @param {Array|Object} collection The collection to iterate over.
5577 * @param {Function} predicate The function invoked per iteration.
5578 * @returns {boolean} Returns `true` if any element passes the predicate check,
5579 * else `false`.
5580 */
5581 function baseSome(collection, predicate) {
5582 var result;
5583 baseEach(collection, function(value, index, collection) {
5584 result = predicate(value, index, collection);
5585 return !result;
5586 });
5587 return !!result;
5588 }
5589 /**
5590 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
5591 * performs a binary search of `array` to determine the index at which `value`
5592 * should be inserted into `array` in order to maintain its sort order.
5593 *
5594 * @private
5595 * @param {Array} array The sorted array to inspect.
5596 * @param {*} value The value to evaluate.
5597 * @param {boolean} [retHighest] Specify returning the highest qualified index.
5598 * @returns {number} Returns the index at which `value` should be inserted
5599 * into `array`.
5600 */
5601 function baseSortedIndex(array, value, retHighest) {
5602 var low = 0;
5603 var high = array == null ? low : array.length;
5604 if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
5605 while (low < high) {
5606 var mid = low + high >>> 1;
5607 var computed = array[mid];
5608 if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) low = mid + 1;
5609 else high = mid;
5610 }
5611 return high;
5612 }
5613 return baseSortedIndexBy(array, value, identity, retHighest);
5614 }
5615 /**
5616 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
5617 * which invokes `iteratee` for `value` and each element of `array` to compute
5618 * their sort ranking. The iteratee is invoked with one argument; (value).
5619 *
5620 * @private
5621 * @param {Array} array The sorted array to inspect.
5622 * @param {*} value The value to evaluate.
5623 * @param {Function} iteratee The iteratee invoked per element.
5624 * @param {boolean} [retHighest] Specify returning the highest qualified index.
5625 * @returns {number} Returns the index at which `value` should be inserted
5626 * into `array`.
5627 */
5628 function baseSortedIndexBy(array, value, iteratee, retHighest) {
5629 var low = 0;
5630 var high = array == null ? 0 : array.length;
5631 if (high === 0) return 0;
5632 value = iteratee(value);
5633 var valIsNaN = value !== value;
5634 var valIsNull = value === null;
5635 var valIsSymbol = isSymbol(value);
5636 var valIsUndefined = value === undefined;
5637 while (low < high) {
5638 var mid = nativeFloor((low + high) / 2);
5639 var computed = iteratee(array[mid]);
5640 var othIsDefined = computed !== undefined;
5641 var othIsNull = computed === null;
5642 var othIsReflexive = computed === computed;
5643 var othIsSymbol = isSymbol(computed);
5644 if (valIsNaN) var setLow = retHighest || othIsReflexive;
5645 else if (valIsUndefined) setLow = othIsReflexive && (retHighest || othIsDefined);
5646 else if (valIsNull) setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
5647 else if (valIsSymbol) setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
5648 else if (othIsNull || othIsSymbol) setLow = false;
5649 else setLow = retHighest ? computed <= value : computed < value;
5650 if (setLow) low = mid + 1;
5651 else high = mid;
5652 }
5653 return nativeMin(high, MAX_ARRAY_INDEX);
5654 }
5655 /**
5656 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
5657 * support for iteratee shorthands.
5658 *
5659 * @private
5660 * @param {Array} array The array to inspect.
5661 * @param {Function} [iteratee] The iteratee invoked per element.
5662 * @returns {Array} Returns the new duplicate free array.
5663 */
5664 function baseSortedUniq(array, iteratee) {
5665 var index = -1;
5666 var length = array.length;
5667 var resIndex = 0;
5668 var result = [];
5669 while (++index < length) {
5670 var value = array[index];
5671 var computed = iteratee ? iteratee(value) : value;
5672 if (!index || !eq(computed, seen)) {
5673 var seen = computed;
5674 result[resIndex++] = value === 0 ? 0 : value;
5675 }
5676 }
5677 return result;
5678 }
5679 /**
5680 * The base implementation of `_.toNumber` which doesn't ensure correct
5681 * conversions of binary, hexadecimal, or octal string values.
5682 *
5683 * @private
5684 * @param {*} value The value to process.
5685 * @returns {number} Returns the number.
5686 */
5687 function baseToNumber(value) {
5688 if (typeof value == "number") return value;
5689 if (isSymbol(value)) return NAN;
5690 return +value;
5691 }
5692 /**
5693 * The base implementation of `_.toString` which doesn't convert nullish
5694 * values to empty strings.
5695 *
5696 * @private
5697 * @param {*} value The value to process.
5698 * @returns {string} Returns the string.
5699 */
5700 function baseToString(value) {
5701 if (typeof value == "string") return value;
5702 if (isArray(value)) return arrayMap(value, baseToString) + "";
5703 if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
5704 var result = value + "";
5705 return result == "0" && 1 / value == -Infinity ? "-0" : result;
5706 }
5707 /**
5708 * The base implementation of `_.uniqBy` without support for iteratee shorthands.
5709 *
5710 * @private
5711 * @param {Array} array The array to inspect.
5712 * @param {Function} [iteratee] The iteratee invoked per element.
5713 * @param {Function} [comparator] The comparator invoked per element.
5714 * @returns {Array} Returns the new duplicate free array.
5715 */
5716 function baseUniq(array, iteratee, comparator) {
5717 var index = -1;
5718 var includes = arrayIncludes;
5719 var length = array.length;
5720 var isCommon = true;
5721 var result = [];
5722 var seen = result;
5723 if (comparator) {
5724 isCommon = false;
5725 includes = arrayIncludesWith;
5726 } else if (length >= LARGE_ARRAY_SIZE) {
5727 var set = iteratee ? null : createSet(array);
5728 if (set) return setToArray(set);
5729 isCommon = false;
5730 includes = cacheHas;
5731 seen = new SetCache();
5732 } else seen = iteratee ? [] : result;
5733 outer: while (++index < length) {
5734 var value = array[index];
5735 var computed = iteratee ? iteratee(value) : value;
5736 value = comparator || value !== 0 ? value : 0;
5737 if (isCommon && computed === computed) {
5738 var seenIndex = seen.length;
5739 while (seenIndex--) if (seen[seenIndex] === computed) continue outer;
5740 if (iteratee) seen.push(computed);
5741 result.push(value);
5742 } else if (!includes(seen, computed, comparator)) {
5743 if (seen !== result) seen.push(computed);
5744 result.push(value);
5745 }
5746 }
5747 return result;
5748 }
5749 /**
5750 * The base implementation of `_.unset`.
5751 *
5752 * @private
5753 * @param {Object} object The object to modify.
5754 * @param {Array|string} path The property path to unset.
5755 * @returns {boolean} Returns `true` if the property is deleted, else `false`.
5756 */
5757 function baseUnset(object, path) {
5758 path = castPath(path, object);
5759 var index = -1;
5760 var length = path.length;
5761 if (!length) return true;
5762 while (++index < length) {
5763 var key = toKey(path[index]);
5764 if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) return false;
5765 if ((key === "constructor" || key === "prototype") && index < length - 1) return false;
5766 }
5767 var obj = parent(object, path);
5768 return obj == null || delete obj[toKey(last(path))];
5769 }
5770 /**
5771 * The base implementation of `_.update`.
5772 *
5773 * @private
5774 * @param {Object} object The object to modify.
5775 * @param {Array|string} path The path of the property to update.
5776 * @param {Function} updater The function to produce the updated value.
5777 * @param {Function} [customizer] The function to customize path creation.
5778 * @returns {Object} Returns `object`.
5779 */
5780 function baseUpdate(object, path, updater, customizer) {
5781 return baseSet(object, path, updater(baseGet(object, path)), customizer);
5782 }
5783 /**
5784 * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
5785 * without support for iteratee shorthands.
5786 *
5787 * @private
5788 * @param {Array} array The array to query.
5789 * @param {Function} predicate The function invoked per iteration.
5790 * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
5791 * @param {boolean} [fromRight] Specify iterating from right to left.
5792 * @returns {Array} Returns the slice of `array`.
5793 */
5794 function baseWhile(array, predicate, isDrop, fromRight) {
5795 var length = array.length;
5796 var index = fromRight ? length : -1;
5797 while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array));
5798 return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
5799 }
5800 /**
5801 * The base implementation of `wrapperValue` which returns the result of
5802 * performing a sequence of actions on the unwrapped `value`, where each
5803 * successive action is supplied the return value of the previous.
5804 *
5805 * @private
5806 * @param {*} value The unwrapped value.
5807 * @param {Array} actions Actions to perform to resolve the unwrapped value.
5808 * @returns {*} Returns the resolved value.
5809 */
5810 function baseWrapperValue(value, actions) {
5811 var result = value;
5812 if (result instanceof LazyWrapper) result = result.value();
5813 return arrayReduce(actions, function(result, action) {
5814 return action.func.apply(action.thisArg, arrayPush([result], action.args));
5815 }, result);
5816 }
5817 /**
5818 * The base implementation of methods like `_.xor`, without support for
5819 * iteratee shorthands, that accepts an array of arrays to inspect.
5820 *
5821 * @private
5822 * @param {Array} arrays The arrays to inspect.
5823 * @param {Function} [iteratee] The iteratee invoked per element.
5824 * @param {Function} [comparator] The comparator invoked per element.
5825 * @returns {Array} Returns the new array of values.
5826 */
5827 function baseXor(arrays, iteratee, comparator) {
5828 var length = arrays.length;
5829 if (length < 2) return length ? baseUniq(arrays[0]) : [];
5830 var index = -1;
5831 var result = Array(length);
5832 while (++index < length) {
5833 var array = arrays[index];
5834 var othIndex = -1;
5835 while (++othIndex < length) if (othIndex != index) result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
5836 }
5837 return baseUniq(baseFlatten(result, 1), iteratee, comparator);
5838 }
5839 /**
5840 * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
5841 *
5842 * @private
5843 * @param {Array} props The property identifiers.
5844 * @param {Array} values The property values.
5845 * @param {Function} assignFunc The function to assign values.
5846 * @returns {Object} Returns the new object.
5847 */
5848 function baseZipObject(props, values, assignFunc) {
5849 var index = -1;
5850 var length = props.length;
5851 var valsLength = values.length;
5852 var result = {};
5853 while (++index < length) {
5854 var value = index < valsLength ? values[index] : undefined;
5855 assignFunc(result, props[index], value);
5856 }
5857 return result;
5858 }
5859 /**
5860 * Casts `value` to an empty array if it's not an array like object.
5861 *
5862 * @private
5863 * @param {*} value The value to inspect.
5864 * @returns {Array|Object} Returns the cast array-like object.
5865 */
5866 function castArrayLikeObject(value) {
5867 return isArrayLikeObject(value) ? value : [];
5868 }
5869 /**
5870 * Casts `value` to `identity` if it's not a function.
5871 *
5872 * @private
5873 * @param {*} value The value to inspect.
5874 * @returns {Function} Returns cast function.
5875 */
5876 function castFunction(value) {
5877 return typeof value == "function" ? value : identity;
5878 }
5879 /**
5880 * Casts `value` to a path array if it's not one.
5881 *
5882 * @private
5883 * @param {*} value The value to inspect.
5884 * @param {Object} [object] The object to query keys on.
5885 * @returns {Array} Returns the cast property path array.
5886 */
5887 function castPath(value, object) {
5888 if (isArray(value)) return value;
5889 return isKey(value, object) ? [value] : stringToPath(toString(value));
5890 }
5891 /**
5892 * A `baseRest` alias which can be replaced with `identity` by module
5893 * replacement plugins.
5894 *
5895 * @private
5896 * @type {Function}
5897 * @param {Function} func The function to apply a rest parameter to.
5898 * @returns {Function} Returns the new function.
5899 */
5900 var castRest = baseRest;
5901 /**
5902 * Casts `array` to a slice if it's needed.
5903 *
5904 * @private
5905 * @param {Array} array The array to inspect.
5906 * @param {number} start The start position.
5907 * @param {number} [end=array.length] The end position.
5908 * @returns {Array} Returns the cast slice.
5909 */
5910 function castSlice(array, start, end) {
5911 var length = array.length;
5912 end = end === undefined ? length : end;
5913 return !start && end >= length ? array : baseSlice(array, start, end);
5914 }
5915 /**
5916 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
5917 *
5918 * @private
5919 * @param {number|Object} id The timer id or timeout object of the timer to clear.
5920 */
5921 var clearTimeout = ctxClearTimeout || function(id) {
5922 return root.clearTimeout(id);
5923 };
5924 /**
5925 * Creates a clone of `buffer`.
5926 *
5927 * @private
5928 * @param {Buffer} buffer The buffer to clone.
5929 * @param {boolean} [isDeep] Specify a deep clone.
5930 * @returns {Buffer} Returns the cloned buffer.
5931 */
5932 function cloneBuffer(buffer, isDeep) {
5933 if (isDeep) return buffer.slice();
5934 var length = buffer.length;
5935 var result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
5936 buffer.copy(result);
5937 return result;
5938 }
5939 /**
5940 * Creates a clone of `arrayBuffer`.
5941 *
5942 * @private
5943 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
5944 * @returns {ArrayBuffer} Returns the cloned array buffer.
5945 */
5946 function cloneArrayBuffer(arrayBuffer) {
5947 var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
5948 new Uint8Array(result).set(new Uint8Array(arrayBuffer));
5949 return result;
5950 }
5951 /**
5952 * Creates a clone of `dataView`.
5953 *
5954 * @private
5955 * @param {Object} dataView The data view to clone.
5956 * @param {boolean} [isDeep] Specify a deep clone.
5957 * @returns {Object} Returns the cloned data view.
5958 */
5959 function cloneDataView(dataView, isDeep) {
5960 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
5961 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
5962 }
5963 /**
5964 * Creates a clone of `regexp`.
5965 *
5966 * @private
5967 * @param {Object} regexp The regexp to clone.
5968 * @returns {Object} Returns the cloned regexp.
5969 */
5970 function cloneRegExp(regexp) {
5971 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
5972 result.lastIndex = regexp.lastIndex;
5973 return result;
5974 }
5975 /**
5976 * Creates a clone of the `symbol` object.
5977 *
5978 * @private
5979 * @param {Object} symbol The symbol object to clone.
5980 * @returns {Object} Returns the cloned symbol object.
5981 */
5982 function cloneSymbol(symbol) {
5983 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
5984 }
5985 /**
5986 * Creates a clone of `typedArray`.
5987 *
5988 * @private
5989 * @param {Object} typedArray The typed array to clone.
5990 * @param {boolean} [isDeep] Specify a deep clone.
5991 * @returns {Object} Returns the cloned typed array.
5992 */
5993 function cloneTypedArray(typedArray, isDeep) {
5994 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
5995 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
5996 }
5997 /**
5998 * Compares values to sort them in ascending order.
5999 *
6000 * @private
6001 * @param {*} value The value to compare.
6002 * @param {*} other The other value to compare.
6003 * @returns {number} Returns the sort order indicator for `value`.
6004 */
6005 function compareAscending(value, other) {
6006 if (value !== other) {
6007 var valIsDefined = value !== undefined;
6008 var valIsNull = value === null;
6009 var valIsReflexive = value === value;
6010 var valIsSymbol = isSymbol(value);
6011 var othIsDefined = other !== undefined;
6012 var othIsNull = other === null;
6013 var othIsReflexive = other === other;
6014 var othIsSymbol = isSymbol(other);
6015 if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) return 1;
6016 if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) return -1;
6017 }
6018 return 0;
6019 }
6020 /**
6021 * Used by `_.orderBy` to compare multiple properties of a value to another
6022 * and stable sort them.
6023 *
6024 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
6025 * specify an order of "desc" for descending or "asc" for ascending sort order
6026 * of corresponding values.
6027 *
6028 * @private
6029 * @param {Object} object The object to compare.
6030 * @param {Object} other The other object to compare.
6031 * @param {boolean[]|string[]} orders The order to sort by for each property.
6032 * @returns {number} Returns the sort order indicator for `object`.
6033 */
6034 function compareMultiple(object, other, orders) {
6035 var index = -1;
6036 var objCriteria = object.criteria;
6037 var othCriteria = other.criteria;
6038 var length = objCriteria.length;
6039 var ordersLength = orders.length;
6040 while (++index < length) {
6041 var result = compareAscending(objCriteria[index], othCriteria[index]);
6042 if (result) {
6043 if (index >= ordersLength) return result;
6044 return result * (orders[index] == "desc" ? -1 : 1);
6045 }
6046 }
6047 return object.index - other.index;
6048 }
6049 /**
6050 * Creates an array that is the composition of partially applied arguments,
6051 * placeholders, and provided arguments into a single array of arguments.
6052 *
6053 * @private
6054 * @param {Array} args The provided arguments.
6055 * @param {Array} partials The arguments to prepend to those provided.
6056 * @param {Array} holders The `partials` placeholder indexes.
6057 * @params {boolean} [isCurried] Specify composing for a curried function.
6058 * @returns {Array} Returns the new array of composed arguments.
6059 */
6060 function composeArgs(args, partials, holders, isCurried) {
6061 var argsIndex = -1;
6062 var argsLength = args.length;
6063 var holdersLength = holders.length;
6064 var leftIndex = -1;
6065 var leftLength = partials.length;
6066 var rangeLength = nativeMax(argsLength - holdersLength, 0);
6067 var result = Array(leftLength + rangeLength);
6068 var isUncurried = !isCurried;
6069 while (++leftIndex < leftLength) result[leftIndex] = partials[leftIndex];
6070 while (++argsIndex < holdersLength) if (isUncurried || argsIndex < argsLength) result[holders[argsIndex]] = args[argsIndex];
6071 while (rangeLength--) result[leftIndex++] = args[argsIndex++];
6072 return result;
6073 }
6074 /**
6075 * This function is like `composeArgs` except that the arguments composition
6076 * is tailored for `_.partialRight`.
6077 *
6078 * @private
6079 * @param {Array} args The provided arguments.
6080 * @param {Array} partials The arguments to append to those provided.
6081 * @param {Array} holders The `partials` placeholder indexes.
6082 * @params {boolean} [isCurried] Specify composing for a curried function.
6083 * @returns {Array} Returns the new array of composed arguments.
6084 */
6085 function composeArgsRight(args, partials, holders, isCurried) {
6086 var argsIndex = -1;
6087 var argsLength = args.length;
6088 var holdersIndex = -1;
6089 var holdersLength = holders.length;
6090 var rightIndex = -1;
6091 var rightLength = partials.length;
6092 var rangeLength = nativeMax(argsLength - holdersLength, 0);
6093 var result = Array(rangeLength + rightLength);
6094 var isUncurried = !isCurried;
6095 while (++argsIndex < rangeLength) result[argsIndex] = args[argsIndex];
6096 var offset = argsIndex;
6097 while (++rightIndex < rightLength) result[offset + rightIndex] = partials[rightIndex];
6098 while (++holdersIndex < holdersLength) if (isUncurried || argsIndex < argsLength) result[offset + holders[holdersIndex]] = args[argsIndex++];
6099 return result;
6100 }
6101 /**
6102 * Copies the values of `source` to `array`.
6103 *
6104 * @private
6105 * @param {Array} source The array to copy values from.
6106 * @param {Array} [array=[]] The array to copy values to.
6107 * @returns {Array} Returns `array`.
6108 */
6109 function copyArray(source, array) {
6110 var index = -1;
6111 var length = source.length;
6112 array || (array = Array(length));
6113 while (++index < length) array[index] = source[index];
6114 return array;
6115 }
6116 /**
6117 * Copies properties of `source` to `object`.
6118 *
6119 * @private
6120 * @param {Object} source The object to copy properties from.
6121 * @param {Array} props The property identifiers to copy.
6122 * @param {Object} [object={}] The object to copy properties to.
6123 * @param {Function} [customizer] The function to customize copied values.
6124 * @returns {Object} Returns `object`.
6125 */
6126 function copyObject(source, props, object, customizer) {
6127 var isNew = !object;
6128 object || (object = {});
6129 var index = -1;
6130 var length = props.length;
6131 while (++index < length) {
6132 var key = props[index];
6133 var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
6134 if (newValue === undefined) newValue = source[key];
6135 if (isNew) baseAssignValue(object, key, newValue);
6136 else assignValue(object, key, newValue);
6137 }
6138 return object;
6139 }
6140 /**
6141 * Copies own symbols of `source` to `object`.
6142 *
6143 * @private
6144 * @param {Object} source The object to copy symbols from.
6145 * @param {Object} [object={}] The object to copy symbols to.
6146 * @returns {Object} Returns `object`.
6147 */
6148 function copySymbols(source, object) {
6149 return copyObject(source, getSymbols(source), object);
6150 }
6151 /**
6152 * Copies own and inherited symbols of `source` to `object`.
6153 *
6154 * @private
6155 * @param {Object} source The object to copy symbols from.
6156 * @param {Object} [object={}] The object to copy symbols to.
6157 * @returns {Object} Returns `object`.
6158 */
6159 function copySymbolsIn(source, object) {
6160 return copyObject(source, getSymbolsIn(source), object);
6161 }
6162 /**
6163 * Creates a function like `_.groupBy`.
6164 *
6165 * @private
6166 * @param {Function} setter The function to set accumulator values.
6167 * @param {Function} [initializer] The accumulator object initializer.
6168 * @returns {Function} Returns the new aggregator function.
6169 */
6170 function createAggregator(setter, initializer) {
6171 return function(collection, iteratee) {
6172 var func = isArray(collection) ? arrayAggregator : baseAggregator;
6173 var accumulator = initializer ? initializer() : {};
6174 return func(collection, setter, getIteratee(iteratee, 2), accumulator);
6175 };
6176 }
6177 /**
6178 * Creates a function like `_.assign`.
6179 *
6180 * @private
6181 * @param {Function} assigner The function to assign values.
6182 * @returns {Function} Returns the new assigner function.
6183 */
6184 function createAssigner(assigner) {
6185 return baseRest(function(object, sources) {
6186 var index = -1;
6187 var length = sources.length;
6188 var customizer = length > 1 ? sources[length - 1] : undefined;
6189 var guard = length > 2 ? sources[2] : undefined;
6190 customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined;
6191 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
6192 customizer = length < 3 ? undefined : customizer;
6193 length = 1;
6194 }
6195 object = Object(object);
6196 while (++index < length) {
6197 var source = sources[index];
6198 if (source) assigner(object, source, index, customizer);
6199 }
6200 return object;
6201 });
6202 }
6203 /**
6204 * Creates a `baseEach` or `baseEachRight` function.
6205 *
6206 * @private
6207 * @param {Function} eachFunc The function to iterate over a collection.
6208 * @param {boolean} [fromRight] Specify iterating from right to left.
6209 * @returns {Function} Returns the new base function.
6210 */
6211 function createBaseEach(eachFunc, fromRight) {
6212 return function(collection, iteratee) {
6213 if (collection == null) return collection;
6214 if (!isArrayLike(collection)) return eachFunc(collection, iteratee);
6215 var length = collection.length;
6216 var index = fromRight ? length : -1;
6217 var iterable = Object(collection);
6218 while (fromRight ? index-- : ++index < length) if (iteratee(iterable[index], index, iterable) === false) break;
6219 return collection;
6220 };
6221 }
6222 /**
6223 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
6224 *
6225 * @private
6226 * @param {boolean} [fromRight] Specify iterating from right to left.
6227 * @returns {Function} Returns the new base function.
6228 */
6229 function createBaseFor(fromRight) {
6230 return function(object, iteratee, keysFunc) {
6231 var index = -1;
6232 var iterable = Object(object);
6233 var props = keysFunc(object);
6234 var length = props.length;
6235 while (length--) {
6236 var key = props[fromRight ? length : ++index];
6237 if (iteratee(iterable[key], key, iterable) === false) break;
6238 }
6239 return object;
6240 };
6241 }
6242 /**
6243 * Creates a function that wraps `func` to invoke it with the optional `this`
6244 * binding of `thisArg`.
6245 *
6246 * @private
6247 * @param {Function} func The function to wrap.
6248 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6249 * @param {*} [thisArg] The `this` binding of `func`.
6250 * @returns {Function} Returns the new wrapped function.
6251 */
6252 function createBind(func, bitmask, thisArg) {
6253 var isBind = bitmask & WRAP_BIND_FLAG;
6254 var Ctor = createCtor(func);
6255 function wrapper() {
6256 return (this && this !== root && this instanceof wrapper ? Ctor : func).apply(isBind ? thisArg : this, arguments);
6257 }
6258 return wrapper;
6259 }
6260 /**
6261 * Creates a function like `_.lowerFirst`.
6262 *
6263 * @private
6264 * @param {string} methodName The name of the `String` case method to use.
6265 * @returns {Function} Returns the new case function.
6266 */
6267 function createCaseFirst(methodName) {
6268 return function(string) {
6269 string = toString(string);
6270 var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined;
6271 var chr = strSymbols ? strSymbols[0] : string.charAt(0);
6272 var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
6273 return chr[methodName]() + trailing;
6274 };
6275 }
6276 /**
6277 * Creates a function like `_.camelCase`.
6278 *
6279 * @private
6280 * @param {Function} callback The function to combine each word.
6281 * @returns {Function} Returns the new compounder function.
6282 */
6283 function createCompounder(callback) {
6284 return function(string) {
6285 return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
6286 };
6287 }
6288 /**
6289 * Creates a function that produces an instance of `Ctor` regardless of
6290 * whether it was invoked as part of a `new` expression or by `call` or `apply`.
6291 *
6292 * @private
6293 * @param {Function} Ctor The constructor to wrap.
6294 * @returns {Function} Returns the new wrapped function.
6295 */
6296 function createCtor(Ctor) {
6297 return function() {
6298 var args = arguments;
6299 switch (args.length) {
6300 case 0: return new Ctor();
6301 case 1: return new Ctor(args[0]);
6302 case 2: return new Ctor(args[0], args[1]);
6303 case 3: return new Ctor(args[0], args[1], args[2]);
6304 case 4: return new Ctor(args[0], args[1], args[2], args[3]);
6305 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
6306 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
6307 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
6308 }
6309 var thisBinding = baseCreate(Ctor.prototype);
6310 var result = Ctor.apply(thisBinding, args);
6311 return isObject(result) ? result : thisBinding;
6312 };
6313 }
6314 /**
6315 * Creates a function that wraps `func` to enable currying.
6316 *
6317 * @private
6318 * @param {Function} func The function to wrap.
6319 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6320 * @param {number} arity The arity of `func`.
6321 * @returns {Function} Returns the new wrapped function.
6322 */
6323 function createCurry(func, bitmask, arity) {
6324 var Ctor = createCtor(func);
6325 function wrapper() {
6326 var length = arguments.length;
6327 var args = Array(length);
6328 var index = length;
6329 var placeholder = getHolder(wrapper);
6330 while (index--) args[index] = arguments[index];
6331 var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
6332 length -= holders.length;
6333 if (length < arity) return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, undefined, args, holders, undefined, undefined, arity - length);
6334 return apply(this && this !== root && this instanceof wrapper ? Ctor : func, this, args);
6335 }
6336 return wrapper;
6337 }
6338 /**
6339 * Creates a `_.find` or `_.findLast` function.
6340 *
6341 * @private
6342 * @param {Function} findIndexFunc The function to find the collection index.
6343 * @returns {Function} Returns the new find function.
6344 */
6345 function createFind(findIndexFunc) {
6346 return function(collection, predicate, fromIndex) {
6347 var iterable = Object(collection);
6348 if (!isArrayLike(collection)) {
6349 var iteratee = getIteratee(predicate, 3);
6350 collection = keys(collection);
6351 predicate = function(key) {
6352 return iteratee(iterable[key], key, iterable);
6353 };
6354 }
6355 var index = findIndexFunc(collection, predicate, fromIndex);
6356 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
6357 };
6358 }
6359 /**
6360 * Creates a `_.flow` or `_.flowRight` function.
6361 *
6362 * @private
6363 * @param {boolean} [fromRight] Specify iterating from right to left.
6364 * @returns {Function} Returns the new flow function.
6365 */
6366 function createFlow(fromRight) {
6367 return flatRest(function(funcs) {
6368 var length = funcs.length;
6369 var index = length;
6370 var prereq = LodashWrapper.prototype.thru;
6371 if (fromRight) funcs.reverse();
6372 while (index--) {
6373 var func = funcs[index];
6374 if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
6375 if (prereq && !wrapper && getFuncName(func) == "wrapper") var wrapper = new LodashWrapper([], true);
6376 }
6377 index = wrapper ? index : length;
6378 while (++index < length) {
6379 func = funcs[index];
6380 var funcName = getFuncName(func);
6381 var data = funcName == "wrapper" ? getData(func) : undefined;
6382 if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
6383 else wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
6384 }
6385 return function() {
6386 var args = arguments;
6387 var value = args[0];
6388 if (wrapper && args.length == 1 && isArray(value)) return wrapper.plant(value).value();
6389 var index = 0;
6390 var result = length ? funcs[index].apply(this, args) : value;
6391 while (++index < length) result = funcs[index].call(this, result);
6392 return result;
6393 };
6394 });
6395 }
6396 /**
6397 * Creates a function that wraps `func` to invoke it with optional `this`
6398 * binding of `thisArg`, partial application, and currying.
6399 *
6400 * @private
6401 * @param {Function|string} func The function or method name to wrap.
6402 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6403 * @param {*} [thisArg] The `this` binding of `func`.
6404 * @param {Array} [partials] The arguments to prepend to those provided to
6405 * the new function.
6406 * @param {Array} [holders] The `partials` placeholder indexes.
6407 * @param {Array} [partialsRight] The arguments to append to those provided
6408 * to the new function.
6409 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
6410 * @param {Array} [argPos] The argument positions of the new function.
6411 * @param {number} [ary] The arity cap of `func`.
6412 * @param {number} [arity] The arity of `func`.
6413 * @returns {Function} Returns the new wrapped function.
6414 */
6415 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
6416 var isAry = bitmask & WRAP_ARY_FLAG;
6417 var isBind = bitmask & WRAP_BIND_FLAG;
6418 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
6419 var isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
6420 var isFlip = bitmask & WRAP_FLIP_FLAG;
6421 var Ctor = isBindKey ? undefined : createCtor(func);
6422 function wrapper() {
6423 var length = arguments.length;
6424 var args = Array(length);
6425 var index = length;
6426 while (index--) args[index] = arguments[index];
6427 if (isCurried) {
6428 var placeholder = getHolder(wrapper);
6429 var holdersCount = countHolders(args, placeholder);
6430 }
6431 if (partials) args = composeArgs(args, partials, holders, isCurried);
6432 if (partialsRight) args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
6433 length -= holdersCount;
6434 if (isCurried && length < arity) {
6435 var newHolders = replaceHolders(args, placeholder);
6436 return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
6437 }
6438 var thisBinding = isBind ? thisArg : this;
6439 var fn = isBindKey ? thisBinding[func] : func;
6440 length = args.length;
6441 if (argPos) args = reorder(args, argPos);
6442 else if (isFlip && length > 1) args.reverse();
6443 if (isAry && ary < length) args.length = ary;
6444 if (this && this !== root && this instanceof wrapper) fn = Ctor || createCtor(fn);
6445 return fn.apply(thisBinding, args);
6446 }
6447 return wrapper;
6448 }
6449 /**
6450 * Creates a function like `_.invertBy`.
6451 *
6452 * @private
6453 * @param {Function} setter The function to set accumulator values.
6454 * @param {Function} toIteratee The function to resolve iteratees.
6455 * @returns {Function} Returns the new inverter function.
6456 */
6457 function createInverter(setter, toIteratee) {
6458 return function(object, iteratee) {
6459 return baseInverter(object, setter, toIteratee(iteratee), {});
6460 };
6461 }
6462 /**
6463 * Creates a function that performs a mathematical operation on two values.
6464 *
6465 * @private
6466 * @param {Function} operator The function to perform the operation.
6467 * @param {number} [defaultValue] The value used for `undefined` arguments.
6468 * @returns {Function} Returns the new mathematical operation function.
6469 */
6470 function createMathOperation(operator, defaultValue) {
6471 return function(value, other) {
6472 var result;
6473 if (value === undefined && other === undefined) return defaultValue;
6474 if (value !== undefined) result = value;
6475 if (other !== undefined) {
6476 if (result === undefined) return other;
6477 if (typeof value == "string" || typeof other == "string") {
6478 value = baseToString(value);
6479 other = baseToString(other);
6480 } else {
6481 value = baseToNumber(value);
6482 other = baseToNumber(other);
6483 }
6484 result = operator(value, other);
6485 }
6486 return result;
6487 };
6488 }
6489 /**
6490 * Creates a function like `_.over`.
6491 *
6492 * @private
6493 * @param {Function} arrayFunc The function to iterate over iteratees.
6494 * @returns {Function} Returns the new over function.
6495 */
6496 function createOver(arrayFunc) {
6497 return flatRest(function(iteratees) {
6498 iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
6499 return baseRest(function(args) {
6500 var thisArg = this;
6501 return arrayFunc(iteratees, function(iteratee) {
6502 return apply(iteratee, thisArg, args);
6503 });
6504 });
6505 });
6506 }
6507 /**
6508 * Creates the padding for `string` based on `length`. The `chars` string
6509 * is truncated if the number of characters exceeds `length`.
6510 *
6511 * @private
6512 * @param {number} length The padding length.
6513 * @param {string} [chars=' '] The string used as padding.
6514 * @returns {string} Returns the padding for `string`.
6515 */
6516 function createPadding(length, chars) {
6517 chars = chars === undefined ? " " : baseToString(chars);
6518 var charsLength = chars.length;
6519 if (charsLength < 2) return charsLength ? baseRepeat(chars, length) : chars;
6520 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
6521 return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
6522 }
6523 /**
6524 * Creates a function that wraps `func` to invoke it with the `this` binding
6525 * of `thisArg` and `partials` prepended to the arguments it receives.
6526 *
6527 * @private
6528 * @param {Function} func The function to wrap.
6529 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6530 * @param {*} thisArg The `this` binding of `func`.
6531 * @param {Array} partials The arguments to prepend to those provided to
6532 * the new function.
6533 * @returns {Function} Returns the new wrapped function.
6534 */
6535 function createPartial(func, bitmask, thisArg, partials) {
6536 var isBind = bitmask & WRAP_BIND_FLAG;
6537 var Ctor = createCtor(func);
6538 function wrapper() {
6539 var argsIndex = -1;
6540 var argsLength = arguments.length;
6541 var leftIndex = -1;
6542 var leftLength = partials.length;
6543 var args = Array(leftLength + argsLength);
6544 var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
6545 while (++leftIndex < leftLength) args[leftIndex] = partials[leftIndex];
6546 while (argsLength--) args[leftIndex++] = arguments[++argsIndex];
6547 return apply(fn, isBind ? thisArg : this, args);
6548 }
6549 return wrapper;
6550 }
6551 /**
6552 * Creates a `_.range` or `_.rangeRight` function.
6553 *
6554 * @private
6555 * @param {boolean} [fromRight] Specify iterating from right to left.
6556 * @returns {Function} Returns the new range function.
6557 */
6558 function createRange(fromRight) {
6559 return function(start, end, step) {
6560 if (step && typeof step != "number" && isIterateeCall(start, end, step)) end = step = undefined;
6561 start = toFinite(start);
6562 if (end === undefined) {
6563 end = start;
6564 start = 0;
6565 } else end = toFinite(end);
6566 step = step === undefined ? start < end ? 1 : -1 : toFinite(step);
6567 return baseRange(start, end, step, fromRight);
6568 };
6569 }
6570 /**
6571 * Creates a function that performs a relational operation on two values.
6572 *
6573 * @private
6574 * @param {Function} operator The function to perform the operation.
6575 * @returns {Function} Returns the new relational operation function.
6576 */
6577 function createRelationalOperation(operator) {
6578 return function(value, other) {
6579 if (!(typeof value == "string" && typeof other == "string")) {
6580 value = toNumber(value);
6581 other = toNumber(other);
6582 }
6583 return operator(value, other);
6584 };
6585 }
6586 /**
6587 * Creates a function that wraps `func` to continue currying.
6588 *
6589 * @private
6590 * @param {Function} func The function to wrap.
6591 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
6592 * @param {Function} wrapFunc The function to create the `func` wrapper.
6593 * @param {*} placeholder The placeholder value.
6594 * @param {*} [thisArg] The `this` binding of `func`.
6595 * @param {Array} [partials] The arguments to prepend to those provided to
6596 * the new function.
6597 * @param {Array} [holders] The `partials` placeholder indexes.
6598 * @param {Array} [argPos] The argument positions of the new function.
6599 * @param {number} [ary] The arity cap of `func`.
6600 * @param {number} [arity] The arity of `func`.
6601 * @returns {Function} Returns the new wrapped function.
6602 */
6603 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
6604 var isCurry = bitmask & WRAP_CURRY_FLAG;
6605 var newHolders = isCurry ? holders : undefined;
6606 var newHoldersRight = isCurry ? undefined : holders;
6607 var newPartials = isCurry ? partials : undefined;
6608 var newPartialsRight = isCurry ? undefined : partials;
6609 bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
6610 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
6611 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
6612 var newData = [
6613 func,
6614 bitmask,
6615 thisArg,
6616 newPartials,
6617 newHolders,
6618 newPartialsRight,
6619 newHoldersRight,
6620 argPos,
6621 ary,
6622 arity
6623 ];
6624 var result = wrapFunc.apply(undefined, newData);
6625 if (isLaziable(func)) setData(result, newData);
6626 result.placeholder = placeholder;
6627 return setWrapToString(result, func, bitmask);
6628 }
6629 /**
6630 * Creates a function like `_.round`.
6631 *
6632 * @private
6633 * @param {string} methodName The name of the `Math` method to use when rounding.
6634 * @returns {Function} Returns the new round function.
6635 */
6636 function createRound(methodName) {
6637 var func = Math[methodName];
6638 return function(number, precision) {
6639 number = toNumber(number);
6640 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
6641 if (precision && nativeIsFinite(number)) {
6642 var pair = (toString(number) + "e").split("e");
6643 pair = (toString(func(pair[0] + "e" + (+pair[1] + precision))) + "e").split("e");
6644 return +(pair[0] + "e" + (+pair[1] - precision));
6645 }
6646 return func(number);
6647 };
6648 }
6649 /**
6650 * Creates a set object of `values`.
6651 *
6652 * @private
6653 * @param {Array} values The values to add to the set.
6654 * @returns {Object} Returns the new set.
6655 */
6656 var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function(values) {
6657 return new Set(values);
6658 };
6659 /**
6660 * Creates a `_.toPairs` or `_.toPairsIn` function.
6661 *
6662 * @private
6663 * @param {Function} keysFunc The function to get the keys of a given object.
6664 * @returns {Function} Returns the new pairs function.
6665 */
6666 function createToPairs(keysFunc) {
6667 return function(object) {
6668 var tag = getTag(object);
6669 if (tag == mapTag) return mapToArray(object);
6670 if (tag == setTag) return setToPairs(object);
6671 return baseToPairs(object, keysFunc(object));
6672 };
6673 }
6674 /**
6675 * Creates a function that either curries or invokes `func` with optional
6676 * `this` binding and partially applied arguments.
6677 *
6678 * @private
6679 * @param {Function|string} func The function or method name to wrap.
6680 * @param {number} bitmask The bitmask flags.
6681 * 1 - `_.bind`
6682 * 2 - `_.bindKey`
6683 * 4 - `_.curry` or `_.curryRight` of a bound function
6684 * 8 - `_.curry`
6685 * 16 - `_.curryRight`
6686 * 32 - `_.partial`
6687 * 64 - `_.partialRight`
6688 * 128 - `_.rearg`
6689 * 256 - `_.ary`
6690 * 512 - `_.flip`
6691 * @param {*} [thisArg] The `this` binding of `func`.
6692 * @param {Array} [partials] The arguments to be partially applied.
6693 * @param {Array} [holders] The `partials` placeholder indexes.
6694 * @param {Array} [argPos] The argument positions of the new function.
6695 * @param {number} [ary] The arity cap of `func`.
6696 * @param {number} [arity] The arity of `func`.
6697 * @returns {Function} Returns the new wrapped function.
6698 */
6699 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
6700 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
6701 if (!isBindKey && typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
6702 var length = partials ? partials.length : 0;
6703 if (!length) {
6704 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
6705 partials = holders = undefined;
6706 }
6707 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
6708 arity = arity === undefined ? arity : toInteger(arity);
6709 length -= holders ? holders.length : 0;
6710 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
6711 var partialsRight = partials;
6712 var holdersRight = holders;
6713 partials = holders = undefined;
6714 }
6715 var data = isBindKey ? undefined : getData(func);
6716 var newData = [
6717 func,
6718 bitmask,
6719 thisArg,
6720 partials,
6721 holders,
6722 partialsRight,
6723 holdersRight,
6724 argPos,
6725 ary,
6726 arity
6727 ];
6728 if (data) mergeData(newData, data);
6729 func = newData[0];
6730 bitmask = newData[1];
6731 thisArg = newData[2];
6732 partials = newData[3];
6733 holders = newData[4];
6734 arity = newData[9] = newData[9] === undefined ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0);
6735 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
6736 if (!bitmask || bitmask == WRAP_BIND_FLAG) var result = createBind(func, bitmask, thisArg);
6737 else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) result = createCurry(func, bitmask, arity);
6738 else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) result = createPartial(func, bitmask, thisArg, partials);
6739 else result = createHybrid.apply(undefined, newData);
6740 return setWrapToString((data ? baseSetData : setData)(result, newData), func, bitmask);
6741 }
6742 /**
6743 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
6744 * of source objects to the destination object for all destination properties
6745 * that resolve to `undefined`.
6746 *
6747 * @private
6748 * @param {*} objValue The destination value.
6749 * @param {*} srcValue The source value.
6750 * @param {string} key The key of the property to assign.
6751 * @param {Object} object The parent object of `objValue`.
6752 * @returns {*} Returns the value to assign.
6753 */
6754 function customDefaultsAssignIn(objValue, srcValue, key, object) {
6755 if (objValue === undefined || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) return srcValue;
6756 return objValue;
6757 }
6758 /**
6759 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
6760 * objects into destination objects that are passed thru.
6761 *
6762 * @private
6763 * @param {*} objValue The destination value.
6764 * @param {*} srcValue The source value.
6765 * @param {string} key The key of the property to merge.
6766 * @param {Object} object The parent object of `objValue`.
6767 * @param {Object} source The parent object of `srcValue`.
6768 * @param {Object} [stack] Tracks traversed source values and their merged
6769 * counterparts.
6770 * @returns {*} Returns the value to assign.
6771 */
6772 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
6773 if (isObject(objValue) && isObject(srcValue)) {
6774 stack.set(srcValue, objValue);
6775 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
6776 stack["delete"](srcValue);
6777 }
6778 return objValue;
6779 }
6780 /**
6781 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
6782 * objects.
6783 *
6784 * @private
6785 * @param {*} value The value to inspect.
6786 * @param {string} key The key of the property to inspect.
6787 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
6788 */
6789 function customOmitClone(value) {
6790 return isPlainObject(value) ? undefined : value;
6791 }
6792 /**
6793 * A specialized version of `baseIsEqualDeep` for arrays with support for
6794 * partial deep comparisons.
6795 *
6796 * @private
6797 * @param {Array} array The array to compare.
6798 * @param {Array} other The other array to compare.
6799 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
6800 * @param {Function} customizer The function to customize comparisons.
6801 * @param {Function} equalFunc The function to determine equivalents of values.
6802 * @param {Object} stack Tracks traversed `array` and `other` objects.
6803 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
6804 */
6805 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
6806 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
6807 var arrLength = array.length;
6808 var othLength = other.length;
6809 if (arrLength != othLength && !(isPartial && othLength > arrLength)) return false;
6810 var arrStacked = stack.get(array);
6811 var othStacked = stack.get(other);
6812 if (arrStacked && othStacked) return arrStacked == other && othStacked == array;
6813 var index = -1;
6814 var result = true;
6815 var seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined;
6816 stack.set(array, other);
6817 stack.set(other, array);
6818 while (++index < arrLength) {
6819 var arrValue = array[index];
6820 var othValue = other[index];
6821 if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
6822 if (compared !== undefined) {
6823 if (compared) continue;
6824 result = false;
6825 break;
6826 }
6827 if (seen) {
6828 if (!arraySome(other, function(othValue, othIndex) {
6829 if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) return seen.push(othIndex);
6830 })) {
6831 result = false;
6832 break;
6833 }
6834 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
6835 result = false;
6836 break;
6837 }
6838 }
6839 stack["delete"](array);
6840 stack["delete"](other);
6841 return result;
6842 }
6843 /**
6844 * A specialized version of `baseIsEqualDeep` for comparing objects of
6845 * the same `toStringTag`.
6846 *
6847 * **Note:** This function only supports comparing values with tags of
6848 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
6849 *
6850 * @private
6851 * @param {Object} object The object to compare.
6852 * @param {Object} other The other object to compare.
6853 * @param {string} tag The `toStringTag` of the objects to compare.
6854 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
6855 * @param {Function} customizer The function to customize comparisons.
6856 * @param {Function} equalFunc The function to determine equivalents of values.
6857 * @param {Object} stack Tracks traversed `object` and `other` objects.
6858 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
6859 */
6860 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
6861 switch (tag) {
6862 case dataViewTag:
6863 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return false;
6864 object = object.buffer;
6865 other = other.buffer;
6866 case arrayBufferTag:
6867 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) return false;
6868 return true;
6869 case boolTag:
6870 case dateTag:
6871 case numberTag: return eq(+object, +other);
6872 case errorTag: return object.name == other.name && object.message == other.message;
6873 case regexpTag:
6874 case stringTag: return object == other + "";
6875 case mapTag: var convert = mapToArray;
6876 case setTag:
6877 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
6878 convert || (convert = setToArray);
6879 if (object.size != other.size && !isPartial) return false;
6880 var stacked = stack.get(object);
6881 if (stacked) return stacked == other;
6882 bitmask |= COMPARE_UNORDERED_FLAG;
6883 stack.set(object, other);
6884 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
6885 stack["delete"](object);
6886 return result;
6887 case symbolTag: if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other);
6888 }
6889 return false;
6890 }
6891 /**
6892 * A specialized version of `baseIsEqualDeep` for objects with support for
6893 * partial deep comparisons.
6894 *
6895 * @private
6896 * @param {Object} object The object to compare.
6897 * @param {Object} other The other object to compare.
6898 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
6899 * @param {Function} customizer The function to customize comparisons.
6900 * @param {Function} equalFunc The function to determine equivalents of values.
6901 * @param {Object} stack Tracks traversed `object` and `other` objects.
6902 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
6903 */
6904 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
6905 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
6906 var objProps = getAllKeys(object);
6907 var objLength = objProps.length;
6908 if (objLength != getAllKeys(other).length && !isPartial) return false;
6909 var index = objLength;
6910 while (index--) {
6911 var key = objProps[index];
6912 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) return false;
6913 }
6914 var objStacked = stack.get(object);
6915 var othStacked = stack.get(other);
6916 if (objStacked && othStacked) return objStacked == other && othStacked == object;
6917 var result = true;
6918 stack.set(object, other);
6919 stack.set(other, object);
6920 var skipCtor = isPartial;
6921 while (++index < objLength) {
6922 key = objProps[index];
6923 var objValue = object[key];
6924 var othValue = other[key];
6925 if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
6926 if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
6927 result = false;
6928 break;
6929 }
6930 skipCtor || (skipCtor = key == "constructor");
6931 }
6932 if (result && !skipCtor) {
6933 var objCtor = object.constructor;
6934 var othCtor = other.constructor;
6935 if (objCtor != othCtor && "constructor" in object && "constructor" in other && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) result = false;
6936 }
6937 stack["delete"](object);
6938 stack["delete"](other);
6939 return result;
6940 }
6941 /**
6942 * A specialized version of `baseRest` which flattens the rest array.
6943 *
6944 * @private
6945 * @param {Function} func The function to apply a rest parameter to.
6946 * @returns {Function} Returns the new function.
6947 */
6948 function flatRest(func) {
6949 return setToString(overRest(func, undefined, flatten), func + "");
6950 }
6951 /**
6952 * Creates an array of own enumerable property names and symbols of `object`.
6953 *
6954 * @private
6955 * @param {Object} object The object to query.
6956 * @returns {Array} Returns the array of property names and symbols.
6957 */
6958 function getAllKeys(object) {
6959 return baseGetAllKeys(object, keys, getSymbols);
6960 }
6961 /**
6962 * Creates an array of own and inherited enumerable property names and
6963 * symbols of `object`.
6964 *
6965 * @private
6966 * @param {Object} object The object to query.
6967 * @returns {Array} Returns the array of property names and symbols.
6968 */
6969 function getAllKeysIn(object) {
6970 return baseGetAllKeys(object, keysIn, getSymbolsIn);
6971 }
6972 /**
6973 * Gets metadata for `func`.
6974 *
6975 * @private
6976 * @param {Function} func The function to query.
6977 * @returns {*} Returns the metadata for `func`.
6978 */
6979 var getData = !metaMap ? noop : function(func) {
6980 return metaMap.get(func);
6981 };
6982 /**
6983 * Gets the name of `func`.
6984 *
6985 * @private
6986 * @param {Function} func The function to query.
6987 * @returns {string} Returns the function name.
6988 */
6989 function getFuncName(func) {
6990 var result = func.name + "";
6991 var array = realNames[result];
6992 var length = hasOwnProperty.call(realNames, result) ? array.length : 0;
6993 while (length--) {
6994 var data = array[length];
6995 var otherFunc = data.func;
6996 if (otherFunc == null || otherFunc == func) return data.name;
6997 }
6998 return result;
6999 }
7000 /**
7001 * Gets the argument placeholder value for `func`.
7002 *
7003 * @private
7004 * @param {Function} func The function to inspect.
7005 * @returns {*} Returns the placeholder value.
7006 */
7007 function getHolder(func) {
7008 return (hasOwnProperty.call(lodash, "placeholder") ? lodash : func).placeholder;
7009 }
7010 /**
7011 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
7012 * this function returns the custom method, otherwise it returns `baseIteratee`.
7013 * If arguments are provided, the chosen function is invoked with them and
7014 * its result is returned.
7015 *
7016 * @private
7017 * @param {*} [value] The value to convert to an iteratee.
7018 * @param {number} [arity] The arity of the created iteratee.
7019 * @returns {Function} Returns the chosen function or its result.
7020 */
7021 function getIteratee() {
7022 var result = lodash.iteratee || iteratee;
7023 result = result === iteratee ? baseIteratee : result;
7024 return arguments.length ? result(arguments[0], arguments[1]) : result;
7025 }
7026 /**
7027 * Gets the data for `map`.
7028 *
7029 * @private
7030 * @param {Object} map The map to query.
7031 * @param {string} key The reference key.
7032 * @returns {*} Returns the map data.
7033 */
7034 function getMapData(map, key) {
7035 var data = map.__data__;
7036 return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
7037 }
7038 /**
7039 * Gets the property names, values, and compare flags of `object`.
7040 *
7041 * @private
7042 * @param {Object} object The object to query.
7043 * @returns {Array} Returns the match data of `object`.
7044 */
7045 function getMatchData(object) {
7046 var result = keys(object);
7047 var length = result.length;
7048 while (length--) {
7049 var key = result[length];
7050 var value = object[key];
7051 result[length] = [
7052 key,
7053 value,
7054 isStrictComparable(value)
7055 ];
7056 }
7057 return result;
7058 }
7059 /**
7060 * Gets the native function at `key` of `object`.
7061 *
7062 * @private
7063 * @param {Object} object The object to query.
7064 * @param {string} key The key of the method to get.
7065 * @returns {*} Returns the function if it's native, else `undefined`.
7066 */
7067 function getNative(object, key) {
7068 var value = getValue(object, key);
7069 return baseIsNative(value) ? value : undefined;
7070 }
7071 /**
7072 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
7073 *
7074 * @private
7075 * @param {*} value The value to query.
7076 * @returns {string} Returns the raw `toStringTag`.
7077 */
7078 function getRawTag(value) {
7079 var isOwn = hasOwnProperty.call(value, symToStringTag);
7080 var tag = value[symToStringTag];
7081 try {
7082 value[symToStringTag] = undefined;
7083 var unmasked = true;
7084 } catch (e) {}
7085 var result = nativeObjectToString.call(value);
7086 if (unmasked) if (isOwn) value[symToStringTag] = tag;
7087 else delete value[symToStringTag];
7088 return result;
7089 }
7090 /**
7091 * Creates an array of the own enumerable symbols of `object`.
7092 *
7093 * @private
7094 * @param {Object} object The object to query.
7095 * @returns {Array} Returns the array of symbols.
7096 */
7097 var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
7098 if (object == null) return [];
7099 object = Object(object);
7100 return arrayFilter(nativeGetSymbols(object), function(symbol) {
7101 return propertyIsEnumerable.call(object, symbol);
7102 });
7103 };
7104 /**
7105 * Creates an array of the own and inherited enumerable symbols of `object`.
7106 *
7107 * @private
7108 * @param {Object} object The object to query.
7109 * @returns {Array} Returns the array of symbols.
7110 */
7111 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
7112 var result = [];
7113 while (object) {
7114 arrayPush(result, getSymbols(object));
7115 object = getPrototype(object);
7116 }
7117 return result;
7118 };
7119 /**
7120 * Gets the `toStringTag` of `value`.
7121 *
7122 * @private
7123 * @param {*} value The value to query.
7124 * @returns {string} Returns the `toStringTag`.
7125 */
7126 var getTag = baseGetTag;
7127 if (DataView && getTag(new DataView(/* @__PURE__ */ new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) getTag = function(value) {
7128 var result = baseGetTag(value);
7129 var Ctor = result == objectTag ? value.constructor : undefined;
7130 var ctorString = Ctor ? toSource(Ctor) : "";
7131 if (ctorString) switch (ctorString) {
7132 case dataViewCtorString: return dataViewTag;
7133 case mapCtorString: return mapTag;
7134 case promiseCtorString: return promiseTag;
7135 case setCtorString: return setTag;
7136 case weakMapCtorString: return weakMapTag;
7137 }
7138 return result;
7139 };
7140 /**
7141 * Gets the view, applying any `transforms` to the `start` and `end` positions.
7142 *
7143 * @private
7144 * @param {number} start The start of the view.
7145 * @param {number} end The end of the view.
7146 * @param {Array} transforms The transformations to apply to the view.
7147 * @returns {Object} Returns an object containing the `start` and `end`
7148 * positions of the view.
7149 */
7150 function getView(start, end, transforms) {
7151 var index = -1;
7152 var length = transforms.length;
7153 while (++index < length) {
7154 var data = transforms[index];
7155 var size = data.size;
7156 switch (data.type) {
7157 case "drop":
7158 start += size;
7159 break;
7160 case "dropRight":
7161 end -= size;
7162 break;
7163 case "take":
7164 end = nativeMin(end, start + size);
7165 break;
7166 case "takeRight":
7167 start = nativeMax(start, end - size);
7168 break;
7169 }
7170 }
7171 return {
7172 "start": start,
7173 "end": end
7174 };
7175 }
7176 /**
7177 * Extracts wrapper details from the `source` body comment.
7178 *
7179 * @private
7180 * @param {string} source The source to inspect.
7181 * @returns {Array} Returns the wrapper details.
7182 */
7183 function getWrapDetails(source) {
7184 var match = source.match(reWrapDetails);
7185 return match ? match[1].split(reSplitDetails) : [];
7186 }
7187 /**
7188 * Checks if `path` exists on `object`.
7189 *
7190 * @private
7191 * @param {Object} object The object to query.
7192 * @param {Array|string} path The path to check.
7193 * @param {Function} hasFunc The function to check properties.
7194 * @returns {boolean} Returns `true` if `path` exists, else `false`.
7195 */
7196 function hasPath(object, path, hasFunc) {
7197 path = castPath(path, object);
7198 var index = -1;
7199 var length = path.length;
7200 var result = false;
7201 while (++index < length) {
7202 var key = toKey(path[index]);
7203 if (!(result = object != null && hasFunc(object, key))) break;
7204 object = object[key];
7205 }
7206 if (result || ++index != length) return result;
7207 length = object == null ? 0 : object.length;
7208 return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
7209 }
7210 /**
7211 * Initializes an array clone.
7212 *
7213 * @private
7214 * @param {Array} array The array to clone.
7215 * @returns {Array} Returns the initialized clone.
7216 */
7217 function initCloneArray(array) {
7218 var length = array.length;
7219 var result = new array.constructor(length);
7220 if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
7221 result.index = array.index;
7222 result.input = array.input;
7223 }
7224 return result;
7225 }
7226 /**
7227 * Initializes an object clone.
7228 *
7229 * @private
7230 * @param {Object} object The object to clone.
7231 * @returns {Object} Returns the initialized clone.
7232 */
7233 function initCloneObject(object) {
7234 return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
7235 }
7236 /**
7237 * Initializes an object clone based on its `toStringTag`.
7238 *
7239 * **Note:** This function only supports cloning values with tags of
7240 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
7241 *
7242 * @private
7243 * @param {Object} object The object to clone.
7244 * @param {string} tag The `toStringTag` of the object to clone.
7245 * @param {boolean} [isDeep] Specify a deep clone.
7246 * @returns {Object} Returns the initialized clone.
7247 */
7248 function initCloneByTag(object, tag, isDeep) {
7249 var Ctor = object.constructor;
7250 switch (tag) {
7251 case arrayBufferTag: return cloneArrayBuffer(object);
7252 case boolTag:
7253 case dateTag: return new Ctor(+object);
7254 case dataViewTag: return cloneDataView(object, isDeep);
7255 case float32Tag:
7256 case float64Tag:
7257 case int8Tag:
7258 case int16Tag:
7259 case int32Tag:
7260 case uint8Tag:
7261 case uint8ClampedTag:
7262 case uint16Tag:
7263 case uint32Tag: return cloneTypedArray(object, isDeep);
7264 case mapTag: return new Ctor();
7265 case numberTag:
7266 case stringTag: return new Ctor(object);
7267 case regexpTag: return cloneRegExp(object);
7268 case setTag: return new Ctor();
7269 case symbolTag: return cloneSymbol(object);
7270 }
7271 }
7272 /**
7273 * Inserts wrapper `details` in a comment at the top of the `source` body.
7274 *
7275 * @private
7276 * @param {string} source The source to modify.
7277 * @returns {Array} details The details to insert.
7278 * @returns {string} Returns the modified source.
7279 */
7280 function insertWrapDetails(source, details) {
7281 var length = details.length;
7282 if (!length) return source;
7283 var lastIndex = length - 1;
7284 details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
7285 details = details.join(length > 2 ? ", " : " ");
7286 return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
7287 }
7288 /**
7289 * Checks if `value` is a flattenable `arguments` object or array.
7290 *
7291 * @private
7292 * @param {*} value The value to check.
7293 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
7294 */
7295 function isFlattenable(value) {
7296 return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
7297 }
7298 /**
7299 * Checks if `value` is a valid array-like index.
7300 *
7301 * @private
7302 * @param {*} value The value to check.
7303 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
7304 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
7305 */
7306 function isIndex(value, length) {
7307 var type = typeof value;
7308 length = length == null ? MAX_SAFE_INTEGER : length;
7309 return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
7310 }
7311 /**
7312 * Checks if the given arguments are from an iteratee call.
7313 *
7314 * @private
7315 * @param {*} value The potential iteratee value argument.
7316 * @param {*} index The potential iteratee index or key argument.
7317 * @param {*} object The potential iteratee object argument.
7318 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
7319 * else `false`.
7320 */
7321 function isIterateeCall(value, index, object) {
7322 if (!isObject(object)) return false;
7323 var type = typeof index;
7324 if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) return eq(object[index], value);
7325 return false;
7326 }
7327 /**
7328 * Checks if `value` is a property name and not a property path.
7329 *
7330 * @private
7331 * @param {*} value The value to check.
7332 * @param {Object} [object] The object to query keys on.
7333 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
7334 */
7335 function isKey(value, object) {
7336 if (isArray(value)) return false;
7337 var type = typeof value;
7338 if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true;
7339 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
7340 }
7341 /**
7342 * Checks if `value` is suitable for use as unique object key.
7343 *
7344 * @private
7345 * @param {*} value The value to check.
7346 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
7347 */
7348 function isKeyable(value) {
7349 var type = typeof value;
7350 return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
7351 }
7352 /**
7353 * Checks if `func` has a lazy counterpart.
7354 *
7355 * @private
7356 * @param {Function} func The function to check.
7357 * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
7358 * else `false`.
7359 */
7360 function isLaziable(func) {
7361 var funcName = getFuncName(func);
7362 var other = lodash[funcName];
7363 if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) return false;
7364 if (func === other) return true;
7365 var data = getData(other);
7366 return !!data && func === data[0];
7367 }
7368 /**
7369 * Checks if `func` has its source masked.
7370 *
7371 * @private
7372 * @param {Function} func The function to check.
7373 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
7374 */
7375 function isMasked(func) {
7376 return !!maskSrcKey && maskSrcKey in func;
7377 }
7378 /**
7379 * Checks if `func` is capable of being masked.
7380 *
7381 * @private
7382 * @param {*} value The value to check.
7383 * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
7384 */
7385 var isMaskable = coreJsData ? isFunction : stubFalse;
7386 /**
7387 * Checks if `value` is likely a prototype object.
7388 *
7389 * @private
7390 * @param {*} value The value to check.
7391 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
7392 */
7393 function isPrototype(value) {
7394 var Ctor = value && value.constructor;
7395 return value === (typeof Ctor == "function" && Ctor.prototype || objectProto);
7396 }
7397 /**
7398 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
7399 *
7400 * @private
7401 * @param {*} value The value to check.
7402 * @returns {boolean} Returns `true` if `value` if suitable for strict
7403 * equality comparisons, else `false`.
7404 */
7405 function isStrictComparable(value) {
7406 return value === value && !isObject(value);
7407 }
7408 /**
7409 * A specialized version of `matchesProperty` for source values suitable
7410 * for strict equality comparisons, i.e. `===`.
7411 *
7412 * @private
7413 * @param {string} key The key of the property to get.
7414 * @param {*} srcValue The value to match.
7415 * @returns {Function} Returns the new spec function.
7416 */
7417 function matchesStrictComparable(key, srcValue) {
7418 return function(object) {
7419 if (object == null) return false;
7420 return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
7421 };
7422 }
7423 /**
7424 * A specialized version of `_.memoize` which clears the memoized function's
7425 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
7426 *
7427 * @private
7428 * @param {Function} func The function to have its output memoized.
7429 * @returns {Function} Returns the new memoized function.
7430 */
7431 function memoizeCapped(func) {
7432 var result = memoize(func, function(key) {
7433 if (cache.size === MAX_MEMOIZE_SIZE) cache.clear();
7434 return key;
7435 });
7436 var cache = result.cache;
7437 return result;
7438 }
7439 /**
7440 * Merges the function metadata of `source` into `data`.
7441 *
7442 * Merging metadata reduces the number of wrappers used to invoke a function.
7443 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
7444 * may be applied regardless of execution order. Methods like `_.ary` and
7445 * `_.rearg` modify function arguments, making the order in which they are
7446 * executed important, preventing the merging of metadata. However, we make
7447 * an exception for a safe combined case where curried functions have `_.ary`
7448 * and or `_.rearg` applied.
7449 *
7450 * @private
7451 * @param {Array} data The destination metadata.
7452 * @param {Array} source The source metadata.
7453 * @returns {Array} Returns `data`.
7454 */
7455 function mergeData(data, source) {
7456 var bitmask = data[1];
7457 var srcBitmask = source[1];
7458 var newBitmask = bitmask | srcBitmask;
7459 var isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
7460 var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
7461 if (!(isCommon || isCombo)) return data;
7462 if (srcBitmask & WRAP_BIND_FLAG) {
7463 data[2] = source[2];
7464 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
7465 }
7466 var value = source[3];
7467 if (value) {
7468 var partials = data[3];
7469 data[3] = partials ? composeArgs(partials, value, source[4]) : value;
7470 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
7471 }
7472 value = source[5];
7473 if (value) {
7474 partials = data[5];
7475 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
7476 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
7477 }
7478 value = source[7];
7479 if (value) data[7] = value;
7480 if (srcBitmask & WRAP_ARY_FLAG) data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
7481 if (data[9] == null) data[9] = source[9];
7482 data[0] = source[0];
7483 data[1] = newBitmask;
7484 return data;
7485 }
7486 /**
7487 * This function is like
7488 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
7489 * except that it includes inherited enumerable properties.
7490 *
7491 * @private
7492 * @param {Object} object The object to query.
7493 * @returns {Array} Returns the array of property names.
7494 */
7495 function nativeKeysIn(object) {
7496 var result = [];
7497 if (object != null) for (var key in Object(object)) result.push(key);
7498 return result;
7499 }
7500 /**
7501 * Converts `value` to a string using `Object.prototype.toString`.
7502 *
7503 * @private
7504 * @param {*} value The value to convert.
7505 * @returns {string} Returns the converted string.
7506 */
7507 function objectToString(value) {
7508 return nativeObjectToString.call(value);
7509 }
7510 /**
7511 * A specialized version of `baseRest` which transforms the rest array.
7512 *
7513 * @private
7514 * @param {Function} func The function to apply a rest parameter to.
7515 * @param {number} [start=func.length-1] The start position of the rest parameter.
7516 * @param {Function} transform The rest array transform.
7517 * @returns {Function} Returns the new function.
7518 */
7519 function overRest(func, start, transform) {
7520 start = nativeMax(start === undefined ? func.length - 1 : start, 0);
7521 return function() {
7522 var args = arguments;
7523 var index = -1;
7524 var length = nativeMax(args.length - start, 0);
7525 var array = Array(length);
7526 while (++index < length) array[index] = args[start + index];
7527 index = -1;
7528 var otherArgs = Array(start + 1);
7529 while (++index < start) otherArgs[index] = args[index];
7530 otherArgs[start] = transform(array);
7531 return apply(func, this, otherArgs);
7532 };
7533 }
7534 /**
7535 * Gets the parent value at `path` of `object`.
7536 *
7537 * @private
7538 * @param {Object} object The object to query.
7539 * @param {Array} path The path to get the parent value of.
7540 * @returns {*} Returns the parent value.
7541 */
7542 function parent(object, path) {
7543 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
7544 }
7545 /**
7546 * Reorder `array` according to the specified indexes where the element at
7547 * the first index is assigned as the first element, the element at
7548 * the second index is assigned as the second element, and so on.
7549 *
7550 * @private
7551 * @param {Array} array The array to reorder.
7552 * @param {Array} indexes The arranged array indexes.
7553 * @returns {Array} Returns `array`.
7554 */
7555 function reorder(array, indexes) {
7556 var arrLength = array.length;
7557 var length = nativeMin(indexes.length, arrLength);
7558 var oldArray = copyArray(array);
7559 while (length--) {
7560 var index = indexes[length];
7561 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
7562 }
7563 return array;
7564 }
7565 /**
7566 * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
7567 *
7568 * @private
7569 * @param {Object} object The object to query.
7570 * @param {string} key The key of the property to get.
7571 * @returns {*} Returns the property value.
7572 */
7573 function safeGet(object, key) {
7574 if (key === "constructor" && typeof object[key] === "function") return;
7575 if (key == "__proto__") return;
7576 return object[key];
7577 }
7578 /**
7579 * Sets metadata for `func`.
7580 *
7581 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
7582 * period of time, it will trip its breaker and transition to an identity
7583 * function to avoid garbage collection pauses in V8. See
7584 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
7585 * for more details.
7586 *
7587 * @private
7588 * @param {Function} func The function to associate metadata with.
7589 * @param {*} data The metadata.
7590 * @returns {Function} Returns `func`.
7591 */
7592 var setData = shortOut(baseSetData);
7593 /**
7594 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
7595 *
7596 * @private
7597 * @param {Function} func The function to delay.
7598 * @param {number} wait The number of milliseconds to delay invocation.
7599 * @returns {number|Object} Returns the timer id or timeout object.
7600 */
7601 var setTimeout = ctxSetTimeout || function(func, wait) {
7602 return root.setTimeout(func, wait);
7603 };
7604 /**
7605 * Sets the `toString` method of `func` to return `string`.
7606 *
7607 * @private
7608 * @param {Function} func The function to modify.
7609 * @param {Function} string The `toString` result.
7610 * @returns {Function} Returns `func`.
7611 */
7612 var setToString = shortOut(baseSetToString);
7613 /**
7614 * Sets the `toString` method of `wrapper` to mimic the source of `reference`
7615 * with wrapper details in a comment at the top of the source body.
7616 *
7617 * @private
7618 * @param {Function} wrapper The function to modify.
7619 * @param {Function} reference The reference function.
7620 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
7621 * @returns {Function} Returns `wrapper`.
7622 */
7623 function setWrapToString(wrapper, reference, bitmask) {
7624 var source = reference + "";
7625 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
7626 }
7627 /**
7628 * Creates a function that'll short out and invoke `identity` instead
7629 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
7630 * milliseconds.
7631 *
7632 * @private
7633 * @param {Function} func The function to restrict.
7634 * @returns {Function} Returns the new shortable function.
7635 */
7636 function shortOut(func) {
7637 var count = 0;
7638 var lastCalled = 0;
7639 return function() {
7640 var stamp = nativeNow();
7641 var remaining = HOT_SPAN - (stamp - lastCalled);
7642 lastCalled = stamp;
7643 if (remaining > 0) {
7644 if (++count >= HOT_COUNT) return arguments[0];
7645 } else count = 0;
7646 return func.apply(undefined, arguments);
7647 };
7648 }
7649 /**
7650 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
7651 *
7652 * @private
7653 * @param {Array} array The array to shuffle.
7654 * @param {number} [size=array.length] The size of `array`.
7655 * @returns {Array} Returns `array`.
7656 */
7657 function shuffleSelf(array, size) {
7658 var index = -1;
7659 var length = array.length;
7660 var lastIndex = length - 1;
7661 size = size === undefined ? length : size;
7662 while (++index < size) {
7663 var rand = baseRandom(index, lastIndex);
7664 var value = array[rand];
7665 array[rand] = array[index];
7666 array[index] = value;
7667 }
7668 array.length = size;
7669 return array;
7670 }
7671 /**
7672 * Converts `string` to a property path array.
7673 *
7674 * @private
7675 * @param {string} string The string to convert.
7676 * @returns {Array} Returns the property path array.
7677 */
7678 var stringToPath = memoizeCapped(function(string) {
7679 var result = [];
7680 if (string.charCodeAt(0) === 46) result.push("");
7681 string.replace(rePropName, function(match, number, quote, subString) {
7682 result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
7683 });
7684 return result;
7685 });
7686 /**
7687 * Converts `value` to a string key if it's not a string or symbol.
7688 *
7689 * @private
7690 * @param {*} value The value to inspect.
7691 * @returns {string|symbol} Returns the key.
7692 */
7693 function toKey(value) {
7694 if (typeof value == "string" || isSymbol(value)) return value;
7695 var result = value + "";
7696 return result == "0" && 1 / value == -Infinity ? "-0" : result;
7697 }
7698 /**
7699 * Converts `func` to its source code.
7700 *
7701 * @private
7702 * @param {Function} func The function to convert.
7703 * @returns {string} Returns the source code.
7704 */
7705 function toSource(func) {
7706 if (func != null) {
7707 try {
7708 return funcToString.call(func);
7709 } catch (e) {}
7710 try {
7711 return func + "";
7712 } catch (e) {}
7713 }
7714 return "";
7715 }
7716 /**
7717 * Updates wrapper `details` based on `bitmask` flags.
7718 *
7719 * @private
7720 * @returns {Array} details The details to modify.
7721 * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
7722 * @returns {Array} Returns `details`.
7723 */
7724 function updateWrapDetails(details, bitmask) {
7725 arrayEach(wrapFlags, function(pair) {
7726 var value = "_." + pair[0];
7727 if (bitmask & pair[1] && !arrayIncludes(details, value)) details.push(value);
7728 });
7729 return details.sort();
7730 }
7731 /**
7732 * Creates a clone of `wrapper`.
7733 *
7734 * @private
7735 * @param {Object} wrapper The wrapper to clone.
7736 * @returns {Object} Returns the cloned wrapper.
7737 */
7738 function wrapperClone(wrapper) {
7739 if (wrapper instanceof LazyWrapper) return wrapper.clone();
7740 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
7741 result.__actions__ = copyArray(wrapper.__actions__);
7742 result.__index__ = wrapper.__index__;
7743 result.__values__ = wrapper.__values__;
7744 return result;
7745 }
7746 /**
7747 * Creates an array of elements split into groups the length of `size`.
7748 * If `array` can't be split evenly, the final chunk will be the remaining
7749 * elements.
7750 *
7751 * @static
7752 * @memberOf _
7753 * @since 3.0.0
7754 * @category Array
7755 * @param {Array} array The array to process.
7756 * @param {number} [size=1] The length of each chunk
7757 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
7758 * @returns {Array} Returns the new array of chunks.
7759 * @example
7760 *
7761 * _.chunk(['a', 'b', 'c', 'd'], 2);
7762 * // => [['a', 'b'], ['c', 'd']]
7763 *
7764 * _.chunk(['a', 'b', 'c', 'd'], 3);
7765 * // => [['a', 'b', 'c'], ['d']]
7766 */
7767 function chunk(array, size, guard) {
7768 if (guard ? isIterateeCall(array, size, guard) : size === undefined) size = 1;
7769 else size = nativeMax(toInteger(size), 0);
7770 var length = array == null ? 0 : array.length;
7771 if (!length || size < 1) return [];
7772 var index = 0;
7773 var resIndex = 0;
7774 var result = Array(nativeCeil(length / size));
7775 while (index < length) result[resIndex++] = baseSlice(array, index, index += size);
7776 return result;
7777 }
7778 /**
7779 * Creates an array with all falsey values removed. The values `false`, `null`,
7780 * `0`, `-0`, `0n`, `""`, `undefined`, and `NaN` are falsy.
7781 *
7782 * @static
7783 * @memberOf _
7784 * @since 0.1.0
7785 * @category Array
7786 * @param {Array} array The array to compact.
7787 * @returns {Array} Returns the new array of filtered values.
7788 * @example
7789 *
7790 * _.compact([0, 1, false, 2, '', 3]);
7791 * // => [1, 2, 3]
7792 */
7793 function compact(array) {
7794 var index = -1;
7795 var length = array == null ? 0 : array.length;
7796 var resIndex = 0;
7797 var result = [];
7798 while (++index < length) {
7799 var value = array[index];
7800 if (value) result[resIndex++] = value;
7801 }
7802 return result;
7803 }
7804 /**
7805 * Creates a new array concatenating `array` with any additional arrays
7806 * and/or values.
7807 *
7808 * @static
7809 * @memberOf _
7810 * @since 4.0.0
7811 * @category Array
7812 * @param {Array} array The array to concatenate.
7813 * @param {...*} [values] The values to concatenate.
7814 * @returns {Array} Returns the new concatenated array.
7815 * @example
7816 *
7817 * var array = [1];
7818 * var other = _.concat(array, 2, [3], [[4]]);
7819 *
7820 * console.log(other);
7821 * // => [1, 2, 3, [4]]
7822 *
7823 * console.log(array);
7824 * // => [1]
7825 */
7826 function concat() {
7827 var length = arguments.length;
7828 if (!length) return [];
7829 var args = Array(length - 1);
7830 var array = arguments[0];
7831 var index = length;
7832 while (index--) args[index - 1] = arguments[index];
7833 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
7834 }
7835 /**
7836 * Creates an array of `array` values not included in the other given arrays
7837 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
7838 * for equality comparisons. The order and references of result values are
7839 * determined by the first array.
7840 *
7841 * **Note:** Unlike `_.pullAll`, this method returns a new array.
7842 *
7843 * @static
7844 * @memberOf _
7845 * @since 0.1.0
7846 * @category Array
7847 * @param {Array} array The array to inspect.
7848 * @param {...Array} [values] The values to exclude.
7849 * @returns {Array} Returns the new array of filtered values.
7850 * @see _.without, _.xor
7851 * @example
7852 *
7853 * _.difference([2, 1], [2, 3]);
7854 * // => [1]
7855 */
7856 var difference = baseRest(function(array, values) {
7857 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
7858 });
7859 /**
7860 * This method is like `_.difference` except that it accepts `iteratee` which
7861 * is invoked for each element of `array` and `values` to generate the criterion
7862 * by which they're compared. The order and references of result values are
7863 * determined by the first array. The iteratee is invoked with one argument:
7864 * (value).
7865 *
7866 * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
7867 *
7868 * @static
7869 * @memberOf _
7870 * @since 4.0.0
7871 * @category Array
7872 * @param {Array} array The array to inspect.
7873 * @param {...Array} [values] The values to exclude.
7874 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
7875 * @returns {Array} Returns the new array of filtered values.
7876 * @example
7877 *
7878 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
7879 * // => [1.2]
7880 *
7881 * // The `_.property` iteratee shorthand.
7882 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
7883 * // => [{ 'x': 2 }]
7884 */
7885 var differenceBy = baseRest(function(array, values) {
7886 var iteratee = last(values);
7887 if (isArrayLikeObject(iteratee)) iteratee = undefined;
7888 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) : [];
7889 });
7890 /**
7891 * This method is like `_.difference` except that it accepts `comparator`
7892 * which is invoked to compare elements of `array` to `values`. The order and
7893 * references of result values are determined by the first array. The comparator
7894 * is invoked with two arguments: (arrVal, othVal).
7895 *
7896 * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
7897 *
7898 * @static
7899 * @memberOf _
7900 * @since 4.0.0
7901 * @category Array
7902 * @param {Array} array The array to inspect.
7903 * @param {...Array} [values] The values to exclude.
7904 * @param {Function} [comparator] The comparator invoked per element.
7905 * @returns {Array} Returns the new array of filtered values.
7906 * @example
7907 *
7908 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
7909 *
7910 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
7911 * // => [{ 'x': 2, 'y': 1 }]
7912 */
7913 var differenceWith = baseRest(function(array, values) {
7914 var comparator = last(values);
7915 if (isArrayLikeObject(comparator)) comparator = undefined;
7916 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) : [];
7917 });
7918 /**
7919 * Creates a slice of `array` with `n` elements dropped from the beginning.
7920 *
7921 * @static
7922 * @memberOf _
7923 * @since 0.5.0
7924 * @category Array
7925 * @param {Array} array The array to query.
7926 * @param {number} [n=1] The number of elements to drop.
7927 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
7928 * @returns {Array} Returns the slice of `array`.
7929 * @example
7930 *
7931 * _.drop([1, 2, 3]);
7932 * // => [2, 3]
7933 *
7934 * _.drop([1, 2, 3], 2);
7935 * // => [3]
7936 *
7937 * _.drop([1, 2, 3], 5);
7938 * // => []
7939 *
7940 * _.drop([1, 2, 3], 0);
7941 * // => [1, 2, 3]
7942 */
7943 function drop(array, n, guard) {
7944 var length = array == null ? 0 : array.length;
7945 if (!length) return [];
7946 n = guard || n === undefined ? 1 : toInteger(n);
7947 return baseSlice(array, n < 0 ? 0 : n, length);
7948 }
7949 /**
7950 * Creates a slice of `array` with `n` elements dropped from the end.
7951 *
7952 * @static
7953 * @memberOf _
7954 * @since 3.0.0
7955 * @category Array
7956 * @param {Array} array The array to query.
7957 * @param {number} [n=1] The number of elements to drop.
7958 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
7959 * @returns {Array} Returns the slice of `array`.
7960 * @example
7961 *
7962 * _.dropRight([1, 2, 3]);
7963 * // => [1, 2]
7964 *
7965 * _.dropRight([1, 2, 3], 2);
7966 * // => [1]
7967 *
7968 * _.dropRight([1, 2, 3], 5);
7969 * // => []
7970 *
7971 * _.dropRight([1, 2, 3], 0);
7972 * // => [1, 2, 3]
7973 */
7974 function dropRight(array, n, guard) {
7975 var length = array == null ? 0 : array.length;
7976 if (!length) return [];
7977 n = guard || n === undefined ? 1 : toInteger(n);
7978 n = length - n;
7979 return baseSlice(array, 0, n < 0 ? 0 : n);
7980 }
7981 /**
7982 * Creates a slice of `array` excluding elements dropped from the end.
7983 * Elements are dropped until `predicate` returns falsey. The predicate is
7984 * invoked with three arguments: (value, index, array).
7985 *
7986 * @static
7987 * @memberOf _
7988 * @since 3.0.0
7989 * @category Array
7990 * @param {Array} array The array to query.
7991 * @param {Function} [predicate=_.identity] The function invoked per iteration.
7992 * @returns {Array} Returns the slice of `array`.
7993 * @example
7994 *
7995 * var users = [
7996 * { 'user': 'barney', 'active': true },
7997 * { 'user': 'fred', 'active': false },
7998 * { 'user': 'pebbles', 'active': false }
7999 * ];
8000 *
8001 * _.dropRightWhile(users, function(o) { return !o.active; });
8002 * // => objects for ['barney']
8003 *
8004 * // The `_.matches` iteratee shorthand.
8005 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
8006 * // => objects for ['barney', 'fred']
8007 *
8008 * // The `_.matchesProperty` iteratee shorthand.
8009 * _.dropRightWhile(users, ['active', false]);
8010 * // => objects for ['barney']
8011 *
8012 * // The `_.property` iteratee shorthand.
8013 * _.dropRightWhile(users, 'active');
8014 * // => objects for ['barney', 'fred', 'pebbles']
8015 */
8016 function dropRightWhile(array, predicate) {
8017 return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : [];
8018 }
8019 /**
8020 * Creates a slice of `array` excluding elements dropped from the beginning.
8021 * Elements are dropped until `predicate` returns falsey. The predicate is
8022 * invoked with three arguments: (value, index, array).
8023 *
8024 * @static
8025 * @memberOf _
8026 * @since 3.0.0
8027 * @category Array
8028 * @param {Array} array The array to query.
8029 * @param {Function} [predicate=_.identity] The function invoked per iteration.
8030 * @returns {Array} Returns the slice of `array`.
8031 * @example
8032 *
8033 * var users = [
8034 * { 'user': 'barney', 'active': false },
8035 * { 'user': 'fred', 'active': false },
8036 * { 'user': 'pebbles', 'active': true }
8037 * ];
8038 *
8039 * _.dropWhile(users, function(o) { return !o.active; });
8040 * // => objects for ['pebbles']
8041 *
8042 * // The `_.matches` iteratee shorthand.
8043 * _.dropWhile(users, { 'user': 'barney', 'active': false });
8044 * // => objects for ['fred', 'pebbles']
8045 *
8046 * // The `_.matchesProperty` iteratee shorthand.
8047 * _.dropWhile(users, ['active', false]);
8048 * // => objects for ['pebbles']
8049 *
8050 * // The `_.property` iteratee shorthand.
8051 * _.dropWhile(users, 'active');
8052 * // => objects for ['barney', 'fred', 'pebbles']
8053 */
8054 function dropWhile(array, predicate) {
8055 return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : [];
8056 }
8057 /**
8058 * Fills elements of `array` with `value` from `start` up to, but not
8059 * including, `end`.
8060 *
8061 * **Note:** This method mutates `array`.
8062 *
8063 * @static
8064 * @memberOf _
8065 * @since 3.2.0
8066 * @category Array
8067 * @param {Array} array The array to fill.
8068 * @param {*} value The value to fill `array` with.
8069 * @param {number} [start=0] The start position.
8070 * @param {number} [end=array.length] The end position.
8071 * @returns {Array} Returns `array`.
8072 * @example
8073 *
8074 * var array = [1, 2, 3];
8075 *
8076 * _.fill(array, 'a');
8077 * console.log(array);
8078 * // => ['a', 'a', 'a']
8079 *
8080 * _.fill(Array(3), 2);
8081 * // => [2, 2, 2]
8082 *
8083 * _.fill([4, 6, 8, 10], '*', 1, 3);
8084 * // => [4, '*', '*', 10]
8085 */
8086 function fill(array, value, start, end) {
8087 var length = array == null ? 0 : array.length;
8088 if (!length) return [];
8089 if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
8090 start = 0;
8091 end = length;
8092 }
8093 return baseFill(array, value, start, end);
8094 }
8095 /**
8096 * This method is like `_.find` except that it returns the index of the first
8097 * element `predicate` returns truthy for instead of the element itself.
8098 *
8099 * @static
8100 * @memberOf _
8101 * @since 1.1.0
8102 * @category Array
8103 * @param {Array} array The array to inspect.
8104 * @param {Function} [predicate=_.identity] The function invoked per iteration.
8105 * @param {number} [fromIndex=0] The index to search from.
8106 * @returns {number} Returns the index of the found element, else `-1`.
8107 * @example
8108 *
8109 * var users = [
8110 * { 'user': 'barney', 'active': false },
8111 * { 'user': 'fred', 'active': false },
8112 * { 'user': 'pebbles', 'active': true }
8113 * ];
8114 *
8115 * _.findIndex(users, function(o) { return o.user == 'barney'; });
8116 * // => 0
8117 *
8118 * // The `_.matches` iteratee shorthand.
8119 * _.findIndex(users, { 'user': 'fred', 'active': false });
8120 * // => 1
8121 *
8122 * // The `_.matchesProperty` iteratee shorthand.
8123 * _.findIndex(users, ['active', false]);
8124 * // => 0
8125 *
8126 * // The `_.property` iteratee shorthand.
8127 * _.findIndex(users, 'active');
8128 * // => 2
8129 */
8130 function findIndex(array, predicate, fromIndex) {
8131 var length = array == null ? 0 : array.length;
8132 if (!length) return -1;
8133 var index = fromIndex == null ? 0 : toInteger(fromIndex);
8134 if (index < 0) index = nativeMax(length + index, 0);
8135 return baseFindIndex(array, getIteratee(predicate, 3), index);
8136 }
8137 /**
8138 * This method is like `_.findIndex` except that it iterates over elements
8139 * of `collection` from right to left.
8140 *
8141 * @static
8142 * @memberOf _
8143 * @since 2.0.0
8144 * @category Array
8145 * @param {Array} array The array to inspect.
8146 * @param {Function} [predicate=_.identity] The function invoked per iteration.
8147 * @param {number} [fromIndex=array.length-1] The index to search from.
8148 * @returns {number} Returns the index of the found element, else `-1`.
8149 * @example
8150 *
8151 * var users = [
8152 * { 'user': 'barney', 'active': true },
8153 * { 'user': 'fred', 'active': false },
8154 * { 'user': 'pebbles', 'active': false }
8155 * ];
8156 *
8157 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
8158 * // => 2
8159 *
8160 * // The `_.matches` iteratee shorthand.
8161 * _.findLastIndex(users, { 'user': 'barney', 'active': true });
8162 * // => 0
8163 *
8164 * // The `_.matchesProperty` iteratee shorthand.
8165 * _.findLastIndex(users, ['active', false]);
8166 * // => 2
8167 *
8168 * // The `_.property` iteratee shorthand.
8169 * _.findLastIndex(users, 'active');
8170 * // => 0
8171 */
8172 function findLastIndex(array, predicate, fromIndex) {
8173 var length = array == null ? 0 : array.length;
8174 if (!length) return -1;
8175 var index = length - 1;
8176 if (fromIndex !== undefined) {
8177 index = toInteger(fromIndex);
8178 index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
8179 }
8180 return baseFindIndex(array, getIteratee(predicate, 3), index, true);
8181 }
8182 /**
8183 * Flattens `array` a single level deep.
8184 *
8185 * @static
8186 * @memberOf _
8187 * @since 0.1.0
8188 * @category Array
8189 * @param {Array} array The array to flatten.
8190 * @returns {Array} Returns the new flattened array.
8191 * @example
8192 *
8193 * _.flatten([1, [2, [3, [4]], 5]]);
8194 * // => [1, 2, [3, [4]], 5]
8195 */
8196 function flatten(array) {
8197 return (array == null ? 0 : array.length) ? baseFlatten(array, 1) : [];
8198 }
8199 /**
8200 * Recursively flattens `array`.
8201 *
8202 * @static
8203 * @memberOf _
8204 * @since 3.0.0
8205 * @category Array
8206 * @param {Array} array The array to flatten.
8207 * @returns {Array} Returns the new flattened array.
8208 * @example
8209 *
8210 * _.flattenDeep([1, [2, [3, [4]], 5]]);
8211 * // => [1, 2, 3, 4, 5]
8212 */
8213 function flattenDeep(array) {
8214 return (array == null ? 0 : array.length) ? baseFlatten(array, INFINITY) : [];
8215 }
8216 /**
8217 * Recursively flatten `array` up to `depth` times.
8218 *
8219 * @static
8220 * @memberOf _
8221 * @since 4.4.0
8222 * @category Array
8223 * @param {Array} array The array to flatten.
8224 * @param {number} [depth=1] The maximum recursion depth.
8225 * @returns {Array} Returns the new flattened array.
8226 * @example
8227 *
8228 * var array = [1, [2, [3, [4]], 5]];
8229 *
8230 * _.flattenDepth(array, 1);
8231 * // => [1, 2, [3, [4]], 5]
8232 *
8233 * _.flattenDepth(array, 2);
8234 * // => [1, 2, 3, [4], 5]
8235 */
8236 function flattenDepth(array, depth) {
8237 if (!(array == null ? 0 : array.length)) return [];
8238 depth = depth === undefined ? 1 : toInteger(depth);
8239 return baseFlatten(array, depth);
8240 }
8241 /**
8242 * The inverse of `_.toPairs`; this method returns an object composed
8243 * from key-value `pairs`.
8244 *
8245 * @static
8246 * @memberOf _
8247 * @since 4.0.0
8248 * @category Array
8249 * @param {Array} pairs The key-value pairs.
8250 * @returns {Object} Returns the new object.
8251 * @example
8252 *
8253 * _.fromPairs([['a', 1], ['b', 2]]);
8254 * // => { 'a': 1, 'b': 2 }
8255 */
8256 function fromPairs(pairs) {
8257 var index = -1;
8258 var length = pairs == null ? 0 : pairs.length;
8259 var result = {};
8260 while (++index < length) {
8261 var pair = pairs[index];
8262 baseAssignValue(result, pair[0], pair[1]);
8263 }
8264 return result;
8265 }
8266 /**
8267 * Gets the first element of `array`.
8268 *
8269 * @static
8270 * @memberOf _
8271 * @since 0.1.0
8272 * @alias first
8273 * @category Array
8274 * @param {Array} array The array to query.
8275 * @returns {*} Returns the first element of `array`.
8276 * @example
8277 *
8278 * _.head([1, 2, 3]);
8279 * // => 1
8280 *
8281 * _.head([]);
8282 * // => undefined
8283 */
8284 function head(array) {
8285 return array && array.length ? array[0] : undefined;
8286 }
8287 /**
8288 * Gets the index at which the first occurrence of `value` is found in `array`
8289 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8290 * for equality comparisons. If `fromIndex` is negative, it's used as the
8291 * offset from the end of `array`.
8292 *
8293 * @static
8294 * @memberOf _
8295 * @since 0.1.0
8296 * @category Array
8297 * @param {Array} array The array to inspect.
8298 * @param {*} value The value to search for.
8299 * @param {number} [fromIndex=0] The index to search from.
8300 * @returns {number} Returns the index of the matched value, else `-1`.
8301 * @example
8302 *
8303 * _.indexOf([1, 2, 1, 2], 2);
8304 * // => 1
8305 *
8306 * // Search from the `fromIndex`.
8307 * _.indexOf([1, 2, 1, 2], 2, 2);
8308 * // => 3
8309 */
8310 function indexOf(array, value, fromIndex) {
8311 var length = array == null ? 0 : array.length;
8312 if (!length) return -1;
8313 var index = fromIndex == null ? 0 : toInteger(fromIndex);
8314 if (index < 0) index = nativeMax(length + index, 0);
8315 return baseIndexOf(array, value, index);
8316 }
8317 /**
8318 * Gets all but the last element of `array`.
8319 *
8320 * @static
8321 * @memberOf _
8322 * @since 0.1.0
8323 * @category Array
8324 * @param {Array} array The array to query.
8325 * @returns {Array} Returns the slice of `array`.
8326 * @example
8327 *
8328 * _.initial([1, 2, 3]);
8329 * // => [1, 2]
8330 */
8331 function initial(array) {
8332 return (array == null ? 0 : array.length) ? baseSlice(array, 0, -1) : [];
8333 }
8334 /**
8335 * Creates an array of unique values that are included in all given arrays
8336 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8337 * for equality comparisons. The order and references of result values are
8338 * determined by the first array.
8339 *
8340 * @static
8341 * @memberOf _
8342 * @since 0.1.0
8343 * @category Array
8344 * @param {...Array} [arrays] The arrays to inspect.
8345 * @returns {Array} Returns the new array of intersecting values.
8346 * @example
8347 *
8348 * _.intersection([2, 1], [2, 3]);
8349 * // => [2]
8350 */
8351 var intersection = baseRest(function(arrays) {
8352 var mapped = arrayMap(arrays, castArrayLikeObject);
8353 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
8354 });
8355 /**
8356 * This method is like `_.intersection` except that it accepts `iteratee`
8357 * which is invoked for each element of each `arrays` to generate the criterion
8358 * by which they're compared. The order and references of result values are
8359 * determined by the first array. The iteratee is invoked with one argument:
8360 * (value).
8361 *
8362 * @static
8363 * @memberOf _
8364 * @since 4.0.0
8365 * @category Array
8366 * @param {...Array} [arrays] The arrays to inspect.
8367 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8368 * @returns {Array} Returns the new array of intersecting values.
8369 * @example
8370 *
8371 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
8372 * // => [2.1]
8373 *
8374 * // The `_.property` iteratee shorthand.
8375 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
8376 * // => [{ 'x': 1 }]
8377 */
8378 var intersectionBy = baseRest(function(arrays) {
8379 var iteratee = last(arrays);
8380 var mapped = arrayMap(arrays, castArrayLikeObject);
8381 if (iteratee === last(mapped)) iteratee = undefined;
8382 else mapped.pop();
8383 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee, 2)) : [];
8384 });
8385 /**
8386 * This method is like `_.intersection` except that it accepts `comparator`
8387 * which is invoked to compare elements of `arrays`. The order and references
8388 * of result values are determined by the first array. The comparator is
8389 * invoked with two arguments: (arrVal, othVal).
8390 *
8391 * @static
8392 * @memberOf _
8393 * @since 4.0.0
8394 * @category Array
8395 * @param {...Array} [arrays] The arrays to inspect.
8396 * @param {Function} [comparator] The comparator invoked per element.
8397 * @returns {Array} Returns the new array of intersecting values.
8398 * @example
8399 *
8400 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
8401 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
8402 *
8403 * _.intersectionWith(objects, others, _.isEqual);
8404 * // => [{ 'x': 1, 'y': 2 }]
8405 */
8406 var intersectionWith = baseRest(function(arrays) {
8407 var comparator = last(arrays);
8408 var mapped = arrayMap(arrays, castArrayLikeObject);
8409 comparator = typeof comparator == "function" ? comparator : undefined;
8410 if (comparator) mapped.pop();
8411 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined, comparator) : [];
8412 });
8413 /**
8414 * Converts all elements in `array` into a string separated by `separator`.
8415 *
8416 * @static
8417 * @memberOf _
8418 * @since 4.0.0
8419 * @category Array
8420 * @param {Array} array The array to convert.
8421 * @param {string} [separator=','] The element separator.
8422 * @returns {string} Returns the joined string.
8423 * @example
8424 *
8425 * _.join(['a', 'b', 'c'], '~');
8426 * // => 'a~b~c'
8427 */
8428 function join(array, separator) {
8429 return array == null ? "" : nativeJoin.call(array, separator);
8430 }
8431 /**
8432 * Gets the last element of `array`.
8433 *
8434 * @static
8435 * @memberOf _
8436 * @since 0.1.0
8437 * @category Array
8438 * @param {Array} array The array to query.
8439 * @returns {*} Returns the last element of `array`.
8440 * @example
8441 *
8442 * _.last([1, 2, 3]);
8443 * // => 3
8444 */
8445 function last(array) {
8446 var length = array == null ? 0 : array.length;
8447 return length ? array[length - 1] : undefined;
8448 }
8449 /**
8450 * This method is like `_.indexOf` except that it iterates over elements of
8451 * `array` from right to left.
8452 *
8453 * @static
8454 * @memberOf _
8455 * @since 0.1.0
8456 * @category Array
8457 * @param {Array} array The array to inspect.
8458 * @param {*} value The value to search for.
8459 * @param {number} [fromIndex=array.length-1] The index to search from.
8460 * @returns {number} Returns the index of the matched value, else `-1`.
8461 * @example
8462 *
8463 * _.lastIndexOf([1, 2, 1, 2], 2);
8464 * // => 3
8465 *
8466 * // Search from the `fromIndex`.
8467 * _.lastIndexOf([1, 2, 1, 2], 2, 2);
8468 * // => 1
8469 */
8470 function lastIndexOf(array, value, fromIndex) {
8471 var length = array == null ? 0 : array.length;
8472 if (!length) return -1;
8473 var index = length;
8474 if (fromIndex !== undefined) {
8475 index = toInteger(fromIndex);
8476 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
8477 }
8478 return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
8479 }
8480 /**
8481 * Gets the element at index `n` of `array`. If `n` is negative, the nth
8482 * element from the end is returned.
8483 *
8484 * @static
8485 * @memberOf _
8486 * @since 4.11.0
8487 * @category Array
8488 * @param {Array} array The array to query.
8489 * @param {number} [n=0] The index of the element to return.
8490 * @returns {*} Returns the nth element of `array`.
8491 * @example
8492 *
8493 * var array = ['a', 'b', 'c', 'd'];
8494 *
8495 * _.nth(array, 1);
8496 * // => 'b'
8497 *
8498 * _.nth(array, -2);
8499 * // => 'c';
8500 */
8501 function nth(array, n) {
8502 return array && array.length ? baseNth(array, toInteger(n)) : undefined;
8503 }
8504 /**
8505 * Removes all given values from `array` using
8506 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
8507 * for equality comparisons.
8508 *
8509 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
8510 * to remove elements from an array by predicate.
8511 *
8512 * @static
8513 * @memberOf _
8514 * @since 2.0.0
8515 * @category Array
8516 * @param {Array} array The array to modify.
8517 * @param {...*} [values] The values to remove.
8518 * @returns {Array} Returns `array`.
8519 * @example
8520 *
8521 * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
8522 *
8523 * _.pull(array, 'a', 'c');
8524 * console.log(array);
8525 * // => ['b', 'b']
8526 */
8527 var pull = baseRest(pullAll);
8528 /**
8529 * This method is like `_.pull` except that it accepts an array of values to remove.
8530 *
8531 * **Note:** Unlike `_.difference`, this method mutates `array`.
8532 *
8533 * @static
8534 * @memberOf _
8535 * @since 4.0.0
8536 * @category Array
8537 * @param {Array} array The array to modify.
8538 * @param {Array} values The values to remove.
8539 * @returns {Array} Returns `array`.
8540 * @example
8541 *
8542 * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
8543 *
8544 * _.pullAll(array, ['a', 'c']);
8545 * console.log(array);
8546 * // => ['b', 'b']
8547 */
8548 function pullAll(array, values) {
8549 return array && array.length && values && values.length ? basePullAll(array, values) : array;
8550 }
8551 /**
8552 * This method is like `_.pullAll` except that it accepts `iteratee` which is
8553 * invoked for each element of `array` and `values` to generate the criterion
8554 * by which they're compared. The iteratee is invoked with one argument: (value).
8555 *
8556 * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
8557 *
8558 * @static
8559 * @memberOf _
8560 * @since 4.0.0
8561 * @category Array
8562 * @param {Array} array The array to modify.
8563 * @param {Array} values The values to remove.
8564 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8565 * @returns {Array} Returns `array`.
8566 * @example
8567 *
8568 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
8569 *
8570 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
8571 * console.log(array);
8572 * // => [{ 'x': 2 }]
8573 */
8574 function pullAllBy(array, values, iteratee) {
8575 return array && array.length && values && values.length ? basePullAll(array, values, getIteratee(iteratee, 2)) : array;
8576 }
8577 /**
8578 * This method is like `_.pullAll` except that it accepts `comparator` which
8579 * is invoked to compare elements of `array` to `values`. The comparator is
8580 * invoked with two arguments: (arrVal, othVal).
8581 *
8582 * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
8583 *
8584 * @static
8585 * @memberOf _
8586 * @since 4.6.0
8587 * @category Array
8588 * @param {Array} array The array to modify.
8589 * @param {Array} values The values to remove.
8590 * @param {Function} [comparator] The comparator invoked per element.
8591 * @returns {Array} Returns `array`.
8592 * @example
8593 *
8594 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
8595 *
8596 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
8597 * console.log(array);
8598 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
8599 */
8600 function pullAllWith(array, values, comparator) {
8601 return array && array.length && values && values.length ? basePullAll(array, values, undefined, comparator) : array;
8602 }
8603 /**
8604 * Removes elements from `array` corresponding to `indexes` and returns an
8605 * array of removed elements.
8606 *
8607 * **Note:** Unlike `_.at`, this method mutates `array`.
8608 *
8609 * @static
8610 * @memberOf _
8611 * @since 3.0.0
8612 * @category Array
8613 * @param {Array} array The array to modify.
8614 * @param {...(number|number[])} [indexes] The indexes of elements to remove.
8615 * @returns {Array} Returns the new array of removed elements.
8616 * @example
8617 *
8618 * var array = ['a', 'b', 'c', 'd'];
8619 * var pulled = _.pullAt(array, [1, 3]);
8620 *
8621 * console.log(array);
8622 * // => ['a', 'c']
8623 *
8624 * console.log(pulled);
8625 * // => ['b', 'd']
8626 */
8627 var pullAt = flatRest(function(array, indexes) {
8628 var length = array == null ? 0 : array.length;
8629 var result = baseAt(array, indexes);
8630 basePullAt(array, arrayMap(indexes, function(index) {
8631 return isIndex(index, length) ? +index : index;
8632 }).sort(compareAscending));
8633 return result;
8634 });
8635 /**
8636 * Removes all elements from `array` that `predicate` returns truthy for
8637 * and returns an array of the removed elements. The predicate is invoked
8638 * with three arguments: (value, index, array).
8639 *
8640 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
8641 * to pull elements from an array by value.
8642 *
8643 * @static
8644 * @memberOf _
8645 * @since 2.0.0
8646 * @category Array
8647 * @param {Array} array The array to modify.
8648 * @param {Function} [predicate=_.identity] The function invoked per iteration.
8649 * @returns {Array} Returns the new array of removed elements.
8650 * @example
8651 *
8652 * var array = [1, 2, 3, 4];
8653 * var evens = _.remove(array, function(n) {
8654 * return n % 2 == 0;
8655 * });
8656 *
8657 * console.log(array);
8658 * // => [1, 3]
8659 *
8660 * console.log(evens);
8661 * // => [2, 4]
8662 */
8663 function remove(array, predicate) {
8664 var result = [];
8665 if (!(array && array.length)) return result;
8666 var index = -1;
8667 var indexes = [];
8668 var length = array.length;
8669 predicate = getIteratee(predicate, 3);
8670 while (++index < length) {
8671 var value = array[index];
8672 if (predicate(value, index, array)) {
8673 result.push(value);
8674 indexes.push(index);
8675 }
8676 }
8677 basePullAt(array, indexes);
8678 return result;
8679 }
8680 /**
8681 * Reverses `array` so that the first element becomes the last, the second
8682 * element becomes the second to last, and so on.
8683 *
8684 * **Note:** This method mutates `array` and is based on
8685 * [`Array#reverse`](https://mdn.io/Array/reverse).
8686 *
8687 * @static
8688 * @memberOf _
8689 * @since 4.0.0
8690 * @category Array
8691 * @param {Array} array The array to modify.
8692 * @returns {Array} Returns `array`.
8693 * @example
8694 *
8695 * var array = [1, 2, 3];
8696 *
8697 * _.reverse(array);
8698 * // => [3, 2, 1]
8699 *
8700 * console.log(array);
8701 * // => [3, 2, 1]
8702 */
8703 function reverse(array) {
8704 return array == null ? array : nativeReverse.call(array);
8705 }
8706 /**
8707 * Creates a slice of `array` from `start` up to, but not including, `end`.
8708 *
8709 * **Note:** This method is used instead of
8710 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
8711 * returned.
8712 *
8713 * @static
8714 * @memberOf _
8715 * @since 3.0.0
8716 * @category Array
8717 * @param {Array} array The array to slice.
8718 * @param {number} [start=0] The start position.
8719 * @param {number} [end=array.length] The end position.
8720 * @returns {Array} Returns the slice of `array`.
8721 */
8722 function slice(array, start, end) {
8723 var length = array == null ? 0 : array.length;
8724 if (!length) return [];
8725 if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
8726 start = 0;
8727 end = length;
8728 } else {
8729 start = start == null ? 0 : toInteger(start);
8730 end = end === undefined ? length : toInteger(end);
8731 }
8732 return baseSlice(array, start, end);
8733 }
8734 /**
8735 * Uses a binary search to determine the lowest index at which `value`
8736 * should be inserted into `array` in order to maintain its sort order.
8737 *
8738 * @static
8739 * @memberOf _
8740 * @since 0.1.0
8741 * @category Array
8742 * @param {Array} array The sorted array to inspect.
8743 * @param {*} value The value to evaluate.
8744 * @returns {number} Returns the index at which `value` should be inserted
8745 * into `array`.
8746 * @example
8747 *
8748 * _.sortedIndex([30, 50], 40);
8749 * // => 1
8750 */
8751 function sortedIndex(array, value) {
8752 return baseSortedIndex(array, value);
8753 }
8754 /**
8755 * This method is like `_.sortedIndex` except that it accepts `iteratee`
8756 * which is invoked for `value` and each element of `array` to compute their
8757 * sort ranking. The iteratee is invoked with one argument: (value).
8758 *
8759 * @static
8760 * @memberOf _
8761 * @since 4.0.0
8762 * @category Array
8763 * @param {Array} array The sorted array to inspect.
8764 * @param {*} value The value to evaluate.
8765 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8766 * @returns {number} Returns the index at which `value` should be inserted
8767 * into `array`.
8768 * @example
8769 *
8770 * var objects = [{ 'x': 4 }, { 'x': 5 }];
8771 *
8772 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
8773 * // => 0
8774 *
8775 * // The `_.property` iteratee shorthand.
8776 * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
8777 * // => 0
8778 */
8779 function sortedIndexBy(array, value, iteratee) {
8780 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
8781 }
8782 /**
8783 * This method is like `_.indexOf` except that it performs a binary
8784 * search on a sorted `array`.
8785 *
8786 * @static
8787 * @memberOf _
8788 * @since 4.0.0
8789 * @category Array
8790 * @param {Array} array The array to inspect.
8791 * @param {*} value The value to search for.
8792 * @returns {number} Returns the index of the matched value, else `-1`.
8793 * @example
8794 *
8795 * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
8796 * // => 1
8797 */
8798 function sortedIndexOf(array, value) {
8799 var length = array == null ? 0 : array.length;
8800 if (length) {
8801 var index = baseSortedIndex(array, value);
8802 if (index < length && eq(array[index], value)) return index;
8803 }
8804 return -1;
8805 }
8806 /**
8807 * This method is like `_.sortedIndex` except that it returns the highest
8808 * index at which `value` should be inserted into `array` in order to
8809 * maintain its sort order.
8810 *
8811 * @static
8812 * @memberOf _
8813 * @since 3.0.0
8814 * @category Array
8815 * @param {Array} array The sorted array to inspect.
8816 * @param {*} value The value to evaluate.
8817 * @returns {number} Returns the index at which `value` should be inserted
8818 * into `array`.
8819 * @example
8820 *
8821 * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
8822 * // => 4
8823 */
8824 function sortedLastIndex(array, value) {
8825 return baseSortedIndex(array, value, true);
8826 }
8827 /**
8828 * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
8829 * which is invoked for `value` and each element of `array` to compute their
8830 * sort ranking. The iteratee is invoked with one argument: (value).
8831 *
8832 * @static
8833 * @memberOf _
8834 * @since 4.0.0
8835 * @category Array
8836 * @param {Array} array The sorted array to inspect.
8837 * @param {*} value The value to evaluate.
8838 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
8839 * @returns {number} Returns the index at which `value` should be inserted
8840 * into `array`.
8841 * @example
8842 *
8843 * var objects = [{ 'x': 4 }, { 'x': 5 }];
8844 *
8845 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
8846 * // => 1
8847 *
8848 * // The `_.property` iteratee shorthand.
8849 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
8850 * // => 1
8851 */
8852 function sortedLastIndexBy(array, value, iteratee) {
8853 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
8854 }
8855 /**
8856 * This method is like `_.lastIndexOf` except that it performs a binary
8857 * search on a sorted `array`.
8858 *
8859 * @static
8860 * @memberOf _
8861 * @since 4.0.0
8862 * @category Array
8863 * @param {Array} array The array to inspect.
8864 * @param {*} value The value to search for.
8865 * @returns {number} Returns the index of the matched value, else `-1`.
8866 * @example
8867 *
8868 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
8869 * // => 3
8870 */
8871 function sortedLastIndexOf(array, value) {
8872 if (array == null ? 0 : array.length) {
8873 var index = baseSortedIndex(array, value, true) - 1;
8874 if (eq(array[index], value)) return index;
8875 }
8876 return -1;
8877 }
8878 /**
8879 * This method is like `_.uniq` except that it's designed and optimized
8880 * for sorted arrays.
8881 *
8882 * @static
8883 * @memberOf _
8884 * @since 4.0.0
8885 * @category Array
8886 * @param {Array} array The array to inspect.
8887 * @returns {Array} Returns the new duplicate free array.
8888 * @example
8889 *
8890 * _.sortedUniq([1, 1, 2]);
8891 * // => [1, 2]
8892 */
8893 function sortedUniq(array) {
8894 return array && array.length ? baseSortedUniq(array) : [];
8895 }
8896 /**
8897 * This method is like `_.uniqBy` except that it's designed and optimized
8898 * for sorted arrays.
8899 *
8900 * @static
8901 * @memberOf _
8902 * @since 4.0.0
8903 * @category Array
8904 * @param {Array} array The array to inspect.
8905 * @param {Function} [iteratee] The iteratee invoked per element.
8906 * @returns {Array} Returns the new duplicate free array.
8907 * @example
8908 *
8909 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
8910 * // => [1.1, 2.3]
8911 */
8912 function sortedUniqBy(array, iteratee) {
8913 return array && array.length ? baseSortedUniq(array, getIteratee(iteratee, 2)) : [];
8914 }
8915 /**
8916 * Gets all but the first element of `array`.
8917 *
8918 * @static
8919 * @memberOf _
8920 * @since 4.0.0
8921 * @category Array
8922 * @param {Array} array The array to query.
8923 * @returns {Array} Returns the slice of `array`.
8924 * @example
8925 *
8926 * _.tail([1, 2, 3]);
8927 * // => [2, 3]
8928 */
8929 function tail(array) {
8930 var length = array == null ? 0 : array.length;
8931 return length ? baseSlice(array, 1, length) : [];
8932 }
8933 /**
8934 * Creates a slice of `array` with `n` elements taken from the beginning.
8935 *
8936 * @static
8937 * @memberOf _
8938 * @since 0.1.0
8939 * @category Array
8940 * @param {Array} array The array to query.
8941 * @param {number} [n=1] The number of elements to take.
8942 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8943 * @returns {Array} Returns the slice of `array`.
8944 * @example
8945 *
8946 * _.take([1, 2, 3]);
8947 * // => [1]
8948 *
8949 * _.take([1, 2, 3], 2);
8950 * // => [1, 2]
8951 *
8952 * _.take([1, 2, 3], 5);
8953 * // => [1, 2, 3]
8954 *
8955 * _.take([1, 2, 3], 0);
8956 * // => []
8957 */
8958 function take(array, n, guard) {
8959 if (!(array && array.length)) return [];
8960 n = guard || n === undefined ? 1 : toInteger(n);
8961 return baseSlice(array, 0, n < 0 ? 0 : n);
8962 }
8963 /**
8964 * Creates a slice of `array` with `n` elements taken from the end.
8965 *
8966 * @static
8967 * @memberOf _
8968 * @since 3.0.0
8969 * @category Array
8970 * @param {Array} array The array to query.
8971 * @param {number} [n=1] The number of elements to take.
8972 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8973 * @returns {Array} Returns the slice of `array`.
8974 * @example
8975 *
8976 * _.takeRight([1, 2, 3]);
8977 * // => [3]
8978 *
8979 * _.takeRight([1, 2, 3], 2);
8980 * // => [2, 3]
8981 *
8982 * _.takeRight([1, 2, 3], 5);
8983 * // => [1, 2, 3]
8984 *
8985 * _.takeRight([1, 2, 3], 0);
8986 * // => []
8987 */
8988 function takeRight(array, n, guard) {
8989 var length = array == null ? 0 : array.length;
8990 if (!length) return [];
8991 n = guard || n === undefined ? 1 : toInteger(n);
8992 n = length - n;
8993 return baseSlice(array, n < 0 ? 0 : n, length);
8994 }
8995 /**
8996 * Creates a slice of `array` with elements taken from the end. Elements are
8997 * taken until `predicate` returns falsey. The predicate is invoked with
8998 * three arguments: (value, index, array).
8999 *
9000 * @static
9001 * @memberOf _
9002 * @since 3.0.0
9003 * @category Array
9004 * @param {Array} array The array to query.
9005 * @param {Function} [predicate=_.identity] The function invoked per iteration.
9006 * @returns {Array} Returns the slice of `array`.
9007 * @example
9008 *
9009 * var users = [
9010 * { 'user': 'barney', 'active': true },
9011 * { 'user': 'fred', 'active': false },
9012 * { 'user': 'pebbles', 'active': false }
9013 * ];
9014 *
9015 * _.takeRightWhile(users, function(o) { return !o.active; });
9016 * // => objects for ['fred', 'pebbles']
9017 *
9018 * // The `_.matches` iteratee shorthand.
9019 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
9020 * // => objects for ['pebbles']
9021 *
9022 * // The `_.matchesProperty` iteratee shorthand.
9023 * _.takeRightWhile(users, ['active', false]);
9024 * // => objects for ['fred', 'pebbles']
9025 *
9026 * // The `_.property` iteratee shorthand.
9027 * _.takeRightWhile(users, 'active');
9028 * // => []
9029 */
9030 function takeRightWhile(array, predicate) {
9031 return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : [];
9032 }
9033 /**
9034 * Creates a slice of `array` with elements taken from the beginning. Elements
9035 * are taken until `predicate` returns falsey. The predicate is invoked with
9036 * three arguments: (value, index, array).
9037 *
9038 * @static
9039 * @memberOf _
9040 * @since 3.0.0
9041 * @category Array
9042 * @param {Array} array The array to query.
9043 * @param {Function} [predicate=_.identity] The function invoked per iteration.
9044 * @returns {Array} Returns the slice of `array`.
9045 * @example
9046 *
9047 * var users = [
9048 * { 'user': 'barney', 'active': false },
9049 * { 'user': 'fred', 'active': false },
9050 * { 'user': 'pebbles', 'active': true }
9051 * ];
9052 *
9053 * _.takeWhile(users, function(o) { return !o.active; });
9054 * // => objects for ['barney', 'fred']
9055 *
9056 * // The `_.matches` iteratee shorthand.
9057 * _.takeWhile(users, { 'user': 'barney', 'active': false });
9058 * // => objects for ['barney']
9059 *
9060 * // The `_.matchesProperty` iteratee shorthand.
9061 * _.takeWhile(users, ['active', false]);
9062 * // => objects for ['barney', 'fred']
9063 *
9064 * // The `_.property` iteratee shorthand.
9065 * _.takeWhile(users, 'active');
9066 * // => []
9067 */
9068 function takeWhile(array, predicate) {
9069 return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : [];
9070 }
9071 /**
9072 * Creates an array of unique values, in order, from all given arrays using
9073 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
9074 * for equality comparisons.
9075 *
9076 * @static
9077 * @memberOf _
9078 * @since 0.1.0
9079 * @category Array
9080 * @param {...Array} [arrays] The arrays to inspect.
9081 * @returns {Array} Returns the new array of combined values.
9082 * @example
9083 *
9084 * _.union([2], [1, 2]);
9085 * // => [2, 1]
9086 */
9087 var union = baseRest(function(arrays) {
9088 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
9089 });
9090 /**
9091 * This method is like `_.union` except that it accepts `iteratee` which is
9092 * invoked for each element of each `arrays` to generate the criterion by
9093 * which uniqueness is computed. Result values are chosen from the first
9094 * array in which the value occurs. The iteratee is invoked with one argument:
9095 * (value).
9096 *
9097 * @static
9098 * @memberOf _
9099 * @since 4.0.0
9100 * @category Array
9101 * @param {...Array} [arrays] The arrays to inspect.
9102 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
9103 * @returns {Array} Returns the new array of combined values.
9104 * @example
9105 *
9106 * _.unionBy([2.1], [1.2, 2.3], Math.floor);
9107 * // => [2.1, 1.2]
9108 *
9109 * // The `_.property` iteratee shorthand.
9110 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
9111 * // => [{ 'x': 1 }, { 'x': 2 }]
9112 */
9113 var unionBy = baseRest(function(arrays) {
9114 var iteratee = last(arrays);
9115 if (isArrayLikeObject(iteratee)) iteratee = undefined;
9116 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
9117 });
9118 /**
9119 * This method is like `_.union` except that it accepts `comparator` which
9120 * is invoked to compare elements of `arrays`. Result values are chosen from
9121 * the first array in which the value occurs. The comparator is invoked
9122 * with two arguments: (arrVal, othVal).
9123 *
9124 * @static
9125 * @memberOf _
9126 * @since 4.0.0
9127 * @category Array
9128 * @param {...Array} [arrays] The arrays to inspect.
9129 * @param {Function} [comparator] The comparator invoked per element.
9130 * @returns {Array} Returns the new array of combined values.
9131 * @example
9132 *
9133 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
9134 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
9135 *
9136 * _.unionWith(objects, others, _.isEqual);
9137 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
9138 */
9139 var unionWith = baseRest(function(arrays) {
9140 var comparator = last(arrays);
9141 comparator = typeof comparator == "function" ? comparator : undefined;
9142 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
9143 });
9144 /**
9145 * Creates a duplicate-free version of an array, using
9146 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
9147 * for equality comparisons, in which only the first occurrence of each element
9148 * is kept. The order of result values is determined by the order they occur
9149 * in the array.
9150 *
9151 * @static
9152 * @memberOf _
9153 * @since 0.1.0
9154 * @category Array
9155 * @param {Array} array The array to inspect.
9156 * @returns {Array} Returns the new duplicate free array.
9157 * @example
9158 *
9159 * _.uniq([2, 1, 2]);
9160 * // => [2, 1]
9161 */
9162 function uniq(array) {
9163 return array && array.length ? baseUniq(array) : [];
9164 }
9165 /**
9166 * This method is like `_.uniq` except that it accepts `iteratee` which is
9167 * invoked for each element in `array` to generate the criterion by which
9168 * uniqueness is computed. The order of result values is determined by the
9169 * order they occur in the array. The iteratee is invoked with one argument:
9170 * (value).
9171 *
9172 * @static
9173 * @memberOf _
9174 * @since 4.0.0
9175 * @category Array
9176 * @param {Array} array The array to inspect.
9177 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
9178 * @returns {Array} Returns the new duplicate free array.
9179 * @example
9180 *
9181 * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
9182 * // => [2.1, 1.2]
9183 *
9184 * // The `_.property` iteratee shorthand.
9185 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
9186 * // => [{ 'x': 1 }, { 'x': 2 }]
9187 */
9188 function uniqBy(array, iteratee) {
9189 return array && array.length ? baseUniq(array, getIteratee(iteratee, 2)) : [];
9190 }
9191 /**
9192 * This method is like `_.uniq` except that it accepts `comparator` which
9193 * is invoked to compare elements of `array`. The order of result values is
9194 * determined by the order they occur in the array.The comparator is invoked
9195 * with two arguments: (arrVal, othVal).
9196 *
9197 * @static
9198 * @memberOf _
9199 * @since 4.0.0
9200 * @category Array
9201 * @param {Array} array The array to inspect.
9202 * @param {Function} [comparator] The comparator invoked per element.
9203 * @returns {Array} Returns the new duplicate free array.
9204 * @example
9205 *
9206 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
9207 *
9208 * _.uniqWith(objects, _.isEqual);
9209 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
9210 */
9211 function uniqWith(array, comparator) {
9212 comparator = typeof comparator == "function" ? comparator : undefined;
9213 return array && array.length ? baseUniq(array, undefined, comparator) : [];
9214 }
9215 /**
9216 * This method is like `_.zip` except that it accepts an array of grouped
9217 * elements and creates an array regrouping the elements to their pre-zip
9218 * configuration.
9219 *
9220 * @static
9221 * @memberOf _
9222 * @since 1.2.0
9223 * @category Array
9224 * @param {Array} array The array of grouped elements to process.
9225 * @returns {Array} Returns the new array of regrouped elements.
9226 * @example
9227 *
9228 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
9229 * // => [['a', 1, true], ['b', 2, false]]
9230 *
9231 * _.unzip(zipped);
9232 * // => [['a', 'b'], [1, 2], [true, false]]
9233 */
9234 function unzip(array) {
9235 if (!(array && array.length)) return [];
9236 var length = 0;
9237 array = arrayFilter(array, function(group) {
9238 if (isArrayLikeObject(group)) {
9239 length = nativeMax(group.length, length);
9240 return true;
9241 }
9242 });
9243 return baseTimes(length, function(index) {
9244 return arrayMap(array, baseProperty(index));
9245 });
9246 }
9247 /**
9248 * This method is like `_.unzip` except that it accepts `iteratee` to specify
9249 * how regrouped values should be combined. The iteratee is invoked with the
9250 * elements of each group: (...group).
9251 *
9252 * @static
9253 * @memberOf _
9254 * @since 3.8.0
9255 * @category Array
9256 * @param {Array} array The array of grouped elements to process.
9257 * @param {Function} [iteratee=_.identity] The function to combine
9258 * regrouped values.
9259 * @returns {Array} Returns the new array of regrouped elements.
9260 * @example
9261 *
9262 * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
9263 * // => [[1, 10, 100], [2, 20, 200]]
9264 *
9265 * _.unzipWith(zipped, _.add);
9266 * // => [3, 30, 300]
9267 */
9268 function unzipWith(array, iteratee) {
9269 if (!(array && array.length)) return [];
9270 var result = unzip(array);
9271 if (iteratee == null) return result;
9272 return arrayMap(result, function(group) {
9273 return apply(iteratee, undefined, group);
9274 });
9275 }
9276 /**
9277 * Creates an array excluding all given values using
9278 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
9279 * for equality comparisons.
9280 *
9281 * **Note:** Unlike `_.pull`, this method returns a new array.
9282 *
9283 * @static
9284 * @memberOf _
9285 * @since 0.1.0
9286 * @category Array
9287 * @param {Array} array The array to inspect.
9288 * @param {...*} [values] The values to exclude.
9289 * @returns {Array} Returns the new array of filtered values.
9290 * @see _.difference, _.xor
9291 * @example
9292 *
9293 * _.without([2, 1, 2, 3], 1, 2);
9294 * // => [3]
9295 */
9296 var without = baseRest(function(array, values) {
9297 return isArrayLikeObject(array) ? baseDifference(array, values) : [];
9298 });
9299 /**
9300 * Creates an array of unique values that is the
9301 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
9302 * of the given arrays. The order of result values is determined by the order
9303 * they occur in the arrays.
9304 *
9305 * @static
9306 * @memberOf _
9307 * @since 2.4.0
9308 * @category Array
9309 * @param {...Array} [arrays] The arrays to inspect.
9310 * @returns {Array} Returns the new array of filtered values.
9311 * @see _.difference, _.without
9312 * @example
9313 *
9314 * _.xor([2, 1], [2, 3]);
9315 * // => [1, 3]
9316 */
9317 var xor = baseRest(function(arrays) {
9318 return baseXor(arrayFilter(arrays, isArrayLikeObject));
9319 });
9320 /**
9321 * This method is like `_.xor` except that it accepts `iteratee` which is
9322 * invoked for each element of each `arrays` to generate the criterion by
9323 * which by which they're compared. The order of result values is determined
9324 * by the order they occur in the arrays. The iteratee is invoked with one
9325 * argument: (value).
9326 *
9327 * @static
9328 * @memberOf _
9329 * @since 4.0.0
9330 * @category Array
9331 * @param {...Array} [arrays] The arrays to inspect.
9332 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
9333 * @returns {Array} Returns the new array of filtered values.
9334 * @example
9335 *
9336 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
9337 * // => [1.2, 3.4]
9338 *
9339 * // The `_.property` iteratee shorthand.
9340 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
9341 * // => [{ 'x': 2 }]
9342 */
9343 var xorBy = baseRest(function(arrays) {
9344 var iteratee = last(arrays);
9345 if (isArrayLikeObject(iteratee)) iteratee = undefined;
9346 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
9347 });
9348 /**
9349 * This method is like `_.xor` except that it accepts `comparator` which is
9350 * invoked to compare elements of `arrays`. The order of result values is
9351 * determined by the order they occur in the arrays. The comparator is invoked
9352 * with two arguments: (arrVal, othVal).
9353 *
9354 * @static
9355 * @memberOf _
9356 * @since 4.0.0
9357 * @category Array
9358 * @param {...Array} [arrays] The arrays to inspect.
9359 * @param {Function} [comparator] The comparator invoked per element.
9360 * @returns {Array} Returns the new array of filtered values.
9361 * @example
9362 *
9363 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
9364 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
9365 *
9366 * _.xorWith(objects, others, _.isEqual);
9367 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
9368 */
9369 var xorWith = baseRest(function(arrays) {
9370 var comparator = last(arrays);
9371 comparator = typeof comparator == "function" ? comparator : undefined;
9372 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
9373 });
9374 /**
9375 * Creates an array of grouped elements, the first of which contains the
9376 * first elements of the given arrays, the second of which contains the
9377 * second elements of the given arrays, and so on.
9378 *
9379 * @static
9380 * @memberOf _
9381 * @since 0.1.0
9382 * @category Array
9383 * @param {...Array} [arrays] The arrays to process.
9384 * @returns {Array} Returns the new array of grouped elements.
9385 * @example
9386 *
9387 * _.zip(['a', 'b'], [1, 2], [true, false]);
9388 * // => [['a', 1, true], ['b', 2, false]]
9389 */
9390 var zip = baseRest(unzip);
9391 /**
9392 * This method is like `_.fromPairs` except that it accepts two arrays,
9393 * one of property identifiers and one of corresponding values.
9394 *
9395 * @static
9396 * @memberOf _
9397 * @since 0.4.0
9398 * @category Array
9399 * @param {Array} [props=[]] The property identifiers.
9400 * @param {Array} [values=[]] The property values.
9401 * @returns {Object} Returns the new object.
9402 * @example
9403 *
9404 * _.zipObject(['a', 'b'], [1, 2]);
9405 * // => { 'a': 1, 'b': 2 }
9406 */
9407 function zipObject(props, values) {
9408 return baseZipObject(props || [], values || [], assignValue);
9409 }
9410 /**
9411 * This method is like `_.zipObject` except that it supports property paths.
9412 *
9413 * @static
9414 * @memberOf _
9415 * @since 4.1.0
9416 * @category Array
9417 * @param {Array} [props=[]] The property identifiers.
9418 * @param {Array} [values=[]] The property values.
9419 * @returns {Object} Returns the new object.
9420 * @example
9421 *
9422 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
9423 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
9424 */
9425 function zipObjectDeep(props, values) {
9426 return baseZipObject(props || [], values || [], baseSet);
9427 }
9428 /**
9429 * This method is like `_.zip` except that it accepts `iteratee` to specify
9430 * how grouped values should be combined. The iteratee is invoked with the
9431 * elements of each group: (...group).
9432 *
9433 * @static
9434 * @memberOf _
9435 * @since 3.8.0
9436 * @category Array
9437 * @param {...Array} [arrays] The arrays to process.
9438 * @param {Function} [iteratee=_.identity] The function to combine
9439 * grouped values.
9440 * @returns {Array} Returns the new array of grouped elements.
9441 * @example
9442 *
9443 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
9444 * return a + b + c;
9445 * });
9446 * // => [111, 222]
9447 */
9448 var zipWith = baseRest(function(arrays) {
9449 var length = arrays.length;
9450 var iteratee = length > 1 ? arrays[length - 1] : undefined;
9451 iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : undefined;
9452 return unzipWith(arrays, iteratee);
9453 });
9454 /**
9455 * Creates a `lodash` wrapper instance that wraps `value` with explicit method
9456 * chain sequences enabled. The result of such sequences must be unwrapped
9457 * with `_#value`.
9458 *
9459 * @static
9460 * @memberOf _
9461 * @since 1.3.0
9462 * @category Seq
9463 * @param {*} value The value to wrap.
9464 * @returns {Object} Returns the new `lodash` wrapper instance.
9465 * @example
9466 *
9467 * var users = [
9468 * { 'user': 'barney', 'age': 36 },
9469 * { 'user': 'fred', 'age': 40 },
9470 * { 'user': 'pebbles', 'age': 1 }
9471 * ];
9472 *
9473 * var youngest = _
9474 * .chain(users)
9475 * .sortBy('age')
9476 * .map(function(o) {
9477 * return o.user + ' is ' + o.age;
9478 * })
9479 * .head()
9480 * .value();
9481 * // => 'pebbles is 1'
9482 */
9483 function chain(value) {
9484 var result = lodash(value);
9485 result.__chain__ = true;
9486 return result;
9487 }
9488 /**
9489 * This method invokes `interceptor` and returns `value`. The interceptor
9490 * is invoked with one argument; (value). The purpose of this method is to
9491 * "tap into" a method chain sequence in order to modify intermediate results.
9492 *
9493 * @static
9494 * @memberOf _
9495 * @since 0.1.0
9496 * @category Seq
9497 * @param {*} value The value to provide to `interceptor`.
9498 * @param {Function} interceptor The function to invoke.
9499 * @returns {*} Returns `value`.
9500 * @example
9501 *
9502 * _([1, 2, 3])
9503 * .tap(function(array) {
9504 * // Mutate input array.
9505 * array.pop();
9506 * })
9507 * .reverse()
9508 * .value();
9509 * // => [2, 1]
9510 */
9511 function tap(value, interceptor) {
9512 interceptor(value);
9513 return value;
9514 }
9515 /**
9516 * This method is like `_.tap` except that it returns the result of `interceptor`.
9517 * The purpose of this method is to "pass thru" values replacing intermediate
9518 * results in a method chain sequence.
9519 *
9520 * @static
9521 * @memberOf _
9522 * @since 3.0.0
9523 * @category Seq
9524 * @param {*} value The value to provide to `interceptor`.
9525 * @param {Function} interceptor The function to invoke.
9526 * @returns {*} Returns the result of `interceptor`.
9527 * @example
9528 *
9529 * _(' abc ')
9530 * .chain()
9531 * .trim()
9532 * .thru(function(value) {
9533 * return [value];
9534 * })
9535 * .value();
9536 * // => ['abc']
9537 */
9538 function thru(value, interceptor) {
9539 return interceptor(value);
9540 }
9541 /**
9542 * This method is the wrapper version of `_.at`.
9543 *
9544 * @name at
9545 * @memberOf _
9546 * @since 1.0.0
9547 * @category Seq
9548 * @param {...(string|string[])} [paths] The property paths to pick.
9549 * @returns {Object} Returns the new `lodash` wrapper instance.
9550 * @example
9551 *
9552 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
9553 *
9554 * _(object).at(['a[0].b.c', 'a[1]']).value();
9555 * // => [3, 4]
9556 */
9557 var wrapperAt = flatRest(function(paths) {
9558 var length = paths.length;
9559 var start = length ? paths[0] : 0;
9560 var value = this.__wrapped__;
9561 var interceptor = function(object) {
9562 return baseAt(object, paths);
9563 };
9564 if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) return this.thru(interceptor);
9565 value = value.slice(start, +start + (length ? 1 : 0));
9566 value.__actions__.push({
9567 "func": thru,
9568 "args": [interceptor],
9569 "thisArg": undefined
9570 });
9571 return new LodashWrapper(value, this.__chain__).thru(function(array) {
9572 if (length && !array.length) array.push(undefined);
9573 return array;
9574 });
9575 });
9576 /**
9577 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
9578 *
9579 * @name chain
9580 * @memberOf _
9581 * @since 0.1.0
9582 * @category Seq
9583 * @returns {Object} Returns the new `lodash` wrapper instance.
9584 * @example
9585 *
9586 * var users = [
9587 * { 'user': 'barney', 'age': 36 },
9588 * { 'user': 'fred', 'age': 40 }
9589 * ];
9590 *
9591 * // A sequence without explicit chaining.
9592 * _(users).head();
9593 * // => { 'user': 'barney', 'age': 36 }
9594 *
9595 * // A sequence with explicit chaining.
9596 * _(users)
9597 * .chain()
9598 * .head()
9599 * .pick('user')
9600 * .value();
9601 * // => { 'user': 'barney' }
9602 */
9603 function wrapperChain() {
9604 return chain(this);
9605 }
9606 /**
9607 * Executes the chain sequence and returns the wrapped result.
9608 *
9609 * @name commit
9610 * @memberOf _
9611 * @since 3.2.0
9612 * @category Seq
9613 * @returns {Object} Returns the new `lodash` wrapper instance.
9614 * @example
9615 *
9616 * var array = [1, 2];
9617 * var wrapped = _(array).push(3);
9618 *
9619 * console.log(array);
9620 * // => [1, 2]
9621 *
9622 * wrapped = wrapped.commit();
9623 * console.log(array);
9624 * // => [1, 2, 3]
9625 *
9626 * wrapped.last();
9627 * // => 3
9628 *
9629 * console.log(array);
9630 * // => [1, 2, 3]
9631 */
9632 function wrapperCommit() {
9633 return new LodashWrapper(this.value(), this.__chain__);
9634 }
9635 /**
9636 * Gets the next value on a wrapped object following the
9637 * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
9638 *
9639 * @name next
9640 * @memberOf _
9641 * @since 4.0.0
9642 * @category Seq
9643 * @returns {Object} Returns the next iterator value.
9644 * @example
9645 *
9646 * var wrapped = _([1, 2]);
9647 *
9648 * wrapped.next();
9649 * // => { 'done': false, 'value': 1 }
9650 *
9651 * wrapped.next();
9652 * // => { 'done': false, 'value': 2 }
9653 *
9654 * wrapped.next();
9655 * // => { 'done': true, 'value': undefined }
9656 */
9657 function wrapperNext() {
9658 if (this.__values__ === undefined) this.__values__ = toArray(this.value());
9659 var done = this.__index__ >= this.__values__.length;
9660 return {
9661 "done": done,
9662 "value": done ? undefined : this.__values__[this.__index__++]
9663 };
9664 }
9665 /**
9666 * Enables the wrapper to be iterable.
9667 *
9668 * @name Symbol.iterator
9669 * @memberOf _
9670 * @since 4.0.0
9671 * @category Seq
9672 * @returns {Object} Returns the wrapper object.
9673 * @example
9674 *
9675 * var wrapped = _([1, 2]);
9676 *
9677 * wrapped[Symbol.iterator]() === wrapped;
9678 * // => true
9679 *
9680 * Array.from(wrapped);
9681 * // => [1, 2]
9682 */
9683 function wrapperToIterator() {
9684 return this;
9685 }
9686 /**
9687 * Creates a clone of the chain sequence planting `value` as the wrapped value.
9688 *
9689 * @name plant
9690 * @memberOf _
9691 * @since 3.2.0
9692 * @category Seq
9693 * @param {*} value The value to plant.
9694 * @returns {Object} Returns the new `lodash` wrapper instance.
9695 * @example
9696 *
9697 * function square(n) {
9698 * return n * n;
9699 * }
9700 *
9701 * var wrapped = _([1, 2]).map(square);
9702 * var other = wrapped.plant([3, 4]);
9703 *
9704 * other.value();
9705 * // => [9, 16]
9706 *
9707 * wrapped.value();
9708 * // => [1, 4]
9709 */
9710 function wrapperPlant(value) {
9711 var result;
9712 var parent = this;
9713 while (parent instanceof baseLodash) {
9714 var clone = wrapperClone(parent);
9715 clone.__index__ = 0;
9716 clone.__values__ = undefined;
9717 if (result) previous.__wrapped__ = clone;
9718 else result = clone;
9719 var previous = clone;
9720 parent = parent.__wrapped__;
9721 }
9722 previous.__wrapped__ = value;
9723 return result;
9724 }
9725 /**
9726 * This method is the wrapper version of `_.reverse`.
9727 *
9728 * **Note:** This method mutates the wrapped array.
9729 *
9730 * @name reverse
9731 * @memberOf _
9732 * @since 0.1.0
9733 * @category Seq
9734 * @returns {Object} Returns the new `lodash` wrapper instance.
9735 * @example
9736 *
9737 * var array = [1, 2, 3];
9738 *
9739 * _(array).reverse().value()
9740 * // => [3, 2, 1]
9741 *
9742 * console.log(array);
9743 * // => [3, 2, 1]
9744 */
9745 function wrapperReverse() {
9746 var value = this.__wrapped__;
9747 if (value instanceof LazyWrapper) {
9748 var wrapped = value;
9749 if (this.__actions__.length) wrapped = new LazyWrapper(this);
9750 wrapped = wrapped.reverse();
9751 wrapped.__actions__.push({
9752 "func": thru,
9753 "args": [reverse],
9754 "thisArg": undefined
9755 });
9756 return new LodashWrapper(wrapped, this.__chain__);
9757 }
9758 return this.thru(reverse);
9759 }
9760 /**
9761 * Executes the chain sequence to resolve the unwrapped value.
9762 *
9763 * @name value
9764 * @memberOf _
9765 * @since 0.1.0
9766 * @alias toJSON, valueOf
9767 * @category Seq
9768 * @returns {*} Returns the resolved unwrapped value.
9769 * @example
9770 *
9771 * _([1, 2, 3]).value();
9772 * // => [1, 2, 3]
9773 */
9774 function wrapperValue() {
9775 return baseWrapperValue(this.__wrapped__, this.__actions__);
9776 }
9777 /**
9778 * Creates an object composed of keys generated from the results of running
9779 * each element of `collection` thru `iteratee`. The corresponding value of
9780 * each key is the number of times the key was returned by `iteratee`. The
9781 * iteratee is invoked with one argument: (value).
9782 *
9783 * @static
9784 * @memberOf _
9785 * @since 0.5.0
9786 * @category Collection
9787 * @param {Array|Object} collection The collection to iterate over.
9788 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
9789 * @returns {Object} Returns the composed aggregate object.
9790 * @example
9791 *
9792 * _.countBy([6.1, 4.2, 6.3], Math.floor);
9793 * // => { '4': 1, '6': 2 }
9794 *
9795 * // The `_.property` iteratee shorthand.
9796 * _.countBy(['one', 'two', 'three'], 'length');
9797 * // => { '3': 2, '5': 1 }
9798 */
9799 var countBy = createAggregator(function(result, value, key) {
9800 if (hasOwnProperty.call(result, key)) ++result[key];
9801 else baseAssignValue(result, key, 1);
9802 });
9803 /**
9804 * Checks if `predicate` returns truthy for **all** elements of `collection`.
9805 * Iteration is stopped once `predicate` returns falsey. The predicate is
9806 * invoked with three arguments: (value, index|key, collection).
9807 *
9808 * **Note:** This method returns `true` for
9809 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
9810 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
9811 * elements of empty collections.
9812 *
9813 * @static
9814 * @memberOf _
9815 * @since 0.1.0
9816 * @category Collection
9817 * @param {Array|Object} collection The collection to iterate over.
9818 * @param {Function} [predicate=_.identity] The function invoked per iteration.
9819 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
9820 * @returns {boolean} Returns `true` if all elements pass the predicate check,
9821 * else `false`.
9822 * @example
9823 *
9824 * _.every([true, 1, null, 'yes'], Boolean);
9825 * // => false
9826 *
9827 * var users = [
9828 * { 'user': 'barney', 'age': 36, 'active': false },
9829 * { 'user': 'fred', 'age': 40, 'active': false }
9830 * ];
9831 *
9832 * // The `_.matches` iteratee shorthand.
9833 * _.every(users, { 'user': 'barney', 'active': false });
9834 * // => false
9835 *
9836 * // The `_.matchesProperty` iteratee shorthand.
9837 * _.every(users, ['active', false]);
9838 * // => true
9839 *
9840 * // The `_.property` iteratee shorthand.
9841 * _.every(users, 'active');
9842 * // => false
9843 */
9844 function every(collection, predicate, guard) {
9845 var func = isArray(collection) ? arrayEvery : baseEvery;
9846 if (guard && isIterateeCall(collection, predicate, guard)) predicate = undefined;
9847 return func(collection, getIteratee(predicate, 3));
9848 }
9849 /**
9850 * Iterates over elements of `collection`, returning an array of all elements
9851 * `predicate` returns truthy for. The predicate is invoked with three
9852 * arguments: (value, index|key, collection).
9853 *
9854 * **Note:** Unlike `_.remove`, this method returns a new array.
9855 *
9856 * @static
9857 * @memberOf _
9858 * @since 0.1.0
9859 * @category Collection
9860 * @param {Array|Object} collection The collection to iterate over.
9861 * @param {Function} [predicate=_.identity] The function invoked per iteration.
9862 * @returns {Array} Returns the new filtered array.
9863 * @see _.reject
9864 * @example
9865 *
9866 * var users = [
9867 * { 'user': 'barney', 'age': 36, 'active': true },
9868 * { 'user': 'fred', 'age': 40, 'active': false }
9869 * ];
9870 *
9871 * _.filter(users, function(o) { return !o.active; });
9872 * // => objects for ['fred']
9873 *
9874 * // The `_.matches` iteratee shorthand.
9875 * _.filter(users, { 'age': 36, 'active': true });
9876 * // => objects for ['barney']
9877 *
9878 * // The `_.matchesProperty` iteratee shorthand.
9879 * _.filter(users, ['active', false]);
9880 * // => objects for ['fred']
9881 *
9882 * // The `_.property` iteratee shorthand.
9883 * _.filter(users, 'active');
9884 * // => objects for ['barney']
9885 *
9886 * // Combining several predicates using `_.overEvery` or `_.overSome`.
9887 * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
9888 * // => objects for ['fred', 'barney']
9889 */
9890 function filter(collection, predicate) {
9891 return (isArray(collection) ? arrayFilter : baseFilter)(collection, getIteratee(predicate, 3));
9892 }
9893 /**
9894 * Iterates over elements of `collection`, returning the first element
9895 * `predicate` returns truthy for. The predicate is invoked with three
9896 * arguments: (value, index|key, collection).
9897 *
9898 * @static
9899 * @memberOf _
9900 * @since 0.1.0
9901 * @category Collection
9902 * @param {Array|Object} collection The collection to inspect.
9903 * @param {Function} [predicate=_.identity] The function invoked per iteration.
9904 * @param {number} [fromIndex=0] The index to search from.
9905 * @returns {*} Returns the matched element, else `undefined`.
9906 * @example
9907 *
9908 * var users = [
9909 * { 'user': 'barney', 'age': 36, 'active': true },
9910 * { 'user': 'fred', 'age': 40, 'active': false },
9911 * { 'user': 'pebbles', 'age': 1, 'active': true }
9912 * ];
9913 *
9914 * _.find(users, function(o) { return o.age < 40; });
9915 * // => object for 'barney'
9916 *
9917 * // The `_.matches` iteratee shorthand.
9918 * _.find(users, { 'age': 1, 'active': true });
9919 * // => object for 'pebbles'
9920 *
9921 * // The `_.matchesProperty` iteratee shorthand.
9922 * _.find(users, ['active', false]);
9923 * // => object for 'fred'
9924 *
9925 * // The `_.property` iteratee shorthand.
9926 * _.find(users, 'active');
9927 * // => object for 'barney'
9928 */
9929 var find = createFind(findIndex);
9930 /**
9931 * This method is like `_.find` except that it iterates over elements of
9932 * `collection` from right to left.
9933 *
9934 * @static
9935 * @memberOf _
9936 * @since 2.0.0
9937 * @category Collection
9938 * @param {Array|Object} collection The collection to inspect.
9939 * @param {Function} [predicate=_.identity] The function invoked per iteration.
9940 * @param {number} [fromIndex=collection.length-1] The index to search from.
9941 * @returns {*} Returns the matched element, else `undefined`.
9942 * @example
9943 *
9944 * _.findLast([1, 2, 3, 4], function(n) {
9945 * return n % 2 == 1;
9946 * });
9947 * // => 3
9948 */
9949 var findLast = createFind(findLastIndex);
9950 /**
9951 * Creates a flattened array of values by running each element in `collection`
9952 * thru `iteratee` and flattening the mapped results. The iteratee is invoked
9953 * with three arguments: (value, index|key, collection).
9954 *
9955 * @static
9956 * @memberOf _
9957 * @since 4.0.0
9958 * @category Collection
9959 * @param {Array|Object} collection The collection to iterate over.
9960 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9961 * @returns {Array} Returns the new flattened array.
9962 * @example
9963 *
9964 * function duplicate(n) {
9965 * return [n, n];
9966 * }
9967 *
9968 * _.flatMap([1, 2], duplicate);
9969 * // => [1, 1, 2, 2]
9970 */
9971 function flatMap(collection, iteratee) {
9972 return baseFlatten(map(collection, iteratee), 1);
9973 }
9974 /**
9975 * This method is like `_.flatMap` except that it recursively flattens the
9976 * mapped results.
9977 *
9978 * @static
9979 * @memberOf _
9980 * @since 4.7.0
9981 * @category Collection
9982 * @param {Array|Object} collection The collection to iterate over.
9983 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
9984 * @returns {Array} Returns the new flattened array.
9985 * @example
9986 *
9987 * function duplicate(n) {
9988 * return [[[n, n]]];
9989 * }
9990 *
9991 * _.flatMapDeep([1, 2], duplicate);
9992 * // => [1, 1, 2, 2]
9993 */
9994 function flatMapDeep(collection, iteratee) {
9995 return baseFlatten(map(collection, iteratee), INFINITY);
9996 }
9997 /**
9998 * This method is like `_.flatMap` except that it recursively flattens the
9999 * mapped results up to `depth` times.
10000 *
10001 * @static
10002 * @memberOf _
10003 * @since 4.7.0
10004 * @category Collection
10005 * @param {Array|Object} collection The collection to iterate over.
10006 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10007 * @param {number} [depth=1] The maximum recursion depth.
10008 * @returns {Array} Returns the new flattened array.
10009 * @example
10010 *
10011 * function duplicate(n) {
10012 * return [[[n, n]]];
10013 * }
10014 *
10015 * _.flatMapDepth([1, 2], duplicate, 2);
10016 * // => [[1, 1], [2, 2]]
10017 */
10018 function flatMapDepth(collection, iteratee, depth) {
10019 depth = depth === undefined ? 1 : toInteger(depth);
10020 return baseFlatten(map(collection, iteratee), depth);
10021 }
10022 /**
10023 * Iterates over elements of `collection` and invokes `iteratee` for each element.
10024 * The iteratee is invoked with three arguments: (value, index|key, collection).
10025 * Iteratee functions may exit iteration early by explicitly returning `false`.
10026 *
10027 * **Note:** As with other "Collections" methods, objects with a "length"
10028 * property are iterated like arrays. To avoid this behavior use `_.forIn`
10029 * or `_.forOwn` for object iteration.
10030 *
10031 * @static
10032 * @memberOf _
10033 * @since 0.1.0
10034 * @alias each
10035 * @category Collection
10036 * @param {Array|Object} collection The collection to iterate over.
10037 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10038 * @returns {Array|Object} Returns `collection`.
10039 * @see _.forEachRight
10040 * @example
10041 *
10042 * _.forEach([1, 2], function(value) {
10043 * console.log(value);
10044 * });
10045 * // => Logs `1` then `2`.
10046 *
10047 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
10048 * console.log(key);
10049 * });
10050 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
10051 */
10052 function forEach(collection, iteratee) {
10053 return (isArray(collection) ? arrayEach : baseEach)(collection, getIteratee(iteratee, 3));
10054 }
10055 /**
10056 * This method is like `_.forEach` except that it iterates over elements of
10057 * `collection` from right to left.
10058 *
10059 * @static
10060 * @memberOf _
10061 * @since 2.0.0
10062 * @alias eachRight
10063 * @category Collection
10064 * @param {Array|Object} collection The collection to iterate over.
10065 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10066 * @returns {Array|Object} Returns `collection`.
10067 * @see _.forEach
10068 * @example
10069 *
10070 * _.forEachRight([1, 2], function(value) {
10071 * console.log(value);
10072 * });
10073 * // => Logs `2` then `1`.
10074 */
10075 function forEachRight(collection, iteratee) {
10076 return (isArray(collection) ? arrayEachRight : baseEachRight)(collection, getIteratee(iteratee, 3));
10077 }
10078 /**
10079 * Creates an object composed of keys generated from the results of running
10080 * each element of `collection` thru `iteratee`. The order of grouped values
10081 * is determined by the order they occur in `collection`. The corresponding
10082 * value of each key is an array of elements responsible for generating the
10083 * key. The iteratee is invoked with one argument: (value).
10084 *
10085 * @static
10086 * @memberOf _
10087 * @since 0.1.0
10088 * @category Collection
10089 * @param {Array|Object} collection The collection to iterate over.
10090 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
10091 * @returns {Object} Returns the composed aggregate object.
10092 * @example
10093 *
10094 * _.groupBy([6.1, 4.2, 6.3], Math.floor);
10095 * // => { '4': [4.2], '6': [6.1, 6.3] }
10096 *
10097 * // The `_.property` iteratee shorthand.
10098 * _.groupBy(['one', 'two', 'three'], 'length');
10099 * // => { '3': ['one', 'two'], '5': ['three'] }
10100 */
10101 var groupBy = createAggregator(function(result, value, key) {
10102 if (hasOwnProperty.call(result, key)) result[key].push(value);
10103 else baseAssignValue(result, key, [value]);
10104 });
10105 /**
10106 * Checks if `value` is in `collection`. If `collection` is a string, it's
10107 * checked for a substring of `value`, otherwise
10108 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
10109 * is used for equality comparisons. If `fromIndex` is negative, it's used as
10110 * the offset from the end of `collection`.
10111 *
10112 * @static
10113 * @memberOf _
10114 * @since 0.1.0
10115 * @category Collection
10116 * @param {Array|Object|string} collection The collection to inspect.
10117 * @param {*} value The value to search for.
10118 * @param {number} [fromIndex=0] The index to search from.
10119 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
10120 * @returns {boolean} Returns `true` if `value` is found, else `false`.
10121 * @example
10122 *
10123 * _.includes([1, 2, 3], 1);
10124 * // => true
10125 *
10126 * _.includes([1, 2, 3], 1, 2);
10127 * // => false
10128 *
10129 * _.includes({ 'a': 1, 'b': 2 }, 1);
10130 * // => true
10131 *
10132 * _.includes('abcd', 'bc');
10133 * // => true
10134 */
10135 function includes(collection, value, fromIndex, guard) {
10136 collection = isArrayLike(collection) ? collection : values(collection);
10137 fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
10138 var length = collection.length;
10139 if (fromIndex < 0) fromIndex = nativeMax(length + fromIndex, 0);
10140 return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
10141 }
10142 /**
10143 * Invokes the method at `path` of each element in `collection`, returning
10144 * an array of the results of each invoked method. Any additional arguments
10145 * are provided to each invoked method. If `path` is a function, it's invoked
10146 * for, and `this` bound to, each element in `collection`.
10147 *
10148 * @static
10149 * @memberOf _
10150 * @since 4.0.0
10151 * @category Collection
10152 * @param {Array|Object} collection The collection to iterate over.
10153 * @param {Array|Function|string} path The path of the method to invoke or
10154 * the function invoked per iteration.
10155 * @param {...*} [args] The arguments to invoke each method with.
10156 * @returns {Array} Returns the array of results.
10157 * @example
10158 *
10159 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
10160 * // => [[1, 5, 7], [1, 2, 3]]
10161 *
10162 * _.invokeMap([123, 456], String.prototype.split, '');
10163 * // => [['1', '2', '3'], ['4', '5', '6']]
10164 */
10165 var invokeMap = baseRest(function(collection, path, args) {
10166 var index = -1;
10167 var isFunc = typeof path == "function";
10168 var result = isArrayLike(collection) ? Array(collection.length) : [];
10169 baseEach(collection, function(value) {
10170 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
10171 });
10172 return result;
10173 });
10174 /**
10175 * Creates an object composed of keys generated from the results of running
10176 * each element of `collection` thru `iteratee`. The corresponding value of
10177 * each key is the last element responsible for generating the key. The
10178 * iteratee is invoked with one argument: (value).
10179 *
10180 * @static
10181 * @memberOf _
10182 * @since 4.0.0
10183 * @category Collection
10184 * @param {Array|Object} collection The collection to iterate over.
10185 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
10186 * @returns {Object} Returns the composed aggregate object.
10187 * @example
10188 *
10189 * var array = [
10190 * { 'dir': 'left', 'code': 97 },
10191 * { 'dir': 'right', 'code': 100 }
10192 * ];
10193 *
10194 * _.keyBy(array, function(o) {
10195 * return String.fromCharCode(o.code);
10196 * });
10197 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
10198 *
10199 * _.keyBy(array, 'dir');
10200 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
10201 */
10202 var keyBy = createAggregator(function(result, value, key) {
10203 baseAssignValue(result, key, value);
10204 });
10205 /**
10206 * Creates an array of values by running each element in `collection` thru
10207 * `iteratee`. The iteratee is invoked with three arguments:
10208 * (value, index|key, collection).
10209 *
10210 * Many lodash methods are guarded to work as iteratees for methods like
10211 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
10212 *
10213 * The guarded methods are:
10214 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
10215 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
10216 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
10217 * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
10218 *
10219 * @static
10220 * @memberOf _
10221 * @since 0.1.0
10222 * @category Collection
10223 * @param {Array|Object} collection The collection to iterate over.
10224 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10225 * @returns {Array} Returns the new mapped array.
10226 * @example
10227 *
10228 * function square(n) {
10229 * return n * n;
10230 * }
10231 *
10232 * _.map([4, 8], square);
10233 * // => [16, 64]
10234 *
10235 * _.map({ 'a': 4, 'b': 8 }, square);
10236 * // => [16, 64] (iteration order is not guaranteed)
10237 *
10238 * var users = [
10239 * { 'user': 'barney' },
10240 * { 'user': 'fred' }
10241 * ];
10242 *
10243 * // The `_.property` iteratee shorthand.
10244 * _.map(users, 'user');
10245 * // => ['barney', 'fred']
10246 */
10247 function map(collection, iteratee) {
10248 return (isArray(collection) ? arrayMap : baseMap)(collection, getIteratee(iteratee, 3));
10249 }
10250 /**
10251 * This method is like `_.sortBy` except that it allows specifying the sort
10252 * orders of the iteratees to sort by. If `orders` is unspecified, all values
10253 * are sorted in ascending order. Otherwise, specify an order of "desc" for
10254 * descending or "asc" for ascending sort order of corresponding values.
10255 *
10256 * @static
10257 * @memberOf _
10258 * @since 4.0.0
10259 * @category Collection
10260 * @param {Array|Object} collection The collection to iterate over.
10261 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
10262 * The iteratees to sort by.
10263 * @param {string[]} [orders] The sort orders of `iteratees`.
10264 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
10265 * @returns {Array} Returns the new sorted array.
10266 * @example
10267 *
10268 * var users = [
10269 * { 'user': 'fred', 'age': 48 },
10270 * { 'user': 'barney', 'age': 34 },
10271 * { 'user': 'fred', 'age': 40 },
10272 * { 'user': 'barney', 'age': 36 }
10273 * ];
10274 *
10275 * // Sort by `user` in ascending order and by `age` in descending order.
10276 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
10277 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
10278 */
10279 function orderBy(collection, iteratees, orders, guard) {
10280 if (collection == null) return [];
10281 if (!isArray(iteratees)) iteratees = iteratees == null ? [] : [iteratees];
10282 orders = guard ? undefined : orders;
10283 if (!isArray(orders)) orders = orders == null ? [] : [orders];
10284 return baseOrderBy(collection, iteratees, orders);
10285 }
10286 /**
10287 * Creates an array of elements split into two groups, the first of which
10288 * contains elements `predicate` returns truthy for, the second of which
10289 * contains elements `predicate` returns falsey for. The predicate is
10290 * invoked with one argument: (value).
10291 *
10292 * @static
10293 * @memberOf _
10294 * @since 3.0.0
10295 * @category Collection
10296 * @param {Array|Object} collection The collection to iterate over.
10297 * @param {Function} [predicate=_.identity] The function invoked per iteration.
10298 * @returns {Array} Returns the array of grouped elements.
10299 * @example
10300 *
10301 * var users = [
10302 * { 'user': 'barney', 'age': 36, 'active': false },
10303 * { 'user': 'fred', 'age': 40, 'active': true },
10304 * { 'user': 'pebbles', 'age': 1, 'active': false }
10305 * ];
10306 *
10307 * _.partition(users, function(o) { return o.active; });
10308 * // => objects for [['fred'], ['barney', 'pebbles']]
10309 *
10310 * // The `_.matches` iteratee shorthand.
10311 * _.partition(users, { 'age': 1, 'active': false });
10312 * // => objects for [['pebbles'], ['barney', 'fred']]
10313 *
10314 * // The `_.matchesProperty` iteratee shorthand.
10315 * _.partition(users, ['active', false]);
10316 * // => objects for [['barney', 'pebbles'], ['fred']]
10317 *
10318 * // The `_.property` iteratee shorthand.
10319 * _.partition(users, 'active');
10320 * // => objects for [['fred'], ['barney', 'pebbles']]
10321 */
10322 var partition = createAggregator(function(result, value, key) {
10323 result[key ? 0 : 1].push(value);
10324 }, function() {
10325 return [[], []];
10326 });
10327 /**
10328 * Reduces `collection` to a value which is the accumulated result of running
10329 * each element in `collection` thru `iteratee`, where each successive
10330 * invocation is supplied the return value of the previous. If `accumulator`
10331 * is not given, the first element of `collection` is used as the initial
10332 * value. The iteratee is invoked with four arguments:
10333 * (accumulator, value, index|key, collection).
10334 *
10335 * Many lodash methods are guarded to work as iteratees for methods like
10336 * `_.reduce`, `_.reduceRight`, and `_.transform`.
10337 *
10338 * The guarded methods are:
10339 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
10340 * and `sortBy`
10341 *
10342 * @static
10343 * @memberOf _
10344 * @since 0.1.0
10345 * @category Collection
10346 * @param {Array|Object} collection The collection to iterate over.
10347 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10348 * @param {*} [accumulator] The initial value.
10349 * @returns {*} Returns the accumulated value.
10350 * @see _.reduceRight
10351 * @example
10352 *
10353 * _.reduce([1, 2], function(sum, n) {
10354 * return sum + n;
10355 * }, 0);
10356 * // => 3
10357 *
10358 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
10359 * (result[value] || (result[value] = [])).push(key);
10360 * return result;
10361 * }, {});
10362 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
10363 */
10364 function reduce(collection, iteratee, accumulator) {
10365 var func = isArray(collection) ? arrayReduce : baseReduce;
10366 var initAccum = arguments.length < 3;
10367 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
10368 }
10369 /**
10370 * This method is like `_.reduce` except that it iterates over elements of
10371 * `collection` from right to left.
10372 *
10373 * @static
10374 * @memberOf _
10375 * @since 0.1.0
10376 * @category Collection
10377 * @param {Array|Object} collection The collection to iterate over.
10378 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10379 * @param {*} [accumulator] The initial value.
10380 * @returns {*} Returns the accumulated value.
10381 * @see _.reduce
10382 * @example
10383 *
10384 * var array = [[0, 1], [2, 3], [4, 5]];
10385 *
10386 * _.reduceRight(array, function(flattened, other) {
10387 * return flattened.concat(other);
10388 * }, []);
10389 * // => [4, 5, 2, 3, 0, 1]
10390 */
10391 function reduceRight(collection, iteratee, accumulator) {
10392 var func = isArray(collection) ? arrayReduceRight : baseReduce;
10393 var initAccum = arguments.length < 3;
10394 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
10395 }
10396 /**
10397 * The opposite of `_.filter`; this method returns the elements of `collection`
10398 * that `predicate` does **not** return truthy for.
10399 *
10400 * @static
10401 * @memberOf _
10402 * @since 0.1.0
10403 * @category Collection
10404 * @param {Array|Object} collection The collection to iterate over.
10405 * @param {Function} [predicate=_.identity] The function invoked per iteration.
10406 * @returns {Array} Returns the new filtered array.
10407 * @see _.filter
10408 * @example
10409 *
10410 * var users = [
10411 * { 'user': 'barney', 'age': 36, 'active': false },
10412 * { 'user': 'fred', 'age': 40, 'active': true }
10413 * ];
10414 *
10415 * _.reject(users, function(o) { return !o.active; });
10416 * // => objects for ['fred']
10417 *
10418 * // The `_.matches` iteratee shorthand.
10419 * _.reject(users, { 'age': 40, 'active': true });
10420 * // => objects for ['barney']
10421 *
10422 * // The `_.matchesProperty` iteratee shorthand.
10423 * _.reject(users, ['active', false]);
10424 * // => objects for ['fred']
10425 *
10426 * // The `_.property` iteratee shorthand.
10427 * _.reject(users, 'active');
10428 * // => objects for ['barney']
10429 */
10430 function reject(collection, predicate) {
10431 return (isArray(collection) ? arrayFilter : baseFilter)(collection, negate(getIteratee(predicate, 3)));
10432 }
10433 /**
10434 * Gets a random element from `collection`.
10435 *
10436 * @static
10437 * @memberOf _
10438 * @since 2.0.0
10439 * @category Collection
10440 * @param {Array|Object} collection The collection to sample.
10441 * @returns {*} Returns the random element.
10442 * @example
10443 *
10444 * _.sample([1, 2, 3, 4]);
10445 * // => 2
10446 */
10447 function sample(collection) {
10448 return (isArray(collection) ? arraySample : baseSample)(collection);
10449 }
10450 /**
10451 * Gets `n` random elements at unique keys from `collection` up to the
10452 * size of `collection`.
10453 *
10454 * @static
10455 * @memberOf _
10456 * @since 4.0.0
10457 * @category Collection
10458 * @param {Array|Object} collection The collection to sample.
10459 * @param {number} [n=1] The number of elements to sample.
10460 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10461 * @returns {Array} Returns the random elements.
10462 * @example
10463 *
10464 * _.sampleSize([1, 2, 3], 2);
10465 * // => [3, 1]
10466 *
10467 * _.sampleSize([1, 2, 3], 4);
10468 * // => [2, 3, 1]
10469 */
10470 function sampleSize(collection, n, guard) {
10471 if (guard ? isIterateeCall(collection, n, guard) : n === undefined) n = 1;
10472 else n = toInteger(n);
10473 return (isArray(collection) ? arraySampleSize : baseSampleSize)(collection, n);
10474 }
10475 /**
10476 * Creates an array of shuffled values, using a version of the
10477 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
10478 *
10479 * @static
10480 * @memberOf _
10481 * @since 0.1.0
10482 * @category Collection
10483 * @param {Array|Object} collection The collection to shuffle.
10484 * @returns {Array} Returns the new shuffled array.
10485 * @example
10486 *
10487 * _.shuffle([1, 2, 3, 4]);
10488 * // => [4, 1, 3, 2]
10489 */
10490 function shuffle(collection) {
10491 return (isArray(collection) ? arrayShuffle : baseShuffle)(collection);
10492 }
10493 /**
10494 * Gets the size of `collection` by returning its length for array-like
10495 * values or the number of own enumerable string keyed properties for objects.
10496 *
10497 * @static
10498 * @memberOf _
10499 * @since 0.1.0
10500 * @category Collection
10501 * @param {Array|Object|string} collection The collection to inspect.
10502 * @returns {number} Returns the collection size.
10503 * @example
10504 *
10505 * _.size([1, 2, 3]);
10506 * // => 3
10507 *
10508 * _.size({ 'a': 1, 'b': 2 });
10509 * // => 2
10510 *
10511 * _.size('pebbles');
10512 * // => 7
10513 */
10514 function size(collection) {
10515 if (collection == null) return 0;
10516 if (isArrayLike(collection)) return isString(collection) ? stringSize(collection) : collection.length;
10517 var tag = getTag(collection);
10518 if (tag == mapTag || tag == setTag) return collection.size;
10519 return baseKeys(collection).length;
10520 }
10521 /**
10522 * Checks if `predicate` returns truthy for **any** element of `collection`.
10523 * Iteration is stopped once `predicate` returns truthy. The predicate is
10524 * invoked with three arguments: (value, index|key, collection).
10525 *
10526 * @static
10527 * @memberOf _
10528 * @since 0.1.0
10529 * @category Collection
10530 * @param {Array|Object} collection The collection to iterate over.
10531 * @param {Function} [predicate=_.identity] The function invoked per iteration.
10532 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10533 * @returns {boolean} Returns `true` if any element passes the predicate check,
10534 * else `false`.
10535 * @example
10536 *
10537 * _.some([null, 0, 'yes', false], Boolean);
10538 * // => true
10539 *
10540 * var users = [
10541 * { 'user': 'barney', 'active': true },
10542 * { 'user': 'fred', 'active': false }
10543 * ];
10544 *
10545 * // The `_.matches` iteratee shorthand.
10546 * _.some(users, { 'user': 'barney', 'active': false });
10547 * // => false
10548 *
10549 * // The `_.matchesProperty` iteratee shorthand.
10550 * _.some(users, ['active', false]);
10551 * // => true
10552 *
10553 * // The `_.property` iteratee shorthand.
10554 * _.some(users, 'active');
10555 * // => true
10556 */
10557 function some(collection, predicate, guard) {
10558 var func = isArray(collection) ? arraySome : baseSome;
10559 if (guard && isIterateeCall(collection, predicate, guard)) predicate = undefined;
10560 return func(collection, getIteratee(predicate, 3));
10561 }
10562 /**
10563 * Creates an array of elements, sorted in ascending order by the results of
10564 * running each element in a collection thru each iteratee. This method
10565 * performs a stable sort, that is, it preserves the original sort order of
10566 * equal elements. The iteratees are invoked with one argument: (value).
10567 *
10568 * @static
10569 * @memberOf _
10570 * @since 0.1.0
10571 * @category Collection
10572 * @param {Array|Object} collection The collection to iterate over.
10573 * @param {...(Function|Function[])} [iteratees=[_.identity]]
10574 * The iteratees to sort by.
10575 * @returns {Array} Returns the new sorted array.
10576 * @example
10577 *
10578 * var users = [
10579 * { 'user': 'fred', 'age': 48 },
10580 * { 'user': 'barney', 'age': 36 },
10581 * { 'user': 'fred', 'age': 30 },
10582 * { 'user': 'barney', 'age': 34 }
10583 * ];
10584 *
10585 * _.sortBy(users, [function(o) { return o.user; }]);
10586 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
10587 *
10588 * _.sortBy(users, ['user', 'age']);
10589 * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
10590 */
10591 var sortBy = baseRest(function(collection, iteratees) {
10592 if (collection == null) return [];
10593 var length = iteratees.length;
10594 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) iteratees = [];
10595 else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) iteratees = [iteratees[0]];
10596 return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
10597 });
10598 /**
10599 * Gets the timestamp of the number of milliseconds that have elapsed since
10600 * the Unix epoch (1 January 1970 00:00:00 UTC).
10601 *
10602 * @static
10603 * @memberOf _
10604 * @since 2.4.0
10605 * @category Date
10606 * @returns {number} Returns the timestamp.
10607 * @example
10608 *
10609 * _.defer(function(stamp) {
10610 * console.log(_.now() - stamp);
10611 * }, _.now());
10612 * // => Logs the number of milliseconds it took for the deferred invocation.
10613 */
10614 var now = ctxNow || function() {
10615 return root.Date.now();
10616 };
10617 /**
10618 * The opposite of `_.before`; this method creates a function that invokes
10619 * `func` once it's called `n` or more times.
10620 *
10621 * @static
10622 * @memberOf _
10623 * @since 0.1.0
10624 * @category Function
10625 * @param {number} n The number of calls before `func` is invoked.
10626 * @param {Function} func The function to restrict.
10627 * @returns {Function} Returns the new restricted function.
10628 * @example
10629 *
10630 * var saves = ['profile', 'settings'];
10631 *
10632 * var done = _.after(saves.length, function() {
10633 * console.log('done saving!');
10634 * });
10635 *
10636 * _.forEach(saves, function(type) {
10637 * asyncSave({ 'type': type, 'complete': done });
10638 * });
10639 * // => Logs 'done saving!' after the two async saves have completed.
10640 */
10641 function after(n, func) {
10642 if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
10643 n = toInteger(n);
10644 return function() {
10645 if (--n < 1) return func.apply(this, arguments);
10646 };
10647 }
10648 /**
10649 * Creates a function that invokes `func`, with up to `n` arguments,
10650 * ignoring any additional arguments.
10651 *
10652 * @static
10653 * @memberOf _
10654 * @since 3.0.0
10655 * @category Function
10656 * @param {Function} func The function to cap arguments for.
10657 * @param {number} [n=func.length] The arity cap.
10658 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10659 * @returns {Function} Returns the new capped function.
10660 * @example
10661 *
10662 * _.map(['6', '8', '10'], _.ary(parseInt, 1));
10663 * // => [6, 8, 10]
10664 */
10665 function ary(func, n, guard) {
10666 n = guard ? undefined : n;
10667 n = func && n == null ? func.length : n;
10668 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
10669 }
10670 /**
10671 * Creates a function that invokes `func`, with the `this` binding and arguments
10672 * of the created function, while it's called less than `n` times. Subsequent
10673 * calls to the created function return the result of the last `func` invocation.
10674 *
10675 * @static
10676 * @memberOf _
10677 * @since 3.0.0
10678 * @category Function
10679 * @param {number} n The number of calls at which `func` is no longer invoked.
10680 * @param {Function} func The function to restrict.
10681 * @returns {Function} Returns the new restricted function.
10682 * @example
10683 *
10684 * jQuery(element).on('click', _.before(5, addContactToList));
10685 * // => Allows adding up to 4 contacts to the list.
10686 */
10687 function before(n, func) {
10688 var result;
10689 if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
10690 n = toInteger(n);
10691 return function() {
10692 if (--n > 0) result = func.apply(this, arguments);
10693 if (n <= 1) func = undefined;
10694 return result;
10695 };
10696 }
10697 /**
10698 * Creates a function that invokes `func` with the `this` binding of `thisArg`
10699 * and `partials` prepended to the arguments it receives.
10700 *
10701 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
10702 * may be used as a placeholder for partially applied arguments.
10703 *
10704 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
10705 * property of bound functions.
10706 *
10707 * @static
10708 * @memberOf _
10709 * @since 0.1.0
10710 * @category Function
10711 * @param {Function} func The function to bind.
10712 * @param {*} thisArg The `this` binding of `func`.
10713 * @param {...*} [partials] The arguments to be partially applied.
10714 * @returns {Function} Returns the new bound function.
10715 * @example
10716 *
10717 * function greet(greeting, punctuation) {
10718 * return greeting + ' ' + this.user + punctuation;
10719 * }
10720 *
10721 * var object = { 'user': 'fred' };
10722 *
10723 * var bound = _.bind(greet, object, 'hi');
10724 * bound('!');
10725 * // => 'hi fred!'
10726 *
10727 * // Bound with placeholders.
10728 * var bound = _.bind(greet, object, _, '!');
10729 * bound('hi');
10730 * // => 'hi fred!'
10731 */
10732 var bind = baseRest(function(func, thisArg, partials) {
10733 var bitmask = WRAP_BIND_FLAG;
10734 if (partials.length) {
10735 var holders = replaceHolders(partials, getHolder(bind));
10736 bitmask |= WRAP_PARTIAL_FLAG;
10737 }
10738 return createWrap(func, bitmask, thisArg, partials, holders);
10739 });
10740 /**
10741 * Creates a function that invokes the method at `object[key]` with `partials`
10742 * prepended to the arguments it receives.
10743 *
10744 * This method differs from `_.bind` by allowing bound functions to reference
10745 * methods that may be redefined or don't yet exist. See
10746 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
10747 * for more details.
10748 *
10749 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
10750 * builds, may be used as a placeholder for partially applied arguments.
10751 *
10752 * @static
10753 * @memberOf _
10754 * @since 0.10.0
10755 * @category Function
10756 * @param {Object} object The object to invoke the method on.
10757 * @param {string} key The key of the method.
10758 * @param {...*} [partials] The arguments to be partially applied.
10759 * @returns {Function} Returns the new bound function.
10760 * @example
10761 *
10762 * var object = {
10763 * 'user': 'fred',
10764 * 'greet': function(greeting, punctuation) {
10765 * return greeting + ' ' + this.user + punctuation;
10766 * }
10767 * };
10768 *
10769 * var bound = _.bindKey(object, 'greet', 'hi');
10770 * bound('!');
10771 * // => 'hi fred!'
10772 *
10773 * object.greet = function(greeting, punctuation) {
10774 * return greeting + 'ya ' + this.user + punctuation;
10775 * };
10776 *
10777 * bound('!');
10778 * // => 'hiya fred!'
10779 *
10780 * // Bound with placeholders.
10781 * var bound = _.bindKey(object, 'greet', _, '!');
10782 * bound('hi');
10783 * // => 'hiya fred!'
10784 */
10785 var bindKey = baseRest(function(object, key, partials) {
10786 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
10787 if (partials.length) {
10788 var holders = replaceHolders(partials, getHolder(bindKey));
10789 bitmask |= WRAP_PARTIAL_FLAG;
10790 }
10791 return createWrap(key, bitmask, object, partials, holders);
10792 });
10793 /**
10794 * Creates a function that accepts arguments of `func` and either invokes
10795 * `func` returning its result, if at least `arity` number of arguments have
10796 * been provided, or returns a function that accepts the remaining `func`
10797 * arguments, and so on. The arity of `func` may be specified if `func.length`
10798 * is not sufficient.
10799 *
10800 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
10801 * may be used as a placeholder for provided arguments.
10802 *
10803 * **Note:** This method doesn't set the "length" property of curried functions.
10804 *
10805 * @static
10806 * @memberOf _
10807 * @since 2.0.0
10808 * @category Function
10809 * @param {Function} func The function to curry.
10810 * @param {number} [arity=func.length] The arity of `func`.
10811 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10812 * @returns {Function} Returns the new curried function.
10813 * @example
10814 *
10815 * var abc = function(a, b, c) {
10816 * return [a, b, c];
10817 * };
10818 *
10819 * var curried = _.curry(abc);
10820 *
10821 * curried(1)(2)(3);
10822 * // => [1, 2, 3]
10823 *
10824 * curried(1, 2)(3);
10825 * // => [1, 2, 3]
10826 *
10827 * curried(1, 2, 3);
10828 * // => [1, 2, 3]
10829 *
10830 * // Curried with placeholders.
10831 * curried(1)(_, 3)(2);
10832 * // => [1, 2, 3]
10833 */
10834 function curry(func, arity, guard) {
10835 arity = guard ? undefined : arity;
10836 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
10837 result.placeholder = curry.placeholder;
10838 return result;
10839 }
10840 /**
10841 * This method is like `_.curry` except that arguments are applied to `func`
10842 * in the manner of `_.partialRight` instead of `_.partial`.
10843 *
10844 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
10845 * builds, may be used as a placeholder for provided arguments.
10846 *
10847 * **Note:** This method doesn't set the "length" property of curried functions.
10848 *
10849 * @static
10850 * @memberOf _
10851 * @since 3.0.0
10852 * @category Function
10853 * @param {Function} func The function to curry.
10854 * @param {number} [arity=func.length] The arity of `func`.
10855 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
10856 * @returns {Function} Returns the new curried function.
10857 * @example
10858 *
10859 * var abc = function(a, b, c) {
10860 * return [a, b, c];
10861 * };
10862 *
10863 * var curried = _.curryRight(abc);
10864 *
10865 * curried(3)(2)(1);
10866 * // => [1, 2, 3]
10867 *
10868 * curried(2, 3)(1);
10869 * // => [1, 2, 3]
10870 *
10871 * curried(1, 2, 3);
10872 * // => [1, 2, 3]
10873 *
10874 * // Curried with placeholders.
10875 * curried(3)(1, _)(2);
10876 * // => [1, 2, 3]
10877 */
10878 function curryRight(func, arity, guard) {
10879 arity = guard ? undefined : arity;
10880 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
10881 result.placeholder = curryRight.placeholder;
10882 return result;
10883 }
10884 /**
10885 * Creates a debounced function that delays invoking `func` until after `wait`
10886 * milliseconds have elapsed since the last time the debounced function was
10887 * invoked. The debounced function comes with a `cancel` method to cancel
10888 * delayed `func` invocations and a `flush` method to immediately invoke them.
10889 * Provide `options` to indicate whether `func` should be invoked on the
10890 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
10891 * with the last arguments provided to the debounced function. Subsequent
10892 * calls to the debounced function return the result of the last `func`
10893 * invocation.
10894 *
10895 * **Note:** If `leading` and `trailing` options are `true`, `func` is
10896 * invoked on the trailing edge of the timeout only if the debounced function
10897 * is invoked more than once during the `wait` timeout.
10898 *
10899 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
10900 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
10901 *
10902 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
10903 * for details over the differences between `_.debounce` and `_.throttle`.
10904 *
10905 * @static
10906 * @memberOf _
10907 * @since 0.1.0
10908 * @category Function
10909 * @param {Function} func The function to debounce.
10910 * @param {number} [wait=0] The number of milliseconds to delay.
10911 * @param {Object} [options={}] The options object.
10912 * @param {boolean} [options.leading=false]
10913 * Specify invoking on the leading edge of the timeout.
10914 * @param {number} [options.maxWait]
10915 * The maximum time `func` is allowed to be delayed before it's invoked.
10916 * @param {boolean} [options.trailing=true]
10917 * Specify invoking on the trailing edge of the timeout.
10918 * @returns {Function} Returns the new debounced function.
10919 * @example
10920 *
10921 * // Avoid costly calculations while the window size is in flux.
10922 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
10923 *
10924 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
10925 * jQuery(element).on('click', _.debounce(sendMail, 300, {
10926 * 'leading': true,
10927 * 'trailing': false
10928 * }));
10929 *
10930 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
10931 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
10932 * var source = new EventSource('/stream');
10933 * jQuery(source).on('message', debounced);
10934 *
10935 * // Cancel the trailing debounced invocation.
10936 * jQuery(window).on('popstate', debounced.cancel);
10937 */
10938 function debounce(func, wait, options) {
10939 var lastArgs;
10940 var lastThis;
10941 var maxWait;
10942 var result;
10943 var timerId;
10944 var lastCallTime;
10945 var lastInvokeTime = 0;
10946 var leading = false;
10947 var maxing = false;
10948 var trailing = true;
10949 if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
10950 wait = toNumber(wait) || 0;
10951 if (isObject(options)) {
10952 leading = !!options.leading;
10953 maxing = "maxWait" in options;
10954 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
10955 trailing = "trailing" in options ? !!options.trailing : trailing;
10956 }
10957 function invokeFunc(time) {
10958 var args = lastArgs;
10959 var thisArg = lastThis;
10960 lastArgs = lastThis = undefined;
10961 lastInvokeTime = time;
10962 result = func.apply(thisArg, args);
10963 return result;
10964 }
10965 function leadingEdge(time) {
10966 lastInvokeTime = time;
10967 timerId = setTimeout(timerExpired, wait);
10968 return leading ? invokeFunc(time) : result;
10969 }
10970 function remainingWait(time) {
10971 var timeSinceLastCall = time - lastCallTime;
10972 var timeSinceLastInvoke = time - lastInvokeTime;
10973 var timeWaiting = wait - timeSinceLastCall;
10974 return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
10975 }
10976 function shouldInvoke(time) {
10977 var timeSinceLastCall = time - lastCallTime;
10978 var timeSinceLastInvoke = time - lastInvokeTime;
10979 return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
10980 }
10981 function timerExpired() {
10982 var time = now();
10983 if (shouldInvoke(time)) return trailingEdge(time);
10984 timerId = setTimeout(timerExpired, remainingWait(time));
10985 }
10986 function trailingEdge(time) {
10987 timerId = undefined;
10988 if (trailing && lastArgs) return invokeFunc(time);
10989 lastArgs = lastThis = undefined;
10990 return result;
10991 }
10992 function cancel() {
10993 if (timerId !== undefined) clearTimeout(timerId);
10994 lastInvokeTime = 0;
10995 lastArgs = lastCallTime = lastThis = timerId = undefined;
10996 }
10997 function flush() {
10998 return timerId === undefined ? result : trailingEdge(now());
10999 }
11000 function debounced() {
11001 var time = now();
11002 var isInvoking = shouldInvoke(time);
11003 lastArgs = arguments;
11004 lastThis = this;
11005 lastCallTime = time;
11006 if (isInvoking) {
11007 if (timerId === undefined) return leadingEdge(lastCallTime);
11008 if (maxing) {
11009 clearTimeout(timerId);
11010 timerId = setTimeout(timerExpired, wait);
11011 return invokeFunc(lastCallTime);
11012 }
11013 }
11014 if (timerId === undefined) timerId = setTimeout(timerExpired, wait);
11015 return result;
11016 }
11017 debounced.cancel = cancel;
11018 debounced.flush = flush;
11019 return debounced;
11020 }
11021 /**
11022 * Defers invoking the `func` until the current call stack has cleared. Any
11023 * additional arguments are provided to `func` when it's invoked.
11024 *
11025 * @static
11026 * @memberOf _
11027 * @since 0.1.0
11028 * @category Function
11029 * @param {Function} func The function to defer.
11030 * @param {...*} [args] The arguments to invoke `func` with.
11031 * @returns {number} Returns the timer id.
11032 * @example
11033 *
11034 * _.defer(function(text) {
11035 * console.log(text);
11036 * }, 'deferred');
11037 * // => Logs 'deferred' after one millisecond.
11038 */
11039 var defer = baseRest(function(func, args) {
11040 return baseDelay(func, 1, args);
11041 });
11042 /**
11043 * Invokes `func` after `wait` milliseconds. Any additional arguments are
11044 * provided to `func` when it's invoked.
11045 *
11046 * @static
11047 * @memberOf _
11048 * @since 0.1.0
11049 * @category Function
11050 * @param {Function} func The function to delay.
11051 * @param {number} wait The number of milliseconds to delay invocation.
11052 * @param {...*} [args] The arguments to invoke `func` with.
11053 * @returns {number} Returns the timer id.
11054 * @example
11055 *
11056 * _.delay(function(text) {
11057 * console.log(text);
11058 * }, 1000, 'later');
11059 * // => Logs 'later' after one second.
11060 */
11061 var delay = baseRest(function(func, wait, args) {
11062 return baseDelay(func, toNumber(wait) || 0, args);
11063 });
11064 /**
11065 * Creates a function that invokes `func` with arguments reversed.
11066 *
11067 * @static
11068 * @memberOf _
11069 * @since 4.0.0
11070 * @category Function
11071 * @param {Function} func The function to flip arguments for.
11072 * @returns {Function} Returns the new flipped function.
11073 * @example
11074 *
11075 * var flipped = _.flip(function() {
11076 * return _.toArray(arguments);
11077 * });
11078 *
11079 * flipped('a', 'b', 'c', 'd');
11080 * // => ['d', 'c', 'b', 'a']
11081 */
11082 function flip(func) {
11083 return createWrap(func, WRAP_FLIP_FLAG);
11084 }
11085 /**
11086 * Creates a function that memoizes the result of `func`. If `resolver` is
11087 * provided, it determines the cache key for storing the result based on the
11088 * arguments provided to the memoized function. By default, the first argument
11089 * provided to the memoized function is used as the map cache key. The `func`
11090 * is invoked with the `this` binding of the memoized function.
11091 *
11092 * **Note:** The cache is exposed as the `cache` property on the memoized
11093 * function. Its creation may be customized by replacing the `_.memoize.Cache`
11094 * constructor with one whose instances implement the
11095 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
11096 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
11097 *
11098 * @static
11099 * @memberOf _
11100 * @since 0.1.0
11101 * @category Function
11102 * @param {Function} func The function to have its output memoized.
11103 * @param {Function} [resolver] The function to resolve the cache key.
11104 * @returns {Function} Returns the new memoized function.
11105 * @example
11106 *
11107 * var object = { 'a': 1, 'b': 2 };
11108 * var other = { 'c': 3, 'd': 4 };
11109 *
11110 * var values = _.memoize(_.values);
11111 * values(object);
11112 * // => [1, 2]
11113 *
11114 * values(other);
11115 * // => [3, 4]
11116 *
11117 * object.a = 2;
11118 * values(object);
11119 * // => [1, 2]
11120 *
11121 * // Modify the result cache.
11122 * values.cache.set(object, ['a', 'b']);
11123 * values(object);
11124 * // => ['a', 'b']
11125 *
11126 * // Replace `_.memoize.Cache`.
11127 * _.memoize.Cache = WeakMap;
11128 */
11129 function memoize(func, resolver) {
11130 if (typeof func != "function" || resolver != null && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT);
11131 var memoized = function() {
11132 var args = arguments;
11133 var key = resolver ? resolver.apply(this, args) : args[0];
11134 var cache = memoized.cache;
11135 if (cache.has(key)) return cache.get(key);
11136 var result = func.apply(this, args);
11137 memoized.cache = cache.set(key, result) || cache;
11138 return result;
11139 };
11140 memoized.cache = new (memoize.Cache || MapCache)();
11141 return memoized;
11142 }
11143 memoize.Cache = MapCache;
11144 /**
11145 * Creates a function that negates the result of the predicate `func`. The
11146 * `func` predicate is invoked with the `this` binding and arguments of the
11147 * created function.
11148 *
11149 * @static
11150 * @memberOf _
11151 * @since 3.0.0
11152 * @category Function
11153 * @param {Function} predicate The predicate to negate.
11154 * @returns {Function} Returns the new negated function.
11155 * @example
11156 *
11157 * function isEven(n) {
11158 * return n % 2 == 0;
11159 * }
11160 *
11161 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
11162 * // => [1, 3, 5]
11163 */
11164 function negate(predicate) {
11165 if (typeof predicate != "function") throw new TypeError(FUNC_ERROR_TEXT);
11166 return function() {
11167 var args = arguments;
11168 switch (args.length) {
11169 case 0: return !predicate.call(this);
11170 case 1: return !predicate.call(this, args[0]);
11171 case 2: return !predicate.call(this, args[0], args[1]);
11172 case 3: return !predicate.call(this, args[0], args[1], args[2]);
11173 }
11174 return !predicate.apply(this, args);
11175 };
11176 }
11177 /**
11178 * Creates a function that is restricted to invoking `func` once. Repeat calls
11179 * to the function return the value of the first invocation. The `func` is
11180 * invoked with the `this` binding and arguments of the created function.
11181 *
11182 * @static
11183 * @memberOf _
11184 * @since 0.1.0
11185 * @category Function
11186 * @param {Function} func The function to restrict.
11187 * @returns {Function} Returns the new restricted function.
11188 * @example
11189 *
11190 * var initialize = _.once(createApplication);
11191 * initialize();
11192 * initialize();
11193 * // => `createApplication` is invoked once
11194 */
11195 function once(func) {
11196 return before(2, func);
11197 }
11198 /**
11199 * Creates a function that invokes `func` with its arguments transformed.
11200 *
11201 * @static
11202 * @since 4.0.0
11203 * @memberOf _
11204 * @category Function
11205 * @param {Function} func The function to wrap.
11206 * @param {...(Function|Function[])} [transforms=[_.identity]]
11207 * The argument transforms.
11208 * @returns {Function} Returns the new function.
11209 * @example
11210 *
11211 * function doubled(n) {
11212 * return n * 2;
11213 * }
11214 *
11215 * function square(n) {
11216 * return n * n;
11217 * }
11218 *
11219 * var func = _.overArgs(function(x, y) {
11220 * return [x, y];
11221 * }, [square, doubled]);
11222 *
11223 * func(9, 3);
11224 * // => [81, 6]
11225 *
11226 * func(10, 5);
11227 * // => [100, 10]
11228 */
11229 var overArgs = castRest(function(func, transforms) {
11230 transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
11231 var funcsLength = transforms.length;
11232 return baseRest(function(args) {
11233 var index = -1;
11234 var length = nativeMin(args.length, funcsLength);
11235 while (++index < length) args[index] = transforms[index].call(this, args[index]);
11236 return apply(func, this, args);
11237 });
11238 });
11239 /**
11240 * Creates a function that invokes `func` with `partials` prepended to the
11241 * arguments it receives. This method is like `_.bind` except it does **not**
11242 * alter the `this` binding.
11243 *
11244 * The `_.partial.placeholder` value, which defaults to `_` in monolithic
11245 * builds, may be used as a placeholder for partially applied arguments.
11246 *
11247 * **Note:** This method doesn't set the "length" property of partially
11248 * applied functions.
11249 *
11250 * @static
11251 * @memberOf _
11252 * @since 0.2.0
11253 * @category Function
11254 * @param {Function} func The function to partially apply arguments to.
11255 * @param {...*} [partials] The arguments to be partially applied.
11256 * @returns {Function} Returns the new partially applied function.
11257 * @example
11258 *
11259 * function greet(greeting, name) {
11260 * return greeting + ' ' + name;
11261 * }
11262 *
11263 * var sayHelloTo = _.partial(greet, 'hello');
11264 * sayHelloTo('fred');
11265 * // => 'hello fred'
11266 *
11267 * // Partially applied with placeholders.
11268 * var greetFred = _.partial(greet, _, 'fred');
11269 * greetFred('hi');
11270 * // => 'hi fred'
11271 */
11272 var partial = baseRest(function(func, partials) {
11273 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, replaceHolders(partials, getHolder(partial)));
11274 });
11275 /**
11276 * This method is like `_.partial` except that partially applied arguments
11277 * are appended to the arguments it receives.
11278 *
11279 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
11280 * builds, may be used as a placeholder for partially applied arguments.
11281 *
11282 * **Note:** This method doesn't set the "length" property of partially
11283 * applied functions.
11284 *
11285 * @static
11286 * @memberOf _
11287 * @since 1.0.0
11288 * @category Function
11289 * @param {Function} func The function to partially apply arguments to.
11290 * @param {...*} [partials] The arguments to be partially applied.
11291 * @returns {Function} Returns the new partially applied function.
11292 * @example
11293 *
11294 * function greet(greeting, name) {
11295 * return greeting + ' ' + name;
11296 * }
11297 *
11298 * var greetFred = _.partialRight(greet, 'fred');
11299 * greetFred('hi');
11300 * // => 'hi fred'
11301 *
11302 * // Partially applied with placeholders.
11303 * var sayHelloTo = _.partialRight(greet, 'hello', _);
11304 * sayHelloTo('fred');
11305 * // => 'hello fred'
11306 */
11307 var partialRight = baseRest(function(func, partials) {
11308 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, replaceHolders(partials, getHolder(partialRight)));
11309 });
11310 /**
11311 * Creates a function that invokes `func` with arguments arranged according
11312 * to the specified `indexes` where the argument value at the first index is
11313 * provided as the first argument, the argument value at the second index is
11314 * provided as the second argument, and so on.
11315 *
11316 * @static
11317 * @memberOf _
11318 * @since 3.0.0
11319 * @category Function
11320 * @param {Function} func The function to rearrange arguments for.
11321 * @param {...(number|number[])} indexes The arranged argument indexes.
11322 * @returns {Function} Returns the new function.
11323 * @example
11324 *
11325 * var rearged = _.rearg(function(a, b, c) {
11326 * return [a, b, c];
11327 * }, [2, 0, 1]);
11328 *
11329 * rearged('b', 'c', 'a')
11330 * // => ['a', 'b', 'c']
11331 */
11332 var rearg = flatRest(function(func, indexes) {
11333 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
11334 });
11335 /**
11336 * Creates a function that invokes `func` with the `this` binding of the
11337 * created function and arguments from `start` and beyond provided as
11338 * an array.
11339 *
11340 * **Note:** This method is based on the
11341 * [rest parameter](https://mdn.io/rest_parameters).
11342 *
11343 * @static
11344 * @memberOf _
11345 * @since 4.0.0
11346 * @category Function
11347 * @param {Function} func The function to apply a rest parameter to.
11348 * @param {number} [start=func.length-1] The start position of the rest parameter.
11349 * @returns {Function} Returns the new function.
11350 * @example
11351 *
11352 * var say = _.rest(function(what, names) {
11353 * return what + ' ' + _.initial(names).join(', ') +
11354 * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
11355 * });
11356 *
11357 * say('hello', 'fred', 'barney', 'pebbles');
11358 * // => 'hello fred, barney, & pebbles'
11359 */
11360 function rest(func, start) {
11361 if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
11362 start = start === undefined ? start : toInteger(start);
11363 return baseRest(func, start);
11364 }
11365 /**
11366 * Creates a function that invokes `func` with the `this` binding of the
11367 * create function and an array of arguments much like
11368 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
11369 *
11370 * **Note:** This method is based on the
11371 * [spread operator](https://mdn.io/spread_operator).
11372 *
11373 * @static
11374 * @memberOf _
11375 * @since 3.2.0
11376 * @category Function
11377 * @param {Function} func The function to spread arguments over.
11378 * @param {number} [start=0] The start position of the spread.
11379 * @returns {Function} Returns the new function.
11380 * @example
11381 *
11382 * var say = _.spread(function(who, what) {
11383 * return who + ' says ' + what;
11384 * });
11385 *
11386 * say(['fred', 'hello']);
11387 * // => 'fred says hello'
11388 *
11389 * var numbers = Promise.all([
11390 * Promise.resolve(40),
11391 * Promise.resolve(36)
11392 * ]);
11393 *
11394 * numbers.then(_.spread(function(x, y) {
11395 * return x + y;
11396 * }));
11397 * // => a Promise of 76
11398 */
11399 function spread(func, start) {
11400 if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
11401 start = start == null ? 0 : nativeMax(toInteger(start), 0);
11402 return baseRest(function(args) {
11403 var array = args[start];
11404 var otherArgs = castSlice(args, 0, start);
11405 if (array) arrayPush(otherArgs, array);
11406 return apply(func, this, otherArgs);
11407 });
11408 }
11409 /**
11410 * Creates a throttled function that only invokes `func` at most once per
11411 * every `wait` milliseconds. The throttled function comes with a `cancel`
11412 * method to cancel delayed `func` invocations and a `flush` method to
11413 * immediately invoke them. Provide `options` to indicate whether `func`
11414 * should be invoked on the leading and/or trailing edge of the `wait`
11415 * timeout. The `func` is invoked with the last arguments provided to the
11416 * throttled function. Subsequent calls to the throttled function return the
11417 * result of the last `func` invocation.
11418 *
11419 * **Note:** If `leading` and `trailing` options are `true`, `func` is
11420 * invoked on the trailing edge of the timeout only if the throttled function
11421 * is invoked more than once during the `wait` timeout.
11422 *
11423 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
11424 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
11425 *
11426 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
11427 * for details over the differences between `_.throttle` and `_.debounce`.
11428 *
11429 * @static
11430 * @memberOf _
11431 * @since 0.1.0
11432 * @category Function
11433 * @param {Function} func The function to throttle.
11434 * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
11435 * @param {Object} [options={}] The options object.
11436 * @param {boolean} [options.leading=true]
11437 * Specify invoking on the leading edge of the timeout.
11438 * @param {boolean} [options.trailing=true]
11439 * Specify invoking on the trailing edge of the timeout.
11440 * @returns {Function} Returns the new throttled function.
11441 * @example
11442 *
11443 * // Avoid excessively updating the position while scrolling.
11444 * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
11445 *
11446 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
11447 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
11448 * jQuery(element).on('click', throttled);
11449 *
11450 * // Cancel the trailing throttled invocation.
11451 * jQuery(window).on('popstate', throttled.cancel);
11452 */
11453 function throttle(func, wait, options) {
11454 var leading = true;
11455 var trailing = true;
11456 if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
11457 if (isObject(options)) {
11458 leading = "leading" in options ? !!options.leading : leading;
11459 trailing = "trailing" in options ? !!options.trailing : trailing;
11460 }
11461 return debounce(func, wait, {
11462 "leading": leading,
11463 "maxWait": wait,
11464 "trailing": trailing
11465 });
11466 }
11467 /**
11468 * Creates a function that accepts up to one argument, ignoring any
11469 * additional arguments.
11470 *
11471 * @static
11472 * @memberOf _
11473 * @since 4.0.0
11474 * @category Function
11475 * @param {Function} func The function to cap arguments for.
11476 * @returns {Function} Returns the new capped function.
11477 * @example
11478 *
11479 * _.map(['6', '8', '10'], _.unary(parseInt));
11480 * // => [6, 8, 10]
11481 */
11482 function unary(func) {
11483 return ary(func, 1);
11484 }
11485 /**
11486 * Creates a function that provides `value` to `wrapper` as its first
11487 * argument. Any additional arguments provided to the function are appended
11488 * to those provided to the `wrapper`. The wrapper is invoked with the `this`
11489 * binding of the created function.
11490 *
11491 * @static
11492 * @memberOf _
11493 * @since 0.1.0
11494 * @category Function
11495 * @param {*} value The value to wrap.
11496 * @param {Function} [wrapper=identity] The wrapper function.
11497 * @returns {Function} Returns the new function.
11498 * @example
11499 *
11500 * var p = _.wrap(_.escape, function(func, text) {
11501 * return '<p>' + func(text) + '</p>';
11502 * });
11503 *
11504 * p('fred, barney, & pebbles');
11505 * // => '<p>fred, barney, &amp; pebbles</p>'
11506 */
11507 function wrap(value, wrapper) {
11508 return partial(castFunction(wrapper), value);
11509 }
11510 /**
11511 * Casts `value` as an array if it's not one.
11512 *
11513 * @static
11514 * @memberOf _
11515 * @since 4.4.0
11516 * @category Lang
11517 * @param {*} value The value to inspect.
11518 * @returns {Array} Returns the cast array.
11519 * @example
11520 *
11521 * _.castArray(1);
11522 * // => [1]
11523 *
11524 * _.castArray({ 'a': 1 });
11525 * // => [{ 'a': 1 }]
11526 *
11527 * _.castArray('abc');
11528 * // => ['abc']
11529 *
11530 * _.castArray(null);
11531 * // => [null]
11532 *
11533 * _.castArray(undefined);
11534 * // => [undefined]
11535 *
11536 * _.castArray();
11537 * // => []
11538 *
11539 * var array = [1, 2, 3];
11540 * console.log(_.castArray(array) === array);
11541 * // => true
11542 */
11543 function castArray() {
11544 if (!arguments.length) return [];
11545 var value = arguments[0];
11546 return isArray(value) ? value : [value];
11547 }
11548 /**
11549 * Creates a shallow clone of `value`.
11550 *
11551 * **Note:** This method is loosely based on the
11552 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
11553 * and supports cloning arrays, array buffers, booleans, date objects, maps,
11554 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
11555 * arrays. The own enumerable properties of `arguments` objects are cloned
11556 * as plain objects. An empty object is returned for uncloneable values such
11557 * as error objects, functions, DOM nodes, and WeakMaps.
11558 *
11559 * @static
11560 * @memberOf _
11561 * @since 0.1.0
11562 * @category Lang
11563 * @param {*} value The value to clone.
11564 * @returns {*} Returns the cloned value.
11565 * @see _.cloneDeep
11566 * @example
11567 *
11568 * var objects = [{ 'a': 1 }, { 'b': 2 }];
11569 *
11570 * var shallow = _.clone(objects);
11571 * console.log(shallow[0] === objects[0]);
11572 * // => true
11573 */
11574 function clone(value) {
11575 return baseClone(value, CLONE_SYMBOLS_FLAG);
11576 }
11577 /**
11578 * This method is like `_.clone` except that it accepts `customizer` which
11579 * is invoked to produce the cloned value. If `customizer` returns `undefined`,
11580 * cloning is handled by the method instead. The `customizer` is invoked with
11581 * up to four arguments; (value [, index|key, object, stack]).
11582 *
11583 * @static
11584 * @memberOf _
11585 * @since 4.0.0
11586 * @category Lang
11587 * @param {*} value The value to clone.
11588 * @param {Function} [customizer] The function to customize cloning.
11589 * @returns {*} Returns the cloned value.
11590 * @see _.cloneDeepWith
11591 * @example
11592 *
11593 * function customizer(value) {
11594 * if (_.isElement(value)) {
11595 * return value.cloneNode(false);
11596 * }
11597 * }
11598 *
11599 * var el = _.cloneWith(document.body, customizer);
11600 *
11601 * console.log(el === document.body);
11602 * // => false
11603 * console.log(el.nodeName);
11604 * // => 'BODY'
11605 * console.log(el.childNodes.length);
11606 * // => 0
11607 */
11608 function cloneWith(value, customizer) {
11609 customizer = typeof customizer == "function" ? customizer : undefined;
11610 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
11611 }
11612 /**
11613 * This method is like `_.clone` except that it recursively clones `value`.
11614 *
11615 * @static
11616 * @memberOf _
11617 * @since 1.0.0
11618 * @category Lang
11619 * @param {*} value The value to recursively clone.
11620 * @returns {*} Returns the deep cloned value.
11621 * @see _.clone
11622 * @example
11623 *
11624 * var objects = [{ 'a': 1 }, { 'b': 2 }];
11625 *
11626 * var deep = _.cloneDeep(objects);
11627 * console.log(deep[0] === objects[0]);
11628 * // => false
11629 */
11630 function cloneDeep(value) {
11631 return baseClone(value, 5);
11632 }
11633 /**
11634 * This method is like `_.cloneWith` except that it recursively clones `value`.
11635 *
11636 * @static
11637 * @memberOf _
11638 * @since 4.0.0
11639 * @category Lang
11640 * @param {*} value The value to recursively clone.
11641 * @param {Function} [customizer] The function to customize cloning.
11642 * @returns {*} Returns the deep cloned value.
11643 * @see _.cloneWith
11644 * @example
11645 *
11646 * function customizer(value) {
11647 * if (_.isElement(value)) {
11648 * return value.cloneNode(true);
11649 * }
11650 * }
11651 *
11652 * var el = _.cloneDeepWith(document.body, customizer);
11653 *
11654 * console.log(el === document.body);
11655 * // => false
11656 * console.log(el.nodeName);
11657 * // => 'BODY'
11658 * console.log(el.childNodes.length);
11659 * // => 20
11660 */
11661 function cloneDeepWith(value, customizer) {
11662 customizer = typeof customizer == "function" ? customizer : undefined;
11663 return baseClone(value, 5, customizer);
11664 }
11665 /**
11666 * Checks if `object` conforms to `source` by invoking the predicate
11667 * properties of `source` with the corresponding property values of `object`.
11668 *
11669 * **Note:** This method is equivalent to `_.conforms` when `source` is
11670 * partially applied.
11671 *
11672 * @static
11673 * @memberOf _
11674 * @since 4.14.0
11675 * @category Lang
11676 * @param {Object} object The object to inspect.
11677 * @param {Object} source The object of property predicates to conform to.
11678 * @returns {boolean} Returns `true` if `object` conforms, else `false`.
11679 * @example
11680 *
11681 * var object = { 'a': 1, 'b': 2 };
11682 *
11683 * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
11684 * // => true
11685 *
11686 * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
11687 * // => false
11688 */
11689 function conformsTo(object, source) {
11690 return source == null || baseConformsTo(object, source, keys(source));
11691 }
11692 /**
11693 * Performs a
11694 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
11695 * comparison between two values to determine if they are equivalent.
11696 *
11697 * @static
11698 * @memberOf _
11699 * @since 4.0.0
11700 * @category Lang
11701 * @param {*} value The value to compare.
11702 * @param {*} other The other value to compare.
11703 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
11704 * @example
11705 *
11706 * var object = { 'a': 1 };
11707 * var other = { 'a': 1 };
11708 *
11709 * _.eq(object, object);
11710 * // => true
11711 *
11712 * _.eq(object, other);
11713 * // => false
11714 *
11715 * _.eq('a', 'a');
11716 * // => true
11717 *
11718 * _.eq('a', Object('a'));
11719 * // => false
11720 *
11721 * _.eq(NaN, NaN);
11722 * // => true
11723 */
11724 function eq(value, other) {
11725 return value === other || value !== value && other !== other;
11726 }
11727 /**
11728 * Checks if `value` is greater than `other`.
11729 *
11730 * @static
11731 * @memberOf _
11732 * @since 3.9.0
11733 * @category Lang
11734 * @param {*} value The value to compare.
11735 * @param {*} other The other value to compare.
11736 * @returns {boolean} Returns `true` if `value` is greater than `other`,
11737 * else `false`.
11738 * @see _.lt
11739 * @example
11740 *
11741 * _.gt(3, 1);
11742 * // => true
11743 *
11744 * _.gt(3, 3);
11745 * // => false
11746 *
11747 * _.gt(1, 3);
11748 * // => false
11749 */
11750 var gt = createRelationalOperation(baseGt);
11751 /**
11752 * Checks if `value` is greater than or equal to `other`.
11753 *
11754 * @static
11755 * @memberOf _
11756 * @since 3.9.0
11757 * @category Lang
11758 * @param {*} value The value to compare.
11759 * @param {*} other The other value to compare.
11760 * @returns {boolean} Returns `true` if `value` is greater than or equal to
11761 * `other`, else `false`.
11762 * @see _.lte
11763 * @example
11764 *
11765 * _.gte(3, 1);
11766 * // => true
11767 *
11768 * _.gte(3, 3);
11769 * // => true
11770 *
11771 * _.gte(1, 3);
11772 * // => false
11773 */
11774 var gte = createRelationalOperation(function(value, other) {
11775 return value >= other;
11776 });
11777 /**
11778 * Checks if `value` is likely an `arguments` object.
11779 *
11780 * @static
11781 * @memberOf _
11782 * @since 0.1.0
11783 * @category Lang
11784 * @param {*} value The value to check.
11785 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
11786 * else `false`.
11787 * @example
11788 *
11789 * _.isArguments(function() { return arguments; }());
11790 * // => true
11791 *
11792 * _.isArguments([1, 2, 3]);
11793 * // => false
11794 */
11795 var isArguments = baseIsArguments(function() {
11796 return arguments;
11797 }()) ? baseIsArguments : function(value) {
11798 return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
11799 };
11800 /**
11801 * Checks if `value` is classified as an `Array` object.
11802 *
11803 * @static
11804 * @memberOf _
11805 * @since 0.1.0
11806 * @category Lang
11807 * @param {*} value The value to check.
11808 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
11809 * @example
11810 *
11811 * _.isArray([1, 2, 3]);
11812 * // => true
11813 *
11814 * _.isArray(document.body.children);
11815 * // => false
11816 *
11817 * _.isArray('abc');
11818 * // => false
11819 *
11820 * _.isArray(_.noop);
11821 * // => false
11822 */
11823 var isArray = Array.isArray;
11824 /**
11825 * Checks if `value` is classified as an `ArrayBuffer` object.
11826 *
11827 * @static
11828 * @memberOf _
11829 * @since 4.3.0
11830 * @category Lang
11831 * @param {*} value The value to check.
11832 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
11833 * @example
11834 *
11835 * _.isArrayBuffer(new ArrayBuffer(2));
11836 * // => true
11837 *
11838 * _.isArrayBuffer(new Array(2));
11839 * // => false
11840 */
11841 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
11842 /**
11843 * Checks if `value` is array-like. A value is considered array-like if it's
11844 * not a function and has a `value.length` that's an integer greater than or
11845 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
11846 *
11847 * @static
11848 * @memberOf _
11849 * @since 4.0.0
11850 * @category Lang
11851 * @param {*} value The value to check.
11852 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
11853 * @example
11854 *
11855 * _.isArrayLike([1, 2, 3]);
11856 * // => true
11857 *
11858 * _.isArrayLike(document.body.children);
11859 * // => true
11860 *
11861 * _.isArrayLike('abc');
11862 * // => true
11863 *
11864 * _.isArrayLike(_.noop);
11865 * // => false
11866 */
11867 function isArrayLike(value) {
11868 return value != null && isLength(value.length) && !isFunction(value);
11869 }
11870 /**
11871 * This method is like `_.isArrayLike` except that it also checks if `value`
11872 * is an object.
11873 *
11874 * @static
11875 * @memberOf _
11876 * @since 4.0.0
11877 * @category Lang
11878 * @param {*} value The value to check.
11879 * @returns {boolean} Returns `true` if `value` is an array-like object,
11880 * else `false`.
11881 * @example
11882 *
11883 * _.isArrayLikeObject([1, 2, 3]);
11884 * // => true
11885 *
11886 * _.isArrayLikeObject(document.body.children);
11887 * // => true
11888 *
11889 * _.isArrayLikeObject('abc');
11890 * // => false
11891 *
11892 * _.isArrayLikeObject(_.noop);
11893 * // => false
11894 */
11895 function isArrayLikeObject(value) {
11896 return isObjectLike(value) && isArrayLike(value);
11897 }
11898 /**
11899 * Checks if `value` is classified as a boolean primitive or object.
11900 *
11901 * @static
11902 * @memberOf _
11903 * @since 0.1.0
11904 * @category Lang
11905 * @param {*} value The value to check.
11906 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
11907 * @example
11908 *
11909 * _.isBoolean(false);
11910 * // => true
11911 *
11912 * _.isBoolean(null);
11913 * // => false
11914 */
11915 function isBoolean(value) {
11916 return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
11917 }
11918 /**
11919 * Checks if `value` is a buffer.
11920 *
11921 * @static
11922 * @memberOf _
11923 * @since 4.3.0
11924 * @category Lang
11925 * @param {*} value The value to check.
11926 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
11927 * @example
11928 *
11929 * _.isBuffer(new Buffer(2));
11930 * // => true
11931 *
11932 * _.isBuffer(new Uint8Array(2));
11933 * // => false
11934 */
11935 var isBuffer = nativeIsBuffer || stubFalse;
11936 /**
11937 * Checks if `value` is classified as a `Date` object.
11938 *
11939 * @static
11940 * @memberOf _
11941 * @since 0.1.0
11942 * @category Lang
11943 * @param {*} value The value to check.
11944 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
11945 * @example
11946 *
11947 * _.isDate(new Date);
11948 * // => true
11949 *
11950 * _.isDate('Mon April 23 2012');
11951 * // => false
11952 */
11953 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
11954 /**
11955 * Checks if `value` is likely a DOM element.
11956 *
11957 * @static
11958 * @memberOf _
11959 * @since 0.1.0
11960 * @category Lang
11961 * @param {*} value The value to check.
11962 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
11963 * @example
11964 *
11965 * _.isElement(document.body);
11966 * // => true
11967 *
11968 * _.isElement('<body>');
11969 * // => false
11970 */
11971 function isElement(value) {
11972 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
11973 }
11974 /**
11975 * Checks if `value` is an empty object, collection, map, or set.
11976 *
11977 * Objects are considered empty if they have no own enumerable string keyed
11978 * properties.
11979 *
11980 * Array-like values such as `arguments` objects, arrays, buffers, strings, or
11981 * jQuery-like collections are considered empty if they have a `length` of `0`.
11982 * Similarly, maps and sets are considered empty if they have a `size` of `0`.
11983 *
11984 * @static
11985 * @memberOf _
11986 * @since 0.1.0
11987 * @category Lang
11988 * @param {*} value The value to check.
11989 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
11990 * @example
11991 *
11992 * _.isEmpty(null);
11993 * // => true
11994 *
11995 * _.isEmpty(true);
11996 * // => true
11997 *
11998 * _.isEmpty(1);
11999 * // => true
12000 *
12001 * _.isEmpty([1, 2, 3]);
12002 * // => false
12003 *
12004 * _.isEmpty({ 'a': 1 });
12005 * // => false
12006 */
12007 function isEmpty(value) {
12008 if (value == null) return true;
12009 if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) return !value.length;
12010 var tag = getTag(value);
12011 if (tag == mapTag || tag == setTag) return !value.size;
12012 if (isPrototype(value)) return !baseKeys(value).length;
12013 for (var key in value) if (hasOwnProperty.call(value, key)) return false;
12014 return true;
12015 }
12016 /**
12017 * Performs a deep comparison between two values to determine if they are
12018 * equivalent.
12019 *
12020 * **Note:** This method supports comparing arrays, array buffers, booleans,
12021 * date objects, error objects, maps, numbers, `Object` objects, regexes,
12022 * sets, strings, symbols, and typed arrays. `Object` objects are compared
12023 * by their own, not inherited, enumerable properties. Functions and DOM
12024 * nodes are compared by strict equality, i.e. `===`.
12025 *
12026 * @static
12027 * @memberOf _
12028 * @since 0.1.0
12029 * @category Lang
12030 * @param {*} value The value to compare.
12031 * @param {*} other The other value to compare.
12032 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
12033 * @example
12034 *
12035 * var object = { 'a': 1 };
12036 * var other = { 'a': 1 };
12037 *
12038 * _.isEqual(object, other);
12039 * // => true
12040 *
12041 * object === other;
12042 * // => false
12043 */
12044 function isEqual(value, other) {
12045 return baseIsEqual(value, other);
12046 }
12047 /**
12048 * This method is like `_.isEqual` except that it accepts `customizer` which
12049 * is invoked to compare values. If `customizer` returns `undefined`, comparisons
12050 * are handled by the method instead. The `customizer` is invoked with up to
12051 * six arguments: (objValue, othValue [, index|key, object, other, stack]).
12052 *
12053 * @static
12054 * @memberOf _
12055 * @since 4.0.0
12056 * @category Lang
12057 * @param {*} value The value to compare.
12058 * @param {*} other The other value to compare.
12059 * @param {Function} [customizer] The function to customize comparisons.
12060 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
12061 * @example
12062 *
12063 * function isGreeting(value) {
12064 * return /^h(?:i|ello)$/.test(value);
12065 * }
12066 *
12067 * function customizer(objValue, othValue) {
12068 * if (isGreeting(objValue) && isGreeting(othValue)) {
12069 * return true;
12070 * }
12071 * }
12072 *
12073 * var array = ['hello', 'goodbye'];
12074 * var other = ['hi', 'goodbye'];
12075 *
12076 * _.isEqualWith(array, other, customizer);
12077 * // => true
12078 */
12079 function isEqualWith(value, other, customizer) {
12080 customizer = typeof customizer == "function" ? customizer : undefined;
12081 var result = customizer ? customizer(value, other) : undefined;
12082 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
12083 }
12084 /**
12085 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
12086 * `SyntaxError`, `TypeError`, or `URIError` object.
12087 *
12088 * @static
12089 * @memberOf _
12090 * @since 3.0.0
12091 * @category Lang
12092 * @param {*} value The value to check.
12093 * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
12094 * @example
12095 *
12096 * _.isError(new Error);
12097 * // => true
12098 *
12099 * _.isError(Error);
12100 * // => false
12101 */
12102 function isError(value) {
12103 if (!isObjectLike(value)) return false;
12104 var tag = baseGetTag(value);
12105 return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
12106 }
12107 /**
12108 * Checks if `value` is a finite primitive number.
12109 *
12110 * **Note:** This method is based on
12111 * [`Number.isFinite`](https://mdn.io/Number/isFinite).
12112 *
12113 * @static
12114 * @memberOf _
12115 * @since 0.1.0
12116 * @category Lang
12117 * @param {*} value The value to check.
12118 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
12119 * @example
12120 *
12121 * _.isFinite(3);
12122 * // => true
12123 *
12124 * _.isFinite(Number.MIN_VALUE);
12125 * // => true
12126 *
12127 * _.isFinite(Infinity);
12128 * // => false
12129 *
12130 * _.isFinite('3');
12131 * // => false
12132 */
12133 function isFinite(value) {
12134 return typeof value == "number" && nativeIsFinite(value);
12135 }
12136 /**
12137 * Checks if `value` is classified as a `Function` object.
12138 *
12139 * @static
12140 * @memberOf _
12141 * @since 0.1.0
12142 * @category Lang
12143 * @param {*} value The value to check.
12144 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
12145 * @example
12146 *
12147 * _.isFunction(_);
12148 * // => true
12149 *
12150 * _.isFunction(/abc/);
12151 * // => false
12152 */
12153 function isFunction(value) {
12154 if (!isObject(value)) return false;
12155 var tag = baseGetTag(value);
12156 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
12157 }
12158 /**
12159 * Checks if `value` is an integer.
12160 *
12161 * **Note:** This method is based on
12162 * [`Number.isInteger`](https://mdn.io/Number/isInteger).
12163 *
12164 * @static
12165 * @memberOf _
12166 * @since 4.0.0
12167 * @category Lang
12168 * @param {*} value The value to check.
12169 * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
12170 * @example
12171 *
12172 * _.isInteger(3);
12173 * // => true
12174 *
12175 * _.isInteger(Number.MIN_VALUE);
12176 * // => false
12177 *
12178 * _.isInteger(Infinity);
12179 * // => false
12180 *
12181 * _.isInteger('3');
12182 * // => false
12183 */
12184 function isInteger(value) {
12185 return typeof value == "number" && value == toInteger(value);
12186 }
12187 /**
12188 * Checks if `value` is a valid array-like length.
12189 *
12190 * **Note:** This method is loosely based on
12191 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
12192 *
12193 * @static
12194 * @memberOf _
12195 * @since 4.0.0
12196 * @category Lang
12197 * @param {*} value The value to check.
12198 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
12199 * @example
12200 *
12201 * _.isLength(3);
12202 * // => true
12203 *
12204 * _.isLength(Number.MIN_VALUE);
12205 * // => false
12206 *
12207 * _.isLength(Infinity);
12208 * // => false
12209 *
12210 * _.isLength('3');
12211 * // => false
12212 */
12213 function isLength(value) {
12214 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
12215 }
12216 /**
12217 * Checks if `value` is the
12218 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
12219 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
12220 *
12221 * @static
12222 * @memberOf _
12223 * @since 0.1.0
12224 * @category Lang
12225 * @param {*} value The value to check.
12226 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
12227 * @example
12228 *
12229 * _.isObject({});
12230 * // => true
12231 *
12232 * _.isObject([1, 2, 3]);
12233 * // => true
12234 *
12235 * _.isObject(_.noop);
12236 * // => true
12237 *
12238 * _.isObject(null);
12239 * // => false
12240 */
12241 function isObject(value) {
12242 var type = typeof value;
12243 return value != null && (type == "object" || type == "function");
12244 }
12245 /**
12246 * Checks if `value` is object-like. A value is object-like if it's not `null`
12247 * and has a `typeof` result of "object".
12248 *
12249 * @static
12250 * @memberOf _
12251 * @since 4.0.0
12252 * @category Lang
12253 * @param {*} value The value to check.
12254 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
12255 * @example
12256 *
12257 * _.isObjectLike({});
12258 * // => true
12259 *
12260 * _.isObjectLike([1, 2, 3]);
12261 * // => true
12262 *
12263 * _.isObjectLike(_.noop);
12264 * // => false
12265 *
12266 * _.isObjectLike(null);
12267 * // => false
12268 */
12269 function isObjectLike(value) {
12270 return value != null && typeof value == "object";
12271 }
12272 /**
12273 * Checks if `value` is classified as a `Map` object.
12274 *
12275 * @static
12276 * @memberOf _
12277 * @since 4.3.0
12278 * @category Lang
12279 * @param {*} value The value to check.
12280 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
12281 * @example
12282 *
12283 * _.isMap(new Map);
12284 * // => true
12285 *
12286 * _.isMap(new WeakMap);
12287 * // => false
12288 */
12289 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
12290 /**
12291 * Performs a partial deep comparison between `object` and `source` to
12292 * determine if `object` contains equivalent property values.
12293 *
12294 * **Note:** This method is equivalent to `_.matches` when `source` is
12295 * partially applied.
12296 *
12297 * Partial comparisons will match empty array and empty object `source`
12298 * values against any array or object value, respectively. See `_.isEqual`
12299 * for a list of supported value comparisons.
12300 *
12301 * @static
12302 * @memberOf _
12303 * @since 3.0.0
12304 * @category Lang
12305 * @param {Object} object The object to inspect.
12306 * @param {Object} source The object of property values to match.
12307 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
12308 * @example
12309 *
12310 * var object = { 'a': 1, 'b': 2 };
12311 *
12312 * _.isMatch(object, { 'b': 2 });
12313 * // => true
12314 *
12315 * _.isMatch(object, { 'b': 1 });
12316 * // => false
12317 */
12318 function isMatch(object, source) {
12319 return object === source || baseIsMatch(object, source, getMatchData(source));
12320 }
12321 /**
12322 * This method is like `_.isMatch` except that it accepts `customizer` which
12323 * is invoked to compare values. If `customizer` returns `undefined`, comparisons
12324 * are handled by the method instead. The `customizer` is invoked with five
12325 * arguments: (objValue, srcValue, index|key, object, source).
12326 *
12327 * @static
12328 * @memberOf _
12329 * @since 4.0.0
12330 * @category Lang
12331 * @param {Object} object The object to inspect.
12332 * @param {Object} source The object of property values to match.
12333 * @param {Function} [customizer] The function to customize comparisons.
12334 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
12335 * @example
12336 *
12337 * function isGreeting(value) {
12338 * return /^h(?:i|ello)$/.test(value);
12339 * }
12340 *
12341 * function customizer(objValue, srcValue) {
12342 * if (isGreeting(objValue) && isGreeting(srcValue)) {
12343 * return true;
12344 * }
12345 * }
12346 *
12347 * var object = { 'greeting': 'hello' };
12348 * var source = { 'greeting': 'hi' };
12349 *
12350 * _.isMatchWith(object, source, customizer);
12351 * // => true
12352 */
12353 function isMatchWith(object, source, customizer) {
12354 customizer = typeof customizer == "function" ? customizer : undefined;
12355 return baseIsMatch(object, source, getMatchData(source), customizer);
12356 }
12357 /**
12358 * Checks if `value` is `NaN`.
12359 *
12360 * **Note:** This method is based on
12361 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
12362 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
12363 * `undefined` and other non-number values.
12364 *
12365 * @static
12366 * @memberOf _
12367 * @since 0.1.0
12368 * @category Lang
12369 * @param {*} value The value to check.
12370 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
12371 * @example
12372 *
12373 * _.isNaN(NaN);
12374 * // => true
12375 *
12376 * _.isNaN(new Number(NaN));
12377 * // => true
12378 *
12379 * isNaN(undefined);
12380 * // => true
12381 *
12382 * _.isNaN(undefined);
12383 * // => false
12384 */
12385 function isNaN(value) {
12386 return isNumber(value) && value != +value;
12387 }
12388 /**
12389 * Checks if `value` is a pristine native function.
12390 *
12391 * **Note:** This method can't reliably detect native functions in the presence
12392 * of the core-js package because core-js circumvents this kind of detection.
12393 * Despite multiple requests, the core-js maintainer has made it clear: any
12394 * attempt to fix the detection will be obstructed. As a result, we're left
12395 * with little choice but to throw an error. Unfortunately, this also affects
12396 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
12397 * which rely on core-js.
12398 *
12399 * @static
12400 * @memberOf _
12401 * @since 3.0.0
12402 * @category Lang
12403 * @param {*} value The value to check.
12404 * @returns {boolean} Returns `true` if `value` is a native function,
12405 * else `false`.
12406 * @example
12407 *
12408 * _.isNative(Array.prototype.push);
12409 * // => true
12410 *
12411 * _.isNative(_);
12412 * // => false
12413 */
12414 function isNative(value) {
12415 if (isMaskable(value)) throw new Error(CORE_ERROR_TEXT);
12416 return baseIsNative(value);
12417 }
12418 /**
12419 * Checks if `value` is `null`.
12420 *
12421 * @static
12422 * @memberOf _
12423 * @since 0.1.0
12424 * @category Lang
12425 * @param {*} value The value to check.
12426 * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
12427 * @example
12428 *
12429 * _.isNull(null);
12430 * // => true
12431 *
12432 * _.isNull(void 0);
12433 * // => false
12434 */
12435 function isNull(value) {
12436 return value === null;
12437 }
12438 /**
12439 * Checks if `value` is `null` or `undefined`.
12440 *
12441 * @static
12442 * @memberOf _
12443 * @since 4.0.0
12444 * @category Lang
12445 * @param {*} value The value to check.
12446 * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
12447 * @example
12448 *
12449 * _.isNil(null);
12450 * // => true
12451 *
12452 * _.isNil(void 0);
12453 * // => true
12454 *
12455 * _.isNil(NaN);
12456 * // => false
12457 */
12458 function isNil(value) {
12459 return value == null;
12460 }
12461 /**
12462 * Checks if `value` is classified as a `Number` primitive or object.
12463 *
12464 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
12465 * classified as numbers, use the `_.isFinite` method.
12466 *
12467 * @static
12468 * @memberOf _
12469 * @since 0.1.0
12470 * @category Lang
12471 * @param {*} value The value to check.
12472 * @returns {boolean} Returns `true` if `value` is a number, else `false`.
12473 * @example
12474 *
12475 * _.isNumber(3);
12476 * // => true
12477 *
12478 * _.isNumber(Number.MIN_VALUE);
12479 * // => true
12480 *
12481 * _.isNumber(Infinity);
12482 * // => true
12483 *
12484 * _.isNumber('3');
12485 * // => false
12486 */
12487 function isNumber(value) {
12488 return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
12489 }
12490 /**
12491 * Checks if `value` is a plain object, that is, an object created by the
12492 * `Object` constructor or one with a `[[Prototype]]` of `null`.
12493 *
12494 * @static
12495 * @memberOf _
12496 * @since 0.8.0
12497 * @category Lang
12498 * @param {*} value The value to check.
12499 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
12500 * @example
12501 *
12502 * function Foo() {
12503 * this.a = 1;
12504 * }
12505 *
12506 * _.isPlainObject(new Foo);
12507 * // => false
12508 *
12509 * _.isPlainObject([1, 2, 3]);
12510 * // => false
12511 *
12512 * _.isPlainObject({ 'x': 0, 'y': 0 });
12513 * // => true
12514 *
12515 * _.isPlainObject(Object.create(null));
12516 * // => true
12517 */
12518 function isPlainObject(value) {
12519 if (!isObjectLike(value) || baseGetTag(value) != objectTag) return false;
12520 var proto = getPrototype(value);
12521 if (proto === null) return true;
12522 var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
12523 return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
12524 }
12525 /**
12526 * Checks if `value` is classified as a `RegExp` object.
12527 *
12528 * @static
12529 * @memberOf _
12530 * @since 0.1.0
12531 * @category Lang
12532 * @param {*} value The value to check.
12533 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
12534 * @example
12535 *
12536 * _.isRegExp(/abc/);
12537 * // => true
12538 *
12539 * _.isRegExp('/abc/');
12540 * // => false
12541 */
12542 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
12543 /**
12544 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
12545 * double precision number which isn't the result of a rounded unsafe integer.
12546 *
12547 * **Note:** This method is based on
12548 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
12549 *
12550 * @static
12551 * @memberOf _
12552 * @since 4.0.0
12553 * @category Lang
12554 * @param {*} value The value to check.
12555 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
12556 * @example
12557 *
12558 * _.isSafeInteger(3);
12559 * // => true
12560 *
12561 * _.isSafeInteger(Number.MIN_VALUE);
12562 * // => false
12563 *
12564 * _.isSafeInteger(Infinity);
12565 * // => false
12566 *
12567 * _.isSafeInteger('3');
12568 * // => false
12569 */
12570 function isSafeInteger(value) {
12571 return isInteger(value) && value >= -9007199254740991 && value <= MAX_SAFE_INTEGER;
12572 }
12573 /**
12574 * Checks if `value` is classified as a `Set` object.
12575 *
12576 * @static
12577 * @memberOf _
12578 * @since 4.3.0
12579 * @category Lang
12580 * @param {*} value The value to check.
12581 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
12582 * @example
12583 *
12584 * _.isSet(new Set);
12585 * // => true
12586 *
12587 * _.isSet(new WeakSet);
12588 * // => false
12589 */
12590 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
12591 /**
12592 * Checks if `value` is classified as a `String` primitive or object.
12593 *
12594 * @static
12595 * @since 0.1.0
12596 * @memberOf _
12597 * @category Lang
12598 * @param {*} value The value to check.
12599 * @returns {boolean} Returns `true` if `value` is a string, else `false`.
12600 * @example
12601 *
12602 * _.isString('abc');
12603 * // => true
12604 *
12605 * _.isString(1);
12606 * // => false
12607 */
12608 function isString(value) {
12609 return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
12610 }
12611 /**
12612 * Checks if `value` is classified as a `Symbol` primitive or object.
12613 *
12614 * @static
12615 * @memberOf _
12616 * @since 4.0.0
12617 * @category Lang
12618 * @param {*} value The value to check.
12619 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
12620 * @example
12621 *
12622 * _.isSymbol(Symbol.iterator);
12623 * // => true
12624 *
12625 * _.isSymbol('abc');
12626 * // => false
12627 */
12628 function isSymbol(value) {
12629 return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
12630 }
12631 /**
12632 * Checks if `value` is classified as a typed array.
12633 *
12634 * @static
12635 * @memberOf _
12636 * @since 3.0.0
12637 * @category Lang
12638 * @param {*} value The value to check.
12639 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
12640 * @example
12641 *
12642 * _.isTypedArray(new Uint8Array);
12643 * // => true
12644 *
12645 * _.isTypedArray([]);
12646 * // => false
12647 */
12648 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
12649 /**
12650 * Checks if `value` is `undefined`.
12651 *
12652 * @static
12653 * @since 0.1.0
12654 * @memberOf _
12655 * @category Lang
12656 * @param {*} value The value to check.
12657 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
12658 * @example
12659 *
12660 * _.isUndefined(void 0);
12661 * // => true
12662 *
12663 * _.isUndefined(null);
12664 * // => false
12665 */
12666 function isUndefined(value) {
12667 return value === undefined;
12668 }
12669 /**
12670 * Checks if `value` is classified as a `WeakMap` object.
12671 *
12672 * @static
12673 * @memberOf _
12674 * @since 4.3.0
12675 * @category Lang
12676 * @param {*} value The value to check.
12677 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
12678 * @example
12679 *
12680 * _.isWeakMap(new WeakMap);
12681 * // => true
12682 *
12683 * _.isWeakMap(new Map);
12684 * // => false
12685 */
12686 function isWeakMap(value) {
12687 return isObjectLike(value) && getTag(value) == weakMapTag;
12688 }
12689 /**
12690 * Checks if `value` is classified as a `WeakSet` object.
12691 *
12692 * @static
12693 * @memberOf _
12694 * @since 4.3.0
12695 * @category Lang
12696 * @param {*} value The value to check.
12697 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
12698 * @example
12699 *
12700 * _.isWeakSet(new WeakSet);
12701 * // => true
12702 *
12703 * _.isWeakSet(new Set);
12704 * // => false
12705 */
12706 function isWeakSet(value) {
12707 return isObjectLike(value) && baseGetTag(value) == weakSetTag;
12708 }
12709 /**
12710 * Checks if `value` is less than `other`.
12711 *
12712 * @static
12713 * @memberOf _
12714 * @since 3.9.0
12715 * @category Lang
12716 * @param {*} value The value to compare.
12717 * @param {*} other The other value to compare.
12718 * @returns {boolean} Returns `true` if `value` is less than `other`,
12719 * else `false`.
12720 * @see _.gt
12721 * @example
12722 *
12723 * _.lt(1, 3);
12724 * // => true
12725 *
12726 * _.lt(3, 3);
12727 * // => false
12728 *
12729 * _.lt(3, 1);
12730 * // => false
12731 */
12732 var lt = createRelationalOperation(baseLt);
12733 /**
12734 * Checks if `value` is less than or equal to `other`.
12735 *
12736 * @static
12737 * @memberOf _
12738 * @since 3.9.0
12739 * @category Lang
12740 * @param {*} value The value to compare.
12741 * @param {*} other The other value to compare.
12742 * @returns {boolean} Returns `true` if `value` is less than or equal to
12743 * `other`, else `false`.
12744 * @see _.gte
12745 * @example
12746 *
12747 * _.lte(1, 3);
12748 * // => true
12749 *
12750 * _.lte(3, 3);
12751 * // => true
12752 *
12753 * _.lte(3, 1);
12754 * // => false
12755 */
12756 var lte = createRelationalOperation(function(value, other) {
12757 return value <= other;
12758 });
12759 /**
12760 * Converts `value` to an array.
12761 *
12762 * @static
12763 * @since 0.1.0
12764 * @memberOf _
12765 * @category Lang
12766 * @param {*} value The value to convert.
12767 * @returns {Array} Returns the converted array.
12768 * @example
12769 *
12770 * _.toArray({ 'a': 1, 'b': 2 });
12771 * // => [1, 2]
12772 *
12773 * _.toArray('abc');
12774 * // => ['a', 'b', 'c']
12775 *
12776 * _.toArray(1);
12777 * // => []
12778 *
12779 * _.toArray(null);
12780 * // => []
12781 */
12782 function toArray(value) {
12783 if (!value) return [];
12784 if (isArrayLike(value)) return isString(value) ? stringToArray(value) : copyArray(value);
12785 if (symIterator && value[symIterator]) return iteratorToArray(value[symIterator]());
12786 var tag = getTag(value);
12787 return (tag == mapTag ? mapToArray : tag == setTag ? setToArray : values)(value);
12788 }
12789 /**
12790 * Converts `value` to a finite number.
12791 *
12792 * @static
12793 * @memberOf _
12794 * @since 4.12.0
12795 * @category Lang
12796 * @param {*} value The value to convert.
12797 * @returns {number} Returns the converted number.
12798 * @example
12799 *
12800 * _.toFinite(3.2);
12801 * // => 3.2
12802 *
12803 * _.toFinite(Number.MIN_VALUE);
12804 * // => 5e-324
12805 *
12806 * _.toFinite(Infinity);
12807 * // => 1.7976931348623157e+308
12808 *
12809 * _.toFinite('3.2');
12810 * // => 3.2
12811 */
12812 function toFinite(value) {
12813 if (!value) return value === 0 ? value : 0;
12814 value = toNumber(value);
12815 if (value === INFINITY || value === -Infinity) return (value < 0 ? -1 : 1) * MAX_INTEGER;
12816 return value === value ? value : 0;
12817 }
12818 /**
12819 * Converts `value` to an integer.
12820 *
12821 * **Note:** This method is loosely based on
12822 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
12823 *
12824 * @static
12825 * @memberOf _
12826 * @since 4.0.0
12827 * @category Lang
12828 * @param {*} value The value to convert.
12829 * @returns {number} Returns the converted integer.
12830 * @example
12831 *
12832 * _.toInteger(3.2);
12833 * // => 3
12834 *
12835 * _.toInteger(Number.MIN_VALUE);
12836 * // => 0
12837 *
12838 * _.toInteger(Infinity);
12839 * // => 1.7976931348623157e+308
12840 *
12841 * _.toInteger('3.2');
12842 * // => 3
12843 */
12844 function toInteger(value) {
12845 var result = toFinite(value);
12846 var remainder = result % 1;
12847 return result === result ? remainder ? result - remainder : result : 0;
12848 }
12849 /**
12850 * Converts `value` to an integer suitable for use as the length of an
12851 * array-like object.
12852 *
12853 * **Note:** This method is based on
12854 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
12855 *
12856 * @static
12857 * @memberOf _
12858 * @since 4.0.0
12859 * @category Lang
12860 * @param {*} value The value to convert.
12861 * @returns {number} Returns the converted integer.
12862 * @example
12863 *
12864 * _.toLength(3.2);
12865 * // => 3
12866 *
12867 * _.toLength(Number.MIN_VALUE);
12868 * // => 0
12869 *
12870 * _.toLength(Infinity);
12871 * // => 4294967295
12872 *
12873 * _.toLength('3.2');
12874 * // => 3
12875 */
12876 function toLength(value) {
12877 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
12878 }
12879 /**
12880 * Converts `value` to a number.
12881 *
12882 * @static
12883 * @memberOf _
12884 * @since 4.0.0
12885 * @category Lang
12886 * @param {*} value The value to process.
12887 * @returns {number} Returns the number.
12888 * @example
12889 *
12890 * _.toNumber(3.2);
12891 * // => 3.2
12892 *
12893 * _.toNumber(Number.MIN_VALUE);
12894 * // => 5e-324
12895 *
12896 * _.toNumber(Infinity);
12897 * // => Infinity
12898 *
12899 * _.toNumber('3.2');
12900 * // => 3.2
12901 */
12902 function toNumber(value) {
12903 if (typeof value == "number") return value;
12904 if (isSymbol(value)) return NAN;
12905 if (isObject(value)) {
12906 var other = typeof value.valueOf == "function" ? value.valueOf() : value;
12907 value = isObject(other) ? other + "" : other;
12908 }
12909 if (typeof value != "string") return value === 0 ? value : +value;
12910 value = baseTrim(value);
12911 var isBinary = reIsBinary.test(value);
12912 return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
12913 }
12914 /**
12915 * Converts `value` to a plain object flattening inherited enumerable string
12916 * keyed properties of `value` to own properties of the plain object.
12917 *
12918 * @static
12919 * @memberOf _
12920 * @since 3.0.0
12921 * @category Lang
12922 * @param {*} value The value to convert.
12923 * @returns {Object} Returns the converted plain object.
12924 * @example
12925 *
12926 * function Foo() {
12927 * this.b = 2;
12928 * }
12929 *
12930 * Foo.prototype.c = 3;
12931 *
12932 * _.assign({ 'a': 1 }, new Foo);
12933 * // => { 'a': 1, 'b': 2 }
12934 *
12935 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
12936 * // => { 'a': 1, 'b': 2, 'c': 3 }
12937 */
12938 function toPlainObject(value) {
12939 return copyObject(value, keysIn(value));
12940 }
12941 /**
12942 * Converts `value` to a safe integer. A safe integer can be compared and
12943 * represented correctly.
12944 *
12945 * @static
12946 * @memberOf _
12947 * @since 4.0.0
12948 * @category Lang
12949 * @param {*} value The value to convert.
12950 * @returns {number} Returns the converted integer.
12951 * @example
12952 *
12953 * _.toSafeInteger(3.2);
12954 * // => 3
12955 *
12956 * _.toSafeInteger(Number.MIN_VALUE);
12957 * // => 0
12958 *
12959 * _.toSafeInteger(Infinity);
12960 * // => 9007199254740991
12961 *
12962 * _.toSafeInteger('3.2');
12963 * // => 3
12964 */
12965 function toSafeInteger(value) {
12966 return value ? baseClamp(toInteger(value), -9007199254740991, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
12967 }
12968 /**
12969 * Converts `value` to a string. An empty string is returned for `null`
12970 * and `undefined` values. The sign of `-0` is preserved.
12971 *
12972 * @static
12973 * @memberOf _
12974 * @since 4.0.0
12975 * @category Lang
12976 * @param {*} value The value to convert.
12977 * @returns {string} Returns the converted string.
12978 * @example
12979 *
12980 * _.toString(null);
12981 * // => ''
12982 *
12983 * _.toString(-0);
12984 * // => '-0'
12985 *
12986 * _.toString([1, 2, 3]);
12987 * // => '1,2,3'
12988 */
12989 function toString(value) {
12990 return value == null ? "" : baseToString(value);
12991 }
12992 /**
12993 * Assigns own enumerable string keyed properties of source objects to the
12994 * destination object. Source objects are applied from left to right.
12995 * Subsequent sources overwrite property assignments of previous sources.
12996 *
12997 * **Note:** This method mutates `object` and is loosely based on
12998 * [`Object.assign`](https://mdn.io/Object/assign).
12999 *
13000 * @static
13001 * @memberOf _
13002 * @since 0.10.0
13003 * @category Object
13004 * @param {Object} object The destination object.
13005 * @param {...Object} [sources] The source objects.
13006 * @returns {Object} Returns `object`.
13007 * @see _.assignIn
13008 * @example
13009 *
13010 * function Foo() {
13011 * this.a = 1;
13012 * }
13013 *
13014 * function Bar() {
13015 * this.c = 3;
13016 * }
13017 *
13018 * Foo.prototype.b = 2;
13019 * Bar.prototype.d = 4;
13020 *
13021 * _.assign({ 'a': 0 }, new Foo, new Bar);
13022 * // => { 'a': 1, 'c': 3 }
13023 */
13024 var assign = createAssigner(function(object, source) {
13025 if (isPrototype(source) || isArrayLike(source)) {
13026 copyObject(source, keys(source), object);
13027 return;
13028 }
13029 for (var key in source) if (hasOwnProperty.call(source, key)) assignValue(object, key, source[key]);
13030 });
13031 /**
13032 * This method is like `_.assign` except that it iterates over own and
13033 * inherited source properties.
13034 *
13035 * **Note:** This method mutates `object`.
13036 *
13037 * @static
13038 * @memberOf _
13039 * @since 4.0.0
13040 * @alias extend
13041 * @category Object
13042 * @param {Object} object The destination object.
13043 * @param {...Object} [sources] The source objects.
13044 * @returns {Object} Returns `object`.
13045 * @see _.assign
13046 * @example
13047 *
13048 * function Foo() {
13049 * this.a = 1;
13050 * }
13051 *
13052 * function Bar() {
13053 * this.c = 3;
13054 * }
13055 *
13056 * Foo.prototype.b = 2;
13057 * Bar.prototype.d = 4;
13058 *
13059 * _.assignIn({ 'a': 0 }, new Foo, new Bar);
13060 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
13061 */
13062 var assignIn = createAssigner(function(object, source) {
13063 copyObject(source, keysIn(source), object);
13064 });
13065 /**
13066 * This method is like `_.assignIn` except that it accepts `customizer`
13067 * which is invoked to produce the assigned values. If `customizer` returns
13068 * `undefined`, assignment is handled by the method instead. The `customizer`
13069 * is invoked with five arguments: (objValue, srcValue, key, object, source).
13070 *
13071 * **Note:** This method mutates `object`.
13072 *
13073 * @static
13074 * @memberOf _
13075 * @since 4.0.0
13076 * @alias extendWith
13077 * @category Object
13078 * @param {Object} object The destination object.
13079 * @param {...Object} sources The source objects.
13080 * @param {Function} [customizer] The function to customize assigned values.
13081 * @returns {Object} Returns `object`.
13082 * @see _.assignWith
13083 * @example
13084 *
13085 * function customizer(objValue, srcValue) {
13086 * return _.isUndefined(objValue) ? srcValue : objValue;
13087 * }
13088 *
13089 * var defaults = _.partialRight(_.assignInWith, customizer);
13090 *
13091 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
13092 * // => { 'a': 1, 'b': 2 }
13093 */
13094 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
13095 copyObject(source, keysIn(source), object, customizer);
13096 });
13097 /**
13098 * This method is like `_.assign` except that it accepts `customizer`
13099 * which is invoked to produce the assigned values. If `customizer` returns
13100 * `undefined`, assignment is handled by the method instead. The `customizer`
13101 * is invoked with five arguments: (objValue, srcValue, key, object, source).
13102 *
13103 * **Note:** This method mutates `object`.
13104 *
13105 * @static
13106 * @memberOf _
13107 * @since 4.0.0
13108 * @category Object
13109 * @param {Object} object The destination object.
13110 * @param {...Object} sources The source objects.
13111 * @param {Function} [customizer] The function to customize assigned values.
13112 * @returns {Object} Returns `object`.
13113 * @see _.assignInWith
13114 * @example
13115 *
13116 * function customizer(objValue, srcValue) {
13117 * return _.isUndefined(objValue) ? srcValue : objValue;
13118 * }
13119 *
13120 * var defaults = _.partialRight(_.assignWith, customizer);
13121 *
13122 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
13123 * // => { 'a': 1, 'b': 2 }
13124 */
13125 var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
13126 copyObject(source, keys(source), object, customizer);
13127 });
13128 /**
13129 * Creates an array of values corresponding to `paths` of `object`.
13130 *
13131 * @static
13132 * @memberOf _
13133 * @since 1.0.0
13134 * @category Object
13135 * @param {Object} object The object to iterate over.
13136 * @param {...(string|string[])} [paths] The property paths to pick.
13137 * @returns {Array} Returns the picked values.
13138 * @example
13139 *
13140 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
13141 *
13142 * _.at(object, ['a[0].b.c', 'a[1]']);
13143 * // => [3, 4]
13144 */
13145 var at = flatRest(baseAt);
13146 /**
13147 * Creates an object that inherits from the `prototype` object. If a
13148 * `properties` object is given, its own enumerable string keyed properties
13149 * are assigned to the created object.
13150 *
13151 * @static
13152 * @memberOf _
13153 * @since 2.3.0
13154 * @category Object
13155 * @param {Object} prototype The object to inherit from.
13156 * @param {Object} [properties] The properties to assign to the object.
13157 * @returns {Object} Returns the new object.
13158 * @example
13159 *
13160 * function Shape() {
13161 * this.x = 0;
13162 * this.y = 0;
13163 * }
13164 *
13165 * function Circle() {
13166 * Shape.call(this);
13167 * }
13168 *
13169 * Circle.prototype = _.create(Shape.prototype, {
13170 * 'constructor': Circle
13171 * });
13172 *
13173 * var circle = new Circle;
13174 * circle instanceof Circle;
13175 * // => true
13176 *
13177 * circle instanceof Shape;
13178 * // => true
13179 */
13180 function create(prototype, properties) {
13181 var result = baseCreate(prototype);
13182 return properties == null ? result : baseAssign(result, properties);
13183 }
13184 /**
13185 * Assigns own and inherited enumerable string keyed properties of source
13186 * objects to the destination object for all destination properties that
13187 * resolve to `undefined`. Source objects are applied from left to right.
13188 * Once a property is set, additional values of the same property are ignored.
13189 *
13190 * **Note:** This method mutates `object`.
13191 *
13192 * @static
13193 * @since 0.1.0
13194 * @memberOf _
13195 * @category Object
13196 * @param {Object} object The destination object.
13197 * @param {...Object} [sources] The source objects.
13198 * @returns {Object} Returns `object`.
13199 * @see _.defaultsDeep
13200 * @example
13201 *
13202 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
13203 * // => { 'a': 1, 'b': 2 }
13204 */
13205 var defaults = baseRest(function(object, sources) {
13206 object = Object(object);
13207 var index = -1;
13208 var length = sources.length;
13209 var guard = length > 2 ? sources[2] : undefined;
13210 if (guard && isIterateeCall(sources[0], sources[1], guard)) length = 1;
13211 while (++index < length) {
13212 var source = sources[index];
13213 var props = keysIn(source);
13214 var propsIndex = -1;
13215 var propsLength = props.length;
13216 while (++propsIndex < propsLength) {
13217 var key = props[propsIndex];
13218 var value = object[key];
13219 if (value === undefined || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) object[key] = source[key];
13220 }
13221 }
13222 return object;
13223 });
13224 /**
13225 * This method is like `_.defaults` except that it recursively assigns
13226 * default properties.
13227 *
13228 * **Note:** This method mutates `object`.
13229 *
13230 * @static
13231 * @memberOf _
13232 * @since 3.10.0
13233 * @category Object
13234 * @param {Object} object The destination object.
13235 * @param {...Object} [sources] The source objects.
13236 * @returns {Object} Returns `object`.
13237 * @see _.defaults
13238 * @example
13239 *
13240 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
13241 * // => { 'a': { 'b': 2, 'c': 3 } }
13242 */
13243 var defaultsDeep = baseRest(function(args) {
13244 args.push(undefined, customDefaultsMerge);
13245 return apply(mergeWith, undefined, args);
13246 });
13247 /**
13248 * This method is like `_.find` except that it returns the key of the first
13249 * element `predicate` returns truthy for instead of the element itself.
13250 *
13251 * @static
13252 * @memberOf _
13253 * @since 1.1.0
13254 * @category Object
13255 * @param {Object} object The object to inspect.
13256 * @param {Function} [predicate=_.identity] The function invoked per iteration.
13257 * @returns {string|undefined} Returns the key of the matched element,
13258 * else `undefined`.
13259 * @example
13260 *
13261 * var users = {
13262 * 'barney': { 'age': 36, 'active': true },
13263 * 'fred': { 'age': 40, 'active': false },
13264 * 'pebbles': { 'age': 1, 'active': true }
13265 * };
13266 *
13267 * _.findKey(users, function(o) { return o.age < 40; });
13268 * // => 'barney' (iteration order is not guaranteed)
13269 *
13270 * // The `_.matches` iteratee shorthand.
13271 * _.findKey(users, { 'age': 1, 'active': true });
13272 * // => 'pebbles'
13273 *
13274 * // The `_.matchesProperty` iteratee shorthand.
13275 * _.findKey(users, ['active', false]);
13276 * // => 'fred'
13277 *
13278 * // The `_.property` iteratee shorthand.
13279 * _.findKey(users, 'active');
13280 * // => 'barney'
13281 */
13282 function findKey(object, predicate) {
13283 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
13284 }
13285 /**
13286 * This method is like `_.findKey` except that it iterates over elements of
13287 * a collection in the opposite order.
13288 *
13289 * @static
13290 * @memberOf _
13291 * @since 2.0.0
13292 * @category Object
13293 * @param {Object} object The object to inspect.
13294 * @param {Function} [predicate=_.identity] The function invoked per iteration.
13295 * @returns {string|undefined} Returns the key of the matched element,
13296 * else `undefined`.
13297 * @example
13298 *
13299 * var users = {
13300 * 'barney': { 'age': 36, 'active': true },
13301 * 'fred': { 'age': 40, 'active': false },
13302 * 'pebbles': { 'age': 1, 'active': true }
13303 * };
13304 *
13305 * _.findLastKey(users, function(o) { return o.age < 40; });
13306 * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
13307 *
13308 * // The `_.matches` iteratee shorthand.
13309 * _.findLastKey(users, { 'age': 36, 'active': true });
13310 * // => 'barney'
13311 *
13312 * // The `_.matchesProperty` iteratee shorthand.
13313 * _.findLastKey(users, ['active', false]);
13314 * // => 'fred'
13315 *
13316 * // The `_.property` iteratee shorthand.
13317 * _.findLastKey(users, 'active');
13318 * // => 'pebbles'
13319 */
13320 function findLastKey(object, predicate) {
13321 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
13322 }
13323 /**
13324 * Iterates over own and inherited enumerable string keyed properties of an
13325 * object and invokes `iteratee` for each property. The iteratee is invoked
13326 * with three arguments: (value, key, object). Iteratee functions may exit
13327 * iteration early by explicitly returning `false`.
13328 *
13329 * @static
13330 * @memberOf _
13331 * @since 0.3.0
13332 * @category Object
13333 * @param {Object} object The object to iterate over.
13334 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13335 * @returns {Object} Returns `object`.
13336 * @see _.forInRight
13337 * @example
13338 *
13339 * function Foo() {
13340 * this.a = 1;
13341 * this.b = 2;
13342 * }
13343 *
13344 * Foo.prototype.c = 3;
13345 *
13346 * _.forIn(new Foo, function(value, key) {
13347 * console.log(key);
13348 * });
13349 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
13350 */
13351 function forIn(object, iteratee) {
13352 return object == null ? object : baseFor(object, getIteratee(iteratee, 3), keysIn);
13353 }
13354 /**
13355 * This method is like `_.forIn` except that it iterates over properties of
13356 * `object` in the opposite order.
13357 *
13358 * @static
13359 * @memberOf _
13360 * @since 2.0.0
13361 * @category Object
13362 * @param {Object} object The object to iterate over.
13363 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13364 * @returns {Object} Returns `object`.
13365 * @see _.forIn
13366 * @example
13367 *
13368 * function Foo() {
13369 * this.a = 1;
13370 * this.b = 2;
13371 * }
13372 *
13373 * Foo.prototype.c = 3;
13374 *
13375 * _.forInRight(new Foo, function(value, key) {
13376 * console.log(key);
13377 * });
13378 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
13379 */
13380 function forInRight(object, iteratee) {
13381 return object == null ? object : baseForRight(object, getIteratee(iteratee, 3), keysIn);
13382 }
13383 /**
13384 * Iterates over own enumerable string keyed properties of an object and
13385 * invokes `iteratee` for each property. The iteratee is invoked with three
13386 * arguments: (value, key, object). Iteratee functions may exit iteration
13387 * early by explicitly returning `false`.
13388 *
13389 * @static
13390 * @memberOf _
13391 * @since 0.3.0
13392 * @category Object
13393 * @param {Object} object The object to iterate over.
13394 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13395 * @returns {Object} Returns `object`.
13396 * @see _.forOwnRight
13397 * @example
13398 *
13399 * function Foo() {
13400 * this.a = 1;
13401 * this.b = 2;
13402 * }
13403 *
13404 * Foo.prototype.c = 3;
13405 *
13406 * _.forOwn(new Foo, function(value, key) {
13407 * console.log(key);
13408 * });
13409 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
13410 */
13411 function forOwn(object, iteratee) {
13412 return object && baseForOwn(object, getIteratee(iteratee, 3));
13413 }
13414 /**
13415 * This method is like `_.forOwn` except that it iterates over properties of
13416 * `object` in the opposite order.
13417 *
13418 * @static
13419 * @memberOf _
13420 * @since 2.0.0
13421 * @category Object
13422 * @param {Object} object The object to iterate over.
13423 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13424 * @returns {Object} Returns `object`.
13425 * @see _.forOwn
13426 * @example
13427 *
13428 * function Foo() {
13429 * this.a = 1;
13430 * this.b = 2;
13431 * }
13432 *
13433 * Foo.prototype.c = 3;
13434 *
13435 * _.forOwnRight(new Foo, function(value, key) {
13436 * console.log(key);
13437 * });
13438 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
13439 */
13440 function forOwnRight(object, iteratee) {
13441 return object && baseForOwnRight(object, getIteratee(iteratee, 3));
13442 }
13443 /**
13444 * Creates an array of function property names from own enumerable properties
13445 * of `object`.
13446 *
13447 * @static
13448 * @since 0.1.0
13449 * @memberOf _
13450 * @category Object
13451 * @param {Object} object The object to inspect.
13452 * @returns {Array} Returns the function names.
13453 * @see _.functionsIn
13454 * @example
13455 *
13456 * function Foo() {
13457 * this.a = _.constant('a');
13458 * this.b = _.constant('b');
13459 * }
13460 *
13461 * Foo.prototype.c = _.constant('c');
13462 *
13463 * _.functions(new Foo);
13464 * // => ['a', 'b']
13465 */
13466 function functions(object) {
13467 return object == null ? [] : baseFunctions(object, keys(object));
13468 }
13469 /**
13470 * Creates an array of function property names from own and inherited
13471 * enumerable properties of `object`.
13472 *
13473 * @static
13474 * @memberOf _
13475 * @since 4.0.0
13476 * @category Object
13477 * @param {Object} object The object to inspect.
13478 * @returns {Array} Returns the function names.
13479 * @see _.functions
13480 * @example
13481 *
13482 * function Foo() {
13483 * this.a = _.constant('a');
13484 * this.b = _.constant('b');
13485 * }
13486 *
13487 * Foo.prototype.c = _.constant('c');
13488 *
13489 * _.functionsIn(new Foo);
13490 * // => ['a', 'b', 'c']
13491 */
13492 function functionsIn(object) {
13493 return object == null ? [] : baseFunctions(object, keysIn(object));
13494 }
13495 /**
13496 * Gets the value at `path` of `object`. If the resolved value is
13497 * `undefined`, the `defaultValue` is returned in its place.
13498 *
13499 * @static
13500 * @memberOf _
13501 * @since 3.7.0
13502 * @category Object
13503 * @param {Object} object The object to query.
13504 * @param {Array|string} path The path of the property to get.
13505 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
13506 * @returns {*} Returns the resolved value.
13507 * @example
13508 *
13509 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
13510 *
13511 * _.get(object, 'a[0].b.c');
13512 * // => 3
13513 *
13514 * _.get(object, ['a', '0', 'b', 'c']);
13515 * // => 3
13516 *
13517 * _.get(object, 'a.b.c', 'default');
13518 * // => 'default'
13519 */
13520 function get(object, path, defaultValue) {
13521 var result = object == null ? undefined : baseGet(object, path);
13522 return result === undefined ? defaultValue : result;
13523 }
13524 /**
13525 * Checks if `path` is a direct property of `object`.
13526 *
13527 * @static
13528 * @since 0.1.0
13529 * @memberOf _
13530 * @category Object
13531 * @param {Object} object The object to query.
13532 * @param {Array|string} path The path to check.
13533 * @returns {boolean} Returns `true` if `path` exists, else `false`.
13534 * @example
13535 *
13536 * var object = { 'a': { 'b': 2 } };
13537 * var other = _.create({ 'a': _.create({ 'b': 2 }) });
13538 *
13539 * _.has(object, 'a');
13540 * // => true
13541 *
13542 * _.has(object, 'a.b');
13543 * // => true
13544 *
13545 * _.has(object, ['a', 'b']);
13546 * // => true
13547 *
13548 * _.has(other, 'a');
13549 * // => false
13550 */
13551 function has(object, path) {
13552 return object != null && hasPath(object, path, baseHas);
13553 }
13554 /**
13555 * Checks if `path` is a direct or inherited property of `object`.
13556 *
13557 * @static
13558 * @memberOf _
13559 * @since 4.0.0
13560 * @category Object
13561 * @param {Object} object The object to query.
13562 * @param {Array|string} path The path to check.
13563 * @returns {boolean} Returns `true` if `path` exists, else `false`.
13564 * @example
13565 *
13566 * var object = _.create({ 'a': _.create({ 'b': 2 }) });
13567 *
13568 * _.hasIn(object, 'a');
13569 * // => true
13570 *
13571 * _.hasIn(object, 'a.b');
13572 * // => true
13573 *
13574 * _.hasIn(object, ['a', 'b']);
13575 * // => true
13576 *
13577 * _.hasIn(object, 'b');
13578 * // => false
13579 */
13580 function hasIn(object, path) {
13581 return object != null && hasPath(object, path, baseHasIn);
13582 }
13583 /**
13584 * Creates an object composed of the inverted keys and values of `object`.
13585 * If `object` contains duplicate values, subsequent values overwrite
13586 * property assignments of previous values.
13587 *
13588 * @static
13589 * @memberOf _
13590 * @since 0.7.0
13591 * @category Object
13592 * @param {Object} object The object to invert.
13593 * @returns {Object} Returns the new inverted object.
13594 * @example
13595 *
13596 * var object = { 'a': 1, 'b': 2, 'c': 1 };
13597 *
13598 * _.invert(object);
13599 * // => { '1': 'c', '2': 'b' }
13600 */
13601 var invert = createInverter(function(result, value, key) {
13602 if (value != null && typeof value.toString != "function") value = nativeObjectToString.call(value);
13603 result[value] = key;
13604 }, constant(identity));
13605 /**
13606 * This method is like `_.invert` except that the inverted object is generated
13607 * from the results of running each element of `object` thru `iteratee`. The
13608 * corresponding inverted value of each inverted key is an array of keys
13609 * responsible for generating the inverted value. The iteratee is invoked
13610 * with one argument: (value).
13611 *
13612 * @static
13613 * @memberOf _
13614 * @since 4.1.0
13615 * @category Object
13616 * @param {Object} object The object to invert.
13617 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
13618 * @returns {Object} Returns the new inverted object.
13619 * @example
13620 *
13621 * var object = { 'a': 1, 'b': 2, 'c': 1 };
13622 *
13623 * _.invertBy(object);
13624 * // => { '1': ['a', 'c'], '2': ['b'] }
13625 *
13626 * _.invertBy(object, function(value) {
13627 * return 'group' + value;
13628 * });
13629 * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
13630 */
13631 var invertBy = createInverter(function(result, value, key) {
13632 if (value != null && typeof value.toString != "function") value = nativeObjectToString.call(value);
13633 if (hasOwnProperty.call(result, value)) result[value].push(key);
13634 else result[value] = [key];
13635 }, getIteratee);
13636 /**
13637 * Invokes the method at `path` of `object`.
13638 *
13639 * @static
13640 * @memberOf _
13641 * @since 4.0.0
13642 * @category Object
13643 * @param {Object} object The object to query.
13644 * @param {Array|string} path The path of the method to invoke.
13645 * @param {...*} [args] The arguments to invoke the method with.
13646 * @returns {*} Returns the result of the invoked method.
13647 * @example
13648 *
13649 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
13650 *
13651 * _.invoke(object, 'a[0].b.c.slice', 1, 3);
13652 * // => [2, 3]
13653 */
13654 var invoke = baseRest(baseInvoke);
13655 /**
13656 * Creates an array of the own enumerable property names of `object`.
13657 *
13658 * **Note:** Non-object values are coerced to objects. See the
13659 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
13660 * for more details.
13661 *
13662 * @static
13663 * @since 0.1.0
13664 * @memberOf _
13665 * @category Object
13666 * @param {Object} object The object to query.
13667 * @returns {Array} Returns the array of property names.
13668 * @example
13669 *
13670 * function Foo() {
13671 * this.a = 1;
13672 * this.b = 2;
13673 * }
13674 *
13675 * Foo.prototype.c = 3;
13676 *
13677 * _.keys(new Foo);
13678 * // => ['a', 'b'] (iteration order is not guaranteed)
13679 *
13680 * _.keys('hi');
13681 * // => ['0', '1']
13682 */
13683 function keys(object) {
13684 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
13685 }
13686 /**
13687 * Creates an array of the own and inherited enumerable property names of `object`.
13688 *
13689 * **Note:** Non-object values are coerced to objects.
13690 *
13691 * @static
13692 * @memberOf _
13693 * @since 3.0.0
13694 * @category Object
13695 * @param {Object} object The object to query.
13696 * @returns {Array} Returns the array of property names.
13697 * @example
13698 *
13699 * function Foo() {
13700 * this.a = 1;
13701 * this.b = 2;
13702 * }
13703 *
13704 * Foo.prototype.c = 3;
13705 *
13706 * _.keysIn(new Foo);
13707 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
13708 */
13709 function keysIn(object) {
13710 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
13711 }
13712 /**
13713 * The opposite of `_.mapValues`; this method creates an object with the
13714 * same values as `object` and keys generated by running each own enumerable
13715 * string keyed property of `object` thru `iteratee`. The iteratee is invoked
13716 * with three arguments: (value, key, object).
13717 *
13718 * @static
13719 * @memberOf _
13720 * @since 3.8.0
13721 * @category Object
13722 * @param {Object} object The object to iterate over.
13723 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13724 * @returns {Object} Returns the new mapped object.
13725 * @see _.mapValues
13726 * @example
13727 *
13728 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
13729 * return key + value;
13730 * });
13731 * // => { 'a1': 1, 'b2': 2 }
13732 */
13733 function mapKeys(object, iteratee) {
13734 var result = {};
13735 iteratee = getIteratee(iteratee, 3);
13736 baseForOwn(object, function(value, key, object) {
13737 baseAssignValue(result, iteratee(value, key, object), value);
13738 });
13739 return result;
13740 }
13741 /**
13742 * Creates an object with the same keys as `object` and values generated
13743 * by running each own enumerable string keyed property of `object` thru
13744 * `iteratee`. The iteratee is invoked with three arguments:
13745 * (value, key, object).
13746 *
13747 * @static
13748 * @memberOf _
13749 * @since 2.4.0
13750 * @category Object
13751 * @param {Object} object The object to iterate over.
13752 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
13753 * @returns {Object} Returns the new mapped object.
13754 * @see _.mapKeys
13755 * @example
13756 *
13757 * var users = {
13758 * 'fred': { 'user': 'fred', 'age': 40 },
13759 * 'pebbles': { 'user': 'pebbles', 'age': 1 }
13760 * };
13761 *
13762 * _.mapValues(users, function(o) { return o.age; });
13763 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
13764 *
13765 * // The `_.property` iteratee shorthand.
13766 * _.mapValues(users, 'age');
13767 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
13768 */
13769 function mapValues(object, iteratee) {
13770 var result = {};
13771 iteratee = getIteratee(iteratee, 3);
13772 baseForOwn(object, function(value, key, object) {
13773 baseAssignValue(result, key, iteratee(value, key, object));
13774 });
13775 return result;
13776 }
13777 /**
13778 * This method is like `_.assign` except that it recursively merges own and
13779 * inherited enumerable string keyed properties of source objects into the
13780 * destination object. Source properties that resolve to `undefined` are
13781 * skipped if a destination value exists. Array and plain object properties
13782 * are merged recursively. Other objects and value types are overridden by
13783 * assignment. Source objects are applied from left to right. Subsequent
13784 * sources overwrite property assignments of previous sources.
13785 *
13786 * **Note:** This method mutates `object`.
13787 *
13788 * @static
13789 * @memberOf _
13790 * @since 0.5.0
13791 * @category Object
13792 * @param {Object} object The destination object.
13793 * @param {...Object} [sources] The source objects.
13794 * @returns {Object} Returns `object`.
13795 * @example
13796 *
13797 * var object = {
13798 * 'a': [{ 'b': 2 }, { 'd': 4 }]
13799 * };
13800 *
13801 * var other = {
13802 * 'a': [{ 'c': 3 }, { 'e': 5 }]
13803 * };
13804 *
13805 * _.merge(object, other);
13806 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
13807 */
13808 var merge = createAssigner(function(object, source, srcIndex) {
13809 baseMerge(object, source, srcIndex);
13810 });
13811 /**
13812 * This method is like `_.merge` except that it accepts `customizer` which
13813 * is invoked to produce the merged values of the destination and source
13814 * properties. If `customizer` returns `undefined`, merging is handled by the
13815 * method instead. The `customizer` is invoked with six arguments:
13816 * (objValue, srcValue, key, object, source, stack).
13817 *
13818 * **Note:** This method mutates `object`.
13819 *
13820 * @static
13821 * @memberOf _
13822 * @since 4.0.0
13823 * @category Object
13824 * @param {Object} object The destination object.
13825 * @param {...Object} sources The source objects.
13826 * @param {Function} customizer The function to customize assigned values.
13827 * @returns {Object} Returns `object`.
13828 * @example
13829 *
13830 * function customizer(objValue, srcValue) {
13831 * if (_.isArray(objValue)) {
13832 * return objValue.concat(srcValue);
13833 * }
13834 * }
13835 *
13836 * var object = { 'a': [1], 'b': [2] };
13837 * var other = { 'a': [3], 'b': [4] };
13838 *
13839 * _.mergeWith(object, other, customizer);
13840 * // => { 'a': [1, 3], 'b': [2, 4] }
13841 */
13842 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
13843 baseMerge(object, source, srcIndex, customizer);
13844 });
13845 /**
13846 * The opposite of `_.pick`; this method creates an object composed of the
13847 * own and inherited enumerable property paths of `object` that are not omitted.
13848 *
13849 * **Note:** This method is considerably slower than `_.pick`.
13850 *
13851 * @static
13852 * @since 0.1.0
13853 * @memberOf _
13854 * @category Object
13855 * @param {Object} object The source object.
13856 * @param {...(string|string[])} [paths] The property paths to omit.
13857 * @returns {Object} Returns the new object.
13858 * @example
13859 *
13860 * var object = { 'a': 1, 'b': '2', 'c': 3 };
13861 *
13862 * _.omit(object, ['a', 'c']);
13863 * // => { 'b': '2' }
13864 */
13865 var omit = flatRest(function(object, paths) {
13866 var result = {};
13867 if (object == null) return result;
13868 var isDeep = false;
13869 paths = arrayMap(paths, function(path) {
13870 path = castPath(path, object);
13871 isDeep || (isDeep = path.length > 1);
13872 return path;
13873 });
13874 copyObject(object, getAllKeysIn(object), result);
13875 if (isDeep) result = baseClone(result, 7, customOmitClone);
13876 var length = paths.length;
13877 while (length--) baseUnset(result, paths[length]);
13878 return result;
13879 });
13880 /**
13881 * The opposite of `_.pickBy`; this method creates an object composed of
13882 * the own and inherited enumerable string keyed properties of `object` that
13883 * `predicate` doesn't return truthy for. The predicate is invoked with two
13884 * arguments: (value, key).
13885 *
13886 * @static
13887 * @memberOf _
13888 * @since 4.0.0
13889 * @category Object
13890 * @param {Object} object The source object.
13891 * @param {Function} [predicate=_.identity] The function invoked per property.
13892 * @returns {Object} Returns the new object.
13893 * @example
13894 *
13895 * var object = { 'a': 1, 'b': '2', 'c': 3 };
13896 *
13897 * _.omitBy(object, _.isNumber);
13898 * // => { 'b': '2' }
13899 */
13900 function omitBy(object, predicate) {
13901 return pickBy(object, negate(getIteratee(predicate)));
13902 }
13903 /**
13904 * Creates an object composed of the picked `object` properties.
13905 *
13906 * @static
13907 * @since 0.1.0
13908 * @memberOf _
13909 * @category Object
13910 * @param {Object} object The source object.
13911 * @param {...(string|string[])} [paths] The property paths to pick.
13912 * @returns {Object} Returns the new object.
13913 * @example
13914 *
13915 * var object = { 'a': 1, 'b': '2', 'c': 3 };
13916 *
13917 * _.pick(object, ['a', 'c']);
13918 * // => { 'a': 1, 'c': 3 }
13919 */
13920 var pick = flatRest(function(object, paths) {
13921 return object == null ? {} : basePick(object, paths);
13922 });
13923 /**
13924 * Creates an object composed of the `object` properties `predicate` returns
13925 * truthy for. The predicate is invoked with two arguments: (value, key).
13926 *
13927 * @static
13928 * @memberOf _
13929 * @since 4.0.0
13930 * @category Object
13931 * @param {Object} object The source object.
13932 * @param {Function} [predicate=_.identity] The function invoked per property.
13933 * @returns {Object} Returns the new object.
13934 * @example
13935 *
13936 * var object = { 'a': 1, 'b': '2', 'c': 3 };
13937 *
13938 * _.pickBy(object, _.isNumber);
13939 * // => { 'a': 1, 'c': 3 }
13940 */
13941 function pickBy(object, predicate) {
13942 if (object == null) return {};
13943 var props = arrayMap(getAllKeysIn(object), function(prop) {
13944 return [prop];
13945 });
13946 predicate = getIteratee(predicate);
13947 return basePickBy(object, props, function(value, path) {
13948 return predicate(value, path[0]);
13949 });
13950 }
13951 /**
13952 * This method is like `_.get` except that if the resolved value is a
13953 * function it's invoked with the `this` binding of its parent object and
13954 * its result is returned.
13955 *
13956 * @static
13957 * @since 0.1.0
13958 * @memberOf _
13959 * @category Object
13960 * @param {Object} object The object to query.
13961 * @param {Array|string} path The path of the property to resolve.
13962 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
13963 * @returns {*} Returns the resolved value.
13964 * @example
13965 *
13966 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
13967 *
13968 * _.result(object, 'a[0].b.c1');
13969 * // => 3
13970 *
13971 * _.result(object, 'a[0].b.c2');
13972 * // => 4
13973 *
13974 * _.result(object, 'a[0].b.c3', 'default');
13975 * // => 'default'
13976 *
13977 * _.result(object, 'a[0].b.c3', _.constant('default'));
13978 * // => 'default'
13979 */
13980 function result(object, path, defaultValue) {
13981 path = castPath(path, object);
13982 var index = -1;
13983 var length = path.length;
13984 if (!length) {
13985 length = 1;
13986 object = undefined;
13987 }
13988 while (++index < length) {
13989 var value = object == null ? undefined : object[toKey(path[index])];
13990 if (value === undefined) {
13991 index = length;
13992 value = defaultValue;
13993 }
13994 object = isFunction(value) ? value.call(object) : value;
13995 }
13996 return object;
13997 }
13998 /**
13999 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
14000 * it's created. Arrays are created for missing index properties while objects
14001 * are created for all other missing properties. Use `_.setWith` to customize
14002 * `path` creation.
14003 *
14004 * **Note:** This method mutates `object`.
14005 *
14006 * @static
14007 * @memberOf _
14008 * @since 3.7.0
14009 * @category Object
14010 * @param {Object} object The object to modify.
14011 * @param {Array|string} path The path of the property to set.
14012 * @param {*} value The value to set.
14013 * @returns {Object} Returns `object`.
14014 * @example
14015 *
14016 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
14017 *
14018 * _.set(object, 'a[0].b.c', 4);
14019 * console.log(object.a[0].b.c);
14020 * // => 4
14021 *
14022 * _.set(object, ['x', '0', 'y', 'z'], 5);
14023 * console.log(object.x[0].y.z);
14024 * // => 5
14025 */
14026 function set(object, path, value) {
14027 return object == null ? object : baseSet(object, path, value);
14028 }
14029 /**
14030 * This method is like `_.set` except that it accepts `customizer` which is
14031 * invoked to produce the objects of `path`. If `customizer` returns `undefined`
14032 * path creation is handled by the method instead. The `customizer` is invoked
14033 * with three arguments: (nsValue, key, nsObject).
14034 *
14035 * **Note:** This method mutates `object`.
14036 *
14037 * @static
14038 * @memberOf _
14039 * @since 4.0.0
14040 * @category Object
14041 * @param {Object} object The object to modify.
14042 * @param {Array|string} path The path of the property to set.
14043 * @param {*} value The value to set.
14044 * @param {Function} [customizer] The function to customize assigned values.
14045 * @returns {Object} Returns `object`.
14046 * @example
14047 *
14048 * var object = {};
14049 *
14050 * _.setWith(object, '[0][1]', 'a', Object);
14051 * // => { '0': { '1': 'a' } }
14052 */
14053 function setWith(object, path, value, customizer) {
14054 customizer = typeof customizer == "function" ? customizer : undefined;
14055 return object == null ? object : baseSet(object, path, value, customizer);
14056 }
14057 /**
14058 * Creates an array of own enumerable string keyed-value pairs for `object`
14059 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
14060 * entries are returned.
14061 *
14062 * @static
14063 * @memberOf _
14064 * @since 4.0.0
14065 * @alias entries
14066 * @category Object
14067 * @param {Object} object The object to query.
14068 * @returns {Array} Returns the key-value pairs.
14069 * @example
14070 *
14071 * function Foo() {
14072 * this.a = 1;
14073 * this.b = 2;
14074 * }
14075 *
14076 * Foo.prototype.c = 3;
14077 *
14078 * _.toPairs(new Foo);
14079 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
14080 */
14081 var toPairs = createToPairs(keys);
14082 /**
14083 * Creates an array of own and inherited enumerable string keyed-value pairs
14084 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
14085 * or set, its entries are returned.
14086 *
14087 * @static
14088 * @memberOf _
14089 * @since 4.0.0
14090 * @alias entriesIn
14091 * @category Object
14092 * @param {Object} object The object to query.
14093 * @returns {Array} Returns the key-value pairs.
14094 * @example
14095 *
14096 * function Foo() {
14097 * this.a = 1;
14098 * this.b = 2;
14099 * }
14100 *
14101 * Foo.prototype.c = 3;
14102 *
14103 * _.toPairsIn(new Foo);
14104 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
14105 */
14106 var toPairsIn = createToPairs(keysIn);
14107 /**
14108 * An alternative to `_.reduce`; this method transforms `object` to a new
14109 * `accumulator` object which is the result of running each of its own
14110 * enumerable string keyed properties thru `iteratee`, with each invocation
14111 * potentially mutating the `accumulator` object. If `accumulator` is not
14112 * provided, a new object with the same `[[Prototype]]` will be used. The
14113 * iteratee is invoked with four arguments: (accumulator, value, key, object).
14114 * Iteratee functions may exit iteration early by explicitly returning `false`.
14115 *
14116 * @static
14117 * @memberOf _
14118 * @since 1.3.0
14119 * @category Object
14120 * @param {Object} object The object to iterate over.
14121 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
14122 * @param {*} [accumulator] The custom accumulator value.
14123 * @returns {*} Returns the accumulated value.
14124 * @example
14125 *
14126 * _.transform([2, 3, 4], function(result, n) {
14127 * result.push(n *= n);
14128 * return n % 2 == 0;
14129 * }, []);
14130 * // => [4, 9]
14131 *
14132 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
14133 * (result[value] || (result[value] = [])).push(key);
14134 * }, {});
14135 * // => { '1': ['a', 'c'], '2': ['b'] }
14136 */
14137 function transform(object, iteratee, accumulator) {
14138 var isArr = isArray(object);
14139 var isArrLike = isArr || isBuffer(object) || isTypedArray(object);
14140 iteratee = getIteratee(iteratee, 4);
14141 if (accumulator == null) {
14142 var Ctor = object && object.constructor;
14143 if (isArrLike) accumulator = isArr ? new Ctor() : [];
14144 else if (isObject(object)) accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
14145 else accumulator = {};
14146 }
14147 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
14148 return iteratee(accumulator, value, index, object);
14149 });
14150 return accumulator;
14151 }
14152 /**
14153 * Removes the property at `path` of `object`.
14154 *
14155 * **Note:** This method mutates `object`.
14156 *
14157 * @static
14158 * @memberOf _
14159 * @since 4.0.0
14160 * @category Object
14161 * @param {Object} object The object to modify.
14162 * @param {Array|string} path The path of the property to unset.
14163 * @returns {boolean} Returns `true` if the property is deleted, else `false`.
14164 * @example
14165 *
14166 * var object = { 'a': [{ 'b': { 'c': 7 } }] };
14167 * _.unset(object, 'a[0].b.c');
14168 * // => true
14169 *
14170 * console.log(object);
14171 * // => { 'a': [{ 'b': {} }] };
14172 *
14173 * _.unset(object, ['a', '0', 'b', 'c']);
14174 * // => true
14175 *
14176 * console.log(object);
14177 * // => { 'a': [{ 'b': {} }] };
14178 */
14179 function unset(object, path) {
14180 return object == null ? true : baseUnset(object, path);
14181 }
14182 /**
14183 * This method is like `_.set` except that accepts `updater` to produce the
14184 * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
14185 * is invoked with one argument: (value).
14186 *
14187 * **Note:** This method mutates `object`.
14188 *
14189 * @static
14190 * @memberOf _
14191 * @since 4.6.0
14192 * @category Object
14193 * @param {Object} object The object to modify.
14194 * @param {Array|string} path The path of the property to set.
14195 * @param {Function} updater The function to produce the updated value.
14196 * @returns {Object} Returns `object`.
14197 * @example
14198 *
14199 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
14200 *
14201 * _.update(object, 'a[0].b.c', function(n) { return n * n; });
14202 * console.log(object.a[0].b.c);
14203 * // => 9
14204 *
14205 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
14206 * console.log(object.x[0].y.z);
14207 * // => 0
14208 */
14209 function update(object, path, updater) {
14210 return object == null ? object : baseUpdate(object, path, castFunction(updater));
14211 }
14212 /**
14213 * This method is like `_.update` except that it accepts `customizer` which is
14214 * invoked to produce the objects of `path`. If `customizer` returns `undefined`
14215 * path creation is handled by the method instead. The `customizer` is invoked
14216 * with three arguments: (nsValue, key, nsObject).
14217 *
14218 * **Note:** This method mutates `object`.
14219 *
14220 * @static
14221 * @memberOf _
14222 * @since 4.6.0
14223 * @category Object
14224 * @param {Object} object The object to modify.
14225 * @param {Array|string} path The path of the property to set.
14226 * @param {Function} updater The function to produce the updated value.
14227 * @param {Function} [customizer] The function to customize assigned values.
14228 * @returns {Object} Returns `object`.
14229 * @example
14230 *
14231 * var object = {};
14232 *
14233 * _.updateWith(object, '[0][1]', _.constant('a'), Object);
14234 * // => { '0': { '1': 'a' } }
14235 */
14236 function updateWith(object, path, updater, customizer) {
14237 customizer = typeof customizer == "function" ? customizer : undefined;
14238 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
14239 }
14240 /**
14241 * Creates an array of the own enumerable string keyed property values of `object`.
14242 *
14243 * **Note:** Non-object values are coerced to objects.
14244 *
14245 * @static
14246 * @since 0.1.0
14247 * @memberOf _
14248 * @category Object
14249 * @param {Object} object The object to query.
14250 * @returns {Array} Returns the array of property values.
14251 * @example
14252 *
14253 * function Foo() {
14254 * this.a = 1;
14255 * this.b = 2;
14256 * }
14257 *
14258 * Foo.prototype.c = 3;
14259 *
14260 * _.values(new Foo);
14261 * // => [1, 2] (iteration order is not guaranteed)
14262 *
14263 * _.values('hi');
14264 * // => ['h', 'i']
14265 */
14266 function values(object) {
14267 return object == null ? [] : baseValues(object, keys(object));
14268 }
14269 /**
14270 * Creates an array of the own and inherited enumerable string keyed property
14271 * values of `object`.
14272 *
14273 * **Note:** Non-object values are coerced to objects.
14274 *
14275 * @static
14276 * @memberOf _
14277 * @since 3.0.0
14278 * @category Object
14279 * @param {Object} object The object to query.
14280 * @returns {Array} Returns the array of property values.
14281 * @example
14282 *
14283 * function Foo() {
14284 * this.a = 1;
14285 * this.b = 2;
14286 * }
14287 *
14288 * Foo.prototype.c = 3;
14289 *
14290 * _.valuesIn(new Foo);
14291 * // => [1, 2, 3] (iteration order is not guaranteed)
14292 */
14293 function valuesIn(object) {
14294 return object == null ? [] : baseValues(object, keysIn(object));
14295 }
14296 /**
14297 * Clamps `number` within the inclusive `lower` and `upper` bounds.
14298 *
14299 * @static
14300 * @memberOf _
14301 * @since 4.0.0
14302 * @category Number
14303 * @param {number} number The number to clamp.
14304 * @param {number} [lower] The lower bound.
14305 * @param {number} upper The upper bound.
14306 * @returns {number} Returns the clamped number.
14307 * @example
14308 *
14309 * _.clamp(-10, -5, 5);
14310 * // => -5
14311 *
14312 * _.clamp(10, -5, 5);
14313 * // => 5
14314 */
14315 function clamp(number, lower, upper) {
14316 if (upper === undefined) {
14317 upper = lower;
14318 lower = undefined;
14319 }
14320 if (upper !== undefined) {
14321 upper = toNumber(upper);
14322 upper = upper === upper ? upper : 0;
14323 }
14324 if (lower !== undefined) {
14325 lower = toNumber(lower);
14326 lower = lower === lower ? lower : 0;
14327 }
14328 return baseClamp(toNumber(number), lower, upper);
14329 }
14330 /**
14331 * Checks if `n` is between `start` and up to, but not including, `end`. If
14332 * `end` is not specified, it's set to `start` with `start` then set to `0`.
14333 * If `start` is greater than `end` the params are swapped to support
14334 * negative ranges.
14335 *
14336 * @static
14337 * @memberOf _
14338 * @since 3.3.0
14339 * @category Number
14340 * @param {number} number The number to check.
14341 * @param {number} [start=0] The start of the range.
14342 * @param {number} end The end of the range.
14343 * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
14344 * @see _.range, _.rangeRight
14345 * @example
14346 *
14347 * _.inRange(3, 2, 4);
14348 * // => true
14349 *
14350 * _.inRange(4, 8);
14351 * // => true
14352 *
14353 * _.inRange(4, 2);
14354 * // => false
14355 *
14356 * _.inRange(2, 2);
14357 * // => false
14358 *
14359 * _.inRange(1.2, 2);
14360 * // => true
14361 *
14362 * _.inRange(5.2, 4);
14363 * // => false
14364 *
14365 * _.inRange(-3, -2, -6);
14366 * // => true
14367 */
14368 function inRange(number, start, end) {
14369 start = toFinite(start);
14370 if (end === undefined) {
14371 end = start;
14372 start = 0;
14373 } else end = toFinite(end);
14374 number = toNumber(number);
14375 return baseInRange(number, start, end);
14376 }
14377 /**
14378 * Produces a random number between the inclusive `lower` and `upper` bounds.
14379 * If only one argument is provided a number between `0` and the given number
14380 * is returned. If `floating` is `true`, or either `lower` or `upper` are
14381 * floats, a floating-point number is returned instead of an integer.
14382 *
14383 * **Note:** JavaScript follows the IEEE-754 standard for resolving
14384 * floating-point values which can produce unexpected results.
14385 *
14386 * **Note:** If `lower` is greater than `upper`, the values are swapped.
14387 *
14388 * @static
14389 * @memberOf _
14390 * @since 0.7.0
14391 * @category Number
14392 * @param {number} [lower=0] The lower bound.
14393 * @param {number} [upper=1] The upper bound.
14394 * @param {boolean} [floating] Specify returning a floating-point number.
14395 * @returns {number} Returns the random number.
14396 * @example
14397 *
14398 * _.random(0, 5);
14399 * // => an integer between 0 and 5
14400 *
14401 * // when lower is greater than upper the values are swapped
14402 * _.random(5, 0);
14403 * // => an integer between 0 and 5
14404 *
14405 * _.random(5);
14406 * // => also an integer between 0 and 5
14407 *
14408 * _.random(-5);
14409 * // => an integer between -5 and 0
14410 *
14411 * _.random(5, true);
14412 * // => a floating-point number between 0 and 5
14413 *
14414 * _.random(1.2, 5.2);
14415 * // => a floating-point number between 1.2 and 5.2
14416 */
14417 function random(lower, upper, floating) {
14418 if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) upper = floating = undefined;
14419 if (floating === undefined) {
14420 if (typeof upper == "boolean") {
14421 floating = upper;
14422 upper = undefined;
14423 } else if (typeof lower == "boolean") {
14424 floating = lower;
14425 lower = undefined;
14426 }
14427 }
14428 if (lower === undefined && upper === undefined) {
14429 lower = 0;
14430 upper = 1;
14431 } else {
14432 lower = toFinite(lower);
14433 if (upper === undefined) {
14434 upper = lower;
14435 lower = 0;
14436 } else upper = toFinite(upper);
14437 }
14438 if (lower > upper) {
14439 var temp = lower;
14440 lower = upper;
14441 upper = temp;
14442 }
14443 if (floating || lower % 1 || upper % 1) {
14444 var rand = nativeRandom();
14445 return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
14446 }
14447 return baseRandom(lower, upper);
14448 }
14449 /**
14450 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
14451 *
14452 * @static
14453 * @memberOf _
14454 * @since 3.0.0
14455 * @category String
14456 * @param {string} [string=''] The string to convert.
14457 * @returns {string} Returns the camel cased string.
14458 * @example
14459 *
14460 * _.camelCase('Foo Bar');
14461 * // => 'fooBar'
14462 *
14463 * _.camelCase('--foo-bar--');
14464 * // => 'fooBar'
14465 *
14466 * _.camelCase('__FOO_BAR__');
14467 * // => 'fooBar'
14468 */
14469 var camelCase = createCompounder(function(result, word, index) {
14470 word = word.toLowerCase();
14471 return result + (index ? capitalize(word) : word);
14472 });
14473 /**
14474 * Converts the first character of `string` to upper case and the remaining
14475 * to lower case.
14476 *
14477 * @static
14478 * @memberOf _
14479 * @since 3.0.0
14480 * @category String
14481 * @param {string} [string=''] The string to capitalize.
14482 * @returns {string} Returns the capitalized string.
14483 * @example
14484 *
14485 * _.capitalize('FRED');
14486 * // => 'Fred'
14487 */
14488 function capitalize(string) {
14489 return upperFirst(toString(string).toLowerCase());
14490 }
14491 /**
14492 * Deburrs `string` by converting
14493 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
14494 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
14495 * letters to basic Latin letters and removing
14496 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
14497 *
14498 * @static
14499 * @memberOf _
14500 * @since 3.0.0
14501 * @category String
14502 * @param {string} [string=''] The string to deburr.
14503 * @returns {string} Returns the deburred string.
14504 * @example
14505 *
14506 * _.deburr('déjà vu');
14507 * // => 'deja vu'
14508 */
14509 function deburr(string) {
14510 string = toString(string);
14511 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
14512 }
14513 /**
14514 * Checks if `string` ends with the given target string.
14515 *
14516 * @static
14517 * @memberOf _
14518 * @since 3.0.0
14519 * @category String
14520 * @param {string} [string=''] The string to inspect.
14521 * @param {string} [target] The string to search for.
14522 * @param {number} [position=string.length] The position to search up to.
14523 * @returns {boolean} Returns `true` if `string` ends with `target`,
14524 * else `false`.
14525 * @example
14526 *
14527 * _.endsWith('abc', 'c');
14528 * // => true
14529 *
14530 * _.endsWith('abc', 'b');
14531 * // => false
14532 *
14533 * _.endsWith('abc', 'b', 2);
14534 * // => true
14535 */
14536 function endsWith(string, target, position) {
14537 string = toString(string);
14538 target = baseToString(target);
14539 var length = string.length;
14540 position = position === undefined ? length : baseClamp(toInteger(position), 0, length);
14541 var end = position;
14542 position -= target.length;
14543 return position >= 0 && string.slice(position, end) == target;
14544 }
14545 /**
14546 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
14547 * corresponding HTML entities.
14548 *
14549 * **Note:** No other characters are escaped. To escape additional
14550 * characters use a third-party library like [_he_](https://mths.be/he).
14551 *
14552 * Though the ">" character is escaped for symmetry, characters like
14553 * ">" and "/" don't need escaping in HTML and have no special meaning
14554 * unless they're part of a tag or unquoted attribute value. See
14555 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
14556 * (under "semi-related fun fact") for more details.
14557 *
14558 * When working with HTML you should always
14559 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
14560 * XSS vectors.
14561 *
14562 * @static
14563 * @since 0.1.0
14564 * @memberOf _
14565 * @category String
14566 * @param {string} [string=''] The string to escape.
14567 * @returns {string} Returns the escaped string.
14568 * @example
14569 *
14570 * _.escape('fred, barney, & pebbles');
14571 * // => 'fred, barney, &amp; pebbles'
14572 */
14573 function escape(string) {
14574 string = toString(string);
14575 return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
14576 }
14577 /**
14578 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
14579 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
14580 *
14581 * @static
14582 * @memberOf _
14583 * @since 3.0.0
14584 * @category String
14585 * @param {string} [string=''] The string to escape.
14586 * @returns {string} Returns the escaped string.
14587 * @example
14588 *
14589 * _.escapeRegExp('[lodash](https://lodash.com/)');
14590 * // => '\[lodash\]\(https://lodash\.com/\)'
14591 */
14592 function escapeRegExp(string) {
14593 string = toString(string);
14594 return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
14595 }
14596 /**
14597 * Converts `string` to
14598 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
14599 *
14600 * @static
14601 * @memberOf _
14602 * @since 3.0.0
14603 * @category String
14604 * @param {string} [string=''] The string to convert.
14605 * @returns {string} Returns the kebab cased string.
14606 * @example
14607 *
14608 * _.kebabCase('Foo Bar');
14609 * // => 'foo-bar'
14610 *
14611 * _.kebabCase('fooBar');
14612 * // => 'foo-bar'
14613 *
14614 * _.kebabCase('__FOO_BAR__');
14615 * // => 'foo-bar'
14616 */
14617 var kebabCase = createCompounder(function(result, word, index) {
14618 return result + (index ? "-" : "") + word.toLowerCase();
14619 });
14620 /**
14621 * Converts `string`, as space separated words, to lower case.
14622 *
14623 * @static
14624 * @memberOf _
14625 * @since 4.0.0
14626 * @category String
14627 * @param {string} [string=''] The string to convert.
14628 * @returns {string} Returns the lower cased string.
14629 * @example
14630 *
14631 * _.lowerCase('--Foo-Bar--');
14632 * // => 'foo bar'
14633 *
14634 * _.lowerCase('fooBar');
14635 * // => 'foo bar'
14636 *
14637 * _.lowerCase('__FOO_BAR__');
14638 * // => 'foo bar'
14639 */
14640 var lowerCase = createCompounder(function(result, word, index) {
14641 return result + (index ? " " : "") + word.toLowerCase();
14642 });
14643 /**
14644 * Converts the first character of `string` to lower case.
14645 *
14646 * @static
14647 * @memberOf _
14648 * @since 4.0.0
14649 * @category String
14650 * @param {string} [string=''] The string to convert.
14651 * @returns {string} Returns the converted string.
14652 * @example
14653 *
14654 * _.lowerFirst('Fred');
14655 * // => 'fred'
14656 *
14657 * _.lowerFirst('FRED');
14658 * // => 'fRED'
14659 */
14660 var lowerFirst = createCaseFirst("toLowerCase");
14661 /**
14662 * Pads `string` on the left and right sides if it's shorter than `length`.
14663 * Padding characters are truncated if they can't be evenly divided by `length`.
14664 *
14665 * @static
14666 * @memberOf _
14667 * @since 3.0.0
14668 * @category String
14669 * @param {string} [string=''] The string to pad.
14670 * @param {number} [length=0] The padding length.
14671 * @param {string} [chars=' '] The string used as padding.
14672 * @returns {string} Returns the padded string.
14673 * @example
14674 *
14675 * _.pad('abc', 8);
14676 * // => ' abc '
14677 *
14678 * _.pad('abc', 8, '_-');
14679 * // => '_-abc_-_'
14680 *
14681 * _.pad('abc', 3);
14682 * // => 'abc'
14683 */
14684 function pad(string, length, chars) {
14685 string = toString(string);
14686 length = toInteger(length);
14687 var strLength = length ? stringSize(string) : 0;
14688 if (!length || strLength >= length) return string;
14689 var mid = (length - strLength) / 2;
14690 return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
14691 }
14692 /**
14693 * Pads `string` on the right side if it's shorter than `length`. Padding
14694 * characters are truncated if they exceed `length`.
14695 *
14696 * @static
14697 * @memberOf _
14698 * @since 4.0.0
14699 * @category String
14700 * @param {string} [string=''] The string to pad.
14701 * @param {number} [length=0] The padding length.
14702 * @param {string} [chars=' '] The string used as padding.
14703 * @returns {string} Returns the padded string.
14704 * @example
14705 *
14706 * _.padEnd('abc', 6);
14707 * // => 'abc '
14708 *
14709 * _.padEnd('abc', 6, '_-');
14710 * // => 'abc_-_'
14711 *
14712 * _.padEnd('abc', 3);
14713 * // => 'abc'
14714 */
14715 function padEnd(string, length, chars) {
14716 string = toString(string);
14717 length = toInteger(length);
14718 var strLength = length ? stringSize(string) : 0;
14719 return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
14720 }
14721 /**
14722 * Pads `string` on the left side if it's shorter than `length`. Padding
14723 * characters are truncated if they exceed `length`.
14724 *
14725 * @static
14726 * @memberOf _
14727 * @since 4.0.0
14728 * @category String
14729 * @param {string} [string=''] The string to pad.
14730 * @param {number} [length=0] The padding length.
14731 * @param {string} [chars=' '] The string used as padding.
14732 * @returns {string} Returns the padded string.
14733 * @example
14734 *
14735 * _.padStart('abc', 6);
14736 * // => ' abc'
14737 *
14738 * _.padStart('abc', 6, '_-');
14739 * // => '_-_abc'
14740 *
14741 * _.padStart('abc', 3);
14742 * // => 'abc'
14743 */
14744 function padStart(string, length, chars) {
14745 string = toString(string);
14746 length = toInteger(length);
14747 var strLength = length ? stringSize(string) : 0;
14748 return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
14749 }
14750 /**
14751 * Converts `string` to an integer of the specified radix. If `radix` is
14752 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
14753 * hexadecimal, in which case a `radix` of `16` is used.
14754 *
14755 * **Note:** This method aligns with the
14756 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
14757 *
14758 * @static
14759 * @memberOf _
14760 * @since 1.1.0
14761 * @category String
14762 * @param {string} string The string to convert.
14763 * @param {number} [radix=10] The radix to interpret `value` by.
14764 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14765 * @returns {number} Returns the converted integer.
14766 * @example
14767 *
14768 * _.parseInt('08');
14769 * // => 8
14770 *
14771 * _.map(['6', '08', '10'], _.parseInt);
14772 * // => [6, 8, 10]
14773 */
14774 function parseInt(string, radix, guard) {
14775 if (guard || radix == null) radix = 0;
14776 else if (radix) radix = +radix;
14777 return nativeParseInt(toString(string).replace(reTrimStart, ""), radix || 0);
14778 }
14779 /**
14780 * Repeats the given string `n` times.
14781 *
14782 * @static
14783 * @memberOf _
14784 * @since 3.0.0
14785 * @category String
14786 * @param {string} [string=''] The string to repeat.
14787 * @param {number} [n=1] The number of times to repeat the string.
14788 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14789 * @returns {string} Returns the repeated string.
14790 * @example
14791 *
14792 * _.repeat('*', 3);
14793 * // => '***'
14794 *
14795 * _.repeat('abc', 2);
14796 * // => 'abcabc'
14797 *
14798 * _.repeat('abc', 0);
14799 * // => ''
14800 */
14801 function repeat(string, n, guard) {
14802 if (guard ? isIterateeCall(string, n, guard) : n === undefined) n = 1;
14803 else n = toInteger(n);
14804 return baseRepeat(toString(string), n);
14805 }
14806 /**
14807 * Replaces matches for `pattern` in `string` with `replacement`.
14808 *
14809 * **Note:** This method is based on
14810 * [`String#replace`](https://mdn.io/String/replace).
14811 *
14812 * @static
14813 * @memberOf _
14814 * @since 4.0.0
14815 * @category String
14816 * @param {string} [string=''] The string to modify.
14817 * @param {RegExp|string} pattern The pattern to replace.
14818 * @param {Function|string} replacement The match replacement.
14819 * @returns {string} Returns the modified string.
14820 * @example
14821 *
14822 * _.replace('Hi Fred', 'Fred', 'Barney');
14823 * // => 'Hi Barney'
14824 */
14825 function replace() {
14826 var args = arguments;
14827 var string = toString(args[0]);
14828 return args.length < 3 ? string : string.replace(args[1], args[2]);
14829 }
14830 /**
14831 * Converts `string` to
14832 * [snake case](https://en.wikipedia.org/wiki/Snake_case).
14833 *
14834 * @static
14835 * @memberOf _
14836 * @since 3.0.0
14837 * @category String
14838 * @param {string} [string=''] The string to convert.
14839 * @returns {string} Returns the snake cased string.
14840 * @example
14841 *
14842 * _.snakeCase('Foo Bar');
14843 * // => 'foo_bar'
14844 *
14845 * _.snakeCase('fooBar');
14846 * // => 'foo_bar'
14847 *
14848 * _.snakeCase('--FOO-BAR--');
14849 * // => 'foo_bar'
14850 */
14851 var snakeCase = createCompounder(function(result, word, index) {
14852 return result + (index ? "_" : "") + word.toLowerCase();
14853 });
14854 /**
14855 * Splits `string` by `separator`.
14856 *
14857 * **Note:** This method is based on
14858 * [`String#split`](https://mdn.io/String/split).
14859 *
14860 * @static
14861 * @memberOf _
14862 * @since 4.0.0
14863 * @category String
14864 * @param {string} [string=''] The string to split.
14865 * @param {RegExp|string} separator The separator pattern to split by.
14866 * @param {number} [limit] The length to truncate results to.
14867 * @returns {Array} Returns the string segments.
14868 * @example
14869 *
14870 * _.split('a-b-c', '-', 2);
14871 * // => ['a', 'b']
14872 */
14873 function split(string, separator, limit) {
14874 if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) separator = limit = undefined;
14875 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
14876 if (!limit) return [];
14877 string = toString(string);
14878 if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
14879 separator = baseToString(separator);
14880 if (!separator && hasUnicode(string)) return castSlice(stringToArray(string), 0, limit);
14881 }
14882 return string.split(separator, limit);
14883 }
14884 /**
14885 * Converts `string` to
14886 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
14887 *
14888 * @static
14889 * @memberOf _
14890 * @since 3.1.0
14891 * @category String
14892 * @param {string} [string=''] The string to convert.
14893 * @returns {string} Returns the start cased string.
14894 * @example
14895 *
14896 * _.startCase('--foo-bar--');
14897 * // => 'Foo Bar'
14898 *
14899 * _.startCase('fooBar');
14900 * // => 'Foo Bar'
14901 *
14902 * _.startCase('__FOO_BAR__');
14903 * // => 'FOO BAR'
14904 */
14905 var startCase = createCompounder(function(result, word, index) {
14906 return result + (index ? " " : "") + upperFirst(word);
14907 });
14908 /**
14909 * Checks if `string` starts with the given target string.
14910 *
14911 * @static
14912 * @memberOf _
14913 * @since 3.0.0
14914 * @category String
14915 * @param {string} [string=''] The string to inspect.
14916 * @param {string} [target] The string to search for.
14917 * @param {number} [position=0] The position to search from.
14918 * @returns {boolean} Returns `true` if `string` starts with `target`,
14919 * else `false`.
14920 * @example
14921 *
14922 * _.startsWith('abc', 'a');
14923 * // => true
14924 *
14925 * _.startsWith('abc', 'b');
14926 * // => false
14927 *
14928 * _.startsWith('abc', 'b', 1);
14929 * // => true
14930 */
14931 function startsWith(string, target, position) {
14932 string = toString(string);
14933 position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
14934 target = baseToString(target);
14935 return string.slice(position, position + target.length) == target;
14936 }
14937 /**
14938 * Creates a compiled template function that can interpolate data properties
14939 * in "interpolate" delimiters, HTML-escape interpolated data properties in
14940 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
14941 * properties may be accessed as free variables in the template. If a setting
14942 * object is given, it takes precedence over `_.templateSettings` values.
14943 *
14944 * **Security:** `_.template` is insecure and should not be used. It will be
14945 * removed in Lodash v5. Avoid untrusted input. See
14946 * [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md).
14947 *
14948 * **Note:** In the development build `_.template` utilizes
14949 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
14950 * for easier debugging.
14951 *
14952 * For more information on precompiling templates see
14953 * [lodash's custom builds documentation](https://lodash.com/custom-builds).
14954 *
14955 * For more information on Chrome extension sandboxes see
14956 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
14957 *
14958 * @static
14959 * @since 0.1.0
14960 * @memberOf _
14961 * @category String
14962 * @param {string} [string=''] The template string.
14963 * @param {Object} [options={}] The options object.
14964 * @param {RegExp} [options.escape=_.templateSettings.escape]
14965 * The HTML "escape" delimiter.
14966 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
14967 * The "evaluate" delimiter.
14968 * @param {Object} [options.imports=_.templateSettings.imports]
14969 * An object to import into the template as free variables.
14970 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
14971 * The "interpolate" delimiter.
14972 * @param {string} [options.sourceURL='lodash.templateSources[n]']
14973 * The sourceURL of the compiled template.
14974 * @param {string} [options.variable='obj']
14975 * The data object variable name.
14976 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
14977 * @returns {Function} Returns the compiled template function.
14978 * @example
14979 *
14980 * // Use the "interpolate" delimiter to create a compiled template.
14981 * var compiled = _.template('hello <%= user %>!');
14982 * compiled({ 'user': 'fred' });
14983 * // => 'hello fred!'
14984 *
14985 * // Use the HTML "escape" delimiter to escape data property values.
14986 * var compiled = _.template('<b><%- value %></b>');
14987 * compiled({ 'value': '<script>' });
14988 * // => '<b>&lt;script&gt;</b>'
14989 *
14990 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
14991 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
14992 * compiled({ 'users': ['fred', 'barney'] });
14993 * // => '<li>fred</li><li>barney</li>'
14994 *
14995 * // Use the internal `print` function in "evaluate" delimiters.
14996 * var compiled = _.template('<% print("hello " + user); %>!');
14997 * compiled({ 'user': 'barney' });
14998 * // => 'hello barney!'
14999 *
15000 * // Use the ES template literal delimiter as an "interpolate" delimiter.
15001 * // Disable support by replacing the "interpolate" delimiter.
15002 * var compiled = _.template('hello ${ user }!');
15003 * compiled({ 'user': 'pebbles' });
15004 * // => 'hello pebbles!'
15005 *
15006 * // Use backslashes to treat delimiters as plain text.
15007 * var compiled = _.template('<%= "\\<%- value %\\>" %>');
15008 * compiled({ 'value': 'ignored' });
15009 * // => '<%- value %>'
15010 *
15011 * // Use the `imports` option to import `jQuery` as `jq`.
15012 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
15013 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
15014 * compiled({ 'users': ['fred', 'barney'] });
15015 * // => '<li>fred</li><li>barney</li>'
15016 *
15017 * // Use the `sourceURL` option to specify a custom sourceURL for the template.
15018 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
15019 * compiled(data);
15020 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
15021 *
15022 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
15023 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
15024 * compiled.source;
15025 * // => function(data) {
15026 * // var __t, __p = '';
15027 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
15028 * // return __p;
15029 * // }
15030 *
15031 * // Use custom template delimiters.
15032 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
15033 * var compiled = _.template('hello {{ user }}!');
15034 * compiled({ 'user': 'mustache' });
15035 * // => 'hello mustache!'
15036 *
15037 * // Use the `source` property to inline compiled templates for meaningful
15038 * // line numbers in error messages and stack traces.
15039 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
15040 * var JST = {\
15041 * "main": ' + _.template(mainText).source + '\
15042 * };\
15043 * ');
15044 */
15045 function template(string, options, guard) {
15046 var settings = lodash.templateSettings;
15047 if (guard && isIterateeCall(string, options, guard)) options = undefined;
15048 string = toString(string);
15049 options = assignWith({}, options, settings, customDefaultsAssignIn);
15050 var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn);
15051 var importsKeys = keys(imports);
15052 var importsValues = baseValues(imports, importsKeys);
15053 arrayEach(importsKeys, function(key) {
15054 if (reForbiddenIdentifierChars.test(key)) throw new Error(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
15055 });
15056 var isEscaping;
15057 var isEvaluating;
15058 var index = 0;
15059 var interpolate = options.interpolate || reNoMatch;
15060 var source = "__p += '";
15061 var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
15062 var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
15063 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
15064 interpolateValue || (interpolateValue = esTemplateValue);
15065 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
15066 if (escapeValue) {
15067 isEscaping = true;
15068 source += "' +\n__e(" + escapeValue + ") +\n'";
15069 }
15070 if (evaluateValue) {
15071 isEvaluating = true;
15072 source += "';\n" + evaluateValue + ";\n__p += '";
15073 }
15074 if (interpolateValue) source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
15075 index = offset + match.length;
15076 return match;
15077 });
15078 source += "';\n";
15079 var variable = hasOwnProperty.call(options, "variable") && options.variable;
15080 if (!variable) source = "with (obj) {\n" + source + "\n}\n";
15081 else if (reForbiddenIdentifierChars.test(variable)) throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
15082 source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
15083 source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
15084 var result = attempt(function() {
15085 return Function(importsKeys, sourceURL + "return " + source).apply(undefined, importsValues);
15086 });
15087 result.source = source;
15088 if (isError(result)) throw result;
15089 return result;
15090 }
15091 /**
15092 * Converts `string`, as a whole, to lower case just like
15093 * [String#toLowerCase](https://mdn.io/toLowerCase).
15094 *
15095 * @static
15096 * @memberOf _
15097 * @since 4.0.0
15098 * @category String
15099 * @param {string} [string=''] The string to convert.
15100 * @returns {string} Returns the lower cased string.
15101 * @example
15102 *
15103 * _.toLower('--Foo-Bar--');
15104 * // => '--foo-bar--'
15105 *
15106 * _.toLower('fooBar');
15107 * // => 'foobar'
15108 *
15109 * _.toLower('__FOO_BAR__');
15110 * // => '__foo_bar__'
15111 */
15112 function toLower(value) {
15113 return toString(value).toLowerCase();
15114 }
15115 /**
15116 * Converts `string`, as a whole, to upper case just like
15117 * [String#toUpperCase](https://mdn.io/toUpperCase).
15118 *
15119 * @static
15120 * @memberOf _
15121 * @since 4.0.0
15122 * @category String
15123 * @param {string} [string=''] The string to convert.
15124 * @returns {string} Returns the upper cased string.
15125 * @example
15126 *
15127 * _.toUpper('--foo-bar--');
15128 * // => '--FOO-BAR--'
15129 *
15130 * _.toUpper('fooBar');
15131 * // => 'FOOBAR'
15132 *
15133 * _.toUpper('__foo_bar__');
15134 * // => '__FOO_BAR__'
15135 */
15136 function toUpper(value) {
15137 return toString(value).toUpperCase();
15138 }
15139 /**
15140 * Removes leading and trailing whitespace or specified characters from `string`.
15141 *
15142 * @static
15143 * @memberOf _
15144 * @since 3.0.0
15145 * @category String
15146 * @param {string} [string=''] The string to trim.
15147 * @param {string} [chars=whitespace] The characters to trim.
15148 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15149 * @returns {string} Returns the trimmed string.
15150 * @example
15151 *
15152 * _.trim(' abc ');
15153 * // => 'abc'
15154 *
15155 * _.trim('-_-abc-_-', '_-');
15156 * // => 'abc'
15157 *
15158 * _.map([' foo ', ' bar '], _.trim);
15159 * // => ['foo', 'bar']
15160 */
15161 function trim(string, chars, guard) {
15162 string = toString(string);
15163 if (string && (guard || chars === undefined)) return baseTrim(string);
15164 if (!string || !(chars = baseToString(chars))) return string;
15165 var strSymbols = stringToArray(string);
15166 var chrSymbols = stringToArray(chars);
15167 return castSlice(strSymbols, charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1).join("");
15168 }
15169 /**
15170 * Removes trailing whitespace or specified characters from `string`.
15171 *
15172 * @static
15173 * @memberOf _
15174 * @since 4.0.0
15175 * @category String
15176 * @param {string} [string=''] The string to trim.
15177 * @param {string} [chars=whitespace] The characters to trim.
15178 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15179 * @returns {string} Returns the trimmed string.
15180 * @example
15181 *
15182 * _.trimEnd(' abc ');
15183 * // => ' abc'
15184 *
15185 * _.trimEnd('-_-abc-_-', '_-');
15186 * // => '-_-abc'
15187 */
15188 function trimEnd(string, chars, guard) {
15189 string = toString(string);
15190 if (string && (guard || chars === undefined)) return string.slice(0, trimmedEndIndex(string) + 1);
15191 if (!string || !(chars = baseToString(chars))) return string;
15192 var strSymbols = stringToArray(string);
15193 return castSlice(strSymbols, 0, charsEndIndex(strSymbols, stringToArray(chars)) + 1).join("");
15194 }
15195 /**
15196 * Removes leading whitespace or specified characters from `string`.
15197 *
15198 * @static
15199 * @memberOf _
15200 * @since 4.0.0
15201 * @category String
15202 * @param {string} [string=''] The string to trim.
15203 * @param {string} [chars=whitespace] The characters to trim.
15204 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15205 * @returns {string} Returns the trimmed string.
15206 * @example
15207 *
15208 * _.trimStart(' abc ');
15209 * // => 'abc '
15210 *
15211 * _.trimStart('-_-abc-_-', '_-');
15212 * // => 'abc-_-'
15213 */
15214 function trimStart(string, chars, guard) {
15215 string = toString(string);
15216 if (string && (guard || chars === undefined)) return string.replace(reTrimStart, "");
15217 if (!string || !(chars = baseToString(chars))) return string;
15218 var strSymbols = stringToArray(string);
15219 return castSlice(strSymbols, charsStartIndex(strSymbols, stringToArray(chars))).join("");
15220 }
15221 /**
15222 * Truncates `string` if it's longer than the given maximum string length.
15223 * The last characters of the truncated string are replaced with the omission
15224 * string which defaults to "...".
15225 *
15226 * @static
15227 * @memberOf _
15228 * @since 4.0.0
15229 * @category String
15230 * @param {string} [string=''] The string to truncate.
15231 * @param {Object} [options={}] The options object.
15232 * @param {number} [options.length=30] The maximum string length.
15233 * @param {string} [options.omission='...'] The string to indicate text is omitted.
15234 * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
15235 * @returns {string} Returns the truncated string.
15236 * @example
15237 *
15238 * _.truncate('hi-diddly-ho there, neighborino');
15239 * // => 'hi-diddly-ho there, neighbo...'
15240 *
15241 * _.truncate('hi-diddly-ho there, neighborino', {
15242 * 'length': 24,
15243 * 'separator': ' '
15244 * });
15245 * // => 'hi-diddly-ho there,...'
15246 *
15247 * _.truncate('hi-diddly-ho there, neighborino', {
15248 * 'length': 24,
15249 * 'separator': /,? +/
15250 * });
15251 * // => 'hi-diddly-ho there...'
15252 *
15253 * _.truncate('hi-diddly-ho there, neighborino', {
15254 * 'omission': ' [...]'
15255 * });
15256 * // => 'hi-diddly-ho there, neig [...]'
15257 */
15258 function truncate(string, options) {
15259 var length = DEFAULT_TRUNC_LENGTH;
15260 var omission = DEFAULT_TRUNC_OMISSION;
15261 if (isObject(options)) {
15262 var separator = "separator" in options ? options.separator : separator;
15263 length = "length" in options ? toInteger(options.length) : length;
15264 omission = "omission" in options ? baseToString(options.omission) : omission;
15265 }
15266 string = toString(string);
15267 var strLength = string.length;
15268 if (hasUnicode(string)) {
15269 var strSymbols = stringToArray(string);
15270 strLength = strSymbols.length;
15271 }
15272 if (length >= strLength) return string;
15273 var end = length - stringSize(omission);
15274 if (end < 1) return omission;
15275 var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
15276 if (separator === undefined) return result + omission;
15277 if (strSymbols) end += result.length - end;
15278 if (isRegExp(separator)) {
15279 if (string.slice(end).search(separator)) {
15280 var match;
15281 var substring = result;
15282 if (!separator.global) separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
15283 separator.lastIndex = 0;
15284 while (match = separator.exec(substring)) var newEnd = match.index;
15285 result = result.slice(0, newEnd === undefined ? end : newEnd);
15286 }
15287 } else if (string.indexOf(baseToString(separator), end) != end) {
15288 var index = result.lastIndexOf(separator);
15289 if (index > -1) result = result.slice(0, index);
15290 }
15291 return result + omission;
15292 }
15293 /**
15294 * The inverse of `_.escape`; this method converts the HTML entities
15295 * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
15296 * their corresponding characters.
15297 *
15298 * **Note:** No other HTML entities are unescaped. To unescape additional
15299 * HTML entities use a third-party library like [_he_](https://mths.be/he).
15300 *
15301 * @static
15302 * @memberOf _
15303 * @since 0.6.0
15304 * @category String
15305 * @param {string} [string=''] The string to unescape.
15306 * @returns {string} Returns the unescaped string.
15307 * @example
15308 *
15309 * _.unescape('fred, barney, &amp; pebbles');
15310 * // => 'fred, barney, & pebbles'
15311 */
15312 function unescape(string) {
15313 string = toString(string);
15314 return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
15315 }
15316 /**
15317 * Converts `string`, as space separated words, to upper case.
15318 *
15319 * @static
15320 * @memberOf _
15321 * @since 4.0.0
15322 * @category String
15323 * @param {string} [string=''] The string to convert.
15324 * @returns {string} Returns the upper cased string.
15325 * @example
15326 *
15327 * _.upperCase('--foo-bar');
15328 * // => 'FOO BAR'
15329 *
15330 * _.upperCase('fooBar');
15331 * // => 'FOO BAR'
15332 *
15333 * _.upperCase('__foo_bar__');
15334 * // => 'FOO BAR'
15335 */
15336 var upperCase = createCompounder(function(result, word, index) {
15337 return result + (index ? " " : "") + word.toUpperCase();
15338 });
15339 /**
15340 * Converts the first character of `string` to upper case.
15341 *
15342 * @static
15343 * @memberOf _
15344 * @since 4.0.0
15345 * @category String
15346 * @param {string} [string=''] The string to convert.
15347 * @returns {string} Returns the converted string.
15348 * @example
15349 *
15350 * _.upperFirst('fred');
15351 * // => 'Fred'
15352 *
15353 * _.upperFirst('FRED');
15354 * // => 'FRED'
15355 */
15356 var upperFirst = createCaseFirst("toUpperCase");
15357 /**
15358 * Splits `string` into an array of its words.
15359 *
15360 * @static
15361 * @memberOf _
15362 * @since 3.0.0
15363 * @category String
15364 * @param {string} [string=''] The string to inspect.
15365 * @param {RegExp|string} [pattern] The pattern to match words.
15366 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
15367 * @returns {Array} Returns the words of `string`.
15368 * @example
15369 *
15370 * _.words('fred, barney, & pebbles');
15371 * // => ['fred', 'barney', 'pebbles']
15372 *
15373 * _.words('fred, barney, & pebbles', /[^, ]+/g);
15374 * // => ['fred', 'barney', '&', 'pebbles']
15375 */
15376 function words(string, pattern, guard) {
15377 string = toString(string);
15378 pattern = guard ? undefined : pattern;
15379 if (pattern === undefined) return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
15380 return string.match(pattern) || [];
15381 }
15382 /**
15383 * Attempts to invoke `func`, returning either the result or the caught error
15384 * object. Any additional arguments are provided to `func` when it's invoked.
15385 *
15386 * @static
15387 * @memberOf _
15388 * @since 3.0.0
15389 * @category Util
15390 * @param {Function} func The function to attempt.
15391 * @param {...*} [args] The arguments to invoke `func` with.
15392 * @returns {*} Returns the `func` result or error object.
15393 * @example
15394 *
15395 * // Avoid throwing errors for invalid selectors.
15396 * var elements = _.attempt(function(selector) {
15397 * return document.querySelectorAll(selector);
15398 * }, '>_>');
15399 *
15400 * if (_.isError(elements)) {
15401 * elements = [];
15402 * }
15403 */
15404 var attempt = baseRest(function(func, args) {
15405 try {
15406 return apply(func, undefined, args);
15407 } catch (e) {
15408 return isError(e) ? e : new Error(e);
15409 }
15410 });
15411 /**
15412 * Binds methods of an object to the object itself, overwriting the existing
15413 * method.
15414 *
15415 * **Note:** This method doesn't set the "length" property of bound functions.
15416 *
15417 * @static
15418 * @since 0.1.0
15419 * @memberOf _
15420 * @category Util
15421 * @param {Object} object The object to bind and assign the bound methods to.
15422 * @param {...(string|string[])} methodNames The object method names to bind.
15423 * @returns {Object} Returns `object`.
15424 * @example
15425 *
15426 * var view = {
15427 * 'label': 'docs',
15428 * 'click': function() {
15429 * console.log('clicked ' + this.label);
15430 * }
15431 * };
15432 *
15433 * _.bindAll(view, ['click']);
15434 * jQuery(element).on('click', view.click);
15435 * // => Logs 'clicked docs' when clicked.
15436 */
15437 var bindAll = flatRest(function(object, methodNames) {
15438 arrayEach(methodNames, function(key) {
15439 key = toKey(key);
15440 baseAssignValue(object, key, bind(object[key], object));
15441 });
15442 return object;
15443 });
15444 /**
15445 * Creates a function that iterates over `pairs` and invokes the corresponding
15446 * function of the first predicate to return truthy. The predicate-function
15447 * pairs are invoked with the `this` binding and arguments of the created
15448 * function.
15449 *
15450 * @static
15451 * @memberOf _
15452 * @since 4.0.0
15453 * @category Util
15454 * @param {Array} pairs The predicate-function pairs.
15455 * @returns {Function} Returns the new composite function.
15456 * @example
15457 *
15458 * var func = _.cond([
15459 * [_.matches({ 'a': 1 }), _.constant('matches A')],
15460 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
15461 * [_.stubTrue, _.constant('no match')]
15462 * ]);
15463 *
15464 * func({ 'a': 1, 'b': 2 });
15465 * // => 'matches A'
15466 *
15467 * func({ 'a': 0, 'b': 1 });
15468 * // => 'matches B'
15469 *
15470 * func({ 'a': '1', 'b': '2' });
15471 * // => 'no match'
15472 */
15473 function cond(pairs) {
15474 var length = pairs == null ? 0 : pairs.length;
15475 var toIteratee = getIteratee();
15476 pairs = !length ? [] : arrayMap(pairs, function(pair) {
15477 if (typeof pair[1] != "function") throw new TypeError(FUNC_ERROR_TEXT);
15478 return [toIteratee(pair[0]), pair[1]];
15479 });
15480 return baseRest(function(args) {
15481 var index = -1;
15482 while (++index < length) {
15483 var pair = pairs[index];
15484 if (apply(pair[0], this, args)) return apply(pair[1], this, args);
15485 }
15486 });
15487 }
15488 /**
15489 * Creates a function that invokes the predicate properties of `source` with
15490 * the corresponding property values of a given object, returning `true` if
15491 * all predicates return truthy, else `false`.
15492 *
15493 * **Note:** The created function is equivalent to `_.conformsTo` with
15494 * `source` partially applied.
15495 *
15496 * @static
15497 * @memberOf _
15498 * @since 4.0.0
15499 * @category Util
15500 * @param {Object} source The object of property predicates to conform to.
15501 * @returns {Function} Returns the new spec function.
15502 * @example
15503 *
15504 * var objects = [
15505 * { 'a': 2, 'b': 1 },
15506 * { 'a': 1, 'b': 2 }
15507 * ];
15508 *
15509 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
15510 * // => [{ 'a': 1, 'b': 2 }]
15511 */
15512 function conforms(source) {
15513 return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
15514 }
15515 /**
15516 * Creates a function that returns `value`.
15517 *
15518 * @static
15519 * @memberOf _
15520 * @since 2.4.0
15521 * @category Util
15522 * @param {*} value The value to return from the new function.
15523 * @returns {Function} Returns the new constant function.
15524 * @example
15525 *
15526 * var objects = _.times(2, _.constant({ 'a': 1 }));
15527 *
15528 * console.log(objects);
15529 * // => [{ 'a': 1 }, { 'a': 1 }]
15530 *
15531 * console.log(objects[0] === objects[1]);
15532 * // => true
15533 */
15534 function constant(value) {
15535 return function() {
15536 return value;
15537 };
15538 }
15539 /**
15540 * Checks `value` to determine whether a default value should be returned in
15541 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
15542 * or `undefined`.
15543 *
15544 * @static
15545 * @memberOf _
15546 * @since 4.14.0
15547 * @category Util
15548 * @param {*} value The value to check.
15549 * @param {*} defaultValue The default value.
15550 * @returns {*} Returns the resolved value.
15551 * @example
15552 *
15553 * _.defaultTo(1, 10);
15554 * // => 1
15555 *
15556 * _.defaultTo(undefined, 10);
15557 * // => 10
15558 */
15559 function defaultTo(value, defaultValue) {
15560 return value == null || value !== value ? defaultValue : value;
15561 }
15562 /**
15563 * Creates a function that returns the result of invoking the given functions
15564 * with the `this` binding of the created function, where each successive
15565 * invocation is supplied the return value of the previous.
15566 *
15567 * @static
15568 * @memberOf _
15569 * @since 3.0.0
15570 * @category Util
15571 * @param {...(Function|Function[])} [funcs] The functions to invoke.
15572 * @returns {Function} Returns the new composite function.
15573 * @see _.flowRight
15574 * @example
15575 *
15576 * function square(n) {
15577 * return n * n;
15578 * }
15579 *
15580 * var addSquare = _.flow([_.add, square]);
15581 * addSquare(1, 2);
15582 * // => 9
15583 */
15584 var flow = createFlow();
15585 /**
15586 * This method is like `_.flow` except that it creates a function that
15587 * invokes the given functions from right to left.
15588 *
15589 * @static
15590 * @since 3.0.0
15591 * @memberOf _
15592 * @category Util
15593 * @param {...(Function|Function[])} [funcs] The functions to invoke.
15594 * @returns {Function} Returns the new composite function.
15595 * @see _.flow
15596 * @example
15597 *
15598 * function square(n) {
15599 * return n * n;
15600 * }
15601 *
15602 * var addSquare = _.flowRight([square, _.add]);
15603 * addSquare(1, 2);
15604 * // => 9
15605 */
15606 var flowRight = createFlow(true);
15607 /**
15608 * This method returns the first argument it receives.
15609 *
15610 * @static
15611 * @since 0.1.0
15612 * @memberOf _
15613 * @category Util
15614 * @param {*} value Any value.
15615 * @returns {*} Returns `value`.
15616 * @example
15617 *
15618 * var object = { 'a': 1 };
15619 *
15620 * console.log(_.identity(object) === object);
15621 * // => true
15622 */
15623 function identity(value) {
15624 return value;
15625 }
15626 /**
15627 * Creates a function that invokes `func` with the arguments of the created
15628 * function. If `func` is a property name, the created function returns the
15629 * property value for a given element. If `func` is an array or object, the
15630 * created function returns `true` for elements that contain the equivalent
15631 * source properties, otherwise it returns `false`.
15632 *
15633 * @static
15634 * @since 4.0.0
15635 * @memberOf _
15636 * @category Util
15637 * @param {*} [func=_.identity] The value to convert to a callback.
15638 * @returns {Function} Returns the callback.
15639 * @example
15640 *
15641 * var users = [
15642 * { 'user': 'barney', 'age': 36, 'active': true },
15643 * { 'user': 'fred', 'age': 40, 'active': false }
15644 * ];
15645 *
15646 * // The `_.matches` iteratee shorthand.
15647 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
15648 * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
15649 *
15650 * // The `_.matchesProperty` iteratee shorthand.
15651 * _.filter(users, _.iteratee(['user', 'fred']));
15652 * // => [{ 'user': 'fred', 'age': 40 }]
15653 *
15654 * // The `_.property` iteratee shorthand.
15655 * _.map(users, _.iteratee('user'));
15656 * // => ['barney', 'fred']
15657 *
15658 * // Create custom iteratee shorthands.
15659 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
15660 * return !_.isRegExp(func) ? iteratee(func) : function(string) {
15661 * return func.test(string);
15662 * };
15663 * });
15664 *
15665 * _.filter(['abc', 'def'], /ef/);
15666 * // => ['def']
15667 */
15668 function iteratee(func) {
15669 return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
15670 }
15671 /**
15672 * Creates a function that performs a partial deep comparison between a given
15673 * object and `source`, returning `true` if the given object has equivalent
15674 * property values, else `false`.
15675 *
15676 * **Note:** The created function is equivalent to `_.isMatch` with `source`
15677 * partially applied.
15678 *
15679 * Partial comparisons will match empty array and empty object `source`
15680 * values against any array or object value, respectively. See `_.isEqual`
15681 * for a list of supported value comparisons.
15682 *
15683 * **Note:** Multiple values can be checked by combining several matchers
15684 * using `_.overSome`
15685 *
15686 * @static
15687 * @memberOf _
15688 * @since 3.0.0
15689 * @category Util
15690 * @param {Object} source The object of property values to match.
15691 * @returns {Function} Returns the new spec function.
15692 * @example
15693 *
15694 * var objects = [
15695 * { 'a': 1, 'b': 2, 'c': 3 },
15696 * { 'a': 4, 'b': 5, 'c': 6 }
15697 * ];
15698 *
15699 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
15700 * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
15701 *
15702 * // Checking for several possible values
15703 * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
15704 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
15705 */
15706 function matches(source) {
15707 return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
15708 }
15709 /**
15710 * Creates a function that performs a partial deep comparison between the
15711 * value at `path` of a given object to `srcValue`, returning `true` if the
15712 * object value is equivalent, else `false`.
15713 *
15714 * **Note:** Partial comparisons will match empty array and empty object
15715 * `srcValue` values against any array or object value, respectively. See
15716 * `_.isEqual` for a list of supported value comparisons.
15717 *
15718 * **Note:** Multiple values can be checked by combining several matchers
15719 * using `_.overSome`
15720 *
15721 * @static
15722 * @memberOf _
15723 * @since 3.2.0
15724 * @category Util
15725 * @param {Array|string} path The path of the property to get.
15726 * @param {*} srcValue The value to match.
15727 * @returns {Function} Returns the new spec function.
15728 * @example
15729 *
15730 * var objects = [
15731 * { 'a': 1, 'b': 2, 'c': 3 },
15732 * { 'a': 4, 'b': 5, 'c': 6 }
15733 * ];
15734 *
15735 * _.find(objects, _.matchesProperty('a', 4));
15736 * // => { 'a': 4, 'b': 5, 'c': 6 }
15737 *
15738 * // Checking for several possible values
15739 * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
15740 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
15741 */
15742 function matchesProperty(path, srcValue) {
15743 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
15744 }
15745 /**
15746 * Creates a function that invokes the method at `path` of a given object.
15747 * Any additional arguments are provided to the invoked method.
15748 *
15749 * @static
15750 * @memberOf _
15751 * @since 3.7.0
15752 * @category Util
15753 * @param {Array|string} path The path of the method to invoke.
15754 * @param {...*} [args] The arguments to invoke the method with.
15755 * @returns {Function} Returns the new invoker function.
15756 * @example
15757 *
15758 * var objects = [
15759 * { 'a': { 'b': _.constant(2) } },
15760 * { 'a': { 'b': _.constant(1) } }
15761 * ];
15762 *
15763 * _.map(objects, _.method('a.b'));
15764 * // => [2, 1]
15765 *
15766 * _.map(objects, _.method(['a', 'b']));
15767 * // => [2, 1]
15768 */
15769 var method = baseRest(function(path, args) {
15770 return function(object) {
15771 return baseInvoke(object, path, args);
15772 };
15773 });
15774 /**
15775 * The opposite of `_.method`; this method creates a function that invokes
15776 * the method at a given path of `object`. Any additional arguments are
15777 * provided to the invoked method.
15778 *
15779 * @static
15780 * @memberOf _
15781 * @since 3.7.0
15782 * @category Util
15783 * @param {Object} object The object to query.
15784 * @param {...*} [args] The arguments to invoke the method with.
15785 * @returns {Function} Returns the new invoker function.
15786 * @example
15787 *
15788 * var array = _.times(3, _.constant),
15789 * object = { 'a': array, 'b': array, 'c': array };
15790 *
15791 * _.map(['a[2]', 'c[0]'], _.methodOf(object));
15792 * // => [2, 0]
15793 *
15794 * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
15795 * // => [2, 0]
15796 */
15797 var methodOf = baseRest(function(object, args) {
15798 return function(path) {
15799 return baseInvoke(object, path, args);
15800 };
15801 });
15802 /**
15803 * Adds all own enumerable string keyed function properties of a source
15804 * object to the destination object. If `object` is a function, then methods
15805 * are added to its prototype as well.
15806 *
15807 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
15808 * avoid conflicts caused by modifying the original.
15809 *
15810 * @static
15811 * @since 0.1.0
15812 * @memberOf _
15813 * @category Util
15814 * @param {Function|Object} [object=lodash] The destination object.
15815 * @param {Object} source The object of functions to add.
15816 * @param {Object} [options={}] The options object.
15817 * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
15818 * @returns {Function|Object} Returns `object`.
15819 * @example
15820 *
15821 * function vowels(string) {
15822 * return _.filter(string, function(v) {
15823 * return /[aeiou]/i.test(v);
15824 * });
15825 * }
15826 *
15827 * _.mixin({ 'vowels': vowels });
15828 * _.vowels('fred');
15829 * // => ['e']
15830 *
15831 * _('fred').vowels().value();
15832 * // => ['e']
15833 *
15834 * _.mixin({ 'vowels': vowels }, { 'chain': false });
15835 * _('fred').vowels();
15836 * // => ['e']
15837 */
15838 function mixin(object, source, options) {
15839 var props = keys(source);
15840 var methodNames = baseFunctions(source, props);
15841 if (options == null && !(isObject(source) && (methodNames.length || !props.length))) {
15842 options = source;
15843 source = object;
15844 object = this;
15845 methodNames = baseFunctions(source, keys(source));
15846 }
15847 var chain = !(isObject(options) && "chain" in options) || !!options.chain;
15848 var isFunc = isFunction(object);
15849 arrayEach(methodNames, function(methodName) {
15850 var func = source[methodName];
15851 object[methodName] = func;
15852 if (isFunc) object.prototype[methodName] = function() {
15853 var chainAll = this.__chain__;
15854 if (chain || chainAll) {
15855 var result = object(this.__wrapped__);
15856 (result.__actions__ = copyArray(this.__actions__)).push({
15857 "func": func,
15858 "args": arguments,
15859 "thisArg": object
15860 });
15861 result.__chain__ = chainAll;
15862 return result;
15863 }
15864 return func.apply(object, arrayPush([this.value()], arguments));
15865 };
15866 });
15867 return object;
15868 }
15869 /**
15870 * Reverts the `_` variable to its previous value and returns a reference to
15871 * the `lodash` function.
15872 *
15873 * @static
15874 * @since 0.1.0
15875 * @memberOf _
15876 * @category Util
15877 * @returns {Function} Returns the `lodash` function.
15878 * @example
15879 *
15880 * var lodash = _.noConflict();
15881 */
15882 function noConflict() {
15883 if (root._ === this) root._ = oldDash;
15884 return this;
15885 }
15886 /**
15887 * This method returns `undefined`.
15888 *
15889 * @static
15890 * @memberOf _
15891 * @since 2.3.0
15892 * @category Util
15893 * @example
15894 *
15895 * _.times(2, _.noop);
15896 * // => [undefined, undefined]
15897 */
15898 function noop() {}
15899 /**
15900 * Creates a function that gets the argument at index `n`. If `n` is negative,
15901 * the nth argument from the end is returned.
15902 *
15903 * @static
15904 * @memberOf _
15905 * @since 4.0.0
15906 * @category Util
15907 * @param {number} [n=0] The index of the argument to return.
15908 * @returns {Function} Returns the new pass-thru function.
15909 * @example
15910 *
15911 * var func = _.nthArg(1);
15912 * func('a', 'b', 'c', 'd');
15913 * // => 'b'
15914 *
15915 * var func = _.nthArg(-2);
15916 * func('a', 'b', 'c', 'd');
15917 * // => 'c'
15918 */
15919 function nthArg(n) {
15920 n = toInteger(n);
15921 return baseRest(function(args) {
15922 return baseNth(args, n);
15923 });
15924 }
15925 /**
15926 * Creates a function that invokes `iteratees` with the arguments it receives
15927 * and returns their results.
15928 *
15929 * @static
15930 * @memberOf _
15931 * @since 4.0.0
15932 * @category Util
15933 * @param {...(Function|Function[])} [iteratees=[_.identity]]
15934 * The iteratees to invoke.
15935 * @returns {Function} Returns the new function.
15936 * @example
15937 *
15938 * var func = _.over([Math.max, Math.min]);
15939 *
15940 * func(1, 2, 3, 4);
15941 * // => [4, 1]
15942 */
15943 var over = createOver(arrayMap);
15944 /**
15945 * Creates a function that checks if **all** of the `predicates` return
15946 * truthy when invoked with the arguments it receives.
15947 *
15948 * Following shorthands are possible for providing predicates.
15949 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
15950 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
15951 *
15952 * @static
15953 * @memberOf _
15954 * @since 4.0.0
15955 * @category Util
15956 * @param {...(Function|Function[])} [predicates=[_.identity]]
15957 * The predicates to check.
15958 * @returns {Function} Returns the new function.
15959 * @example
15960 *
15961 * var func = _.overEvery([Boolean, isFinite]);
15962 *
15963 * func('1');
15964 * // => true
15965 *
15966 * func(null);
15967 * // => false
15968 *
15969 * func(NaN);
15970 * // => false
15971 */
15972 var overEvery = createOver(arrayEvery);
15973 /**
15974 * Creates a function that checks if **any** of the `predicates` return
15975 * truthy when invoked with the arguments it receives.
15976 *
15977 * Following shorthands are possible for providing predicates.
15978 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
15979 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
15980 *
15981 * @static
15982 * @memberOf _
15983 * @since 4.0.0
15984 * @category Util
15985 * @param {...(Function|Function[])} [predicates=[_.identity]]
15986 * The predicates to check.
15987 * @returns {Function} Returns the new function.
15988 * @example
15989 *
15990 * var func = _.overSome([Boolean, isFinite]);
15991 *
15992 * func('1');
15993 * // => true
15994 *
15995 * func(null);
15996 * // => true
15997 *
15998 * func(NaN);
15999 * // => false
16000 *
16001 * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
16002 * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
16003 */
16004 var overSome = createOver(arraySome);
16005 /**
16006 * Creates a function that returns the value at `path` of a given object.
16007 *
16008 * @static
16009 * @memberOf _
16010 * @since 2.4.0
16011 * @category Util
16012 * @param {Array|string} path The path of the property to get.
16013 * @returns {Function} Returns the new accessor function.
16014 * @example
16015 *
16016 * var objects = [
16017 * { 'a': { 'b': 2 } },
16018 * { 'a': { 'b': 1 } }
16019 * ];
16020 *
16021 * _.map(objects, _.property('a.b'));
16022 * // => [2, 1]
16023 *
16024 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
16025 * // => [1, 2]
16026 */
16027 function property(path) {
16028 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
16029 }
16030 /**
16031 * The opposite of `_.property`; this method creates a function that returns
16032 * the value at a given path of `object`.
16033 *
16034 * @static
16035 * @memberOf _
16036 * @since 3.0.0
16037 * @category Util
16038 * @param {Object} object The object to query.
16039 * @returns {Function} Returns the new accessor function.
16040 * @example
16041 *
16042 * var array = [0, 1, 2],
16043 * object = { 'a': array, 'b': array, 'c': array };
16044 *
16045 * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
16046 * // => [2, 0]
16047 *
16048 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
16049 * // => [2, 0]
16050 */
16051 function propertyOf(object) {
16052 return function(path) {
16053 return object == null ? undefined : baseGet(object, path);
16054 };
16055 }
16056 /**
16057 * Creates an array of numbers (positive and/or negative) progressing from
16058 * `start` up to, but not including, `end`. A step of `-1` is used if a negative
16059 * `start` is specified without an `end` or `step`. If `end` is not specified,
16060 * it's set to `start` with `start` then set to `0`.
16061 *
16062 * **Note:** JavaScript follows the IEEE-754 standard for resolving
16063 * floating-point values which can produce unexpected results.
16064 *
16065 * @static
16066 * @since 0.1.0
16067 * @memberOf _
16068 * @category Util
16069 * @param {number} [start=0] The start of the range.
16070 * @param {number} end The end of the range.
16071 * @param {number} [step=1] The value to increment or decrement by.
16072 * @returns {Array} Returns the range of numbers.
16073 * @see _.inRange, _.rangeRight
16074 * @example
16075 *
16076 * _.range(4);
16077 * // => [0, 1, 2, 3]
16078 *
16079 * _.range(-4);
16080 * // => [0, -1, -2, -3]
16081 *
16082 * _.range(1, 5);
16083 * // => [1, 2, 3, 4]
16084 *
16085 * _.range(0, 20, 5);
16086 * // => [0, 5, 10, 15]
16087 *
16088 * _.range(0, -4, -1);
16089 * // => [0, -1, -2, -3]
16090 *
16091 * _.range(1, 4, 0);
16092 * // => [1, 1, 1]
16093 *
16094 * _.range(0);
16095 * // => []
16096 */
16097 var range = createRange();
16098 /**
16099 * This method is like `_.range` except that it populates values in
16100 * descending order.
16101 *
16102 * @static
16103 * @memberOf _
16104 * @since 4.0.0
16105 * @category Util
16106 * @param {number} [start=0] The start of the range.
16107 * @param {number} end The end of the range.
16108 * @param {number} [step=1] The value to increment or decrement by.
16109 * @returns {Array} Returns the range of numbers.
16110 * @see _.inRange, _.range
16111 * @example
16112 *
16113 * _.rangeRight(4);
16114 * // => [3, 2, 1, 0]
16115 *
16116 * _.rangeRight(-4);
16117 * // => [-3, -2, -1, 0]
16118 *
16119 * _.rangeRight(1, 5);
16120 * // => [4, 3, 2, 1]
16121 *
16122 * _.rangeRight(0, 20, 5);
16123 * // => [15, 10, 5, 0]
16124 *
16125 * _.rangeRight(0, -4, -1);
16126 * // => [-3, -2, -1, 0]
16127 *
16128 * _.rangeRight(1, 4, 0);
16129 * // => [1, 1, 1]
16130 *
16131 * _.rangeRight(0);
16132 * // => []
16133 */
16134 var rangeRight = createRange(true);
16135 /**
16136 * This method returns a new empty array.
16137 *
16138 * @static
16139 * @memberOf _
16140 * @since 4.13.0
16141 * @category Util
16142 * @returns {Array} Returns the new empty array.
16143 * @example
16144 *
16145 * var arrays = _.times(2, _.stubArray);
16146 *
16147 * console.log(arrays);
16148 * // => [[], []]
16149 *
16150 * console.log(arrays[0] === arrays[1]);
16151 * // => false
16152 */
16153 function stubArray() {
16154 return [];
16155 }
16156 /**
16157 * This method returns `false`.
16158 *
16159 * @static
16160 * @memberOf _
16161 * @since 4.13.0
16162 * @category Util
16163 * @returns {boolean} Returns `false`.
16164 * @example
16165 *
16166 * _.times(2, _.stubFalse);
16167 * // => [false, false]
16168 */
16169 function stubFalse() {
16170 return false;
16171 }
16172 /**
16173 * This method returns a new empty object.
16174 *
16175 * @static
16176 * @memberOf _
16177 * @since 4.13.0
16178 * @category Util
16179 * @returns {Object} Returns the new empty object.
16180 * @example
16181 *
16182 * var objects = _.times(2, _.stubObject);
16183 *
16184 * console.log(objects);
16185 * // => [{}, {}]
16186 *
16187 * console.log(objects[0] === objects[1]);
16188 * // => false
16189 */
16190 function stubObject() {
16191 return {};
16192 }
16193 /**
16194 * This method returns an empty string.
16195 *
16196 * @static
16197 * @memberOf _
16198 * @since 4.13.0
16199 * @category Util
16200 * @returns {string} Returns the empty string.
16201 * @example
16202 *
16203 * _.times(2, _.stubString);
16204 * // => ['', '']
16205 */
16206 function stubString() {
16207 return "";
16208 }
16209 /**
16210 * This method returns `true`.
16211 *
16212 * @static
16213 * @memberOf _
16214 * @since 4.13.0
16215 * @category Util
16216 * @returns {boolean} Returns `true`.
16217 * @example
16218 *
16219 * _.times(2, _.stubTrue);
16220 * // => [true, true]
16221 */
16222 function stubTrue() {
16223 return true;
16224 }
16225 /**
16226 * Invokes the iteratee `n` times, returning an array of the results of
16227 * each invocation. The iteratee is invoked with one argument; (index).
16228 *
16229 * @static
16230 * @since 0.1.0
16231 * @memberOf _
16232 * @category Util
16233 * @param {number} n The number of times to invoke `iteratee`.
16234 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
16235 * @returns {Array} Returns the array of results.
16236 * @example
16237 *
16238 * _.times(3, String);
16239 * // => ['0', '1', '2']
16240 *
16241 * _.times(4, _.constant(0));
16242 * // => [0, 0, 0, 0]
16243 */
16244 function times(n, iteratee) {
16245 n = toInteger(n);
16246 if (n < 1 || n > MAX_SAFE_INTEGER) return [];
16247 var index = MAX_ARRAY_LENGTH;
16248 var length = nativeMin(n, MAX_ARRAY_LENGTH);
16249 iteratee = getIteratee(iteratee);
16250 n -= MAX_ARRAY_LENGTH;
16251 var result = baseTimes(length, iteratee);
16252 while (++index < n) iteratee(index);
16253 return result;
16254 }
16255 /**
16256 * Converts `value` to a property path array.
16257 *
16258 * @static
16259 * @memberOf _
16260 * @since 4.0.0
16261 * @category Util
16262 * @param {*} value The value to convert.
16263 * @returns {Array} Returns the new property path array.
16264 * @example
16265 *
16266 * _.toPath('a.b.c');
16267 * // => ['a', 'b', 'c']
16268 *
16269 * _.toPath('a[0].b.c');
16270 * // => ['a', '0', 'b', 'c']
16271 */
16272 function toPath(value) {
16273 if (isArray(value)) return arrayMap(value, toKey);
16274 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
16275 }
16276 /**
16277 * Generates a unique ID. If `prefix` is given, the ID is appended to it.
16278 *
16279 * @static
16280 * @since 0.1.0
16281 * @memberOf _
16282 * @category Util
16283 * @param {string} [prefix=''] The value to prefix the ID with.
16284 * @returns {string} Returns the unique ID.
16285 * @example
16286 *
16287 * _.uniqueId('contact_');
16288 * // => 'contact_104'
16289 *
16290 * _.uniqueId();
16291 * // => '105'
16292 */
16293 function uniqueId(prefix) {
16294 var id = ++idCounter;
16295 return toString(prefix) + id;
16296 }
16297 /**
16298 * Adds two numbers.
16299 *
16300 * @static
16301 * @memberOf _
16302 * @since 3.4.0
16303 * @category Math
16304 * @param {number} augend The first number in an addition.
16305 * @param {number} addend The second number in an addition.
16306 * @returns {number} Returns the total.
16307 * @example
16308 *
16309 * _.add(6, 4);
16310 * // => 10
16311 */
16312 var add = createMathOperation(function(augend, addend) {
16313 return augend + addend;
16314 }, 0);
16315 /**
16316 * Computes `number` rounded up to `precision`.
16317 *
16318 * @static
16319 * @memberOf _
16320 * @since 3.10.0
16321 * @category Math
16322 * @param {number} number The number to round up.
16323 * @param {number} [precision=0] The precision to round up to.
16324 * @returns {number} Returns the rounded up number.
16325 * @example
16326 *
16327 * _.ceil(4.006);
16328 * // => 5
16329 *
16330 * _.ceil(6.004, 2);
16331 * // => 6.01
16332 *
16333 * _.ceil(6040, -2);
16334 * // => 6100
16335 */
16336 var ceil = createRound("ceil");
16337 /**
16338 * Divide two numbers.
16339 *
16340 * @static
16341 * @memberOf _
16342 * @since 4.7.0
16343 * @category Math
16344 * @param {number} dividend The first number in a division.
16345 * @param {number} divisor The second number in a division.
16346 * @returns {number} Returns the quotient.
16347 * @example
16348 *
16349 * _.divide(6, 4);
16350 * // => 1.5
16351 */
16352 var divide = createMathOperation(function(dividend, divisor) {
16353 return dividend / divisor;
16354 }, 1);
16355 /**
16356 * Computes `number` rounded down to `precision`.
16357 *
16358 * @static
16359 * @memberOf _
16360 * @since 3.10.0
16361 * @category Math
16362 * @param {number} number The number to round down.
16363 * @param {number} [precision=0] The precision to round down to.
16364 * @returns {number} Returns the rounded down number.
16365 * @example
16366 *
16367 * _.floor(4.006);
16368 * // => 4
16369 *
16370 * _.floor(0.046, 2);
16371 * // => 0.04
16372 *
16373 * _.floor(4060, -2);
16374 * // => 4000
16375 */
16376 var floor = createRound("floor");
16377 /**
16378 * Computes the maximum value of `array`. If `array` is empty or falsey,
16379 * `undefined` is returned.
16380 *
16381 * @static
16382 * @since 0.1.0
16383 * @memberOf _
16384 * @category Math
16385 * @param {Array} array The array to iterate over.
16386 * @returns {*} Returns the maximum value.
16387 * @example
16388 *
16389 * _.max([4, 2, 8, 6]);
16390 * // => 8
16391 *
16392 * _.max([]);
16393 * // => undefined
16394 */
16395 function max(array) {
16396 return array && array.length ? baseExtremum(array, identity, baseGt) : undefined;
16397 }
16398 /**
16399 * This method is like `_.max` except that it accepts `iteratee` which is
16400 * invoked for each element in `array` to generate the criterion by which
16401 * the value is ranked. The iteratee is invoked with one argument: (value).
16402 *
16403 * @static
16404 * @memberOf _
16405 * @since 4.0.0
16406 * @category Math
16407 * @param {Array} array The array to iterate over.
16408 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16409 * @returns {*} Returns the maximum value.
16410 * @example
16411 *
16412 * var objects = [{ 'n': 1 }, { 'n': 2 }];
16413 *
16414 * _.maxBy(objects, function(o) { return o.n; });
16415 * // => { 'n': 2 }
16416 *
16417 * // The `_.property` iteratee shorthand.
16418 * _.maxBy(objects, 'n');
16419 * // => { 'n': 2 }
16420 */
16421 function maxBy(array, iteratee) {
16422 return array && array.length ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) : undefined;
16423 }
16424 /**
16425 * Computes the mean of the values in `array`.
16426 *
16427 * @static
16428 * @memberOf _
16429 * @since 4.0.0
16430 * @category Math
16431 * @param {Array} array The array to iterate over.
16432 * @returns {number} Returns the mean.
16433 * @example
16434 *
16435 * _.mean([4, 2, 8, 6]);
16436 * // => 5
16437 */
16438 function mean(array) {
16439 return baseMean(array, identity);
16440 }
16441 /**
16442 * This method is like `_.mean` except that it accepts `iteratee` which is
16443 * invoked for each element in `array` to generate the value to be averaged.
16444 * The iteratee is invoked with one argument: (value).
16445 *
16446 * @static
16447 * @memberOf _
16448 * @since 4.7.0
16449 * @category Math
16450 * @param {Array} array The array to iterate over.
16451 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16452 * @returns {number} Returns the mean.
16453 * @example
16454 *
16455 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
16456 *
16457 * _.meanBy(objects, function(o) { return o.n; });
16458 * // => 5
16459 *
16460 * // The `_.property` iteratee shorthand.
16461 * _.meanBy(objects, 'n');
16462 * // => 5
16463 */
16464 function meanBy(array, iteratee) {
16465 return baseMean(array, getIteratee(iteratee, 2));
16466 }
16467 /**
16468 * Computes the minimum value of `array`. If `array` is empty or falsey,
16469 * `undefined` is returned.
16470 *
16471 * @static
16472 * @since 0.1.0
16473 * @memberOf _
16474 * @category Math
16475 * @param {Array} array The array to iterate over.
16476 * @returns {*} Returns the minimum value.
16477 * @example
16478 *
16479 * _.min([4, 2, 8, 6]);
16480 * // => 2
16481 *
16482 * _.min([]);
16483 * // => undefined
16484 */
16485 function min(array) {
16486 return array && array.length ? baseExtremum(array, identity, baseLt) : undefined;
16487 }
16488 /**
16489 * This method is like `_.min` except that it accepts `iteratee` which is
16490 * invoked for each element in `array` to generate the criterion by which
16491 * the value is ranked. The iteratee is invoked with one argument: (value).
16492 *
16493 * @static
16494 * @memberOf _
16495 * @since 4.0.0
16496 * @category Math
16497 * @param {Array} array The array to iterate over.
16498 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16499 * @returns {*} Returns the minimum value.
16500 * @example
16501 *
16502 * var objects = [{ 'n': 1 }, { 'n': 2 }];
16503 *
16504 * _.minBy(objects, function(o) { return o.n; });
16505 * // => { 'n': 1 }
16506 *
16507 * // The `_.property` iteratee shorthand.
16508 * _.minBy(objects, 'n');
16509 * // => { 'n': 1 }
16510 */
16511 function minBy(array, iteratee) {
16512 return array && array.length ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) : undefined;
16513 }
16514 /**
16515 * Multiply two numbers.
16516 *
16517 * @static
16518 * @memberOf _
16519 * @since 4.7.0
16520 * @category Math
16521 * @param {number} multiplier The first number in a multiplication.
16522 * @param {number} multiplicand The second number in a multiplication.
16523 * @returns {number} Returns the product.
16524 * @example
16525 *
16526 * _.multiply(6, 4);
16527 * // => 24
16528 */
16529 var multiply = createMathOperation(function(multiplier, multiplicand) {
16530 return multiplier * multiplicand;
16531 }, 1);
16532 /**
16533 * Computes `number` rounded to `precision`.
16534 *
16535 * @static
16536 * @memberOf _
16537 * @since 3.10.0
16538 * @category Math
16539 * @param {number} number The number to round.
16540 * @param {number} [precision=0] The precision to round to.
16541 * @returns {number} Returns the rounded number.
16542 * @example
16543 *
16544 * _.round(4.006);
16545 * // => 4
16546 *
16547 * _.round(4.006, 2);
16548 * // => 4.01
16549 *
16550 * _.round(4060, -2);
16551 * // => 4100
16552 */
16553 var round = createRound("round");
16554 /**
16555 * Subtract two numbers.
16556 *
16557 * @static
16558 * @memberOf _
16559 * @since 4.0.0
16560 * @category Math
16561 * @param {number} minuend The first number in a subtraction.
16562 * @param {number} subtrahend The second number in a subtraction.
16563 * @returns {number} Returns the difference.
16564 * @example
16565 *
16566 * _.subtract(6, 4);
16567 * // => 2
16568 */
16569 var subtract = createMathOperation(function(minuend, subtrahend) {
16570 return minuend - subtrahend;
16571 }, 0);
16572 /**
16573 * Computes the sum of the values in `array`.
16574 *
16575 * @static
16576 * @memberOf _
16577 * @since 3.4.0
16578 * @category Math
16579 * @param {Array} array The array to iterate over.
16580 * @returns {number} Returns the sum.
16581 * @example
16582 *
16583 * _.sum([4, 2, 8, 6]);
16584 * // => 20
16585 */
16586 function sum(array) {
16587 return array && array.length ? baseSum(array, identity) : 0;
16588 }
16589 /**
16590 * This method is like `_.sum` except that it accepts `iteratee` which is
16591 * invoked for each element in `array` to generate the value to be summed.
16592 * The iteratee is invoked with one argument: (value).
16593 *
16594 * @static
16595 * @memberOf _
16596 * @since 4.0.0
16597 * @category Math
16598 * @param {Array} array The array to iterate over.
16599 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
16600 * @returns {number} Returns the sum.
16601 * @example
16602 *
16603 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
16604 *
16605 * _.sumBy(objects, function(o) { return o.n; });
16606 * // => 20
16607 *
16608 * // The `_.property` iteratee shorthand.
16609 * _.sumBy(objects, 'n');
16610 * // => 20
16611 */
16612 function sumBy(array, iteratee) {
16613 return array && array.length ? baseSum(array, getIteratee(iteratee, 2)) : 0;
16614 }
16615 lodash.after = after;
16616 lodash.ary = ary;
16617 lodash.assign = assign;
16618 lodash.assignIn = assignIn;
16619 lodash.assignInWith = assignInWith;
16620 lodash.assignWith = assignWith;
16621 lodash.at = at;
16622 lodash.before = before;
16623 lodash.bind = bind;
16624 lodash.bindAll = bindAll;
16625 lodash.bindKey = bindKey;
16626 lodash.castArray = castArray;
16627 lodash.chain = chain;
16628 lodash.chunk = chunk;
16629 lodash.compact = compact;
16630 lodash.concat = concat;
16631 lodash.cond = cond;
16632 lodash.conforms = conforms;
16633 lodash.constant = constant;
16634 lodash.countBy = countBy;
16635 lodash.create = create;
16636 lodash.curry = curry;
16637 lodash.curryRight = curryRight;
16638 lodash.debounce = debounce;
16639 lodash.defaults = defaults;
16640 lodash.defaultsDeep = defaultsDeep;
16641 lodash.defer = defer;
16642 lodash.delay = delay;
16643 lodash.difference = difference;
16644 lodash.differenceBy = differenceBy;
16645 lodash.differenceWith = differenceWith;
16646 lodash.drop = drop;
16647 lodash.dropRight = dropRight;
16648 lodash.dropRightWhile = dropRightWhile;
16649 lodash.dropWhile = dropWhile;
16650 lodash.fill = fill;
16651 lodash.filter = filter;
16652 lodash.flatMap = flatMap;
16653 lodash.flatMapDeep = flatMapDeep;
16654 lodash.flatMapDepth = flatMapDepth;
16655 lodash.flatten = flatten;
16656 lodash.flattenDeep = flattenDeep;
16657 lodash.flattenDepth = flattenDepth;
16658 lodash.flip = flip;
16659 lodash.flow = flow;
16660 lodash.flowRight = flowRight;
16661 lodash.fromPairs = fromPairs;
16662 lodash.functions = functions;
16663 lodash.functionsIn = functionsIn;
16664 lodash.groupBy = groupBy;
16665 lodash.initial = initial;
16666 lodash.intersection = intersection;
16667 lodash.intersectionBy = intersectionBy;
16668 lodash.intersectionWith = intersectionWith;
16669 lodash.invert = invert;
16670 lodash.invertBy = invertBy;
16671 lodash.invokeMap = invokeMap;
16672 lodash.iteratee = iteratee;
16673 lodash.keyBy = keyBy;
16674 lodash.keys = keys;
16675 lodash.keysIn = keysIn;
16676 lodash.map = map;
16677 lodash.mapKeys = mapKeys;
16678 lodash.mapValues = mapValues;
16679 lodash.matches = matches;
16680 lodash.matchesProperty = matchesProperty;
16681 lodash.memoize = memoize;
16682 lodash.merge = merge;
16683 lodash.mergeWith = mergeWith;
16684 lodash.method = method;
16685 lodash.methodOf = methodOf;
16686 lodash.mixin = mixin;
16687 lodash.negate = negate;
16688 lodash.nthArg = nthArg;
16689 lodash.omit = omit;
16690 lodash.omitBy = omitBy;
16691 lodash.once = once;
16692 lodash.orderBy = orderBy;
16693 lodash.over = over;
16694 lodash.overArgs = overArgs;
16695 lodash.overEvery = overEvery;
16696 lodash.overSome = overSome;
16697 lodash.partial = partial;
16698 lodash.partialRight = partialRight;
16699 lodash.partition = partition;
16700 lodash.pick = pick;
16701 lodash.pickBy = pickBy;
16702 lodash.property = property;
16703 lodash.propertyOf = propertyOf;
16704 lodash.pull = pull;
16705 lodash.pullAll = pullAll;
16706 lodash.pullAllBy = pullAllBy;
16707 lodash.pullAllWith = pullAllWith;
16708 lodash.pullAt = pullAt;
16709 lodash.range = range;
16710 lodash.rangeRight = rangeRight;
16711 lodash.rearg = rearg;
16712 lodash.reject = reject;
16713 lodash.remove = remove;
16714 lodash.rest = rest;
16715 lodash.reverse = reverse;
16716 lodash.sampleSize = sampleSize;
16717 lodash.set = set;
16718 lodash.setWith = setWith;
16719 lodash.shuffle = shuffle;
16720 lodash.slice = slice;
16721 lodash.sortBy = sortBy;
16722 lodash.sortedUniq = sortedUniq;
16723 lodash.sortedUniqBy = sortedUniqBy;
16724 lodash.split = split;
16725 lodash.spread = spread;
16726 lodash.tail = tail;
16727 lodash.take = take;
16728 lodash.takeRight = takeRight;
16729 lodash.takeRightWhile = takeRightWhile;
16730 lodash.takeWhile = takeWhile;
16731 lodash.tap = tap;
16732 lodash.throttle = throttle;
16733 lodash.thru = thru;
16734 lodash.toArray = toArray;
16735 lodash.toPairs = toPairs;
16736 lodash.toPairsIn = toPairsIn;
16737 lodash.toPath = toPath;
16738 lodash.toPlainObject = toPlainObject;
16739 lodash.transform = transform;
16740 lodash.unary = unary;
16741 lodash.union = union;
16742 lodash.unionBy = unionBy;
16743 lodash.unionWith = unionWith;
16744 lodash.uniq = uniq;
16745 lodash.uniqBy = uniqBy;
16746 lodash.uniqWith = uniqWith;
16747 lodash.unset = unset;
16748 lodash.unzip = unzip;
16749 lodash.unzipWith = unzipWith;
16750 lodash.update = update;
16751 lodash.updateWith = updateWith;
16752 lodash.values = values;
16753 lodash.valuesIn = valuesIn;
16754 lodash.without = without;
16755 lodash.words = words;
16756 lodash.wrap = wrap;
16757 lodash.xor = xor;
16758 lodash.xorBy = xorBy;
16759 lodash.xorWith = xorWith;
16760 lodash.zip = zip;
16761 lodash.zipObject = zipObject;
16762 lodash.zipObjectDeep = zipObjectDeep;
16763 lodash.zipWith = zipWith;
16764 lodash.entries = toPairs;
16765 lodash.entriesIn = toPairsIn;
16766 lodash.extend = assignIn;
16767 lodash.extendWith = assignInWith;
16768 mixin(lodash, lodash);
16769 lodash.add = add;
16770 lodash.attempt = attempt;
16771 lodash.camelCase = camelCase;
16772 lodash.capitalize = capitalize;
16773 lodash.ceil = ceil;
16774 lodash.clamp = clamp;
16775 lodash.clone = clone;
16776 lodash.cloneDeep = cloneDeep;
16777 lodash.cloneDeepWith = cloneDeepWith;
16778 lodash.cloneWith = cloneWith;
16779 lodash.conformsTo = conformsTo;
16780 lodash.deburr = deburr;
16781 lodash.defaultTo = defaultTo;
16782 lodash.divide = divide;
16783 lodash.endsWith = endsWith;
16784 lodash.eq = eq;
16785 lodash.escape = escape;
16786 lodash.escapeRegExp = escapeRegExp;
16787 lodash.every = every;
16788 lodash.find = find;
16789 lodash.findIndex = findIndex;
16790 lodash.findKey = findKey;
16791 lodash.findLast = findLast;
16792 lodash.findLastIndex = findLastIndex;
16793 lodash.findLastKey = findLastKey;
16794 lodash.floor = floor;
16795 lodash.forEach = forEach;
16796 lodash.forEachRight = forEachRight;
16797 lodash.forIn = forIn;
16798 lodash.forInRight = forInRight;
16799 lodash.forOwn = forOwn;
16800 lodash.forOwnRight = forOwnRight;
16801 lodash.get = get;
16802 lodash.gt = gt;
16803 lodash.gte = gte;
16804 lodash.has = has;
16805 lodash.hasIn = hasIn;
16806 lodash.head = head;
16807 lodash.identity = identity;
16808 lodash.includes = includes;
16809 lodash.indexOf = indexOf;
16810 lodash.inRange = inRange;
16811 lodash.invoke = invoke;
16812 lodash.isArguments = isArguments;
16813 lodash.isArray = isArray;
16814 lodash.isArrayBuffer = isArrayBuffer;
16815 lodash.isArrayLike = isArrayLike;
16816 lodash.isArrayLikeObject = isArrayLikeObject;
16817 lodash.isBoolean = isBoolean;
16818 lodash.isBuffer = isBuffer;
16819 lodash.isDate = isDate;
16820 lodash.isElement = isElement;
16821 lodash.isEmpty = isEmpty;
16822 lodash.isEqual = isEqual;
16823 lodash.isEqualWith = isEqualWith;
16824 lodash.isError = isError;
16825 lodash.isFinite = isFinite;
16826 lodash.isFunction = isFunction;
16827 lodash.isInteger = isInteger;
16828 lodash.isLength = isLength;
16829 lodash.isMap = isMap;
16830 lodash.isMatch = isMatch;
16831 lodash.isMatchWith = isMatchWith;
16832 lodash.isNaN = isNaN;
16833 lodash.isNative = isNative;
16834 lodash.isNil = isNil;
16835 lodash.isNull = isNull;
16836 lodash.isNumber = isNumber;
16837 lodash.isObject = isObject;
16838 lodash.isObjectLike = isObjectLike;
16839 lodash.isPlainObject = isPlainObject;
16840 lodash.isRegExp = isRegExp;
16841 lodash.isSafeInteger = isSafeInteger;
16842 lodash.isSet = isSet;
16843 lodash.isString = isString;
16844 lodash.isSymbol = isSymbol;
16845 lodash.isTypedArray = isTypedArray;
16846 lodash.isUndefined = isUndefined;
16847 lodash.isWeakMap = isWeakMap;
16848 lodash.isWeakSet = isWeakSet;
16849 lodash.join = join;
16850 lodash.kebabCase = kebabCase;
16851 lodash.last = last;
16852 lodash.lastIndexOf = lastIndexOf;
16853 lodash.lowerCase = lowerCase;
16854 lodash.lowerFirst = lowerFirst;
16855 lodash.lt = lt;
16856 lodash.lte = lte;
16857 lodash.max = max;
16858 lodash.maxBy = maxBy;
16859 lodash.mean = mean;
16860 lodash.meanBy = meanBy;
16861 lodash.min = min;
16862 lodash.minBy = minBy;
16863 lodash.stubArray = stubArray;
16864 lodash.stubFalse = stubFalse;
16865 lodash.stubObject = stubObject;
16866 lodash.stubString = stubString;
16867 lodash.stubTrue = stubTrue;
16868 lodash.multiply = multiply;
16869 lodash.nth = nth;
16870 lodash.noConflict = noConflict;
16871 lodash.noop = noop;
16872 lodash.now = now;
16873 lodash.pad = pad;
16874 lodash.padEnd = padEnd;
16875 lodash.padStart = padStart;
16876 lodash.parseInt = parseInt;
16877 lodash.random = random;
16878 lodash.reduce = reduce;
16879 lodash.reduceRight = reduceRight;
16880 lodash.repeat = repeat;
16881 lodash.replace = replace;
16882 lodash.result = result;
16883 lodash.round = round;
16884 lodash.runInContext = runInContext;
16885 lodash.sample = sample;
16886 lodash.size = size;
16887 lodash.snakeCase = snakeCase;
16888 lodash.some = some;
16889 lodash.sortedIndex = sortedIndex;
16890 lodash.sortedIndexBy = sortedIndexBy;
16891 lodash.sortedIndexOf = sortedIndexOf;
16892 lodash.sortedLastIndex = sortedLastIndex;
16893 lodash.sortedLastIndexBy = sortedLastIndexBy;
16894 lodash.sortedLastIndexOf = sortedLastIndexOf;
16895 lodash.startCase = startCase;
16896 lodash.startsWith = startsWith;
16897 lodash.subtract = subtract;
16898 lodash.sum = sum;
16899 lodash.sumBy = sumBy;
16900 lodash.template = template;
16901 lodash.times = times;
16902 lodash.toFinite = toFinite;
16903 lodash.toInteger = toInteger;
16904 lodash.toLength = toLength;
16905 lodash.toLower = toLower;
16906 lodash.toNumber = toNumber;
16907 lodash.toSafeInteger = toSafeInteger;
16908 lodash.toString = toString;
16909 lodash.toUpper = toUpper;
16910 lodash.trim = trim;
16911 lodash.trimEnd = trimEnd;
16912 lodash.trimStart = trimStart;
16913 lodash.truncate = truncate;
16914 lodash.unescape = unescape;
16915 lodash.uniqueId = uniqueId;
16916 lodash.upperCase = upperCase;
16917 lodash.upperFirst = upperFirst;
16918 lodash.each = forEach;
16919 lodash.eachRight = forEachRight;
16920 lodash.first = head;
16921 mixin(lodash, function() {
16922 var source = {};
16923 baseForOwn(lodash, function(func, methodName) {
16924 if (!hasOwnProperty.call(lodash.prototype, methodName)) source[methodName] = func;
16925 });
16926 return source;
16927 }(), { "chain": false });
16928 /**
16929 * The semantic version number.
16930 *
16931 * @static
16932 * @memberOf _
16933 * @type {string}
16934 */
16935 lodash.VERSION = VERSION;
16936 arrayEach([
16937 "bind",
16938 "bindKey",
16939 "curry",
16940 "curryRight",
16941 "partial",
16942 "partialRight"
16943 ], function(methodName) {
16944 lodash[methodName].placeholder = lodash;
16945 });
16946 arrayEach(["drop", "take"], function(methodName, index) {
16947 LazyWrapper.prototype[methodName] = function(n) {
16948 n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
16949 var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
16950 if (result.__filtered__) result.__takeCount__ = nativeMin(n, result.__takeCount__);
16951 else result.__views__.push({
16952 "size": nativeMin(n, MAX_ARRAY_LENGTH),
16953 "type": methodName + (result.__dir__ < 0 ? "Right" : "")
16954 });
16955 return result;
16956 };
16957 LazyWrapper.prototype[methodName + "Right"] = function(n) {
16958 return this.reverse()[methodName](n).reverse();
16959 };
16960 });
16961 arrayEach([
16962 "filter",
16963 "map",
16964 "takeWhile"
16965 ], function(methodName, index) {
16966 var type = index + 1;
16967 var isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
16968 LazyWrapper.prototype[methodName] = function(iteratee) {
16969 var result = this.clone();
16970 result.__iteratees__.push({
16971 "iteratee": getIteratee(iteratee, 3),
16972 "type": type
16973 });
16974 result.__filtered__ = result.__filtered__ || isFilter;
16975 return result;
16976 };
16977 });
16978 arrayEach(["head", "last"], function(methodName, index) {
16979 var takeName = "take" + (index ? "Right" : "");
16980 LazyWrapper.prototype[methodName] = function() {
16981 return this[takeName](1).value()[0];
16982 };
16983 });
16984 arrayEach(["initial", "tail"], function(methodName, index) {
16985 var dropName = "drop" + (index ? "" : "Right");
16986 LazyWrapper.prototype[methodName] = function() {
16987 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
16988 };
16989 });
16990 LazyWrapper.prototype.compact = function() {
16991 return this.filter(identity);
16992 };
16993 LazyWrapper.prototype.find = function(predicate) {
16994 return this.filter(predicate).head();
16995 };
16996 LazyWrapper.prototype.findLast = function(predicate) {
16997 return this.reverse().find(predicate);
16998 };
16999 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
17000 if (typeof path == "function") return new LazyWrapper(this);
17001 return this.map(function(value) {
17002 return baseInvoke(value, path, args);
17003 });
17004 });
17005 LazyWrapper.prototype.reject = function(predicate) {
17006 return this.filter(negate(getIteratee(predicate)));
17007 };
17008 LazyWrapper.prototype.slice = function(start, end) {
17009 start = toInteger(start);
17010 var result = this;
17011 if (result.__filtered__ && (start > 0 || end < 0)) return new LazyWrapper(result);
17012 if (start < 0) result = result.takeRight(-start);
17013 else if (start) result = result.drop(start);
17014 if (end !== undefined) {
17015 end = toInteger(end);
17016 result = end < 0 ? result.dropRight(-end) : result.take(end - start);
17017 }
17018 return result;
17019 };
17020 LazyWrapper.prototype.takeRightWhile = function(predicate) {
17021 return this.reverse().takeWhile(predicate).reverse();
17022 };
17023 LazyWrapper.prototype.toArray = function() {
17024 return this.take(MAX_ARRAY_LENGTH);
17025 };
17026 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
17027 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName);
17028 var isTaker = /^(?:head|last)$/.test(methodName);
17029 var lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName];
17030 var retUnwrapped = isTaker || /^find/.test(methodName);
17031 if (!lodashFunc) return;
17032 lodash.prototype[methodName] = function() {
17033 var value = this.__wrapped__;
17034 var args = isTaker ? [1] : arguments;
17035 var isLazy = value instanceof LazyWrapper;
17036 var iteratee = args[0];
17037 var useLazy = isLazy || isArray(value);
17038 var interceptor = function(value) {
17039 var result = lodashFunc.apply(lodash, arrayPush([value], args));
17040 return isTaker && chainAll ? result[0] : result;
17041 };
17042 if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) isLazy = useLazy = false;
17043 var chainAll = this.__chain__;
17044 var isHybrid = !!this.__actions__.length;
17045 var isUnwrapped = retUnwrapped && !chainAll;
17046 var onlyLazy = isLazy && !isHybrid;
17047 if (!retUnwrapped && useLazy) {
17048 value = onlyLazy ? value : new LazyWrapper(this);
17049 var result = func.apply(value, args);
17050 result.__actions__.push({
17051 "func": thru,
17052 "args": [interceptor],
17053 "thisArg": undefined
17054 });
17055 return new LodashWrapper(result, chainAll);
17056 }
17057 if (isUnwrapped && onlyLazy) return func.apply(this, args);
17058 result = this.thru(interceptor);
17059 return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
17060 };
17061 });
17062 arrayEach([
17063 "pop",
17064 "push",
17065 "shift",
17066 "sort",
17067 "splice",
17068 "unshift"
17069 ], function(methodName) {
17070 var func = arrayProto[methodName];
17071 var chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru";
17072 var retUnwrapped = /^(?:pop|shift)$/.test(methodName);
17073 lodash.prototype[methodName] = function() {
17074 var args = arguments;
17075 if (retUnwrapped && !this.__chain__) {
17076 var value = this.value();
17077 return func.apply(isArray(value) ? value : [], args);
17078 }
17079 return this[chainName](function(value) {
17080 return func.apply(isArray(value) ? value : [], args);
17081 });
17082 };
17083 });
17084 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
17085 var lodashFunc = lodash[methodName];
17086 if (lodashFunc) {
17087 var key = lodashFunc.name + "";
17088 if (!hasOwnProperty.call(realNames, key)) realNames[key] = [];
17089 realNames[key].push({
17090 "name": methodName,
17091 "func": lodashFunc
17092 });
17093 }
17094 });
17095 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
17096 "name": "wrapper",
17097 "func": undefined
17098 }];
17099 LazyWrapper.prototype.clone = lazyClone;
17100 LazyWrapper.prototype.reverse = lazyReverse;
17101 LazyWrapper.prototype.value = lazyValue;
17102 lodash.prototype.at = wrapperAt;
17103 lodash.prototype.chain = wrapperChain;
17104 lodash.prototype.commit = wrapperCommit;
17105 lodash.prototype.next = wrapperNext;
17106 lodash.prototype.plant = wrapperPlant;
17107 lodash.prototype.reverse = wrapperReverse;
17108 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
17109 lodash.prototype.first = lodash.prototype.head;
17110 if (symIterator) lodash.prototype[symIterator] = wrapperToIterator;
17111 return lodash;
17112 })();
17113 if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
17114 root._ = _;
17115 define(function() {
17116 return _;
17117 });
17118 } else if (freeModule) {
17119 (freeModule.exports = _)._ = _;
17120 freeExports._ = _;
17121 } else root._ = _;
17122 }).call(exports);
17123 }));
17124
17125 //#endregion
17126 //#region modules/atomic-widgets/assets/js/frontend/form-handlers.js
17127 var _excluded = ["message"];
17128 var _interopRequireDefault = require_interopRequireDefault();
17129 require_es_array_includes();
17130 require_es_array_push();
17131 require_esnext_iterator_constructor();
17132 require_esnext_iterator_every();
17133 require_esnext_iterator_filter();
17134 require_esnext_iterator_for_each();
17135 require_esnext_iterator_map();
17136 var _frontendHandlers = (globalThis.elementorV2.frontendHandlers);
17137 var _alpinejs = (globalThis.elementorV2.alpinejs);
17138 var _utils = require_utils();
17139 var _lodash = _interopRequireDefault(require_lodash());
17140 var webmcpFormListenersRegistered = false;
17141 (0, _frontendHandlers.registerBySelector)({
17142 id: "atomic-form-submit-handler",
17143 selector: _utils.ATOMIC_FORM_SELECTOR,
17144 callback: ({ element }) => handleAtomicFormSubmit(element)
17145 });
17146 function registerWebmcpFormListeners() {
17147 if (webmcpFormListenersRegistered) return;
17148 webmcpFormListenersRegistered = true;
17149 window.addEventListener("toolactivated", ({ toolName }) => {
17150 resetWebmcpFormState(toolName);
17151 });
17152 window.addEventListener("toolcancel", ({ toolName }) => {
17153 resetWebmcpFormState(toolName);
17154 });
17155 }
17156 function resetWebmcpFormState(toolName) {
17157 document.querySelectorAll(_utils.ATOMIC_FORM_SELECTOR).forEach((form) => {
17158 if (form.getAttribute("toolname") !== toolName) return;
17159 delete form.dataset.atomicFormSubmitting;
17160 form.querySelectorAll("button[type=\"submit\"], input[type=\"submit\"]").forEach((button) => {
17161 button.disabled = false;
17162 });
17163 });
17164 }
17165 function extractAgentToolData(payload) {
17166 if (!payload || "object" !== typeof payload) return null;
17167 if (void 0 !== payload.data) return payload.data;
17168 const { message: ignoredMessage } = payload, rest = _objectWithoutProperties(payload, _excluded);
17169 if (!Object.keys(rest).length) return null;
17170 return rest;
17171 }
17172 function buildAgentToolResponse(response, state) {
17173 var _response$data;
17174 var _ref;
17175 var _payload$message;
17176 const payload = (_response$data = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data !== void 0 ? _response$data : null;
17177 const message = (_ref = (_payload$message = payload === null || payload === void 0 ? void 0 : payload.message) !== null && _payload$message !== void 0 ? _payload$message : response === null || response === void 0 ? void 0 : response.message) !== null && _ref !== void 0 ? _ref : "";
17178 return {
17179 success: "success" === state,
17180 state,
17181 message,
17182 data: extractAgentToolData(payload)
17183 };
17184 }
17185 function respondToAgentIfInvoked(event, response, state) {
17186 if (!(event === null || event === void 0 ? void 0 : event.agentInvoked) || "function" !== typeof event.respondWith) return;
17187 event.respondWith(Promise.resolve(buildAgentToolResponse(response, state)));
17188 }
17189 function registerAtomicFormAlpineData(form) {
17190 var _alpinejs$Alpine;
17191 if (!form || !((_alpinejs$Alpine = _alpinejs.Alpine) === null || _alpinejs$Alpine === void 0 ? void 0 : _alpinejs$Alpine.data)) return;
17192 const alpineId = (0, _utils.getAlpineId)(form);
17193 if (!alpineId) return;
17194 _alpinejs.Alpine.data(alpineId, () => ({ submit(event) {
17195 return _asyncToGenerator(function* () {
17196 if ((0, _utils.isEditorContext)()) return;
17197 event.preventDefault();
17198 if (form.dataset.atomicFormSubmitting) {
17199 respondToAgentIfInvoked(event, {
17200 success: false,
17201 message: "Form is already submitting."
17202 }, "error");
17203 return;
17204 }
17205 form.dataset.atomicFormSubmitting = "true";
17206 const submitButtons = form.querySelectorAll("button[type=\"submit\"], input[type=\"submit\"]");
17207 submitButtons.forEach((button) => {
17208 button.disabled = true;
17209 });
17210 const payload = buildAtomicFormPayload(form);
17211 if (!payload) {
17212 setFormState(form, "error");
17213 respondToAgentIfInvoked(event, {
17214 success: false,
17215 message: "Invalid form payload."
17216 }, "error");
17217 clearAtomicFormSubmittingState(form, submitButtons);
17218 return;
17219 }
17220 try {
17221 const response = yield submitAtomicForm(payload);
17222 const state = (response === null || response === void 0 ? void 0 : response.success) ? "success" : "error";
17223 setFormState(form, state);
17224 if (response === null || response === void 0 ? void 0 : response.success) {
17225 form.reset();
17226 form.addEventListener("input", () => {
17227 setFormState(form, "default");
17228 }, { once: true });
17229 }
17230 respondToAgentIfInvoked(event, response, state);
17231 } catch (error) {
17232 var _error$message;
17233 setFormState(form, "error");
17234 respondToAgentIfInvoked(event, {
17235 success: false,
17236 message: (_error$message = error === null || error === void 0 ? void 0 : error.message) !== null && _error$message !== void 0 ? _error$message : "Submission failed."
17237 }, "error");
17238 } finally {
17239 clearAtomicFormSubmittingState(form, submitButtons);
17240 }
17241 })();
17242 } }));
17243 }
17244 function handleAtomicFormSubmit(form) {
17245 registerWebmcpFormListeners();
17246 registerAtomicFormAlpineData(form);
17247 return refreshDom(form);
17248 }
17249 function clearAtomicFormSubmittingState(form, submitButtons) {
17250 delete form.dataset.atomicFormSubmitting;
17251 submitButtons.forEach((button) => {
17252 button.disabled = false;
17253 });
17254 }
17255 function buildAtomicFormPayload(form) {
17256 const postId = (0, _utils.getPostId)(form);
17257 const formId = form.dataset.id;
17258 const formName = form.dataset.formName || "";
17259 const formFields = getAtomicFormFields(form);
17260 if (!postId || !formFields.length) return null;
17261 return {
17262 postId,
17263 formId,
17264 formName,
17265 formFields
17266 };
17267 }
17268 function getAtomicFormFields(form) {
17269 const fields = [];
17270 const allInputs = [...form.querySelectorAll(_utils.ATOMIC_FORM_FIELD_SELECTOR)].filter((input) => input.dataset.interactionId);
17271 const inputGroups = _lodash.default.groupBy(allInputs, (input) => input.getAttribute("name"));
17272 Object.entries(inputGroups).forEach(([name, inputs]) => {
17273 if (name && inputs.every((input) => "radio" === input.getAttribute("type"))) {
17274 fields.push(getGroupedFields(name, inputs, "radio", form));
17275 return;
17276 }
17277 if (name && inputs.length > 1 && inputs.every((input) => "checkbox" === input.getAttribute("type"))) {
17278 fields.push(getGroupedFields(name, inputs, "checkbox", form));
17279 return;
17280 }
17281 inputs.forEach((input) => {
17282 const id = input.dataset.interactionId;
17283 const label = getAtomicFormFieldLabel(input, form);
17284 const type = getAtomicFormFieldType(input);
17285 const value = getAtomicFormFieldValue(input, type);
17286 const options = getAtomicFieldOptions(input, type, form);
17287 fields.push({
17288 id,
17289 type,
17290 label,
17291 value,
17292 name,
17293 options
17294 });
17295 });
17296 });
17297 return fields;
17298 }
17299 function getGroupedFieldId(name, inputs, checkedInputs) {
17300 var _checkedInputs$;
17301 var _primaryInput$dataset;
17302 const primaryInput = (_checkedInputs$ = checkedInputs[0]) !== null && _checkedInputs$ !== void 0 ? _checkedInputs$ : inputs[0];
17303 return (_primaryInput$dataset = primaryInput === null || primaryInput === void 0 ? void 0 : primaryInput.dataset.interactionId) !== null && _primaryInput$dataset !== void 0 ? _primaryInput$dataset : name;
17304 }
17305 function getGroupedFields(name, inputs, type, form) {
17306 const checkedInputs = inputs.filter((input) => input.checked);
17307 const value = getAtomicFormFieldValue(checkedInputs, type);
17308 const options = getAtomicFieldOptions(inputs, type, form);
17309 return {
17310 id: getGroupedFieldId(name, inputs, checkedInputs),
17311 type,
17312 label: name,
17313 value,
17314 name,
17315 options
17316 };
17317 }
17318 function getAtomicFieldOptions(fieldOrGroup, type, form) {
17319 if ("select" === type) {
17320 const optionElements = fieldOrGroup.querySelectorAll("option");
17321 return Array.from(optionElements).map((option) => {
17322 return {
17323 value: option.value,
17324 label: option.textContent
17325 };
17326 });
17327 }
17328 if (Array.isArray(fieldOrGroup) && ["radio", "checkbox"].includes(type)) return fieldOrGroup.map((input) => {
17329 return {
17330 value: input.value,
17331 label: getAtomicFormFieldLabel(input, form)
17332 };
17333 });
17334 return null;
17335 }
17336 function getAtomicFormFieldLabel(field, form) {
17337 var _field$closest;
17338 const ariaLabel = field.getAttribute("aria-label");
17339 if (ariaLabel) return ariaLabel;
17340 const fieldId = field.getAttribute("id");
17341 if (fieldId) {
17342 var _labelElement$textCon;
17343 const labelElement = form.querySelector(`label[for="${fieldId}"]`);
17344 const labelText = labelElement === null || labelElement === void 0 || (_labelElement$textCon = labelElement.textContent) === null || _labelElement$textCon === void 0 ? void 0 : _labelElement$textCon.trim();
17345 if (labelText) return labelText;
17346 }
17347 const parentLabelText = (_field$closest = field.closest("label")) === null || _field$closest === void 0 || (_field$closest = _field$closest.textContent) === null || _field$closest === void 0 ? void 0 : _field$closest.trim();
17348 if (parentLabelText) return parentLabelText;
17349 return field.getAttribute("placeholder") || fieldId || "";
17350 }
17351 function getAtomicFormFieldValue(inputs, type) {
17352 if ("file" === type) return inputs.files;
17353 if (Array.isArray(inputs)) return inputs.map((input) => input.value).join(", ");
17354 if ("checkbox" === type) return inputs.checked ? inputs.value || "on" : "";
17355 return inputs.value;
17356 }
17357 function getAtomicFormFieldType(field) {
17358 const tagName = field.tagName.toLowerCase();
17359 if ("input" === tagName) return field.getAttribute("type") || "text";
17360 return tagName;
17361 }
17362 function appendFieldValue(formData, key, value) {
17363 const items = value instanceof FileList ? Array.from(value) : value;
17364 if (Array.isArray(items)) {
17365 items.forEach((item, i) => formData.append(`${key}[${i}]`, item));
17366 return;
17367 }
17368 formData.append(key, items);
17369 }
17370 function appendFormField(formData, field, index) {
17371 const prefix = `form_fields[${index}]`;
17372 formData.append(`${prefix}[id]`, field.id);
17373 formData.append(`${prefix}[type]`, field.type);
17374 formData.append(`${prefix}[label]`, field.label);
17375 formData.append(`${prefix}[name]`, field.name);
17376 formData.append(`${prefix}[options]`, JSON.stringify(field.options));
17377 appendFieldValue(formData, `${prefix}[value]`, field.value);
17378 }
17379 function submitAtomicForm(_x) {
17380 return _submitAtomicForm.apply(this, arguments);
17381 }
17382 function _submitAtomicForm() {
17383 _submitAtomicForm = _asyncToGenerator(function* (payload) {
17384 var _elementorFrontendCon;
17385 var _elementorFrontendCon2;
17386 var _document$title;
17387 var _document;
17388 var _window$location$href;
17389 var _window;
17390 const ajaxUrl = (_elementorFrontendCon = elementorFrontendConfig) === null || _elementorFrontendCon === void 0 || (_elementorFrontendCon = _elementorFrontendCon.urls) === null || _elementorFrontendCon === void 0 ? void 0 : _elementorFrontendCon.ajaxurl;
17391 if (!ajaxUrl) return { success: false };
17392 const formData = new FormData();
17393 formData.append("action", "elementor_pro_atomic_forms_send_form");
17394 formData.append("_nonce", (_elementorFrontendCon2 = elementorFrontendConfig) === null || _elementorFrontendCon2 === void 0 || (_elementorFrontendCon2 = _elementorFrontendCon2.nonces) === null || _elementorFrontendCon2 === void 0 ? void 0 : _elementorFrontendCon2.atomicFormsSendForm);
17395 formData.append("post_id", payload.postId);
17396 formData.append("form_id", payload.formId);
17397 formData.append("form_name", payload.formName);
17398 formData.append("referer_title", (_document$title = (_document = document) === null || _document === void 0 ? void 0 : _document.title) !== null && _document$title !== void 0 ? _document$title : "");
17399 formData.append("referrer", (_window$location$href = (_window = window) === null || _window === void 0 || (_window = _window.location) === null || _window === void 0 ? void 0 : _window.href) !== null && _window$location$href !== void 0 ? _window$location$href : "");
17400 payload.formFields.forEach((field, index) => appendFormField(formData, field, index));
17401 const response = yield fetch(ajaxUrl, {
17402 method: "POST",
17403 body: formData
17404 });
17405 if (!response.ok) return { success: false };
17406 return response.json();
17407 });
17408 return _submitAtomicForm.apply(this, arguments);
17409 }
17410 function setFormState(element, state) {
17411 if (!state) return;
17412 element.classList.remove("form-state-default", "form-state-success", "form-state-error");
17413 element.classList.add(`form-state-${state}`);
17414 setFocusOnMessageElement(element, state);
17415 }
17416 function refreshDom(element) {
17417 var _alpinejs$Alpine2;
17418 var _alpinejs$Alpine3;
17419 var _alpinejs$Alpine4;
17420 if (!((_alpinejs$Alpine2 = _alpinejs.Alpine) === null || _alpinejs$Alpine2 === void 0 ? void 0 : _alpinejs$Alpine2.nextTick) || !((_alpinejs$Alpine3 = _alpinejs.Alpine) === null || _alpinejs$Alpine3 === void 0 ? void 0 : _alpinejs$Alpine3.destroyTree) || !((_alpinejs$Alpine4 = _alpinejs.Alpine) === null || _alpinejs$Alpine4 === void 0 ? void 0 : _alpinejs$Alpine4.initTree)) return;
17421 _alpinejs.Alpine.nextTick(() => {
17422 _alpinejs.Alpine.destroyTree(element);
17423 _alpinejs.Alpine.initTree(element);
17424 });
17425 return () => _alpinejs.Alpine.destroyTree(element);
17426 }
17427 function setFocusOnMessageElement(element, type) {
17428 const messageElement = element.querySelector(`[data-e-type="e-form-${type}-message"]`);
17429 messageElement === null || messageElement === void 0 || messageElement.focus({ focusVisible: true });
17430 }
17431
17432 //#endregion
17433 })();
17434 //# sourceMappingURL=atomic-widgets-form-handler.js.map