vendor: 78 bytes, lines 1-3
1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3
vendor: 342 bytes, lines 4-13
4/***/ "./node_modules/axios/index.js": 5/*!*************************************!*\ 6 !*** ./node_modules/axios/index.js ***! 7 \*************************************/ 8/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 9 10module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js"); 11 12/***/ }), 13
vendor: 6,957 bytes, lines 14-213
14/***/ "./node_modules/axios/lib/adapters/xhr.js": 15/*!************************************************!*\ 16 !*** ./node_modules/axios/lib/adapters/xhr.js ***! 17 \************************************************/ 18/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 19 20"use strict"; 21 22 23var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 24var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); 25var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); 26var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); 27var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js"); 28var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); 29var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js"); 30var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js"); 31 32module.exports = function xhrAdapter(config) { 33 return new Promise(function dispatchXhrRequest(resolve, reject) { 34 var requestData = config.data; 35 var requestHeaders = config.headers; 36 var responseType = config.responseType; 37 38 if (utils.isFormData(requestData)) { 39 delete requestHeaders['Content-Type']; // Let the browser set it 40 } 41 42 var request = new XMLHttpRequest(); 43 44 // HTTP basic authentication 45 if (config.auth) { 46 var username = config.auth.username || ''; 47 var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; 48 requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); 49 } 50 51 var fullPath = buildFullPath(config.baseURL, config.url); 52 request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); 53 54 // Set the request timeout in MS 55 request.timeout = config.timeout; 56 57 function onloadend() { 58 if (!request) { 59 return; 60 } 61 // Prepare the response 62 var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; 63 var responseData = !responseType || responseType === 'text' || responseType === 'json' ? 64 request.responseText : request.response; 65 var response = { 66 data: responseData, 67 status: request.status, 68 statusText: request.statusText, 69 headers: responseHeaders, 70 config: config, 71 request: request 72 }; 73 74 settle(resolve, reject, response); 75 76 // Clean up request 77 request = null; 78 } 79 80 if ('onloadend' in request) { 81 // Use onloadend if available 82 request.onloadend = onloadend; 83 } else { 84 // Listen for ready state to emulate onloadend 85 request.onreadystatechange = function handleLoad() { 86 if (!request || request.readyState !== 4) { 87 return; 88 } 89 90 // The request errored out and we didn't get a response, this will be 91 // handled by onerror instead 92 // With one exception: request that using file: protocol, most browsers 93 // will return status as 0 even though it's a successful request 94 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 95 return; 96 } 97 // readystate handler is calling before onerror or ontimeout handlers, 98 // so we should call onloadend on the next 'tick' 99 setTimeout(onloadend); 100 }; 101 } 102 103 // Handle browser request cancellation (as opposed to a manual cancellation) 104 request.onabort = function handleAbort() { 105 if (!request) { 106 return; 107 } 108 109 reject(createError('Request aborted', config, 'ECONNABORTED', request)); 110 111 // Clean up request 112 request = null; 113 }; 114 115 // Handle low level network errors 116 request.onerror = function handleError() { 117 // Real errors are hidden from us by the browser 118 // onerror should only fire if it's a network error 119 reject(createError('Network Error', config, null, request)); 120 121 // Clean up request 122 request = null; 123 }; 124 125 // Handle timeout 126 request.ontimeout = function handleTimeout() { 127 var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; 128 if (config.timeoutErrorMessage) { 129 timeoutErrorMessage = config.timeoutErrorMessage; 130 } 131 reject(createError( 132 timeoutErrorMessage, 133 config, 134 config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED', 135 request)); 136 137 // Clean up request 138 request = null; 139 }; 140 141 // Add xsrf header 142 // This is only done if running in a standard browser environment. 143 // Specifically not if we're in a web worker, or react-native. 144 if (utils.isStandardBrowserEnv()) { 145 // Add xsrf header 146 var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? 147 cookies.read(config.xsrfCookieName) : 148 undefined; 149 150 if (xsrfValue) { 151 requestHeaders[config.xsrfHeaderName] = xsrfValue; 152 } 153 } 154 155 // Add headers to the request 156 if ('setRequestHeader' in request) { 157 utils.forEach(requestHeaders, function setRequestHeader(val, key) { 158 if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { 159 // Remove Content-Type if data is undefined 160 delete requestHeaders[key]; 161 } else { 162 // Otherwise add header to the request 163 request.setRequestHeader(key, val); 164 } 165 }); 166 } 167 168 // Add withCredentials to request if needed 169 if (!utils.isUndefined(config.withCredentials)) { 170 request.withCredentials = !!config.withCredentials; 171 } 172 173 // Add responseType to request if needed 174 if (responseType && responseType !== 'json') { 175 request.responseType = config.responseType; 176 } 177 178 // Handle progress if needed 179 if (typeof config.onDownloadProgress === 'function') { 180 request.addEventListener('progress', config.onDownloadProgress); 181 } 182 183 // Not all browsers support upload events 184 if (typeof config.onUploadProgress === 'function' && request.upload) { 185 request.upload.addEventListener('progress', config.onUploadProgress); 186 } 187 188 if (config.cancelToken) { 189 // Handle cancellation 190 config.cancelToken.promise.then(function onCanceled(cancel) { 191 if (!request) { 192 return; 193 } 194 195 request.abort(); 196 reject(cancel); 197 // Clean up request 198 request = null; 199 }); 200 } 201 202 if (!requestData) { 203 requestData = null; 204 } 205 206 // Send the request 207 request.send(requestData); 208 }); 209}; 210 211 212/***/ }), 213
vendor: 2,383 bytes, lines 214-280
214/***/ "./node_modules/axios/lib/axios.js": 215/*!*****************************************!*\ 216 !*** ./node_modules/axios/lib/axios.js ***! 217 \*****************************************/ 218/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 219 220"use strict"; 221 222 223var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 224var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 225var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js"); 226var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); 227var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js"); 228 229/** 230 * Create an instance of Axios 231 * 232 * @param {Object} defaultConfig The default config for the instance 233 * @return {Axios} A new instance of Axios 234 */ 235function createInstance(defaultConfig) { 236 var context = new Axios(defaultConfig); 237 var instance = bind(Axios.prototype.request, context); 238 239 // Copy axios.prototype to instance 240 utils.extend(instance, Axios.prototype, context); 241 242 // Copy context to instance 243 utils.extend(instance, context); 244 245 return instance; 246} 247 248// Create the default instance to be exported 249var axios = createInstance(defaults); 250 251// Expose Axios class to allow class inheritance 252axios.Axios = Axios; 253 254// Factory for creating new instances 255axios.create = function create(instanceConfig) { 256 return createInstance(mergeConfig(axios.defaults, instanceConfig)); 257}; 258 259// Expose Cancel & CancelToken 260axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 261axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js"); 262axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 263 264// Expose all/spread 265axios.all = function all(promises) { 266 return Promise.all(promises); 267}; 268axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); 269 270// Expose isAxiosError 271axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "./node_modules/axios/lib/helpers/isAxiosError.js"); 272 273module.exports = axios; 274 275// Allow use of default import syntax in TypeScript 276module.exports["default"] = axios; 277 278 279/***/ }), 280
vendor: 636 bytes, lines 281-310
281/***/ "./node_modules/axios/lib/cancel/Cancel.js": 282/*!*************************************************!*\ 283 !*** ./node_modules/axios/lib/cancel/Cancel.js ***! 284 \*************************************************/ 285/***/ ((module) => { 286 287"use strict"; 288 289 290/** 291 * A `Cancel` is an object that is thrown when an operation is canceled. 292 * 293 * @class 294 * @param {string=} message The message. 295 */ 296function Cancel(message) { 297 this.message = message; 298} 299 300Cancel.prototype.toString = function toString() { 301 return 'Cancel' + (this.message ? ': ' + this.message : ''); 302}; 303 304Cancel.prototype.__CANCEL__ = true; 305 306module.exports = Cancel; 307 308 309/***/ }), 310
vendor: 1,619 bytes, lines 311-378
311/***/ "./node_modules/axios/lib/cancel/CancelToken.js": 312/*!******************************************************!*\ 313 !*** ./node_modules/axios/lib/cancel/CancelToken.js ***! 314 \******************************************************/ 315/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 316 317"use strict"; 318 319 320var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 321 322/** 323 * A `CancelToken` is an object that can be used to request cancellation of an operation. 324 * 325 * @class 326 * @param {Function} executor The executor function. 327 */ 328function CancelToken(executor) { 329 if (typeof executor !== 'function') { 330 throw new TypeError('executor must be a function.'); 331 } 332 333 var resolvePromise; 334 this.promise = new Promise(function promiseExecutor(resolve) { 335 resolvePromise = resolve; 336 }); 337 338 var token = this; 339 executor(function cancel(message) { 340 if (token.reason) { 341 // Cancellation has already been requested 342 return; 343 } 344 345 token.reason = new Cancel(message); 346 resolvePromise(token.reason); 347 }); 348} 349 350/** 351 * Throws a `Cancel` if cancellation has been requested. 352 */ 353CancelToken.prototype.throwIfRequested = function throwIfRequested() { 354 if (this.reason) { 355 throw this.reason; 356 } 357}; 358 359/** 360 * Returns an object that contains a new `CancelToken` and a function that, when called, 361 * cancels the `CancelToken`. 362 */ 363CancelToken.source = function source() { 364 var cancel; 365 var token = new CancelToken(function executor(c) { 366 cancel = c; 367 }); 368 return { 369 token: token, 370 cancel: cancel 371 }; 372}; 373 374module.exports = CancelToken; 375 376 377/***/ }), 378
vendor: 361 bytes, lines 379-394
379/***/ "./node_modules/axios/lib/cancel/isCancel.js": 380/*!***************************************************!*\ 381 !*** ./node_modules/axios/lib/cancel/isCancel.js ***! 382 \***************************************************/ 383/***/ ((module) => { 384 385"use strict"; 386 387 388module.exports = function isCancel(value) { 389 return !!(value && value.__CANCEL__); 390}; 391 392 393/***/ }), 394
vendor: 4,919 bytes, lines 395-553
395/***/ "./node_modules/axios/lib/core/Axios.js": 396/*!**********************************************!*\ 397 !*** ./node_modules/axios/lib/core/Axios.js ***! 398 \**********************************************/ 399/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 400 401"use strict"; 402 403 404var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 405var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); 406var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js"); 407var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js"); 408var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); 409var validator = __webpack_require__(/*! ../helpers/validator */ "./node_modules/axios/lib/helpers/validator.js"); 410 411var validators = validator.validators; 412/** 413 * Create a new instance of Axios 414 * 415 * @param {Object} instanceConfig The default config for the instance 416 */ 417function Axios(instanceConfig) { 418 this.defaults = instanceConfig; 419 this.interceptors = { 420 request: new InterceptorManager(), 421 response: new InterceptorManager() 422 }; 423} 424 425/** 426 * Dispatch a request 427 * 428 * @param {Object} config The config specific for this request (merged with this.defaults) 429 */ 430Axios.prototype.request = function request(config) { 431 /*eslint no-param-reassign:0*/ 432 // Allow for axios('example/url'[, config]) a la fetch API 433 if (typeof config === 'string') { 434 config = arguments[1] || {}; 435 config.url = arguments[0]; 436 } else { 437 config = config || {}; 438 } 439 440 config = mergeConfig(this.defaults, config); 441 442 // Set config.method 443 if (config.method) { 444 config.method = config.method.toLowerCase(); 445 } else if (this.defaults.method) { 446 config.method = this.defaults.method.toLowerCase(); 447 } else { 448 config.method = 'get'; 449 } 450 451 var transitional = config.transitional; 452 453 if (transitional !== undefined) { 454 validator.assertOptions(transitional, { 455 silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'), 456 forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'), 457 clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0') 458 }, false); 459 } 460 461 // filter out skipped interceptors 462 var requestInterceptorChain = []; 463 var synchronousRequestInterceptors = true; 464 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 465 if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { 466 return; 467 } 468 469 synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; 470 471 requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); 472 }); 473 474 var responseInterceptorChain = []; 475 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 476 responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); 477 }); 478 479 var promise; 480 481 if (!synchronousRequestInterceptors) { 482 var chain = [dispatchRequest, undefined]; 483 484 Array.prototype.unshift.apply(chain, requestInterceptorChain); 485 chain = chain.concat(responseInterceptorChain); 486 487 promise = Promise.resolve(config); 488 while (chain.length) { 489 promise = promise.then(chain.shift(), chain.shift()); 490 } 491 492 return promise; 493 } 494 495 496 var newConfig = config; 497 while (requestInterceptorChain.length) { 498 var onFulfilled = requestInterceptorChain.shift(); 499 var onRejected = requestInterceptorChain.shift(); 500 try { 501 newConfig = onFulfilled(newConfig); 502 } catch (error) { 503 onRejected(error); 504 break; 505 } 506 } 507 508 try { 509 promise = dispatchRequest(newConfig); 510 } catch (error) { 511 return Promise.reject(error); 512 } 513 514 while (responseInterceptorChain.length) { 515 promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); 516 } 517 518 return promise; 519}; 520 521Axios.prototype.getUri = function getUri(config) { 522 config = mergeConfig(this.defaults, config); 523 return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); 524}; 525 526// Provide aliases for supported request methods 527utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { 528 /*eslint func-names:0*/ 529 Axios.prototype[method] = function(url, config) { 530 return this.request(mergeConfig(config || {}, { 531 method: method, 532 url: url, 533 data: (config || {}).data 534 })); 535 }; 536}); 537 538utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 539 /*eslint func-names:0*/ 540 Axios.prototype[method] = function(url, data, config) { 541 return this.request(mergeConfig(config || {}, { 542 method: method, 543 url: url, 544 data: data 545 })); 546 }; 547}); 548 549module.exports = Axios; 550 551 552/***/ }), 553
vendor: 1,754 bytes, lines 554-618
554/***/ "./node_modules/axios/lib/core/InterceptorManager.js": 555/*!***********************************************************!*\ 556 !*** ./node_modules/axios/lib/core/InterceptorManager.js ***! 557 \***********************************************************/ 558/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 559 560"use strict"; 561 562 563var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 564 565function InterceptorManager() { 566 this.handlers = []; 567} 568 569/** 570 * Add a new interceptor to the stack 571 * 572 * @param {Function} fulfilled The function to handle `then` for a `Promise` 573 * @param {Function} rejected The function to handle `reject` for a `Promise` 574 * 575 * @return {Number} An ID used to remove interceptor later 576 */ 577InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { 578 this.handlers.push({ 579 fulfilled: fulfilled, 580 rejected: rejected, 581 synchronous: options ? options.synchronous : false, 582 runWhen: options ? options.runWhen : null 583 }); 584 return this.handlers.length - 1; 585}; 586 587/** 588 * Remove an interceptor from the stack 589 * 590 * @param {Number} id The ID that was returned by `use` 591 */ 592InterceptorManager.prototype.eject = function eject(id) { 593 if (this.handlers[id]) { 594 this.handlers[id] = null; 595 } 596}; 597 598/** 599 * Iterate over all the registered interceptors 600 * 601 * This method is particularly useful for skipping over any 602 * interceptors that may have become `null` calling `eject`. 603 * 604 * @param {Function} fn The function to call for each interceptor 605 */ 606InterceptorManager.prototype.forEach = function forEach(fn) { 607 utils.forEach(this.handlers, function forEachHandler(h) { 608 if (h !== null) { 609 fn(h); 610 } 611 }); 612}; 613 614module.exports = InterceptorManager; 615 616 617/***/ }), 618
vendor: 1,149 bytes, lines 619-649
619/***/ "./node_modules/axios/lib/core/buildFullPath.js": 620/*!******************************************************!*\ 621 !*** ./node_modules/axios/lib/core/buildFullPath.js ***! 622 \******************************************************/ 623/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 624 625"use strict"; 626 627 628var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js"); 629var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js"); 630 631/** 632 * Creates a new URL by combining the baseURL with the requestedURL, 633 * only when the requestedURL is not already an absolute URL. 634 * If the requestURL is absolute, this function returns the requestedURL untouched. 635 * 636 * @param {string} baseURL The base URL 637 * @param {string} requestedURL Absolute or relative URL to combine 638 * @returns {string} The combined full path 639 */ 640module.exports = function buildFullPath(baseURL, requestedURL) { 641 if (baseURL && !isAbsoluteURL(requestedURL)) { 642 return combineURLs(baseURL, requestedURL); 643 } 644 return requestedURL; 645}; 646 647 648/***/ }), 649
vendor: 1,000 bytes, lines 650-678
650/***/ "./node_modules/axios/lib/core/createError.js": 651/*!****************************************************!*\ 652 !*** ./node_modules/axios/lib/core/createError.js ***! 653 \****************************************************/ 654/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 655 656"use strict"; 657 658 659var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); 660 661/** 662 * Create an Error with the specified message, config, error code, request and response. 663 * 664 * @param {string} message The error message. 665 * @param {Object} config The config. 666 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 667 * @param {Object} [request] The request. 668 * @param {Object} [response] The response. 669 * @returns {Error} The created error. 670 */ 671module.exports = function createError(message, config, code, request, response) { 672 var error = new Error(message); 673 return enhanceError(error, config, code, request, response); 674}; 675 676 677/***/ }), 678
vendor: 2,557 bytes, lines 679-771
679/***/ "./node_modules/axios/lib/core/dispatchRequest.js": 680/*!********************************************************!*\ 681 !*** ./node_modules/axios/lib/core/dispatchRequest.js ***! 682 \********************************************************/ 683/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 684 685"use strict"; 686 687 688var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 689var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js"); 690var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 691var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js"); 692 693/** 694 * Throws a `Cancel` if cancellation has been requested. 695 */ 696function throwIfCancellationRequested(config) { 697 if (config.cancelToken) { 698 config.cancelToken.throwIfRequested(); 699 } 700} 701 702/** 703 * Dispatch a request to the server using the configured adapter. 704 * 705 * @param {object} config The config that is to be used for the request 706 * @returns {Promise} The Promise to be fulfilled 707 */ 708module.exports = function dispatchRequest(config) { 709 throwIfCancellationRequested(config); 710 711 // Ensure headers exist 712 config.headers = config.headers || {}; 713 714 // Transform request data 715 config.data = transformData.call( 716 config, 717 config.data, 718 config.headers, 719 config.transformRequest 720 ); 721 722 // Flatten headers 723 config.headers = utils.merge( 724 config.headers.common || {}, 725 config.headers[config.method] || {}, 726 config.headers 727 ); 728 729 utils.forEach( 730 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 731 function cleanHeaderConfig(method) { 732 delete config.headers[method]; 733 } 734 ); 735 736 var adapter = config.adapter || defaults.adapter; 737 738 return adapter(config).then(function onAdapterResolution(response) { 739 throwIfCancellationRequested(config); 740 741 // Transform response data 742 response.data = transformData.call( 743 config, 744 response.data, 745 response.headers, 746 config.transformResponse 747 ); 748 749 return response; 750 }, function onAdapterRejection(reason) { 751 if (!isCancel(reason)) { 752 throwIfCancellationRequested(config); 753 754 // Transform response data 755 if (reason && reason.response) { 756 reason.response.data = transformData.call( 757 config, 758 reason.response.data, 759 reason.response.headers, 760 config.transformResponse 761 ); 762 } 763 } 764 765 return Promise.reject(reason); 766 }); 767}; 768 769 770/***/ }), 771
vendor: 1,316 bytes, lines 772-824
772/***/ "./node_modules/axios/lib/core/enhanceError.js": 773/*!*****************************************************!*\ 774 !*** ./node_modules/axios/lib/core/enhanceError.js ***! 775 \*****************************************************/ 776/***/ ((module) => { 777 778"use strict"; 779 780 781/** 782 * Update an Error with the specified config, error code, and response. 783 * 784 * @param {Error} error The error to update. 785 * @param {Object} config The config. 786 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 787 * @param {Object} [request] The request. 788 * @param {Object} [response] The response. 789 * @returns {Error} The error. 790 */ 791module.exports = function enhanceError(error, config, code, request, response) { 792 error.config = config; 793 if (code) { 794 error.code = code; 795 } 796 797 error.request = request; 798 error.response = response; 799 error.isAxiosError = true; 800 801 error.toJSON = function toJSON() { 802 return { 803 // Standard 804 message: this.message, 805 name: this.name, 806 // Microsoft 807 description: this.description, 808 number: this.number, 809 // Mozilla 810 fileName: this.fileName, 811 lineNumber: this.lineNumber, 812 columnNumber: this.columnNumber, 813 stack: this.stack, 814 // Axios 815 config: this.config, 816 code: this.code 817 }; 818 }; 819 return error; 820}; 821 822 823/***/ }), 824
vendor: 3,258 bytes, lines 825-922
825/***/ "./node_modules/axios/lib/core/mergeConfig.js": 826/*!****************************************************!*\ 827 !*** ./node_modules/axios/lib/core/mergeConfig.js ***! 828 \****************************************************/ 829/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 830 831"use strict"; 832 833 834var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); 835 836/** 837 * Config-specific merge-function which creates a new config-object 838 * by merging two configuration objects together. 839 * 840 * @param {Object} config1 841 * @param {Object} config2 842 * @returns {Object} New object resulting from merging config2 to config1 843 */ 844module.exports = function mergeConfig(config1, config2) { 845 // eslint-disable-next-line no-param-reassign 846 config2 = config2 || {}; 847 var config = {}; 848 849 var valueFromConfig2Keys = ['url', 'method', 'data']; 850 var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; 851 var defaultToConfig2Keys = [ 852 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', 853 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', 854 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', 855 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', 856 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' 857 ]; 858 var directMergeKeys = ['validateStatus']; 859 860 function getMergedValue(target, source) { 861 if (utils.isPlainObject(target) && utils.isPlainObject(source)) { 862 return utils.merge(target, source); 863 } else if (utils.isPlainObject(source)) { 864 return utils.merge({}, source); 865 } else if (utils.isArray(source)) { 866 return source.slice(); 867 } 868 return source; 869 } 870 871 function mergeDeepProperties(prop) { 872 if (!utils.isUndefined(config2[prop])) { 873 config[prop] = getMergedValue(config1[prop], config2[prop]); 874 } else if (!utils.isUndefined(config1[prop])) { 875 config[prop] = getMergedValue(undefined, config1[prop]); 876 } 877 } 878 879 utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { 880 if (!utils.isUndefined(config2[prop])) { 881 config[prop] = getMergedValue(undefined, config2[prop]); 882 } 883 }); 884 885 utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); 886 887 utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { 888 if (!utils.isUndefined(config2[prop])) { 889 config[prop] = getMergedValue(undefined, config2[prop]); 890 } else if (!utils.isUndefined(config1[prop])) { 891 config[prop] = getMergedValue(undefined, config1[prop]); 892 } 893 }); 894 895 utils.forEach(directMergeKeys, function merge(prop) { 896 if (prop in config2) { 897 config[prop] = getMergedValue(config1[prop], config2[prop]); 898 } else if (prop in config1) { 899 config[prop] = getMergedValue(undefined, config1[prop]); 900 } 901 }); 902 903 var axiosKeys = valueFromConfig2Keys 904 .concat(mergeDeepPropertiesKeys) 905 .concat(defaultToConfig2Keys) 906 .concat(directMergeKeys); 907 908 var otherKeys = Object 909 .keys(config1) 910 .concat(Object.keys(config2)) 911 .filter(function filterAxiosKeys(key) { 912 return axiosKeys.indexOf(key) === -1; 913 }); 914 915 utils.forEach(otherKeys, mergeDeepProperties); 916 917 return config; 918}; 919 920 921/***/ }), 922
vendor: 1,060 bytes, lines 923-958
923/***/ "./node_modules/axios/lib/core/settle.js": 924/*!***********************************************!*\ 925 !*** ./node_modules/axios/lib/core/settle.js ***! 926 \***********************************************/ 927/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 928 929"use strict"; 930 931 932var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js"); 933 934/** 935 * Resolve or reject a Promise based on response status. 936 * 937 * @param {Function} resolve A function that resolves the promise. 938 * @param {Function} reject A function that rejects the promise. 939 * @param {object} response The response. 940 */ 941module.exports = function settle(resolve, reject, response) { 942 var validateStatus = response.config.validateStatus; 943 if (!response.status || !validateStatus || validateStatus(response.status)) { 944 resolve(response); 945 } else { 946 reject(createError( 947 'Request failed with status code ' + response.status, 948 response.config, 949 null, 950 response.request, 951 response 952 )); 953 } 954}; 955 956 957/***/ }), 958
vendor: 1,066 bytes, lines 959-991
959/***/ "./node_modules/axios/lib/core/transformData.js": 960/*!******************************************************!*\ 961 !*** ./node_modules/axios/lib/core/transformData.js ***! 962 \******************************************************/ 963/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 964 965"use strict"; 966 967 968var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 969var defaults = __webpack_require__(/*! ./../defaults */ "./node_modules/axios/lib/defaults.js"); 970 971/** 972 * Transform the data for a request or a response 973 * 974 * @param {Object|String} data The data to be transformed 975 * @param {Array} headers The headers for the request or response 976 * @param {Array|Function} fns A single function or Array of functions 977 * @returns {*} The resulting transformed data 978 */ 979module.exports = function transformData(data, headers, fns) { 980 var context = this || defaults; 981 /*eslint no-param-reassign:0*/ 982 utils.forEach(fns, function transform(fn) { 983 data = fn.call(context, data, headers); 984 }); 985 986 return data; 987}; 988 989 990/***/ }), 991
vendor: 4,272 bytes, lines 992-1137
992/***/ "./node_modules/axios/lib/defaults.js": 993/*!********************************************!*\ 994 !*** ./node_modules/axios/lib/defaults.js ***! 995 \********************************************/ 996/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 997 998"use strict"; 999/* provided dependency */ var process = __webpack_require__(/*! process/browser.js */ "./node_modules/process/browser.js"); 1000 1001 1002var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 1003var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js"); 1004var enhanceError = __webpack_require__(/*! ./core/enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); 1005 1006var DEFAULT_CONTENT_TYPE = { 1007 'Content-Type': 'application/x-www-form-urlencoded' 1008}; 1009 1010function setContentTypeIfUnset(headers, value) { 1011 if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { 1012 headers['Content-Type'] = value; 1013 } 1014} 1015 1016function getDefaultAdapter() { 1017 var adapter; 1018 if (typeof XMLHttpRequest !== 'undefined') { 1019 // For browsers use XHR adapter 1020 adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js"); 1021 } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { 1022 // For node use HTTP adapter 1023 adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js"); 1024 } 1025 return adapter; 1026} 1027 1028function stringifySafely(rawValue, parser, encoder) { 1029 if (utils.isString(rawValue)) { 1030 try { 1031 (parser || JSON.parse)(rawValue); 1032 return utils.trim(rawValue); 1033 } catch (e) { 1034 if (e.name !== 'SyntaxError') { 1035 throw e; 1036 } 1037 } 1038 } 1039 1040 return (encoder || JSON.stringify)(rawValue); 1041} 1042 1043var defaults = { 1044 1045 transitional: { 1046 silentJSONParsing: true, 1047 forcedJSONParsing: true, 1048 clarifyTimeoutError: false 1049 }, 1050 1051 adapter: getDefaultAdapter(), 1052 1053 transformRequest: [function transformRequest(data, headers) { 1054 normalizeHeaderName(headers, 'Accept'); 1055 normalizeHeaderName(headers, 'Content-Type'); 1056 1057 if (utils.isFormData(data) || 1058 utils.isArrayBuffer(data) || 1059 utils.isBuffer(data) || 1060 utils.isStream(data) || 1061 utils.isFile(data) || 1062 utils.isBlob(data) 1063 ) { 1064 return data; 1065 } 1066 if (utils.isArrayBufferView(data)) { 1067 return data.buffer; 1068 } 1069 if (utils.isURLSearchParams(data)) { 1070 setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); 1071 return data.toString(); 1072 } 1073 if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) { 1074 setContentTypeIfUnset(headers, 'application/json'); 1075 return stringifySafely(data); 1076 } 1077 return data; 1078 }], 1079 1080 transformResponse: [function transformResponse(data) { 1081 var transitional = this.transitional; 1082 var silentJSONParsing = transitional && transitional.silentJSONParsing; 1083 var forcedJSONParsing = transitional && transitional.forcedJSONParsing; 1084 var strictJSONParsing = !silentJSONParsing && this.responseType === 'json'; 1085 1086 if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) { 1087 try { 1088 return JSON.parse(data); 1089 } catch (e) { 1090 if (strictJSONParsing) { 1091 if (e.name === 'SyntaxError') { 1092 throw enhanceError(e, this, 'E_JSON_PARSE'); 1093 } 1094 throw e; 1095 } 1096 } 1097 } 1098 1099 return data; 1100 }], 1101 1102 /** 1103 * A timeout in milliseconds to abort a request. If set to 0 (default) a 1104 * timeout is not created. 1105 */ 1106 timeout: 0, 1107 1108 xsrfCookieName: 'XSRF-TOKEN', 1109 xsrfHeaderName: 'X-XSRF-TOKEN', 1110 1111 maxContentLength: -1, 1112 maxBodyLength: -1, 1113 1114 validateStatus: function validateStatus(status) { 1115 return status >= 200 && status < 300; 1116 } 1117}; 1118 1119defaults.headers = { 1120 common: { 1121 'Accept': 'application/json, text/plain, */*' 1122 } 1123}; 1124 1125utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { 1126 defaults.headers[method] = {}; 1127}); 1128 1129utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 1130 defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); 1131}); 1132 1133module.exports = defaults; 1134 1135 1136/***/ }), 1137
vendor: 503 bytes, lines 1138-1159
1138/***/ "./node_modules/axios/lib/helpers/bind.js": 1139/*!************************************************!*\ 1140 !*** ./node_modules/axios/lib/helpers/bind.js ***! 1141 \************************************************/ 1142/***/ ((module) => { 1143 1144"use strict"; 1145 1146 1147module.exports = function bind(fn, thisArg) { 1148 return function wrap() { 1149 var args = new Array(arguments.length); 1150 for (var i = 0; i < args.length; i++) { 1151 args[i] = arguments[i]; 1152 } 1153 return fn.apply(thisArg, args); 1154 }; 1155}; 1156 1157 1158/***/ }), 1159
vendor: 2,007 bytes, lines 1160-1240
1160/***/ "./node_modules/axios/lib/helpers/buildURL.js": 1161/*!****************************************************!*\ 1162 !*** ./node_modules/axios/lib/helpers/buildURL.js ***! 1163 \****************************************************/ 1164/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1165 1166"use strict"; 1167 1168 1169var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1170 1171function encode(val) { 1172 return encodeURIComponent(val). 1173 replace(/%3A/gi, ':'). 1174 replace(/%24/g, '$'). 1175 replace(/%2C/gi, ','). 1176 replace(/%20/g, '+'). 1177 replace(/%5B/gi, '['). 1178 replace(/%5D/gi, ']'); 1179} 1180 1181/** 1182 * Build a URL by appending params to the end 1183 * 1184 * @param {string} url The base of the url (e.g., http://www.google.com) 1185 * @param {object} [params] The params to be appended 1186 * @returns {string} The formatted url 1187 */ 1188module.exports = function buildURL(url, params, paramsSerializer) { 1189 /*eslint no-param-reassign:0*/ 1190 if (!params) { 1191 return url; 1192 } 1193 1194 var serializedParams; 1195 if (paramsSerializer) { 1196 serializedParams = paramsSerializer(params); 1197 } else if (utils.isURLSearchParams(params)) { 1198 serializedParams = params.toString(); 1199 } else { 1200 var parts = []; 1201 1202 utils.forEach(params, function serialize(val, key) { 1203 if (val === null || typeof val === 'undefined') { 1204 return; 1205 } 1206 1207 if (utils.isArray(val)) { 1208 key = key + '[]'; 1209 } else { 1210 val = [val]; 1211 } 1212 1213 utils.forEach(val, function parseValue(v) { 1214 if (utils.isDate(v)) { 1215 v = v.toISOString(); 1216 } else if (utils.isObject(v)) { 1217 v = JSON.stringify(v); 1218 } 1219 parts.push(encode(key) + '=' + encode(v)); 1220 }); 1221 }); 1222 1223 serializedParams = parts.join('&'); 1224 } 1225 1226 if (serializedParams) { 1227 var hashmarkIndex = url.indexOf('#'); 1228 if (hashmarkIndex !== -1) { 1229 url = url.slice(0, hashmarkIndex); 1230 } 1231 1232 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 1233 } 1234 1235 return url; 1236}; 1237 1238 1239/***/ }), 1240
vendor: 655 bytes, lines 1241-1265
1241/***/ "./node_modules/axios/lib/helpers/combineURLs.js": 1242/*!*******************************************************!*\ 1243 !*** ./node_modules/axios/lib/helpers/combineURLs.js ***! 1244 \*******************************************************/ 1245/***/ ((module) => { 1246 1247"use strict"; 1248 1249 1250/** 1251 * Creates a new URL by combining the specified URLs 1252 * 1253 * @param {string} baseURL The base URL 1254 * @param {string} relativeURL The relative URL 1255 * @returns {string} The combined URL 1256 */ 1257module.exports = function combineURLs(baseURL, relativeURL) { 1258 return relativeURL 1259 ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') 1260 : baseURL; 1261}; 1262 1263 1264/***/ }), 1265
vendor: 1,794 bytes, lines 1266-1329
1266/***/ "./node_modules/axios/lib/helpers/cookies.js": 1267/*!***************************************************!*\ 1268 !*** ./node_modules/axios/lib/helpers/cookies.js ***! 1269 \***************************************************/ 1270/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1271 1272"use strict"; 1273 1274 1275var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1276 1277module.exports = ( 1278 utils.isStandardBrowserEnv() ? 1279 1280 // Standard browser envs support document.cookie 1281 (function standardBrowserEnv() { 1282 return { 1283 write: function write(name, value, expires, path, domain, secure) { 1284 var cookie = []; 1285 cookie.push(name + '=' + encodeURIComponent(value)); 1286 1287 if (utils.isNumber(expires)) { 1288 cookie.push('expires=' + new Date(expires).toGMTString()); 1289 } 1290 1291 if (utils.isString(path)) { 1292 cookie.push('path=' + path); 1293 } 1294 1295 if (utils.isString(domain)) { 1296 cookie.push('domain=' + domain); 1297 } 1298 1299 if (secure === true) { 1300 cookie.push('secure'); 1301 } 1302 1303 document.cookie = cookie.join('; '); 1304 }, 1305 1306 read: function read(name) { 1307 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 1308 return (match ? decodeURIComponent(match[3]) : null); 1309 }, 1310 1311 remove: function remove(name) { 1312 this.write(name, '', Date.now() - 86400000); 1313 } 1314 }; 1315 })() : 1316 1317 // Non standard browser env (web workers, react-native) lack needed support. 1318 (function nonStandardBrowserEnv() { 1319 return { 1320 write: function write() {}, 1321 read: function read() { return null; }, 1322 remove: function remove() {} 1323 }; 1324 })() 1325); 1326 1327 1328/***/ }), 1329
vendor: 846 bytes, lines 1330-1354
1330/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js": 1331/*!*********************************************************!*\ 1332 !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***! 1333 \*********************************************************/ 1334/***/ ((module) => { 1335 1336"use strict"; 1337 1338 1339/** 1340 * Determines whether the specified URL is absolute 1341 * 1342 * @param {string} url The URL to test 1343 * @returns {boolean} True if the specified URL is absolute, otherwise false 1344 */ 1345module.exports = function isAbsoluteURL(url) { 1346 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). 1347 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 1348 // by any combination of letters, digits, plus, period, or hyphen. 1349 return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); 1350}; 1351 1352 1353/***/ }), 1354
vendor: 622 bytes, lines 1355-1376
1355/***/ "./node_modules/axios/lib/helpers/isAxiosError.js": 1356/*!********************************************************!*\ 1357 !*** ./node_modules/axios/lib/helpers/isAxiosError.js ***! 1358 \********************************************************/ 1359/***/ ((module) => { 1360 1361"use strict"; 1362 1363 1364/** 1365 * Determines whether the payload is an error thrown by Axios 1366 * 1367 * @param {*} payload The value to test 1368 * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false 1369 */ 1370module.exports = function isAxiosError(payload) { 1371 return (typeof payload === 'object') && (payload.isAxiosError === true); 1372}; 1373 1374 1375/***/ }), 1376
vendor: 2,696 bytes, lines 1377-1455
1377/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": 1378/*!***********************************************************!*\ 1379 !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***! 1380 \***********************************************************/ 1381/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1382 1383"use strict"; 1384 1385 1386var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1387 1388module.exports = ( 1389 utils.isStandardBrowserEnv() ? 1390 1391 // Standard browser envs have full support of the APIs needed to test 1392 // whether the request URL is of the same origin as current location. 1393 (function standardBrowserEnv() { 1394 var msie = /(msie|trident)/i.test(navigator.userAgent); 1395 var urlParsingNode = document.createElement('a'); 1396 var originURL; 1397 1398 /** 1399 * Parse a URL to discover it's components 1400 * 1401 * @param {String} url The URL to be parsed 1402 * @returns {Object} 1403 */ 1404 function resolveURL(url) { 1405 var href = url; 1406 1407 if (msie) { 1408 // IE needs attribute set twice to normalize properties 1409 urlParsingNode.setAttribute('href', href); 1410 href = urlParsingNode.href; 1411 } 1412 1413 urlParsingNode.setAttribute('href', href); 1414 1415 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils 1416 return { 1417 href: urlParsingNode.href, 1418 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', 1419 host: urlParsingNode.host, 1420 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', 1421 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', 1422 hostname: urlParsingNode.hostname, 1423 port: urlParsingNode.port, 1424 pathname: (urlParsingNode.pathname.charAt(0) === '/') ? 1425 urlParsingNode.pathname : 1426 '/' + urlParsingNode.pathname 1427 }; 1428 } 1429 1430 originURL = resolveURL(window.location.href); 1431 1432 /** 1433 * Determine if a URL shares the same origin as the current location 1434 * 1435 * @param {String} requestURL The URL to test 1436 * @returns {boolean} True if URL shares the same origin, otherwise false 1437 */ 1438 return function isURLSameOrigin(requestURL) { 1439 var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; 1440 return (parsed.protocol === originURL.protocol && 1441 parsed.host === originURL.host); 1442 }; 1443 })() : 1444 1445 // Non standard browser envs (web workers, react-native) lack needed support. 1446 (function nonStandardBrowserEnv() { 1447 return function isURLSameOrigin() { 1448 return true; 1449 }; 1450 })() 1451); 1452 1453 1454/***/ }), 1455
vendor: 764 bytes, lines 1456-1478
1456/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js": 1457/*!***************************************************************!*\ 1458 !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***! 1459 \***************************************************************/ 1460/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1461 1462"use strict"; 1463 1464 1465var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); 1466 1467module.exports = function normalizeHeaderName(headers, normalizedName) { 1468 utils.forEach(headers, function processHeader(value, name) { 1469 if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { 1470 headers[normalizedName] = value; 1471 delete headers[name]; 1472 } 1473 }); 1474}; 1475 1476 1477/***/ }), 1478
vendor: 1,772 bytes, lines 1479-1542
1479/***/ "./node_modules/axios/lib/helpers/parseHeaders.js": 1480/*!********************************************************!*\ 1481 !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***! 1482 \********************************************************/ 1483/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1484 1485"use strict"; 1486 1487 1488var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 1489 1490// Headers whose duplicates are ignored by node 1491// c.f. https://nodejs.org/api/http.html#http_message_headers 1492var ignoreDuplicateOf = [ 1493 'age', 'authorization', 'content-length', 'content-type', 'etag', 1494 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 1495 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 1496 'referer', 'retry-after', 'user-agent' 1497]; 1498 1499/** 1500 * Parse headers into an object 1501 * 1502 * ``` 1503 * Date: Wed, 27 Aug 2014 08:58:49 GMT 1504 * Content-Type: application/json 1505 * Connection: keep-alive 1506 * Transfer-Encoding: chunked 1507 * ``` 1508 * 1509 * @param {String} headers Headers needing to be parsed 1510 * @returns {Object} Headers parsed into an object 1511 */ 1512module.exports = function parseHeaders(headers) { 1513 var parsed = {}; 1514 var key; 1515 var val; 1516 var i; 1517 1518 if (!headers) { return parsed; } 1519 1520 utils.forEach(headers.split('\n'), function parser(line) { 1521 i = line.indexOf(':'); 1522 key = utils.trim(line.substr(0, i)).toLowerCase(); 1523 val = utils.trim(line.substr(i + 1)); 1524 1525 if (key) { 1526 if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { 1527 return; 1528 } 1529 if (key === 'set-cookie') { 1530 parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); 1531 } else { 1532 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 1533 } 1534 } 1535 }); 1536 1537 return parsed; 1538}; 1539 1540 1541/***/ }), 1542
vendor: 819 bytes, lines 1543-1580
1543/***/ "./node_modules/axios/lib/helpers/spread.js": 1544/*!**************************************************!*\ 1545 !*** ./node_modules/axios/lib/helpers/spread.js ***! 1546 \**************************************************/ 1547/***/ ((module) => { 1548 1549"use strict"; 1550 1551 1552/** 1553 * Syntactic sugar for invoking a function and expanding an array for arguments. 1554 * 1555 * Common use case would be to use `Function.prototype.apply`. 1556 * 1557 * ```js 1558 * function f(x, y, z) {} 1559 * var args = [1, 2, 3]; 1560 * f.apply(null, args); 1561 * ``` 1562 * 1563 * With `spread` this example can be re-written. 1564 * 1565 * ```js 1566 * spread(function(x, y, z) {})([1, 2, 3]); 1567 * ``` 1568 * 1569 * @param {Function} callback 1570 * @returns {Function} 1571 */ 1572module.exports = function spread(callback) { 1573 return function wrap(arr) { 1574 return callback.apply(null, arr); 1575 }; 1576}; 1577 1578 1579/***/ }), 1580
vendor: 3,159 bytes, lines 1581-1696
1581/***/ "./node_modules/axios/lib/helpers/validator.js": 1582/*!*****************************************************!*\ 1583 !*** ./node_modules/axios/lib/helpers/validator.js ***! 1584 \*****************************************************/ 1585/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1586 1587"use strict"; 1588 1589 1590var pkg = __webpack_require__(/*! ./../../package.json */ "./node_modules/axios/package.json"); 1591 1592var validators = {}; 1593 1594// eslint-disable-next-line func-names 1595['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) { 1596 validators[type] = function validator(thing) { 1597 return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; 1598 }; 1599}); 1600 1601var deprecatedWarnings = {}; 1602var currentVerArr = pkg.version.split('.'); 1603 1604/** 1605 * Compare package versions 1606 * @param {string} version 1607 * @param {string?} thanVersion 1608 * @returns {boolean} 1609 */ 1610function isOlderVersion(version, thanVersion) { 1611 var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr; 1612 var destVer = version.split('.'); 1613 for (var i = 0; i < 3; i++) { 1614 if (pkgVersionArr[i] > destVer[i]) { 1615 return true; 1616 } else if (pkgVersionArr[i] < destVer[i]) { 1617 return false; 1618 } 1619 } 1620 return false; 1621} 1622 1623/** 1624 * Transitional option validator 1625 * @param {function|boolean?} validator 1626 * @param {string?} version 1627 * @param {string} message 1628 * @returns {function} 1629 */ 1630validators.transitional = function transitional(validator, version, message) { 1631 var isDeprecated = version && isOlderVersion(version); 1632 1633 function formatMessage(opt, desc) { 1634 return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); 1635 } 1636 1637 // eslint-disable-next-line func-names 1638 return function(value, opt, opts) { 1639 if (validator === false) { 1640 throw new Error(formatMessage(opt, ' has been removed in ' + version)); 1641 } 1642 1643 if (isDeprecated && !deprecatedWarnings[opt]) { 1644 deprecatedWarnings[opt] = true; 1645 // eslint-disable-next-line no-console 1646 console.warn( 1647 formatMessage( 1648 opt, 1649 ' has been deprecated since v' + version + ' and will be removed in the near future' 1650 ) 1651 ); 1652 } 1653 1654 return validator ? validator(value, opt, opts) : true; 1655 }; 1656}; 1657 1658/** 1659 * Assert object's properties type 1660 * @param {object} options 1661 * @param {object} schema 1662 * @param {boolean?} allowUnknown 1663 */ 1664 1665function assertOptions(options, schema, allowUnknown) { 1666 if (typeof options !== 'object') { 1667 throw new TypeError('options must be an object'); 1668 } 1669 var keys = Object.keys(options); 1670 var i = keys.length; 1671 while (i-- > 0) { 1672 var opt = keys[i]; 1673 var validator = schema[opt]; 1674 if (validator) { 1675 var value = options[opt]; 1676 var result = value === undefined || validator(value, opt, options); 1677 if (result !== true) { 1678 throw new TypeError('option ' + opt + ' must be ' + result); 1679 } 1680 continue; 1681 } 1682 if (allowUnknown !== true) { 1683 throw Error('Unknown option ' + opt); 1684 } 1685 } 1686} 1687 1688module.exports = { 1689 isOlderVersion: isOlderVersion, 1690 assertOptions: assertOptions, 1691 validators: validators 1692}; 1693 1694 1695/***/ }), 1696
vendor: 9,257 bytes, lines 1697-2056
1697/***/ "./node_modules/axios/lib/utils.js": 1698/*!*****************************************!*\ 1699 !*** ./node_modules/axios/lib/utils.js ***! 1700 \*****************************************/ 1701/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 1702 1703"use strict"; 1704 1705 1706var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 1707 1708// utils is a library of generic helper functions non-specific to axios 1709 1710var toString = Object.prototype.toString; 1711 1712/** 1713 * Determine if a value is an Array 1714 * 1715 * @param {Object} val The value to test 1716 * @returns {boolean} True if value is an Array, otherwise false 1717 */ 1718function isArray(val) { 1719 return toString.call(val) === '[object Array]'; 1720} 1721 1722/** 1723 * Determine if a value is undefined 1724 * 1725 * @param {Object} val The value to test 1726 * @returns {boolean} True if the value is undefined, otherwise false 1727 */ 1728function isUndefined(val) { 1729 return typeof val === 'undefined'; 1730} 1731 1732/** 1733 * Determine if a value is a Buffer 1734 * 1735 * @param {Object} val The value to test 1736 * @returns {boolean} True if value is a Buffer, otherwise false 1737 */ 1738function isBuffer(val) { 1739 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) 1740 && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); 1741} 1742 1743/** 1744 * Determine if a value is an ArrayBuffer 1745 * 1746 * @param {Object} val The value to test 1747 * @returns {boolean} True if value is an ArrayBuffer, otherwise false 1748 */ 1749function isArrayBuffer(val) { 1750 return toString.call(val) === '[object ArrayBuffer]'; 1751} 1752 1753/** 1754 * Determine if a value is a FormData 1755 * 1756 * @param {Object} val The value to test 1757 * @returns {boolean} True if value is an FormData, otherwise false 1758 */ 1759function isFormData(val) { 1760 return (typeof FormData !== 'undefined') && (val instanceof FormData); 1761} 1762 1763/** 1764 * Determine if a value is a view on an ArrayBuffer 1765 * 1766 * @param {Object} val The value to test 1767 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 1768 */ 1769function isArrayBufferView(val) { 1770 var result; 1771 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 1772 result = ArrayBuffer.isView(val); 1773 } else { 1774 result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); 1775 } 1776 return result; 1777} 1778 1779/** 1780 * Determine if a value is a String 1781 * 1782 * @param {Object} val The value to test 1783 * @returns {boolean} True if value is a String, otherwise false 1784 */ 1785function isString(val) { 1786 return typeof val === 'string'; 1787} 1788 1789/** 1790 * Determine if a value is a Number 1791 * 1792 * @param {Object} val The value to test 1793 * @returns {boolean} True if value is a Number, otherwise false 1794 */ 1795function isNumber(val) { 1796 return typeof val === 'number'; 1797} 1798 1799/** 1800 * Determine if a value is an Object 1801 * 1802 * @param {Object} val The value to test 1803 * @returns {boolean} True if value is an Object, otherwise false 1804 */ 1805function isObject(val) { 1806 return val !== null && typeof val === 'object'; 1807} 1808 1809/** 1810 * Determine if a value is a plain Object 1811 * 1812 * @param {Object} val The value to test 1813 * @return {boolean} True if value is a plain Object, otherwise false 1814 */ 1815function isPlainObject(val) { 1816 if (toString.call(val) !== '[object Object]') { 1817 return false; 1818 } 1819 1820 var prototype = Object.getPrototypeOf(val); 1821 return prototype === null || prototype === Object.prototype; 1822} 1823 1824/** 1825 * Determine if a value is a Date 1826 * 1827 * @param {Object} val The value to test 1828 * @returns {boolean} True if value is a Date, otherwise false 1829 */ 1830function isDate(val) { 1831 return toString.call(val) === '[object Date]'; 1832} 1833 1834/** 1835 * Determine if a value is a File 1836 * 1837 * @param {Object} val The value to test 1838 * @returns {boolean} True if value is a File, otherwise false 1839 */ 1840function isFile(val) { 1841 return toString.call(val) === '[object File]'; 1842} 1843 1844/** 1845 * Determine if a value is a Blob 1846 * 1847 * @param {Object} val The value to test 1848 * @returns {boolean} True if value is a Blob, otherwise false 1849 */ 1850function isBlob(val) { 1851 return toString.call(val) === '[object Blob]'; 1852} 1853 1854/** 1855 * Determine if a value is a Function 1856 * 1857 * @param {Object} val The value to test 1858 * @returns {boolean} True if value is a Function, otherwise false 1859 */ 1860function isFunction(val) { 1861 return toString.call(val) === '[object Function]'; 1862} 1863 1864/** 1865 * Determine if a value is a Stream 1866 * 1867 * @param {Object} val The value to test 1868 * @returns {boolean} True if value is a Stream, otherwise false 1869 */ 1870function isStream(val) { 1871 return isObject(val) && isFunction(val.pipe); 1872} 1873 1874/** 1875 * Determine if a value is a URLSearchParams object 1876 * 1877 * @param {Object} val The value to test 1878 * @returns {boolean} True if value is a URLSearchParams object, otherwise false 1879 */ 1880function isURLSearchParams(val) { 1881 return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; 1882} 1883 1884/** 1885 * Trim excess whitespace off the beginning and end of a string 1886 * 1887 * @param {String} str The String to trim 1888 * @returns {String} The String freed of excess whitespace 1889 */ 1890function trim(str) { 1891 return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); 1892} 1893 1894/** 1895 * Determine if we're running in a standard browser environment 1896 * 1897 * This allows axios to run in a web worker, and react-native. 1898 * Both environments support XMLHttpRequest, but not fully standard globals. 1899 * 1900 * web workers: 1901 * typeof window -> undefined 1902 * typeof document -> undefined 1903 * 1904 * react-native: 1905 * navigator.product -> 'ReactNative' 1906 * nativescript 1907 * navigator.product -> 'NativeScript' or 'NS' 1908 */ 1909function isStandardBrowserEnv() { 1910 if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || 1911 navigator.product === 'NativeScript' || 1912 navigator.product === 'NS')) { 1913 return false; 1914 } 1915 return ( 1916 typeof window !== 'undefined' && 1917 typeof document !== 'undefined' 1918 ); 1919} 1920 1921/** 1922 * Iterate over an Array or an Object invoking a function for each item. 1923 * 1924 * If `obj` is an Array callback will be called passing 1925 * the value, index, and complete array for each item. 1926 * 1927 * If 'obj' is an Object callback will be called passing 1928 * the value, key, and complete object for each property. 1929 * 1930 * @param {Object|Array} obj The object to iterate 1931 * @param {Function} fn The callback to invoke for each item 1932 */ 1933function forEach(obj, fn) { 1934 // Don't bother if no value provided 1935 if (obj === null || typeof obj === 'undefined') { 1936 return; 1937 } 1938 1939 // Force an array if not already something iterable 1940 if (typeof obj !== 'object') { 1941 /*eslint no-param-reassign:0*/ 1942 obj = [obj]; 1943 } 1944 1945 if (isArray(obj)) { 1946 // Iterate over array values 1947 for (var i = 0, l = obj.length; i < l; i++) { 1948 fn.call(null, obj[i], i, obj); 1949 } 1950 } else { 1951 // Iterate over object keys 1952 for (var key in obj) { 1953 if (Object.prototype.hasOwnProperty.call(obj, key)) { 1954 fn.call(null, obj[key], key, obj); 1955 } 1956 } 1957 } 1958} 1959 1960/** 1961 * Accepts varargs expecting each argument to be an object, then 1962 * immutably merges the properties of each object and returns result. 1963 * 1964 * When multiple objects contain the same key the later object in 1965 * the arguments list will take precedence. 1966 * 1967 * Example: 1968 * 1969 * ```js 1970 * var result = merge({foo: 123}, {foo: 456}); 1971 * console.log(result.foo); // outputs 456 1972 * ``` 1973 * 1974 * @param {Object} obj1 Object to merge 1975 * @returns {Object} Result of all merge properties 1976 */ 1977function merge(/* obj1, obj2, obj3, ... */) { 1978 var result = {}; 1979 function assignValue(val, key) { 1980 if (isPlainObject(result[key]) && isPlainObject(val)) { 1981 result[key] = merge(result[key], val); 1982 } else if (isPlainObject(val)) { 1983 result[key] = merge({}, val); 1984 } else if (isArray(val)) { 1985 result[key] = val.slice(); 1986 } else { 1987 result[key] = val; 1988 } 1989 } 1990 1991 for (var i = 0, l = arguments.length; i < l; i++) { 1992 forEach(arguments[i], assignValue); 1993 } 1994 return result; 1995} 1996 1997/** 1998 * Extends object a by mutably adding to it the properties of object b. 1999 * 2000 * @param {Object} a The object to be extended 2001 * @param {Object} b The object to copy properties from 2002 * @param {Object} thisArg The object to bind function to 2003 * @return {Object} The resulting value of object a 2004 */ 2005function extend(a, b, thisArg) { 2006 forEach(b, function assignValue(val, key) { 2007 if (thisArg && typeof val === 'function') { 2008 a[key] = bind(val, thisArg); 2009 } else { 2010 a[key] = val; 2011 } 2012 }); 2013 return a; 2014} 2015 2016/** 2017 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) 2018 * 2019 * @param {string} content with BOM 2020 * @return {string} content value without BOM 2021 */ 2022function stripBOM(content) { 2023 if (content.charCodeAt(0) === 0xFEFF) { 2024 content = content.slice(1); 2025 } 2026 return content; 2027} 2028 2029module.exports = { 2030 isArray: isArray, 2031 isArrayBuffer: isArrayBuffer, 2032 isBuffer: isBuffer, 2033 isFormData: isFormData, 2034 isArrayBufferView: isArrayBufferView, 2035 isString: isString, 2036 isNumber: isNumber, 2037 isObject: isObject, 2038 isPlainObject: isPlainObject, 2039 isUndefined: isUndefined, 2040 isDate: isDate, 2041 isFile: isFile, 2042 isBlob: isBlob, 2043 isFunction: isFunction, 2044 isStream: isStream, 2045 isURLSearchParams: isURLSearchParams, 2046 isStandardBrowserEnv: isStandardBrowserEnv, 2047 forEach: forEach, 2048 merge: merge, 2049 extend: extend, 2050 trim: trim, 2051 stripBOM: stripBOM 2052}; 2053 2054 2055/***/ }), 2056
2057/***/ "./resources/js/app.js": 2058/*!*****************************!*\ 2059 !*** ./resources/js/app.js ***! 2060 \*****************************/ 2061/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 2062 2063__webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js"); 2064var WCAG = { 2065 "contrast": function contrast() { 2066 $("body").toggleClass("wcag_contrast"); 2067 }, 2068 "a1": function a1() { 2069 $("html").removeClass("wcag_a2"); 2070 $("html").removeClass("wcag_a3"); 2071 }, 2072 "a2": function a2() { 2073 $("html").addClass("wcag_a2"); 2074 $("html").removeClass("wcag_a3"); 2075 }, 2076 "a3": function a3() { 2077 $("html").removeClass("wcag_a2"); 2078 $("html").addClass("wcag_a3"); 2079 } 2080}; 2081$("document").ready(function () { 2082 $("#wcag_ctl_a1").on("click", function (event) { 2083 $("#wcag_ctl_a1").addClass("wcag_marked"); 2084 $("#wcag_ctl_a2").removeClass("wcag_marked"); 2085 $("#wcag_ctl_a3").removeClass("wcag_marked"); 2086 WCAG.a1(); 2087 event.preventDefault(); 2088 }); 2089 $("#wcag_ctl_a2").on("click", function (event) { 2090 $("#wcag_ctl_a2").addClass("wcag_marked"); 2091 $("#wcag_ctl_a1").removeClass("wcag_marked"); 2092 $("#wcag_ctl_a3").removeClass("wcag_marked"); 2093 WCAG.a2(); 2094 event.preventDefault(); 2095 }); 2096 $("#wcag_ctl_a3").on("click", function (event) { 2097 $("#wcag_ctl_a3").addClass("wcag_marked"); 2098 $("#wcag_ctl_a1").removeClass("wcag_marked"); 2099 $("#wcag_ctl_a2").removeClass("wcag_marked"); 2100 WCAG.a3(); 2101 event.preventDefault(); 2102 }); 2103 $("#wcag_ctl_contrast").on("click", function (event) { 2104 $("#wcag_ctl_contrast").toggleClass("wcag_marked"); 2105 WCAG.contrast(); 2106 event.preventDefault(); 2107 }); 2108}); 2109 2110/***/ }), 2111
2112/***/ "./resources/js/bootstrap.js": 2113/*!***********************************!*\ 2114 !*** ./resources/js/bootstrap.js ***! 2115 \***********************************/ 2116/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 2117 2118window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 2119window.jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 2120window.$ = window.jquery; 2121window.lightbox2 = __webpack_require__(/*! lightbox2 */ "./node_modules/lightbox2/dist/js/lightbox.js"); 2122/** 2123 * We'll load the axios HTTP library which allows us to easily issue requests 2124 * to our Laravel back-end. This library automatically handles sending the 2125 * CSRF token as a header based on the value of the "XSRF" token cookie. 2126 */ 2127 2128window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); 2129window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 2130 2131/** 2132 * Echo exposes an expressive API for subscribing to channels and listening 2133 * for events that are broadcast by Laravel. Echo and event broadcasting 2134 * allows your team to easily build robust real-time web applications. 2135 */ 2136 2137// import Echo from 'laravel-echo'; 2138 2139// window.Pusher = require('pusher-js'); 2140 2141// window.Echo = new Echo({ 2142// broadcaster: 'pusher', 2143// key: process.env.MIX_PUSHER_APP_KEY, 2144// cluster: process.env.MIX_PUSHER_APP_CLUSTER, 2145// forceTLS: true 2146// }); 2147 2148/***/ }), 2149
vendor: 292,899 bytes, lines 2150-13125
2150/***/ "./node_modules/jquery/dist/jquery.js": 2151/*!********************************************!*\ 2152 !*** ./node_modules/jquery/dist/jquery.js ***! 2153 \********************************************/ 2154/***/ (function(module, exports) { 2155 2156var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 2157 * jQuery JavaScript Library v3.6.4 2158 * https://jquery.com/ 2159 * 2160 * Includes Sizzle.js 2161 * https://sizzlejs.com/ 2162 * 2163 * Copyright OpenJS Foundation and other contributors 2164 * Released under the MIT license 2165 * https://jquery.org/license 2166 * 2167 * Date: 2023-03-08T15:28Z 2168 */ 2169( function( global, factory ) { 2170 2171 "use strict"; 2172 2173 if ( true && typeof module.exports === "object" ) { 2174 2175 // For CommonJS and CommonJS-like environments where a proper `window` 2176 // is present, execute the factory and get jQuery. 2177 // For environments that do not have a `window` with a `document` 2178 // (such as Node.js), expose a factory as module.exports. 2179 // This accentuates the need for the creation of a real `window`. 2180 // e.g. var jQuery = require("jquery")(window); 2181 // See ticket trac-14549 for more info. 2182 module.exports = global.document ? 2183 factory( global, true ) : 2184 function( w ) { 2185 if ( !w.document ) { 2186 throw new Error( "jQuery requires a window with a document" ); 2187 } 2188 return factory( w ); 2189 }; 2190 } else { 2191 factory( global ); 2192 } 2193 2194// Pass this if window is not defined yet 2195} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 2196 2197// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 2198// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 2199// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 2200// enough that all such attempts are guarded in a try block. 2201"use strict"; 2202 2203var arr = []; 2204 2205var getProto = Object.getPrototypeOf; 2206 2207var slice = arr.slice; 2208 2209var flat = arr.flat ? function( array ) { 2210 return arr.flat.call( array ); 2211} : function( array ) { 2212 return arr.concat.apply( [], array ); 2213}; 2214 2215 2216var push = arr.push; 2217 2218var indexOf = arr.indexOf; 2219 2220var class2type = {}; 2221 2222var toString = class2type.toString; 2223 2224var hasOwn = class2type.hasOwnProperty; 2225 2226var fnToString = hasOwn.toString; 2227 2228var ObjectFunctionString = fnToString.call( Object ); 2229 2230var support = {}; 2231 2232var isFunction = function isFunction( obj ) { 2233 2234 // Support: Chrome <=57, Firefox <=52 2235 // In some browsers, typeof returns "function" for HTML <object> elements 2236 // (i.e., `typeof document.createElement( "object" ) === "function"`). 2237 // We don't want to classify *any* DOM node as a function. 2238 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 2239 // Plus for old WebKit, typeof returns "function" for HTML collections 2240 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 2241 return typeof obj === "function" && typeof obj.nodeType !== "number" && 2242 typeof obj.item !== "function"; 2243 }; 2244 2245 2246var isWindow = function isWindow( obj ) { 2247 return obj != null && obj === obj.window; 2248 }; 2249 2250 2251var document = window.document; 2252 2253 2254 2255 var preservedScriptAttributes = { 2256 type: true, 2257 src: true, 2258 nonce: true, 2259 noModule: true 2260 }; 2261 2262 function DOMEval( code, node, doc ) { 2263 doc = doc || document; 2264 2265 var i, val, 2266 script = doc.createElement( "script" ); 2267 2268 script.text = code; 2269 if ( node ) { 2270 for ( i in preservedScriptAttributes ) { 2271 2272 // Support: Firefox 64+, Edge 18+ 2273 // Some browsers don't support the "nonce" property on scripts. 2274 // On the other hand, just using `getAttribute` is not enough as 2275 // the `nonce` attribute is reset to an empty string whenever it 2276 // becomes browsing-context connected. 2277 // See https://github.com/whatwg/html/issues/2369 2278 // See https://html.spec.whatwg.org/#nonce-attributes 2279 // The `node.getAttribute` check was added for the sake of 2280 // `jQuery.globalEval` so that it can fake a nonce-containing node 2281 // via an object. 2282 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 2283 if ( val ) { 2284 script.setAttribute( i, val ); 2285 } 2286 } 2287 } 2288 doc.head.appendChild( script ).parentNode.removeChild( script ); 2289 } 2290 2291 2292function toType( obj ) { 2293 if ( obj == null ) { 2294 return obj + ""; 2295 } 2296 2297 // Support: Android <=2.3 only (functionish RegExp) 2298 return typeof obj === "object" || typeof obj === "function" ? 2299 class2type[ toString.call( obj ) ] || "object" : 2300 typeof obj; 2301} 2302/* global Symbol */ 2303// Defining this global in .eslintrc.json would create a danger of using the global 2304// unguarded in another place, it seems safer to define global only for this module 2305 2306 2307 2308var 2309 version = "3.6.4", 2310 2311 // Define a local copy of jQuery 2312 jQuery = function( selector, context ) { 2313 2314 // The jQuery object is actually just the init constructor 'enhanced' 2315 // Need init if jQuery is called (just allow error to be thrown if not included) 2316 return new jQuery.fn.init( selector, context ); 2317 }; 2318 2319jQuery.fn = jQuery.prototype = { 2320 2321 // The current version of jQuery being used 2322 jquery: version, 2323 2324 constructor: jQuery, 2325 2326 // The default length of a jQuery object is 0 2327 length: 0, 2328 2329 toArray: function() { 2330 return slice.call( this ); 2331 }, 2332 2333 // Get the Nth element in the matched element set OR 2334 // Get the whole matched element set as a clean array 2335 get: function( num ) { 2336 2337 // Return all the elements in a clean array 2338 if ( num == null ) { 2339 return slice.call( this ); 2340 } 2341 2342 // Return just the one element from the set 2343 return num < 0 ? this[ num + this.length ] : this[ num ]; 2344 }, 2345 2346 // Take an array of elements and push it onto the stack 2347 // (returning the new matched element set) 2348 pushStack: function( elems ) { 2349 2350 // Build a new jQuery matched element set 2351 var ret = jQuery.merge( this.constructor(), elems ); 2352 2353 // Add the old object onto the stack (as a reference) 2354 ret.prevObject = this; 2355 2356 // Return the newly-formed element set 2357 return ret; 2358 }, 2359 2360 // Execute a callback for every element in the matched set. 2361 each: function( callback ) { 2362 return jQuery.each( this, callback ); 2363 }, 2364 2365 map: function( callback ) { 2366 return this.pushStack( jQuery.map( this, function( elem, i ) { 2367 return callback.call( elem, i, elem ); 2368 } ) ); 2369 }, 2370 2371 slice: function() { 2372 return this.pushStack( slice.apply( this, arguments ) ); 2373 }, 2374 2375 first: function() { 2376 return this.eq( 0 ); 2377 }, 2378 2379 last: function() { 2380 return this.eq( -1 ); 2381 }, 2382 2383 even: function() { 2384 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 2385 return ( i + 1 ) % 2; 2386 } ) ); 2387 }, 2388 2389 odd: function() { 2390 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 2391 return i % 2; 2392 } ) ); 2393 }, 2394 2395 eq: function( i ) { 2396 var len = this.length, 2397 j = +i + ( i < 0 ? len : 0 ); 2398 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 2399 }, 2400 2401 end: function() { 2402 return this.prevObject || this.constructor(); 2403 }, 2404 2405 // For internal use only. 2406 // Behaves like an Array's method, not like a jQuery method. 2407 push: push, 2408 sort: arr.sort, 2409 splice: arr.splice 2410}; 2411 2412jQuery.extend = jQuery.fn.extend = function() { 2413 var options, name, src, copy, copyIsArray, clone, 2414 target = arguments[ 0 ] || {}, 2415 i = 1, 2416 length = arguments.length, 2417 deep = false; 2418 2419 // Handle a deep copy situation 2420 if ( typeof target === "boolean" ) { 2421 deep = target; 2422 2423 // Skip the boolean and the target 2424 target = arguments[ i ] || {}; 2425 i++; 2426 } 2427 2428 // Handle case when target is a string or something (possible in deep copy) 2429 if ( typeof target !== "object" && !isFunction( target ) ) { 2430 target = {}; 2431 } 2432 2433 // Extend jQuery itself if only one argument is passed 2434 if ( i === length ) { 2435 target = this; 2436 i--; 2437 } 2438 2439 for ( ; i < length; i++ ) { 2440 2441 // Only deal with non-null/undefined values 2442 if ( ( options = arguments[ i ] ) != null ) { 2443 2444 // Extend the base object 2445 for ( name in options ) { 2446 copy = options[ name ]; 2447 2448 // Prevent Object.prototype pollution 2449 // Prevent never-ending loop 2450 if ( name === "__proto__" || target === copy ) { 2451 continue; 2452 } 2453 2454 // Recurse if we're merging plain objects or arrays 2455 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 2456 ( copyIsArray = Array.isArray( copy ) ) ) ) { 2457 src = target[ name ]; 2458 2459 // Ensure proper type for the source value 2460 if ( copyIsArray && !Array.isArray( src ) ) { 2461 clone = []; 2462 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 2463 clone = {}; 2464 } else { 2465 clone = src; 2466 } 2467 copyIsArray = false; 2468 2469 // Never move original objects, clone them 2470 target[ name ] = jQuery.extend( deep, clone, copy ); 2471 2472 // Don't bring in undefined values 2473 } else if ( copy !== undefined ) { 2474 target[ name ] = copy; 2475 } 2476 } 2477 } 2478 } 2479 2480 // Return the modified object 2481 return target; 2482}; 2483 2484jQuery.extend( { 2485 2486 // Unique for each copy of jQuery on the page 2487 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 2488 2489 // Assume jQuery is ready without the ready module 2490 isReady: true, 2491 2492 error: function( msg ) { 2493 throw new Error( msg ); 2494 }, 2495 2496 noop: function() {}, 2497 2498 isPlainObject: function( obj ) { 2499 var proto, Ctor; 2500 2501 // Detect obvious negatives 2502 // Use toString instead of jQuery.type to catch host objects 2503 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 2504 return false; 2505 } 2506 2507 proto = getProto( obj ); 2508 2509 // Objects with no prototype (e.g., `Object.create( null )`) are plain 2510 if ( !proto ) { 2511 return true; 2512 } 2513 2514 // Objects with prototype are plain iff they were constructed by a global Object function 2515 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 2516 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 2517 }, 2518 2519 isEmptyObject: function( obj ) { 2520 var name; 2521 2522 for ( name in obj ) { 2523 return false; 2524 } 2525 return true; 2526 }, 2527 2528 // Evaluates a script in a provided context; falls back to the global one 2529 // if not specified. 2530 globalEval: function( code, options, doc ) { 2531 DOMEval( code, { nonce: options && options.nonce }, doc ); 2532 }, 2533 2534 each: function( obj, callback ) { 2535 var length, i = 0; 2536 2537 if ( isArrayLike( obj ) ) { 2538 length = obj.length; 2539 for ( ; i < length; i++ ) { 2540 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 2541 break; 2542 } 2543 } 2544 } else { 2545 for ( i in obj ) { 2546 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 2547 break; 2548 } 2549 } 2550 } 2551 2552 return obj; 2553 }, 2554 2555 // results is for internal usage only 2556 makeArray: function( arr, results ) { 2557 var ret = results || []; 2558 2559 if ( arr != null ) { 2560 if ( isArrayLike( Object( arr ) ) ) { 2561 jQuery.merge( ret, 2562 typeof arr === "string" ? 2563 [ arr ] : arr 2564 ); 2565 } else { 2566 push.call( ret, arr ); 2567 } 2568 } 2569 2570 return ret; 2571 }, 2572 2573 inArray: function( elem, arr, i ) { 2574 return arr == null ? -1 : indexOf.call( arr, elem, i ); 2575 }, 2576 2577 // Support: Android <=4.0 only, PhantomJS 1 only 2578 // push.apply(_, arraylike) throws on ancient WebKit 2579 merge: function( first, second ) { 2580 var len = +second.length, 2581 j = 0, 2582 i = first.length; 2583 2584 for ( ; j < len; j++ ) { 2585 first[ i++ ] = second[ j ]; 2586 } 2587 2588 first.length = i; 2589 2590 return first; 2591 }, 2592 2593 grep: function( elems, callback, invert ) { 2594 var callbackInverse, 2595 matches = [], 2596 i = 0, 2597 length = elems.length, 2598 callbackExpect = !invert; 2599 2600 // Go through the array, only saving the items 2601 // that pass the validator function 2602 for ( ; i < length; i++ ) { 2603 callbackInverse = !callback( elems[ i ], i ); 2604 if ( callbackInverse !== callbackExpect ) { 2605 matches.push( elems[ i ] ); 2606 } 2607 } 2608 2609 return matches; 2610 }, 2611 2612 // arg is for internal usage only 2613 map: function( elems, callback, arg ) { 2614 var length, value, 2615 i = 0, 2616 ret = []; 2617 2618 // Go through the array, translating each of the items to their new values 2619 if ( isArrayLike( elems ) ) { 2620 length = elems.length; 2621 for ( ; i < length; i++ ) { 2622 value = callback( elems[ i ], i, arg ); 2623 2624 if ( value != null ) { 2625 ret.push( value ); 2626 } 2627 } 2628 2629 // Go through every key on the object, 2630 } else { 2631 for ( i in elems ) { 2632 value = callback( elems[ i ], i, arg ); 2633 2634 if ( value != null ) { 2635 ret.push( value ); 2636 } 2637 } 2638 } 2639 2640 // Flatten any nested arrays 2641 return flat( ret ); 2642 }, 2643 2644 // A global GUID counter for objects 2645 guid: 1, 2646 2647 // jQuery.support is not used in Core but other projects attach their 2648 // properties to it so it needs to exist. 2649 support: support 2650} ); 2651 2652if ( typeof Symbol === "function" ) { 2653 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 2654} 2655 2656// Populate the class2type map 2657jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 2658 function( _i, name ) { 2659 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 2660 } ); 2661 2662function isArrayLike( obj ) { 2663 2664 // Support: real iOS 8.2 only (not reproducible in simulator) 2665 // `in` check used to prevent JIT error (gh-2145) 2666 // hasOwn isn't used here due to false negatives 2667 // regarding Nodelist length in IE 2668 var length = !!obj && "length" in obj && obj.length, 2669 type = toType( obj ); 2670 2671 if ( isFunction( obj ) || isWindow( obj ) ) { 2672 return false; 2673 } 2674 2675 return type === "array" || length === 0 || 2676 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 2677} 2678var Sizzle = 2679/*! 2680 * Sizzle CSS Selector Engine v2.3.10 2681 * https://sizzlejs.com/ 2682 * 2683 * Copyright JS Foundation and other contributors 2684 * Released under the MIT license 2685 * https://js.foundation/ 2686 * 2687 * Date: 2023-02-14 2688 */ 2689( function( window ) { 2690var i, 2691 support, 2692 Expr, 2693 getText, 2694 isXML, 2695 tokenize, 2696 compile, 2697 select, 2698 outermostContext, 2699 sortInput, 2700 hasDuplicate, 2701 2702 // Local document vars 2703 setDocument, 2704 document, 2705 docElem, 2706 documentIsHTML, 2707 rbuggyQSA, 2708 rbuggyMatches, 2709 matches, 2710 contains, 2711 2712 // Instance-specific data 2713 expando = "sizzle" + 1 * new Date(), 2714 preferredDoc = window.document, 2715 dirruns = 0, 2716 done = 0, 2717 classCache = createCache(), 2718 tokenCache = createCache(), 2719 compilerCache = createCache(), 2720 nonnativeSelectorCache = createCache(), 2721 sortOrder = function( a, b ) { 2722 if ( a === b ) { 2723 hasDuplicate = true; 2724 } 2725 return 0; 2726 }, 2727 2728 // Instance methods 2729 hasOwn = ( {} ).hasOwnProperty, 2730 arr = [], 2731 pop = arr.pop, 2732 pushNative = arr.push, 2733 push = arr.push, 2734 slice = arr.slice, 2735 2736 // Use a stripped-down indexOf as it's faster than native 2737 // https://jsperf.com/thor-indexof-vs-for/5 2738 indexOf = function( list, elem ) { 2739 var i = 0, 2740 len = list.length; 2741 for ( ; i < len; i++ ) { 2742 if ( list[ i ] === elem ) { 2743 return i; 2744 } 2745 } 2746 return -1; 2747 }, 2748 2749 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + 2750 "ismap|loop|multiple|open|readonly|required|scoped", 2751 2752 // Regular expressions 2753 2754 // http://www.w3.org/TR/css3-selectors/#whitespace 2755 whitespace = "[\\x20\\t\\r\\n\\f]", 2756 2757 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 2758 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 2759 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 2760 2761 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 2762 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 2763 2764 // Operator (capture 2) 2765 "*([*^$|!~]?=)" + whitespace + 2766 2767 // "Attribute values must be CSS identifiers [capture 5] 2768 // or strings [capture 3 or capture 4]" 2769 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 2770 whitespace + "*\\]", 2771 2772 pseudos = ":(" + identifier + ")(?:\\((" + 2773 2774 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 2775 // 1. quoted (capture 3; capture 4 or capture 5) 2776 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 2777 2778 // 2. simple (capture 6) 2779 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 2780 2781 // 3. anything else (capture 2) 2782 ".*" + 2783 ")\\)|)", 2784 2785 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 2786 rwhitespace = new RegExp( whitespace + "+", "g" ), 2787 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + 2788 whitespace + "+$", "g" ), 2789 2790 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 2791 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + 2792 "*" ), 2793 rdescend = new RegExp( whitespace + "|>" ), 2794 2795 rpseudo = new RegExp( pseudos ), 2796 ridentifier = new RegExp( "^" + identifier + "$" ), 2797 2798 matchExpr = { 2799 "ID": new RegExp( "^#(" + identifier + ")" ), 2800 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 2801 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 2802 "ATTR": new RegExp( "^" + attributes ), 2803 "PSEUDO": new RegExp( "^" + pseudos ), 2804 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 2805 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 2806 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 2807 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 2808 2809 // For use in libraries implementing .is() 2810 // We use this for POS matching in `select` 2811 "needsContext": new RegExp( "^" + whitespace + 2812 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 2813 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 2814 }, 2815 2816 rhtml = /HTML$/i, 2817 rinputs = /^(?:input|select|textarea|button)$/i, 2818 rheader = /^h\d$/i, 2819 2820 rnative = /^[^{]+\{\s*\[native \w/, 2821 2822 // Easily-parseable/retrievable ID or TAG or CLASS selectors 2823 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 2824 2825 rsibling = /[+~]/, 2826 2827 // CSS escapes 2828 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 2829 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), 2830 funescape = function( escape, nonHex ) { 2831 var high = "0x" + escape.slice( 1 ) - 0x10000; 2832 2833 return nonHex ? 2834 2835 // Strip the backslash prefix from a non-hex escape sequence 2836 nonHex : 2837 2838 // Replace a hexadecimal escape sequence with the encoded Unicode code point 2839 // Support: IE <=11+ 2840 // For values outside the Basic Multilingual Plane (BMP), manually construct a 2841 // surrogate pair 2842 high < 0 ? 2843 String.fromCharCode( high + 0x10000 ) : 2844 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 2845 }, 2846 2847 // CSS string/identifier serialization 2848 // https://drafts.csswg.org/cssom/#common-serializing-idioms 2849 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 2850 fcssescape = function( ch, asCodePoint ) { 2851 if ( asCodePoint ) { 2852 2853 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 2854 if ( ch === "\0" ) { 2855 return "\uFFFD"; 2856 } 2857 2858 // Control characters and (dependent upon position) numbers get escaped as code points 2859 return ch.slice( 0, -1 ) + "\\" + 2860 ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 2861 } 2862 2863 // Other potentially-special ASCII characters get backslash-escaped 2864 return "\\" + ch; 2865 }, 2866 2867 // Used for iframes 2868 // See setDocument() 2869 // Removing the function wrapper causes a "Permission Denied" 2870 // error in IE 2871 unloadHandler = function() { 2872 setDocument(); 2873 }, 2874 2875 inDisabledFieldset = addCombinator( 2876 function( elem ) { 2877 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 2878 }, 2879 { dir: "parentNode", next: "legend" } 2880 ); 2881 2882// Optimize for push.apply( _, NodeList ) 2883try { 2884 push.apply( 2885 ( arr = slice.call( preferredDoc.childNodes ) ), 2886 preferredDoc.childNodes 2887 ); 2888 2889 // Support: Android<4.0 2890 // Detect silently failing push.apply 2891 // eslint-disable-next-line no-unused-expressions 2892 arr[ preferredDoc.childNodes.length ].nodeType; 2893} catch ( e ) { 2894 push = { apply: arr.length ? 2895 2896 // Leverage slice if possible 2897 function( target, els ) { 2898 pushNative.apply( target, slice.call( els ) ); 2899 } : 2900 2901 // Support: IE<9 2902 // Otherwise append directly 2903 function( target, els ) { 2904 var j = target.length, 2905 i = 0; 2906 2907 // Can't trust NodeList.length 2908 while ( ( target[ j++ ] = els[ i++ ] ) ) {} 2909 target.length = j - 1; 2910 } 2911 }; 2912} 2913 2914function Sizzle( selector, context, results, seed ) { 2915 var m, i, elem, nid, match, groups, newSelector, 2916 newContext = context && context.ownerDocument, 2917 2918 // nodeType defaults to 9, since context defaults to document 2919 nodeType = context ? context.nodeType : 9; 2920 2921 results = results || []; 2922 2923 // Return early from calls with invalid selector or context 2924 if ( typeof selector !== "string" || !selector || 2925 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 2926 2927 return results; 2928 } 2929 2930 // Try to shortcut find operations (as opposed to filters) in HTML documents 2931 if ( !seed ) { 2932 setDocument( context ); 2933 context = context || document; 2934 2935 if ( documentIsHTML ) { 2936 2937 // If the selector is sufficiently simple, try using a "get*By*" DOM method 2938 // (excepting DocumentFragment context, where the methods don't exist) 2939 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 2940 2941 // ID selector 2942 if ( ( m = match[ 1 ] ) ) { 2943 2944 // Document context 2945 if ( nodeType === 9 ) { 2946 if ( ( elem = context.getElementById( m ) ) ) { 2947 2948 // Support: IE, Opera, Webkit 2949 // TODO: identify versions 2950 // getElementById can match elements by name instead of ID 2951 if ( elem.id === m ) { 2952 results.push( elem ); 2953 return results; 2954 } 2955 } else { 2956 return results; 2957 } 2958 2959 // Element context 2960 } else { 2961 2962 // Support: IE, Opera, Webkit 2963 // TODO: identify versions 2964 // getElementById can match elements by name instead of ID 2965 if ( newContext && ( elem = newContext.getElementById( m ) ) && 2966 contains( context, elem ) && 2967 elem.id === m ) { 2968 2969 results.push( elem ); 2970 return results; 2971 } 2972 } 2973 2974 // Type selector 2975 } else if ( match[ 2 ] ) { 2976 push.apply( results, context.getElementsByTagName( selector ) ); 2977 return results; 2978 2979 // Class selector 2980 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && 2981 context.getElementsByClassName ) { 2982 2983 push.apply( results, context.getElementsByClassName( m ) ); 2984 return results; 2985 } 2986 } 2987 2988 // Take advantage of querySelectorAll 2989 if ( support.qsa && 2990 !nonnativeSelectorCache[ selector + " " ] && 2991 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && 2992 2993 // Support: IE 8 only 2994 // Exclude object elements 2995 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { 2996 2997 newSelector = selector; 2998 newContext = context; 2999 3000 // qSA considers elements outside a scoping root when evaluating child or 3001 // descendant combinators, which is not what we want. 3002 // In such cases, we work around the behavior by prefixing every selector in the 3003 // list with an ID selector referencing the scope context. 3004 // The technique has to be used as well when a leading combinator is used 3005 // as such selectors are not recognized by querySelectorAll. 3006 // Thanks to Andrew Dupont for this technique. 3007 if ( nodeType === 1 && 3008 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 3009 3010 // Expand context for sibling selectors 3011 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 3012 context; 3013 3014 // We can use :scope instead of the ID hack if the browser 3015 // supports it & if we're not changing the context. 3016 if ( newContext !== context || !support.scope ) { 3017 3018 // Capture the context ID, setting it first if necessary 3019 if ( ( nid = context.getAttribute( "id" ) ) ) { 3020 nid = nid.replace( rcssescape, fcssescape ); 3021 } else { 3022 context.setAttribute( "id", ( nid = expando ) ); 3023 } 3024 } 3025 3026 // Prefix every selector in the list 3027 groups = tokenize( selector ); 3028 i = groups.length; 3029 while ( i-- ) { 3030 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 3031 toSelector( groups[ i ] ); 3032 } 3033 newSelector = groups.join( "," ); 3034 } 3035 3036 try { 3037 push.apply( results, 3038 newContext.querySelectorAll( newSelector ) 3039 ); 3040 return results; 3041 } catch ( qsaError ) { 3042 nonnativeSelectorCache( selector, true ); 3043 } finally { 3044 if ( nid === expando ) { 3045 context.removeAttribute( "id" ); 3046 } 3047 } 3048 } 3049 } 3050 } 3051 3052 // All others 3053 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 3054} 3055 3056/** 3057 * Create key-value caches of limited size 3058 * @returns {function(string, object)} Returns the Object data after storing it on itself with 3059 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 3060 * deleting the oldest entry 3061 */ 3062function createCache() { 3063 var keys = []; 3064 3065 function cache( key, value ) { 3066 3067 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 3068 if ( keys.push( key + " " ) > Expr.cacheLength ) { 3069 3070 // Only keep the most recent entries 3071 delete cache[ keys.shift() ]; 3072 } 3073 return ( cache[ key + " " ] = value ); 3074 } 3075 return cache; 3076} 3077 3078/** 3079 * Mark a function for special use by Sizzle 3080 * @param {Function} fn The function to mark 3081 */ 3082function markFunction( fn ) { 3083 fn[ expando ] = true; 3084 return fn; 3085} 3086 3087/** 3088 * Support testing using an element 3089 * @param {Function} fn Passed the created element and returns a boolean result 3090 */ 3091function assert( fn ) { 3092 var el = document.createElement( "fieldset" ); 3093 3094 try { 3095 return !!fn( el ); 3096 } catch ( e ) { 3097 return false; 3098 } finally { 3099 3100 // Remove from its parent by default 3101 if ( el.parentNode ) { 3102 el.parentNode.removeChild( el ); 3103 } 3104 3105 // release memory in IE 3106 el = null; 3107 } 3108} 3109 3110/** 3111 * Adds the same handler for all of the specified attrs 3112 * @param {String} attrs Pipe-separated list of attributes 3113 * @param {Function} handler The method that will be applied 3114 */ 3115function addHandle( attrs, handler ) { 3116 var arr = attrs.split( "|" ), 3117 i = arr.length; 3118 3119 while ( i-- ) { 3120 Expr.attrHandle[ arr[ i ] ] = handler; 3121 } 3122} 3123 3124/** 3125 * Checks document order of two siblings 3126 * @param {Element} a 3127 * @param {Element} b 3128 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 3129 */ 3130function siblingCheck( a, b ) { 3131 var cur = b && a, 3132 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 3133 a.sourceIndex - b.sourceIndex; 3134 3135 // Use IE sourceIndex if available on both nodes 3136 if ( diff ) { 3137 return diff; 3138 } 3139 3140 // Check if b follows a 3141 if ( cur ) { 3142 while ( ( cur = cur.nextSibling ) ) { 3143 if ( cur === b ) { 3144 return -1; 3145 } 3146 } 3147 } 3148 3149 return a ? 1 : -1; 3150} 3151 3152/** 3153 * Returns a function to use in pseudos for input types 3154 * @param {String} type 3155 */ 3156function createInputPseudo( type ) { 3157 return function( elem ) { 3158 var name = elem.nodeName.toLowerCase(); 3159 return name === "input" && elem.type === type; 3160 }; 3161} 3162 3163/** 3164 * Returns a function to use in pseudos for buttons 3165 * @param {String} type 3166 */ 3167function createButtonPseudo( type ) { 3168 return function( elem ) { 3169 var name = elem.nodeName.toLowerCase(); 3170 return ( name === "input" || name === "button" ) && elem.type === type; 3171 }; 3172} 3173 3174/** 3175 * Returns a function to use in pseudos for :enabled/:disabled 3176 * @param {Boolean} disabled true for :disabled; false for :enabled 3177 */ 3178function createDisabledPseudo( disabled ) { 3179 3180 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 3181 return function( elem ) { 3182 3183 // Only certain elements can match :enabled or :disabled 3184 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 3185 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 3186 if ( "form" in elem ) { 3187 3188 // Check for inherited disabledness on relevant non-disabled elements: 3189 // * listed form-associated elements in a disabled fieldset 3190 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 3191 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 3192 // * option elements in a disabled optgroup 3193 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 3194 // All such elements have a "form" property. 3195 if ( elem.parentNode && elem.disabled === false ) { 3196 3197 // Option elements defer to a parent optgroup if present 3198 if ( "label" in elem ) { 3199 if ( "label" in elem.parentNode ) { 3200 return elem.parentNode.disabled === disabled; 3201 } else { 3202 return elem.disabled === disabled; 3203 } 3204 } 3205 3206 // Support: IE 6 - 11 3207 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 3208 return elem.isDisabled === disabled || 3209 3210 // Where there is no isDisabled, check manually 3211 /* jshint -W018 */ 3212 elem.isDisabled !== !disabled && 3213 inDisabledFieldset( elem ) === disabled; 3214 } 3215 3216 return elem.disabled === disabled; 3217 3218 // Try to winnow out elements that can't be disabled before trusting the disabled property. 3219 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 3220 // even exist on them, let alone have a boolean value. 3221 } else if ( "label" in elem ) { 3222 return elem.disabled === disabled; 3223 } 3224 3225 // Remaining elements are neither :enabled nor :disabled 3226 return false; 3227 }; 3228} 3229 3230/** 3231 * Returns a function to use in pseudos for positionals 3232 * @param {Function} fn 3233 */ 3234function createPositionalPseudo( fn ) { 3235 return markFunction( function( argument ) { 3236 argument = +argument; 3237 return markFunction( function( seed, matches ) { 3238 var j, 3239 matchIndexes = fn( [], seed.length, argument ), 3240 i = matchIndexes.length; 3241 3242 // Match elements found at the specified indexes 3243 while ( i-- ) { 3244 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 3245 seed[ j ] = !( matches[ j ] = seed[ j ] ); 3246 } 3247 } 3248 } ); 3249 } ); 3250} 3251 3252/** 3253 * Checks a node for validity as a Sizzle context 3254 * @param {Element|Object=} context 3255 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 3256 */ 3257function testContext( context ) { 3258 return context && typeof context.getElementsByTagName !== "undefined" && context; 3259} 3260 3261// Expose support vars for convenience 3262support = Sizzle.support = {}; 3263 3264/** 3265 * Detects XML nodes 3266 * @param {Element|Object} elem An element or a document 3267 * @returns {Boolean} True iff elem is a non-HTML XML node 3268 */ 3269isXML = Sizzle.isXML = function( elem ) { 3270 var namespace = elem && elem.namespaceURI, 3271 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 3272 3273 // Support: IE <=8 3274 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 3275 // https://bugs.jquery.com/ticket/4833 3276 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); 3277}; 3278 3279/** 3280 * Sets document-related variables once based on the current document 3281 * @param {Element|Object} [doc] An element or document object to use to set the document 3282 * @returns {Object} Returns the current document 3283 */ 3284setDocument = Sizzle.setDocument = function( node ) { 3285 var hasCompare, subWindow, 3286 doc = node ? node.ownerDocument || node : preferredDoc; 3287 3288 // Return early if doc is invalid or already selected 3289 // Support: IE 11+, Edge 17 - 18+ 3290 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 3291 // two documents; shallow comparisons work. 3292 // eslint-disable-next-line eqeqeq 3293 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 3294 return document; 3295 } 3296 3297 // Update global variables 3298 document = doc; 3299 docElem = document.documentElement; 3300 documentIsHTML = !isXML( document ); 3301 3302 // Support: IE 9 - 11+, Edge 12 - 18+ 3303 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 3304 // Support: IE 11+, Edge 17 - 18+ 3305 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 3306 // two documents; shallow comparisons work. 3307 // eslint-disable-next-line eqeqeq 3308 if ( preferredDoc != document && 3309 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 3310 3311 // Support: IE 11, Edge 3312 if ( subWindow.addEventListener ) { 3313 subWindow.addEventListener( "unload", unloadHandler, false ); 3314 3315 // Support: IE 9 - 10 only 3316 } else if ( subWindow.attachEvent ) { 3317 subWindow.attachEvent( "onunload", unloadHandler ); 3318 } 3319 } 3320 3321 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, 3322 // Safari 4 - 5 only, Opera <=11.6 - 12.x only 3323 // IE/Edge & older browsers don't support the :scope pseudo-class. 3324 // Support: Safari 6.0 only 3325 // Safari 6.0 supports :scope but it's an alias of :root there. 3326 support.scope = assert( function( el ) { 3327 docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); 3328 return typeof el.querySelectorAll !== "undefined" && 3329 !el.querySelectorAll( ":scope fieldset div" ).length; 3330 } ); 3331 3332 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 3333 // Make sure the the `:has()` argument is parsed unforgivingly. 3334 // We include `*` in the test to detect buggy implementations that are 3335 // _selectively_ forgiving (specifically when the list includes at least 3336 // one valid selector). 3337 // Note that we treat complete lack of support for `:has()` as if it were 3338 // spec-compliant support, which is fine because use of `:has()` in such 3339 // environments will fail in the qSA path and fall back to jQuery traversal 3340 // anyway. 3341 support.cssHas = assert( function() { 3342 try { 3343 document.querySelector( ":has(*,:jqfake)" ); 3344 return false; 3345 } catch ( e ) { 3346 return true; 3347 } 3348 } ); 3349 3350 /* Attributes 3351 ---------------------------------------------------------------------- */ 3352 3353 // Support: IE<8 3354 // Verify that getAttribute really returns attributes and not properties 3355 // (excepting IE8 booleans) 3356 support.attributes = assert( function( el ) { 3357 el.className = "i"; 3358 return !el.getAttribute( "className" ); 3359 } ); 3360 3361 /* getElement(s)By* 3362 ---------------------------------------------------------------------- */ 3363 3364 // Check if getElementsByTagName("*") returns only elements 3365 support.getElementsByTagName = assert( function( el ) { 3366 el.appendChild( document.createComment( "" ) ); 3367 return !el.getElementsByTagName( "*" ).length; 3368 } ); 3369 3370 // Support: IE<9 3371 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 3372 3373 // Support: IE<10 3374 // Check if getElementById returns elements by name 3375 // The broken getElementById methods don't pick up programmatically-set names, 3376 // so use a roundabout getElementsByName test 3377 support.getById = assert( function( el ) { 3378 docElem.appendChild( el ).id = expando; 3379 return !document.getElementsByName || !document.getElementsByName( expando ).length; 3380 } ); 3381 3382 // ID filter and find 3383 if ( support.getById ) { 3384 Expr.filter[ "ID" ] = function( id ) { 3385 var attrId = id.replace( runescape, funescape ); 3386 return function( elem ) { 3387 return elem.getAttribute( "id" ) === attrId; 3388 }; 3389 }; 3390 Expr.find[ "ID" ] = function( id, context ) { 3391 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 3392 var elem = context.getElementById( id ); 3393 return elem ? [ elem ] : []; 3394 } 3395 }; 3396 } else { 3397 Expr.filter[ "ID" ] = function( id ) { 3398 var attrId = id.replace( runescape, funescape ); 3399 return function( elem ) { 3400 var node = typeof elem.getAttributeNode !== "undefined" && 3401 elem.getAttributeNode( "id" ); 3402 return node && node.value === attrId; 3403 }; 3404 }; 3405 3406 // Support: IE 6 - 7 only 3407 // getElementById is not reliable as a find shortcut 3408 Expr.find[ "ID" ] = function( id, context ) { 3409 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 3410 var node, i, elems, 3411 elem = context.getElementById( id ); 3412 3413 if ( elem ) { 3414 3415 // Verify the id attribute 3416 node = elem.getAttributeNode( "id" ); 3417 if ( node && node.value === id ) { 3418 return [ elem ]; 3419 } 3420 3421 // Fall back on getElementsByName 3422 elems = context.getElementsByName( id ); 3423 i = 0; 3424 while ( ( elem = elems[ i++ ] ) ) { 3425 node = elem.getAttributeNode( "id" ); 3426 if ( node && node.value === id ) { 3427 return [ elem ]; 3428 } 3429 } 3430 } 3431 3432 return []; 3433 } 3434 }; 3435 } 3436 3437 // Tag 3438 Expr.find[ "TAG" ] = support.getElementsByTagName ? 3439 function( tag, context ) { 3440 if ( typeof context.getElementsByTagName !== "undefined" ) { 3441 return context.getElementsByTagName( tag ); 3442 3443 // DocumentFragment nodes don't have gEBTN 3444 } else if ( support.qsa ) { 3445 return context.querySelectorAll( tag ); 3446 } 3447 } : 3448 3449 function( tag, context ) { 3450 var elem, 3451 tmp = [], 3452 i = 0, 3453 3454 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 3455 results = context.getElementsByTagName( tag ); 3456 3457 // Filter out possible comments 3458 if ( tag === "*" ) { 3459 while ( ( elem = results[ i++ ] ) ) { 3460 if ( elem.nodeType === 1 ) { 3461 tmp.push( elem ); 3462 } 3463 } 3464 3465 return tmp; 3466 } 3467 return results; 3468 }; 3469 3470 // Class 3471 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { 3472 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 3473 return context.getElementsByClassName( className ); 3474 } 3475 }; 3476 3477 /* QSA/matchesSelector 3478 ---------------------------------------------------------------------- */ 3479 3480 // QSA and matchesSelector support 3481 3482 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 3483 rbuggyMatches = []; 3484 3485 // qSa(:focus) reports false when true (Chrome 21) 3486 // We allow this because of a bug in IE8/9 that throws an error 3487 // whenever `document.activeElement` is accessed on an iframe 3488 // So, we allow :focus to pass through QSA all the time to avoid the IE error 3489 // See https://bugs.jquery.com/ticket/13378 3490 rbuggyQSA = []; 3491 3492 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { 3493 3494 // Build QSA regex 3495 // Regex strategy adopted from Diego Perini 3496 assert( function( el ) { 3497 3498 var input; 3499 3500 // Select is set to empty string on purpose 3501 // This is to test IE's treatment of not explicitly 3502 // setting a boolean content attribute, 3503 // since its presence should be enough 3504 // https://bugs.jquery.com/ticket/12359 3505 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 3506 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 3507 "<option selected=''></option></select>"; 3508 3509 // Support: IE8, Opera 11-12.16 3510 // Nothing should be selected when empty strings follow ^= or $= or *= 3511 // The test attribute must be unknown in Opera but "safe" for WinRT 3512 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 3513 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { 3514 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 3515 } 3516 3517 // Support: IE8 3518 // Boolean attributes and "value" are not treated correctly 3519 if ( !el.querySelectorAll( "[selected]" ).length ) { 3520 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 3521 } 3522 3523 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 3524 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 3525 rbuggyQSA.push( "~=" ); 3526 } 3527 3528 // Support: IE 11+, Edge 15 - 18+ 3529 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 3530 // Adding a temporary attribute to the document before the selection works 3531 // around the issue. 3532 // Interestingly, IE 10 & older don't seem to have the issue. 3533 input = document.createElement( "input" ); 3534 input.setAttribute( "name", "" ); 3535 el.appendChild( input ); 3536 if ( !el.querySelectorAll( "[name='']" ).length ) { 3537 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 3538 whitespace + "*(?:''|\"\")" ); 3539 } 3540 3541 // Webkit/Opera - :checked should return selected option elements 3542 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 3543 // IE8 throws error here and will not see later tests 3544 if ( !el.querySelectorAll( ":checked" ).length ) { 3545 rbuggyQSA.push( ":checked" ); 3546 } 3547 3548 // Support: Safari 8+, iOS 8+ 3549 // https://bugs.webkit.org/show_bug.cgi?id=136851 3550 // In-page `selector#id sibling-combinator selector` fails 3551 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 3552 rbuggyQSA.push( ".#.+[+~]" ); 3553 } 3554 3555 // Support: Firefox <=3.6 - 5 only 3556 // Old Firefox doesn't throw on a badly-escaped identifier. 3557 el.querySelectorAll( "\\\f" ); 3558 rbuggyQSA.push( "[\\r\\n\\f]" ); 3559 } ); 3560 3561 assert( function( el ) { 3562 el.innerHTML = "<a href='' disabled='disabled'></a>" + 3563 "<select disabled='disabled'><option/></select>"; 3564 3565 // Support: Windows 8 Native Apps 3566 // The type and name attributes are restricted during .innerHTML assignment 3567 var input = document.createElement( "input" ); 3568 input.setAttribute( "type", "hidden" ); 3569 el.appendChild( input ).setAttribute( "name", "D" ); 3570 3571 // Support: IE8 3572 // Enforce case-sensitivity of name attribute 3573 if ( el.querySelectorAll( "[name=d]" ).length ) { 3574 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 3575 } 3576 3577 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 3578 // IE8 throws error here and will not see later tests 3579 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { 3580 rbuggyQSA.push( ":enabled", ":disabled" ); 3581 } 3582 3583 // Support: IE9-11+ 3584 // IE's :disabled selector does not pick up the children of disabled fieldsets 3585 docElem.appendChild( el ).disabled = true; 3586 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 3587 rbuggyQSA.push( ":enabled", ":disabled" ); 3588 } 3589 3590 // Support: Opera 10 - 11 only 3591 // Opera 10-11 does not throw on post-comma invalid pseudos 3592 el.querySelectorAll( "*,:x" ); 3593 rbuggyQSA.push( ",.*:" ); 3594 } ); 3595 } 3596 3597 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || 3598 docElem.webkitMatchesSelector || 3599 docElem.mozMatchesSelector || 3600 docElem.oMatchesSelector || 3601 docElem.msMatchesSelector ) ) ) ) { 3602 3603 assert( function( el ) { 3604 3605 // Check to see if it's possible to do matchesSelector 3606 // on a disconnected node (IE 9) 3607 support.disconnectedMatch = matches.call( el, "*" ); 3608 3609 // This should fail with an exception 3610 // Gecko does not error, returns false instead 3611 matches.call( el, "[s!='']:x" ); 3612 rbuggyMatches.push( "!=", pseudos ); 3613 } ); 3614 } 3615 3616 if ( !support.cssHas ) { 3617 3618 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 3619 // Our regular `try-catch` mechanism fails to detect natively-unsupported 3620 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 3621 // in browsers that parse the `:has()` argument as a forgiving selector list. 3622 // https://drafts.csswg.org/selectors/#relational now requires the argument 3623 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 3624 rbuggyQSA.push( ":has" ); 3625 } 3626 3627 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 3628 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); 3629 3630 /* Contains 3631 ---------------------------------------------------------------------- */ 3632 hasCompare = rnative.test( docElem.compareDocumentPosition ); 3633 3634 // Element contains another 3635 // Purposefully self-exclusive 3636 // As in, an element does not contain itself 3637 contains = hasCompare || rnative.test( docElem.contains ) ? 3638 function( a, b ) { 3639 3640 // Support: IE <9 only 3641 // IE doesn't have `contains` on `document` so we need to check for 3642 // `documentElement` presence. 3643 // We need to fall back to `a` when `documentElement` is missing 3644 // as `ownerDocument` of elements within `<template/>` may have 3645 // a null one - a default behavior of all modern browsers. 3646 var adown = a.nodeType === 9 && a.documentElement || a, 3647 bup = b && b.parentNode; 3648 return a === bup || !!( bup && bup.nodeType === 1 && ( 3649 adown.contains ? 3650 adown.contains( bup ) : 3651 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 3652 ) ); 3653 } : 3654 function( a, b ) { 3655 if ( b ) { 3656 while ( ( b = b.parentNode ) ) { 3657 if ( b === a ) { 3658 return true; 3659 } 3660 } 3661 } 3662 return false; 3663 }; 3664 3665 /* Sorting 3666 ---------------------------------------------------------------------- */ 3667 3668 // Document order sorting 3669 sortOrder = hasCompare ? 3670 function( a, b ) { 3671 3672 // Flag for duplicate removal 3673 if ( a === b ) { 3674 hasDuplicate = true; 3675 return 0; 3676 } 3677 3678 // Sort on method existence if only one input has compareDocumentPosition 3679 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 3680 if ( compare ) { 3681 return compare; 3682 } 3683 3684 // Calculate position if both inputs belong to the same document 3685 // Support: IE 11+, Edge 17 - 18+ 3686 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 3687 // two documents; shallow comparisons work. 3688 // eslint-disable-next-line eqeqeq 3689 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 3690 a.compareDocumentPosition( b ) : 3691 3692 // Otherwise we know they are disconnected 3693 1; 3694 3695 // Disconnected nodes 3696 if ( compare & 1 || 3697 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 3698 3699 // Choose the first element that is related to our preferred document 3700 // Support: IE 11+, Edge 17 - 18+ 3701 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 3702 // two documents; shallow comparisons work. 3703 // eslint-disable-next-line eqeqeq 3704 if ( a == document || a.ownerDocument == preferredDoc && 3705 contains( preferredDoc, a ) ) { 3706 return -1; 3707 } 3708 3709 // Support: IE 11+, Edge 17 - 18+ 3710 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 3711 // two documents; shallow comparisons work. 3712 // eslint-disable-next-line eqeqeq 3713 if ( b == document || b.ownerDocument == preferredDoc && 3714 contains( preferredDoc, b ) ) { 3715 return 1; 3716 } 3717 3718 // Maintain original order 3719 return sortInput ? 3720 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 3721 0; 3722 } 3723 3724 return compare & 4 ? -1 : 1; 3725 } : 3726 function( a, b ) { 3727 3728 // Exit early if the nodes are identical 3729 if ( a === b ) { 3730 hasDuplicate = true; 3731 return 0; 3732 } 3733 3734 var cur, 3735 i = 0, 3736 aup = a.parentNode, 3737 bup = b.parentNode, 3738 ap = [ a ], 3739 bp = [ b ]; 3740 3741 // Parentless nodes are either documents or disconnected 3742 if ( !aup || !bup ) { 3743 3744 // Support: IE 11+, Edge 17 - 18+ 3745 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 3746 // two documents; shallow comparisons work. 3747 /* eslint-disable eqeqeq */ 3748 return a == document ? -1 : 3749 b == document ? 1 : 3750 /* eslint-enable eqeqeq */ 3751 aup ? -1 : 3752 bup ? 1 : 3753 sortInput ? 3754 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 3755 0; 3756 3757 // If the nodes are siblings, we can do a quick check 3758 } else if ( aup === bup ) { 3759 return siblingCheck( a, b ); 3760 } 3761 3762 // Otherwise we need full lists of their ancestors for comparison 3763 cur = a; 3764 while ( ( cur = cur.parentNode ) ) { 3765 ap.unshift( cur ); 3766 } 3767 cur = b; 3768 while ( ( cur = cur.parentNode ) ) { 3769 bp.unshift( cur ); 3770 } 3771 3772 // Walk down the tree looking for a discrepancy 3773 while ( ap[ i ] === bp[ i ] ) { 3774 i++; 3775 } 3776 3777 return i ? 3778 3779 // Do a sibling check if the nodes have a common ancestor 3780 siblingCheck( ap[ i ], bp[ i ] ) : 3781 3782 // Otherwise nodes in our document sort first 3783 // Support: IE 11+, Edge 17 - 18+ 3784 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 3785 // two documents; shallow comparisons work. 3786 /* eslint-disable eqeqeq */ 3787 ap[ i ] == preferredDoc ? -1 : 3788 bp[ i ] == preferredDoc ? 1 : 3789 /* eslint-enable eqeqeq */ 3790 0; 3791 }; 3792 3793 return document; 3794}; 3795 3796Sizzle.matches = function( expr, elements ) { 3797 return Sizzle( expr, null, null, elements ); 3798}; 3799 3800Sizzle.matchesSelector = function( elem, expr ) { 3801 setDocument( elem ); 3802 3803 if ( support.matchesSelector && documentIsHTML && 3804 !nonnativeSelectorCache[ expr + " " ] && 3805 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 3806 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 3807 3808 try { 3809 var ret = matches.call( elem, expr ); 3810 3811 // IE 9's matchesSelector returns false on disconnected nodes 3812 if ( ret || support.disconnectedMatch || 3813 3814 // As well, disconnected nodes are said to be in a document 3815 // fragment in IE 9 3816 elem.document && elem.document.nodeType !== 11 ) { 3817 return ret; 3818 } 3819 } catch ( e ) { 3820 nonnativeSelectorCache( expr, true ); 3821 } 3822 } 3823 3824 return Sizzle( expr, document, null, [ elem ] ).length > 0; 3825}; 3826 3827Sizzle.contains = function( context, elem ) { 3828 3829 // Set document vars if needed 3830 // Support: IE 11+, Edge 17 - 18+ 3831 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 3832 // two documents; shallow comparisons work. 3833 // eslint-disable-next-line eqeqeq 3834 if ( ( context.ownerDocument || context ) != document ) { 3835 setDocument( context ); 3836 } 3837 return contains( context, elem ); 3838}; 3839 3840Sizzle.attr = function( elem, name ) { 3841 3842 // Set document vars if needed 3843 // Support: IE 11+, Edge 17 - 18+ 3844 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 3845 // two documents; shallow comparisons work. 3846 // eslint-disable-next-line eqeqeq 3847 if ( ( elem.ownerDocument || elem ) != document ) { 3848 setDocument( elem ); 3849 } 3850 3851 var fn = Expr.attrHandle[ name.toLowerCase() ], 3852 3853 // Don't get fooled by Object.prototype properties (jQuery #13807) 3854 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 3855 fn( elem, name, !documentIsHTML ) : 3856 undefined; 3857 3858 return val !== undefined ? 3859 val : 3860 support.attributes || !documentIsHTML ? 3861 elem.getAttribute( name ) : 3862 ( val = elem.getAttributeNode( name ) ) && val.specified ? 3863 val.value : 3864 null; 3865}; 3866 3867Sizzle.escape = function( sel ) { 3868 return ( sel + "" ).replace( rcssescape, fcssescape ); 3869}; 3870 3871Sizzle.error = function( msg ) { 3872 throw new Error( "Syntax error, unrecognized expression: " + msg ); 3873}; 3874 3875/** 3876 * Document sorting and removing duplicates 3877 * @param {ArrayLike} results 3878 */ 3879Sizzle.uniqueSort = function( results ) { 3880 var elem, 3881 duplicates = [], 3882 j = 0, 3883 i = 0; 3884 3885 // Unless we *know* we can detect duplicates, assume their presence 3886 hasDuplicate = !support.detectDuplicates; 3887 sortInput = !support.sortStable && results.slice( 0 ); 3888 results.sort( sortOrder ); 3889 3890 if ( hasDuplicate ) { 3891 while ( ( elem = results[ i++ ] ) ) { 3892 if ( elem === results[ i ] ) { 3893 j = duplicates.push( i ); 3894 } 3895 } 3896 while ( j-- ) { 3897 results.splice( duplicates[ j ], 1 ); 3898 } 3899 } 3900 3901 // Clear input after sorting to release objects 3902 // See https://github.com/jquery/sizzle/pull/225 3903 sortInput = null; 3904 3905 return results; 3906}; 3907 3908/** 3909 * Utility function for retrieving the text value of an array of DOM nodes 3910 * @param {Array|Element} elem 3911 */ 3912getText = Sizzle.getText = function( elem ) { 3913 var node, 3914 ret = "", 3915 i = 0, 3916 nodeType = elem.nodeType; 3917 3918 if ( !nodeType ) { 3919 3920 // If no nodeType, this is expected to be an array 3921 while ( ( node = elem[ i++ ] ) ) { 3922 3923 // Do not traverse comment nodes 3924 ret += getText( node ); 3925 } 3926 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 3927 3928 // Use textContent for elements 3929 // innerText usage removed for consistency of new lines (jQuery #11153) 3930 if ( typeof elem.textContent === "string" ) { 3931 return elem.textContent; 3932 } else { 3933 3934 // Traverse its children 3935 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 3936 ret += getText( elem ); 3937 } 3938 } 3939 } else if ( nodeType === 3 || nodeType === 4 ) { 3940 return elem.nodeValue; 3941 } 3942 3943 // Do not include comment or processing instruction nodes 3944 3945 return ret; 3946}; 3947 3948Expr = Sizzle.selectors = { 3949 3950 // Can be adjusted by the user 3951 cacheLength: 50, 3952 3953 createPseudo: markFunction, 3954 3955 match: matchExpr, 3956 3957 attrHandle: {}, 3958 3959 find: {}, 3960 3961 relative: { 3962 ">": { dir: "parentNode", first: true }, 3963 " ": { dir: "parentNode" }, 3964 "+": { dir: "previousSibling", first: true }, 3965 "~": { dir: "previousSibling" } 3966 }, 3967 3968 preFilter: { 3969 "ATTR": function( match ) { 3970 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 3971 3972 // Move the given value to match[3] whether quoted or unquoted 3973 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || 3974 match[ 5 ] || "" ).replace( runescape, funescape ); 3975 3976 if ( match[ 2 ] === "~=" ) { 3977 match[ 3 ] = " " + match[ 3 ] + " "; 3978 } 3979 3980 return match.slice( 0, 4 ); 3981 }, 3982 3983 "CHILD": function( match ) { 3984 3985 /* matches from matchExpr["CHILD"] 3986 1 type (only|nth|...) 3987 2 what (child|of-type) 3988 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 3989 4 xn-component of xn+y argument ([+-]?\d*n|) 3990 5 sign of xn-component 3991 6 x of xn-component 3992 7 sign of y-component 3993 8 y of y-component 3994 */ 3995 match[ 1 ] = match[ 1 ].toLowerCase(); 3996 3997 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 3998 3999 // nth-* requires argument 4000 if ( !match[ 3 ] ) { 4001 Sizzle.error( match[ 0 ] ); 4002 } 4003 4004 // numeric x and y parameters for Expr.filter.CHILD 4005 // remember that false/true cast respectively to 0/1 4006 match[ 4 ] = +( match[ 4 ] ? 4007 match[ 5 ] + ( match[ 6 ] || 1 ) : 4008 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); 4009 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 4010 4011 // other types prohibit arguments 4012 } else if ( match[ 3 ] ) { 4013 Sizzle.error( match[ 0 ] ); 4014 } 4015 4016 return match; 4017 }, 4018 4019 "PSEUDO": function( match ) { 4020 var excess, 4021 unquoted = !match[ 6 ] && match[ 2 ]; 4022 4023 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { 4024 return null; 4025 } 4026 4027 // Accept quoted arguments as-is 4028 if ( match[ 3 ] ) { 4029 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 4030 4031 // Strip excess characters from unquoted arguments 4032 } else if ( unquoted && rpseudo.test( unquoted ) && 4033 4034 // Get excess from tokenize (recursively) 4035 ( excess = tokenize( unquoted, true ) ) && 4036 4037 // advance to the next closing parenthesis 4038 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 4039 4040 // excess is a negative index 4041 match[ 0 ] = match[ 0 ].slice( 0, excess ); 4042 match[ 2 ] = unquoted.slice( 0, excess ); 4043 } 4044 4045 // Return only captures needed by the pseudo filter method (type and argument) 4046 return match.slice( 0, 3 ); 4047 } 4048 }, 4049 4050 filter: { 4051 4052 "TAG": function( nodeNameSelector ) { 4053 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 4054 return nodeNameSelector === "*" ? 4055 function() { 4056 return true; 4057 } : 4058 function( elem ) { 4059 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 4060 }; 4061 }, 4062 4063 "CLASS": function( className ) { 4064 var pattern = classCache[ className + " " ]; 4065 4066 return pattern || 4067 ( pattern = new RegExp( "(^|" + whitespace + 4068 ")" + className + "(" + whitespace + "|$)" ) ) && classCache( 4069 className, function( elem ) { 4070 return pattern.test( 4071 typeof elem.className === "string" && elem.className || 4072 typeof elem.getAttribute !== "undefined" && 4073 elem.getAttribute( "class" ) || 4074 "" 4075 ); 4076 } ); 4077 }, 4078 4079 "ATTR": function( name, operator, check ) { 4080 return function( elem ) { 4081 var result = Sizzle.attr( elem, name ); 4082 4083 if ( result == null ) { 4084 return operator === "!="; 4085 } 4086 if ( !operator ) { 4087 return true; 4088 } 4089 4090 result += ""; 4091 4092 /* eslint-disable max-len */ 4093 4094 return operator === "=" ? result === check : 4095 operator === "!=" ? result !== check : 4096 operator === "^=" ? check && result.indexOf( check ) === 0 : 4097 operator === "*=" ? check && result.indexOf( check ) > -1 : 4098 operator === "$=" ? check && result.slice( -check.length ) === check : 4099 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 4100 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 4101 false; 4102 /* eslint-enable max-len */ 4103 4104 }; 4105 }, 4106 4107 "CHILD": function( type, what, _argument, first, last ) { 4108 var simple = type.slice( 0, 3 ) !== "nth", 4109 forward = type.slice( -4 ) !== "last", 4110 ofType = what === "of-type"; 4111 4112 return first === 1 && last === 0 ? 4113 4114 // Shortcut for :nth-*(n) 4115 function( elem ) { 4116 return !!elem.parentNode; 4117 } : 4118 4119 function( elem, _context, xml ) { 4120 var cache, uniqueCache, outerCache, node, nodeIndex, start, 4121 dir = simple !== forward ? "nextSibling" : "previousSibling", 4122 parent = elem.parentNode, 4123 name = ofType && elem.nodeName.toLowerCase(), 4124 useCache = !xml && !ofType, 4125 diff = false; 4126 4127 if ( parent ) { 4128 4129 // :(first|last|only)-(child|of-type) 4130 if ( simple ) { 4131 while ( dir ) { 4132 node = elem; 4133 while ( ( node = node[ dir ] ) ) { 4134 if ( ofType ? 4135 node.nodeName.toLowerCase() === name : 4136 node.nodeType === 1 ) { 4137 4138 return false; 4139 } 4140 } 4141 4142 // Reverse direction for :only-* (if we haven't yet done so) 4143 start = dir = type === "only" && !start && "nextSibling"; 4144 } 4145 return true; 4146 } 4147 4148 start = [ forward ? parent.firstChild : parent.lastChild ]; 4149 4150 // non-xml :nth-child(...) stores cache data on `parent` 4151 if ( forward && useCache ) { 4152 4153 // Seek `elem` from a previously-cached index 4154 4155 // ...in a gzip-friendly way 4156 node = parent; 4157 outerCache = node[ expando ] || ( node[ expando ] = {} ); 4158 4159 // Support: IE <9 only 4160 // Defend against cloned attroperties (jQuery gh-1709) 4161 uniqueCache = outerCache[ node.uniqueID ] || 4162 ( outerCache[ node.uniqueID ] = {} ); 4163 4164 cache = uniqueCache[ type ] || []; 4165 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 4166 diff = nodeIndex && cache[ 2 ]; 4167 node = nodeIndex && parent.childNodes[ nodeIndex ]; 4168 4169 while ( ( node = ++nodeIndex && node && node[ dir ] || 4170 4171 // Fallback to seeking `elem` from the start 4172 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 4173 4174 // When found, cache indexes on `parent` and break 4175 if ( node.nodeType === 1 && ++diff && node === elem ) { 4176 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 4177 break; 4178 } 4179 } 4180 4181 } else { 4182 4183 // Use previously-cached element index if available 4184 if ( useCache ) { 4185 4186 // ...in a gzip-friendly way 4187 node = elem; 4188 outerCache = node[ expando ] || ( node[ expando ] = {} ); 4189 4190 // Support: IE <9 only 4191 // Defend against cloned attroperties (jQuery gh-1709) 4192 uniqueCache = outerCache[ node.uniqueID ] || 4193 ( outerCache[ node.uniqueID ] = {} ); 4194 4195 cache = uniqueCache[ type ] || []; 4196 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 4197 diff = nodeIndex; 4198 } 4199 4200 // xml :nth-child(...) 4201 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 4202 if ( diff === false ) { 4203 4204 // Use the same loop as above to seek `elem` from the start 4205 while ( ( node = ++nodeIndex && node && node[ dir ] || 4206 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 4207 4208 if ( ( ofType ? 4209 node.nodeName.toLowerCase() === name : 4210 node.nodeType === 1 ) && 4211 ++diff ) { 4212 4213 // Cache the index of each encountered element 4214 if ( useCache ) { 4215 outerCache = node[ expando ] || 4216 ( node[ expando ] = {} ); 4217 4218 // Support: IE <9 only 4219 // Defend against cloned attroperties (jQuery gh-1709) 4220 uniqueCache = outerCache[ node.uniqueID ] || 4221 ( outerCache[ node.uniqueID ] = {} ); 4222 4223 uniqueCache[ type ] = [ dirruns, diff ]; 4224 } 4225 4226 if ( node === elem ) { 4227 break; 4228 } 4229 } 4230 } 4231 } 4232 } 4233 4234 // Incorporate the offset, then check against cycle size 4235 diff -= last; 4236 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 4237 } 4238 }; 4239 }, 4240 4241 "PSEUDO": function( pseudo, argument ) { 4242 4243 // pseudo-class names are case-insensitive 4244 // http://www.w3.org/TR/selectors/#pseudo-classes 4245 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 4246 // Remember that setFilters inherits from pseudos 4247 var args, 4248 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 4249 Sizzle.error( "unsupported pseudo: " + pseudo ); 4250 4251 // The user may use createPseudo to indicate that 4252 // arguments are needed to create the filter function 4253 // just as Sizzle does 4254 if ( fn[ expando ] ) { 4255 return fn( argument ); 4256 } 4257 4258 // But maintain support for old signatures 4259 if ( fn.length > 1 ) { 4260 args = [ pseudo, pseudo, "", argument ]; 4261 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 4262 markFunction( function( seed, matches ) { 4263 var idx, 4264 matched = fn( seed, argument ), 4265 i = matched.length; 4266 while ( i-- ) { 4267 idx = indexOf( seed, matched[ i ] ); 4268 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 4269 } 4270 } ) : 4271 function( elem ) { 4272 return fn( elem, 0, args ); 4273 }; 4274 } 4275 4276 return fn; 4277 } 4278 }, 4279 4280 pseudos: { 4281 4282 // Potentially complex pseudos 4283 "not": markFunction( function( selector ) { 4284 4285 // Trim the selector passed to compile 4286 // to avoid treating leading and trailing 4287 // spaces as combinators 4288 var input = [], 4289 results = [], 4290 matcher = compile( selector.replace( rtrim, "$1" ) ); 4291 4292 return matcher[ expando ] ? 4293 markFunction( function( seed, matches, _context, xml ) { 4294 var elem, 4295 unmatched = matcher( seed, null, xml, [] ), 4296 i = seed.length; 4297 4298 // Match elements unmatched by `matcher` 4299 while ( i-- ) { 4300 if ( ( elem = unmatched[ i ] ) ) { 4301 seed[ i ] = !( matches[ i ] = elem ); 4302 } 4303 } 4304 } ) : 4305 function( elem, _context, xml ) { 4306 input[ 0 ] = elem; 4307 matcher( input, null, xml, results ); 4308 4309 // Don't keep the element (issue #299) 4310 input[ 0 ] = null; 4311 return !results.pop(); 4312 }; 4313 } ), 4314 4315 "has": markFunction( function( selector ) { 4316 return function( elem ) { 4317 return Sizzle( selector, elem ).length > 0; 4318 }; 4319 } ), 4320 4321 "contains": markFunction( function( text ) { 4322 text = text.replace( runescape, funescape ); 4323 return function( elem ) { 4324 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; 4325 }; 4326 } ), 4327 4328 // "Whether an element is represented by a :lang() selector 4329 // is based solely on the element's language value 4330 // being equal to the identifier C, 4331 // or beginning with the identifier C immediately followed by "-". 4332 // The matching of C against the element's language value is performed case-insensitively. 4333 // The identifier C does not have to be a valid language name." 4334 // http://www.w3.org/TR/selectors/#lang-pseudo 4335 "lang": markFunction( function( lang ) { 4336 4337 // lang value must be a valid identifier 4338 if ( !ridentifier.test( lang || "" ) ) { 4339 Sizzle.error( "unsupported lang: " + lang ); 4340 } 4341 lang = lang.replace( runescape, funescape ).toLowerCase(); 4342 return function( elem ) { 4343 var elemLang; 4344 do { 4345 if ( ( elemLang = documentIsHTML ? 4346 elem.lang : 4347 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 4348 4349 elemLang = elemLang.toLowerCase(); 4350 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 4351 } 4352 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 4353 return false; 4354 }; 4355 } ), 4356 4357 // Miscellaneous 4358 "target": function( elem ) { 4359 var hash = window.location && window.location.hash; 4360 return hash && hash.slice( 1 ) === elem.id; 4361 }, 4362 4363 "root": function( elem ) { 4364 return elem === docElem; 4365 }, 4366 4367 "focus": function( elem ) { 4368 return elem === document.activeElement && 4369 ( !document.hasFocus || document.hasFocus() ) && 4370 !!( elem.type || elem.href || ~elem.tabIndex ); 4371 }, 4372 4373 // Boolean properties 4374 "enabled": createDisabledPseudo( false ), 4375 "disabled": createDisabledPseudo( true ), 4376 4377 "checked": function( elem ) { 4378 4379 // In CSS3, :checked should return both checked and selected elements 4380 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 4381 var nodeName = elem.nodeName.toLowerCase(); 4382 return ( nodeName === "input" && !!elem.checked ) || 4383 ( nodeName === "option" && !!elem.selected ); 4384 }, 4385 4386 "selected": function( elem ) { 4387 4388 // Accessing this property makes selected-by-default 4389 // options in Safari work properly 4390 if ( elem.parentNode ) { 4391 // eslint-disable-next-line no-unused-expressions 4392 elem.parentNode.selectedIndex; 4393 } 4394 4395 return elem.selected === true; 4396 }, 4397 4398 // Contents 4399 "empty": function( elem ) { 4400 4401 // http://www.w3.org/TR/selectors/#empty-pseudo 4402 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 4403 // but not by others (comment: 8; processing instruction: 7; etc.) 4404 // nodeType < 6 works because attributes (2) do not appear as children 4405 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 4406 if ( elem.nodeType < 6 ) { 4407 return false; 4408 } 4409 } 4410 return true; 4411 }, 4412 4413 "parent": function( elem ) { 4414 return !Expr.pseudos[ "empty" ]( elem ); 4415 }, 4416 4417 // Element/input types 4418 "header": function( elem ) { 4419 return rheader.test( elem.nodeName ); 4420 }, 4421 4422 "input": function( elem ) { 4423 return rinputs.test( elem.nodeName ); 4424 }, 4425 4426 "button": function( elem ) { 4427 var name = elem.nodeName.toLowerCase(); 4428 return name === "input" && elem.type === "button" || name === "button"; 4429 }, 4430 4431 "text": function( elem ) { 4432 var attr; 4433 return elem.nodeName.toLowerCase() === "input" && 4434 elem.type === "text" && 4435 4436 // Support: IE <10 only 4437 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 4438 ( ( attr = elem.getAttribute( "type" ) ) == null || 4439 attr.toLowerCase() === "text" ); 4440 }, 4441 4442 // Position-in-collection 4443 "first": createPositionalPseudo( function() { 4444 return [ 0 ]; 4445 } ), 4446 4447 "last": createPositionalPseudo( function( _matchIndexes, length ) { 4448 return [ length - 1 ]; 4449 } ), 4450 4451 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { 4452 return [ argument < 0 ? argument + length : argument ]; 4453 } ), 4454 4455 "even": createPositionalPseudo( function( matchIndexes, length ) { 4456 var i = 0; 4457 for ( ; i < length; i += 2 ) { 4458 matchIndexes.push( i ); 4459 } 4460 return matchIndexes; 4461 } ), 4462 4463 "odd": createPositionalPseudo( function( matchIndexes, length ) { 4464 var i = 1; 4465 for ( ; i < length; i += 2 ) { 4466 matchIndexes.push( i ); 4467 } 4468 return matchIndexes; 4469 } ), 4470 4471 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { 4472 var i = argument < 0 ? 4473 argument + length : 4474 argument > length ? 4475 length : 4476 argument; 4477 for ( ; --i >= 0; ) { 4478 matchIndexes.push( i ); 4479 } 4480 return matchIndexes; 4481 } ), 4482 4483 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { 4484 var i = argument < 0 ? argument + length : argument; 4485 for ( ; ++i < length; ) { 4486 matchIndexes.push( i ); 4487 } 4488 return matchIndexes; 4489 } ) 4490 } 4491}; 4492 4493Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; 4494 4495// Add button/input type pseudos 4496for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 4497 Expr.pseudos[ i ] = createInputPseudo( i ); 4498} 4499for ( i in { submit: true, reset: true } ) { 4500 Expr.pseudos[ i ] = createButtonPseudo( i ); 4501} 4502 4503// Easy API for creating new setFilters 4504function setFilters() {} 4505setFilters.prototype = Expr.filters = Expr.pseudos; 4506Expr.setFilters = new setFilters(); 4507 4508tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 4509 var matched, match, tokens, type, 4510 soFar, groups, preFilters, 4511 cached = tokenCache[ selector + " " ]; 4512 4513 if ( cached ) { 4514 return parseOnly ? 0 : cached.slice( 0 ); 4515 } 4516 4517 soFar = selector; 4518 groups = []; 4519 preFilters = Expr.preFilter; 4520 4521 while ( soFar ) { 4522 4523 // Comma and first run 4524 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 4525 if ( match ) { 4526 4527 // Don't consume trailing commas as valid 4528 soFar = soFar.slice( match[ 0 ].length ) || soFar; 4529 } 4530 groups.push( ( tokens = [] ) ); 4531 } 4532 4533 matched = false; 4534 4535 // Combinators 4536 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 4537 matched = match.shift(); 4538 tokens.push( { 4539 value: matched, 4540 4541 // Cast descendant combinators to space 4542 type: match[ 0 ].replace( rtrim, " " ) 4543 } ); 4544 soFar = soFar.slice( matched.length ); 4545 } 4546 4547 // Filters 4548 for ( type in Expr.filter ) { 4549 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 4550 ( match = preFilters[ type ]( match ) ) ) ) { 4551 matched = match.shift(); 4552 tokens.push( { 4553 value: matched, 4554 type: type, 4555 matches: match 4556 } ); 4557 soFar = soFar.slice( matched.length ); 4558 } 4559 } 4560 4561 if ( !matched ) { 4562 break; 4563 } 4564 } 4565 4566 // Return the length of the invalid excess 4567 // if we're just parsing 4568 // Otherwise, throw an error or return tokens 4569 return parseOnly ? 4570 soFar.length : 4571 soFar ? 4572 Sizzle.error( selector ) : 4573 4574 // Cache the tokens 4575 tokenCache( selector, groups ).slice( 0 ); 4576}; 4577 4578function toSelector( tokens ) { 4579 var i = 0, 4580 len = tokens.length, 4581 selector = ""; 4582 for ( ; i < len; i++ ) { 4583 selector += tokens[ i ].value; 4584 } 4585 return selector; 4586} 4587 4588function addCombinator( matcher, combinator, base ) { 4589 var dir = combinator.dir, 4590 skip = combinator.next, 4591 key = skip || dir, 4592 checkNonElements = base && key === "parentNode", 4593 doneName = done++; 4594 4595 return combinator.first ? 4596 4597 // Check against closest ancestor/preceding element 4598 function( elem, context, xml ) { 4599 while ( ( elem = elem[ dir ] ) ) { 4600 if ( elem.nodeType === 1 || checkNonElements ) { 4601 return matcher( elem, context, xml ); 4602 } 4603 } 4604 return false; 4605 } : 4606 4607 // Check against all ancestor/preceding elements 4608 function( elem, context, xml ) { 4609 var oldCache, uniqueCache, outerCache, 4610 newCache = [ dirruns, doneName ]; 4611 4612 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 4613 if ( xml ) { 4614 while ( ( elem = elem[ dir ] ) ) { 4615 if ( elem.nodeType === 1 || checkNonElements ) { 4616 if ( matcher( elem, context, xml ) ) { 4617 return true; 4618 } 4619 } 4620 } 4621 } else { 4622 while ( ( elem = elem[ dir ] ) ) { 4623 if ( elem.nodeType === 1 || checkNonElements ) { 4624 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 4625 4626 // Support: IE <9 only 4627 // Defend against cloned attroperties (jQuery gh-1709) 4628 uniqueCache = outerCache[ elem.uniqueID ] || 4629 ( outerCache[ elem.uniqueID ] = {} ); 4630 4631 if ( skip && skip === elem.nodeName.toLowerCase() ) { 4632 elem = elem[ dir ] || elem; 4633 } else if ( ( oldCache = uniqueCache[ key ] ) && 4634 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 4635 4636 // Assign to newCache so results back-propagate to previous elements 4637 return ( newCache[ 2 ] = oldCache[ 2 ] ); 4638 } else { 4639 4640 // Reuse newcache so results back-propagate to previous elements 4641 uniqueCache[ key ] = newCache; 4642 4643 // A match means we're done; a fail means we have to keep checking 4644 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 4645 return true; 4646 } 4647 } 4648 } 4649 } 4650 } 4651 return false; 4652 }; 4653} 4654 4655function elementMatcher( matchers ) { 4656 return matchers.length > 1 ? 4657 function( elem, context, xml ) { 4658 var i = matchers.length; 4659 while ( i-- ) { 4660 if ( !matchers[ i ]( elem, context, xml ) ) { 4661 return false; 4662 } 4663 } 4664 return true; 4665 } : 4666 matchers[ 0 ]; 4667} 4668 4669function multipleContexts( selector, contexts, results ) { 4670 var i = 0, 4671 len = contexts.length; 4672 for ( ; i < len; i++ ) { 4673 Sizzle( selector, contexts[ i ], results ); 4674 } 4675 return results; 4676} 4677 4678function condense( unmatched, map, filter, context, xml ) { 4679 var elem, 4680 newUnmatched = [], 4681 i = 0, 4682 len = unmatched.length, 4683 mapped = map != null; 4684 4685 for ( ; i < len; i++ ) { 4686 if ( ( elem = unmatched[ i ] ) ) { 4687 if ( !filter || filter( elem, context, xml ) ) { 4688 newUnmatched.push( elem ); 4689 if ( mapped ) { 4690 map.push( i ); 4691 } 4692 } 4693 } 4694 } 4695 4696 return newUnmatched; 4697} 4698 4699function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 4700 if ( postFilter && !postFilter[ expando ] ) { 4701 postFilter = setMatcher( postFilter ); 4702 } 4703 if ( postFinder && !postFinder[ expando ] ) { 4704 postFinder = setMatcher( postFinder, postSelector ); 4705 } 4706 return markFunction( function( seed, results, context, xml ) { 4707 var temp, i, elem, 4708 preMap = [], 4709 postMap = [], 4710 preexisting = results.length, 4711 4712 // Get initial elements from seed or context 4713 elems = seed || multipleContexts( 4714 selector || "*", 4715 context.nodeType ? [ context ] : context, 4716 [] 4717 ), 4718 4719 // Prefilter to get matcher input, preserving a map for seed-results synchronization 4720 matcherIn = preFilter && ( seed || !selector ) ? 4721 condense( elems, preMap, preFilter, context, xml ) : 4722 elems, 4723 4724 matcherOut = matcher ? 4725 4726 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 4727 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 4728 4729 // ...intermediate processing is necessary 4730 [] : 4731 4732 // ...otherwise use results directly 4733 results : 4734 matcherIn; 4735 4736 // Find primary matches 4737 if ( matcher ) { 4738 matcher( matcherIn, matcherOut, context, xml ); 4739 } 4740 4741 // Apply postFilter 4742 if ( postFilter ) { 4743 temp = condense( matcherOut, postMap ); 4744 postFilter( temp, [], context, xml ); 4745 4746 // Un-match failing elements by moving them back to matcherIn 4747 i = temp.length; 4748 while ( i-- ) { 4749 if ( ( elem = temp[ i ] ) ) { 4750 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 4751 } 4752 } 4753 } 4754 4755 if ( seed ) { 4756 if ( postFinder || preFilter ) { 4757 if ( postFinder ) { 4758 4759 // Get the final matcherOut by condensing this intermediate into postFinder contexts 4760 temp = []; 4761 i = matcherOut.length; 4762 while ( i-- ) { 4763 if ( ( elem = matcherOut[ i ] ) ) { 4764 4765 // Restore matcherIn since elem is not yet a final match 4766 temp.push( ( matcherIn[ i ] = elem ) ); 4767 } 4768 } 4769 postFinder( null, ( matcherOut = [] ), temp, xml ); 4770 } 4771 4772 // Move matched elements from seed to results to keep them synchronized 4773 i = matcherOut.length; 4774 while ( i-- ) { 4775 if ( ( elem = matcherOut[ i ] ) && 4776 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { 4777 4778 seed[ temp ] = !( results[ temp ] = elem ); 4779 } 4780 } 4781 } 4782 4783 // Add elements to results, through postFinder if defined 4784 } else { 4785 matcherOut = condense( 4786 matcherOut === results ? 4787 matcherOut.splice( preexisting, matcherOut.length ) : 4788 matcherOut 4789 ); 4790 if ( postFinder ) { 4791 postFinder( null, results, matcherOut, xml ); 4792 } else { 4793 push.apply( results, matcherOut ); 4794 } 4795 } 4796 } ); 4797} 4798 4799function matcherFromTokens( tokens ) { 4800 var checkContext, matcher, j, 4801 len = tokens.length, 4802 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 4803 implicitRelative = leadingRelative || Expr.relative[ " " ], 4804 i = leadingRelative ? 1 : 0, 4805 4806 // The foundational matcher ensures that elements are reachable from top-level context(s) 4807 matchContext = addCombinator( function( elem ) { 4808 return elem === checkContext; 4809 }, implicitRelative, true ), 4810 matchAnyContext = addCombinator( function( elem ) { 4811 return indexOf( checkContext, elem ) > -1; 4812 }, implicitRelative, true ), 4813 matchers = [ function( elem, context, xml ) { 4814 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 4815 ( checkContext = context ).nodeType ? 4816 matchContext( elem, context, xml ) : 4817 matchAnyContext( elem, context, xml ) ); 4818 4819 // Avoid hanging onto element (issue #299) 4820 checkContext = null; 4821 return ret; 4822 } ]; 4823 4824 for ( ; i < len; i++ ) { 4825 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 4826 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 4827 } else { 4828 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 4829 4830 // Return special upon seeing a positional matcher 4831 if ( matcher[ expando ] ) { 4832 4833 // Find the next relative operator (if any) for proper handling 4834 j = ++i; 4835 for ( ; j < len; j++ ) { 4836 if ( Expr.relative[ tokens[ j ].type ] ) { 4837 break; 4838 } 4839 } 4840 return setMatcher( 4841 i > 1 && elementMatcher( matchers ), 4842 i > 1 && toSelector( 4843 4844 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 4845 tokens 4846 .slice( 0, i - 1 ) 4847 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 4848 ).replace( rtrim, "$1" ), 4849 matcher, 4850 i < j && matcherFromTokens( tokens.slice( i, j ) ), 4851 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 4852 j < len && toSelector( tokens ) 4853 ); 4854 } 4855 matchers.push( matcher ); 4856 } 4857 } 4858 4859 return elementMatcher( matchers ); 4860} 4861 4862function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 4863 var bySet = setMatchers.length > 0, 4864 byElement = elementMatchers.length > 0, 4865 superMatcher = function( seed, context, xml, results, outermost ) { 4866 var elem, j, matcher, 4867 matchedCount = 0, 4868 i = "0", 4869 unmatched = seed && [], 4870 setMatched = [], 4871 contextBackup = outermostContext, 4872 4873 // We must always have either seed elements or outermost context 4874 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), 4875 4876 // Use integer dirruns iff this is the outermost matcher 4877 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 4878 len = elems.length; 4879 4880 if ( outermost ) { 4881 4882 // Support: IE 11+, Edge 17 - 18+ 4883 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 4884 // two documents; shallow comparisons work. 4885 // eslint-disable-next-line eqeqeq 4886 outermostContext = context == document || context || outermost; 4887 } 4888 4889 // Add elements passing elementMatchers directly to results 4890 // Support: IE<9, Safari 4891 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 4892 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 4893 if ( byElement && elem ) { 4894 j = 0; 4895 4896 // Support: IE 11+, Edge 17 - 18+ 4897 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 4898 // two documents; shallow comparisons work. 4899 // eslint-disable-next-line eqeqeq 4900 if ( !context && elem.ownerDocument != document ) { 4901 setDocument( elem ); 4902 xml = !documentIsHTML; 4903 } 4904 while ( ( matcher = elementMatchers[ j++ ] ) ) { 4905 if ( matcher( elem, context || document, xml ) ) { 4906 results.push( elem ); 4907 break; 4908 } 4909 } 4910 if ( outermost ) { 4911 dirruns = dirrunsUnique; 4912 } 4913 } 4914 4915 // Track unmatched elements for set filters 4916 if ( bySet ) { 4917 4918 // They will have gone through all possible matchers 4919 if ( ( elem = !matcher && elem ) ) { 4920 matchedCount--; 4921 } 4922 4923 // Lengthen the array for every element, matched or not 4924 if ( seed ) { 4925 unmatched.push( elem ); 4926 } 4927 } 4928 } 4929 4930 // `i` is now the count of elements visited above, and adding it to `matchedCount` 4931 // makes the latter nonnegative. 4932 matchedCount += i; 4933 4934 // Apply set filters to unmatched elements 4935 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 4936 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 4937 // no element matchers and no seed. 4938 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 4939 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 4940 // numerically zero. 4941 if ( bySet && i !== matchedCount ) { 4942 j = 0; 4943 while ( ( matcher = setMatchers[ j++ ] ) ) { 4944 matcher( unmatched, setMatched, context, xml ); 4945 } 4946 4947 if ( seed ) { 4948 4949 // Reintegrate element matches to eliminate the need for sorting 4950 if ( matchedCount > 0 ) { 4951 while ( i-- ) { 4952 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 4953 setMatched[ i ] = pop.call( results ); 4954 } 4955 } 4956 } 4957 4958 // Discard index placeholder values to get only actual matches 4959 setMatched = condense( setMatched ); 4960 } 4961 4962 // Add matches to results 4963 push.apply( results, setMatched ); 4964 4965 // Seedless set matches succeeding multiple successful matchers stipulate sorting 4966 if ( outermost && !seed && setMatched.length > 0 && 4967 ( matchedCount + setMatchers.length ) > 1 ) { 4968 4969 Sizzle.uniqueSort( results ); 4970 } 4971 } 4972 4973 // Override manipulation of globals by nested matchers 4974 if ( outermost ) { 4975 dirruns = dirrunsUnique; 4976 outermostContext = contextBackup; 4977 } 4978 4979 return unmatched; 4980 }; 4981 4982 return bySet ? 4983 markFunction( superMatcher ) : 4984 superMatcher; 4985} 4986 4987compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 4988 var i, 4989 setMatchers = [], 4990 elementMatchers = [], 4991 cached = compilerCache[ selector + " " ]; 4992 4993 if ( !cached ) { 4994 4995 // Generate a function of recursive functions that can be used to check each element 4996 if ( !match ) { 4997 match = tokenize( selector ); 4998 } 4999 i = match.length; 5000 while ( i-- ) { 5001 cached = matcherFromTokens( match[ i ] ); 5002 if ( cached[ expando ] ) { 5003 setMatchers.push( cached ); 5004 } else { 5005 elementMatchers.push( cached ); 5006 } 5007 } 5008 5009 // Cache the compiled function 5010 cached = compilerCache( 5011 selector, 5012 matcherFromGroupMatchers( elementMatchers, setMatchers ) 5013 ); 5014 5015 // Save selector and tokenization 5016 cached.selector = selector; 5017 } 5018 return cached; 5019}; 5020 5021/** 5022 * A low-level selection function that works with Sizzle's compiled 5023 * selector functions 5024 * @param {String|Function} selector A selector or a pre-compiled 5025 * selector function built with Sizzle.compile 5026 * @param {Element} context 5027 * @param {Array} [results] 5028 * @param {Array} [seed] A set of elements to match against 5029 */ 5030select = Sizzle.select = function( selector, context, results, seed ) { 5031 var i, tokens, token, type, find, 5032 compiled = typeof selector === "function" && selector, 5033 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 5034 5035 results = results || []; 5036 5037 // Try to minimize operations if there is only one selector in the list and no seed 5038 // (the latter of which guarantees us context) 5039 if ( match.length === 1 ) { 5040 5041 // Reduce context if the leading compound selector is an ID 5042 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 5043 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 5044 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 5045 5046 context = ( Expr.find[ "ID" ]( token.matches[ 0 ] 5047 .replace( runescape, funescape ), context ) || [] )[ 0 ]; 5048 if ( !context ) { 5049 return results; 5050 5051 // Precompiled matchers will still verify ancestry, so step up a level 5052 } else if ( compiled ) { 5053 context = context.parentNode; 5054 } 5055 5056 selector = selector.slice( tokens.shift().value.length ); 5057 } 5058 5059 // Fetch a seed set for right-to-left matching 5060 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; 5061 while ( i-- ) { 5062 token = tokens[ i ]; 5063 5064 // Abort if we hit a combinator 5065 if ( Expr.relative[ ( type = token.type ) ] ) { 5066 break; 5067 } 5068 if ( ( find = Expr.find[ type ] ) ) { 5069 5070 // Search, expanding context for leading sibling combinators 5071 if ( ( seed = find( 5072 token.matches[ 0 ].replace( runescape, funescape ), 5073 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || 5074 context 5075 ) ) ) { 5076 5077 // If seed is empty or no tokens remain, we can return early 5078 tokens.splice( i, 1 ); 5079 selector = seed.length && toSelector( tokens ); 5080 if ( !selector ) { 5081 push.apply( results, seed ); 5082 return results; 5083 } 5084 5085 break; 5086 } 5087 } 5088 } 5089 } 5090 5091 // Compile and execute a filtering function if one is not provided 5092 // Provide `match` to avoid retokenization if we modified the selector above 5093 ( compiled || compile( selector, match ) )( 5094 seed, 5095 context, 5096 !documentIsHTML, 5097 results, 5098 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 5099 ); 5100 return results; 5101}; 5102 5103// One-time assignments 5104 5105// Sort stability 5106support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 5107 5108// Support: Chrome 14-35+ 5109// Always assume duplicates if they aren't passed to the comparison function 5110support.detectDuplicates = !!hasDuplicate; 5111 5112// Initialize against the default document 5113setDocument(); 5114 5115// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 5116// Detached nodes confoundingly follow *each other* 5117support.sortDetached = assert( function( el ) { 5118 5119 // Should return 1, but returns 4 (following) 5120 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 5121} ); 5122 5123// Support: IE<8 5124// Prevent attribute/property "interpolation" 5125// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 5126if ( !assert( function( el ) { 5127 el.innerHTML = "<a href='#'></a>"; 5128 return el.firstChild.getAttribute( "href" ) === "#"; 5129} ) ) { 5130 addHandle( "type|href|height|width", function( elem, name, isXML ) { 5131 if ( !isXML ) { 5132 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 5133 } 5134 } ); 5135} 5136 5137// Support: IE<9 5138// Use defaultValue in place of getAttribute("value") 5139if ( !support.attributes || !assert( function( el ) { 5140 el.innerHTML = "<input/>"; 5141 el.firstChild.setAttribute( "value", "" ); 5142 return el.firstChild.getAttribute( "value" ) === ""; 5143} ) ) { 5144 addHandle( "value", function( elem, _name, isXML ) { 5145 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 5146 return elem.defaultValue; 5147 } 5148 } ); 5149} 5150 5151// Support: IE<9 5152// Use getAttributeNode to fetch booleans when getAttribute lies 5153if ( !assert( function( el ) { 5154 return el.getAttribute( "disabled" ) == null; 5155} ) ) { 5156 addHandle( booleans, function( elem, name, isXML ) { 5157 var val; 5158 if ( !isXML ) { 5159 return elem[ name ] === true ? name.toLowerCase() : 5160 ( val = elem.getAttributeNode( name ) ) && val.specified ? 5161 val.value : 5162 null; 5163 } 5164 } ); 5165} 5166 5167return Sizzle; 5168 5169} )( window ); 5170 5171 5172 5173jQuery.find = Sizzle; 5174jQuery.expr = Sizzle.selectors; 5175 5176// Deprecated 5177jQuery.expr[ ":" ] = jQuery.expr.pseudos; 5178jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 5179jQuery.text = Sizzle.getText; 5180jQuery.isXMLDoc = Sizzle.isXML; 5181jQuery.contains = Sizzle.contains; 5182jQuery.escapeSelector = Sizzle.escape; 5183 5184 5185 5186 5187var dir = function( elem, dir, until ) { 5188 var matched = [], 5189 truncate = until !== undefined; 5190 5191 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 5192 if ( elem.nodeType === 1 ) { 5193 if ( truncate && jQuery( elem ).is( until ) ) { 5194 break; 5195 } 5196 matched.push( elem ); 5197 } 5198 } 5199 return matched; 5200}; 5201 5202 5203var siblings = function( n, elem ) { 5204 var matched = []; 5205 5206 for ( ; n; n = n.nextSibling ) { 5207 if ( n.nodeType === 1 && n !== elem ) { 5208 matched.push( n ); 5209 } 5210 } 5211 5212 return matched; 5213}; 5214 5215 5216var rneedsContext = jQuery.expr.match.needsContext; 5217 5218 5219 5220function nodeName( elem, name ) { 5221 5222 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 5223 5224} 5225var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 5226 5227 5228 5229// Implement the identical functionality for filter and not 5230function winnow( elements, qualifier, not ) { 5231 if ( isFunction( qualifier ) ) { 5232 return jQuery.grep( elements, function( elem, i ) { 5233 return !!qualifier.call( elem, i, elem ) !== not; 5234 } ); 5235 } 5236 5237 // Single element 5238 if ( qualifier.nodeType ) { 5239 return jQuery.grep( elements, function( elem ) { 5240 return ( elem === qualifier ) !== not; 5241 } ); 5242 } 5243 5244 // Arraylike of elements (jQuery, arguments, Array) 5245 if ( typeof qualifier !== "string" ) { 5246 return jQuery.grep( elements, function( elem ) { 5247 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 5248 } ); 5249 } 5250 5251 // Filtered directly for both simple and complex selectors 5252 return jQuery.filter( qualifier, elements, not ); 5253} 5254 5255jQuery.filter = function( expr, elems, not ) { 5256 var elem = elems[ 0 ]; 5257 5258 if ( not ) { 5259 expr = ":not(" + expr + ")"; 5260 } 5261 5262 if ( elems.length === 1 && elem.nodeType === 1 ) { 5263 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 5264 } 5265 5266 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 5267 return elem.nodeType === 1; 5268 } ) ); 5269}; 5270 5271jQuery.fn.extend( { 5272 find: function( selector ) { 5273 var i, ret, 5274 len = this.length, 5275 self = this; 5276 5277 if ( typeof selector !== "string" ) { 5278 return this.pushStack( jQuery( selector ).filter( function() { 5279 for ( i = 0; i < len; i++ ) { 5280 if ( jQuery.contains( self[ i ], this ) ) { 5281 return true; 5282 } 5283 } 5284 } ) ); 5285 } 5286 5287 ret = this.pushStack( [] ); 5288 5289 for ( i = 0; i < len; i++ ) { 5290 jQuery.find( selector, self[ i ], ret ); 5291 } 5292 5293 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 5294 }, 5295 filter: function( selector ) { 5296 return this.pushStack( winnow( this, selector || [], false ) ); 5297 }, 5298 not: function( selector ) { 5299 return this.pushStack( winnow( this, selector || [], true ) ); 5300 }, 5301 is: function( selector ) { 5302 return !!winnow( 5303 this, 5304 5305 // If this is a positional/relative selector, check membership in the returned set 5306 // so $("p:first").is("p:last") won't return true for a doc with two "p". 5307 typeof selector === "string" && rneedsContext.test( selector ) ? 5308 jQuery( selector ) : 5309 selector || [], 5310 false 5311 ).length; 5312 } 5313} ); 5314 5315 5316// Initialize a jQuery object 5317 5318 5319// A central reference to the root jQuery(document) 5320var rootjQuery, 5321 5322 // A simple way to check for HTML strings 5323 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 5324 // Strict HTML recognition (trac-11290: must start with <) 5325 // Shortcut simple #id case for speed 5326 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 5327 5328 init = jQuery.fn.init = function( selector, context, root ) { 5329 var match, elem; 5330 5331 // HANDLE: $(""), $(null), $(undefined), $(false) 5332 if ( !selector ) { 5333 return this; 5334 } 5335 5336 // Method init() accepts an alternate rootjQuery 5337 // so migrate can support jQuery.sub (gh-2101) 5338 root = root || rootjQuery; 5339 5340 // Handle HTML strings 5341 if ( typeof selector === "string" ) { 5342 if ( selector[ 0 ] === "<" && 5343 selector[ selector.length - 1 ] === ">" && 5344 selector.length >= 3 ) { 5345 5346 // Assume that strings that start and end with <> are HTML and skip the regex check 5347 match = [ null, selector, null ]; 5348 5349 } else { 5350 match = rquickExpr.exec( selector ); 5351 } 5352 5353 // Match html or make sure no context is specified for #id 5354 if ( match && ( match[ 1 ] || !context ) ) { 5355 5356 // HANDLE: $(html) -> $(array) 5357 if ( match[ 1 ] ) { 5358 context = context instanceof jQuery ? context[ 0 ] : context; 5359 5360 // Option to run scripts is true for back-compat 5361 // Intentionally let the error be thrown if parseHTML is not present 5362 jQuery.merge( this, jQuery.parseHTML( 5363 match[ 1 ], 5364 context && context.nodeType ? context.ownerDocument || context : document, 5365 true 5366 ) ); 5367 5368 // HANDLE: $(html, props) 5369 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 5370 for ( match in context ) { 5371 5372 // Properties of context are called as methods if possible 5373 if ( isFunction( this[ match ] ) ) { 5374 this[ match ]( context[ match ] ); 5375 5376 // ...and otherwise set as attributes 5377 } else { 5378 this.attr( match, context[ match ] ); 5379 } 5380 } 5381 } 5382 5383 return this; 5384 5385 // HANDLE: $(#id) 5386 } else { 5387 elem = document.getElementById( match[ 2 ] ); 5388 5389 if ( elem ) { 5390 5391 // Inject the element directly into the jQuery object 5392 this[ 0 ] = elem; 5393 this.length = 1; 5394 } 5395 return this; 5396 } 5397 5398 // HANDLE: $(expr, $(...)) 5399 } else if ( !context || context.jquery ) { 5400 return ( context || root ).find( selector ); 5401 5402 // HANDLE: $(expr, context) 5403 // (which is just equivalent to: $(context).find(expr) 5404 } else { 5405 return this.constructor( context ).find( selector ); 5406 } 5407 5408 // HANDLE: $(DOMElement) 5409 } else if ( selector.nodeType ) { 5410 this[ 0 ] = selector; 5411 this.length = 1; 5412 return this; 5413 5414 // HANDLE: $(function) 5415 // Shortcut for document ready 5416 } else if ( isFunction( selector ) ) { 5417 return root.ready !== undefined ? 5418 root.ready( selector ) : 5419 5420 // Execute immediately if ready is not present 5421 selector( jQuery ); 5422 } 5423 5424 return jQuery.makeArray( selector, this ); 5425 }; 5426 5427// Give the init function the jQuery prototype for later instantiation 5428init.prototype = jQuery.fn; 5429 5430// Initialize central reference 5431rootjQuery = jQuery( document ); 5432 5433 5434var rparentsprev = /^(?:parents|prev(?:Until|All))/, 5435 5436 // Methods guaranteed to produce a unique set when starting from a unique set 5437 guaranteedUnique = { 5438 children: true, 5439 contents: true, 5440 next: true, 5441 prev: true 5442 }; 5443 5444jQuery.fn.extend( { 5445 has: function( target ) { 5446 var targets = jQuery( target, this ), 5447 l = targets.length; 5448 5449 return this.filter( function() { 5450 var i = 0; 5451 for ( ; i < l; i++ ) { 5452 if ( jQuery.contains( this, targets[ i ] ) ) { 5453 return true; 5454 } 5455 } 5456 } ); 5457 }, 5458 5459 closest: function( selectors, context ) { 5460 var cur, 5461 i = 0, 5462 l = this.length, 5463 matched = [], 5464 targets = typeof selectors !== "string" && jQuery( selectors ); 5465 5466 // Positional selectors never match, since there's no _selection_ context 5467 if ( !rneedsContext.test( selectors ) ) { 5468 for ( ; i < l; i++ ) { 5469 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 5470 5471 // Always skip document fragments 5472 if ( cur.nodeType < 11 && ( targets ? 5473 targets.index( cur ) > -1 : 5474 5475 // Don't pass non-elements to Sizzle 5476 cur.nodeType === 1 && 5477 jQuery.find.matchesSelector( cur, selectors ) ) ) { 5478 5479 matched.push( cur ); 5480 break; 5481 } 5482 } 5483 } 5484 } 5485 5486 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 5487 }, 5488 5489 // Determine the position of an element within the set 5490 index: function( elem ) { 5491 5492 // No argument, return index in parent 5493 if ( !elem ) { 5494 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 5495 } 5496 5497 // Index in selector 5498 if ( typeof elem === "string" ) { 5499 return indexOf.call( jQuery( elem ), this[ 0 ] ); 5500 } 5501 5502 // Locate the position of the desired element 5503 return indexOf.call( this, 5504 5505 // If it receives a jQuery object, the first element is used 5506 elem.jquery ? elem[ 0 ] : elem 5507 ); 5508 }, 5509 5510 add: function( selector, context ) { 5511 return this.pushStack( 5512 jQuery.uniqueSort( 5513 jQuery.merge( this.get(), jQuery( selector, context ) ) 5514 ) 5515 ); 5516 }, 5517 5518 addBack: function( selector ) { 5519 return this.add( selector == null ? 5520 this.prevObject : this.prevObject.filter( selector ) 5521 ); 5522 } 5523} ); 5524 5525function sibling( cur, dir ) { 5526 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 5527 return cur; 5528} 5529 5530jQuery.each( { 5531 parent: function( elem ) { 5532 var parent = elem.parentNode; 5533 return parent && parent.nodeType !== 11 ? parent : null; 5534 }, 5535 parents: function( elem ) { 5536 return dir( elem, "parentNode" ); 5537 }, 5538 parentsUntil: function( elem, _i, until ) { 5539 return dir( elem, "parentNode", until ); 5540 }, 5541 next: function( elem ) { 5542 return sibling( elem, "nextSibling" ); 5543 }, 5544 prev: function( elem ) { 5545 return sibling( elem, "previousSibling" ); 5546 }, 5547 nextAll: function( elem ) { 5548 return dir( elem, "nextSibling" ); 5549 }, 5550 prevAll: function( elem ) { 5551 return dir( elem, "previousSibling" ); 5552 }, 5553 nextUntil: function( elem, _i, until ) { 5554 return dir( elem, "nextSibling", until ); 5555 }, 5556 prevUntil: function( elem, _i, until ) { 5557 return dir( elem, "previousSibling", until ); 5558 }, 5559 siblings: function( elem ) { 5560 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 5561 }, 5562 children: function( elem ) { 5563 return siblings( elem.firstChild ); 5564 }, 5565 contents: function( elem ) { 5566 if ( elem.contentDocument != null && 5567 5568 // Support: IE 11+ 5569 // <object> elements with no `data` attribute has an object 5570 // `contentDocument` with a `null` prototype. 5571 getProto( elem.contentDocument ) ) { 5572 5573 return elem.contentDocument; 5574 } 5575 5576 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 5577 // Treat the template element as a regular one in browsers that 5578 // don't support it. 5579 if ( nodeName( elem, "template" ) ) { 5580 elem = elem.content || elem; 5581 } 5582 5583 return jQuery.merge( [], elem.childNodes ); 5584 } 5585}, function( name, fn ) { 5586 jQuery.fn[ name ] = function( until, selector ) { 5587 var matched = jQuery.map( this, fn, until ); 5588 5589 if ( name.slice( -5 ) !== "Until" ) { 5590 selector = until; 5591 } 5592 5593 if ( selector && typeof selector === "string" ) { 5594 matched = jQuery.filter( selector, matched ); 5595 } 5596 5597 if ( this.length > 1 ) { 5598 5599 // Remove duplicates 5600 if ( !guaranteedUnique[ name ] ) { 5601 jQuery.uniqueSort( matched ); 5602 } 5603 5604 // Reverse order for parents* and prev-derivatives 5605 if ( rparentsprev.test( name ) ) { 5606 matched.reverse(); 5607 } 5608 } 5609 5610 return this.pushStack( matched ); 5611 }; 5612} ); 5613var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 5614 5615 5616 5617// Convert String-formatted options into Object-formatted ones 5618function createOptions( options ) { 5619 var object = {}; 5620 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 5621 object[ flag ] = true; 5622 } ); 5623 return object; 5624} 5625 5626/* 5627 * Create a callback list using the following parameters: 5628 * 5629 * options: an optional list of space-separated options that will change how 5630 * the callback list behaves or a more traditional option object 5631 * 5632 * By default a callback list will act like an event callback list and can be 5633 * "fired" multiple times. 5634 * 5635 * Possible options: 5636 * 5637 * once: will ensure the callback list can only be fired once (like a Deferred) 5638 * 5639 * memory: will keep track of previous values and will call any callback added 5640 * after the list has been fired right away with the latest "memorized" 5641 * values (like a Deferred) 5642 * 5643 * unique: will ensure a callback can only be added once (no duplicate in the list) 5644 * 5645 * stopOnFalse: interrupt callings when a callback returns false 5646 * 5647 */ 5648jQuery.Callbacks = function( options ) { 5649 5650 // Convert options from String-formatted to Object-formatted if needed 5651 // (we check in cache first) 5652 options = typeof options === "string" ? 5653 createOptions( options ) : 5654 jQuery.extend( {}, options ); 5655 5656 var // Flag to know if list is currently firing 5657 firing, 5658 5659 // Last fire value for non-forgettable lists 5660 memory, 5661 5662 // Flag to know if list was already fired 5663 fired, 5664 5665 // Flag to prevent firing 5666 locked, 5667 5668 // Actual callback list 5669 list = [], 5670 5671 // Queue of execution data for repeatable lists 5672 queue = [], 5673 5674 // Index of currently firing callback (modified by add/remove as needed) 5675 firingIndex = -1, 5676 5677 // Fire callbacks 5678 fire = function() { 5679 5680 // Enforce single-firing 5681 locked = locked || options.once; 5682 5683 // Execute callbacks for all pending executions, 5684 // respecting firingIndex overrides and runtime changes 5685 fired = firing = true; 5686 for ( ; queue.length; firingIndex = -1 ) { 5687 memory = queue.shift(); 5688 while ( ++firingIndex < list.length ) { 5689 5690 // Run callback and check for early termination 5691 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 5692 options.stopOnFalse ) { 5693 5694 // Jump to end and forget the data so .add doesn't re-fire 5695 firingIndex = list.length; 5696 memory = false; 5697 } 5698 } 5699 } 5700 5701 // Forget the data if we're done with it 5702 if ( !options.memory ) { 5703 memory = false; 5704 } 5705 5706 firing = false; 5707 5708 // Clean up if we're done firing for good 5709 if ( locked ) { 5710 5711 // Keep an empty list if we have data for future add calls 5712 if ( memory ) { 5713 list = []; 5714 5715 // Otherwise, this object is spent 5716 } else { 5717 list = ""; 5718 } 5719 } 5720 }, 5721 5722 // Actual Callbacks object 5723 self = { 5724 5725 // Add a callback or a collection of callbacks to the list 5726 add: function() { 5727 if ( list ) { 5728 5729 // If we have memory from a past run, we should fire after adding 5730 if ( memory && !firing ) { 5731 firingIndex = list.length - 1; 5732 queue.push( memory ); 5733 } 5734 5735 ( function add( args ) { 5736 jQuery.each( args, function( _, arg ) { 5737 if ( isFunction( arg ) ) { 5738 if ( !options.unique || !self.has( arg ) ) { 5739 list.push( arg ); 5740 } 5741 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 5742 5743 // Inspect recursively 5744 add( arg ); 5745 } 5746 } ); 5747 } )( arguments ); 5748 5749 if ( memory && !firing ) { 5750 fire(); 5751 } 5752 } 5753 return this; 5754 }, 5755 5756 // Remove a callback from the list 5757 remove: function() { 5758 jQuery.each( arguments, function( _, arg ) { 5759 var index; 5760 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 5761 list.splice( index, 1 ); 5762 5763 // Handle firing indexes 5764 if ( index <= firingIndex ) { 5765 firingIndex--; 5766 } 5767 } 5768 } ); 5769 return this; 5770 }, 5771 5772 // Check if a given callback is in the list. 5773 // If no argument is given, return whether or not list has callbacks attached. 5774 has: function( fn ) { 5775 return fn ? 5776 jQuery.inArray( fn, list ) > -1 : 5777 list.length > 0; 5778 }, 5779 5780 // Remove all callbacks from the list 5781 empty: function() { 5782 if ( list ) { 5783 list = []; 5784 } 5785 return this; 5786 }, 5787 5788 // Disable .fire and .add 5789 // Abort any current/pending executions 5790 // Clear all callbacks and values 5791 disable: function() { 5792 locked = queue = []; 5793 list = memory = ""; 5794 return this; 5795 }, 5796 disabled: function() { 5797 return !list; 5798 }, 5799 5800 // Disable .fire 5801 // Also disable .add unless we have memory (since it would have no effect) 5802 // Abort any pending executions 5803 lock: function() { 5804 locked = queue = []; 5805 if ( !memory && !firing ) { 5806 list = memory = ""; 5807 } 5808 return this; 5809 }, 5810 locked: function() { 5811 return !!locked; 5812 }, 5813 5814 // Call all callbacks with the given context and arguments 5815 fireWith: function( context, args ) { 5816 if ( !locked ) { 5817 args = args || []; 5818 args = [ context, args.slice ? args.slice() : args ]; 5819 queue.push( args ); 5820 if ( !firing ) { 5821 fire(); 5822 } 5823 } 5824 return this; 5825 }, 5826 5827 // Call all the callbacks with the given arguments 5828 fire: function() { 5829 self.fireWith( this, arguments ); 5830 return this; 5831 }, 5832 5833 // To know if the callbacks have already been called at least once 5834 fired: function() { 5835 return !!fired; 5836 } 5837 }; 5838 5839 return self; 5840}; 5841 5842 5843function Identity( v ) { 5844 return v; 5845} 5846function Thrower( ex ) { 5847 throw ex; 5848} 5849 5850function adoptValue( value, resolve, reject, noValue ) { 5851 var method; 5852 5853 try { 5854 5855 // Check for promise aspect first to privilege synchronous behavior 5856 if ( value && isFunction( ( method = value.promise ) ) ) { 5857 method.call( value ).done( resolve ).fail( reject ); 5858 5859 // Other thenables 5860 } else if ( value && isFunction( ( method = value.then ) ) ) { 5861 method.call( value, resolve, reject ); 5862 5863 // Other non-thenables 5864 } else { 5865 5866 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 5867 // * false: [ value ].slice( 0 ) => resolve( value ) 5868 // * true: [ value ].slice( 1 ) => resolve() 5869 resolve.apply( undefined, [ value ].slice( noValue ) ); 5870 } 5871 5872 // For Promises/A+, convert exceptions into rejections 5873 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 5874 // Deferred#then to conditionally suppress rejection. 5875 } catch ( value ) { 5876 5877 // Support: Android 4.0 only 5878 // Strict mode functions invoked without .call/.apply get global-object context 5879 reject.apply( undefined, [ value ] ); 5880 } 5881} 5882 5883jQuery.extend( { 5884 5885 Deferred: function( func ) { 5886 var tuples = [ 5887 5888 // action, add listener, callbacks, 5889 // ... .then handlers, argument index, [final state] 5890 [ "notify", "progress", jQuery.Callbacks( "memory" ), 5891 jQuery.Callbacks( "memory" ), 2 ], 5892 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 5893 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 5894 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 5895 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 5896 ], 5897 state = "pending", 5898 promise = { 5899 state: function() { 5900 return state; 5901 }, 5902 always: function() { 5903 deferred.done( arguments ).fail( arguments ); 5904 return this; 5905 }, 5906 "catch": function( fn ) { 5907 return promise.then( null, fn ); 5908 }, 5909 5910 // Keep pipe for back-compat 5911 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 5912 var fns = arguments; 5913 5914 return jQuery.Deferred( function( newDefer ) { 5915 jQuery.each( tuples, function( _i, tuple ) { 5916 5917 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 5918 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 5919 5920 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 5921 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 5922 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 5923 deferred[ tuple[ 1 ] ]( function() { 5924 var returned = fn && fn.apply( this, arguments ); 5925 if ( returned && isFunction( returned.promise ) ) { 5926 returned.promise() 5927 .progress( newDefer.notify ) 5928 .done( newDefer.resolve ) 5929 .fail( newDefer.reject ); 5930 } else { 5931 newDefer[ tuple[ 0 ] + "With" ]( 5932 this, 5933 fn ? [ returned ] : arguments 5934 ); 5935 } 5936 } ); 5937 } ); 5938 fns = null; 5939 } ).promise(); 5940 }, 5941 then: function( onFulfilled, onRejected, onProgress ) { 5942 var maxDepth = 0; 5943 function resolve( depth, deferred, handler, special ) { 5944 return function() { 5945 var that = this, 5946 args = arguments, 5947 mightThrow = function() { 5948 var returned, then; 5949 5950 // Support: Promises/A+ section 2.3.3.3.3 5951 // https://promisesaplus.com/#point-59 5952 // Ignore double-resolution attempts 5953 if ( depth < maxDepth ) { 5954 return; 5955 } 5956 5957 returned = handler.apply( that, args ); 5958 5959 // Support: Promises/A+ section 2.3.1 5960 // https://promisesaplus.com/#point-48 5961 if ( returned === deferred.promise() ) { 5962 throw new TypeError( "Thenable self-resolution" ); 5963 } 5964 5965 // Support: Promises/A+ sections 2.3.3.1, 3.5 5966 // https://promisesaplus.com/#point-54 5967 // https://promisesaplus.com/#point-75 5968 // Retrieve `then` only once 5969 then = returned && 5970 5971 // Support: Promises/A+ section 2.3.4 5972 // https://promisesaplus.com/#point-64 5973 // Only check objects and functions for thenability 5974 ( typeof returned === "object" || 5975 typeof returned === "function" ) && 5976 returned.then; 5977 5978 // Handle a returned thenable 5979 if ( isFunction( then ) ) { 5980 5981 // Special processors (notify) just wait for resolution 5982 if ( special ) { 5983 then.call( 5984 returned, 5985 resolve( maxDepth, deferred, Identity, special ), 5986 resolve( maxDepth, deferred, Thrower, special ) 5987 ); 5988 5989 // Normal processors (resolve) also hook into progress 5990 } else { 5991 5992 // ...and disregard older resolution values 5993 maxDepth++; 5994 5995 then.call( 5996 returned, 5997 resolve( maxDepth, deferred, Identity, special ), 5998 resolve( maxDepth, deferred, Thrower, special ), 5999 resolve( maxDepth, deferred, Identity, 6000 deferred.notifyWith ) 6001 ); 6002 } 6003 6004 // Handle all other returned values 6005 } else { 6006 6007 // Only substitute handlers pass on context 6008 // and multiple values (non-spec behavior) 6009 if ( handler !== Identity ) { 6010 that = undefined; 6011 args = [ returned ]; 6012 } 6013 6014 // Process the value(s) 6015 // Default process is resolve 6016 ( special || deferred.resolveWith )( that, args ); 6017 } 6018 }, 6019 6020 // Only normal processors (resolve) catch and reject exceptions 6021 process = special ? 6022 mightThrow : 6023 function() { 6024 try { 6025 mightThrow(); 6026 } catch ( e ) { 6027 6028 if ( jQuery.Deferred.exceptionHook ) { 6029 jQuery.Deferred.exceptionHook( e, 6030 process.stackTrace ); 6031 } 6032 6033 // Support: Promises/A+ section 2.3.3.3.4.1 6034 // https://promisesaplus.com/#point-61 6035 // Ignore post-resolution exceptions 6036 if ( depth + 1 >= maxDepth ) { 6037 6038 // Only substitute handlers pass on context 6039 // and multiple values (non-spec behavior) 6040 if ( handler !== Thrower ) { 6041 that = undefined; 6042 args = [ e ]; 6043 } 6044 6045 deferred.rejectWith( that, args ); 6046 } 6047 } 6048 }; 6049 6050 // Support: Promises/A+ section 2.3.3.3.1 6051 // https://promisesaplus.com/#point-57 6052 // Re-resolve promises immediately to dodge false rejection from 6053 // subsequent errors 6054 if ( depth ) { 6055 process(); 6056 } else { 6057 6058 // Call an optional hook to record the stack, in case of exception 6059 // since it's otherwise lost when execution goes async 6060 if ( jQuery.Deferred.getStackHook ) { 6061 process.stackTrace = jQuery.Deferred.getStackHook(); 6062 } 6063 window.setTimeout( process ); 6064 } 6065 }; 6066 } 6067 6068 return jQuery.Deferred( function( newDefer ) { 6069 6070 // progress_handlers.add( ... ) 6071 tuples[ 0 ][ 3 ].add( 6072 resolve( 6073 0, 6074 newDefer, 6075 isFunction( onProgress ) ? 6076 onProgress : 6077 Identity, 6078 newDefer.notifyWith 6079 ) 6080 ); 6081 6082 // fulfilled_handlers.add( ... ) 6083 tuples[ 1 ][ 3 ].add( 6084 resolve( 6085 0, 6086 newDefer, 6087 isFunction( onFulfilled ) ? 6088 onFulfilled : 6089 Identity 6090 ) 6091 ); 6092 6093 // rejected_handlers.add( ... ) 6094 tuples[ 2 ][ 3 ].add( 6095 resolve( 6096 0, 6097 newDefer, 6098 isFunction( onRejected ) ? 6099 onRejected : 6100 Thrower 6101 ) 6102 ); 6103 } ).promise(); 6104 }, 6105 6106 // Get a promise for this deferred 6107 // If obj is provided, the promise aspect is added to the object 6108 promise: function( obj ) { 6109 return obj != null ? jQuery.extend( obj, promise ) : promise; 6110 } 6111 }, 6112 deferred = {}; 6113 6114 // Add list-specific methods 6115 jQuery.each( tuples, function( i, tuple ) { 6116 var list = tuple[ 2 ], 6117 stateString = tuple[ 5 ]; 6118 6119 // promise.progress = list.add 6120 // promise.done = list.add 6121 // promise.fail = list.add 6122 promise[ tuple[ 1 ] ] = list.add; 6123 6124 // Handle state 6125 if ( stateString ) { 6126 list.add( 6127 function() { 6128 6129 // state = "resolved" (i.e., fulfilled) 6130 // state = "rejected" 6131 state = stateString; 6132 }, 6133 6134 // rejected_callbacks.disable 6135 // fulfilled_callbacks.disable 6136 tuples[ 3 - i ][ 2 ].disable, 6137 6138 // rejected_handlers.disable 6139 // fulfilled_handlers.disable 6140 tuples[ 3 - i ][ 3 ].disable, 6141 6142 // progress_callbacks.lock 6143 tuples[ 0 ][ 2 ].lock, 6144 6145 // progress_handlers.lock 6146 tuples[ 0 ][ 3 ].lock 6147 ); 6148 } 6149 6150 // progress_handlers.fire 6151 // fulfilled_handlers.fire 6152 // rejected_handlers.fire 6153 list.add( tuple[ 3 ].fire ); 6154 6155 // deferred.notify = function() { deferred.notifyWith(...) } 6156 // deferred.resolve = function() { deferred.resolveWith(...) } 6157 // deferred.reject = function() { deferred.rejectWith(...) } 6158 deferred[ tuple[ 0 ] ] = function() { 6159 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 6160 return this; 6161 }; 6162 6163 // deferred.notifyWith = list.fireWith 6164 // deferred.resolveWith = list.fireWith 6165 // deferred.rejectWith = list.fireWith 6166 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 6167 } ); 6168 6169 // Make the deferred a promise 6170 promise.promise( deferred ); 6171 6172 // Call given func if any 6173 if ( func ) { 6174 func.call( deferred, deferred ); 6175 } 6176 6177 // All done! 6178 return deferred; 6179 }, 6180 6181 // Deferred helper 6182 when: function( singleValue ) { 6183 var 6184 6185 // count of uncompleted subordinates 6186 remaining = arguments.length, 6187 6188 // count of unprocessed arguments 6189 i = remaining, 6190 6191 // subordinate fulfillment data 6192 resolveContexts = Array( i ), 6193 resolveValues = slice.call( arguments ), 6194 6195 // the primary Deferred 6196 primary = jQuery.Deferred(), 6197 6198 // subordinate callback factory 6199 updateFunc = function( i ) { 6200 return function( value ) { 6201 resolveContexts[ i ] = this; 6202 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 6203 if ( !( --remaining ) ) { 6204 primary.resolveWith( resolveContexts, resolveValues ); 6205 } 6206 }; 6207 }; 6208 6209 // Single- and empty arguments are adopted like Promise.resolve 6210 if ( remaining <= 1 ) { 6211 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 6212 !remaining ); 6213 6214 // Use .then() to unwrap secondary thenables (cf. gh-3000) 6215 if ( primary.state() === "pending" || 6216 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 6217 6218 return primary.then(); 6219 } 6220 } 6221 6222 // Multiple arguments are aggregated like Promise.all array elements 6223 while ( i-- ) { 6224 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 6225 } 6226 6227 return primary.promise(); 6228 } 6229} ); 6230 6231 6232// These usually indicate a programmer mistake during development, 6233// warn about them ASAP rather than swallowing them by default. 6234var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 6235 6236jQuery.Deferred.exceptionHook = function( error, stack ) { 6237 6238 // Support: IE 8 - 9 only 6239 // Console exists when dev tools are open, which can happen at any time 6240 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 6241 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 6242 } 6243}; 6244 6245 6246 6247 6248jQuery.readyException = function( error ) { 6249 window.setTimeout( function() { 6250 throw error; 6251 } ); 6252}; 6253 6254 6255 6256 6257// The deferred used on DOM ready 6258var readyList = jQuery.Deferred(); 6259 6260jQuery.fn.ready = function( fn ) { 6261 6262 readyList 6263 .then( fn ) 6264 6265 // Wrap jQuery.readyException in a function so that the lookup 6266 // happens at the time of error handling instead of callback 6267 // registration. 6268 .catch( function( error ) { 6269 jQuery.readyException( error ); 6270 } ); 6271 6272 return this; 6273}; 6274 6275jQuery.extend( { 6276 6277 // Is the DOM ready to be used? Set to true once it occurs. 6278 isReady: false, 6279 6280 // A counter to track how many items to wait for before 6281 // the ready event fires. See trac-6781 6282 readyWait: 1, 6283 6284 // Handle when the DOM is ready 6285 ready: function( wait ) { 6286 6287 // Abort if there are pending holds or we're already ready 6288 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 6289 return; 6290 } 6291 6292 // Remember that the DOM is ready 6293 jQuery.isReady = true; 6294 6295 // If a normal DOM Ready event fired, decrement, and wait if need be 6296 if ( wait !== true && --jQuery.readyWait > 0 ) { 6297 return; 6298 } 6299 6300 // If there are functions bound, to execute 6301 readyList.resolveWith( document, [ jQuery ] ); 6302 } 6303} ); 6304 6305jQuery.ready.then = readyList.then; 6306 6307// The ready event handler and self cleanup method 6308function completed() { 6309 document.removeEventListener( "DOMContentLoaded", completed ); 6310 window.removeEventListener( "load", completed ); 6311 jQuery.ready(); 6312} 6313 6314// Catch cases where $(document).ready() is called 6315// after the browser event has already occurred. 6316// Support: IE <=9 - 10 only 6317// Older IE sometimes signals "interactive" too soon 6318if ( document.readyState === "complete" || 6319 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 6320 6321 // Handle it asynchronously to allow scripts the opportunity to delay ready 6322 window.setTimeout( jQuery.ready ); 6323 6324} else { 6325 6326 // Use the handy event callback 6327 document.addEventListener( "DOMContentLoaded", completed ); 6328 6329 // A fallback to window.onload, that will always work 6330 window.addEventListener( "load", completed ); 6331} 6332 6333 6334 6335 6336// Multifunctional method to get and set values of a collection 6337// The value/s can optionally be executed if it's a function 6338var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 6339 var i = 0, 6340 len = elems.length, 6341 bulk = key == null; 6342 6343 // Sets many values 6344 if ( toType( key ) === "object" ) { 6345 chainable = true; 6346 for ( i in key ) { 6347 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 6348 } 6349 6350 // Sets one value 6351 } else if ( value !== undefined ) { 6352 chainable = true; 6353 6354 if ( !isFunction( value ) ) { 6355 raw = true; 6356 } 6357 6358 if ( bulk ) { 6359 6360 // Bulk operations run against the entire set 6361 if ( raw ) { 6362 fn.call( elems, value ); 6363 fn = null; 6364 6365 // ...except when executing function values 6366 } else { 6367 bulk = fn; 6368 fn = function( elem, _key, value ) { 6369 return bulk.call( jQuery( elem ), value ); 6370 }; 6371 } 6372 } 6373 6374 if ( fn ) { 6375 for ( ; i < len; i++ ) { 6376 fn( 6377 elems[ i ], key, raw ? 6378 value : 6379 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 6380 ); 6381 } 6382 } 6383 } 6384 6385 if ( chainable ) { 6386 return elems; 6387 } 6388 6389 // Gets 6390 if ( bulk ) { 6391 return fn.call( elems ); 6392 } 6393 6394 return len ? fn( elems[ 0 ], key ) : emptyGet; 6395}; 6396 6397 6398// Matches dashed string for camelizing 6399var rmsPrefix = /^-ms-/, 6400 rdashAlpha = /-([a-z])/g; 6401 6402// Used by camelCase as callback to replace() 6403function fcamelCase( _all, letter ) { 6404 return letter.toUpperCase(); 6405} 6406 6407// Convert dashed to camelCase; used by the css and data modules 6408// Support: IE <=9 - 11, Edge 12 - 15 6409// Microsoft forgot to hump their vendor prefix (trac-9572) 6410function camelCase( string ) { 6411 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 6412} 6413var acceptData = function( owner ) { 6414 6415 // Accepts only: 6416 // - Node 6417 // - Node.ELEMENT_NODE 6418 // - Node.DOCUMENT_NODE 6419 // - Object 6420 // - Any 6421 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 6422}; 6423 6424 6425 6426 6427function Data() { 6428 this.expando = jQuery.expando + Data.uid++; 6429} 6430 6431Data.uid = 1; 6432 6433Data.prototype = { 6434 6435 cache: function( owner ) { 6436 6437 // Check if the owner object already has a cache 6438 var value = owner[ this.expando ]; 6439 6440 // If not, create one 6441 if ( !value ) { 6442 value = {}; 6443 6444 // We can accept data for non-element nodes in modern browsers, 6445 // but we should not, see trac-8335. 6446 // Always return an empty object. 6447 if ( acceptData( owner ) ) { 6448 6449 // If it is a node unlikely to be stringify-ed or looped over 6450 // use plain assignment 6451 if ( owner.nodeType ) { 6452 owner[ this.expando ] = value; 6453 6454 // Otherwise secure it in a non-enumerable property 6455 // configurable must be true to allow the property to be 6456 // deleted when data is removed 6457 } else { 6458 Object.defineProperty( owner, this.expando, { 6459 value: value, 6460 configurable: true 6461 } ); 6462 } 6463 } 6464 } 6465 6466 return value; 6467 }, 6468 set: function( owner, data, value ) { 6469 var prop, 6470 cache = this.cache( owner ); 6471 6472 // Handle: [ owner, key, value ] args 6473 // Always use camelCase key (gh-2257) 6474 if ( typeof data === "string" ) { 6475 cache[ camelCase( data ) ] = value; 6476 6477 // Handle: [ owner, { properties } ] args 6478 } else { 6479 6480 // Copy the properties one-by-one to the cache object 6481 for ( prop in data ) { 6482 cache[ camelCase( prop ) ] = data[ prop ]; 6483 } 6484 } 6485 return cache; 6486 }, 6487 get: function( owner, key ) { 6488 return key === undefined ? 6489 this.cache( owner ) : 6490 6491 // Always use camelCase key (gh-2257) 6492 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 6493 }, 6494 access: function( owner, key, value ) { 6495 6496 // In cases where either: 6497 // 6498 // 1. No key was specified 6499 // 2. A string key was specified, but no value provided 6500 // 6501 // Take the "read" path and allow the get method to determine 6502 // which value to return, respectively either: 6503 // 6504 // 1. The entire cache object 6505 // 2. The data stored at the key 6506 // 6507 if ( key === undefined || 6508 ( ( key && typeof key === "string" ) && value === undefined ) ) { 6509 6510 return this.get( owner, key ); 6511 } 6512 6513 // When the key is not a string, or both a key and value 6514 // are specified, set or extend (existing objects) with either: 6515 // 6516 // 1. An object of properties 6517 // 2. A key and value 6518 // 6519 this.set( owner, key, value ); 6520 6521 // Since the "set" path can have two possible entry points 6522 // return the expected data based on which path was taken[*] 6523 return value !== undefined ? value : key; 6524 }, 6525 remove: function( owner, key ) { 6526 var i, 6527 cache = owner[ this.expando ]; 6528 6529 if ( cache === undefined ) { 6530 return; 6531 } 6532 6533 if ( key !== undefined ) { 6534 6535 // Support array or space separated string of keys 6536 if ( Array.isArray( key ) ) { 6537 6538 // If key is an array of keys... 6539 // We always set camelCase keys, so remove that. 6540 key = key.map( camelCase ); 6541 } else { 6542 key = camelCase( key ); 6543 6544 // If a key with the spaces exists, use it. 6545 // Otherwise, create an array by matching non-whitespace 6546 key = key in cache ? 6547 [ key ] : 6548 ( key.match( rnothtmlwhite ) || [] ); 6549 } 6550 6551 i = key.length; 6552 6553 while ( i-- ) { 6554 delete cache[ key[ i ] ]; 6555 } 6556 } 6557 6558 // Remove the expando if there's no more data 6559 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 6560 6561 // Support: Chrome <=35 - 45 6562 // Webkit & Blink performance suffers when deleting properties 6563 // from DOM nodes, so set to undefined instead 6564 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 6565 if ( owner.nodeType ) { 6566 owner[ this.expando ] = undefined; 6567 } else { 6568 delete owner[ this.expando ]; 6569 } 6570 } 6571 }, 6572 hasData: function( owner ) { 6573 var cache = owner[ this.expando ]; 6574 return cache !== undefined && !jQuery.isEmptyObject( cache ); 6575 } 6576}; 6577var dataPriv = new Data(); 6578 6579var dataUser = new Data(); 6580 6581 6582 6583// Implementation Summary 6584// 6585// 1. Enforce API surface and semantic compatibility with 1.9.x branch 6586// 2. Improve the module's maintainability by reducing the storage 6587// paths to a single mechanism. 6588// 3. Use the same single mechanism to support "private" and "user" data. 6589// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 6590// 5. Avoid exposing implementation details on user objects (eg. expando properties) 6591// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 6592 6593var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 6594 rmultiDash = /[A-Z]/g; 6595 6596function getData( data ) { 6597 if ( data === "true" ) { 6598 return true; 6599 } 6600 6601 if ( data === "false" ) { 6602 return false; 6603 } 6604 6605 if ( data === "null" ) { 6606 return null; 6607 } 6608 6609 // Only convert to a number if it doesn't change the string 6610 if ( data === +data + "" ) { 6611 return +data; 6612 } 6613 6614 if ( rbrace.test( data ) ) { 6615 return JSON.parse( data ); 6616 } 6617 6618 return data; 6619} 6620 6621function dataAttr( elem, key, data ) { 6622 var name; 6623 6624 // If nothing was found internally, try to fetch any 6625 // data from the HTML5 data-* attribute 6626 if ( data === undefined && elem.nodeType === 1 ) { 6627 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 6628 data = elem.getAttribute( name ); 6629 6630 if ( typeof data === "string" ) { 6631 try { 6632 data = getData( data ); 6633 } catch ( e ) {} 6634 6635 // Make sure we set the data so it isn't changed later 6636 dataUser.set( elem, key, data ); 6637 } else { 6638 data = undefined; 6639 } 6640 } 6641 return data; 6642} 6643 6644jQuery.extend( { 6645 hasData: function( elem ) { 6646 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 6647 }, 6648 6649 data: function( elem, name, data ) { 6650 return dataUser.access( elem, name, data ); 6651 }, 6652 6653 removeData: function( elem, name ) { 6654 dataUser.remove( elem, name ); 6655 }, 6656 6657 // TODO: Now that all calls to _data and _removeData have been replaced 6658 // with direct calls to dataPriv methods, these can be deprecated. 6659 _data: function( elem, name, data ) { 6660 return dataPriv.access( elem, name, data ); 6661 }, 6662 6663 _removeData: function( elem, name ) { 6664 dataPriv.remove( elem, name ); 6665 } 6666} ); 6667 6668jQuery.fn.extend( { 6669 data: function( key, value ) { 6670 var i, name, data, 6671 elem = this[ 0 ], 6672 attrs = elem && elem.attributes; 6673 6674 // Gets all values 6675 if ( key === undefined ) { 6676 if ( this.length ) { 6677 data = dataUser.get( elem ); 6678 6679 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 6680 i = attrs.length; 6681 while ( i-- ) { 6682 6683 // Support: IE 11 only 6684 // The attrs elements can be null (trac-14894) 6685 if ( attrs[ i ] ) { 6686 name = attrs[ i ].name; 6687 if ( name.indexOf( "data-" ) === 0 ) { 6688 name = camelCase( name.slice( 5 ) ); 6689 dataAttr( elem, name, data[ name ] ); 6690 } 6691 } 6692 } 6693 dataPriv.set( elem, "hasDataAttrs", true ); 6694 } 6695 } 6696 6697 return data; 6698 } 6699 6700 // Sets multiple values 6701 if ( typeof key === "object" ) { 6702 return this.each( function() { 6703 dataUser.set( this, key ); 6704 } ); 6705 } 6706 6707 return access( this, function( value ) { 6708 var data; 6709 6710 // The calling jQuery object (element matches) is not empty 6711 // (and therefore has an element appears at this[ 0 ]) and the 6712 // `value` parameter was not undefined. An empty jQuery object 6713 // will result in `undefined` for elem = this[ 0 ] which will 6714 // throw an exception if an attempt to read a data cache is made. 6715 if ( elem && value === undefined ) { 6716 6717 // Attempt to get data from the cache 6718 // The key will always be camelCased in Data 6719 data = dataUser.get( elem, key ); 6720 if ( data !== undefined ) { 6721 return data; 6722 } 6723 6724 // Attempt to "discover" the data in 6725 // HTML5 custom data-* attrs 6726 data = dataAttr( elem, key ); 6727 if ( data !== undefined ) { 6728 return data; 6729 } 6730 6731 // We tried really hard, but the data doesn't exist. 6732 return; 6733 } 6734 6735 // Set the data... 6736 this.each( function() { 6737 6738 // We always store the camelCased key 6739 dataUser.set( this, key, value ); 6740 } ); 6741 }, null, value, arguments.length > 1, null, true ); 6742 }, 6743 6744 removeData: function( key ) { 6745 return this.each( function() { 6746 dataUser.remove( this, key ); 6747 } ); 6748 } 6749} ); 6750 6751 6752jQuery.extend( { 6753 queue: function( elem, type, data ) { 6754 var queue; 6755 6756 if ( elem ) { 6757 type = ( type || "fx" ) + "queue"; 6758 queue = dataPriv.get( elem, type ); 6759 6760 // Speed up dequeue by getting out quickly if this is just a lookup 6761 if ( data ) { 6762 if ( !queue || Array.isArray( data ) ) { 6763 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 6764 } else { 6765 queue.push( data ); 6766 } 6767 } 6768 return queue || []; 6769 } 6770 }, 6771 6772 dequeue: function( elem, type ) { 6773 type = type || "fx"; 6774 6775 var queue = jQuery.queue( elem, type ), 6776 startLength = queue.length, 6777 fn = queue.shift(), 6778 hooks = jQuery._queueHooks( elem, type ), 6779 next = function() { 6780 jQuery.dequeue( elem, type ); 6781 }; 6782 6783 // If the fx queue is dequeued, always remove the progress sentinel 6784 if ( fn === "inprogress" ) { 6785 fn = queue.shift(); 6786 startLength--; 6787 } 6788 6789 if ( fn ) { 6790 6791 // Add a progress sentinel to prevent the fx queue from being 6792 // automatically dequeued 6793 if ( type === "fx" ) { 6794 queue.unshift( "inprogress" ); 6795 } 6796 6797 // Clear up the last queue stop function 6798 delete hooks.stop; 6799 fn.call( elem, next, hooks ); 6800 } 6801 6802 if ( !startLength && hooks ) { 6803 hooks.empty.fire(); 6804 } 6805 }, 6806 6807 // Not public - generate a queueHooks object, or return the current one 6808 _queueHooks: function( elem, type ) { 6809 var key = type + "queueHooks"; 6810 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 6811 empty: jQuery.Callbacks( "once memory" ).add( function() { 6812 dataPriv.remove( elem, [ type + "queue", key ] ); 6813 } ) 6814 } ); 6815 } 6816} ); 6817 6818jQuery.fn.extend( { 6819 queue: function( type, data ) { 6820 var setter = 2; 6821 6822 if ( typeof type !== "string" ) { 6823 data = type; 6824 type = "fx"; 6825 setter--; 6826 } 6827 6828 if ( arguments.length < setter ) { 6829 return jQuery.queue( this[ 0 ], type ); 6830 } 6831 6832 return data === undefined ? 6833 this : 6834 this.each( function() { 6835 var queue = jQuery.queue( this, type, data ); 6836 6837 // Ensure a hooks for this queue 6838 jQuery._queueHooks( this, type ); 6839 6840 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 6841 jQuery.dequeue( this, type ); 6842 } 6843 } ); 6844 }, 6845 dequeue: function( type ) { 6846 return this.each( function() { 6847 jQuery.dequeue( this, type ); 6848 } ); 6849 }, 6850 clearQueue: function( type ) { 6851 return this.queue( type || "fx", [] ); 6852 }, 6853 6854 // Get a promise resolved when queues of a certain type 6855 // are emptied (fx is the type by default) 6856 promise: function( type, obj ) { 6857 var tmp, 6858 count = 1, 6859 defer = jQuery.Deferred(), 6860 elements = this, 6861 i = this.length, 6862 resolve = function() { 6863 if ( !( --count ) ) { 6864 defer.resolveWith( elements, [ elements ] ); 6865 } 6866 }; 6867 6868 if ( typeof type !== "string" ) { 6869 obj = type; 6870 type = undefined; 6871 } 6872 type = type || "fx"; 6873 6874 while ( i-- ) { 6875 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 6876 if ( tmp && tmp.empty ) { 6877 count++; 6878 tmp.empty.add( resolve ); 6879 } 6880 } 6881 resolve(); 6882 return defer.promise( obj ); 6883 } 6884} ); 6885var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 6886 6887var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 6888 6889 6890var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 6891 6892var documentElement = document.documentElement; 6893 6894 6895 6896 var isAttached = function( elem ) { 6897 return jQuery.contains( elem.ownerDocument, elem ); 6898 }, 6899 composed = { composed: true }; 6900 6901 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 6902 // Check attachment across shadow DOM boundaries when possible (gh-3504) 6903 // Support: iOS 10.0-10.2 only 6904 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 6905 // leading to errors. We need to check for `getRootNode`. 6906 if ( documentElement.getRootNode ) { 6907 isAttached = function( elem ) { 6908 return jQuery.contains( elem.ownerDocument, elem ) || 6909 elem.getRootNode( composed ) === elem.ownerDocument; 6910 }; 6911 } 6912var isHiddenWithinTree = function( elem, el ) { 6913 6914 // isHiddenWithinTree might be called from jQuery#filter function; 6915 // in that case, element will be second argument 6916 elem = el || elem; 6917 6918 // Inline style trumps all 6919 return elem.style.display === "none" || 6920 elem.style.display === "" && 6921 6922 // Otherwise, check computed style 6923 // Support: Firefox <=43 - 45 6924 // Disconnected elements can have computed display: none, so first confirm that elem is 6925 // in the document. 6926 isAttached( elem ) && 6927 6928 jQuery.css( elem, "display" ) === "none"; 6929 }; 6930 6931 6932 6933function adjustCSS( elem, prop, valueParts, tween ) { 6934 var adjusted, scale, 6935 maxIterations = 20, 6936 currentValue = tween ? 6937 function() { 6938 return tween.cur(); 6939 } : 6940 function() { 6941 return jQuery.css( elem, prop, "" ); 6942 }, 6943 initial = currentValue(), 6944 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 6945 6946 // Starting value computation is required for potential unit mismatches 6947 initialInUnit = elem.nodeType && 6948 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 6949 rcssNum.exec( jQuery.css( elem, prop ) ); 6950 6951 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 6952 6953 // Support: Firefox <=54 6954 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 6955 initial = initial / 2; 6956 6957 // Trust units reported by jQuery.css 6958 unit = unit || initialInUnit[ 3 ]; 6959 6960 // Iteratively approximate from a nonzero starting point 6961 initialInUnit = +initial || 1; 6962 6963 while ( maxIterations-- ) { 6964 6965 // Evaluate and update our best guess (doubling guesses that zero out). 6966 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 6967 jQuery.style( elem, prop, initialInUnit + unit ); 6968 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 6969 maxIterations = 0; 6970 } 6971 initialInUnit = initialInUnit / scale; 6972 6973 } 6974 6975 initialInUnit = initialInUnit * 2; 6976 jQuery.style( elem, prop, initialInUnit + unit ); 6977 6978 // Make sure we update the tween properties later on 6979 valueParts = valueParts || []; 6980 } 6981 6982 if ( valueParts ) { 6983 initialInUnit = +initialInUnit || +initial || 0; 6984 6985 // Apply relative offset (+=/-=) if specified 6986 adjusted = valueParts[ 1 ] ? 6987 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 6988 +valueParts[ 2 ]; 6989 if ( tween ) { 6990 tween.unit = unit; 6991 tween.start = initialInUnit; 6992 tween.end = adjusted; 6993 } 6994 } 6995 return adjusted; 6996} 6997 6998 6999var defaultDisplayMap = {}; 7000 7001function getDefaultDisplay( elem ) { 7002 var temp, 7003 doc = elem.ownerDocument, 7004 nodeName = elem.nodeName, 7005 display = defaultDisplayMap[ nodeName ]; 7006 7007 if ( display ) { 7008 return display; 7009 } 7010 7011 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 7012 display = jQuery.css( temp, "display" ); 7013 7014 temp.parentNode.removeChild( temp ); 7015 7016 if ( display === "none" ) { 7017 display = "block"; 7018 } 7019 defaultDisplayMap[ nodeName ] = display; 7020 7021 return display; 7022} 7023 7024function showHide( elements, show ) { 7025 var display, elem, 7026 values = [], 7027 index = 0, 7028 length = elements.length; 7029 7030 // Determine new display value for elements that need to change 7031 for ( ; index < length; index++ ) { 7032 elem = elements[ index ]; 7033 if ( !elem.style ) { 7034 continue; 7035 } 7036 7037 display = elem.style.display; 7038 if ( show ) { 7039 7040 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 7041 // check is required in this first loop unless we have a nonempty display value (either 7042 // inline or about-to-be-restored) 7043 if ( display === "none" ) { 7044 values[ index ] = dataPriv.get( elem, "display" ) || null; 7045 if ( !values[ index ] ) { 7046 elem.style.display = ""; 7047 } 7048 } 7049 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 7050 values[ index ] = getDefaultDisplay( elem ); 7051 } 7052 } else { 7053 if ( display !== "none" ) { 7054 values[ index ] = "none"; 7055 7056 // Remember what we're overwriting 7057 dataPriv.set( elem, "display", display ); 7058 } 7059 } 7060 } 7061 7062 // Set the display of the elements in a second loop to avoid constant reflow 7063 for ( index = 0; index < length; index++ ) { 7064 if ( values[ index ] != null ) { 7065 elements[ index ].style.display = values[ index ]; 7066 } 7067 } 7068 7069 return elements; 7070} 7071 7072jQuery.fn.extend( { 7073 show: function() { 7074 return showHide( this, true ); 7075 }, 7076 hide: function() { 7077 return showHide( this ); 7078 }, 7079 toggle: function( state ) { 7080 if ( typeof state === "boolean" ) { 7081 return state ? this.show() : this.hide(); 7082 } 7083 7084 return this.each( function() { 7085 if ( isHiddenWithinTree( this ) ) { 7086 jQuery( this ).show(); 7087 } else { 7088 jQuery( this ).hide(); 7089 } 7090 } ); 7091 } 7092} ); 7093var rcheckableType = ( /^(?:checkbox|radio)$/i ); 7094 7095var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 7096 7097var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 7098 7099 7100 7101( function() { 7102 var fragment = document.createDocumentFragment(), 7103 div = fragment.appendChild( document.createElement( "div" ) ), 7104 input = document.createElement( "input" ); 7105 7106 // Support: Android 4.0 - 4.3 only 7107 // Check state lost if the name is set (trac-11217) 7108 // Support: Windows Web Apps (WWA) 7109 // `name` and `type` must use .setAttribute for WWA (trac-14901) 7110 input.setAttribute( "type", "radio" ); 7111 input.setAttribute( "checked", "checked" ); 7112 input.setAttribute( "name", "t" ); 7113 7114 div.appendChild( input ); 7115 7116 // Support: Android <=4.1 only 7117 // Older WebKit doesn't clone checked state correctly in fragments 7118 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 7119 7120 // Support: IE <=11 only 7121 // Make sure textarea (and checkbox) defaultValue is properly cloned 7122 div.innerHTML = "<textarea>x</textarea>"; 7123 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 7124 7125 // Support: IE <=9 only 7126 // IE <=9 replaces <option> tags with their contents when inserted outside of 7127 // the select element. 7128 div.innerHTML = "<option></option>"; 7129 support.option = !!div.lastChild; 7130} )(); 7131 7132 7133// We have to close these tags to support XHTML (trac-13200) 7134var wrapMap = { 7135 7136 // XHTML parsers do not magically insert elements in the 7137 // same way that tag soup parsers do. So we cannot shorten 7138 // this by omitting <tbody> or other required elements. 7139 thead: [ 1, "<table>", "</table>" ], 7140 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 7141 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 7142 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 7143 7144 _default: [ 0, "", "" ] 7145}; 7146 7147wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 7148wrapMap.th = wrapMap.td; 7149 7150// Support: IE <=9 only 7151if ( !support.option ) { 7152 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 7153} 7154 7155 7156function getAll( context, tag ) { 7157 7158 // Support: IE <=9 - 11 only 7159 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 7160 var ret; 7161 7162 if ( typeof context.getElementsByTagName !== "undefined" ) { 7163 ret = context.getElementsByTagName( tag || "*" ); 7164 7165 } else if ( typeof context.querySelectorAll !== "undefined" ) { 7166 ret = context.querySelectorAll( tag || "*" ); 7167 7168 } else { 7169 ret = []; 7170 } 7171 7172 if ( tag === undefined || tag && nodeName( context, tag ) ) { 7173 return jQuery.merge( [ context ], ret ); 7174 } 7175 7176 return ret; 7177} 7178 7179 7180// Mark scripts as having already been evaluated 7181function setGlobalEval( elems, refElements ) { 7182 var i = 0, 7183 l = elems.length; 7184 7185 for ( ; i < l; i++ ) { 7186 dataPriv.set( 7187 elems[ i ], 7188 "globalEval", 7189 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 7190 ); 7191 } 7192} 7193 7194 7195var rhtml = /<|&#?\w+;/; 7196 7197function buildFragment( elems, context, scripts, selection, ignored ) { 7198 var elem, tmp, tag, wrap, attached, j, 7199 fragment = context.createDocumentFragment(), 7200 nodes = [], 7201 i = 0, 7202 l = elems.length; 7203 7204 for ( ; i < l; i++ ) { 7205 elem = elems[ i ]; 7206 7207 if ( elem || elem === 0 ) { 7208 7209 // Add nodes directly 7210 if ( toType( elem ) === "object" ) { 7211 7212 // Support: Android <=4.0 only, PhantomJS 1 only 7213 // push.apply(_, arraylike) throws on ancient WebKit 7214 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 7215 7216 // Convert non-html into a text node 7217 } else if ( !rhtml.test( elem ) ) { 7218 nodes.push( context.createTextNode( elem ) ); 7219 7220 // Convert html into DOM nodes 7221 } else { 7222 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 7223 7224 // Deserialize a standard representation 7225 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 7226 wrap = wrapMap[ tag ] || wrapMap._default; 7227 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 7228 7229 // Descend through wrappers to the right content 7230 j = wrap[ 0 ]; 7231 while ( j-- ) { 7232 tmp = tmp.lastChild; 7233 } 7234 7235 // Support: Android <=4.0 only, PhantomJS 1 only 7236 // push.apply(_, arraylike) throws on ancient WebKit 7237 jQuery.merge( nodes, tmp.childNodes ); 7238 7239 // Remember the top-level container 7240 tmp = fragment.firstChild; 7241 7242 // Ensure the created nodes are orphaned (trac-12392) 7243 tmp.textContent = ""; 7244 } 7245 } 7246 } 7247 7248 // Remove wrapper from fragment 7249 fragment.textContent = ""; 7250 7251 i = 0; 7252 while ( ( elem = nodes[ i++ ] ) ) { 7253 7254 // Skip elements already in the context collection (trac-4087) 7255 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 7256 if ( ignored ) { 7257 ignored.push( elem ); 7258 } 7259 continue; 7260 } 7261 7262 attached = isAttached( elem ); 7263 7264 // Append to fragment 7265 tmp = getAll( fragment.appendChild( elem ), "script" ); 7266 7267 // Preserve script evaluation history 7268 if ( attached ) { 7269 setGlobalEval( tmp ); 7270 } 7271 7272 // Capture executables 7273 if ( scripts ) { 7274 j = 0; 7275 while ( ( elem = tmp[ j++ ] ) ) { 7276 if ( rscriptType.test( elem.type || "" ) ) { 7277 scripts.push( elem ); 7278 } 7279 } 7280 } 7281 } 7282 7283 return fragment; 7284} 7285 7286 7287var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 7288 7289function returnTrue() { 7290 return true; 7291} 7292 7293function returnFalse() { 7294 return false; 7295} 7296 7297// Support: IE <=9 - 11+ 7298// focus() and blur() are asynchronous, except when they are no-op. 7299// So expect focus to be synchronous when the element is already active, 7300// and blur to be synchronous when the element is not already active. 7301// (focus and blur are always synchronous in other supported browsers, 7302// this just defines when we can count on it). 7303function expectSync( elem, type ) { 7304 return ( elem === safeActiveElement() ) === ( type === "focus" ); 7305} 7306 7307// Support: IE <=9 only 7308// Accessing document.activeElement can throw unexpectedly 7309// https://bugs.jquery.com/ticket/13393 7310function safeActiveElement() { 7311 try { 7312 return document.activeElement; 7313 } catch ( err ) { } 7314} 7315 7316function on( elem, types, selector, data, fn, one ) { 7317 var origFn, type; 7318 7319 // Types can be a map of types/handlers 7320 if ( typeof types === "object" ) { 7321 7322 // ( types-Object, selector, data ) 7323 if ( typeof selector !== "string" ) { 7324 7325 // ( types-Object, data ) 7326 data = data || selector; 7327 selector = undefined; 7328 } 7329 for ( type in types ) { 7330 on( elem, type, selector, data, types[ type ], one ); 7331 } 7332 return elem; 7333 } 7334 7335 if ( data == null && fn == null ) { 7336 7337 // ( types, fn ) 7338 fn = selector; 7339 data = selector = undefined; 7340 } else if ( fn == null ) { 7341 if ( typeof selector === "string" ) { 7342 7343 // ( types, selector, fn ) 7344 fn = data; 7345 data = undefined; 7346 } else { 7347 7348 // ( types, data, fn ) 7349 fn = data; 7350 data = selector; 7351 selector = undefined; 7352 } 7353 } 7354 if ( fn === false ) { 7355 fn = returnFalse; 7356 } else if ( !fn ) { 7357 return elem; 7358 } 7359 7360 if ( one === 1 ) { 7361 origFn = fn; 7362 fn = function( event ) { 7363 7364 // Can use an empty set, since event contains the info 7365 jQuery().off( event ); 7366 return origFn.apply( this, arguments ); 7367 }; 7368 7369 // Use same guid so caller can remove using origFn 7370 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 7371 } 7372 return elem.each( function() { 7373 jQuery.event.add( this, types, fn, data, selector ); 7374 } ); 7375} 7376 7377/* 7378 * Helper functions for managing events -- not part of the public interface. 7379 * Props to Dean Edwards' addEvent library for many of the ideas. 7380 */ 7381jQuery.event = { 7382 7383 global: {}, 7384 7385 add: function( elem, types, handler, data, selector ) { 7386 7387 var handleObjIn, eventHandle, tmp, 7388 events, t, handleObj, 7389 special, handlers, type, namespaces, origType, 7390 elemData = dataPriv.get( elem ); 7391 7392 // Only attach events to objects that accept data 7393 if ( !acceptData( elem ) ) { 7394 return; 7395 } 7396 7397 // Caller can pass in an object of custom data in lieu of the handler 7398 if ( handler.handler ) { 7399 handleObjIn = handler; 7400 handler = handleObjIn.handler; 7401 selector = handleObjIn.selector; 7402 } 7403 7404 // Ensure that invalid selectors throw exceptions at attach time 7405 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 7406 if ( selector ) { 7407 jQuery.find.matchesSelector( documentElement, selector ); 7408 } 7409 7410 // Make sure that the handler has a unique ID, used to find/remove it later 7411 if ( !handler.guid ) { 7412 handler.guid = jQuery.guid++; 7413 } 7414 7415 // Init the element's event structure and main handler, if this is the first 7416 if ( !( events = elemData.events ) ) { 7417 events = elemData.events = Object.create( null ); 7418 } 7419 if ( !( eventHandle = elemData.handle ) ) { 7420 eventHandle = elemData.handle = function( e ) { 7421 7422 // Discard the second event of a jQuery.event.trigger() and 7423 // when an event is called after a page has unloaded 7424 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 7425 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 7426 }; 7427 } 7428 7429 // Handle multiple events separated by a space 7430 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 7431 t = types.length; 7432 while ( t-- ) { 7433 tmp = rtypenamespace.exec( types[ t ] ) || []; 7434 type = origType = tmp[ 1 ]; 7435 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 7436 7437 // There *must* be a type, no attaching namespace-only handlers 7438 if ( !type ) { 7439 continue; 7440 } 7441 7442 // If event changes its type, use the special event handlers for the changed type 7443 special = jQuery.event.special[ type ] || {}; 7444 7445 // If selector defined, determine special event api type, otherwise given type 7446 type = ( selector ? special.delegateType : special.bindType ) || type; 7447 7448 // Update special based on newly reset type 7449 special = jQuery.event.special[ type ] || {}; 7450 7451 // handleObj is passed to all event handlers 7452 handleObj = jQuery.extend( { 7453 type: type, 7454 origType: origType, 7455 data: data, 7456 handler: handler, 7457 guid: handler.guid, 7458 selector: selector, 7459 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 7460 namespace: namespaces.join( "." ) 7461 }, handleObjIn ); 7462 7463 // Init the event handler queue if we're the first 7464 if ( !( handlers = events[ type ] ) ) { 7465 handlers = events[ type ] = []; 7466 handlers.delegateCount = 0; 7467 7468 // Only use addEventListener if the special events handler returns false 7469 if ( !special.setup || 7470 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 7471 7472 if ( elem.addEventListener ) { 7473 elem.addEventListener( type, eventHandle ); 7474 } 7475 } 7476 } 7477 7478 if ( special.add ) { 7479 special.add.call( elem, handleObj ); 7480 7481 if ( !handleObj.handler.guid ) { 7482 handleObj.handler.guid = handler.guid; 7483 } 7484 } 7485 7486 // Add to the element's handler list, delegates in front 7487 if ( selector ) { 7488 handlers.splice( handlers.delegateCount++, 0, handleObj ); 7489 } else { 7490 handlers.push( handleObj ); 7491 } 7492 7493 // Keep track of which events have ever been used, for event optimization 7494 jQuery.event.global[ type ] = true; 7495 } 7496 7497 }, 7498 7499 // Detach an event or set of events from an element 7500 remove: function( elem, types, handler, selector, mappedTypes ) { 7501 7502 var j, origCount, tmp, 7503 events, t, handleObj, 7504 special, handlers, type, namespaces, origType, 7505 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 7506 7507 if ( !elemData || !( events = elemData.events ) ) { 7508 return; 7509 } 7510 7511 // Once for each type.namespace in types; type may be omitted 7512 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 7513 t = types.length; 7514 while ( t-- ) { 7515 tmp = rtypenamespace.exec( types[ t ] ) || []; 7516 type = origType = tmp[ 1 ]; 7517 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 7518 7519 // Unbind all events (on this namespace, if provided) for the element 7520 if ( !type ) { 7521 for ( type in events ) { 7522 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 7523 } 7524 continue; 7525 } 7526 7527 special = jQuery.event.special[ type ] || {}; 7528 type = ( selector ? special.delegateType : special.bindType ) || type; 7529 handlers = events[ type ] || []; 7530 tmp = tmp[ 2 ] && 7531 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 7532 7533 // Remove matching events 7534 origCount = j = handlers.length; 7535 while ( j-- ) { 7536 handleObj = handlers[ j ]; 7537 7538 if ( ( mappedTypes || origType === handleObj.origType ) && 7539 ( !handler || handler.guid === handleObj.guid ) && 7540 ( !tmp || tmp.test( handleObj.namespace ) ) && 7541 ( !selector || selector === handleObj.selector || 7542 selector === "**" && handleObj.selector ) ) { 7543 handlers.splice( j, 1 ); 7544 7545 if ( handleObj.selector ) { 7546 handlers.delegateCount--; 7547 } 7548 if ( special.remove ) { 7549 special.remove.call( elem, handleObj ); 7550 } 7551 } 7552 } 7553 7554 // Remove generic event handler if we removed something and no more handlers exist 7555 // (avoids potential for endless recursion during removal of special event handlers) 7556 if ( origCount && !handlers.length ) { 7557 if ( !special.teardown || 7558 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 7559 7560 jQuery.removeEvent( elem, type, elemData.handle ); 7561 } 7562 7563 delete events[ type ]; 7564 } 7565 } 7566 7567 // Remove data and the expando if it's no longer used 7568 if ( jQuery.isEmptyObject( events ) ) { 7569 dataPriv.remove( elem, "handle events" ); 7570 } 7571 }, 7572 7573 dispatch: function( nativeEvent ) { 7574 7575 var i, j, ret, matched, handleObj, handlerQueue, 7576 args = new Array( arguments.length ), 7577 7578 // Make a writable jQuery.Event from the native event object 7579 event = jQuery.event.fix( nativeEvent ), 7580 7581 handlers = ( 7582 dataPriv.get( this, "events" ) || Object.create( null ) 7583 )[ event.type ] || [], 7584 special = jQuery.event.special[ event.type ] || {}; 7585 7586 // Use the fix-ed jQuery.Event rather than the (read-only) native event 7587 args[ 0 ] = event; 7588 7589 for ( i = 1; i < arguments.length; i++ ) { 7590 args[ i ] = arguments[ i ]; 7591 } 7592 7593 event.delegateTarget = this; 7594 7595 // Call the preDispatch hook for the mapped type, and let it bail if desired 7596 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 7597 return; 7598 } 7599 7600 // Determine handlers 7601 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 7602 7603 // Run delegates first; they may want to stop propagation beneath us 7604 i = 0; 7605 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 7606 event.currentTarget = matched.elem; 7607 7608 j = 0; 7609 while ( ( handleObj = matched.handlers[ j++ ] ) && 7610 !event.isImmediatePropagationStopped() ) { 7611 7612 // If the event is namespaced, then each handler is only invoked if it is 7613 // specially universal or its namespaces are a superset of the event's. 7614 if ( !event.rnamespace || handleObj.namespace === false || 7615 event.rnamespace.test( handleObj.namespace ) ) { 7616 7617 event.handleObj = handleObj; 7618 event.data = handleObj.data; 7619 7620 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 7621 handleObj.handler ).apply( matched.elem, args ); 7622 7623 if ( ret !== undefined ) { 7624 if ( ( event.result = ret ) === false ) { 7625 event.preventDefault(); 7626 event.stopPropagation(); 7627 } 7628 } 7629 } 7630 } 7631 } 7632 7633 // Call the postDispatch hook for the mapped type 7634 if ( special.postDispatch ) { 7635 special.postDispatch.call( this, event ); 7636 } 7637 7638 return event.result; 7639 }, 7640 7641 handlers: function( event, handlers ) { 7642 var i, handleObj, sel, matchedHandlers, matchedSelectors, 7643 handlerQueue = [], 7644 delegateCount = handlers.delegateCount, 7645 cur = event.target; 7646 7647 // Find delegate handlers 7648 if ( delegateCount && 7649 7650 // Support: IE <=9 7651 // Black-hole SVG <use> instance trees (trac-13180) 7652 cur.nodeType && 7653 7654 // Support: Firefox <=42 7655 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 7656 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 7657 // Support: IE 11 only 7658 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 7659 !( event.type === "click" && event.button >= 1 ) ) { 7660 7661 for ( ; cur !== this; cur = cur.parentNode || this ) { 7662 7663 // Don't check non-elements (trac-13208) 7664 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 7665 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 7666 matchedHandlers = []; 7667 matchedSelectors = {}; 7668 for ( i = 0; i < delegateCount; i++ ) { 7669 handleObj = handlers[ i ]; 7670 7671 // Don't conflict with Object.prototype properties (trac-13203) 7672 sel = handleObj.selector + " "; 7673 7674 if ( matchedSelectors[ sel ] === undefined ) { 7675 matchedSelectors[ sel ] = handleObj.needsContext ? 7676 jQuery( sel, this ).index( cur ) > -1 : 7677 jQuery.find( sel, this, null, [ cur ] ).length; 7678 } 7679 if ( matchedSelectors[ sel ] ) { 7680 matchedHandlers.push( handleObj ); 7681 } 7682 } 7683 if ( matchedHandlers.length ) { 7684 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 7685 } 7686 } 7687 } 7688 } 7689 7690 // Add the remaining (directly-bound) handlers 7691 cur = this; 7692 if ( delegateCount < handlers.length ) { 7693 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 7694 } 7695 7696 return handlerQueue; 7697 }, 7698 7699 addProp: function( name, hook ) { 7700 Object.defineProperty( jQuery.Event.prototype, name, { 7701 enumerable: true, 7702 configurable: true, 7703 7704 get: isFunction( hook ) ? 7705 function() { 7706 if ( this.originalEvent ) { 7707 return hook( this.originalEvent ); 7708 } 7709 } : 7710 function() { 7711 if ( this.originalEvent ) { 7712 return this.originalEvent[ name ]; 7713 } 7714 }, 7715 7716 set: function( value ) { 7717 Object.defineProperty( this, name, { 7718 enumerable: true, 7719 configurable: true, 7720 writable: true, 7721 value: value 7722 } ); 7723 } 7724 } ); 7725 }, 7726 7727 fix: function( originalEvent ) { 7728 return originalEvent[ jQuery.expando ] ? 7729 originalEvent : 7730 new jQuery.Event( originalEvent ); 7731 }, 7732 7733 special: { 7734 load: { 7735 7736 // Prevent triggered image.load events from bubbling to window.load 7737 noBubble: true 7738 }, 7739 click: { 7740 7741 // Utilize native event to ensure correct state for checkable inputs 7742 setup: function( data ) { 7743 7744 // For mutual compressibility with _default, replace `this` access with a local var. 7745 // `|| data` is dead code meant only to preserve the variable through minification. 7746 var el = this || data; 7747 7748 // Claim the first handler 7749 if ( rcheckableType.test( el.type ) && 7750 el.click && nodeName( el, "input" ) ) { 7751 7752 // dataPriv.set( el, "click", ... ) 7753 leverageNative( el, "click", returnTrue ); 7754 } 7755 7756 // Return false to allow normal processing in the caller 7757 return false; 7758 }, 7759 trigger: function( data ) { 7760 7761 // For mutual compressibility with _default, replace `this` access with a local var. 7762 // `|| data` is dead code meant only to preserve the variable through minification. 7763 var el = this || data; 7764 7765 // Force setup before triggering a click 7766 if ( rcheckableType.test( el.type ) && 7767 el.click && nodeName( el, "input" ) ) { 7768 7769 leverageNative( el, "click" ); 7770 } 7771 7772 // Return non-false to allow normal event-path propagation 7773 return true; 7774 }, 7775 7776 // For cross-browser consistency, suppress native .click() on links 7777 // Also prevent it if we're currently inside a leveraged native-event stack 7778 _default: function( event ) { 7779 var target = event.target; 7780 return rcheckableType.test( target.type ) && 7781 target.click && nodeName( target, "input" ) && 7782 dataPriv.get( target, "click" ) || 7783 nodeName( target, "a" ); 7784 } 7785 }, 7786 7787 beforeunload: { 7788 postDispatch: function( event ) { 7789 7790 // Support: Firefox 20+ 7791 // Firefox doesn't alert if the returnValue field is not set. 7792 if ( event.result !== undefined && event.originalEvent ) { 7793 event.originalEvent.returnValue = event.result; 7794 } 7795 } 7796 } 7797 } 7798}; 7799 7800// Ensure the presence of an event listener that handles manually-triggered 7801// synthetic events by interrupting progress until reinvoked in response to 7802// *native* events that it fires directly, ensuring that state changes have 7803// already occurred before other listeners are invoked. 7804function leverageNative( el, type, expectSync ) { 7805 7806 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 7807 if ( !expectSync ) { 7808 if ( dataPriv.get( el, type ) === undefined ) { 7809 jQuery.event.add( el, type, returnTrue ); 7810 } 7811 return; 7812 } 7813 7814 // Register the controller as a special universal handler for all event namespaces 7815 dataPriv.set( el, type, false ); 7816 jQuery.event.add( el, type, { 7817 namespace: false, 7818 handler: function( event ) { 7819 var notAsync, result, 7820 saved = dataPriv.get( this, type ); 7821 7822 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 7823 7824 // Interrupt processing of the outer synthetic .trigger()ed event 7825 // Saved data should be false in such cases, but might be a leftover capture object 7826 // from an async native handler (gh-4350) 7827 if ( !saved.length ) { 7828 7829 // Store arguments for use when handling the inner native event 7830 // There will always be at least one argument (an event object), so this array 7831 // will not be confused with a leftover capture object. 7832 saved = slice.call( arguments ); 7833 dataPriv.set( this, type, saved ); 7834 7835 // Trigger the native event and capture its result 7836 // Support: IE <=9 - 11+ 7837 // focus() and blur() are asynchronous 7838 notAsync = expectSync( this, type ); 7839 this[ type ](); 7840 result = dataPriv.get( this, type ); 7841 if ( saved !== result || notAsync ) { 7842 dataPriv.set( this, type, false ); 7843 } else { 7844 result = {}; 7845 } 7846 if ( saved !== result ) { 7847 7848 // Cancel the outer synthetic event 7849 event.stopImmediatePropagation(); 7850 event.preventDefault(); 7851 7852 // Support: Chrome 86+ 7853 // In Chrome, if an element having a focusout handler is blurred by 7854 // clicking outside of it, it invokes the handler synchronously. If 7855 // that handler calls `.remove()` on the element, the data is cleared, 7856 // leaving `result` undefined. We need to guard against this. 7857 return result && result.value; 7858 } 7859 7860 // If this is an inner synthetic event for an event with a bubbling surrogate 7861 // (focus or blur), assume that the surrogate already propagated from triggering the 7862 // native event and prevent that from happening again here. 7863 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 7864 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 7865 // less bad than duplication. 7866 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 7867 event.stopPropagation(); 7868 } 7869 7870 // If this is a native event triggered above, everything is now in order 7871 // Fire an inner synthetic event with the original arguments 7872 } else if ( saved.length ) { 7873 7874 // ...and capture the result 7875 dataPriv.set( this, type, { 7876 value: jQuery.event.trigger( 7877 7878 // Support: IE <=9 - 11+ 7879 // Extend with the prototype to reset the above stopImmediatePropagation() 7880 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), 7881 saved.slice( 1 ), 7882 this 7883 ) 7884 } ); 7885 7886 // Abort handling of the native event 7887 event.stopImmediatePropagation(); 7888 } 7889 } 7890 } ); 7891} 7892 7893jQuery.removeEvent = function( elem, type, handle ) { 7894 7895 // This "if" is needed for plain objects 7896 if ( elem.removeEventListener ) { 7897 elem.removeEventListener( type, handle ); 7898 } 7899}; 7900 7901jQuery.Event = function( src, props ) { 7902 7903 // Allow instantiation without the 'new' keyword 7904 if ( !( this instanceof jQuery.Event ) ) { 7905 return new jQuery.Event( src, props ); 7906 } 7907 7908 // Event object 7909 if ( src && src.type ) { 7910 this.originalEvent = src; 7911 this.type = src.type; 7912 7913 // Events bubbling up the document may have been marked as prevented 7914 // by a handler lower down the tree; reflect the correct value. 7915 this.isDefaultPrevented = src.defaultPrevented || 7916 src.defaultPrevented === undefined && 7917 7918 // Support: Android <=2.3 only 7919 src.returnValue === false ? 7920 returnTrue : 7921 returnFalse; 7922 7923 // Create target properties 7924 // Support: Safari <=6 - 7 only 7925 // Target should not be a text node (trac-504, trac-13143) 7926 this.target = ( src.target && src.target.nodeType === 3 ) ? 7927 src.target.parentNode : 7928 src.target; 7929 7930 this.currentTarget = src.currentTarget; 7931 this.relatedTarget = src.relatedTarget; 7932 7933 // Event type 7934 } else { 7935 this.type = src; 7936 } 7937 7938 // Put explicitly provided properties onto the event object 7939 if ( props ) { 7940 jQuery.extend( this, props ); 7941 } 7942 7943 // Create a timestamp if incoming event doesn't have one 7944 this.timeStamp = src && src.timeStamp || Date.now(); 7945 7946 // Mark it as fixed 7947 this[ jQuery.expando ] = true; 7948}; 7949 7950// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 7951// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 7952jQuery.Event.prototype = { 7953 constructor: jQuery.Event, 7954 isDefaultPrevented: returnFalse, 7955 isPropagationStopped: returnFalse, 7956 isImmediatePropagationStopped: returnFalse, 7957 isSimulated: false, 7958 7959 preventDefault: function() { 7960 var e = this.originalEvent; 7961 7962 this.isDefaultPrevented = returnTrue; 7963 7964 if ( e && !this.isSimulated ) { 7965 e.preventDefault(); 7966 } 7967 }, 7968 stopPropagation: function() { 7969 var e = this.originalEvent; 7970 7971 this.isPropagationStopped = returnTrue; 7972 7973 if ( e && !this.isSimulated ) { 7974 e.stopPropagation(); 7975 } 7976 }, 7977 stopImmediatePropagation: function() { 7978 var e = this.originalEvent; 7979 7980 this.isImmediatePropagationStopped = returnTrue; 7981 7982 if ( e && !this.isSimulated ) { 7983 e.stopImmediatePropagation(); 7984 } 7985 7986 this.stopPropagation(); 7987 } 7988}; 7989 7990// Includes all common event props including KeyEvent and MouseEvent specific props 7991jQuery.each( { 7992 altKey: true, 7993 bubbles: true, 7994 cancelable: true, 7995 changedTouches: true, 7996 ctrlKey: true, 7997 detail: true, 7998 eventPhase: true, 7999 metaKey: true, 8000 pageX: true, 8001 pageY: true, 8002 shiftKey: true, 8003 view: true, 8004 "char": true, 8005 code: true, 8006 charCode: true, 8007 key: true, 8008 keyCode: true, 8009 button: true, 8010 buttons: true, 8011 clientX: true, 8012 clientY: true, 8013 offsetX: true, 8014 offsetY: true, 8015 pointerId: true, 8016 pointerType: true, 8017 screenX: true, 8018 screenY: true, 8019 targetTouches: true, 8020 toElement: true, 8021 touches: true, 8022 which: true 8023}, jQuery.event.addProp ); 8024 8025jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 8026 jQuery.event.special[ type ] = { 8027 8028 // Utilize native event if possible so blur/focus sequence is correct 8029 setup: function() { 8030 8031 // Claim the first handler 8032 // dataPriv.set( this, "focus", ... ) 8033 // dataPriv.set( this, "blur", ... ) 8034 leverageNative( this, type, expectSync ); 8035 8036 // Return false to allow normal processing in the caller 8037 return false; 8038 }, 8039 trigger: function() { 8040 8041 // Force setup before trigger 8042 leverageNative( this, type ); 8043 8044 // Return non-false to allow normal event-path propagation 8045 return true; 8046 }, 8047 8048 // Suppress native focus or blur if we're currently inside 8049 // a leveraged native-event stack 8050 _default: function( event ) { 8051 return dataPriv.get( event.target, type ); 8052 }, 8053 8054 delegateType: delegateType 8055 }; 8056} ); 8057 8058// Create mouseenter/leave events using mouseover/out and event-time checks 8059// so that event delegation works in jQuery. 8060// Do the same for pointerenter/pointerleave and pointerover/pointerout 8061// 8062// Support: Safari 7 only 8063// Safari sends mouseenter too often; see: 8064// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 8065// for the description of the bug (it existed in older Chrome versions as well). 8066jQuery.each( { 8067 mouseenter: "mouseover", 8068 mouseleave: "mouseout", 8069 pointerenter: "pointerover", 8070 pointerleave: "pointerout" 8071}, function( orig, fix ) { 8072 jQuery.event.special[ orig ] = { 8073 delegateType: fix, 8074 bindType: fix, 8075 8076 handle: function( event ) { 8077 var ret, 8078 target = this, 8079 related = event.relatedTarget, 8080 handleObj = event.handleObj; 8081 8082 // For mouseenter/leave call the handler if related is outside the target. 8083 // NB: No relatedTarget if the mouse left/entered the browser window 8084 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 8085 event.type = handleObj.origType; 8086 ret = handleObj.handler.apply( this, arguments ); 8087 event.type = fix; 8088 } 8089 return ret; 8090 } 8091 }; 8092} ); 8093 8094jQuery.fn.extend( { 8095 8096 on: function( types, selector, data, fn ) { 8097 return on( this, types, selector, data, fn ); 8098 }, 8099 one: function( types, selector, data, fn ) { 8100 return on( this, types, selector, data, fn, 1 ); 8101 }, 8102 off: function( types, selector, fn ) { 8103 var handleObj, type; 8104 if ( types && types.preventDefault && types.handleObj ) { 8105 8106 // ( event ) dispatched jQuery.Event 8107 handleObj = types.handleObj; 8108 jQuery( types.delegateTarget ).off( 8109 handleObj.namespace ? 8110 handleObj.origType + "." + handleObj.namespace : 8111 handleObj.origType, 8112 handleObj.selector, 8113 handleObj.handler 8114 ); 8115 return this; 8116 } 8117 if ( typeof types === "object" ) { 8118 8119 // ( types-object [, selector] ) 8120 for ( type in types ) { 8121 this.off( type, selector, types[ type ] ); 8122 } 8123 return this; 8124 } 8125 if ( selector === false || typeof selector === "function" ) { 8126 8127 // ( types [, fn] ) 8128 fn = selector; 8129 selector = undefined; 8130 } 8131 if ( fn === false ) { 8132 fn = returnFalse; 8133 } 8134 return this.each( function() { 8135 jQuery.event.remove( this, types, fn, selector ); 8136 } ); 8137 } 8138} ); 8139 8140 8141var 8142 8143 // Support: IE <=10 - 11, Edge 12 - 13 only 8144 // In IE/Edge using regex groups here causes severe slowdowns. 8145 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 8146 rnoInnerhtml = /<script|<style|<link/i, 8147 8148 // checked="checked" or checked 8149 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 8150 8151 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 8152 8153// Prefer a tbody over its parent table for containing new rows 8154function manipulationTarget( elem, content ) { 8155 if ( nodeName( elem, "table" ) && 8156 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 8157 8158 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 8159 } 8160 8161 return elem; 8162} 8163 8164// Replace/restore the type attribute of script elements for safe DOM manipulation 8165function disableScript( elem ) { 8166 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 8167 return elem; 8168} 8169function restoreScript( elem ) { 8170 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 8171 elem.type = elem.type.slice( 5 ); 8172 } else { 8173 elem.removeAttribute( "type" ); 8174 } 8175 8176 return elem; 8177} 8178 8179function cloneCopyEvent( src, dest ) { 8180 var i, l, type, pdataOld, udataOld, udataCur, events; 8181 8182 if ( dest.nodeType !== 1 ) { 8183 return; 8184 } 8185 8186 // 1. Copy private data: events, handlers, etc. 8187 if ( dataPriv.hasData( src ) ) { 8188 pdataOld = dataPriv.get( src ); 8189 events = pdataOld.events; 8190 8191 if ( events ) { 8192 dataPriv.remove( dest, "handle events" ); 8193 8194 for ( type in events ) { 8195 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 8196 jQuery.event.add( dest, type, events[ type ][ i ] ); 8197 } 8198 } 8199 } 8200 } 8201 8202 // 2. Copy user data 8203 if ( dataUser.hasData( src ) ) { 8204 udataOld = dataUser.access( src ); 8205 udataCur = jQuery.extend( {}, udataOld ); 8206 8207 dataUser.set( dest, udataCur ); 8208 } 8209} 8210 8211// Fix IE bugs, see support tests 8212function fixInput( src, dest ) { 8213 var nodeName = dest.nodeName.toLowerCase(); 8214 8215 // Fails to persist the checked state of a cloned checkbox or radio button. 8216 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 8217 dest.checked = src.checked; 8218 8219 // Fails to return the selected option to the default selected state when cloning options 8220 } else if ( nodeName === "input" || nodeName === "textarea" ) { 8221 dest.defaultValue = src.defaultValue; 8222 } 8223} 8224 8225function domManip( collection, args, callback, ignored ) { 8226 8227 // Flatten any nested arrays 8228 args = flat( args ); 8229 8230 var fragment, first, scripts, hasScripts, node, doc, 8231 i = 0, 8232 l = collection.length, 8233 iNoClone = l - 1, 8234 value = args[ 0 ], 8235 valueIsFunction = isFunction( value ); 8236 8237 // We can't cloneNode fragments that contain checked, in WebKit 8238 if ( valueIsFunction || 8239 ( l > 1 && typeof value === "string" && 8240 !support.checkClone && rchecked.test( value ) ) ) { 8241 return collection.each( function( index ) { 8242 var self = collection.eq( index ); 8243 if ( valueIsFunction ) { 8244 args[ 0 ] = value.call( this, index, self.html() ); 8245 } 8246 domManip( self, args, callback, ignored ); 8247 } ); 8248 } 8249 8250 if ( l ) { 8251 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 8252 first = fragment.firstChild; 8253 8254 if ( fragment.childNodes.length === 1 ) { 8255 fragment = first; 8256 } 8257 8258 // Require either new content or an interest in ignored elements to invoke the callback 8259 if ( first || ignored ) { 8260 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 8261 hasScripts = scripts.length; 8262 8263 // Use the original fragment for the last item 8264 // instead of the first because it can end up 8265 // being emptied incorrectly in certain situations (trac-8070). 8266 for ( ; i < l; i++ ) { 8267 node = fragment; 8268 8269 if ( i !== iNoClone ) { 8270 node = jQuery.clone( node, true, true ); 8271 8272 // Keep references to cloned scripts for later restoration 8273 if ( hasScripts ) { 8274 8275 // Support: Android <=4.0 only, PhantomJS 1 only 8276 // push.apply(_, arraylike) throws on ancient WebKit 8277 jQuery.merge( scripts, getAll( node, "script" ) ); 8278 } 8279 } 8280 8281 callback.call( collection[ i ], node, i ); 8282 } 8283 8284 if ( hasScripts ) { 8285 doc = scripts[ scripts.length - 1 ].ownerDocument; 8286 8287 // Reenable scripts 8288 jQuery.map( scripts, restoreScript ); 8289 8290 // Evaluate executable scripts on first document insertion 8291 for ( i = 0; i < hasScripts; i++ ) { 8292 node = scripts[ i ]; 8293 if ( rscriptType.test( node.type || "" ) && 8294 !dataPriv.access( node, "globalEval" ) && 8295 jQuery.contains( doc, node ) ) { 8296 8297 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 8298 8299 // Optional AJAX dependency, but won't run scripts if not present 8300 if ( jQuery._evalUrl && !node.noModule ) { 8301 jQuery._evalUrl( node.src, { 8302 nonce: node.nonce || node.getAttribute( "nonce" ) 8303 }, doc ); 8304 } 8305 } else { 8306 8307 // Unwrap a CDATA section containing script contents. This shouldn't be 8308 // needed as in XML documents they're already not visible when 8309 // inspecting element contents and in HTML documents they have no 8310 // meaning but we're preserving that logic for backwards compatibility. 8311 // This will be removed completely in 4.0. See gh-4904. 8312 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 8313 } 8314 } 8315 } 8316 } 8317 } 8318 } 8319 8320 return collection; 8321} 8322 8323function remove( elem, selector, keepData ) { 8324 var node, 8325 nodes = selector ? jQuery.filter( selector, elem ) : elem, 8326 i = 0; 8327 8328 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 8329 if ( !keepData && node.nodeType === 1 ) { 8330 jQuery.cleanData( getAll( node ) ); 8331 } 8332 8333 if ( node.parentNode ) { 8334 if ( keepData && isAttached( node ) ) { 8335 setGlobalEval( getAll( node, "script" ) ); 8336 } 8337 node.parentNode.removeChild( node ); 8338 } 8339 } 8340 8341 return elem; 8342} 8343 8344jQuery.extend( { 8345 htmlPrefilter: function( html ) { 8346 return html; 8347 }, 8348 8349 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 8350 var i, l, srcElements, destElements, 8351 clone = elem.cloneNode( true ), 8352 inPage = isAttached( elem ); 8353 8354 // Fix IE cloning issues 8355 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 8356 !jQuery.isXMLDoc( elem ) ) { 8357 8358 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 8359 destElements = getAll( clone ); 8360 srcElements = getAll( elem ); 8361 8362 for ( i = 0, l = srcElements.length; i < l; i++ ) { 8363 fixInput( srcElements[ i ], destElements[ i ] ); 8364 } 8365 } 8366 8367 // Copy the events from the original to the clone 8368 if ( dataAndEvents ) { 8369 if ( deepDataAndEvents ) { 8370 srcElements = srcElements || getAll( elem ); 8371 destElements = destElements || getAll( clone ); 8372 8373 for ( i = 0, l = srcElements.length; i < l; i++ ) { 8374 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 8375 } 8376 } else { 8377 cloneCopyEvent( elem, clone ); 8378 } 8379 } 8380 8381 // Preserve script evaluation history 8382 destElements = getAll( clone, "script" ); 8383 if ( destElements.length > 0 ) { 8384 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 8385 } 8386 8387 // Return the cloned set 8388 return clone; 8389 }, 8390 8391 cleanData: function( elems ) { 8392 var data, elem, type, 8393 special = jQuery.event.special, 8394 i = 0; 8395 8396 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 8397 if ( acceptData( elem ) ) { 8398 if ( ( data = elem[ dataPriv.expando ] ) ) { 8399 if ( data.events ) { 8400 for ( type in data.events ) { 8401 if ( special[ type ] ) { 8402 jQuery.event.remove( elem, type ); 8403 8404 // This is a shortcut to avoid jQuery.event.remove's overhead 8405 } else { 8406 jQuery.removeEvent( elem, type, data.handle ); 8407 } 8408 } 8409 } 8410 8411 // Support: Chrome <=35 - 45+ 8412 // Assign undefined instead of using delete, see Data#remove 8413 elem[ dataPriv.expando ] = undefined; 8414 } 8415 if ( elem[ dataUser.expando ] ) { 8416 8417 // Support: Chrome <=35 - 45+ 8418 // Assign undefined instead of using delete, see Data#remove 8419 elem[ dataUser.expando ] = undefined; 8420 } 8421 } 8422 } 8423 } 8424} ); 8425 8426jQuery.fn.extend( { 8427 detach: function( selector ) { 8428 return remove( this, selector, true ); 8429 }, 8430 8431 remove: function( selector ) { 8432 return remove( this, selector ); 8433 }, 8434 8435 text: function( value ) { 8436 return access( this, function( value ) { 8437 return value === undefined ? 8438 jQuery.text( this ) : 8439 this.empty().each( function() { 8440 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 8441 this.textContent = value; 8442 } 8443 } ); 8444 }, null, value, arguments.length ); 8445 }, 8446 8447 append: function() { 8448 return domManip( this, arguments, function( elem ) { 8449 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 8450 var target = manipulationTarget( this, elem ); 8451 target.appendChild( elem ); 8452 } 8453 } ); 8454 }, 8455 8456 prepend: function() { 8457 return domManip( this, arguments, function( elem ) { 8458 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 8459 var target = manipulationTarget( this, elem ); 8460 target.insertBefore( elem, target.firstChild ); 8461 } 8462 } ); 8463 }, 8464 8465 before: function() { 8466 return domManip( this, arguments, function( elem ) { 8467 if ( this.parentNode ) { 8468 this.parentNode.insertBefore( elem, this ); 8469 } 8470 } ); 8471 }, 8472 8473 after: function() { 8474 return domManip( this, arguments, function( elem ) { 8475 if ( this.parentNode ) { 8476 this.parentNode.insertBefore( elem, this.nextSibling ); 8477 } 8478 } ); 8479 }, 8480 8481 empty: function() { 8482 var elem, 8483 i = 0; 8484 8485 for ( ; ( elem = this[ i ] ) != null; i++ ) { 8486 if ( elem.nodeType === 1 ) { 8487 8488 // Prevent memory leaks 8489 jQuery.cleanData( getAll( elem, false ) ); 8490 8491 // Remove any remaining nodes 8492 elem.textContent = ""; 8493 } 8494 } 8495 8496 return this; 8497 }, 8498 8499 clone: function( dataAndEvents, deepDataAndEvents ) { 8500 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 8501 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 8502 8503 return this.map( function() { 8504 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 8505 } ); 8506 }, 8507 8508 html: function( value ) { 8509 return access( this, function( value ) { 8510 var elem = this[ 0 ] || {}, 8511 i = 0, 8512 l = this.length; 8513 8514 if ( value === undefined && elem.nodeType === 1 ) { 8515 return elem.innerHTML; 8516 } 8517 8518 // See if we can take a shortcut and just use innerHTML 8519 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 8520 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 8521 8522 value = jQuery.htmlPrefilter( value ); 8523 8524 try { 8525 for ( ; i < l; i++ ) { 8526 elem = this[ i ] || {}; 8527 8528 // Remove element nodes and prevent memory leaks 8529 if ( elem.nodeType === 1 ) { 8530 jQuery.cleanData( getAll( elem, false ) ); 8531 elem.innerHTML = value; 8532 } 8533 } 8534 8535 elem = 0; 8536 8537 // If using innerHTML throws an exception, use the fallback method 8538 } catch ( e ) {} 8539 } 8540 8541 if ( elem ) { 8542 this.empty().append( value ); 8543 } 8544 }, null, value, arguments.length ); 8545 }, 8546 8547 replaceWith: function() { 8548 var ignored = []; 8549 8550 // Make the changes, replacing each non-ignored context element with the new content 8551 return domManip( this, arguments, function( elem ) { 8552 var parent = this.parentNode; 8553 8554 if ( jQuery.inArray( this, ignored ) < 0 ) { 8555 jQuery.cleanData( getAll( this ) ); 8556 if ( parent ) { 8557 parent.replaceChild( elem, this ); 8558 } 8559 } 8560 8561 // Force callback invocation 8562 }, ignored ); 8563 } 8564} ); 8565 8566jQuery.each( { 8567 appendTo: "append", 8568 prependTo: "prepend", 8569 insertBefore: "before", 8570 insertAfter: "after", 8571 replaceAll: "replaceWith" 8572}, function( name, original ) { 8573 jQuery.fn[ name ] = function( selector ) { 8574 var elems, 8575 ret = [], 8576 insert = jQuery( selector ), 8577 last = insert.length - 1, 8578 i = 0; 8579 8580 for ( ; i <= last; i++ ) { 8581 elems = i === last ? this : this.clone( true ); 8582 jQuery( insert[ i ] )[ original ]( elems ); 8583 8584 // Support: Android <=4.0 only, PhantomJS 1 only 8585 // .get() because push.apply(_, arraylike) throws on ancient WebKit 8586 push.apply( ret, elems.get() ); 8587 } 8588 8589 return this.pushStack( ret ); 8590 }; 8591} ); 8592var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 8593 8594var rcustomProp = /^--/; 8595 8596 8597var getStyles = function( elem ) { 8598 8599 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 8600 // IE throws on elements created in popups 8601 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 8602 var view = elem.ownerDocument.defaultView; 8603 8604 if ( !view || !view.opener ) { 8605 view = window; 8606 } 8607 8608 return view.getComputedStyle( elem ); 8609 }; 8610 8611var swap = function( elem, options, callback ) { 8612 var ret, name, 8613 old = {}; 8614 8615 // Remember the old values, and insert the new ones 8616 for ( name in options ) { 8617 old[ name ] = elem.style[ name ]; 8618 elem.style[ name ] = options[ name ]; 8619 } 8620 8621 ret = callback.call( elem ); 8622 8623 // Revert the old values 8624 for ( name in options ) { 8625 elem.style[ name ] = old[ name ]; 8626 } 8627 8628 return ret; 8629}; 8630 8631 8632var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 8633 8634var whitespace = "[\\x20\\t\\r\\n\\f]"; 8635 8636 8637var rtrimCSS = new RegExp( 8638 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 8639 "g" 8640); 8641 8642 8643 8644 8645( function() { 8646 8647 // Executing both pixelPosition & boxSizingReliable tests require only one layout 8648 // so they're executed at the same time to save the second computation. 8649 function computeStyleTests() { 8650 8651 // This is a singleton, we need to execute it only once 8652 if ( !div ) { 8653 return; 8654 } 8655 8656 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 8657 "margin-top:1px;padding:0;border:0"; 8658 div.style.cssText = 8659 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 8660 "margin:auto;border:1px;padding:1px;" + 8661 "width:60%;top:1%"; 8662 documentElement.appendChild( container ).appendChild( div ); 8663 8664 var divStyle = window.getComputedStyle( div ); 8665 pixelPositionVal = divStyle.top !== "1%"; 8666 8667 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 8668 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 8669 8670 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 8671 // Some styles come back with percentage values, even though they shouldn't 8672 div.style.right = "60%"; 8673 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 8674 8675 // Support: IE 9 - 11 only 8676 // Detect misreporting of content dimensions for box-sizing:border-box elements 8677 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 8678 8679 // Support: IE 9 only 8680 // Detect overflow:scroll screwiness (gh-3699) 8681 // Support: Chrome <=64 8682 // Don't get tricked when zoom affects offsetWidth (gh-4029) 8683 div.style.position = "absolute"; 8684 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 8685 8686 documentElement.removeChild( container ); 8687 8688 // Nullify the div so it wouldn't be stored in the memory and 8689 // it will also be a sign that checks already performed 8690 div = null; 8691 } 8692 8693 function roundPixelMeasures( measure ) { 8694 return Math.round( parseFloat( measure ) ); 8695 } 8696 8697 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 8698 reliableTrDimensionsVal, reliableMarginLeftVal, 8699 container = document.createElement( "div" ), 8700 div = document.createElement( "div" ); 8701 8702 // Finish early in limited (non-browser) environments 8703 if ( !div.style ) { 8704 return; 8705 } 8706 8707 // Support: IE <=9 - 11 only 8708 // Style of cloned element affects source element cloned (trac-8908) 8709 div.style.backgroundClip = "content-box"; 8710 div.cloneNode( true ).style.backgroundClip = ""; 8711 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 8712 8713 jQuery.extend( support, { 8714 boxSizingReliable: function() { 8715 computeStyleTests(); 8716 return boxSizingReliableVal; 8717 }, 8718 pixelBoxStyles: function() { 8719 computeStyleTests(); 8720 return pixelBoxStylesVal; 8721 }, 8722 pixelPosition: function() { 8723 computeStyleTests(); 8724 return pixelPositionVal; 8725 }, 8726 reliableMarginLeft: function() { 8727 computeStyleTests(); 8728 return reliableMarginLeftVal; 8729 }, 8730 scrollboxSize: function() { 8731 computeStyleTests(); 8732 return scrollboxSizeVal; 8733 }, 8734 8735 // Support: IE 9 - 11+, Edge 15 - 18+ 8736 // IE/Edge misreport `getComputedStyle` of table rows with width/height 8737 // set in CSS while `offset*` properties report correct values. 8738 // Behavior in IE 9 is more subtle than in newer versions & it passes 8739 // some versions of this test; make sure not to make it pass there! 8740 // 8741 // Support: Firefox 70+ 8742 // Only Firefox includes border widths 8743 // in computed dimensions. (gh-4529) 8744 reliableTrDimensions: function() { 8745 var table, tr, trChild, trStyle; 8746 if ( reliableTrDimensionsVal == null ) { 8747 table = document.createElement( "table" ); 8748 tr = document.createElement( "tr" ); 8749 trChild = document.createElement( "div" ); 8750 8751 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 8752 tr.style.cssText = "border:1px solid"; 8753 8754 // Support: Chrome 86+ 8755 // Height set through cssText does not get applied. 8756 // Computed height then comes back as 0. 8757 tr.style.height = "1px"; 8758 trChild.style.height = "9px"; 8759 8760 // Support: Android 8 Chrome 86+ 8761 // In our bodyBackground.html iframe, 8762 // display for all div elements is set to "inline", 8763 // which causes a problem only in Android 8 Chrome 86. 8764 // Ensuring the div is display: block 8765 // gets around this issue. 8766 trChild.style.display = "block"; 8767 8768 documentElement 8769 .appendChild( table ) 8770 .appendChild( tr ) 8771 .appendChild( trChild ); 8772 8773 trStyle = window.getComputedStyle( tr ); 8774 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 8775 parseInt( trStyle.borderTopWidth, 10 ) + 8776 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 8777 8778 documentElement.removeChild( table ); 8779 } 8780 return reliableTrDimensionsVal; 8781 } 8782 } ); 8783} )(); 8784 8785 8786function curCSS( elem, name, computed ) { 8787 var width, minWidth, maxWidth, ret, 8788 isCustomProp = rcustomProp.test( name ), 8789 8790 // Support: Firefox 51+ 8791 // Retrieving style before computed somehow 8792 // fixes an issue with getting wrong values 8793 // on detached elements 8794 style = elem.style; 8795 8796 computed = computed || getStyles( elem ); 8797 8798 // getPropertyValue is needed for: 8799 // .css('filter') (IE 9 only, trac-12537) 8800 // .css('--customProperty) (gh-3144) 8801 if ( computed ) { 8802 8803 // Support: IE <=9 - 11+ 8804 // IE only supports `"float"` in `getPropertyValue`; in computed styles 8805 // it's only available as `"cssFloat"`. We no longer modify properties 8806 // sent to `.css()` apart from camelCasing, so we need to check both. 8807 // Normally, this would create difference in behavior: if 8808 // `getPropertyValue` returns an empty string, the value returned 8809 // by `.css()` would be `undefined`. This is usually the case for 8810 // disconnected elements. However, in IE even disconnected elements 8811 // with no styles return `"none"` for `getPropertyValue( "float" )` 8812 ret = computed.getPropertyValue( name ) || computed[ name ]; 8813 8814 if ( isCustomProp && ret ) { 8815 8816 // Support: Firefox 105+, Chrome <=105+ 8817 // Spec requires trimming whitespace for custom properties (gh-4926). 8818 // Firefox only trims leading whitespace. Chrome just collapses 8819 // both leading & trailing whitespace to a single space. 8820 // 8821 // Fall back to `undefined` if empty string returned. 8822 // This collapses a missing definition with property defined 8823 // and set to an empty string but there's no standard API 8824 // allowing us to differentiate them without a performance penalty 8825 // and returning `undefined` aligns with older jQuery. 8826 // 8827 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 8828 // as whitespace while CSS does not, but this is not a problem 8829 // because CSS preprocessing replaces them with U+000A LINE FEED 8830 // (which *is* CSS whitespace) 8831 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 8832 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 8833 } 8834 8835 if ( ret === "" && !isAttached( elem ) ) { 8836 ret = jQuery.style( elem, name ); 8837 } 8838 8839 // A tribute to the "awesome hack by Dean Edwards" 8840 // Android Browser returns percentage for some values, 8841 // but width seems to be reliably pixels. 8842 // This is against the CSSOM draft spec: 8843 // https://drafts.csswg.org/cssom/#resolved-values 8844 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 8845 8846 // Remember the original values 8847 width = style.width; 8848 minWidth = style.minWidth; 8849 maxWidth = style.maxWidth; 8850 8851 // Put in the new values to get a computed value out 8852 style.minWidth = style.maxWidth = style.width = ret; 8853 ret = computed.width; 8854 8855 // Revert the changed values 8856 style.width = width; 8857 style.minWidth = minWidth; 8858 style.maxWidth = maxWidth; 8859 } 8860 } 8861 8862 return ret !== undefined ? 8863 8864 // Support: IE <=9 - 11 only 8865 // IE returns zIndex value as an integer. 8866 ret + "" : 8867 ret; 8868} 8869 8870 8871function addGetHookIf( conditionFn, hookFn ) { 8872 8873 // Define the hook, we'll check on the first run if it's really needed. 8874 return { 8875 get: function() { 8876 if ( conditionFn() ) { 8877 8878 // Hook not needed (or it's not possible to use it due 8879 // to missing dependency), remove it. 8880 delete this.get; 8881 return; 8882 } 8883 8884 // Hook needed; redefine it so that the support test is not executed again. 8885 return ( this.get = hookFn ).apply( this, arguments ); 8886 } 8887 }; 8888} 8889 8890 8891var cssPrefixes = [ "Webkit", "Moz", "ms" ], 8892 emptyStyle = document.createElement( "div" ).style, 8893 vendorProps = {}; 8894 8895// Return a vendor-prefixed property or undefined 8896function vendorPropName( name ) { 8897 8898 // Check for vendor prefixed names 8899 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 8900 i = cssPrefixes.length; 8901 8902 while ( i-- ) { 8903 name = cssPrefixes[ i ] + capName; 8904 if ( name in emptyStyle ) { 8905 return name; 8906 } 8907 } 8908} 8909 8910// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 8911function finalPropName( name ) { 8912 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 8913 8914 if ( final ) { 8915 return final; 8916 } 8917 if ( name in emptyStyle ) { 8918 return name; 8919 } 8920 return vendorProps[ name ] = vendorPropName( name ) || name; 8921} 8922 8923 8924var 8925 8926 // Swappable if display is none or starts with table 8927 // except "table", "table-cell", or "table-caption" 8928 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 8929 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 8930 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 8931 cssNormalTransform = { 8932 letterSpacing: "0", 8933 fontWeight: "400" 8934 }; 8935 8936function setPositiveNumber( _elem, value, subtract ) { 8937 8938 // Any relative (+/-) values have already been 8939 // normalized at this point 8940 var matches = rcssNum.exec( value ); 8941 return matches ? 8942 8943 // Guard against undefined "subtract", e.g., when used as in cssHooks 8944 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 8945 value; 8946} 8947 8948function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 8949 var i = dimension === "width" ? 1 : 0, 8950 extra = 0, 8951 delta = 0; 8952 8953 // Adjustment may not be necessary 8954 if ( box === ( isBorderBox ? "border" : "content" ) ) { 8955 return 0; 8956 } 8957 8958 for ( ; i < 4; i += 2 ) { 8959 8960 // Both box models exclude margin 8961 if ( box === "margin" ) { 8962 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 8963 } 8964 8965 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 8966 if ( !isBorderBox ) { 8967 8968 // Add padding 8969 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 8970 8971 // For "border" or "margin", add border 8972 if ( box !== "padding" ) { 8973 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 8974 8975 // But still keep track of it otherwise 8976 } else { 8977 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 8978 } 8979 8980 // If we get here with a border-box (content + padding + border), we're seeking "content" or 8981 // "padding" or "margin" 8982 } else { 8983 8984 // For "content", subtract padding 8985 if ( box === "content" ) { 8986 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 8987 } 8988 8989 // For "content" or "padding", subtract border 8990 if ( box !== "margin" ) { 8991 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 8992 } 8993 } 8994 } 8995 8996 // Account for positive content-box scroll gutter when requested by providing computedVal 8997 if ( !isBorderBox && computedVal >= 0 ) { 8998 8999 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 9000 // Assuming integer scroll gutter, subtract the rest and round down 9001 delta += Math.max( 0, Math.ceil( 9002 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 9003 computedVal - 9004 delta - 9005 extra - 9006 0.5 9007 9008 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 9009 // Use an explicit zero to avoid NaN (gh-3964) 9010 ) ) || 0; 9011 } 9012 9013 return delta; 9014} 9015 9016function getWidthOrHeight( elem, dimension, extra ) { 9017 9018 // Start with computed style 9019 var styles = getStyles( elem ), 9020 9021 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 9022 // Fake content-box until we know it's needed to know the true value. 9023 boxSizingNeeded = !support.boxSizingReliable() || extra, 9024 isBorderBox = boxSizingNeeded && 9025 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 9026 valueIsBorderBox = isBorderBox, 9027 9028 val = curCSS( elem, dimension, styles ), 9029 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 9030 9031 // Support: Firefox <=54 9032 // Return a confounding non-pixel value or feign ignorance, as appropriate. 9033 if ( rnumnonpx.test( val ) ) { 9034 if ( !extra ) { 9035 return val; 9036 } 9037 val = "auto"; 9038 } 9039 9040 9041 // Support: IE 9 - 11 only 9042 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 9043 // In those cases, the computed value can be trusted to be border-box. 9044 if ( ( !support.boxSizingReliable() && isBorderBox || 9045 9046 // Support: IE 10 - 11+, Edge 15 - 18+ 9047 // IE/Edge misreport `getComputedStyle` of table rows with width/height 9048 // set in CSS while `offset*` properties report correct values. 9049 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 9050 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 9051 9052 // Fall back to offsetWidth/offsetHeight when value is "auto" 9053 // This happens for inline elements with no explicit setting (gh-3571) 9054 val === "auto" || 9055 9056 // Support: Android <=4.1 - 4.3 only 9057 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 9058 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 9059 9060 // Make sure the element is visible & connected 9061 elem.getClientRects().length ) { 9062 9063 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 9064 9065 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 9066 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 9067 // retrieved value as a content box dimension. 9068 valueIsBorderBox = offsetProp in elem; 9069 if ( valueIsBorderBox ) { 9070 val = elem[ offsetProp ]; 9071 } 9072 } 9073 9074 // Normalize "" and auto 9075 val = parseFloat( val ) || 0; 9076 9077 // Adjust for the element's box model 9078 return ( val + 9079 boxModelAdjustment( 9080 elem, 9081 dimension, 9082 extra || ( isBorderBox ? "border" : "content" ), 9083 valueIsBorderBox, 9084 styles, 9085 9086 // Provide the current computed size to request scroll gutter calculation (gh-3589) 9087 val 9088 ) 9089 ) + "px"; 9090} 9091 9092jQuery.extend( { 9093 9094 // Add in style property hooks for overriding the default 9095 // behavior of getting and setting a style property 9096 cssHooks: { 9097 opacity: { 9098 get: function( elem, computed ) { 9099 if ( computed ) { 9100 9101 // We should always get a number back from opacity 9102 var ret = curCSS( elem, "opacity" ); 9103 return ret === "" ? "1" : ret; 9104 } 9105 } 9106 } 9107 }, 9108 9109 // Don't automatically add "px" to these possibly-unitless properties 9110 cssNumber: { 9111 "animationIterationCount": true, 9112 "columnCount": true, 9113 "fillOpacity": true, 9114 "flexGrow": true, 9115 "flexShrink": true, 9116 "fontWeight": true, 9117 "gridArea": true, 9118 "gridColumn": true, 9119 "gridColumnEnd": true, 9120 "gridColumnStart": true, 9121 "gridRow": true, 9122 "gridRowEnd": true, 9123 "gridRowStart": true, 9124 "lineHeight": true, 9125 "opacity": true, 9126 "order": true, 9127 "orphans": true, 9128 "widows": true, 9129 "zIndex": true, 9130 "zoom": true 9131 }, 9132 9133 // Add in properties whose names you wish to fix before 9134 // setting or getting the value 9135 cssProps: {}, 9136 9137 // Get and set the style property on a DOM Node 9138 style: function( elem, name, value, extra ) { 9139 9140 // Don't set styles on text and comment nodes 9141 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 9142 return; 9143 } 9144 9145 // Make sure that we're working with the right name 9146 var ret, type, hooks, 9147 origName = camelCase( name ), 9148 isCustomProp = rcustomProp.test( name ), 9149 style = elem.style; 9150 9151 // Make sure that we're working with the right name. We don't 9152 // want to query the value if it is a CSS custom property 9153 // since they are user-defined. 9154 if ( !isCustomProp ) { 9155 name = finalPropName( origName ); 9156 } 9157 9158 // Gets hook for the prefixed version, then unprefixed version 9159 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 9160 9161 // Check if we're setting a value 9162 if ( value !== undefined ) { 9163 type = typeof value; 9164 9165 // Convert "+=" or "-=" to relative numbers (trac-7345) 9166 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 9167 value = adjustCSS( elem, name, ret ); 9168 9169 // Fixes bug trac-9237 9170 type = "number"; 9171 } 9172 9173 // Make sure that null and NaN values aren't set (trac-7116) 9174 if ( value == null || value !== value ) { 9175 return; 9176 } 9177 9178 // If a number was passed in, add the unit (except for certain CSS properties) 9179 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 9180 // "px" to a few hardcoded values. 9181 if ( type === "number" && !isCustomProp ) { 9182 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 9183 } 9184 9185 // background-* props affect original clone's values 9186 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 9187 style[ name ] = "inherit"; 9188 } 9189 9190 // If a hook was provided, use that value, otherwise just set the specified value 9191 if ( !hooks || !( "set" in hooks ) || 9192 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 9193 9194 if ( isCustomProp ) { 9195 style.setProperty( name, value ); 9196 } else { 9197 style[ name ] = value; 9198 } 9199 } 9200 9201 } else { 9202 9203 // If a hook was provided get the non-computed value from there 9204 if ( hooks && "get" in hooks && 9205 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 9206 9207 return ret; 9208 } 9209 9210 // Otherwise just get the value from the style object 9211 return style[ name ]; 9212 } 9213 }, 9214 9215 css: function( elem, name, extra, styles ) { 9216 var val, num, hooks, 9217 origName = camelCase( name ), 9218 isCustomProp = rcustomProp.test( name ); 9219 9220 // Make sure that we're working with the right name. We don't 9221 // want to modify the value if it is a CSS custom property 9222 // since they are user-defined. 9223 if ( !isCustomProp ) { 9224 name = finalPropName( origName ); 9225 } 9226 9227 // Try prefixed name followed by the unprefixed name 9228 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 9229 9230 // If a hook was provided get the computed value from there 9231 if ( hooks && "get" in hooks ) { 9232 val = hooks.get( elem, true, extra ); 9233 } 9234 9235 // Otherwise, if a way to get the computed value exists, use that 9236 if ( val === undefined ) { 9237 val = curCSS( elem, name, styles ); 9238 } 9239 9240 // Convert "normal" to computed value 9241 if ( val === "normal" && name in cssNormalTransform ) { 9242 val = cssNormalTransform[ name ]; 9243 } 9244 9245 // Make numeric if forced or a qualifier was provided and val looks numeric 9246 if ( extra === "" || extra ) { 9247 num = parseFloat( val ); 9248 return extra === true || isFinite( num ) ? num || 0 : val; 9249 } 9250 9251 return val; 9252 } 9253} ); 9254 9255jQuery.each( [ "height", "width" ], function( _i, dimension ) { 9256 jQuery.cssHooks[ dimension ] = { 9257 get: function( elem, computed, extra ) { 9258 if ( computed ) { 9259 9260 // Certain elements can have dimension info if we invisibly show them 9261 // but it must have a current display style that would benefit 9262 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 9263 9264 // Support: Safari 8+ 9265 // Table columns in Safari have non-zero offsetWidth & zero 9266 // getBoundingClientRect().width unless display is changed. 9267 // Support: IE <=11 only 9268 // Running getBoundingClientRect on a disconnected node 9269 // in IE throws an error. 9270 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 9271 swap( elem, cssShow, function() { 9272 return getWidthOrHeight( elem, dimension, extra ); 9273 } ) : 9274 getWidthOrHeight( elem, dimension, extra ); 9275 } 9276 }, 9277 9278 set: function( elem, value, extra ) { 9279 var matches, 9280 styles = getStyles( elem ), 9281 9282 // Only read styles.position if the test has a chance to fail 9283 // to avoid forcing a reflow. 9284 scrollboxSizeBuggy = !support.scrollboxSize() && 9285 styles.position === "absolute", 9286 9287 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 9288 boxSizingNeeded = scrollboxSizeBuggy || extra, 9289 isBorderBox = boxSizingNeeded && 9290 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 9291 subtract = extra ? 9292 boxModelAdjustment( 9293 elem, 9294 dimension, 9295 extra, 9296 isBorderBox, 9297 styles 9298 ) : 9299 0; 9300 9301 // Account for unreliable border-box dimensions by comparing offset* to computed and 9302 // faking a content-box to get border and padding (gh-3699) 9303 if ( isBorderBox && scrollboxSizeBuggy ) { 9304 subtract -= Math.ceil( 9305 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 9306 parseFloat( styles[ dimension ] ) - 9307 boxModelAdjustment( elem, dimension, "border", false, styles ) - 9308 0.5 9309 ); 9310 } 9311 9312 // Convert to pixels if value adjustment is needed 9313 if ( subtract && ( matches = rcssNum.exec( value ) ) && 9314 ( matches[ 3 ] || "px" ) !== "px" ) { 9315 9316 elem.style[ dimension ] = value; 9317 value = jQuery.css( elem, dimension ); 9318 } 9319 9320 return setPositiveNumber( elem, value, subtract ); 9321 } 9322 }; 9323} ); 9324 9325jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 9326 function( elem, computed ) { 9327 if ( computed ) { 9328 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 9329 elem.getBoundingClientRect().left - 9330 swap( elem, { marginLeft: 0 }, function() { 9331 return elem.getBoundingClientRect().left; 9332 } ) 9333 ) + "px"; 9334 } 9335 } 9336); 9337 9338// These hooks are used by animate to expand properties 9339jQuery.each( { 9340 margin: "", 9341 padding: "", 9342 border: "Width" 9343}, function( prefix, suffix ) { 9344 jQuery.cssHooks[ prefix + suffix ] = { 9345 expand: function( value ) { 9346 var i = 0, 9347 expanded = {}, 9348 9349 // Assumes a single number if not a string 9350 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 9351 9352 for ( ; i < 4; i++ ) { 9353 expanded[ prefix + cssExpand[ i ] + suffix ] = 9354 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 9355 } 9356 9357 return expanded; 9358 } 9359 }; 9360 9361 if ( prefix !== "margin" ) { 9362 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 9363 } 9364} ); 9365 9366jQuery.fn.extend( { 9367 css: function( name, value ) { 9368 return access( this, function( elem, name, value ) { 9369 var styles, len, 9370 map = {}, 9371 i = 0; 9372 9373 if ( Array.isArray( name ) ) { 9374 styles = getStyles( elem ); 9375 len = name.length; 9376 9377 for ( ; i < len; i++ ) { 9378 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 9379 } 9380 9381 return map; 9382 } 9383 9384 return value !== undefined ? 9385 jQuery.style( elem, name, value ) : 9386 jQuery.css( elem, name ); 9387 }, name, value, arguments.length > 1 ); 9388 } 9389} ); 9390 9391 9392function Tween( elem, options, prop, end, easing ) { 9393 return new Tween.prototype.init( elem, options, prop, end, easing ); 9394} 9395jQuery.Tween = Tween; 9396 9397Tween.prototype = { 9398 constructor: Tween, 9399 init: function( elem, options, prop, end, easing, unit ) { 9400 this.elem = elem; 9401 this.prop = prop; 9402 this.easing = easing || jQuery.easing._default; 9403 this.options = options; 9404 this.start = this.now = this.cur(); 9405 this.end = end; 9406 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 9407 }, 9408 cur: function() { 9409 var hooks = Tween.propHooks[ this.prop ]; 9410 9411 return hooks && hooks.get ? 9412 hooks.get( this ) : 9413 Tween.propHooks._default.get( this ); 9414 }, 9415 run: function( percent ) { 9416 var eased, 9417 hooks = Tween.propHooks[ this.prop ]; 9418 9419 if ( this.options.duration ) { 9420 this.pos = eased = jQuery.easing[ this.easing ]( 9421 percent, this.options.duration * percent, 0, 1, this.options.duration 9422 ); 9423 } else { 9424 this.pos = eased = percent; 9425 } 9426 this.now = ( this.end - this.start ) * eased + this.start; 9427 9428 if ( this.options.step ) { 9429 this.options.step.call( this.elem, this.now, this ); 9430 } 9431 9432 if ( hooks && hooks.set ) { 9433 hooks.set( this ); 9434 } else { 9435 Tween.propHooks._default.set( this ); 9436 } 9437 return this; 9438 } 9439}; 9440 9441Tween.prototype.init.prototype = Tween.prototype; 9442 9443Tween.propHooks = { 9444 _default: { 9445 get: function( tween ) { 9446 var result; 9447 9448 // Use a property on the element directly when it is not a DOM element, 9449 // or when there is no matching style property that exists. 9450 if ( tween.elem.nodeType !== 1 || 9451 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 9452 return tween.elem[ tween.prop ]; 9453 } 9454 9455 // Passing an empty string as a 3rd parameter to .css will automatically 9456 // attempt a parseFloat and fallback to a string if the parse fails. 9457 // Simple values such as "10px" are parsed to Float; 9458 // complex values such as "rotate(1rad)" are returned as-is. 9459 result = jQuery.css( tween.elem, tween.prop, "" ); 9460 9461 // Empty strings, null, undefined and "auto" are converted to 0. 9462 return !result || result === "auto" ? 0 : result; 9463 }, 9464 set: function( tween ) { 9465 9466 // Use step hook for back compat. 9467 // Use cssHook if its there. 9468 // Use .style if available and use plain properties where available. 9469 if ( jQuery.fx.step[ tween.prop ] ) { 9470 jQuery.fx.step[ tween.prop ]( tween ); 9471 } else if ( tween.elem.nodeType === 1 && ( 9472 jQuery.cssHooks[ tween.prop ] || 9473 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 9474 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 9475 } else { 9476 tween.elem[ tween.prop ] = tween.now; 9477 } 9478 } 9479 } 9480}; 9481 9482// Support: IE <=9 only 9483// Panic based approach to setting things on disconnected nodes 9484Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 9485 set: function( tween ) { 9486 if ( tween.elem.nodeType && tween.elem.parentNode ) { 9487 tween.elem[ tween.prop ] = tween.now; 9488 } 9489 } 9490}; 9491 9492jQuery.easing = { 9493 linear: function( p ) { 9494 return p; 9495 }, 9496 swing: function( p ) { 9497 return 0.5 - Math.cos( p * Math.PI ) / 2; 9498 }, 9499 _default: "swing" 9500}; 9501 9502jQuery.fx = Tween.prototype.init; 9503 9504// Back compat <1.8 extension point 9505jQuery.fx.step = {}; 9506 9507 9508 9509 9510var 9511 fxNow, inProgress, 9512 rfxtypes = /^(?:toggle|show|hide)$/, 9513 rrun = /queueHooks$/; 9514 9515function schedule() { 9516 if ( inProgress ) { 9517 if ( document.hidden === false && window.requestAnimationFrame ) { 9518 window.requestAnimationFrame( schedule ); 9519 } else { 9520 window.setTimeout( schedule, jQuery.fx.interval ); 9521 } 9522 9523 jQuery.fx.tick(); 9524 } 9525} 9526 9527// Animations created synchronously will run synchronously 9528function createFxNow() { 9529 window.setTimeout( function() { 9530 fxNow = undefined; 9531 } ); 9532 return ( fxNow = Date.now() ); 9533} 9534 9535// Generate parameters to create a standard animation 9536function genFx( type, includeWidth ) { 9537 var which, 9538 i = 0, 9539 attrs = { height: type }; 9540 9541 // If we include width, step value is 1 to do all cssExpand values, 9542 // otherwise step value is 2 to skip over Left and Right 9543 includeWidth = includeWidth ? 1 : 0; 9544 for ( ; i < 4; i += 2 - includeWidth ) { 9545 which = cssExpand[ i ]; 9546 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 9547 } 9548 9549 if ( includeWidth ) { 9550 attrs.opacity = attrs.width = type; 9551 } 9552 9553 return attrs; 9554} 9555 9556function createTween( value, prop, animation ) { 9557 var tween, 9558 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 9559 index = 0, 9560 length = collection.length; 9561 for ( ; index < length; index++ ) { 9562 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 9563 9564 // We're done with this property 9565 return tween; 9566 } 9567 } 9568} 9569 9570function defaultPrefilter( elem, props, opts ) { 9571 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 9572 isBox = "width" in props || "height" in props, 9573 anim = this, 9574 orig = {}, 9575 style = elem.style, 9576 hidden = elem.nodeType && isHiddenWithinTree( elem ), 9577 dataShow = dataPriv.get( elem, "fxshow" ); 9578 9579 // Queue-skipping animations hijack the fx hooks 9580 if ( !opts.queue ) { 9581 hooks = jQuery._queueHooks( elem, "fx" ); 9582 if ( hooks.unqueued == null ) { 9583 hooks.unqueued = 0; 9584 oldfire = hooks.empty.fire; 9585 hooks.empty.fire = function() { 9586 if ( !hooks.unqueued ) { 9587 oldfire(); 9588 } 9589 }; 9590 } 9591 hooks.unqueued++; 9592 9593 anim.always( function() { 9594 9595 // Ensure the complete handler is called before this completes 9596 anim.always( function() { 9597 hooks.unqueued--; 9598 if ( !jQuery.queue( elem, "fx" ).length ) { 9599 hooks.empty.fire(); 9600 } 9601 } ); 9602 } ); 9603 } 9604 9605 // Detect show/hide animations 9606 for ( prop in props ) { 9607 value = props[ prop ]; 9608 if ( rfxtypes.test( value ) ) { 9609 delete props[ prop ]; 9610 toggle = toggle || value === "toggle"; 9611 if ( value === ( hidden ? "hide" : "show" ) ) { 9612 9613 // Pretend to be hidden if this is a "show" and 9614 // there is still data from a stopped show/hide 9615 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 9616 hidden = true; 9617 9618 // Ignore all other no-op show/hide data 9619 } else { 9620 continue; 9621 } 9622 } 9623 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 9624 } 9625 } 9626 9627 // Bail out if this is a no-op like .hide().hide() 9628 propTween = !jQuery.isEmptyObject( props ); 9629 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 9630 return; 9631 } 9632 9633 // Restrict "overflow" and "display" styles during box animations 9634 if ( isBox && elem.nodeType === 1 ) { 9635 9636 // Support: IE <=9 - 11, Edge 12 - 15 9637 // Record all 3 overflow attributes because IE does not infer the shorthand 9638 // from identically-valued overflowX and overflowY and Edge just mirrors 9639 // the overflowX value there. 9640 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 9641 9642 // Identify a display type, preferring old show/hide data over the CSS cascade 9643 restoreDisplay = dataShow && dataShow.display; 9644 if ( restoreDisplay == null ) { 9645 restoreDisplay = dataPriv.get( elem, "display" ); 9646 } 9647 display = jQuery.css( elem, "display" ); 9648 if ( display === "none" ) { 9649 if ( restoreDisplay ) { 9650 display = restoreDisplay; 9651 } else { 9652 9653 // Get nonempty value(s) by temporarily forcing visibility 9654 showHide( [ elem ], true ); 9655 restoreDisplay = elem.style.display || restoreDisplay; 9656 display = jQuery.css( elem, "display" ); 9657 showHide( [ elem ] ); 9658 } 9659 } 9660 9661 // Animate inline elements as inline-block 9662 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 9663 if ( jQuery.css( elem, "float" ) === "none" ) { 9664 9665 // Restore the original display value at the end of pure show/hide animations 9666 if ( !propTween ) { 9667 anim.done( function() { 9668 style.display = restoreDisplay; 9669 } ); 9670 if ( restoreDisplay == null ) { 9671 display = style.display; 9672 restoreDisplay = display === "none" ? "" : display; 9673 } 9674 } 9675 style.display = "inline-block"; 9676 } 9677 } 9678 } 9679 9680 if ( opts.overflow ) { 9681 style.overflow = "hidden"; 9682 anim.always( function() { 9683 style.overflow = opts.overflow[ 0 ]; 9684 style.overflowX = opts.overflow[ 1 ]; 9685 style.overflowY = opts.overflow[ 2 ]; 9686 } ); 9687 } 9688 9689 // Implement show/hide animations 9690 propTween = false; 9691 for ( prop in orig ) { 9692 9693 // General show/hide setup for this element animation 9694 if ( !propTween ) { 9695 if ( dataShow ) { 9696 if ( "hidden" in dataShow ) { 9697 hidden = dataShow.hidden; 9698 } 9699 } else { 9700 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 9701 } 9702 9703 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 9704 if ( toggle ) { 9705 dataShow.hidden = !hidden; 9706 } 9707 9708 // Show elements before animating them 9709 if ( hidden ) { 9710 showHide( [ elem ], true ); 9711 } 9712 9713 /* eslint-disable no-loop-func */ 9714 9715 anim.done( function() { 9716 9717 /* eslint-enable no-loop-func */ 9718 9719 // The final step of a "hide" animation is actually hiding the element 9720 if ( !hidden ) { 9721 showHide( [ elem ] ); 9722 } 9723 dataPriv.remove( elem, "fxshow" ); 9724 for ( prop in orig ) { 9725 jQuery.style( elem, prop, orig[ prop ] ); 9726 } 9727 } ); 9728 } 9729 9730 // Per-property setup 9731 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 9732 if ( !( prop in dataShow ) ) { 9733 dataShow[ prop ] = propTween.start; 9734 if ( hidden ) { 9735 propTween.end = propTween.start; 9736 propTween.start = 0; 9737 } 9738 } 9739 } 9740} 9741 9742function propFilter( props, specialEasing ) { 9743 var index, name, easing, value, hooks; 9744 9745 // camelCase, specialEasing and expand cssHook pass 9746 for ( index in props ) { 9747 name = camelCase( index ); 9748 easing = specialEasing[ name ]; 9749 value = props[ index ]; 9750 if ( Array.isArray( value ) ) { 9751 easing = value[ 1 ]; 9752 value = props[ index ] = value[ 0 ]; 9753 } 9754 9755 if ( index !== name ) { 9756 props[ name ] = value; 9757 delete props[ index ]; 9758 } 9759 9760 hooks = jQuery.cssHooks[ name ]; 9761 if ( hooks && "expand" in hooks ) { 9762 value = hooks.expand( value ); 9763 delete props[ name ]; 9764 9765 // Not quite $.extend, this won't overwrite existing keys. 9766 // Reusing 'index' because we have the correct "name" 9767 for ( index in value ) { 9768 if ( !( index in props ) ) { 9769 props[ index ] = value[ index ]; 9770 specialEasing[ index ] = easing; 9771 } 9772 } 9773 } else { 9774 specialEasing[ name ] = easing; 9775 } 9776 } 9777} 9778 9779function Animation( elem, properties, options ) { 9780 var result, 9781 stopped, 9782 index = 0, 9783 length = Animation.prefilters.length, 9784 deferred = jQuery.Deferred().always( function() { 9785 9786 // Don't match elem in the :animated selector 9787 delete tick.elem; 9788 } ), 9789 tick = function() { 9790 if ( stopped ) { 9791 return false; 9792 } 9793 var currentTime = fxNow || createFxNow(), 9794 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 9795 9796 // Support: Android 2.3 only 9797 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 9798 temp = remaining / animation.duration || 0, 9799 percent = 1 - temp, 9800 index = 0, 9801 length = animation.tweens.length; 9802 9803 for ( ; index < length; index++ ) { 9804 animation.tweens[ index ].run( percent ); 9805 } 9806 9807 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 9808 9809 // If there's more to do, yield 9810 if ( percent < 1 && length ) { 9811 return remaining; 9812 } 9813 9814 // If this was an empty animation, synthesize a final progress notification 9815 if ( !length ) { 9816 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 9817 } 9818 9819 // Resolve the animation and report its conclusion 9820 deferred.resolveWith( elem, [ animation ] ); 9821 return false; 9822 }, 9823 animation = deferred.promise( { 9824 elem: elem, 9825 props: jQuery.extend( {}, properties ), 9826 opts: jQuery.extend( true, { 9827 specialEasing: {}, 9828 easing: jQuery.easing._default 9829 }, options ), 9830 originalProperties: properties, 9831 originalOptions: options, 9832 startTime: fxNow || createFxNow(), 9833 duration: options.duration, 9834 tweens: [], 9835 createTween: function( prop, end ) { 9836 var tween = jQuery.Tween( elem, animation.opts, prop, end, 9837 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 9838 animation.tweens.push( tween ); 9839 return tween; 9840 }, 9841 stop: function( gotoEnd ) { 9842 var index = 0, 9843 9844 // If we are going to the end, we want to run all the tweens 9845 // otherwise we skip this part 9846 length = gotoEnd ? animation.tweens.length : 0; 9847 if ( stopped ) { 9848 return this; 9849 } 9850 stopped = true; 9851 for ( ; index < length; index++ ) { 9852 animation.tweens[ index ].run( 1 ); 9853 } 9854 9855 // Resolve when we played the last frame; otherwise, reject 9856 if ( gotoEnd ) { 9857 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 9858 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 9859 } else { 9860 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 9861 } 9862 return this; 9863 } 9864 } ), 9865 props = animation.props; 9866 9867 propFilter( props, animation.opts.specialEasing ); 9868 9869 for ( ; index < length; index++ ) { 9870 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 9871 if ( result ) { 9872 if ( isFunction( result.stop ) ) { 9873 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 9874 result.stop.bind( result ); 9875 } 9876 return result; 9877 } 9878 } 9879 9880 jQuery.map( props, createTween, animation ); 9881 9882 if ( isFunction( animation.opts.start ) ) { 9883 animation.opts.start.call( elem, animation ); 9884 } 9885 9886 // Attach callbacks from options 9887 animation 9888 .progress( animation.opts.progress ) 9889 .done( animation.opts.done, animation.opts.complete ) 9890 .fail( animation.opts.fail ) 9891 .always( animation.opts.always ); 9892 9893 jQuery.fx.timer( 9894 jQuery.extend( tick, { 9895 elem: elem, 9896 anim: animation, 9897 queue: animation.opts.queue 9898 } ) 9899 ); 9900 9901 return animation; 9902} 9903 9904jQuery.Animation = jQuery.extend( Animation, { 9905 9906 tweeners: { 9907 "*": [ function( prop, value ) { 9908 var tween = this.createTween( prop, value ); 9909 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 9910 return tween; 9911 } ] 9912 }, 9913 9914 tweener: function( props, callback ) { 9915 if ( isFunction( props ) ) { 9916 callback = props; 9917 props = [ "*" ]; 9918 } else { 9919 props = props.match( rnothtmlwhite ); 9920 } 9921 9922 var prop, 9923 index = 0, 9924 length = props.length; 9925 9926 for ( ; index < length; index++ ) { 9927 prop = props[ index ]; 9928 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 9929 Animation.tweeners[ prop ].unshift( callback ); 9930 } 9931 }, 9932 9933 prefilters: [ defaultPrefilter ], 9934 9935 prefilter: function( callback, prepend ) { 9936 if ( prepend ) { 9937 Animation.prefilters.unshift( callback ); 9938 } else { 9939 Animation.prefilters.push( callback ); 9940 } 9941 } 9942} ); 9943 9944jQuery.speed = function( speed, easing, fn ) { 9945 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 9946 complete: fn || !fn && easing || 9947 isFunction( speed ) && speed, 9948 duration: speed, 9949 easing: fn && easing || easing && !isFunction( easing ) && easing 9950 }; 9951 9952 // Go to the end state if fx are off 9953 if ( jQuery.fx.off ) { 9954 opt.duration = 0; 9955 9956 } else { 9957 if ( typeof opt.duration !== "number" ) { 9958 if ( opt.duration in jQuery.fx.speeds ) { 9959 opt.duration = jQuery.fx.speeds[ opt.duration ]; 9960 9961 } else { 9962 opt.duration = jQuery.fx.speeds._default; 9963 } 9964 } 9965 } 9966 9967 // Normalize opt.queue - true/undefined/null -> "fx" 9968 if ( opt.queue == null || opt.queue === true ) { 9969 opt.queue = "fx"; 9970 } 9971 9972 // Queueing 9973 opt.old = opt.complete; 9974 9975 opt.complete = function() { 9976 if ( isFunction( opt.old ) ) { 9977 opt.old.call( this ); 9978 } 9979 9980 if ( opt.queue ) { 9981 jQuery.dequeue( this, opt.queue ); 9982 } 9983 }; 9984 9985 return opt; 9986}; 9987 9988jQuery.fn.extend( { 9989 fadeTo: function( speed, to, easing, callback ) { 9990 9991 // Show any hidden elements after setting opacity to 0 9992 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 9993 9994 // Animate to the value specified 9995 .end().animate( { opacity: to }, speed, easing, callback ); 9996 }, 9997 animate: function( prop, speed, easing, callback ) { 9998 var empty = jQuery.isEmptyObject( prop ), 9999 optall = jQuery.speed( speed, easing, callback ), 10000 doAnimation = function() { 10001 10002 // Operate on a copy of prop so per-property easing won't be lost 10003 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 10004 10005 // Empty animations, or finishing resolves immediately 10006 if ( empty || dataPriv.get( this, "finish" ) ) { 10007 anim.stop( true ); 10008 } 10009 }; 10010 10011 doAnimation.finish = doAnimation; 10012 10013 return empty || optall.queue === false ? 10014 this.each( doAnimation ) : 10015 this.queue( optall.queue, doAnimation ); 10016 }, 10017 stop: function( type, clearQueue, gotoEnd ) { 10018 var stopQueue = function( hooks ) { 10019 var stop = hooks.stop; 10020 delete hooks.stop; 10021 stop( gotoEnd ); 10022 }; 10023 10024 if ( typeof type !== "string" ) { 10025 gotoEnd = clearQueue; 10026 clearQueue = type; 10027 type = undefined; 10028 } 10029 if ( clearQueue ) { 10030 this.queue( type || "fx", [] ); 10031 } 10032 10033 return this.each( function() { 10034 var dequeue = true, 10035 index = type != null && type + "queueHooks", 10036 timers = jQuery.timers, 10037 data = dataPriv.get( this ); 10038 10039 if ( index ) { 10040 if ( data[ index ] && data[ index ].stop ) { 10041 stopQueue( data[ index ] ); 10042 } 10043 } else { 10044 for ( index in data ) { 10045 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 10046 stopQueue( data[ index ] ); 10047 } 10048 } 10049 } 10050 10051 for ( index = timers.length; index--; ) { 10052 if ( timers[ index ].elem === this && 10053 ( type == null || timers[ index ].queue === type ) ) { 10054 10055 timers[ index ].anim.stop( gotoEnd ); 10056 dequeue = false; 10057 timers.splice( index, 1 ); 10058 } 10059 } 10060 10061 // Start the next in the queue if the last step wasn't forced. 10062 // Timers currently will call their complete callbacks, which 10063 // will dequeue but only if they were gotoEnd. 10064 if ( dequeue || !gotoEnd ) { 10065 jQuery.dequeue( this, type ); 10066 } 10067 } ); 10068 }, 10069 finish: function( type ) { 10070 if ( type !== false ) { 10071 type = type || "fx"; 10072 } 10073 return this.each( function() { 10074 var index, 10075 data = dataPriv.get( this ), 10076 queue = data[ type + "queue" ], 10077 hooks = data[ type + "queueHooks" ], 10078 timers = jQuery.timers, 10079 length = queue ? queue.length : 0; 10080 10081 // Enable finishing flag on private data 10082 data.finish = true; 10083 10084 // Empty the queue first 10085 jQuery.queue( this, type, [] ); 10086 10087 if ( hooks && hooks.stop ) { 10088 hooks.stop.call( this, true ); 10089 } 10090 10091 // Look for any active animations, and finish them 10092 for ( index = timers.length; index--; ) { 10093 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 10094 timers[ index ].anim.stop( true ); 10095 timers.splice( index, 1 ); 10096 } 10097 } 10098 10099 // Look for any animations in the old queue and finish them 10100 for ( index = 0; index < length; index++ ) { 10101 if ( queue[ index ] && queue[ index ].finish ) { 10102 queue[ index ].finish.call( this ); 10103 } 10104 } 10105 10106 // Turn off finishing flag 10107 delete data.finish; 10108 } ); 10109 } 10110} ); 10111 10112jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 10113 var cssFn = jQuery.fn[ name ]; 10114 jQuery.fn[ name ] = function( speed, easing, callback ) { 10115 return speed == null || typeof speed === "boolean" ? 10116 cssFn.apply( this, arguments ) : 10117 this.animate( genFx( name, true ), speed, easing, callback ); 10118 }; 10119} ); 10120 10121// Generate shortcuts for custom animations 10122jQuery.each( { 10123 slideDown: genFx( "show" ), 10124 slideUp: genFx( "hide" ), 10125 slideToggle: genFx( "toggle" ), 10126 fadeIn: { opacity: "show" }, 10127 fadeOut: { opacity: "hide" }, 10128 fadeToggle: { opacity: "toggle" } 10129}, function( name, props ) { 10130 jQuery.fn[ name ] = function( speed, easing, callback ) { 10131 return this.animate( props, speed, easing, callback ); 10132 }; 10133} ); 10134 10135jQuery.timers = []; 10136jQuery.fx.tick = function() { 10137 var timer, 10138 i = 0, 10139 timers = jQuery.timers; 10140 10141 fxNow = Date.now(); 10142 10143 for ( ; i < timers.length; i++ ) { 10144 timer = timers[ i ]; 10145 10146 // Run the timer and safely remove it when done (allowing for external removal) 10147 if ( !timer() && timers[ i ] === timer ) { 10148 timers.splice( i--, 1 ); 10149 } 10150 } 10151 10152 if ( !timers.length ) { 10153 jQuery.fx.stop(); 10154 } 10155 fxNow = undefined; 10156}; 10157 10158jQuery.fx.timer = function( timer ) { 10159 jQuery.timers.push( timer ); 10160 jQuery.fx.start(); 10161}; 10162 10163jQuery.fx.interval = 13; 10164jQuery.fx.start = function() { 10165 if ( inProgress ) { 10166 return; 10167 } 10168 10169 inProgress = true; 10170 schedule(); 10171}; 10172 10173jQuery.fx.stop = function() { 10174 inProgress = null; 10175}; 10176 10177jQuery.fx.speeds = { 10178 slow: 600, 10179 fast: 200, 10180 10181 // Default speed 10182 _default: 400 10183}; 10184 10185 10186// Based off of the plugin by Clint Helfers, with permission. 10187jQuery.fn.delay = function( time, type ) { 10188 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 10189 type = type || "fx"; 10190 10191 return this.queue( type, function( next, hooks ) { 10192 var timeout = window.setTimeout( next, time ); 10193 hooks.stop = function() { 10194 window.clearTimeout( timeout ); 10195 }; 10196 } ); 10197}; 10198 10199 10200( function() { 10201 var input = document.createElement( "input" ), 10202 select = document.createElement( "select" ), 10203 opt = select.appendChild( document.createElement( "option" ) ); 10204 10205 input.type = "checkbox"; 10206 10207 // Support: Android <=4.3 only 10208 // Default value for a checkbox should be "on" 10209 support.checkOn = input.value !== ""; 10210 10211 // Support: IE <=11 only 10212 // Must access selectedIndex to make default options select 10213 support.optSelected = opt.selected; 10214 10215 // Support: IE <=11 only 10216 // An input loses its value after becoming a radio 10217 input = document.createElement( "input" ); 10218 input.value = "t"; 10219 input.type = "radio"; 10220 support.radioValue = input.value === "t"; 10221} )(); 10222 10223 10224var boolHook, 10225 attrHandle = jQuery.expr.attrHandle; 10226 10227jQuery.fn.extend( { 10228 attr: function( name, value ) { 10229 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 10230 }, 10231 10232 removeAttr: function( name ) { 10233 return this.each( function() { 10234 jQuery.removeAttr( this, name ); 10235 } ); 10236 } 10237} ); 10238 10239jQuery.extend( { 10240 attr: function( elem, name, value ) { 10241 var ret, hooks, 10242 nType = elem.nodeType; 10243 10244 // Don't get/set attributes on text, comment and attribute nodes 10245 if ( nType === 3 || nType === 8 || nType === 2 ) { 10246 return; 10247 } 10248 10249 // Fallback to prop when attributes are not supported 10250 if ( typeof elem.getAttribute === "undefined" ) { 10251 return jQuery.prop( elem, name, value ); 10252 } 10253 10254 // Attribute hooks are determined by the lowercase version 10255 // Grab necessary hook if one is defined 10256 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 10257 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 10258 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 10259 } 10260 10261 if ( value !== undefined ) { 10262 if ( value === null ) { 10263 jQuery.removeAttr( elem, name ); 10264 return; 10265 } 10266 10267 if ( hooks && "set" in hooks && 10268 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 10269 return ret; 10270 } 10271 10272 elem.setAttribute( name, value + "" ); 10273 return value; 10274 } 10275 10276 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 10277 return ret; 10278 } 10279 10280 ret = jQuery.find.attr( elem, name ); 10281 10282 // Non-existent attributes return null, we normalize to undefined 10283 return ret == null ? undefined : ret; 10284 }, 10285 10286 attrHooks: { 10287 type: { 10288 set: function( elem, value ) { 10289 if ( !support.radioValue && value === "radio" && 10290 nodeName( elem, "input" ) ) { 10291 var val = elem.value; 10292 elem.setAttribute( "type", value ); 10293 if ( val ) { 10294 elem.value = val; 10295 } 10296 return value; 10297 } 10298 } 10299 } 10300 }, 10301 10302 removeAttr: function( elem, value ) { 10303 var name, 10304 i = 0, 10305 10306 // Attribute names can contain non-HTML whitespace characters 10307 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 10308 attrNames = value && value.match( rnothtmlwhite ); 10309 10310 if ( attrNames && elem.nodeType === 1 ) { 10311 while ( ( name = attrNames[ i++ ] ) ) { 10312 elem.removeAttribute( name ); 10313 } 10314 } 10315 } 10316} ); 10317 10318// Hooks for boolean attributes 10319boolHook = { 10320 set: function( elem, value, name ) { 10321 if ( value === false ) { 10322 10323 // Remove boolean attributes when set to false 10324 jQuery.removeAttr( elem, name ); 10325 } else { 10326 elem.setAttribute( name, name ); 10327 } 10328 return name; 10329 } 10330}; 10331 10332jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 10333 var getter = attrHandle[ name ] || jQuery.find.attr; 10334 10335 attrHandle[ name ] = function( elem, name, isXML ) { 10336 var ret, handle, 10337 lowercaseName = name.toLowerCase(); 10338 10339 if ( !isXML ) { 10340 10341 // Avoid an infinite loop by temporarily removing this function from the getter 10342 handle = attrHandle[ lowercaseName ]; 10343 attrHandle[ lowercaseName ] = ret; 10344 ret = getter( elem, name, isXML ) != null ? 10345 lowercaseName : 10346 null; 10347 attrHandle[ lowercaseName ] = handle; 10348 } 10349 return ret; 10350 }; 10351} ); 10352 10353 10354 10355 10356var rfocusable = /^(?:input|select|textarea|button)$/i, 10357 rclickable = /^(?:a|area)$/i; 10358 10359jQuery.fn.extend( { 10360 prop: function( name, value ) { 10361 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 10362 }, 10363 10364 removeProp: function( name ) { 10365 return this.each( function() { 10366 delete this[ jQuery.propFix[ name ] || name ]; 10367 } ); 10368 } 10369} ); 10370 10371jQuery.extend( { 10372 prop: function( elem, name, value ) { 10373 var ret, hooks, 10374 nType = elem.nodeType; 10375 10376 // Don't get/set properties on text, comment and attribute nodes 10377 if ( nType === 3 || nType === 8 || nType === 2 ) { 10378 return; 10379 } 10380 10381 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 10382 10383 // Fix name and attach hooks 10384 name = jQuery.propFix[ name ] || name; 10385 hooks = jQuery.propHooks[ name ]; 10386 } 10387 10388 if ( value !== undefined ) { 10389 if ( hooks && "set" in hooks && 10390 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 10391 return ret; 10392 } 10393 10394 return ( elem[ name ] = value ); 10395 } 10396 10397 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 10398 return ret; 10399 } 10400 10401 return elem[ name ]; 10402 }, 10403 10404 propHooks: { 10405 tabIndex: { 10406 get: function( elem ) { 10407 10408 // Support: IE <=9 - 11 only 10409 // elem.tabIndex doesn't always return the 10410 // correct value when it hasn't been explicitly set 10411 // Use proper attribute retrieval (trac-12072) 10412 var tabindex = jQuery.find.attr( elem, "tabindex" ); 10413 10414 if ( tabindex ) { 10415 return parseInt( tabindex, 10 ); 10416 } 10417 10418 if ( 10419 rfocusable.test( elem.nodeName ) || 10420 rclickable.test( elem.nodeName ) && 10421 elem.href 10422 ) { 10423 return 0; 10424 } 10425 10426 return -1; 10427 } 10428 } 10429 }, 10430 10431 propFix: { 10432 "for": "htmlFor", 10433 "class": "className" 10434 } 10435} ); 10436 10437// Support: IE <=11 only 10438// Accessing the selectedIndex property 10439// forces the browser to respect setting selected 10440// on the option 10441// The getter ensures a default option is selected 10442// when in an optgroup 10443// eslint rule "no-unused-expressions" is disabled for this code 10444// since it considers such accessions noop 10445if ( !support.optSelected ) { 10446 jQuery.propHooks.selected = { 10447 get: function( elem ) { 10448 10449 /* eslint no-unused-expressions: "off" */ 10450 10451 var parent = elem.parentNode; 10452 if ( parent && parent.parentNode ) { 10453 parent.parentNode.selectedIndex; 10454 } 10455 return null; 10456 }, 10457 set: function( elem ) { 10458 10459 /* eslint no-unused-expressions: "off" */ 10460 10461 var parent = elem.parentNode; 10462 if ( parent ) { 10463 parent.selectedIndex; 10464 10465 if ( parent.parentNode ) { 10466 parent.parentNode.selectedIndex; 10467 } 10468 } 10469 } 10470 }; 10471} 10472 10473jQuery.each( [ 10474 "tabIndex", 10475 "readOnly", 10476 "maxLength", 10477 "cellSpacing", 10478 "cellPadding", 10479 "rowSpan", 10480 "colSpan", 10481 "useMap", 10482 "frameBorder", 10483 "contentEditable" 10484], function() { 10485 jQuery.propFix[ this.toLowerCase() ] = this; 10486} ); 10487 10488 10489 10490 10491 // Strip and collapse whitespace according to HTML spec 10492 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 10493 function stripAndCollapse( value ) { 10494 var tokens = value.match( rnothtmlwhite ) || []; 10495 return tokens.join( " " ); 10496 } 10497 10498 10499function getClass( elem ) { 10500 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 10501} 10502 10503function classesToArray( value ) { 10504 if ( Array.isArray( value ) ) { 10505 return value; 10506 } 10507 if ( typeof value === "string" ) { 10508 return value.match( rnothtmlwhite ) || []; 10509 } 10510 return []; 10511} 10512 10513jQuery.fn.extend( { 10514 addClass: function( value ) { 10515 var classNames, cur, curValue, className, i, finalValue; 10516 10517 if ( isFunction( value ) ) { 10518 return this.each( function( j ) { 10519 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 10520 } ); 10521 } 10522 10523 classNames = classesToArray( value ); 10524 10525 if ( classNames.length ) { 10526 return this.each( function() { 10527 curValue = getClass( this ); 10528 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 10529 10530 if ( cur ) { 10531 for ( i = 0; i < classNames.length; i++ ) { 10532 className = classNames[ i ]; 10533 if ( cur.indexOf( " " + className + " " ) < 0 ) { 10534 cur += className + " "; 10535 } 10536 } 10537 10538 // Only assign if different to avoid unneeded rendering. 10539 finalValue = stripAndCollapse( cur ); 10540 if ( curValue !== finalValue ) { 10541 this.setAttribute( "class", finalValue ); 10542 } 10543 } 10544 } ); 10545 } 10546 10547 return this; 10548 }, 10549 10550 removeClass: function( value ) { 10551 var classNames, cur, curValue, className, i, finalValue; 10552 10553 if ( isFunction( value ) ) { 10554 return this.each( function( j ) { 10555 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 10556 } ); 10557 } 10558 10559 if ( !arguments.length ) { 10560 return this.attr( "class", "" ); 10561 } 10562 10563 classNames = classesToArray( value ); 10564 10565 if ( classNames.length ) { 10566 return this.each( function() { 10567 curValue = getClass( this ); 10568 10569 // This expression is here for better compressibility (see addClass) 10570 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 10571 10572 if ( cur ) { 10573 for ( i = 0; i < classNames.length; i++ ) { 10574 className = classNames[ i ]; 10575 10576 // Remove *all* instances 10577 while ( cur.indexOf( " " + className + " " ) > -1 ) { 10578 cur = cur.replace( " " + className + " ", " " ); 10579 } 10580 } 10581 10582 // Only assign if different to avoid unneeded rendering. 10583 finalValue = stripAndCollapse( cur ); 10584 if ( curValue !== finalValue ) { 10585 this.setAttribute( "class", finalValue ); 10586 } 10587 } 10588 } ); 10589 } 10590 10591 return this; 10592 }, 10593 10594 toggleClass: function( value, stateVal ) { 10595 var classNames, className, i, self, 10596 type = typeof value, 10597 isValidValue = type === "string" || Array.isArray( value ); 10598 10599 if ( isFunction( value ) ) { 10600 return this.each( function( i ) { 10601 jQuery( this ).toggleClass( 10602 value.call( this, i, getClass( this ), stateVal ), 10603 stateVal 10604 ); 10605 } ); 10606 } 10607 10608 if ( typeof stateVal === "boolean" && isValidValue ) { 10609 return stateVal ? this.addClass( value ) : this.removeClass( value ); 10610 } 10611 10612 classNames = classesToArray( value ); 10613 10614 return this.each( function() { 10615 if ( isValidValue ) { 10616 10617 // Toggle individual class names 10618 self = jQuery( this ); 10619 10620 for ( i = 0; i < classNames.length; i++ ) { 10621 className = classNames[ i ]; 10622 10623 // Check each className given, space separated list 10624 if ( self.hasClass( className ) ) { 10625 self.removeClass( className ); 10626 } else { 10627 self.addClass( className ); 10628 } 10629 } 10630 10631 // Toggle whole class name 10632 } else if ( value === undefined || type === "boolean" ) { 10633 className = getClass( this ); 10634 if ( className ) { 10635 10636 // Store className if set 10637 dataPriv.set( this, "__className__", className ); 10638 } 10639 10640 // If the element has a class name or if we're passed `false`, 10641 // then remove the whole classname (if there was one, the above saved it). 10642 // Otherwise bring back whatever was previously saved (if anything), 10643 // falling back to the empty string if nothing was stored. 10644 if ( this.setAttribute ) { 10645 this.setAttribute( "class", 10646 className || value === false ? 10647 "" : 10648 dataPriv.get( this, "__className__" ) || "" 10649 ); 10650 } 10651 } 10652 } ); 10653 }, 10654 10655 hasClass: function( selector ) { 10656 var className, elem, 10657 i = 0; 10658 10659 className = " " + selector + " "; 10660 while ( ( elem = this[ i++ ] ) ) { 10661 if ( elem.nodeType === 1 && 10662 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 10663 return true; 10664 } 10665 } 10666 10667 return false; 10668 } 10669} ); 10670 10671 10672 10673 10674var rreturn = /\r/g; 10675 10676jQuery.fn.extend( { 10677 val: function( value ) { 10678 var hooks, ret, valueIsFunction, 10679 elem = this[ 0 ]; 10680 10681 if ( !arguments.length ) { 10682 if ( elem ) { 10683 hooks = jQuery.valHooks[ elem.type ] || 10684 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 10685 10686 if ( hooks && 10687 "get" in hooks && 10688 ( ret = hooks.get( elem, "value" ) ) !== undefined 10689 ) { 10690 return ret; 10691 } 10692 10693 ret = elem.value; 10694 10695 // Handle most common string cases 10696 if ( typeof ret === "string" ) { 10697 return ret.replace( rreturn, "" ); 10698 } 10699 10700 // Handle cases where value is null/undef or number 10701 return ret == null ? "" : ret; 10702 } 10703 10704 return; 10705 } 10706 10707 valueIsFunction = isFunction( value ); 10708 10709 return this.each( function( i ) { 10710 var val; 10711 10712 if ( this.nodeType !== 1 ) { 10713 return; 10714 } 10715 10716 if ( valueIsFunction ) { 10717 val = value.call( this, i, jQuery( this ).val() ); 10718 } else { 10719 val = value; 10720 } 10721 10722 // Treat null/undefined as ""; convert numbers to string 10723 if ( val == null ) { 10724 val = ""; 10725 10726 } else if ( typeof val === "number" ) { 10727 val += ""; 10728 10729 } else if ( Array.isArray( val ) ) { 10730 val = jQuery.map( val, function( value ) { 10731 return value == null ? "" : value + ""; 10732 } ); 10733 } 10734 10735 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 10736 10737 // If set returns undefined, fall back to normal setting 10738 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 10739 this.value = val; 10740 } 10741 } ); 10742 } 10743} ); 10744 10745jQuery.extend( { 10746 valHooks: { 10747 option: { 10748 get: function( elem ) { 10749 10750 var val = jQuery.find.attr( elem, "value" ); 10751 return val != null ? 10752 val : 10753 10754 // Support: IE <=10 - 11 only 10755 // option.text throws exceptions (trac-14686, trac-14858) 10756 // Strip and collapse whitespace 10757 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 10758 stripAndCollapse( jQuery.text( elem ) ); 10759 } 10760 }, 10761 select: { 10762 get: function( elem ) { 10763 var value, option, i, 10764 options = elem.options, 10765 index = elem.selectedIndex, 10766 one = elem.type === "select-one", 10767 values = one ? null : [], 10768 max = one ? index + 1 : options.length; 10769 10770 if ( index < 0 ) { 10771 i = max; 10772 10773 } else { 10774 i = one ? index : 0; 10775 } 10776 10777 // Loop through all the selected options 10778 for ( ; i < max; i++ ) { 10779 option = options[ i ]; 10780 10781 // Support: IE <=9 only 10782 // IE8-9 doesn't update selected after form reset (trac-2551) 10783 if ( ( option.selected || i === index ) && 10784 10785 // Don't return options that are disabled or in a disabled optgroup 10786 !option.disabled && 10787 ( !option.parentNode.disabled || 10788 !nodeName( option.parentNode, "optgroup" ) ) ) { 10789 10790 // Get the specific value for the option 10791 value = jQuery( option ).val(); 10792 10793 // We don't need an array for one selects 10794 if ( one ) { 10795 return value; 10796 } 10797 10798 // Multi-Selects return an array 10799 values.push( value ); 10800 } 10801 } 10802 10803 return values; 10804 }, 10805 10806 set: function( elem, value ) { 10807 var optionSet, option, 10808 options = elem.options, 10809 values = jQuery.makeArray( value ), 10810 i = options.length; 10811 10812 while ( i-- ) { 10813 option = options[ i ]; 10814 10815 /* eslint-disable no-cond-assign */ 10816 10817 if ( option.selected = 10818 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 10819 ) { 10820 optionSet = true; 10821 } 10822 10823 /* eslint-enable no-cond-assign */ 10824 } 10825 10826 // Force browsers to behave consistently when non-matching value is set 10827 if ( !optionSet ) { 10828 elem.selectedIndex = -1; 10829 } 10830 return values; 10831 } 10832 } 10833 } 10834} ); 10835 10836// Radios and checkboxes getter/setter 10837jQuery.each( [ "radio", "checkbox" ], function() { 10838 jQuery.valHooks[ this ] = { 10839 set: function( elem, value ) { 10840 if ( Array.isArray( value ) ) { 10841 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 10842 } 10843 } 10844 }; 10845 if ( !support.checkOn ) { 10846 jQuery.valHooks[ this ].get = function( elem ) { 10847 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 10848 }; 10849 } 10850} ); 10851 10852 10853 10854 10855// Return jQuery for attributes-only inclusion 10856 10857 10858support.focusin = "onfocusin" in window; 10859 10860 10861var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 10862 stopPropagationCallback = function( e ) { 10863 e.stopPropagation(); 10864 }; 10865 10866jQuery.extend( jQuery.event, { 10867 10868 trigger: function( event, data, elem, onlyHandlers ) { 10869 10870 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 10871 eventPath = [ elem || document ], 10872 type = hasOwn.call( event, "type" ) ? event.type : event, 10873 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 10874 10875 cur = lastElement = tmp = elem = elem || document; 10876 10877 // Don't do events on text and comment nodes 10878 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 10879 return; 10880 } 10881 10882 // focus/blur morphs to focusin/out; ensure we're not firing them right now 10883 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 10884 return; 10885 } 10886 10887 if ( type.indexOf( "." ) > -1 ) { 10888 10889 // Namespaced trigger; create a regexp to match event type in handle() 10890 namespaces = type.split( "." ); 10891 type = namespaces.shift(); 10892 namespaces.sort(); 10893 } 10894 ontype = type.indexOf( ":" ) < 0 && "on" + type; 10895 10896 // Caller can pass in a jQuery.Event object, Object, or just an event type string 10897 event = event[ jQuery.expando ] ? 10898 event : 10899 new jQuery.Event( type, typeof event === "object" && event ); 10900 10901 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 10902 event.isTrigger = onlyHandlers ? 2 : 3; 10903 event.namespace = namespaces.join( "." ); 10904 event.rnamespace = event.namespace ? 10905 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 10906 null; 10907 10908 // Clean up the event in case it is being reused 10909 event.result = undefined; 10910 if ( !event.target ) { 10911 event.target = elem; 10912 } 10913 10914 // Clone any incoming data and prepend the event, creating the handler arg list 10915 data = data == null ? 10916 [ event ] : 10917 jQuery.makeArray( data, [ event ] ); 10918 10919 // Allow special events to draw outside the lines 10920 special = jQuery.event.special[ type ] || {}; 10921 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 10922 return; 10923 } 10924 10925 // Determine event propagation path in advance, per W3C events spec (trac-9951) 10926 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 10927 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 10928 10929 bubbleType = special.delegateType || type; 10930 if ( !rfocusMorph.test( bubbleType + type ) ) { 10931 cur = cur.parentNode; 10932 } 10933 for ( ; cur; cur = cur.parentNode ) { 10934 eventPath.push( cur ); 10935 tmp = cur; 10936 } 10937 10938 // Only add window if we got to document (e.g., not plain obj or detached DOM) 10939 if ( tmp === ( elem.ownerDocument || document ) ) { 10940 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 10941 } 10942 } 10943 10944 // Fire handlers on the event path 10945 i = 0; 10946 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 10947 lastElement = cur; 10948 event.type = i > 1 ? 10949 bubbleType : 10950 special.bindType || type; 10951 10952 // jQuery handler 10953 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 10954 dataPriv.get( cur, "handle" ); 10955 if ( handle ) { 10956 handle.apply( cur, data ); 10957 } 10958 10959 // Native handler 10960 handle = ontype && cur[ ontype ]; 10961 if ( handle && handle.apply && acceptData( cur ) ) { 10962 event.result = handle.apply( cur, data ); 10963 if ( event.result === false ) { 10964 event.preventDefault(); 10965 } 10966 } 10967 } 10968 event.type = type; 10969 10970 // If nobody prevented the default action, do it now 10971 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 10972 10973 if ( ( !special._default || 10974 special._default.apply( eventPath.pop(), data ) === false ) && 10975 acceptData( elem ) ) { 10976 10977 // Call a native DOM method on the target with the same name as the event. 10978 // Don't do default actions on window, that's where global variables be (trac-6170) 10979 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 10980 10981 // Don't re-trigger an onFOO event when we call its FOO() method 10982 tmp = elem[ ontype ]; 10983 10984 if ( tmp ) { 10985 elem[ ontype ] = null; 10986 } 10987 10988 // Prevent re-triggering of the same event, since we already bubbled it above 10989 jQuery.event.triggered = type; 10990 10991 if ( event.isPropagationStopped() ) { 10992 lastElement.addEventListener( type, stopPropagationCallback ); 10993 } 10994 10995 elem[ type ](); 10996 10997 if ( event.isPropagationStopped() ) { 10998 lastElement.removeEventListener( type, stopPropagationCallback ); 10999 } 11000 11001 jQuery.event.triggered = undefined; 11002 11003 if ( tmp ) { 11004 elem[ ontype ] = tmp; 11005 } 11006 } 11007 } 11008 } 11009 11010 return event.result; 11011 }, 11012 11013 // Piggyback on a donor event to simulate a different one 11014 // Used only for `focus(in | out)` events 11015 simulate: function( type, elem, event ) { 11016 var e = jQuery.extend( 11017 new jQuery.Event(), 11018 event, 11019 { 11020 type: type, 11021 isSimulated: true 11022 } 11023 ); 11024 11025 jQuery.event.trigger( e, null, elem ); 11026 } 11027 11028} ); 11029 11030jQuery.fn.extend( { 11031 11032 trigger: function( type, data ) { 11033 return this.each( function() { 11034 jQuery.event.trigger( type, data, this ); 11035 } ); 11036 }, 11037 triggerHandler: function( type, data ) { 11038 var elem = this[ 0 ]; 11039 if ( elem ) { 11040 return jQuery.event.trigger( type, data, elem, true ); 11041 } 11042 } 11043} ); 11044 11045 11046// Support: Firefox <=44 11047// Firefox doesn't have focus(in | out) events 11048// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 11049// 11050// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 11051// focus(in | out) events fire after focus & blur events, 11052// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 11053// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 11054if ( !support.focusin ) { 11055 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 11056 11057 // Attach a single capturing handler on the document while someone wants focusin/focusout 11058 var handler = function( event ) { 11059 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 11060 }; 11061 11062 jQuery.event.special[ fix ] = { 11063 setup: function() { 11064 11065 // Handle: regular nodes (via `this.ownerDocument`), window 11066 // (via `this.document`) & document (via `this`). 11067 var doc = this.ownerDocument || this.document || this, 11068 attaches = dataPriv.access( doc, fix ); 11069 11070 if ( !attaches ) { 11071 doc.addEventListener( orig, handler, true ); 11072 } 11073 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 11074 }, 11075 teardown: function() { 11076 var doc = this.ownerDocument || this.document || this, 11077 attaches = dataPriv.access( doc, fix ) - 1; 11078 11079 if ( !attaches ) { 11080 doc.removeEventListener( orig, handler, true ); 11081 dataPriv.remove( doc, fix ); 11082 11083 } else { 11084 dataPriv.access( doc, fix, attaches ); 11085 } 11086 } 11087 }; 11088 } ); 11089} 11090var location = window.location; 11091 11092var nonce = { guid: Date.now() }; 11093 11094var rquery = ( /\?/ ); 11095 11096 11097 11098// Cross-browser xml parsing 11099jQuery.parseXML = function( data ) { 11100 var xml, parserErrorElem; 11101 if ( !data || typeof data !== "string" ) { 11102 return null; 11103 } 11104 11105 // Support: IE 9 - 11 only 11106 // IE throws on parseFromString with invalid input. 11107 try { 11108 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 11109 } catch ( e ) {} 11110 11111 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 11112 if ( !xml || parserErrorElem ) { 11113 jQuery.error( "Invalid XML: " + ( 11114 parserErrorElem ? 11115 jQuery.map( parserErrorElem.childNodes, function( el ) { 11116 return el.textContent; 11117 } ).join( "\n" ) : 11118 data 11119 ) ); 11120 } 11121 return xml; 11122}; 11123 11124 11125var 11126 rbracket = /\[\]$/, 11127 rCRLF = /\r?\n/g, 11128 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 11129 rsubmittable = /^(?:input|select|textarea|keygen)/i; 11130 11131function buildParams( prefix, obj, traditional, add ) { 11132 var name; 11133 11134 if ( Array.isArray( obj ) ) { 11135 11136 // Serialize array item. 11137 jQuery.each( obj, function( i, v ) { 11138 if ( traditional || rbracket.test( prefix ) ) { 11139 11140 // Treat each array item as a scalar. 11141 add( prefix, v ); 11142 11143 } else { 11144 11145 // Item is non-scalar (array or object), encode its numeric index. 11146 buildParams( 11147 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 11148 v, 11149 traditional, 11150 add 11151 ); 11152 } 11153 } ); 11154 11155 } else if ( !traditional && toType( obj ) === "object" ) { 11156 11157 // Serialize object item. 11158 for ( name in obj ) { 11159 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 11160 } 11161 11162 } else { 11163 11164 // Serialize scalar item. 11165 add( prefix, obj ); 11166 } 11167} 11168 11169// Serialize an array of form elements or a set of 11170// key/values into a query string 11171jQuery.param = function( a, traditional ) { 11172 var prefix, 11173 s = [], 11174 add = function( key, valueOrFunction ) { 11175 11176 // If value is a function, invoke it and use its return value 11177 var value = isFunction( valueOrFunction ) ? 11178 valueOrFunction() : 11179 valueOrFunction; 11180 11181 s[ s.length ] = encodeURIComponent( key ) + "=" + 11182 encodeURIComponent( value == null ? "" : value ); 11183 }; 11184 11185 if ( a == null ) { 11186 return ""; 11187 } 11188 11189 // If an array was passed in, assume that it is an array of form elements. 11190 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 11191 11192 // Serialize the form elements 11193 jQuery.each( a, function() { 11194 add( this.name, this.value ); 11195 } ); 11196 11197 } else { 11198 11199 // If traditional, encode the "old" way (the way 1.3.2 or older 11200 // did it), otherwise encode params recursively. 11201 for ( prefix in a ) { 11202 buildParams( prefix, a[ prefix ], traditional, add ); 11203 } 11204 } 11205 11206 // Return the resulting serialization 11207 return s.join( "&" ); 11208}; 11209 11210jQuery.fn.extend( { 11211 serialize: function() { 11212 return jQuery.param( this.serializeArray() ); 11213 }, 11214 serializeArray: function() { 11215 return this.map( function() { 11216 11217 // Can add propHook for "elements" to filter or add form elements 11218 var elements = jQuery.prop( this, "elements" ); 11219 return elements ? jQuery.makeArray( elements ) : this; 11220 } ).filter( function() { 11221 var type = this.type; 11222 11223 // Use .is( ":disabled" ) so that fieldset[disabled] works 11224 return this.name && !jQuery( this ).is( ":disabled" ) && 11225 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 11226 ( this.checked || !rcheckableType.test( type ) ); 11227 } ).map( function( _i, elem ) { 11228 var val = jQuery( this ).val(); 11229 11230 if ( val == null ) { 11231 return null; 11232 } 11233 11234 if ( Array.isArray( val ) ) { 11235 return jQuery.map( val, function( val ) { 11236 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 11237 } ); 11238 } 11239 11240 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 11241 } ).get(); 11242 } 11243} ); 11244 11245 11246var 11247 r20 = /%20/g, 11248 rhash = /#.*$/, 11249 rantiCache = /([?&])_=[^&]*/, 11250 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 11251 11252 // trac-7653, trac-8125, trac-8152: local protocol detection 11253 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 11254 rnoContent = /^(?:GET|HEAD)$/, 11255 rprotocol = /^\/\//, 11256 11257 /* Prefilters 11258 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 11259 * 2) These are called: 11260 * - BEFORE asking for a transport 11261 * - AFTER param serialization (s.data is a string if s.processData is true) 11262 * 3) key is the dataType 11263 * 4) the catchall symbol "*" can be used 11264 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 11265 */ 11266 prefilters = {}, 11267 11268 /* Transports bindings 11269 * 1) key is the dataType 11270 * 2) the catchall symbol "*" can be used 11271 * 3) selection will start with transport dataType and THEN go to "*" if needed 11272 */ 11273 transports = {}, 11274 11275 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 11276 allTypes = "*/".concat( "*" ), 11277 11278 // Anchor tag for parsing the document origin 11279 originAnchor = document.createElement( "a" ); 11280 11281originAnchor.href = location.href; 11282 11283// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 11284function addToPrefiltersOrTransports( structure ) { 11285 11286 // dataTypeExpression is optional and defaults to "*" 11287 return function( dataTypeExpression, func ) { 11288 11289 if ( typeof dataTypeExpression !== "string" ) { 11290 func = dataTypeExpression; 11291 dataTypeExpression = "*"; 11292 } 11293 11294 var dataType, 11295 i = 0, 11296 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 11297 11298 if ( isFunction( func ) ) { 11299 11300 // For each dataType in the dataTypeExpression 11301 while ( ( dataType = dataTypes[ i++ ] ) ) { 11302 11303 // Prepend if requested 11304 if ( dataType[ 0 ] === "+" ) { 11305 dataType = dataType.slice( 1 ) || "*"; 11306 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 11307 11308 // Otherwise append 11309 } else { 11310 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 11311 } 11312 } 11313 } 11314 }; 11315} 11316 11317// Base inspection function for prefilters and transports 11318function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 11319 11320 var inspected = {}, 11321 seekingTransport = ( structure === transports ); 11322 11323 function inspect( dataType ) { 11324 var selected; 11325 inspected[ dataType ] = true; 11326 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 11327 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 11328 if ( typeof dataTypeOrTransport === "string" && 11329 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 11330 11331 options.dataTypes.unshift( dataTypeOrTransport ); 11332 inspect( dataTypeOrTransport ); 11333 return false; 11334 } else if ( seekingTransport ) { 11335 return !( selected = dataTypeOrTransport ); 11336 } 11337 } ); 11338 return selected; 11339 } 11340 11341 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 11342} 11343 11344// A special extend for ajax options 11345// that takes "flat" options (not to be deep extended) 11346// Fixes trac-9887 11347function ajaxExtend( target, src ) { 11348 var key, deep, 11349 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 11350 11351 for ( key in src ) { 11352 if ( src[ key ] !== undefined ) { 11353 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 11354 } 11355 } 11356 if ( deep ) { 11357 jQuery.extend( true, target, deep ); 11358 } 11359 11360 return target; 11361} 11362 11363/* Handles responses to an ajax request: 11364 * - finds the right dataType (mediates between content-type and expected dataType) 11365 * - returns the corresponding response 11366 */ 11367function ajaxHandleResponses( s, jqXHR, responses ) { 11368 11369 var ct, type, finalDataType, firstDataType, 11370 contents = s.contents, 11371 dataTypes = s.dataTypes; 11372 11373 // Remove auto dataType and get content-type in the process 11374 while ( dataTypes[ 0 ] === "*" ) { 11375 dataTypes.shift(); 11376 if ( ct === undefined ) { 11377 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 11378 } 11379 } 11380 11381 // Check if we're dealing with a known content-type 11382 if ( ct ) { 11383 for ( type in contents ) { 11384 if ( contents[ type ] && contents[ type ].test( ct ) ) { 11385 dataTypes.unshift( type ); 11386 break; 11387 } 11388 } 11389 } 11390 11391 // Check to see if we have a response for the expected dataType 11392 if ( dataTypes[ 0 ] in responses ) { 11393 finalDataType = dataTypes[ 0 ]; 11394 } else { 11395 11396 // Try convertible dataTypes 11397 for ( type in responses ) { 11398 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 11399 finalDataType = type; 11400 break; 11401 } 11402 if ( !firstDataType ) { 11403 firstDataType = type; 11404 } 11405 } 11406 11407 // Or just use first one 11408 finalDataType = finalDataType || firstDataType; 11409 } 11410 11411 // If we found a dataType 11412 // We add the dataType to the list if needed 11413 // and return the corresponding response 11414 if ( finalDataType ) { 11415 if ( finalDataType !== dataTypes[ 0 ] ) { 11416 dataTypes.unshift( finalDataType ); 11417 } 11418 return responses[ finalDataType ]; 11419 } 11420} 11421 11422/* Chain conversions given the request and the original response 11423 * Also sets the responseXXX fields on the jqXHR instance 11424 */ 11425function ajaxConvert( s, response, jqXHR, isSuccess ) { 11426 var conv2, current, conv, tmp, prev, 11427 converters = {}, 11428 11429 // Work with a copy of dataTypes in case we need to modify it for conversion 11430 dataTypes = s.dataTypes.slice(); 11431 11432 // Create converters map with lowercased keys 11433 if ( dataTypes[ 1 ] ) { 11434 for ( conv in s.converters ) { 11435 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 11436 } 11437 } 11438 11439 current = dataTypes.shift(); 11440 11441 // Convert to each sequential dataType 11442 while ( current ) { 11443 11444 if ( s.responseFields[ current ] ) { 11445 jqXHR[ s.responseFields[ current ] ] = response; 11446 } 11447 11448 // Apply the dataFilter if provided 11449 if ( !prev && isSuccess && s.dataFilter ) { 11450 response = s.dataFilter( response, s.dataType ); 11451 } 11452 11453 prev = current; 11454 current = dataTypes.shift(); 11455 11456 if ( current ) { 11457 11458 // There's only work to do if current dataType is non-auto 11459 if ( current === "*" ) { 11460 11461 current = prev; 11462 11463 // Convert response if prev dataType is non-auto and differs from current 11464 } else if ( prev !== "*" && prev !== current ) { 11465 11466 // Seek a direct converter 11467 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 11468 11469 // If none found, seek a pair 11470 if ( !conv ) { 11471 for ( conv2 in converters ) { 11472 11473 // If conv2 outputs current 11474 tmp = conv2.split( " " ); 11475 if ( tmp[ 1 ] === current ) { 11476 11477 // If prev can be converted to accepted input 11478 conv = converters[ prev + " " + tmp[ 0 ] ] || 11479 converters[ "* " + tmp[ 0 ] ]; 11480 if ( conv ) { 11481 11482 // Condense equivalence converters 11483 if ( conv === true ) { 11484 conv = converters[ conv2 ]; 11485 11486 // Otherwise, insert the intermediate dataType 11487 } else if ( converters[ conv2 ] !== true ) { 11488 current = tmp[ 0 ]; 11489 dataTypes.unshift( tmp[ 1 ] ); 11490 } 11491 break; 11492 } 11493 } 11494 } 11495 } 11496 11497 // Apply converter (if not an equivalence) 11498 if ( conv !== true ) { 11499 11500 // Unless errors are allowed to bubble, catch and return them 11501 if ( conv && s.throws ) { 11502 response = conv( response ); 11503 } else { 11504 try { 11505 response = conv( response ); 11506 } catch ( e ) { 11507 return { 11508 state: "parsererror", 11509 error: conv ? e : "No conversion from " + prev + " to " + current 11510 }; 11511 } 11512 } 11513 } 11514 } 11515 } 11516 } 11517 11518 return { state: "success", data: response }; 11519} 11520 11521jQuery.extend( { 11522 11523 // Counter for holding the number of active queries 11524 active: 0, 11525 11526 // Last-Modified header cache for next request 11527 lastModified: {}, 11528 etag: {}, 11529 11530 ajaxSettings: { 11531 url: location.href, 11532 type: "GET", 11533 isLocal: rlocalProtocol.test( location.protocol ), 11534 global: true, 11535 processData: true, 11536 async: true, 11537 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 11538 11539 /* 11540 timeout: 0, 11541 data: null, 11542 dataType: null, 11543 username: null, 11544 password: null, 11545 cache: null, 11546 throws: false, 11547 traditional: false, 11548 headers: {}, 11549 */ 11550 11551 accepts: { 11552 "*": allTypes, 11553 text: "text/plain", 11554 html: "text/html", 11555 xml: "application/xml, text/xml", 11556 json: "application/json, text/javascript" 11557 }, 11558 11559 contents: { 11560 xml: /\bxml\b/, 11561 html: /\bhtml/, 11562 json: /\bjson\b/ 11563 }, 11564 11565 responseFields: { 11566 xml: "responseXML", 11567 text: "responseText", 11568 json: "responseJSON" 11569 }, 11570 11571 // Data converters 11572 // Keys separate source (or catchall "*") and destination types with a single space 11573 converters: { 11574 11575 // Convert anything to text 11576 "* text": String, 11577 11578 // Text to html (true = no transformation) 11579 "text html": true, 11580 11581 // Evaluate text as a json expression 11582 "text json": JSON.parse, 11583 11584 // Parse text as xml 11585 "text xml": jQuery.parseXML 11586 }, 11587 11588 // For options that shouldn't be deep extended: 11589 // you can add your own custom options here if 11590 // and when you create one that shouldn't be 11591 // deep extended (see ajaxExtend) 11592 flatOptions: { 11593 url: true, 11594 context: true 11595 } 11596 }, 11597 11598 // Creates a full fledged settings object into target 11599 // with both ajaxSettings and settings fields. 11600 // If target is omitted, writes into ajaxSettings. 11601 ajaxSetup: function( target, settings ) { 11602 return settings ? 11603 11604 // Building a settings object 11605 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 11606 11607 // Extending ajaxSettings 11608 ajaxExtend( jQuery.ajaxSettings, target ); 11609 }, 11610 11611 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 11612 ajaxTransport: addToPrefiltersOrTransports( transports ), 11613 11614 // Main method 11615 ajax: function( url, options ) { 11616 11617 // If url is an object, simulate pre-1.5 signature 11618 if ( typeof url === "object" ) { 11619 options = url; 11620 url = undefined; 11621 } 11622 11623 // Force options to be an object 11624 options = options || {}; 11625 11626 var transport, 11627 11628 // URL without anti-cache param 11629 cacheURL, 11630 11631 // Response headers 11632 responseHeadersString, 11633 responseHeaders, 11634 11635 // timeout handle 11636 timeoutTimer, 11637 11638 // Url cleanup var 11639 urlAnchor, 11640 11641 // Request state (becomes false upon send and true upon completion) 11642 completed, 11643 11644 // To know if global events are to be dispatched 11645 fireGlobals, 11646 11647 // Loop variable 11648 i, 11649 11650 // uncached part of the url 11651 uncached, 11652 11653 // Create the final options object 11654 s = jQuery.ajaxSetup( {}, options ), 11655 11656 // Callbacks context 11657 callbackContext = s.context || s, 11658 11659 // Context for global events is callbackContext if it is a DOM node or jQuery collection 11660 globalEventContext = s.context && 11661 ( callbackContext.nodeType || callbackContext.jquery ) ? 11662 jQuery( callbackContext ) : 11663 jQuery.event, 11664 11665 // Deferreds 11666 deferred = jQuery.Deferred(), 11667 completeDeferred = jQuery.Callbacks( "once memory" ), 11668 11669 // Status-dependent callbacks 11670 statusCode = s.statusCode || {}, 11671 11672 // Headers (they are sent all at once) 11673 requestHeaders = {}, 11674 requestHeadersNames = {}, 11675 11676 // Default abort message 11677 strAbort = "canceled", 11678 11679 // Fake xhr 11680 jqXHR = { 11681 readyState: 0, 11682 11683 // Builds headers hashtable if needed 11684 getResponseHeader: function( key ) { 11685 var match; 11686 if ( completed ) { 11687 if ( !responseHeaders ) { 11688 responseHeaders = {}; 11689 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 11690 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 11691 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 11692 .concat( match[ 2 ] ); 11693 } 11694 } 11695 match = responseHeaders[ key.toLowerCase() + " " ]; 11696 } 11697 return match == null ? null : match.join( ", " ); 11698 }, 11699 11700 // Raw string 11701 getAllResponseHeaders: function() { 11702 return completed ? responseHeadersString : null; 11703 }, 11704 11705 // Caches the header 11706 setRequestHeader: function( name, value ) { 11707 if ( completed == null ) { 11708 name = requestHeadersNames[ name.toLowerCase() ] = 11709 requestHeadersNames[ name.toLowerCase() ] || name; 11710 requestHeaders[ name ] = value; 11711 } 11712 return this; 11713 }, 11714 11715 // Overrides response content-type header 11716 overrideMimeType: function( type ) { 11717 if ( completed == null ) { 11718 s.mimeType = type; 11719 } 11720 return this; 11721 }, 11722 11723 // Status-dependent callbacks 11724 statusCode: function( map ) { 11725 var code; 11726 if ( map ) { 11727 if ( completed ) { 11728 11729 // Execute the appropriate callbacks 11730 jqXHR.always( map[ jqXHR.status ] ); 11731 } else { 11732 11733 // Lazy-add the new callbacks in a way that preserves old ones 11734 for ( code in map ) { 11735 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 11736 } 11737 } 11738 } 11739 return this; 11740 }, 11741 11742 // Cancel the request 11743 abort: function( statusText ) { 11744 var finalText = statusText || strAbort; 11745 if ( transport ) { 11746 transport.abort( finalText ); 11747 } 11748 done( 0, finalText ); 11749 return this; 11750 } 11751 }; 11752 11753 // Attach deferreds 11754 deferred.promise( jqXHR ); 11755 11756 // Add protocol if not provided (prefilters might expect it) 11757 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 11758 // We also use the url parameter if available 11759 s.url = ( ( url || s.url || location.href ) + "" ) 11760 .replace( rprotocol, location.protocol + "//" ); 11761 11762 // Alias method option to type as per ticket trac-12004 11763 s.type = options.method || options.type || s.method || s.type; 11764 11765 // Extract dataTypes list 11766 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 11767 11768 // A cross-domain request is in order when the origin doesn't match the current origin. 11769 if ( s.crossDomain == null ) { 11770 urlAnchor = document.createElement( "a" ); 11771 11772 // Support: IE <=8 - 11, Edge 12 - 15 11773 // IE throws exception on accessing the href property if url is malformed, 11774 // e.g. http://example.com:80x/ 11775 try { 11776 urlAnchor.href = s.url; 11777 11778 // Support: IE <=8 - 11 only 11779 // Anchor's host property isn't correctly set when s.url is relative 11780 urlAnchor.href = urlAnchor.href; 11781 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 11782 urlAnchor.protocol + "//" + urlAnchor.host; 11783 } catch ( e ) { 11784 11785 // If there is an error parsing the URL, assume it is crossDomain, 11786 // it can be rejected by the transport if it is invalid 11787 s.crossDomain = true; 11788 } 11789 } 11790 11791 // Convert data if not already a string 11792 if ( s.data && s.processData && typeof s.data !== "string" ) { 11793 s.data = jQuery.param( s.data, s.traditional ); 11794 } 11795 11796 // Apply prefilters 11797 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 11798 11799 // If request was aborted inside a prefilter, stop there 11800 if ( completed ) { 11801 return jqXHR; 11802 } 11803 11804 // We can fire global events as of now if asked to 11805 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 11806 fireGlobals = jQuery.event && s.global; 11807 11808 // Watch for a new set of requests 11809 if ( fireGlobals && jQuery.active++ === 0 ) { 11810 jQuery.event.trigger( "ajaxStart" ); 11811 } 11812 11813 // Uppercase the type 11814 s.type = s.type.toUpperCase(); 11815 11816 // Determine if request has content 11817 s.hasContent = !rnoContent.test( s.type ); 11818 11819 // Save the URL in case we're toying with the If-Modified-Since 11820 // and/or If-None-Match header later on 11821 // Remove hash to simplify url manipulation 11822 cacheURL = s.url.replace( rhash, "" ); 11823 11824 // More options handling for requests with no content 11825 if ( !s.hasContent ) { 11826 11827 // Remember the hash so we can put it back 11828 uncached = s.url.slice( cacheURL.length ); 11829 11830 // If data is available and should be processed, append data to url 11831 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 11832 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 11833 11834 // trac-9682: remove data so that it's not used in an eventual retry 11835 delete s.data; 11836 } 11837 11838 // Add or update anti-cache param if needed 11839 if ( s.cache === false ) { 11840 cacheURL = cacheURL.replace( rantiCache, "$1" ); 11841 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 11842 uncached; 11843 } 11844 11845 // Put hash and anti-cache on the URL that will be requested (gh-1732) 11846 s.url = cacheURL + uncached; 11847 11848 // Change '%20' to '+' if this is encoded form body content (gh-2658) 11849 } else if ( s.data && s.processData && 11850 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 11851 s.data = s.data.replace( r20, "+" ); 11852 } 11853 11854 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 11855 if ( s.ifModified ) { 11856 if ( jQuery.lastModified[ cacheURL ] ) { 11857 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 11858 } 11859 if ( jQuery.etag[ cacheURL ] ) { 11860 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 11861 } 11862 } 11863 11864 // Set the correct header, if data is being sent 11865 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 11866 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 11867 } 11868 11869 // Set the Accepts header for the server, depending on the dataType 11870 jqXHR.setRequestHeader( 11871 "Accept", 11872 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 11873 s.accepts[ s.dataTypes[ 0 ] ] + 11874 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 11875 s.accepts[ "*" ] 11876 ); 11877 11878 // Check for headers option 11879 for ( i in s.headers ) { 11880 jqXHR.setRequestHeader( i, s.headers[ i ] ); 11881 } 11882 11883 // Allow custom headers/mimetypes and early abort 11884 if ( s.beforeSend && 11885 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 11886 11887 // Abort if not done already and return 11888 return jqXHR.abort(); 11889 } 11890 11891 // Aborting is no longer a cancellation 11892 strAbort = "abort"; 11893 11894 // Install callbacks on deferreds 11895 completeDeferred.add( s.complete ); 11896 jqXHR.done( s.success ); 11897 jqXHR.fail( s.error ); 11898 11899 // Get transport 11900 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 11901 11902 // If no transport, we auto-abort 11903 if ( !transport ) { 11904 done( -1, "No Transport" ); 11905 } else { 11906 jqXHR.readyState = 1; 11907 11908 // Send global event 11909 if ( fireGlobals ) { 11910 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 11911 } 11912 11913 // If request was aborted inside ajaxSend, stop there 11914 if ( completed ) { 11915 return jqXHR; 11916 } 11917 11918 // Timeout 11919 if ( s.async && s.timeout > 0 ) { 11920 timeoutTimer = window.setTimeout( function() { 11921 jqXHR.abort( "timeout" ); 11922 }, s.timeout ); 11923 } 11924 11925 try { 11926 completed = false; 11927 transport.send( requestHeaders, done ); 11928 } catch ( e ) { 11929 11930 // Rethrow post-completion exceptions 11931 if ( completed ) { 11932 throw e; 11933 } 11934 11935 // Propagate others as results 11936 done( -1, e ); 11937 } 11938 } 11939 11940 // Callback for when everything is done 11941 function done( status, nativeStatusText, responses, headers ) { 11942 var isSuccess, success, error, response, modified, 11943 statusText = nativeStatusText; 11944 11945 // Ignore repeat invocations 11946 if ( completed ) { 11947 return; 11948 } 11949 11950 completed = true; 11951 11952 // Clear timeout if it exists 11953 if ( timeoutTimer ) { 11954 window.clearTimeout( timeoutTimer ); 11955 } 11956 11957 // Dereference transport for early garbage collection 11958 // (no matter how long the jqXHR object will be used) 11959 transport = undefined; 11960 11961 // Cache response headers 11962 responseHeadersString = headers || ""; 11963 11964 // Set readyState 11965 jqXHR.readyState = status > 0 ? 4 : 0; 11966 11967 // Determine if successful 11968 isSuccess = status >= 200 && status < 300 || status === 304; 11969 11970 // Get response data 11971 if ( responses ) { 11972 response = ajaxHandleResponses( s, jqXHR, responses ); 11973 } 11974 11975 // Use a noop converter for missing script but not if jsonp 11976 if ( !isSuccess && 11977 jQuery.inArray( "script", s.dataTypes ) > -1 && 11978 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 11979 s.converters[ "text script" ] = function() {}; 11980 } 11981 11982 // Convert no matter what (that way responseXXX fields are always set) 11983 response = ajaxConvert( s, response, jqXHR, isSuccess ); 11984 11985 // If successful, handle type chaining 11986 if ( isSuccess ) { 11987 11988 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 11989 if ( s.ifModified ) { 11990 modified = jqXHR.getResponseHeader( "Last-Modified" ); 11991 if ( modified ) { 11992 jQuery.lastModified[ cacheURL ] = modified; 11993 } 11994 modified = jqXHR.getResponseHeader( "etag" ); 11995 if ( modified ) { 11996 jQuery.etag[ cacheURL ] = modified; 11997 } 11998 } 11999 12000 // if no content 12001 if ( status === 204 || s.type === "HEAD" ) { 12002 statusText = "nocontent"; 12003 12004 // if not modified 12005 } else if ( status === 304 ) { 12006 statusText = "notmodified"; 12007 12008 // If we have data, let's convert it 12009 } else { 12010 statusText = response.state; 12011 success = response.data; 12012 error = response.error; 12013 isSuccess = !error; 12014 } 12015 } else { 12016 12017 // Extract error from statusText and normalize for non-aborts 12018 error = statusText; 12019 if ( status || !statusText ) { 12020 statusText = "error"; 12021 if ( status < 0 ) { 12022 status = 0; 12023 } 12024 } 12025 } 12026 12027 // Set data for the fake xhr object 12028 jqXHR.status = status; 12029 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 12030 12031 // Success/Error 12032 if ( isSuccess ) { 12033 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 12034 } else { 12035 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 12036 } 12037 12038 // Status-dependent callbacks 12039 jqXHR.statusCode( statusCode ); 12040 statusCode = undefined; 12041 12042 if ( fireGlobals ) { 12043 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 12044 [ jqXHR, s, isSuccess ? success : error ] ); 12045 } 12046 12047 // Complete 12048 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 12049 12050 if ( fireGlobals ) { 12051 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 12052 12053 // Handle the global AJAX counter 12054 if ( !( --jQuery.active ) ) { 12055 jQuery.event.trigger( "ajaxStop" ); 12056 } 12057 } 12058 } 12059 12060 return jqXHR; 12061 }, 12062 12063 getJSON: function( url, data, callback ) { 12064 return jQuery.get( url, data, callback, "json" ); 12065 }, 12066 12067 getScript: function( url, callback ) { 12068 return jQuery.get( url, undefined, callback, "script" ); 12069 } 12070} ); 12071 12072jQuery.each( [ "get", "post" ], function( _i, method ) { 12073 jQuery[ method ] = function( url, data, callback, type ) { 12074 12075 // Shift arguments if data argument was omitted 12076 if ( isFunction( data ) ) { 12077 type = type || callback; 12078 callback = data; 12079 data = undefined; 12080 } 12081 12082 // The url can be an options object (which then must have .url) 12083 return jQuery.ajax( jQuery.extend( { 12084 url: url, 12085 type: method, 12086 dataType: type, 12087 data: data, 12088 success: callback 12089 }, jQuery.isPlainObject( url ) && url ) ); 12090 }; 12091} ); 12092 12093jQuery.ajaxPrefilter( function( s ) { 12094 var i; 12095 for ( i in s.headers ) { 12096 if ( i.toLowerCase() === "content-type" ) { 12097 s.contentType = s.headers[ i ] || ""; 12098 } 12099 } 12100} ); 12101 12102 12103jQuery._evalUrl = function( url, options, doc ) { 12104 return jQuery.ajax( { 12105 url: url, 12106 12107 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 12108 type: "GET", 12109 dataType: "script", 12110 cache: true, 12111 async: false, 12112 global: false, 12113 12114 // Only evaluate the response if it is successful (gh-4126) 12115 // dataFilter is not invoked for failure responses, so using it instead 12116 // of the default converter is kludgy but it works. 12117 converters: { 12118 "text script": function() {} 12119 }, 12120 dataFilter: function( response ) { 12121 jQuery.globalEval( response, options, doc ); 12122 } 12123 } ); 12124}; 12125 12126 12127jQuery.fn.extend( { 12128 wrapAll: function( html ) { 12129 var wrap; 12130 12131 if ( this[ 0 ] ) { 12132 if ( isFunction( html ) ) { 12133 html = html.call( this[ 0 ] ); 12134 } 12135 12136 // The elements to wrap the target around 12137 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 12138 12139 if ( this[ 0 ].parentNode ) { 12140 wrap.insertBefore( this[ 0 ] ); 12141 } 12142 12143 wrap.map( function() { 12144 var elem = this; 12145 12146 while ( elem.firstElementChild ) { 12147 elem = elem.firstElementChild; 12148 } 12149 12150 return elem; 12151 } ).append( this ); 12152 } 12153 12154 return this; 12155 }, 12156 12157 wrapInner: function( html ) { 12158 if ( isFunction( html ) ) { 12159 return this.each( function( i ) { 12160 jQuery( this ).wrapInner( html.call( this, i ) ); 12161 } ); 12162 } 12163 12164 return this.each( function() { 12165 var self = jQuery( this ), 12166 contents = self.contents(); 12167 12168 if ( contents.length ) { 12169 contents.wrapAll( html ); 12170 12171 } else { 12172 self.append( html ); 12173 } 12174 } ); 12175 }, 12176 12177 wrap: function( html ) { 12178 var htmlIsFunction = isFunction( html ); 12179 12180 return this.each( function( i ) { 12181 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 12182 } ); 12183 }, 12184 12185 unwrap: function( selector ) { 12186 this.parent( selector ).not( "body" ).each( function() { 12187 jQuery( this ).replaceWith( this.childNodes ); 12188 } ); 12189 return this; 12190 } 12191} ); 12192 12193 12194jQuery.expr.pseudos.hidden = function( elem ) { 12195 return !jQuery.expr.pseudos.visible( elem ); 12196}; 12197jQuery.expr.pseudos.visible = function( elem ) { 12198 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 12199}; 12200 12201 12202 12203 12204jQuery.ajaxSettings.xhr = function() { 12205 try { 12206 return new window.XMLHttpRequest(); 12207 } catch ( e ) {} 12208}; 12209 12210var xhrSuccessStatus = { 12211 12212 // File protocol always yields status code 0, assume 200 12213 0: 200, 12214 12215 // Support: IE <=9 only 12216 // trac-1450: sometimes IE returns 1223 when it should be 204 12217 1223: 204 12218 }, 12219 xhrSupported = jQuery.ajaxSettings.xhr(); 12220 12221support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 12222support.ajax = xhrSupported = !!xhrSupported; 12223 12224jQuery.ajaxTransport( function( options ) { 12225 var callback, errorCallback; 12226 12227 // Cross domain only allowed if supported through XMLHttpRequest 12228 if ( support.cors || xhrSupported && !options.crossDomain ) { 12229 return { 12230 send: function( headers, complete ) { 12231 var i, 12232 xhr = options.xhr(); 12233 12234 xhr.open( 12235 options.type, 12236 options.url, 12237 options.async, 12238 options.username, 12239 options.password 12240 ); 12241 12242 // Apply custom fields if provided 12243 if ( options.xhrFields ) { 12244 for ( i in options.xhrFields ) { 12245 xhr[ i ] = options.xhrFields[ i ]; 12246 } 12247 } 12248 12249 // Override mime type if needed 12250 if ( options.mimeType && xhr.overrideMimeType ) { 12251 xhr.overrideMimeType( options.mimeType ); 12252 } 12253 12254 // X-Requested-With header 12255 // For cross-domain requests, seeing as conditions for a preflight are 12256 // akin to a jigsaw puzzle, we simply never set it to be sure. 12257 // (it can always be set on a per-request basis or even using ajaxSetup) 12258 // For same-domain requests, won't change header if already provided. 12259 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 12260 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 12261 } 12262 12263 // Set headers 12264 for ( i in headers ) { 12265 xhr.setRequestHeader( i, headers[ i ] ); 12266 } 12267 12268 // Callback 12269 callback = function( type ) { 12270 return function() { 12271 if ( callback ) { 12272 callback = errorCallback = xhr.onload = 12273 xhr.onerror = xhr.onabort = xhr.ontimeout = 12274 xhr.onreadystatechange = null; 12275 12276 if ( type === "abort" ) { 12277 xhr.abort(); 12278 } else if ( type === "error" ) { 12279 12280 // Support: IE <=9 only 12281 // On a manual native abort, IE9 throws 12282 // errors on any property access that is not readyState 12283 if ( typeof xhr.status !== "number" ) { 12284 complete( 0, "error" ); 12285 } else { 12286 complete( 12287 12288 // File: protocol always yields status 0; see trac-8605, trac-14207 12289 xhr.status, 12290 xhr.statusText 12291 ); 12292 } 12293 } else { 12294 complete( 12295 xhrSuccessStatus[ xhr.status ] || xhr.status, 12296 xhr.statusText, 12297 12298 // Support: IE <=9 only 12299 // IE9 has no XHR2 but throws on binary (trac-11426) 12300 // For XHR2 non-text, let the caller handle it (gh-2498) 12301 ( xhr.responseType || "text" ) !== "text" || 12302 typeof xhr.responseText !== "string" ? 12303 { binary: xhr.response } : 12304 { text: xhr.responseText }, 12305 xhr.getAllResponseHeaders() 12306 ); 12307 } 12308 } 12309 }; 12310 }; 12311 12312 // Listen to events 12313 xhr.onload = callback(); 12314 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 12315 12316 // Support: IE 9 only 12317 // Use onreadystatechange to replace onabort 12318 // to handle uncaught aborts 12319 if ( xhr.onabort !== undefined ) { 12320 xhr.onabort = errorCallback; 12321 } else { 12322 xhr.onreadystatechange = function() { 12323 12324 // Check readyState before timeout as it changes 12325 if ( xhr.readyState === 4 ) { 12326 12327 // Allow onerror to be called first, 12328 // but that will not handle a native abort 12329 // Also, save errorCallback to a variable 12330 // as xhr.onerror cannot be accessed 12331 window.setTimeout( function() { 12332 if ( callback ) { 12333 errorCallback(); 12334 } 12335 } ); 12336 } 12337 }; 12338 } 12339 12340 // Create the abort callback 12341 callback = callback( "abort" ); 12342 12343 try { 12344 12345 // Do send the request (this may raise an exception) 12346 xhr.send( options.hasContent && options.data || null ); 12347 } catch ( e ) { 12348 12349 // trac-14683: Only rethrow if this hasn't been notified as an error yet 12350 if ( callback ) { 12351 throw e; 12352 } 12353 } 12354 }, 12355 12356 abort: function() { 12357 if ( callback ) { 12358 callback(); 12359 } 12360 } 12361 }; 12362 } 12363} ); 12364 12365 12366 12367 12368// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 12369jQuery.ajaxPrefilter( function( s ) { 12370 if ( s.crossDomain ) { 12371 s.contents.script = false; 12372 } 12373} ); 12374 12375// Install script dataType 12376jQuery.ajaxSetup( { 12377 accepts: { 12378 script: "text/javascript, application/javascript, " + 12379 "application/ecmascript, application/x-ecmascript" 12380 }, 12381 contents: { 12382 script: /\b(?:java|ecma)script\b/ 12383 }, 12384 converters: { 12385 "text script": function( text ) { 12386 jQuery.globalEval( text ); 12387 return text; 12388 } 12389 } 12390} ); 12391 12392// Handle cache's special case and crossDomain 12393jQuery.ajaxPrefilter( "script", function( s ) { 12394 if ( s.cache === undefined ) { 12395 s.cache = false; 12396 } 12397 if ( s.crossDomain ) { 12398 s.type = "GET"; 12399 } 12400} ); 12401 12402// Bind script tag hack transport 12403jQuery.ajaxTransport( "script", function( s ) { 12404 12405 // This transport only deals with cross domain or forced-by-attrs requests 12406 if ( s.crossDomain || s.scriptAttrs ) { 12407 var script, callback; 12408 return { 12409 send: function( _, complete ) { 12410 script = jQuery( "<script>" ) 12411 .attr( s.scriptAttrs || {} ) 12412 .prop( { charset: s.scriptCharset, src: s.url } ) 12413 .on( "load error", callback = function( evt ) { 12414 script.remove(); 12415 callback = null; 12416 if ( evt ) { 12417 complete( evt.type === "error" ? 404 : 200, evt.type ); 12418 } 12419 } ); 12420 12421 // Use native DOM manipulation to avoid our domManip AJAX trickery 12422 document.head.appendChild( script[ 0 ] ); 12423 }, 12424 abort: function() { 12425 if ( callback ) { 12426 callback(); 12427 } 12428 } 12429 }; 12430 } 12431} ); 12432 12433 12434 12435 12436var oldCallbacks = [], 12437 rjsonp = /(=)\?(?=&|$)|\?\?/; 12438 12439// Default jsonp settings 12440jQuery.ajaxSetup( { 12441 jsonp: "callback", 12442 jsonpCallback: function() { 12443 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 12444 this[ callback ] = true; 12445 return callback; 12446 } 12447} ); 12448 12449// Detect, normalize options and install callbacks for jsonp requests 12450jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 12451 12452 var callbackName, overwritten, responseContainer, 12453 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 12454 "url" : 12455 typeof s.data === "string" && 12456 ( s.contentType || "" ) 12457 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 12458 rjsonp.test( s.data ) && "data" 12459 ); 12460 12461 // Handle iff the expected data type is "jsonp" or we have a parameter to set 12462 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 12463 12464 // Get callback name, remembering preexisting value associated with it 12465 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 12466 s.jsonpCallback() : 12467 s.jsonpCallback; 12468 12469 // Insert callback into url or form data 12470 if ( jsonProp ) { 12471 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 12472 } else if ( s.jsonp !== false ) { 12473 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 12474 } 12475 12476 // Use data converter to retrieve json after script execution 12477 s.converters[ "script json" ] = function() { 12478 if ( !responseContainer ) { 12479 jQuery.error( callbackName + " was not called" ); 12480 } 12481 return responseContainer[ 0 ]; 12482 }; 12483 12484 // Force json dataType 12485 s.dataTypes[ 0 ] = "json"; 12486 12487 // Install callback 12488 overwritten = window[ callbackName ]; 12489 window[ callbackName ] = function() { 12490 responseContainer = arguments; 12491 }; 12492 12493 // Clean-up function (fires after converters) 12494 jqXHR.always( function() { 12495 12496 // If previous value didn't exist - remove it 12497 if ( overwritten === undefined ) { 12498 jQuery( window ).removeProp( callbackName ); 12499 12500 // Otherwise restore preexisting value 12501 } else { 12502 window[ callbackName ] = overwritten; 12503 } 12504 12505 // Save back as free 12506 if ( s[ callbackName ] ) { 12507 12508 // Make sure that re-using the options doesn't screw things around 12509 s.jsonpCallback = originalSettings.jsonpCallback; 12510 12511 // Save the callback name for future use 12512 oldCallbacks.push( callbackName ); 12513 } 12514 12515 // Call if it was a function and we have a response 12516 if ( responseContainer && isFunction( overwritten ) ) { 12517 overwritten( responseContainer[ 0 ] ); 12518 } 12519 12520 responseContainer = overwritten = undefined; 12521 } ); 12522 12523 // Delegate to script 12524 return "script"; 12525 } 12526} ); 12527 12528 12529 12530 12531// Support: Safari 8 only 12532// In Safari 8 documents created via document.implementation.createHTMLDocument 12533// collapse sibling forms: the second one becomes a child of the first one. 12534// Because of that, this security measure has to be disabled in Safari 8. 12535// https://bugs.webkit.org/show_bug.cgi?id=137337 12536support.createHTMLDocument = ( function() { 12537 var body = document.implementation.createHTMLDocument( "" ).body; 12538 body.innerHTML = "<form></form><form></form>"; 12539 return body.childNodes.length === 2; 12540} )(); 12541 12542 12543// Argument "data" should be string of html 12544// context (optional): If specified, the fragment will be created in this context, 12545// defaults to document 12546// keepScripts (optional): If true, will include scripts passed in the html string 12547jQuery.parseHTML = function( data, context, keepScripts ) { 12548 if ( typeof data !== "string" ) { 12549 return []; 12550 } 12551 if ( typeof context === "boolean" ) { 12552 keepScripts = context; 12553 context = false; 12554 } 12555 12556 var base, parsed, scripts; 12557 12558 if ( !context ) { 12559 12560 // Stop scripts or inline event handlers from being executed immediately 12561 // by using document.implementation 12562 if ( support.createHTMLDocument ) { 12563 context = document.implementation.createHTMLDocument( "" ); 12564 12565 // Set the base href for the created document 12566 // so any parsed elements with URLs 12567 // are based on the document's URL (gh-2965) 12568 base = context.createElement( "base" ); 12569 base.href = document.location.href; 12570 context.head.appendChild( base ); 12571 } else { 12572 context = document; 12573 } 12574 } 12575 12576 parsed = rsingleTag.exec( data ); 12577 scripts = !keepScripts && []; 12578 12579 // Single tag 12580 if ( parsed ) { 12581 return [ context.createElement( parsed[ 1 ] ) ]; 12582 } 12583 12584 parsed = buildFragment( [ data ], context, scripts ); 12585 12586 if ( scripts && scripts.length ) { 12587 jQuery( scripts ).remove(); 12588 } 12589 12590 return jQuery.merge( [], parsed.childNodes ); 12591}; 12592 12593 12594/** 12595 * Load a url into a page 12596 */ 12597jQuery.fn.load = function( url, params, callback ) { 12598 var selector, type, response, 12599 self = this, 12600 off = url.indexOf( " " ); 12601 12602 if ( off > -1 ) { 12603 selector = stripAndCollapse( url.slice( off ) ); 12604 url = url.slice( 0, off ); 12605 } 12606 12607 // If it's a function 12608 if ( isFunction( params ) ) { 12609 12610 // We assume that it's the callback 12611 callback = params; 12612 params = undefined; 12613 12614 // Otherwise, build a param string 12615 } else if ( params && typeof params === "object" ) { 12616 type = "POST"; 12617 } 12618 12619 // If we have elements to modify, make the request 12620 if ( self.length > 0 ) { 12621 jQuery.ajax( { 12622 url: url, 12623 12624 // If "type" variable is undefined, then "GET" method will be used. 12625 // Make value of this field explicit since 12626 // user can override it through ajaxSetup method 12627 type: type || "GET", 12628 dataType: "html", 12629 data: params 12630 } ).done( function( responseText ) { 12631 12632 // Save response for use in complete callback 12633 response = arguments; 12634 12635 self.html( selector ? 12636 12637 // If a selector was specified, locate the right elements in a dummy div 12638 // Exclude scripts to avoid IE 'Permission Denied' errors 12639 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 12640 12641 // Otherwise use the full result 12642 responseText ); 12643 12644 // If the request succeeds, this function gets "data", "status", "jqXHR" 12645 // but they are ignored because response was set above. 12646 // If it fails, this function gets "jqXHR", "status", "error" 12647 } ).always( callback && function( jqXHR, status ) { 12648 self.each( function() { 12649 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 12650 } ); 12651 } ); 12652 } 12653 12654 return this; 12655}; 12656 12657 12658 12659 12660jQuery.expr.pseudos.animated = function( elem ) { 12661 return jQuery.grep( jQuery.timers, function( fn ) { 12662 return elem === fn.elem; 12663 } ).length; 12664}; 12665 12666 12667 12668 12669jQuery.offset = { 12670 setOffset: function( elem, options, i ) { 12671 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 12672 position = jQuery.css( elem, "position" ), 12673 curElem = jQuery( elem ), 12674 props = {}; 12675 12676 // Set position first, in-case top/left are set even on static elem 12677 if ( position === "static" ) { 12678 elem.style.position = "relative"; 12679 } 12680 12681 curOffset = curElem.offset(); 12682 curCSSTop = jQuery.css( elem, "top" ); 12683 curCSSLeft = jQuery.css( elem, "left" ); 12684 calculatePosition = ( position === "absolute" || position === "fixed" ) && 12685 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 12686 12687 // Need to be able to calculate position if either 12688 // top or left is auto and position is either absolute or fixed 12689 if ( calculatePosition ) { 12690 curPosition = curElem.position(); 12691 curTop = curPosition.top; 12692 curLeft = curPosition.left; 12693 12694 } else { 12695 curTop = parseFloat( curCSSTop ) || 0; 12696 curLeft = parseFloat( curCSSLeft ) || 0; 12697 } 12698 12699 if ( isFunction( options ) ) { 12700 12701 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 12702 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 12703 } 12704 12705 if ( options.top != null ) { 12706 props.top = ( options.top - curOffset.top ) + curTop; 12707 } 12708 if ( options.left != null ) { 12709 props.left = ( options.left - curOffset.left ) + curLeft; 12710 } 12711 12712 if ( "using" in options ) { 12713 options.using.call( elem, props ); 12714 12715 } else { 12716 curElem.css( props ); 12717 } 12718 } 12719}; 12720 12721jQuery.fn.extend( { 12722 12723 // offset() relates an element's border box to the document origin 12724 offset: function( options ) { 12725 12726 // Preserve chaining for setter 12727 if ( arguments.length ) { 12728 return options === undefined ? 12729 this : 12730 this.each( function( i ) { 12731 jQuery.offset.setOffset( this, options, i ); 12732 } ); 12733 } 12734 12735 var rect, win, 12736 elem = this[ 0 ]; 12737 12738 if ( !elem ) { 12739 return; 12740 } 12741 12742 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 12743 // Support: IE <=11 only 12744 // Running getBoundingClientRect on a 12745 // disconnected node in IE throws an error 12746 if ( !elem.getClientRects().length ) { 12747 return { top: 0, left: 0 }; 12748 } 12749 12750 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 12751 rect = elem.getBoundingClientRect(); 12752 win = elem.ownerDocument.defaultView; 12753 return { 12754 top: rect.top + win.pageYOffset, 12755 left: rect.left + win.pageXOffset 12756 }; 12757 }, 12758 12759 // position() relates an element's margin box to its offset parent's padding box 12760 // This corresponds to the behavior of CSS absolute positioning 12761 position: function() { 12762 if ( !this[ 0 ] ) { 12763 return; 12764 } 12765 12766 var offsetParent, offset, doc, 12767 elem = this[ 0 ], 12768 parentOffset = { top: 0, left: 0 }; 12769 12770 // position:fixed elements are offset from the viewport, which itself always has zero offset 12771 if ( jQuery.css( elem, "position" ) === "fixed" ) { 12772 12773 // Assume position:fixed implies availability of getBoundingClientRect 12774 offset = elem.getBoundingClientRect(); 12775 12776 } else { 12777 offset = this.offset(); 12778 12779 // Account for the *real* offset parent, which can be the document or its root element 12780 // when a statically positioned element is identified 12781 doc = elem.ownerDocument; 12782 offsetParent = elem.offsetParent || doc.documentElement; 12783 while ( offsetParent && 12784 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 12785 jQuery.css( offsetParent, "position" ) === "static" ) { 12786 12787 offsetParent = offsetParent.parentNode; 12788 } 12789 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 12790 12791 // Incorporate borders into its offset, since they are outside its content origin 12792 parentOffset = jQuery( offsetParent ).offset(); 12793 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 12794 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 12795 } 12796 } 12797 12798 // Subtract parent offsets and element margins 12799 return { 12800 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 12801 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 12802 }; 12803 }, 12804 12805 // This method will return documentElement in the following cases: 12806 // 1) For the element inside the iframe without offsetParent, this method will return 12807 // documentElement of the parent window 12808 // 2) For the hidden or detached element 12809 // 3) For body or html element, i.e. in case of the html node - it will return itself 12810 // 12811 // but those exceptions were never presented as a real life use-cases 12812 // and might be considered as more preferable results. 12813 // 12814 // This logic, however, is not guaranteed and can change at any point in the future 12815 offsetParent: function() { 12816 return this.map( function() { 12817 var offsetParent = this.offsetParent; 12818 12819 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 12820 offsetParent = offsetParent.offsetParent; 12821 } 12822 12823 return offsetParent || documentElement; 12824 } ); 12825 } 12826} ); 12827 12828// Create scrollLeft and scrollTop methods 12829jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 12830 var top = "pageYOffset" === prop; 12831 12832 jQuery.fn[ method ] = function( val ) { 12833 return access( this, function( elem, method, val ) { 12834 12835 // Coalesce documents and windows 12836 var win; 12837 if ( isWindow( elem ) ) { 12838 win = elem; 12839 } else if ( elem.nodeType === 9 ) { 12840 win = elem.defaultView; 12841 } 12842 12843 if ( val === undefined ) { 12844 return win ? win[ prop ] : elem[ method ]; 12845 } 12846 12847 if ( win ) { 12848 win.scrollTo( 12849 !top ? val : win.pageXOffset, 12850 top ? val : win.pageYOffset 12851 ); 12852 12853 } else { 12854 elem[ method ] = val; 12855 } 12856 }, method, val, arguments.length ); 12857 }; 12858} ); 12859 12860// Support: Safari <=7 - 9.1, Chrome <=37 - 49 12861// Add the top/left cssHooks using jQuery.fn.position 12862// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 12863// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 12864// getComputedStyle returns percent when specified for top/left/bottom/right; 12865// rather than make the css module depend on the offset module, just check for it here 12866jQuery.each( [ "top", "left" ], function( _i, prop ) { 12867 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 12868 function( elem, computed ) { 12869 if ( computed ) { 12870 computed = curCSS( elem, prop ); 12871 12872 // If curCSS returns percentage, fallback to offset 12873 return rnumnonpx.test( computed ) ? 12874 jQuery( elem ).position()[ prop ] + "px" : 12875 computed; 12876 } 12877 } 12878 ); 12879} ); 12880 12881 12882// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 12883jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 12884 jQuery.each( { 12885 padding: "inner" + name, 12886 content: type, 12887 "": "outer" + name 12888 }, function( defaultExtra, funcName ) { 12889 12890 // Margin is only for outerHeight, outerWidth 12891 jQuery.fn[ funcName ] = function( margin, value ) { 12892 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 12893 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 12894 12895 return access( this, function( elem, type, value ) { 12896 var doc; 12897 12898 if ( isWindow( elem ) ) { 12899 12900 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 12901 return funcName.indexOf( "outer" ) === 0 ? 12902 elem[ "inner" + name ] : 12903 elem.document.documentElement[ "client" + name ]; 12904 } 12905 12906 // Get document width or height 12907 if ( elem.nodeType === 9 ) { 12908 doc = elem.documentElement; 12909 12910 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 12911 // whichever is greatest 12912 return Math.max( 12913 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 12914 elem.body[ "offset" + name ], doc[ "offset" + name ], 12915 doc[ "client" + name ] 12916 ); 12917 } 12918 12919 return value === undefined ? 12920 12921 // Get width or height on the element, requesting but not forcing parseFloat 12922 jQuery.css( elem, type, extra ) : 12923 12924 // Set width or height on the element 12925 jQuery.style( elem, type, value, extra ); 12926 }, type, chainable ? margin : undefined, chainable ); 12927 }; 12928 } ); 12929} ); 12930 12931 12932jQuery.each( [ 12933 "ajaxStart", 12934 "ajaxStop", 12935 "ajaxComplete", 12936 "ajaxError", 12937 "ajaxSuccess", 12938 "ajaxSend" 12939], function( _i, type ) { 12940 jQuery.fn[ type ] = function( fn ) { 12941 return this.on( type, fn ); 12942 }; 12943} ); 12944 12945 12946 12947 12948jQuery.fn.extend( { 12949 12950 bind: function( types, data, fn ) { 12951 return this.on( types, null, data, fn ); 12952 }, 12953 unbind: function( types, fn ) { 12954 return this.off( types, null, fn ); 12955 }, 12956 12957 delegate: function( selector, types, data, fn ) { 12958 return this.on( types, selector, data, fn ); 12959 }, 12960 undelegate: function( selector, types, fn ) { 12961 12962 // ( namespace ) or ( selector, types [, fn] ) 12963 return arguments.length === 1 ? 12964 this.off( selector, "**" ) : 12965 this.off( types, selector || "**", fn ); 12966 }, 12967 12968 hover: function( fnOver, fnOut ) { 12969 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 12970 } 12971} ); 12972 12973jQuery.each( 12974 ( "blur focus focusin focusout resize scroll click dblclick " + 12975 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 12976 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 12977 function( _i, name ) { 12978 12979 // Handle event binding 12980 jQuery.fn[ name ] = function( data, fn ) { 12981 return arguments.length > 0 ? 12982 this.on( name, null, data, fn ) : 12983 this.trigger( name ); 12984 }; 12985 } 12986); 12987 12988 12989 12990 12991// Support: Android <=4.0 only 12992// Make sure we trim BOM and NBSP 12993// Require that the "whitespace run" starts from a non-whitespace 12994// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 12995var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 12996 12997// Bind a function to a context, optionally partially applying any 12998// arguments. 12999// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 13000// However, it is not slated for removal any time soon 13001jQuery.proxy = function( fn, context ) { 13002 var tmp, args, proxy; 13003 13004 if ( typeof context === "string" ) { 13005 tmp = fn[ context ]; 13006 context = fn; 13007 fn = tmp; 13008 } 13009 13010 // Quick check to determine if target is callable, in the spec 13011 // this throws a TypeError, but we will just return undefined. 13012 if ( !isFunction( fn ) ) { 13013 return undefined; 13014 } 13015 13016 // Simulated bind 13017 args = slice.call( arguments, 2 ); 13018 proxy = function() { 13019 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 13020 }; 13021 13022 // Set the guid of unique handler to the same of original handler, so it can be removed 13023 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 13024 13025 return proxy; 13026}; 13027 13028jQuery.holdReady = function( hold ) { 13029 if ( hold ) { 13030 jQuery.readyWait++; 13031 } else { 13032 jQuery.ready( true ); 13033 } 13034}; 13035jQuery.isArray = Array.isArray; 13036jQuery.parseJSON = JSON.parse; 13037jQuery.nodeName = nodeName; 13038jQuery.isFunction = isFunction; 13039jQuery.isWindow = isWindow; 13040jQuery.camelCase = camelCase; 13041jQuery.type = toType; 13042 13043jQuery.now = Date.now; 13044 13045jQuery.isNumeric = function( obj ) { 13046 13047 // As of jQuery 3.0, isNumeric is limited to 13048 // strings and numbers (primitives or objects) 13049 // that can be coerced to finite numbers (gh-2662) 13050 var type = jQuery.type( obj ); 13051 return ( type === "number" || type === "string" ) && 13052 13053 // parseFloat NaNs numeric-cast false positives ("") 13054 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 13055 // subtraction forces infinities to NaN 13056 !isNaN( obj - parseFloat( obj ) ); 13057}; 13058 13059jQuery.trim = function( text ) { 13060 return text == null ? 13061 "" : 13062 ( text + "" ).replace( rtrim, "$1" ); 13063}; 13064 13065 13066 13067// Register as a named AMD module, since jQuery can be concatenated with other 13068// files that may use define, but not via a proper concatenation script that 13069// understands anonymous AMD modules. A named AMD is safest and most robust 13070// way to register. Lowercase jquery is used because AMD module names are 13071// derived from file names, and jQuery is normally delivered in a lowercase 13072// file name. Do this after creating the global so that if an AMD module wants 13073// to call noConflict to hide this version of jQuery, it will work. 13074 13075// Note that for maximum portability, libraries that are not jQuery should 13076// declare themselves as anonymous modules, and avoid setting a global if an 13077// AMD loader is present. jQuery is a special case. For more information, see 13078// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 13079 13080if ( true ) { 13081 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 13082 return jQuery; 13083 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 13084 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 13085} 13086 13087 13088 13089 13090var 13091 13092 // Map over jQuery in case of overwrite 13093 _jQuery = window.jQuery, 13094 13095 // Map over the $ in case of overwrite 13096 _$ = window.$; 13097 13098jQuery.noConflict = function( deep ) { 13099 if ( window.$ === jQuery ) { 13100 window.$ = _$; 13101 } 13102 13103 if ( deep && window.jQuery === jQuery ) { 13104 window.jQuery = _jQuery; 13105 } 13106 13107 return jQuery; 13108}; 13109 13110// Expose jQuery and $ identifiers, even in AMD 13111// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 13112// and CommonJS for browser emulators (trac-13566) 13113if ( typeof noGlobal === "undefined" ) { 13114 window.jQuery = window.$ = jQuery; 13115} 13116 13117 13118 13119 13120return jQuery; 13121} ); 13122 13123 13124/***/ }), 13125
vendor: 21,261 bytes, lines 13126-13701
13126/***/ "./node_modules/lightbox2/dist/js/lightbox.js": 13127/*!****************************************************!*\ 13128 !*** ./node_modules/lightbox2/dist/js/lightbox.js ***! 13129 \****************************************************/ 13130/***/ (function(module, exports, __webpack_require__) { 13131 13132var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 13133 * Lightbox v2.11.4 13134 * by Lokesh Dhakar 13135 * 13136 * More info: 13137 * http://lokeshdhakar.com/projects/lightbox2/ 13138 * 13139 * Copyright Lokesh Dhakar 13140 * Released under the MIT license 13141 * https://github.com/lokesh/lightbox2/blob/master/LICENSE 13142 * 13143 * @preserve 13144 */ 13145 13146// Uses Node, AMD or browser globals to create a module. 13147(function (root, factory) { 13148 if (true) { 13149 // AMD. Register as an anonymous module. 13150 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 13151 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 13152 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 13153 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 13154 } else {} 13155}(this, function ($) { 13156 13157 function Lightbox(options) { 13158 this.album = []; 13159 this.currentImageIndex = void 0; 13160 this.init(); 13161 13162 // options 13163 this.options = $.extend({}, this.constructor.defaults); 13164 this.option(options); 13165 } 13166 13167 // Descriptions of all options available on the demo site: 13168 // http://lokeshdhakar.com/projects/lightbox2/index.html#options 13169 Lightbox.defaults = { 13170 albumLabel: 'Image %1 of %2', 13171 alwaysShowNavOnTouchDevices: false, 13172 fadeDuration: 600, 13173 fitImagesInViewport: true, 13174 imageFadeDuration: 600, 13175 // maxWidth: 800, 13176 // maxHeight: 600, 13177 positionFromTop: 50, 13178 resizeDuration: 700, 13179 showImageNumberLabel: true, 13180 wrapAround: false, 13181 disableScrolling: false, 13182 /* 13183 Sanitize Title 13184 If the caption data is trusted, for example you are hardcoding it in, then leave this to false. 13185 This will free you to add html tags, such as links, in the caption. 13186 13187 If the caption data is user submitted or from some other untrusted source, then set this to true 13188 to prevent xss and other injection attacks. 13189 */ 13190 sanitizeTitle: false 13191 }; 13192 13193 Lightbox.prototype.option = function(options) { 13194 $.extend(this.options, options); 13195 }; 13196 13197 Lightbox.prototype.imageCountLabel = function(currentImageNum, totalImages) { 13198 return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages); 13199 }; 13200 13201 Lightbox.prototype.init = function() { 13202 var self = this; 13203 // Both enable and build methods require the body tag to be in the DOM. 13204 $(document).ready(function() { 13205 self.enable(); 13206 self.build(); 13207 }); 13208 }; 13209 13210 // Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes 13211 // that contain 'lightbox'. When these are clicked, start lightbox. 13212 Lightbox.prototype.enable = function() { 13213 var self = this; 13214 $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) { 13215 self.start($(event.currentTarget)); 13216 return false; 13217 }); 13218 }; 13219 13220 // Build html for the lightbox and the overlay. 13221 // Attach event handlers to the new DOM elements. click click click 13222 Lightbox.prototype.build = function() { 13223 if ($('#lightbox').length > 0) { 13224 return; 13225 } 13226 13227 var self = this; 13228 13229 // The two root notes generated, #lightboxOverlay and #lightbox are given 13230 // tabindex attrs so they are focusable. We attach our keyboard event 13231 // listeners to these two elements, and not the document. Clicking anywhere 13232 // while Lightbox is opened will keep the focus on or inside one of these 13233 // two elements. 13234 // 13235 // We do this so we can prevent propogation of the Esc keypress when 13236 // Lightbox is open. This prevents it from intefering with other components 13237 // on the page below. 13238 // 13239 // Github issue: https://github.com/lokesh/lightbox2/issues/663 13240 $('<div id="lightboxOverlay" tabindex="-1" class="lightboxOverlay"></div><div id="lightbox" tabindex="-1" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" alt=""/><div class="lb-nav"><a class="lb-prev" role="button" tabindex="0" aria-label="Previous image" href="" ></a><a class="lb-next" role="button" tabindex="0" aria-label="Next image" href="" ></a></div><div class="lb-loader"><a class="lb-cancel" role="button" tabindex="0"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close" role="button" tabindex="0"></a></div></div></div></div>').appendTo($('body')); 13241 13242 // Cache jQuery objects 13243 this.$lightbox = $('#lightbox'); 13244 this.$overlay = $('#lightboxOverlay'); 13245 this.$outerContainer = this.$lightbox.find('.lb-outerContainer'); 13246 this.$container = this.$lightbox.find('.lb-container'); 13247 this.$image = this.$lightbox.find('.lb-image'); 13248 this.$nav = this.$lightbox.find('.lb-nav'); 13249 13250 // Store css values for future lookup 13251 this.containerPadding = { 13252 top: parseInt(this.$container.css('padding-top'), 10), 13253 right: parseInt(this.$container.css('padding-right'), 10), 13254 bottom: parseInt(this.$container.css('padding-bottom'), 10), 13255 left: parseInt(this.$container.css('padding-left'), 10) 13256 }; 13257 13258 this.imageBorderWidth = { 13259 top: parseInt(this.$image.css('border-top-width'), 10), 13260 right: parseInt(this.$image.css('border-right-width'), 10), 13261 bottom: parseInt(this.$image.css('border-bottom-width'), 10), 13262 left: parseInt(this.$image.css('border-left-width'), 10) 13263 }; 13264 13265 // Attach event handlers to the newly minted DOM elements 13266 this.$overlay.hide().on('click', function() { 13267 self.end(); 13268 return false; 13269 }); 13270 13271 this.$lightbox.hide().on('click', function(event) { 13272 if ($(event.target).attr('id') === 'lightbox') { 13273 self.end(); 13274 } 13275 }); 13276 13277 this.$outerContainer.on('click', function(event) { 13278 if ($(event.target).attr('id') === 'lightbox') { 13279 self.end(); 13280 } 13281 return false; 13282 }); 13283 13284 this.$lightbox.find('.lb-prev').on('click', function() { 13285 if (self.currentImageIndex === 0) { 13286 self.changeImage(self.album.length - 1); 13287 } else { 13288 self.changeImage(self.currentImageIndex - 1); 13289 } 13290 return false; 13291 }); 13292 13293 this.$lightbox.find('.lb-next').on('click', function() { 13294 if (self.currentImageIndex === self.album.length - 1) { 13295 self.changeImage(0); 13296 } else { 13297 self.changeImage(self.currentImageIndex + 1); 13298 } 13299 return false; 13300 }); 13301 13302 /* 13303 Show context menu for image on right-click 13304 13305 There is a div containing the navigation that spans the entire image and lives above of it. If 13306 you right-click, you are right clicking this div and not the image. This prevents users from 13307 saving the image or using other context menu actions with the image. 13308 13309 To fix this, when we detect the right mouse button is pressed down, but not yet clicked, we 13310 set pointer-events to none on the nav div. This is so that the upcoming right-click event on 13311 the next mouseup will bubble down to the image. Once the right-click/contextmenu event occurs 13312 we set the pointer events back to auto for the nav div so it can capture hover and left-click 13313 events as usual. 13314 */ 13315 this.$nav.on('mousedown', function(event) { 13316 if (event.which === 3) { 13317 self.$nav.css('pointer-events', 'none'); 13318 13319 self.$lightbox.one('contextmenu', function() { 13320 setTimeout(function() { 13321 this.$nav.css('pointer-events', 'auto'); 13322 }.bind(self), 0); 13323 }); 13324 } 13325 }); 13326 13327 13328 this.$lightbox.find('.lb-loader, .lb-close').on('click keyup', function(e) { 13329 // If mouse click OR 'enter' or 'space' keypress, close LB 13330 if ( 13331 e.type === 'click' || (e.type === 'keyup' && (e.which === 13 || e.which === 32))) { 13332 self.end(); 13333 return false; 13334 } 13335 }); 13336 }; 13337 13338 // Show overlay and lightbox. If the image is part of a set, add siblings to album array. 13339 Lightbox.prototype.start = function($link) { 13340 var self = this; 13341 var $window = $(window); 13342 13343 $window.on('resize', $.proxy(this.sizeOverlay, this)); 13344 13345 this.sizeOverlay(); 13346 13347 this.album = []; 13348 var imageNumber = 0; 13349 13350 function addToAlbum($link) { 13351 self.album.push({ 13352 alt: $link.attr('data-alt'), 13353 link: $link.attr('href'), 13354 title: $link.attr('data-title') || $link.attr('title') 13355 }); 13356 } 13357 13358 // Support both data-lightbox attribute and rel attribute implementations 13359 var dataLightboxValue = $link.attr('data-lightbox'); 13360 var $links; 13361 13362 if (dataLightboxValue) { 13363 $links = $($link.prop('tagName') + '[data-lightbox="' + dataLightboxValue + '"]'); 13364 for (var i = 0; i < $links.length; i = ++i) { 13365 addToAlbum($($links[i])); 13366 if ($links[i] === $link[0]) { 13367 imageNumber = i; 13368 } 13369 } 13370 } else { 13371 if ($link.attr('rel') === 'lightbox') { 13372 // If image is not part of a set 13373 addToAlbum($link); 13374 } else { 13375 // If image is part of a set 13376 $links = $($link.prop('tagName') + '[rel="' + $link.attr('rel') + '"]'); 13377 for (var j = 0; j < $links.length; j = ++j) { 13378 addToAlbum($($links[j])); 13379 if ($links[j] === $link[0]) { 13380 imageNumber = j; 13381 } 13382 } 13383 } 13384 } 13385 13386 // Position Lightbox 13387 var top = $window.scrollTop() + this.options.positionFromTop; 13388 var left = $window.scrollLeft(); 13389 this.$lightbox.css({ 13390 top: top + 'px', 13391 left: left + 'px' 13392 }).fadeIn(this.options.fadeDuration); 13393 13394 // Disable scrolling of the page while open 13395 if (this.options.disableScrolling) { 13396 $('body').addClass('lb-disable-scrolling'); 13397 } 13398 13399 this.changeImage(imageNumber); 13400 }; 13401 13402 // Hide most UI elements in preparation for the animated resizing of the lightbox. 13403 Lightbox.prototype.changeImage = function(imageNumber) { 13404 var self = this; 13405 var filename = this.album[imageNumber].link; 13406 var filetype = filename.split('.').slice(-1)[0]; 13407 var $image = this.$lightbox.find('.lb-image'); 13408 13409 // Disable keyboard nav during transitions 13410 this.disableKeyboardNav(); 13411 13412 // Show loading state 13413 this.$overlay.fadeIn(this.options.fadeDuration); 13414 $('.lb-loader').fadeIn('slow'); 13415 this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide(); 13416 this.$outerContainer.addClass('animating'); 13417 13418 // When image to show is preloaded, we send the width and height to sizeContainer() 13419 var preloader = new Image(); 13420 preloader.onload = function() { 13421 var $preloader; 13422 var imageHeight; 13423 var imageWidth; 13424 var maxImageHeight; 13425 var maxImageWidth; 13426 var windowHeight; 13427 var windowWidth; 13428 13429 $image.attr({ 13430 'alt': self.album[imageNumber].alt, 13431 'src': filename 13432 }); 13433 13434 $preloader = $(preloader); 13435 13436 $image.width(preloader.width); 13437 $image.height(preloader.height); 13438 13439 var aspectRatio = preloader.width / preloader.height; 13440 13441 windowWidth = $(window).width(); 13442 windowHeight = $(window).height(); 13443 13444 // Calculate the max image dimensions for the current viewport. 13445 // Take into account the border around the image and an additional 10px gutter on each side. 13446 maxImageWidth = windowWidth - self.containerPadding.left - self.containerPadding.right - self.imageBorderWidth.left - self.imageBorderWidth.right - 20; 13447 maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - self.options.positionFromTop - 70; 13448 13449 /* 13450 Since many SVGs have small intrinsic dimensions, but they support scaling 13451 up without quality loss because of their vector format, max out their 13452 size inside the viewport. 13453 */ 13454 if (filetype === 'svg') { 13455 if (aspectRatio >= 1) { 13456 imageWidth = maxImageWidth; 13457 imageHeight = parseInt(maxImageWidth / aspectRatio, 10); 13458 } else { 13459 imageWidth = parseInt(maxImageHeight / aspectRatio, 10); 13460 imageHeight = maxImageHeight; 13461 } 13462 $image.width(imageWidth); 13463 $image.height(imageHeight); 13464 13465 } else { 13466 13467 // Fit image inside the viewport. 13468 if (self.options.fitImagesInViewport) { 13469 13470 // Check if image size is larger then maxWidth|maxHeight in settings 13471 if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) { 13472 maxImageWidth = self.options.maxWidth; 13473 } 13474 if (self.options.maxHeight && self.options.maxHeight < maxImageHeight) { 13475 maxImageHeight = self.options.maxHeight; 13476 } 13477 13478 } else { 13479 maxImageWidth = self.options.maxWidth || preloader.width || maxImageWidth; 13480 maxImageHeight = self.options.maxHeight || preloader.height || maxImageHeight; 13481 } 13482 13483 // Is the current image's width or height is greater than the maxImageWidth or maxImageHeight 13484 // option than we need to size down while maintaining the aspect ratio. 13485 if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) { 13486 if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) { 13487 imageWidth = maxImageWidth; 13488 imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10); 13489 $image.width(imageWidth); 13490 $image.height(imageHeight); 13491 } else { 13492 imageHeight = maxImageHeight; 13493 imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10); 13494 $image.width(imageWidth); 13495 $image.height(imageHeight); 13496 } 13497 } 13498 } 13499 13500 self.sizeContainer($image.width(), $image.height()); 13501 }; 13502 13503 // Preload image before showing 13504 preloader.src = this.album[imageNumber].link; 13505 this.currentImageIndex = imageNumber; 13506 }; 13507 13508 // Stretch overlay to fit the viewport 13509 Lightbox.prototype.sizeOverlay = function() { 13510 var self = this; 13511 /* 13512 We use a setTimeout 0 to pause JS execution and let the rendering catch-up. 13513 Why do this? If the `disableScrolling` option is set to true, a class is added to the body 13514 tag that disables scrolling and hides the scrollbar. We want to make sure the scrollbar is 13515 hidden before we measure the document width, as the presence of the scrollbar will affect the 13516 number. 13517 */ 13518 setTimeout(function() { 13519 self.$overlay 13520 .width($(document).width()) 13521 .height($(document).height()); 13522 13523 }, 0); 13524 }; 13525 13526 // Animate the size of the lightbox to fit the image we are showing 13527 // This method also shows the the image. 13528 Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) { 13529 var self = this; 13530 13531 var oldWidth = this.$outerContainer.outerWidth(); 13532 var oldHeight = this.$outerContainer.outerHeight(); 13533 var newWidth = imageWidth + this.containerPadding.left + this.containerPadding.right + this.imageBorderWidth.left + this.imageBorderWidth.right; 13534 var newHeight = imageHeight + this.containerPadding.top + this.containerPadding.bottom + this.imageBorderWidth.top + this.imageBorderWidth.bottom; 13535 13536 function postResize() { 13537 self.$lightbox.find('.lb-dataContainer').width(newWidth); 13538 self.$lightbox.find('.lb-prevLink').height(newHeight); 13539 self.$lightbox.find('.lb-nextLink').height(newHeight); 13540 13541 // Set focus on one of the two root nodes so keyboard events are captured. 13542 self.$overlay.trigger('focus'); 13543 13544 self.showImage(); 13545 } 13546 13547 if (oldWidth !== newWidth || oldHeight !== newHeight) { 13548 this.$outerContainer.animate({ 13549 width: newWidth, 13550 height: newHeight 13551 }, this.options.resizeDuration, 'swing', function() { 13552 postResize(); 13553 }); 13554 } else { 13555 postResize(); 13556 } 13557 }; 13558 13559 // Display the image and its details and begin preload neighboring images. 13560 Lightbox.prototype.showImage = function() { 13561 this.$lightbox.find('.lb-loader').stop(true).hide(); 13562 this.$lightbox.find('.lb-image').fadeIn(this.options.imageFadeDuration); 13563 13564 this.updateNav(); 13565 this.updateDetails(); 13566 this.preloadNeighboringImages(); 13567 this.enableKeyboardNav(); 13568 }; 13569 13570 // Display previous and next navigation if appropriate. 13571 Lightbox.prototype.updateNav = function() { 13572 // Check to see if the browser supports touch events. If so, we take the conservative approach 13573 // and assume that mouse hover events are not supported and always show prev/next navigation 13574 // arrows in image sets. 13575 var alwaysShowNav = false; 13576 try { 13577 document.createEvent('TouchEvent'); 13578 alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false; 13579 } catch (e) {} 13580 13581 this.$lightbox.find('.lb-nav').show(); 13582 13583 if (this.album.length > 1) { 13584 if (this.options.wrapAround) { 13585 if (alwaysShowNav) { 13586 this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1'); 13587 } 13588 this.$lightbox.find('.lb-prev, .lb-next').show(); 13589 } else { 13590 if (this.currentImageIndex > 0) { 13591 this.$lightbox.find('.lb-prev').show(); 13592 if (alwaysShowNav) { 13593 this.$lightbox.find('.lb-prev').css('opacity', '1'); 13594 } 13595 } 13596 if (this.currentImageIndex < this.album.length - 1) { 13597 this.$lightbox.find('.lb-next').show(); 13598 if (alwaysShowNav) { 13599 this.$lightbox.find('.lb-next').css('opacity', '1'); 13600 } 13601 } 13602 } 13603 } 13604 }; 13605 13606 // Display caption, image number, and closing button. 13607 Lightbox.prototype.updateDetails = function() { 13608 var self = this; 13609 13610 // Enable anchor clicks in the injected caption html. 13611 // Thanks Nate Wright for the fix. @https://github.com/NateWr 13612 if (typeof this.album[this.currentImageIndex].title !== 'undefined' && 13613 this.album[this.currentImageIndex].title !== '') { 13614 var $caption = this.$lightbox.find('.lb-caption'); 13615 if (this.options.sanitizeTitle) { 13616 $caption.text(this.album[this.currentImageIndex].title); 13617 } else { 13618 $caption.html(this.album[this.currentImageIndex].title); 13619 } 13620 $caption.fadeIn('fast'); 13621 } 13622 13623 if (this.album.length > 1 && this.options.showImageNumberLabel) { 13624 var labelText = this.imageCountLabel(this.currentImageIndex + 1, this.album.length); 13625 this.$lightbox.find('.lb-number').text(labelText).fadeIn('fast'); 13626 } else { 13627 this.$lightbox.find('.lb-number').hide(); 13628 } 13629 13630 this.$outerContainer.removeClass('animating'); 13631 13632 this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function() { 13633 return self.sizeOverlay(); 13634 }); 13635 }; 13636 13637 // Preload previous and next images in set. 13638 Lightbox.prototype.preloadNeighboringImages = function() { 13639 if (this.album.length > this.currentImageIndex + 1) { 13640 var preloadNext = new Image(); 13641 preloadNext.src = this.album[this.currentImageIndex + 1].link; 13642 } 13643 if (this.currentImageIndex > 0) { 13644 var preloadPrev = new Image(); 13645 preloadPrev.src = this.album[this.currentImageIndex - 1].link; 13646 } 13647 }; 13648 13649 Lightbox.prototype.enableKeyboardNav = function() { 13650 this.$lightbox.on('keyup.keyboard', $.proxy(this.keyboardAction, this)); 13651 this.$overlay.on('keyup.keyboard', $.proxy(this.keyboardAction, this)); 13652 }; 13653 13654 Lightbox.prototype.disableKeyboardNav = function() { 13655 this.$lightbox.off('.keyboard'); 13656 this.$overlay.off('.keyboard'); 13657 }; 13658 13659 Lightbox.prototype.keyboardAction = function(event) { 13660 var KEYCODE_ESC = 27; 13661 var KEYCODE_LEFTARROW = 37; 13662 var KEYCODE_RIGHTARROW = 39; 13663 13664 var keycode = event.keyCode; 13665 if (keycode === KEYCODE_ESC) { 13666 // Prevent bubbling so as to not affect other components on the page. 13667 event.stopPropagation(); 13668 this.end(); 13669 } else if (keycode === KEYCODE_LEFTARROW) { 13670 if (this.currentImageIndex !== 0) { 13671 this.changeImage(this.currentImageIndex - 1); 13672 } else if (this.options.wrapAround && this.album.length > 1) { 13673 this.changeImage(this.album.length - 1); 13674 } 13675 } else if (keycode === KEYCODE_RIGHTARROW) { 13676 if (this.currentImageIndex !== this.album.length - 1) { 13677 this.changeImage(this.currentImageIndex + 1); 13678 } else if (this.options.wrapAround && this.album.length > 1) { 13679 this.changeImage(0); 13680 } 13681 } 13682 }; 13683 13684 // Closing time. :-( 13685 Lightbox.prototype.end = function() { 13686 this.disableKeyboardNav(); 13687 $(window).off('resize', this.sizeOverlay); 13688 this.$lightbox.fadeOut(this.options.fadeDuration); 13689 this.$overlay.fadeOut(this.options.fadeDuration); 13690 13691 if (this.options.disableScrolling) { 13692 $('body').removeClass('lb-disable-scrolling'); 13693 } 13694 }; 13695 13696 return new Lightbox(); 13697})); 13698 13699 13700/***/ }), 13701
vendor: 544,380 bytes, lines 13702-30913
13702/***/ "./node_modules/lodash/lodash.js": 13703/*!***************************************!*\ 13704 !*** ./node_modules/lodash/lodash.js ***! 13705 \***************************************/ 13706/***/ (function(module, exports, __webpack_require__) { 13707 13708/* module decorator */ module = __webpack_require__.nmd(module); 13709var __WEBPACK_AMD_DEFINE_RESULT__;/** 13710 * @license 13711 * Lodash <https://lodash.com/> 13712 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 13713 * Released under MIT license <https://lodash.com/license> 13714 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 13715 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 13716 */ 13717;(function() { 13718 13719 /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 13720 var undefined; 13721 13722 /** Used as the semantic version number. */ 13723 var VERSION = '4.17.21'; 13724 13725 /** Used as the size to enable large array optimizations. */ 13726 var LARGE_ARRAY_SIZE = 200; 13727 13728 /** Error message constants. */ 13729 var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', 13730 FUNC_ERROR_TEXT = 'Expected a function', 13731 INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; 13732 13733 /** Used to stand-in for `undefined` hash values. */ 13734 var HASH_UNDEFINED = '__lodash_hash_undefined__'; 13735 13736 /** Used as the maximum memoize cache size. */ 13737 var MAX_MEMOIZE_SIZE = 500; 13738 13739 /** Used as the internal argument placeholder. */ 13740 var PLACEHOLDER = '__lodash_placeholder__'; 13741 13742 /** Used to compose bitmasks for cloning. */ 13743 var CLONE_DEEP_FLAG = 1, 13744 CLONE_FLAT_FLAG = 2, 13745 CLONE_SYMBOLS_FLAG = 4; 13746 13747 /** Used to compose bitmasks for value comparisons. */ 13748 var COMPARE_PARTIAL_FLAG = 1, 13749 COMPARE_UNORDERED_FLAG = 2; 13750 13751 /** Used to compose bitmasks for function metadata. */ 13752 var WRAP_BIND_FLAG = 1, 13753 WRAP_BIND_KEY_FLAG = 2, 13754 WRAP_CURRY_BOUND_FLAG = 4, 13755 WRAP_CURRY_FLAG = 8, 13756 WRAP_CURRY_RIGHT_FLAG = 16, 13757 WRAP_PARTIAL_FLAG = 32, 13758 WRAP_PARTIAL_RIGHT_FLAG = 64, 13759 WRAP_ARY_FLAG = 128, 13760 WRAP_REARG_FLAG = 256, 13761 WRAP_FLIP_FLAG = 512; 13762 13763 /** Used as default options for `_.truncate`. */ 13764 var DEFAULT_TRUNC_LENGTH = 30, 13765 DEFAULT_TRUNC_OMISSION = '...'; 13766 13767 /** Used to detect hot functions by number of calls within a span of milliseconds. */ 13768 var HOT_COUNT = 800, 13769 HOT_SPAN = 16; 13770 13771 /** Used to indicate the type of lazy iteratees. */ 13772 var LAZY_FILTER_FLAG = 1, 13773 LAZY_MAP_FLAG = 2, 13774 LAZY_WHILE_FLAG = 3; 13775 13776 /** Used as references for various `Number` constants. */ 13777 var INFINITY = 1 / 0, 13778 MAX_SAFE_INTEGER = 9007199254740991, 13779 MAX_INTEGER = 1.7976931348623157e+308, 13780 NAN = 0 / 0; 13781 13782 /** Used as references for the maximum length and index of an array. */ 13783 var MAX_ARRAY_LENGTH = 4294967295, 13784 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, 13785 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; 13786 13787 /** Used to associate wrap methods with their bit flags. */ 13788 var wrapFlags = [ 13789 ['ary', WRAP_ARY_FLAG], 13790 ['bind', WRAP_BIND_FLAG], 13791 ['bindKey', WRAP_BIND_KEY_FLAG], 13792 ['curry', WRAP_CURRY_FLAG], 13793 ['curryRight', WRAP_CURRY_RIGHT_FLAG], 13794 ['flip', WRAP_FLIP_FLAG], 13795 ['partial', WRAP_PARTIAL_FLAG], 13796 ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], 13797 ['rearg', WRAP_REARG_FLAG] 13798 ]; 13799 13800 /** `Object#toString` result references. */ 13801 var argsTag = '[object Arguments]', 13802 arrayTag = '[object Array]', 13803 asyncTag = '[object AsyncFunction]', 13804 boolTag = '[object Boolean]', 13805 dateTag = '[object Date]', 13806 domExcTag = '[object DOMException]', 13807 errorTag = '[object Error]', 13808 funcTag = '[object Function]', 13809 genTag = '[object GeneratorFunction]', 13810 mapTag = '[object Map]', 13811 numberTag = '[object Number]', 13812 nullTag = '[object Null]', 13813 objectTag = '[object Object]', 13814 promiseTag = '[object Promise]', 13815 proxyTag = '[object Proxy]', 13816 regexpTag = '[object RegExp]', 13817 setTag = '[object Set]', 13818 stringTag = '[object String]', 13819 symbolTag = '[object Symbol]', 13820 undefinedTag = '[object Undefined]', 13821 weakMapTag = '[object WeakMap]', 13822 weakSetTag = '[object WeakSet]'; 13823 13824 var arrayBufferTag = '[object ArrayBuffer]', 13825 dataViewTag = '[object DataView]', 13826 float32Tag = '[object Float32Array]', 13827 float64Tag = '[object Float64Array]', 13828 int8Tag = '[object Int8Array]', 13829 int16Tag = '[object Int16Array]', 13830 int32Tag = '[object Int32Array]', 13831 uint8Tag = '[object Uint8Array]', 13832 uint8ClampedTag = '[object Uint8ClampedArray]', 13833 uint16Tag = '[object Uint16Array]', 13834 uint32Tag = '[object Uint32Array]'; 13835 13836 /** Used to match empty string literals in compiled template source. */ 13837 var reEmptyStringLeading = /\b__p \+= '';/g, 13838 reEmptyStringMiddle = /\b(__p \+=) '' \+/g, 13839 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 13840 13841 /** Used to match HTML entities and HTML characters. */ 13842 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, 13843 reUnescapedHtml = /[&<>"']/g, 13844 reHasEscapedHtml = RegExp(reEscapedHtml.source), 13845 reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 13846 13847 /** Used to match template delimiters. */ 13848 var reEscape = /<%-([\s\S]+?)%>/g, 13849 reEvaluate = /<%([\s\S]+?)%>/g, 13850 reInterpolate = /<%=([\s\S]+?)%>/g; 13851 13852 /** Used to match property names within property paths. */ 13853 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, 13854 reIsPlainProp = /^\w*$/, 13855 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 13856 13857 /** 13858 * Used to match `RegExp` 13859 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). 13860 */ 13861 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, 13862 reHasRegExpChar = RegExp(reRegExpChar.source); 13863 13864 /** Used to match leading whitespace. */ 13865 var reTrimStart = /^\s+/; 13866 13867 /** Used to match a single whitespace character. */ 13868 var reWhitespace = /\s/; 13869 13870 /** Used to match wrap detail comments. */ 13871 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, 13872 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, 13873 reSplitDetails = /,? & /; 13874 13875 /** Used to match words composed of alphanumeric characters. */ 13876 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 13877 13878 /** 13879 * Used to validate the `validate` option in `_.template` variable. 13880 * 13881 * Forbids characters which could potentially change the meaning of the function argument definition: 13882 * - "()," (modification of function parameters) 13883 * - "=" (default value) 13884 * - "[]{}" (destructuring of function parameters) 13885 * - "/" (beginning of a comment) 13886 * - whitespace 13887 */ 13888 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; 13889 13890 /** Used to match backslashes in property paths. */ 13891 var reEscapeChar = /\\(\\)?/g; 13892 13893 /** 13894 * Used to match 13895 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). 13896 */ 13897 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 13898 13899 /** Used to match `RegExp` flags from their coerced string values. */ 13900 var reFlags = /\w*$/; 13901 13902 /** Used to detect bad signed hexadecimal string values. */ 13903 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 13904 13905 /** Used to detect binary string values. */ 13906 var reIsBinary = /^0b[01]+$/i; 13907 13908 /** Used to detect host constructors (Safari). */ 13909 var reIsHostCtor = /^\[object .+?Constructor\]$/; 13910 13911 /** Used to detect octal string values. */ 13912 var reIsOctal = /^0o[0-7]+$/i; 13913 13914 /** Used to detect unsigned integer values. */ 13915 var reIsUint = /^(?:0|[1-9]\d*)$/; 13916 13917 /** Used to match Latin Unicode letters (excluding mathematical operators). */ 13918 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 13919 13920 /** Used to ensure capturing order of template delimiters. */ 13921 var reNoMatch = /($^)/; 13922 13923 /** Used to match unescaped characters in compiled string literals. */ 13924 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 13925 13926 /** Used to compose unicode character classes. */ 13927 var rsAstralRange = '\\ud800-\\udfff', 13928 rsComboMarksRange = '\\u0300-\\u036f', 13929 reComboHalfMarksRange = '\\ufe20-\\ufe2f', 13930 rsComboSymbolsRange = '\\u20d0-\\u20ff', 13931 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, 13932 rsDingbatRange = '\\u2700-\\u27bf', 13933 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', 13934 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', 13935 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', 13936 rsPunctuationRange = '\\u2000-\\u206f', 13937 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', 13938 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', 13939 rsVarRange = '\\ufe0e\\ufe0f', 13940 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 13941 13942 /** Used to compose unicode capture groups. */ 13943 var rsApos = "['\u2019]", 13944 rsAstral = '[' + rsAstralRange + ']', 13945 rsBreak = '[' + rsBreakRange + ']', 13946 rsCombo = '[' + rsComboRange + ']', 13947 rsDigits = '\\d+', 13948 rsDingbat = '[' + rsDingbatRange + ']', 13949 rsLower = '[' + rsLowerRange + ']', 13950 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', 13951 rsFitz = '\\ud83c[\\udffb-\\udfff]', 13952 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', 13953 rsNonAstral = '[^' + rsAstralRange + ']', 13954 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', 13955 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', 13956 rsUpper = '[' + rsUpperRange + ']', 13957 rsZWJ = '\\u200d'; 13958 13959 /** Used to compose unicode regexes. */ 13960 var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', 13961 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', 13962 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', 13963 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', 13964 reOptMod = rsModifier + '?', 13965 rsOptVar = '[' + rsVarRange + ']?', 13966 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', 13967 rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', 13968 rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', 13969 rsSeq = rsOptVar + reOptMod + rsOptJoin, 13970 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, 13971 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; 13972 13973 /** Used to match apostrophes. */ 13974 var reApos = RegExp(rsApos, 'g'); 13975 13976 /** 13977 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and 13978 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). 13979 */ 13980 var reComboMark = RegExp(rsCombo, 'g'); 13981 13982 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ 13983 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); 13984 13985 /** Used to match complex or compound words. */ 13986 var reUnicodeWord = RegExp([ 13987 rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', 13988 rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', 13989 rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, 13990 rsUpper + '+' + rsOptContrUpper, 13991 rsOrdUpper, 13992 rsOrdLower, 13993 rsDigits, 13994 rsEmoji 13995 ].join('|'), 'g'); 13996 13997 /** 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/). */ 13998 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); 13999 14000 /** Used to detect strings that need a more robust regexp to match words. */ 14001 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 ]/; 14002 14003 /** Used to assign default `context` object properties. */ 14004 var contextProps = [ 14005 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 14006 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 14007 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 14008 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 14009 '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' 14010 ]; 14011 14012 /** Used to make template sourceURLs easier to identify. */ 14013 var templateCounter = -1; 14014 14015 /** Used to identify `toStringTag` values of typed arrays. */ 14016 var typedArrayTags = {}; 14017 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = 14018 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = 14019 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = 14020 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = 14021 typedArrayTags[uint32Tag] = true; 14022 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = 14023 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = 14024 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = 14025 typedArrayTags[errorTag] = typedArrayTags[funcTag] = 14026 typedArrayTags[mapTag] = typedArrayTags[numberTag] = 14027 typedArrayTags[objectTag] = typedArrayTags[regexpTag] = 14028 typedArrayTags[setTag] = typedArrayTags[stringTag] = 14029 typedArrayTags[weakMapTag] = false; 14030 14031 /** Used to identify `toStringTag` values supported by `_.clone`. */ 14032 var cloneableTags = {}; 14033 cloneableTags[argsTag] = cloneableTags[arrayTag] = 14034 cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = 14035 cloneableTags[boolTag] = cloneableTags[dateTag] = 14036 cloneableTags[float32Tag] = cloneableTags[float64Tag] = 14037 cloneableTags[int8Tag] = cloneableTags[int16Tag] = 14038 cloneableTags[int32Tag] = cloneableTags[mapTag] = 14039 cloneableTags[numberTag] = cloneableTags[objectTag] = 14040 cloneableTags[regexpTag] = cloneableTags[setTag] = 14041 cloneableTags[stringTag] = cloneableTags[symbolTag] = 14042 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = 14043 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 14044 cloneableTags[errorTag] = cloneableTags[funcTag] = 14045 cloneableTags[weakMapTag] = false; 14046 14047 /** Used to map Latin Unicode letters to basic Latin letters. */ 14048 var deburredLetters = { 14049 // Latin-1 Supplement block. 14050 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', 14051 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', 14052 '\xc7': 'C', '\xe7': 'c', 14053 '\xd0': 'D', '\xf0': 'd', 14054 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', 14055 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', 14056 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', 14057 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', 14058 '\xd1': 'N', '\xf1': 'n', 14059 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', 14060 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', 14061 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', 14062 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', 14063 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', 14064 '\xc6': 'Ae', '\xe6': 'ae', 14065 '\xde': 'Th', '\xfe': 'th', 14066 '\xdf': 'ss', 14067 // Latin Extended-A block. 14068 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', 14069 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', 14070 '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', 14071 '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', 14072 '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', 14073 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', 14074 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', 14075 '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', 14076 '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', 14077 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', 14078 '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', 14079 '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', 14080 '\u0134': 'J', '\u0135': 'j', 14081 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', 14082 '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', 14083 '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', 14084 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', 14085 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', 14086 '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', 14087 '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', 14088 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', 14089 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', 14090 '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', 14091 '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', 14092 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', 14093 '\u0163': 't', '\u0165': 't', '\u0167': 't', 14094 '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', 14095 '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', 14096 '\u0174': 'W', '\u0175': 'w', 14097 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', 14098 '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', 14099 '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', 14100 '\u0132': 'IJ', '\u0133': 'ij', 14101 '\u0152': 'Oe', '\u0153': 'oe', 14102 '\u0149': "'n", '\u017f': 's' 14103 }; 14104 14105 /** Used to map characters to HTML entities. */ 14106 var htmlEscapes = { 14107 '&': '&', 14108 '<': '<', 14109 '>': '>', 14110 '"': '"', 14111 "'": ''' 14112 }; 14113 14114 /** Used to map HTML entities to characters. */ 14115 var htmlUnescapes = { 14116 '&': '&', 14117 '<': '<', 14118 '>': '>', 14119 '"': '"', 14120 ''': "'" 14121 }; 14122 14123 /** Used to escape characters for inclusion in compiled string literals. */ 14124 var stringEscapes = { 14125 '\\': '\\', 14126 "'": "'", 14127 '\n': 'n', 14128 '\r': 'r', 14129 '\u2028': 'u2028', 14130 '\u2029': 'u2029' 14131 }; 14132 14133 /** Built-in method references without a dependency on `root`. */ 14134 var freeParseFloat = parseFloat, 14135 freeParseInt = parseInt; 14136 14137 /** Detect free variable `global` from Node.js. */ 14138 var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; 14139 14140 /** Detect free variable `self`. */ 14141 var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 14142 14143 /** Used as a reference to the global object. */ 14144 var root = freeGlobal || freeSelf || Function('return this')(); 14145 14146 /** Detect free variable `exports`. */ 14147 var freeExports = true && exports && !exports.nodeType && exports; 14148 14149 /** Detect free variable `module`. */ 14150 var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; 14151 14152 /** Detect the popular CommonJS extension `module.exports`. */ 14153 var moduleExports = freeModule && freeModule.exports === freeExports; 14154 14155 /** Detect free variable `process` from Node.js. */ 14156 var freeProcess = moduleExports && freeGlobal.process; 14157 14158 /** Used to access faster Node.js helpers. */ 14159 var nodeUtil = (function() { 14160 try { 14161 // Use `util.types` for Node.js 10+. 14162 var types = freeModule && freeModule.require && freeModule.require('util').types; 14163 14164 if (types) { 14165 return types; 14166 } 14167 14168 // Legacy `process.binding('util')` for Node.js < 10. 14169 return freeProcess && freeProcess.binding && freeProcess.binding('util'); 14170 } catch (e) {} 14171 }()); 14172 14173 /* Node.js helper references. */ 14174 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, 14175 nodeIsDate = nodeUtil && nodeUtil.isDate, 14176 nodeIsMap = nodeUtil && nodeUtil.isMap, 14177 nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, 14178 nodeIsSet = nodeUtil && nodeUtil.isSet, 14179 nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 14180 14181 /*--------------------------------------------------------------------------*/ 14182 14183 /** 14184 * A faster alternative to `Function#apply`, this function invokes `func` 14185 * with the `this` binding of `thisArg` and the arguments of `args`. 14186 * 14187 * @private 14188 * @param {Function} func The function to invoke. 14189 * @param {*} thisArg The `this` binding of `func`. 14190 * @param {Array} args The arguments to invoke `func` with. 14191 * @returns {*} Returns the result of `func`. 14192 */ 14193 function apply(func, thisArg, args) { 14194 switch (args.length) { 14195 case 0: return func.call(thisArg); 14196 case 1: return func.call(thisArg, args[0]); 14197 case 2: return func.call(thisArg, args[0], args[1]); 14198 case 3: return func.call(thisArg, args[0], args[1], args[2]); 14199 } 14200 return func.apply(thisArg, args); 14201 } 14202 14203 /** 14204 * A specialized version of `baseAggregator` for arrays. 14205 * 14206 * @private 14207 * @param {Array} [array] The array to iterate over. 14208 * @param {Function} setter The function to set `accumulator` values. 14209 * @param {Function} iteratee The iteratee to transform keys. 14210 * @param {Object} accumulator The initial aggregated object. 14211 * @returns {Function} Returns `accumulator`. 14212 */ 14213 function arrayAggregator(array, setter, iteratee, accumulator) { 14214 var index = -1, 14215 length = array == null ? 0 : array.length; 14216 14217 while (++index < length) { 14218 var value = array[index]; 14219 setter(accumulator, value, iteratee(value), array); 14220 } 14221 return accumulator; 14222 } 14223 14224 /** 14225 * A specialized version of `_.forEach` for arrays without support for 14226 * iteratee shorthands. 14227 * 14228 * @private 14229 * @param {Array} [array] The array to iterate over. 14230 * @param {Function} iteratee The function invoked per iteration. 14231 * @returns {Array} Returns `array`. 14232 */ 14233 function arrayEach(array, iteratee) { 14234 var index = -1, 14235 length = array == null ? 0 : array.length; 14236 14237 while (++index < length) { 14238 if (iteratee(array[index], index, array) === false) { 14239 break; 14240 } 14241 } 14242 return array; 14243 } 14244 14245 /** 14246 * A specialized version of `_.forEachRight` for arrays without support for 14247 * iteratee shorthands. 14248 * 14249 * @private 14250 * @param {Array} [array] The array to iterate over. 14251 * @param {Function} iteratee The function invoked per iteration. 14252 * @returns {Array} Returns `array`. 14253 */ 14254 function arrayEachRight(array, iteratee) { 14255 var length = array == null ? 0 : array.length; 14256 14257 while (length--) { 14258 if (iteratee(array[length], length, array) === false) { 14259 break; 14260 } 14261 } 14262 return array; 14263 } 14264 14265 /** 14266 * A specialized version of `_.every` for arrays without support for 14267 * iteratee shorthands. 14268 * 14269 * @private 14270 * @param {Array} [array] The array to iterate over. 14271 * @param {Function} predicate The function invoked per iteration. 14272 * @returns {boolean} Returns `true` if all elements pass the predicate check, 14273 * else `false`. 14274 */ 14275 function arrayEvery(array, predicate) { 14276 var index = -1, 14277 length = array == null ? 0 : array.length; 14278 14279 while (++index < length) { 14280 if (!predicate(array[index], index, array)) { 14281 return false; 14282 } 14283 } 14284 return true; 14285 } 14286 14287 /** 14288 * A specialized version of `_.filter` for arrays without support for 14289 * iteratee shorthands. 14290 * 14291 * @private 14292 * @param {Array} [array] The array to iterate over. 14293 * @param {Function} predicate The function invoked per iteration. 14294 * @returns {Array} Returns the new filtered array. 14295 */ 14296 function arrayFilter(array, predicate) { 14297 var index = -1, 14298 length = array == null ? 0 : array.length, 14299 resIndex = 0, 14300 result = []; 14301 14302 while (++index < length) { 14303 var value = array[index]; 14304 if (predicate(value, index, array)) { 14305 result[resIndex++] = value; 14306 } 14307 } 14308 return result; 14309 } 14310 14311 /** 14312 * A specialized version of `_.includes` for arrays without support for 14313 * specifying an index to search from. 14314 * 14315 * @private 14316 * @param {Array} [array] The array to inspect. 14317 * @param {*} target The value to search for. 14318 * @returns {boolean} Returns `true` if `target` is found, else `false`. 14319 */ 14320 function arrayIncludes(array, value) { 14321 var length = array == null ? 0 : array.length; 14322 return !!length && baseIndexOf(array, value, 0) > -1; 14323 } 14324 14325 /** 14326 * This function is like `arrayIncludes` except that it accepts a comparator. 14327 * 14328 * @private 14329 * @param {Array} [array] The array to inspect. 14330 * @param {*} target The value to search for. 14331 * @param {Function} comparator The comparator invoked per element. 14332 * @returns {boolean} Returns `true` if `target` is found, else `false`. 14333 */ 14334 function arrayIncludesWith(array, value, comparator) { 14335 var index = -1, 14336 length = array == null ? 0 : array.length; 14337 14338 while (++index < length) { 14339 if (comparator(value, array[index])) { 14340 return true; 14341 } 14342 } 14343 return false; 14344 } 14345 14346 /** 14347 * A specialized version of `_.map` for arrays without support for iteratee 14348 * shorthands. 14349 * 14350 * @private 14351 * @param {Array} [array] The array to iterate over. 14352 * @param {Function} iteratee The function invoked per iteration. 14353 * @returns {Array} Returns the new mapped array. 14354 */ 14355 function arrayMap(array, iteratee) { 14356 var index = -1, 14357 length = array == null ? 0 : array.length, 14358 result = Array(length); 14359 14360 while (++index < length) { 14361 result[index] = iteratee(array[index], index, array); 14362 } 14363 return result; 14364 } 14365 14366 /** 14367 * Appends the elements of `values` to `array`. 14368 * 14369 * @private 14370 * @param {Array} array The array to modify. 14371 * @param {Array} values The values to append. 14372 * @returns {Array} Returns `array`. 14373 */ 14374 function arrayPush(array, values) { 14375 var index = -1, 14376 length = values.length, 14377 offset = array.length; 14378 14379 while (++index < length) { 14380 array[offset + index] = values[index]; 14381 } 14382 return array; 14383 } 14384 14385 /** 14386 * A specialized version of `_.reduce` for arrays without support for 14387 * iteratee shorthands. 14388 * 14389 * @private 14390 * @param {Array} [array] The array to iterate over. 14391 * @param {Function} iteratee The function invoked per iteration. 14392 * @param {*} [accumulator] The initial value. 14393 * @param {boolean} [initAccum] Specify using the first element of `array` as 14394 * the initial value. 14395 * @returns {*} Returns the accumulated value. 14396 */ 14397 function arrayReduce(array, iteratee, accumulator, initAccum) { 14398 var index = -1, 14399 length = array == null ? 0 : array.length; 14400 14401 if (initAccum && length) { 14402 accumulator = array[++index]; 14403 } 14404 while (++index < length) { 14405 accumulator = iteratee(accumulator, array[index], index, array); 14406 } 14407 return accumulator; 14408 } 14409 14410 /** 14411 * A specialized version of `_.reduceRight` for arrays without support for 14412 * iteratee shorthands. 14413 * 14414 * @private 14415 * @param {Array} [array] The array to iterate over. 14416 * @param {Function} iteratee The function invoked per iteration. 14417 * @param {*} [accumulator] The initial value. 14418 * @param {boolean} [initAccum] Specify using the last element of `array` as 14419 * the initial value. 14420 * @returns {*} Returns the accumulated value. 14421 */ 14422 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 14423 var length = array == null ? 0 : array.length; 14424 if (initAccum && length) { 14425 accumulator = array[--length]; 14426 } 14427 while (length--) { 14428 accumulator = iteratee(accumulator, array[length], length, array); 14429 } 14430 return accumulator; 14431 } 14432 14433 /** 14434 * A specialized version of `_.some` for arrays without support for iteratee 14435 * shorthands. 14436 * 14437 * @private 14438 * @param {Array} [array] The array to iterate over. 14439 * @param {Function} predicate The function invoked per iteration. 14440 * @returns {boolean} Returns `true` if any element passes the predicate check, 14441 * else `false`. 14442 */ 14443 function arraySome(array, predicate) { 14444 var index = -1, 14445 length = array == null ? 0 : array.length; 14446 14447 while (++index < length) { 14448 if (predicate(array[index], index, array)) { 14449 return true; 14450 } 14451 } 14452 return false; 14453 } 14454 14455 /** 14456 * Gets the size of an ASCII `string`. 14457 * 14458 * @private 14459 * @param {string} string The string inspect. 14460 * @returns {number} Returns the string size. 14461 */ 14462 var asciiSize = baseProperty('length'); 14463 14464 /** 14465 * Converts an ASCII `string` to an array. 14466 * 14467 * @private 14468 * @param {string} string The string to convert. 14469 * @returns {Array} Returns the converted array. 14470 */ 14471 function asciiToArray(string) { 14472 return string.split(''); 14473 } 14474 14475 /** 14476 * Splits an ASCII `string` into an array of its words. 14477 * 14478 * @private 14479 * @param {string} The string to inspect. 14480 * @returns {Array} Returns the words of `string`. 14481 */ 14482 function asciiWords(string) { 14483 return string.match(reAsciiWord) || []; 14484 } 14485 14486 /** 14487 * The base implementation of methods like `_.findKey` and `_.findLastKey`, 14488 * without support for iteratee shorthands, which iterates over `collection` 14489 * using `eachFunc`. 14490 * 14491 * @private 14492 * @param {Array|Object} collection The collection to inspect. 14493 * @param {Function} predicate The function invoked per iteration. 14494 * @param {Function} eachFunc The function to iterate over `collection`. 14495 * @returns {*} Returns the found element or its key, else `undefined`. 14496 */ 14497 function baseFindKey(collection, predicate, eachFunc) { 14498 var result; 14499 eachFunc(collection, function(value, key, collection) { 14500 if (predicate(value, key, collection)) { 14501 result = key; 14502 return false; 14503 } 14504 }); 14505 return result; 14506 } 14507 14508 /** 14509 * The base implementation of `_.findIndex` and `_.findLastIndex` without 14510 * support for iteratee shorthands. 14511 * 14512 * @private 14513 * @param {Array} array The array to inspect. 14514 * @param {Function} predicate The function invoked per iteration. 14515 * @param {number} fromIndex The index to search from. 14516 * @param {boolean} [fromRight] Specify iterating from right to left. 14517 * @returns {number} Returns the index of the matched value, else `-1`. 14518 */ 14519 function baseFindIndex(array, predicate, fromIndex, fromRight) { 14520 var length = array.length, 14521 index = fromIndex + (fromRight ? 1 : -1); 14522 14523 while ((fromRight ? index-- : ++index < length)) { 14524 if (predicate(array[index], index, array)) { 14525 return index; 14526 } 14527 } 14528 return -1; 14529 } 14530 14531 /** 14532 * The base implementation of `_.indexOf` without `fromIndex` bounds checks. 14533 * 14534 * @private 14535 * @param {Array} array The array to inspect. 14536 * @param {*} value The value to search for. 14537 * @param {number} fromIndex The index to search from. 14538 * @returns {number} Returns the index of the matched value, else `-1`. 14539 */ 14540 function baseIndexOf(array, value, fromIndex) { 14541 return value === value 14542 ? strictIndexOf(array, value, fromIndex) 14543 : baseFindIndex(array, baseIsNaN, fromIndex); 14544 } 14545 14546 /** 14547 * This function is like `baseIndexOf` except that it accepts a comparator. 14548 * 14549 * @private 14550 * @param {Array} array The array to inspect. 14551 * @param {*} value The value to search for. 14552 * @param {number} fromIndex The index to search from. 14553 * @param {Function} comparator The comparator invoked per element. 14554 * @returns {number} Returns the index of the matched value, else `-1`. 14555 */ 14556 function baseIndexOfWith(array, value, fromIndex, comparator) { 14557 var index = fromIndex - 1, 14558 length = array.length; 14559 14560 while (++index < length) { 14561 if (comparator(array[index], value)) { 14562 return index; 14563 } 14564 } 14565 return -1; 14566 } 14567 14568 /** 14569 * The base implementation of `_.isNaN` without support for number objects. 14570 * 14571 * @private 14572 * @param {*} value The value to check. 14573 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 14574 */ 14575 function baseIsNaN(value) { 14576 return value !== value; 14577 } 14578 14579 /** 14580 * The base implementation of `_.mean` and `_.meanBy` without support for 14581 * iteratee shorthands. 14582 * 14583 * @private 14584 * @param {Array} array The array to iterate over. 14585 * @param {Function} iteratee The function invoked per iteration. 14586 * @returns {number} Returns the mean. 14587 */ 14588 function baseMean(array, iteratee) { 14589 var length = array == null ? 0 : array.length; 14590 return length ? (baseSum(array, iteratee) / length) : NAN; 14591 } 14592 14593 /** 14594 * The base implementation of `_.property` without support for deep paths. 14595 * 14596 * @private 14597 * @param {string} key The key of the property to get. 14598 * @returns {Function} Returns the new accessor function. 14599 */ 14600 function baseProperty(key) { 14601 return function(object) { 14602 return object == null ? undefined : object[key]; 14603 }; 14604 } 14605 14606 /** 14607 * The base implementation of `_.propertyOf` without support for deep paths. 14608 * 14609 * @private 14610 * @param {Object} object The object to query. 14611 * @returns {Function} Returns the new accessor function. 14612 */ 14613 function basePropertyOf(object) { 14614 return function(key) { 14615 return object == null ? undefined : object[key]; 14616 }; 14617 } 14618 14619 /** 14620 * The base implementation of `_.reduce` and `_.reduceRight`, without support 14621 * for iteratee shorthands, which iterates over `collection` using `eachFunc`. 14622 * 14623 * @private 14624 * @param {Array|Object} collection The collection to iterate over. 14625 * @param {Function} iteratee The function invoked per iteration. 14626 * @param {*} accumulator The initial value. 14627 * @param {boolean} initAccum Specify using the first or last element of 14628 * `collection` as the initial value. 14629 * @param {Function} eachFunc The function to iterate over `collection`. 14630 * @returns {*} Returns the accumulated value. 14631 */ 14632 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 14633 eachFunc(collection, function(value, index, collection) { 14634 accumulator = initAccum 14635 ? (initAccum = false, value) 14636 : iteratee(accumulator, value, index, collection); 14637 }); 14638 return accumulator; 14639 } 14640 14641 /** 14642 * The base implementation of `_.sortBy` which uses `comparer` to define the 14643 * sort order of `array` and replaces criteria objects with their corresponding 14644 * values. 14645 * 14646 * @private 14647 * @param {Array} array The array to sort. 14648 * @param {Function} comparer The function to define sort order. 14649 * @returns {Array} Returns `array`. 14650 */ 14651 function baseSortBy(array, comparer) { 14652 var length = array.length; 14653 14654 array.sort(comparer); 14655 while (length--) { 14656 array[length] = array[length].value; 14657 } 14658 return array; 14659 } 14660 14661 /** 14662 * The base implementation of `_.sum` and `_.sumBy` without support for 14663 * iteratee shorthands. 14664 * 14665 * @private 14666 * @param {Array} array The array to iterate over. 14667 * @param {Function} iteratee The function invoked per iteration. 14668 * @returns {number} Returns the sum. 14669 */ 14670 function baseSum(array, iteratee) { 14671 var result, 14672 index = -1, 14673 length = array.length; 14674 14675 while (++index < length) { 14676 var current = iteratee(array[index]); 14677 if (current !== undefined) { 14678 result = result === undefined ? current : (result + current); 14679 } 14680 } 14681 return result; 14682 } 14683 14684 /** 14685 * The base implementation of `_.times` without support for iteratee shorthands 14686 * or max array length checks. 14687 * 14688 * @private 14689 * @param {number} n The number of times to invoke `iteratee`. 14690 * @param {Function} iteratee The function invoked per iteration. 14691 * @returns {Array} Returns the array of results. 14692 */ 14693 function baseTimes(n, iteratee) { 14694 var index = -1, 14695 result = Array(n); 14696 14697 while (++index < n) { 14698 result[index] = iteratee(index); 14699 } 14700 return result; 14701 } 14702 14703 /** 14704 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array 14705 * of key-value pairs for `object` corresponding to the property names of `props`. 14706 * 14707 * @private 14708 * @param {Object} object The object to query. 14709 * @param {Array} props The property names to get values for. 14710 * @returns {Object} Returns the key-value pairs. 14711 */ 14712 function baseToPairs(object, props) { 14713 return arrayMap(props, function(key) { 14714 return [key, object[key]]; 14715 }); 14716 } 14717 14718 /** 14719 * The base implementation of `_.trim`. 14720 * 14721 * @private 14722 * @param {string} string The string to trim. 14723 * @returns {string} Returns the trimmed string. 14724 */ 14725 function baseTrim(string) { 14726 return string 14727 ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') 14728 : string; 14729 } 14730 14731 /** 14732 * The base implementation of `_.unary` without support for storing metadata. 14733 * 14734 * @private 14735 * @param {Function} func The function to cap arguments for. 14736 * @returns {Function} Returns the new capped function. 14737 */ 14738 function baseUnary(func) { 14739 return function(value) { 14740 return func(value); 14741 }; 14742 } 14743 14744 /** 14745 * The base implementation of `_.values` and `_.valuesIn` which creates an 14746 * array of `object` property values corresponding to the property names 14747 * of `props`. 14748 * 14749 * @private 14750 * @param {Object} object The object to query. 14751 * @param {Array} props The property names to get values for. 14752 * @returns {Object} Returns the array of property values. 14753 */ 14754 function baseValues(object, props) { 14755 return arrayMap(props, function(key) { 14756 return object[key]; 14757 }); 14758 } 14759 14760 /** 14761 * Checks if a `cache` value for `key` exists. 14762 * 14763 * @private 14764 * @param {Object} cache The cache to query. 14765 * @param {string} key The key of the entry to check. 14766 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 14767 */ 14768 function cacheHas(cache, key) { 14769 return cache.has(key); 14770 } 14771 14772 /** 14773 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol 14774 * that is not found in the character symbols. 14775 * 14776 * @private 14777 * @param {Array} strSymbols The string symbols to inspect. 14778 * @param {Array} chrSymbols The character symbols to find. 14779 * @returns {number} Returns the index of the first unmatched string symbol. 14780 */ 14781 function charsStartIndex(strSymbols, chrSymbols) { 14782 var index = -1, 14783 length = strSymbols.length; 14784 14785 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 14786 return index; 14787 } 14788 14789 /** 14790 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol 14791 * that is not found in the character symbols. 14792 * 14793 * @private 14794 * @param {Array} strSymbols The string symbols to inspect. 14795 * @param {Array} chrSymbols The character symbols to find. 14796 * @returns {number} Returns the index of the last unmatched string symbol. 14797 */ 14798 function charsEndIndex(strSymbols, chrSymbols) { 14799 var index = strSymbols.length; 14800 14801 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 14802 return index; 14803 } 14804 14805 /** 14806 * Gets the number of `placeholder` occurrences in `array`. 14807 * 14808 * @private 14809 * @param {Array} array The array to inspect. 14810 * @param {*} placeholder The placeholder to search for. 14811 * @returns {number} Returns the placeholder count. 14812 */ 14813 function countHolders(array, placeholder) { 14814 var length = array.length, 14815 result = 0; 14816 14817 while (length--) { 14818 if (array[length] === placeholder) { 14819 ++result; 14820 } 14821 } 14822 return result; 14823 } 14824 14825 /** 14826 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A 14827 * letters to basic Latin letters. 14828 * 14829 * @private 14830 * @param {string} letter The matched letter to deburr. 14831 * @returns {string} Returns the deburred letter. 14832 */ 14833 var deburrLetter = basePropertyOf(deburredLetters); 14834 14835 /** 14836 * Used by `_.escape` to convert characters to HTML entities. 14837 * 14838 * @private 14839 * @param {string} chr The matched character to escape. 14840 * @returns {string} Returns the escaped character. 14841 */ 14842 var escapeHtmlChar = basePropertyOf(htmlEscapes); 14843 14844 /** 14845 * Used by `_.template` to escape characters for inclusion in compiled string literals. 14846 * 14847 * @private 14848 * @param {string} chr The matched character to escape. 14849 * @returns {string} Returns the escaped character. 14850 */ 14851 function escapeStringChar(chr) { 14852 return '\\' + stringEscapes[chr]; 14853 } 14854 14855 /** 14856 * Gets the value at `key` of `object`. 14857 * 14858 * @private 14859 * @param {Object} [object] The object to query. 14860 * @param {string} key The key of the property to get. 14861 * @returns {*} Returns the property value. 14862 */ 14863 function getValue(object, key) { 14864 return object == null ? undefined : object[key]; 14865 } 14866 14867 /** 14868 * Checks if `string` contains Unicode symbols. 14869 * 14870 * @private 14871 * @param {string} string The string to inspect. 14872 * @returns {boolean} Returns `true` if a symbol is found, else `false`. 14873 */ 14874 function hasUnicode(string) { 14875 return reHasUnicode.test(string); 14876 } 14877 14878 /** 14879 * Checks if `string` contains a word composed of Unicode symbols. 14880 * 14881 * @private 14882 * @param {string} string The string to inspect. 14883 * @returns {boolean} Returns `true` if a word is found, else `false`. 14884 */ 14885 function hasUnicodeWord(string) { 14886 return reHasUnicodeWord.test(string); 14887 } 14888 14889 /** 14890 * Converts `iterator` to an array. 14891 * 14892 * @private 14893 * @param {Object} iterator The iterator to convert. 14894 * @returns {Array} Returns the converted array. 14895 */ 14896 function iteratorToArray(iterator) { 14897 var data, 14898 result = []; 14899 14900 while (!(data = iterator.next()).done) { 14901 result.push(data.value); 14902 } 14903 return result; 14904 } 14905 14906 /** 14907 * Converts `map` to its key-value pairs. 14908 * 14909 * @private 14910 * @param {Object} map The map to convert. 14911 * @returns {Array} Returns the key-value pairs. 14912 */ 14913 function mapToArray(map) { 14914 var index = -1, 14915 result = Array(map.size); 14916 14917 map.forEach(function(value, key) { 14918 result[++index] = [key, value]; 14919 }); 14920 return result; 14921 } 14922 14923 /** 14924 * Creates a unary function that invokes `func` with its argument transformed. 14925 * 14926 * @private 14927 * @param {Function} func The function to wrap. 14928 * @param {Function} transform The argument transform. 14929 * @returns {Function} Returns the new function. 14930 */ 14931 function overArg(func, transform) { 14932 return function(arg) { 14933 return func(transform(arg)); 14934 }; 14935 } 14936 14937 /** 14938 * Replaces all `placeholder` elements in `array` with an internal placeholder 14939 * and returns an array of their indexes. 14940 * 14941 * @private 14942 * @param {Array} array The array to modify. 14943 * @param {*} placeholder The placeholder to replace. 14944 * @returns {Array} Returns the new array of placeholder indexes. 14945 */ 14946 function replaceHolders(array, placeholder) { 14947 var index = -1, 14948 length = array.length, 14949 resIndex = 0, 14950 result = []; 14951 14952 while (++index < length) { 14953 var value = array[index]; 14954 if (value === placeholder || value === PLACEHOLDER) { 14955 array[index] = PLACEHOLDER; 14956 result[resIndex++] = index; 14957 } 14958 } 14959 return result; 14960 } 14961 14962 /** 14963 * Converts `set` to an array of its values. 14964 * 14965 * @private 14966 * @param {Object} set The set to convert. 14967 * @returns {Array} Returns the values. 14968 */ 14969 function setToArray(set) { 14970 var index = -1, 14971 result = Array(set.size); 14972 14973 set.forEach(function(value) { 14974 result[++index] = value; 14975 }); 14976 return result; 14977 } 14978 14979 /** 14980 * Converts `set` to its value-value pairs. 14981 * 14982 * @private 14983 * @param {Object} set The set to convert. 14984 * @returns {Array} Returns the value-value pairs. 14985 */ 14986 function setToPairs(set) { 14987 var index = -1, 14988 result = Array(set.size); 14989 14990 set.forEach(function(value) { 14991 result[++index] = [value, value]; 14992 }); 14993 return result; 14994 } 14995 14996 /** 14997 * A specialized version of `_.indexOf` which performs strict equality 14998 * comparisons of values, i.e. `===`. 14999 * 15000 * @private 15001 * @param {Array} array The array to inspect. 15002 * @param {*} value The value to search for. 15003 * @param {number} fromIndex The index to search from. 15004 * @returns {number} Returns the index of the matched value, else `-1`. 15005 */ 15006 function strictIndexOf(array, value, fromIndex) { 15007 var index = fromIndex - 1, 15008 length = array.length; 15009 15010 while (++index < length) { 15011 if (array[index] === value) { 15012 return index; 15013 } 15014 } 15015 return -1; 15016 } 15017 15018 /** 15019 * A specialized version of `_.lastIndexOf` which performs strict equality 15020 * comparisons of values, i.e. `===`. 15021 * 15022 * @private 15023 * @param {Array} array The array to inspect. 15024 * @param {*} value The value to search for. 15025 * @param {number} fromIndex The index to search from. 15026 * @returns {number} Returns the index of the matched value, else `-1`. 15027 */ 15028 function strictLastIndexOf(array, value, fromIndex) { 15029 var index = fromIndex + 1; 15030 while (index--) { 15031 if (array[index] === value) { 15032 return index; 15033 } 15034 } 15035 return index; 15036 } 15037 15038 /** 15039 * Gets the number of symbols in `string`. 15040 * 15041 * @private 15042 * @param {string} string The string to inspect. 15043 * @returns {number} Returns the string size. 15044 */ 15045 function stringSize(string) { 15046 return hasUnicode(string) 15047 ? unicodeSize(string) 15048 : asciiSize(string); 15049 } 15050 15051 /** 15052 * Converts `string` to an array. 15053 * 15054 * @private 15055 * @param {string} string The string to convert. 15056 * @returns {Array} Returns the converted array. 15057 */ 15058 function stringToArray(string) { 15059 return hasUnicode(string) 15060 ? unicodeToArray(string) 15061 : asciiToArray(string); 15062 } 15063 15064 /** 15065 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace 15066 * character of `string`. 15067 * 15068 * @private 15069 * @param {string} string The string to inspect. 15070 * @returns {number} Returns the index of the last non-whitespace character. 15071 */ 15072 function trimmedEndIndex(string) { 15073 var index = string.length; 15074 15075 while (index-- && reWhitespace.test(string.charAt(index))) {} 15076 return index; 15077 } 15078 15079 /** 15080 * Used by `_.unescape` to convert HTML entities to characters. 15081 * 15082 * @private 15083 * @param {string} chr The matched character to unescape. 15084 * @returns {string} Returns the unescaped character. 15085 */ 15086 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 15087 15088 /** 15089 * Gets the size of a Unicode `string`. 15090 * 15091 * @private 15092 * @param {string} string The string inspect. 15093 * @returns {number} Returns the string size. 15094 */ 15095 function unicodeSize(string) { 15096 var result = reUnicode.lastIndex = 0; 15097 while (reUnicode.test(string)) { 15098 ++result; 15099 } 15100 return result; 15101 } 15102 15103 /** 15104 * Converts a Unicode `string` to an array. 15105 * 15106 * @private 15107 * @param {string} string The string to convert. 15108 * @returns {Array} Returns the converted array. 15109 */ 15110 function unicodeToArray(string) { 15111 return string.match(reUnicode) || []; 15112 } 15113 15114 /** 15115 * Splits a Unicode `string` into an array of its words. 15116 * 15117 * @private 15118 * @param {string} The string to inspect. 15119 * @returns {Array} Returns the words of `string`. 15120 */ 15121 function unicodeWords(string) { 15122 return string.match(reUnicodeWord) || []; 15123 } 15124 15125 /*--------------------------------------------------------------------------*/ 15126 15127 /** 15128 * Create a new pristine `lodash` function using the `context` object. 15129 * 15130 * @static 15131 * @memberOf _ 15132 * @since 1.1.0 15133 * @category Util 15134 * @param {Object} [context=root] The context object. 15135 * @returns {Function} Returns a new `lodash` function. 15136 * @example 15137 * 15138 * _.mixin({ 'foo': _.constant('foo') }); 15139 * 15140 * var lodash = _.runInContext(); 15141 * lodash.mixin({ 'bar': lodash.constant('bar') }); 15142 * 15143 * _.isFunction(_.foo); 15144 * // => true 15145 * _.isFunction(_.bar); 15146 * // => false 15147 * 15148 * lodash.isFunction(lodash.foo); 15149 * // => false 15150 * lodash.isFunction(lodash.bar); 15151 * // => true 15152 * 15153 * // Create a suped-up `defer` in Node.js. 15154 * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; 15155 */ 15156 var runInContext = (function runInContext(context) { 15157 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); 15158 15159 /** Built-in constructor references. */ 15160 var Array = context.Array, 15161 Date = context.Date, 15162 Error = context.Error, 15163 Function = context.Function, 15164 Math = context.Math, 15165 Object = context.Object, 15166 RegExp = context.RegExp, 15167 String = context.String, 15168 TypeError = context.TypeError; 15169 15170 /** Used for built-in method references. */ 15171 var arrayProto = Array.prototype, 15172 funcProto = Function.prototype, 15173 objectProto = Object.prototype; 15174 15175 /** Used to detect overreaching core-js shims. */ 15176 var coreJsData = context['__core-js_shared__']; 15177 15178 /** Used to resolve the decompiled source of functions. */ 15179 var funcToString = funcProto.toString; 15180 15181 /** Used to check objects for own properties. */ 15182 var hasOwnProperty = objectProto.hasOwnProperty; 15183 15184 /** Used to generate unique IDs. */ 15185 var idCounter = 0; 15186 15187 /** Used to detect methods masquerading as native. */ 15188 var maskSrcKey = (function() { 15189 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); 15190 return uid ? ('Symbol(src)_1.' + uid) : ''; 15191 }()); 15192 15193 /** 15194 * Used to resolve the 15195 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 15196 * of values. 15197 */ 15198 var nativeObjectToString = objectProto.toString; 15199 15200 /** Used to infer the `Object` constructor. */ 15201 var objectCtorString = funcToString.call(Object); 15202 15203 /** Used to restore the original `_` reference in `_.noConflict`. */ 15204 var oldDash = root._; 15205 15206 /** Used to detect if a method is native. */ 15207 var reIsNative = RegExp('^' + 15208 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') 15209 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' 15210 ); 15211 15212 /** Built-in value references. */ 15213 var Buffer = moduleExports ? context.Buffer : undefined, 15214 Symbol = context.Symbol, 15215 Uint8Array = context.Uint8Array, 15216 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, 15217 getPrototype = overArg(Object.getPrototypeOf, Object), 15218 objectCreate = Object.create, 15219 propertyIsEnumerable = objectProto.propertyIsEnumerable, 15220 splice = arrayProto.splice, 15221 spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, 15222 symIterator = Symbol ? Symbol.iterator : undefined, 15223 symToStringTag = Symbol ? Symbol.toStringTag : undefined; 15224 15225 var defineProperty = (function() { 15226 try { 15227 var func = getNative(Object, 'defineProperty'); 15228 func({}, '', {}); 15229 return func; 15230 } catch (e) {} 15231 }()); 15232 15233 /** Mocked built-ins. */ 15234 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, 15235 ctxNow = Date && Date.now !== root.Date.now && Date.now, 15236 ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; 15237 15238 /* Built-in method references for those with the same name as other `lodash` methods. */ 15239 var nativeCeil = Math.ceil, 15240 nativeFloor = Math.floor, 15241 nativeGetSymbols = Object.getOwnPropertySymbols, 15242 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, 15243 nativeIsFinite = context.isFinite, 15244 nativeJoin = arrayProto.join, 15245 nativeKeys = overArg(Object.keys, Object), 15246 nativeMax = Math.max, 15247 nativeMin = Math.min, 15248 nativeNow = Date.now, 15249 nativeParseInt = context.parseInt, 15250 nativeRandom = Math.random, 15251 nativeReverse = arrayProto.reverse; 15252 15253 /* Built-in method references that are verified to be native. */ 15254 var DataView = getNative(context, 'DataView'), 15255 Map = getNative(context, 'Map'), 15256 Promise = getNative(context, 'Promise'), 15257 Set = getNative(context, 'Set'), 15258 WeakMap = getNative(context, 'WeakMap'), 15259 nativeCreate = getNative(Object, 'create'); 15260 15261 /** Used to store function metadata. */ 15262 var metaMap = WeakMap && new WeakMap; 15263 15264 /** Used to lookup unminified function names. */ 15265 var realNames = {}; 15266 15267 /** Used to detect maps, sets, and weakmaps. */ 15268 var dataViewCtorString = toSource(DataView), 15269 mapCtorString = toSource(Map), 15270 promiseCtorString = toSource(Promise), 15271 setCtorString = toSource(Set), 15272 weakMapCtorString = toSource(WeakMap); 15273 15274 /** Used to convert symbols to primitives and strings. */ 15275 var symbolProto = Symbol ? Symbol.prototype : undefined, 15276 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, 15277 symbolToString = symbolProto ? symbolProto.toString : undefined; 15278 15279 /*------------------------------------------------------------------------*/ 15280 15281 /** 15282 * Creates a `lodash` object which wraps `value` to enable implicit method 15283 * chain sequences. Methods that operate on and return arrays, collections, 15284 * and functions can be chained together. Methods that retrieve a single value 15285 * or may return a primitive value will automatically end the chain sequence 15286 * and return the unwrapped value. Otherwise, the value must be unwrapped 15287 * with `_#value`. 15288 * 15289 * Explicit chain sequences, which must be unwrapped with `_#value`, may be 15290 * enabled using `_.chain`. 15291 * 15292 * The execution of chained methods is lazy, that is, it's deferred until 15293 * `_#value` is implicitly or explicitly called. 15294 * 15295 * Lazy evaluation allows several methods to support shortcut fusion. 15296 * Shortcut fusion is an optimization to merge iteratee calls; this avoids 15297 * the creation of intermediate arrays and can greatly reduce the number of 15298 * iteratee executions. Sections of a chain sequence qualify for shortcut 15299 * fusion if the section is applied to an array and iteratees accept only 15300 * one argument. The heuristic for whether a section qualifies for shortcut 15301 * fusion is subject to change. 15302 * 15303 * Chaining is supported in custom builds as long as the `_#value` method is 15304 * directly or indirectly included in the build. 15305 * 15306 * In addition to lodash methods, wrappers have `Array` and `String` methods. 15307 * 15308 * The wrapper `Array` methods are: 15309 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` 15310 * 15311 * The wrapper `String` methods are: 15312 * `replace` and `split` 15313 * 15314 * The wrapper methods that support shortcut fusion are: 15315 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, 15316 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, 15317 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` 15318 * 15319 * The chainable wrapper methods are: 15320 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, 15321 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, 15322 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, 15323 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, 15324 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, 15325 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, 15326 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, 15327 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, 15328 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, 15329 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, 15330 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, 15331 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, 15332 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, 15333 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, 15334 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, 15335 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, 15336 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, 15337 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, 15338 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, 15339 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, 15340 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, 15341 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, 15342 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, 15343 * `zipObject`, `zipObjectDeep`, and `zipWith` 15344 * 15345 * The wrapper methods that are **not** chainable by default are: 15346 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, 15347 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, 15348 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, 15349 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, 15350 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, 15351 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, 15352 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, 15353 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, 15354 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, 15355 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, 15356 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, 15357 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, 15358 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, 15359 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, 15360 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, 15361 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, 15362 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, 15363 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, 15364 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, 15365 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, 15366 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, 15367 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, 15368 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, 15369 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, 15370 * `upperFirst`, `value`, and `words` 15371 * 15372 * @name _ 15373 * @constructor 15374 * @category Seq 15375 * @param {*} value The value to wrap in a `lodash` instance. 15376 * @returns {Object} Returns the new `lodash` wrapper instance. 15377 * @example 15378 * 15379 * function square(n) { 15380 * return n * n; 15381 * } 15382 * 15383 * var wrapped = _([1, 2, 3]); 15384 * 15385 * // Returns an unwrapped value. 15386 * wrapped.reduce(_.add); 15387 * // => 6 15388 * 15389 * // Returns a wrapped value. 15390 * var squares = wrapped.map(square); 15391 * 15392 * _.isArray(squares); 15393 * // => false 15394 * 15395 * _.isArray(squares.value()); 15396 * // => true 15397 */ 15398 function lodash(value) { 15399 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 15400 if (value instanceof LodashWrapper) { 15401 return value; 15402 } 15403 if (hasOwnProperty.call(value, '__wrapped__')) { 15404 return wrapperClone(value); 15405 } 15406 } 15407 return new LodashWrapper(value); 15408 } 15409 15410 /** 15411 * The base implementation of `_.create` without support for assigning 15412 * properties to the created object. 15413 * 15414 * @private 15415 * @param {Object} proto The object to inherit from. 15416 * @returns {Object} Returns the new object. 15417 */ 15418 var baseCreate = (function() { 15419 function object() {} 15420 return function(proto) { 15421 if (!isObject(proto)) { 15422 return {}; 15423 } 15424 if (objectCreate) { 15425 return objectCreate(proto); 15426 } 15427 object.prototype = proto; 15428 var result = new object; 15429 object.prototype = undefined; 15430 return result; 15431 }; 15432 }()); 15433 15434 /** 15435 * The function whose prototype chain sequence wrappers inherit from. 15436 * 15437 * @private 15438 */ 15439 function baseLodash() { 15440 // No operation performed. 15441 } 15442 15443 /** 15444 * The base constructor for creating `lodash` wrapper objects. 15445 * 15446 * @private 15447 * @param {*} value The value to wrap. 15448 * @param {boolean} [chainAll] Enable explicit method chain sequences. 15449 */ 15450 function LodashWrapper(value, chainAll) { 15451 this.__wrapped__ = value; 15452 this.__actions__ = []; 15453 this.__chain__ = !!chainAll; 15454 this.__index__ = 0; 15455 this.__values__ = undefined; 15456 } 15457 15458 /** 15459 * By default, the template delimiters used by lodash are like those in 15460 * embedded Ruby (ERB) as well as ES2015 template strings. Change the 15461 * following template settings to use alternative delimiters. 15462 * 15463 * @static 15464 * @memberOf _ 15465 * @type {Object} 15466 */ 15467 lodash.templateSettings = { 15468 15469 /** 15470 * Used to detect `data` property values to be HTML-escaped. 15471 * 15472 * @memberOf _.templateSettings 15473 * @type {RegExp} 15474 */ 15475 'escape': reEscape, 15476 15477 /** 15478 * Used to detect code to be evaluated. 15479 * 15480 * @memberOf _.templateSettings 15481 * @type {RegExp} 15482 */ 15483 'evaluate': reEvaluate, 15484 15485 /** 15486 * Used to detect `data` property values to inject. 15487 * 15488 * @memberOf _.templateSettings 15489 * @type {RegExp} 15490 */ 15491 'interpolate': reInterpolate, 15492 15493 /** 15494 * Used to reference the data object in the template text. 15495 * 15496 * @memberOf _.templateSettings 15497 * @type {string} 15498 */ 15499 'variable': '', 15500 15501 /** 15502 * Used to import variables into the compiled template. 15503 * 15504 * @memberOf _.templateSettings 15505 * @type {Object} 15506 */ 15507 'imports': { 15508 15509 /** 15510 * A reference to the `lodash` function. 15511 * 15512 * @memberOf _.templateSettings.imports 15513 * @type {Function} 15514 */ 15515 '_': lodash 15516 } 15517 }; 15518 15519 // Ensure wrappers are instances of `baseLodash`. 15520 lodash.prototype = baseLodash.prototype; 15521 lodash.prototype.constructor = lodash; 15522 15523 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 15524 LodashWrapper.prototype.constructor = LodashWrapper; 15525 15526 /*------------------------------------------------------------------------*/ 15527 15528 /** 15529 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. 15530 * 15531 * @private 15532 * @constructor 15533 * @param {*} value The value to wrap. 15534 */ 15535 function LazyWrapper(value) { 15536 this.__wrapped__ = value; 15537 this.__actions__ = []; 15538 this.__dir__ = 1; 15539 this.__filtered__ = false; 15540 this.__iteratees__ = []; 15541 this.__takeCount__ = MAX_ARRAY_LENGTH; 15542 this.__views__ = []; 15543 } 15544 15545 /** 15546 * Creates a clone of the lazy wrapper object. 15547 * 15548 * @private 15549 * @name clone 15550 * @memberOf LazyWrapper 15551 * @returns {Object} Returns the cloned `LazyWrapper` object. 15552 */ 15553 function lazyClone() { 15554 var result = new LazyWrapper(this.__wrapped__); 15555 result.__actions__ = copyArray(this.__actions__); 15556 result.__dir__ = this.__dir__; 15557 result.__filtered__ = this.__filtered__; 15558 result.__iteratees__ = copyArray(this.__iteratees__); 15559 result.__takeCount__ = this.__takeCount__; 15560 result.__views__ = copyArray(this.__views__); 15561 return result; 15562 } 15563 15564 /** 15565 * Reverses the direction of lazy iteration. 15566 * 15567 * @private 15568 * @name reverse 15569 * @memberOf LazyWrapper 15570 * @returns {Object} Returns the new reversed `LazyWrapper` object. 15571 */ 15572 function lazyReverse() { 15573 if (this.__filtered__) { 15574 var result = new LazyWrapper(this); 15575 result.__dir__ = -1; 15576 result.__filtered__ = true; 15577 } else { 15578 result = this.clone(); 15579 result.__dir__ *= -1; 15580 } 15581 return result; 15582 } 15583 15584 /** 15585 * Extracts the unwrapped value from its lazy wrapper. 15586 * 15587 * @private 15588 * @name value 15589 * @memberOf LazyWrapper 15590 * @returns {*} Returns the unwrapped value. 15591 */ 15592 function lazyValue() { 15593 var array = this.__wrapped__.value(), 15594 dir = this.__dir__, 15595 isArr = isArray(array), 15596 isRight = dir < 0, 15597 arrLength = isArr ? array.length : 0, 15598 view = getView(0, arrLength, this.__views__), 15599 start = view.start, 15600 end = view.end, 15601 length = end - start, 15602 index = isRight ? end : (start - 1), 15603 iteratees = this.__iteratees__, 15604 iterLength = iteratees.length, 15605 resIndex = 0, 15606 takeCount = nativeMin(length, this.__takeCount__); 15607 15608 if (!isArr || (!isRight && arrLength == length && takeCount == length)) { 15609 return baseWrapperValue(array, this.__actions__); 15610 } 15611 var result = []; 15612 15613 outer: 15614 while (length-- && resIndex < takeCount) { 15615 index += dir; 15616 15617 var iterIndex = -1, 15618 value = array[index]; 15619 15620 while (++iterIndex < iterLength) { 15621 var data = iteratees[iterIndex], 15622 iteratee = data.iteratee, 15623 type = data.type, 15624 computed = iteratee(value); 15625 15626 if (type == LAZY_MAP_FLAG) { 15627 value = computed; 15628 } else if (!computed) { 15629 if (type == LAZY_FILTER_FLAG) { 15630 continue outer; 15631 } else { 15632 break outer; 15633 } 15634 } 15635 } 15636 result[resIndex++] = value; 15637 } 15638 return result; 15639 } 15640 15641 // Ensure `LazyWrapper` is an instance of `baseLodash`. 15642 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 15643 LazyWrapper.prototype.constructor = LazyWrapper; 15644 15645 /*------------------------------------------------------------------------*/ 15646 15647 /** 15648 * Creates a hash object. 15649 * 15650 * @private 15651 * @constructor 15652 * @param {Array} [entries] The key-value pairs to cache. 15653 */ 15654 function Hash(entries) { 15655 var index = -1, 15656 length = entries == null ? 0 : entries.length; 15657 15658 this.clear(); 15659 while (++index < length) { 15660 var entry = entries[index]; 15661 this.set(entry[0], entry[1]); 15662 } 15663 } 15664 15665 /** 15666 * Removes all key-value entries from the hash. 15667 * 15668 * @private 15669 * @name clear 15670 * @memberOf Hash 15671 */ 15672 function hashClear() { 15673 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 15674 this.size = 0; 15675 } 15676 15677 /** 15678 * Removes `key` and its value from the hash. 15679 * 15680 * @private 15681 * @name delete 15682 * @memberOf Hash 15683 * @param {Object} hash The hash to modify. 15684 * @param {string} key The key of the value to remove. 15685 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 15686 */ 15687 function hashDelete(key) { 15688 var result = this.has(key) && delete this.__data__[key]; 15689 this.size -= result ? 1 : 0; 15690 return result; 15691 } 15692 15693 /** 15694 * Gets the hash value for `key`. 15695 * 15696 * @private 15697 * @name get 15698 * @memberOf Hash 15699 * @param {string} key The key of the value to get. 15700 * @returns {*} Returns the entry value. 15701 */ 15702 function hashGet(key) { 15703 var data = this.__data__; 15704 if (nativeCreate) { 15705 var result = data[key]; 15706 return result === HASH_UNDEFINED ? undefined : result; 15707 } 15708 return hasOwnProperty.call(data, key) ? data[key] : undefined; 15709 } 15710 15711 /** 15712 * Checks if a hash value for `key` exists. 15713 * 15714 * @private 15715 * @name has 15716 * @memberOf Hash 15717 * @param {string} key The key of the entry to check. 15718 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 15719 */ 15720 function hashHas(key) { 15721 var data = this.__data__; 15722 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); 15723 } 15724 15725 /** 15726 * Sets the hash `key` to `value`. 15727 * 15728 * @private 15729 * @name set 15730 * @memberOf Hash 15731 * @param {string} key The key of the value to set. 15732 * @param {*} value The value to set. 15733 * @returns {Object} Returns the hash instance. 15734 */ 15735 function hashSet(key, value) { 15736 var data = this.__data__; 15737 this.size += this.has(key) ? 0 : 1; 15738 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; 15739 return this; 15740 } 15741 15742 // Add methods to `Hash`. 15743 Hash.prototype.clear = hashClear; 15744 Hash.prototype['delete'] = hashDelete; 15745 Hash.prototype.get = hashGet; 15746 Hash.prototype.has = hashHas; 15747 Hash.prototype.set = hashSet; 15748 15749 /*------------------------------------------------------------------------*/ 15750 15751 /** 15752 * Creates an list cache object. 15753 * 15754 * @private 15755 * @constructor 15756 * @param {Array} [entries] The key-value pairs to cache. 15757 */ 15758 function ListCache(entries) { 15759 var index = -1, 15760 length = entries == null ? 0 : entries.length; 15761 15762 this.clear(); 15763 while (++index < length) { 15764 var entry = entries[index]; 15765 this.set(entry[0], entry[1]); 15766 } 15767 } 15768 15769 /** 15770 * Removes all key-value entries from the list cache. 15771 * 15772 * @private 15773 * @name clear 15774 * @memberOf ListCache 15775 */ 15776 function listCacheClear() { 15777 this.__data__ = []; 15778 this.size = 0; 15779 } 15780 15781 /** 15782 * Removes `key` and its value from the list cache. 15783 * 15784 * @private 15785 * @name delete 15786 * @memberOf ListCache 15787 * @param {string} key The key of the value to remove. 15788 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 15789 */ 15790 function listCacheDelete(key) { 15791 var data = this.__data__, 15792 index = assocIndexOf(data, key); 15793 15794 if (index < 0) { 15795 return false; 15796 } 15797 var lastIndex = data.length - 1; 15798 if (index == lastIndex) { 15799 data.pop(); 15800 } else { 15801 splice.call(data, index, 1); 15802 } 15803 --this.size; 15804 return true; 15805 } 15806 15807 /** 15808 * Gets the list cache value for `key`. 15809 * 15810 * @private 15811 * @name get 15812 * @memberOf ListCache 15813 * @param {string} key The key of the value to get. 15814 * @returns {*} Returns the entry value. 15815 */ 15816 function listCacheGet(key) { 15817 var data = this.__data__, 15818 index = assocIndexOf(data, key); 15819 15820 return index < 0 ? undefined : data[index][1]; 15821 } 15822 15823 /** 15824 * Checks if a list cache value for `key` exists. 15825 * 15826 * @private 15827 * @name has 15828 * @memberOf ListCache 15829 * @param {string} key The key of the entry to check. 15830 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 15831 */ 15832 function listCacheHas(key) { 15833 return assocIndexOf(this.__data__, key) > -1; 15834 } 15835 15836 /** 15837 * Sets the list cache `key` to `value`. 15838 * 15839 * @private 15840 * @name set 15841 * @memberOf ListCache 15842 * @param {string} key The key of the value to set. 15843 * @param {*} value The value to set. 15844 * @returns {Object} Returns the list cache instance. 15845 */ 15846 function listCacheSet(key, value) { 15847 var data = this.__data__, 15848 index = assocIndexOf(data, key); 15849 15850 if (index < 0) { 15851 ++this.size; 15852 data.push([key, value]); 15853 } else { 15854 data[index][1] = value; 15855 } 15856 return this; 15857 } 15858 15859 // Add methods to `ListCache`. 15860 ListCache.prototype.clear = listCacheClear; 15861 ListCache.prototype['delete'] = listCacheDelete; 15862 ListCache.prototype.get = listCacheGet; 15863 ListCache.prototype.has = listCacheHas; 15864 ListCache.prototype.set = listCacheSet; 15865 15866 /*------------------------------------------------------------------------*/ 15867 15868 /** 15869 * Creates a map cache object to store key-value pairs. 15870 * 15871 * @private 15872 * @constructor 15873 * @param {Array} [entries] The key-value pairs to cache. 15874 */ 15875 function MapCache(entries) { 15876 var index = -1, 15877 length = entries == null ? 0 : entries.length; 15878 15879 this.clear(); 15880 while (++index < length) { 15881 var entry = entries[index]; 15882 this.set(entry[0], entry[1]); 15883 } 15884 } 15885 15886 /** 15887 * Removes all key-value entries from the map. 15888 * 15889 * @private 15890 * @name clear 15891 * @memberOf MapCache 15892 */ 15893 function mapCacheClear() { 15894 this.size = 0; 15895 this.__data__ = { 15896 'hash': new Hash, 15897 'map': new (Map || ListCache), 15898 'string': new Hash 15899 }; 15900 } 15901 15902 /** 15903 * Removes `key` and its value from the map. 15904 * 15905 * @private 15906 * @name delete 15907 * @memberOf MapCache 15908 * @param {string} key The key of the value to remove. 15909 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 15910 */ 15911 function mapCacheDelete(key) { 15912 var result = getMapData(this, key)['delete'](key); 15913 this.size -= result ? 1 : 0; 15914 return result; 15915 } 15916 15917 /** 15918 * Gets the map value for `key`. 15919 * 15920 * @private 15921 * @name get 15922 * @memberOf MapCache 15923 * @param {string} key The key of the value to get. 15924 * @returns {*} Returns the entry value. 15925 */ 15926 function mapCacheGet(key) { 15927 return getMapData(this, key).get(key); 15928 } 15929 15930 /** 15931 * Checks if a map value for `key` exists. 15932 * 15933 * @private 15934 * @name has 15935 * @memberOf MapCache 15936 * @param {string} key The key of the entry to check. 15937 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 15938 */ 15939 function mapCacheHas(key) { 15940 return getMapData(this, key).has(key); 15941 } 15942 15943 /** 15944 * Sets the map `key` to `value`. 15945 * 15946 * @private 15947 * @name set 15948 * @memberOf MapCache 15949 * @param {string} key The key of the value to set. 15950 * @param {*} value The value to set. 15951 * @returns {Object} Returns the map cache instance. 15952 */ 15953 function mapCacheSet(key, value) { 15954 var data = getMapData(this, key), 15955 size = data.size; 15956 15957 data.set(key, value); 15958 this.size += data.size == size ? 0 : 1; 15959 return this; 15960 } 15961 15962 // Add methods to `MapCache`. 15963 MapCache.prototype.clear = mapCacheClear; 15964 MapCache.prototype['delete'] = mapCacheDelete; 15965 MapCache.prototype.get = mapCacheGet; 15966 MapCache.prototype.has = mapCacheHas; 15967 MapCache.prototype.set = mapCacheSet; 15968 15969 /*------------------------------------------------------------------------*/ 15970 15971 /** 15972 * 15973 * Creates an array cache object to store unique values. 15974 * 15975 * @private 15976 * @constructor 15977 * @param {Array} [values] The values to cache. 15978 */ 15979 function SetCache(values) { 15980 var index = -1, 15981 length = values == null ? 0 : values.length; 15982 15983 this.__data__ = new MapCache; 15984 while (++index < length) { 15985 this.add(values[index]); 15986 } 15987 } 15988 15989 /** 15990 * Adds `value` to the array cache. 15991 * 15992 * @private 15993 * @name add 15994 * @memberOf SetCache 15995 * @alias push 15996 * @param {*} value The value to cache. 15997 * @returns {Object} Returns the cache instance. 15998 */ 15999 function setCacheAdd(value) { 16000 this.__data__.set(value, HASH_UNDEFINED); 16001 return this; 16002 } 16003 16004 /** 16005 * Checks if `value` is in the array cache. 16006 * 16007 * @private 16008 * @name has 16009 * @memberOf SetCache 16010 * @param {*} value The value to search for. 16011 * @returns {number} Returns `true` if `value` is found, else `false`. 16012 */ 16013 function setCacheHas(value) { 16014 return this.__data__.has(value); 16015 } 16016 16017 // Add methods to `SetCache`. 16018 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 16019 SetCache.prototype.has = setCacheHas; 16020 16021 /*------------------------------------------------------------------------*/ 16022 16023 /** 16024 * Creates a stack cache object to store key-value pairs. 16025 * 16026 * @private 16027 * @constructor 16028 * @param {Array} [entries] The key-value pairs to cache. 16029 */ 16030 function Stack(entries) { 16031 var data = this.__data__ = new ListCache(entries); 16032 this.size = data.size; 16033 } 16034 16035 /** 16036 * Removes all key-value entries from the stack. 16037 * 16038 * @private 16039 * @name clear 16040 * @memberOf Stack 16041 */ 16042 function stackClear() { 16043 this.__data__ = new ListCache; 16044 this.size = 0; 16045 } 16046 16047 /** 16048 * Removes `key` and its value from the stack. 16049 * 16050 * @private 16051 * @name delete 16052 * @memberOf Stack 16053 * @param {string} key The key of the value to remove. 16054 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 16055 */ 16056 function stackDelete(key) { 16057 var data = this.__data__, 16058 result = data['delete'](key); 16059 16060 this.size = data.size; 16061 return result; 16062 } 16063 16064 /** 16065 * Gets the stack value for `key`. 16066 * 16067 * @private 16068 * @name get 16069 * @memberOf Stack 16070 * @param {string} key The key of the value to get. 16071 * @returns {*} Returns the entry value. 16072 */ 16073 function stackGet(key) { 16074 return this.__data__.get(key); 16075 } 16076 16077 /** 16078 * Checks if a stack value for `key` exists. 16079 * 16080 * @private 16081 * @name has 16082 * @memberOf Stack 16083 * @param {string} key The key of the entry to check. 16084 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 16085 */ 16086 function stackHas(key) { 16087 return this.__data__.has(key); 16088 } 16089 16090 /** 16091 * Sets the stack `key` to `value`. 16092 * 16093 * @private 16094 * @name set 16095 * @memberOf Stack 16096 * @param {string} key The key of the value to set. 16097 * @param {*} value The value to set. 16098 * @returns {Object} Returns the stack cache instance. 16099 */ 16100 function stackSet(key, value) { 16101 var data = this.__data__; 16102 if (data instanceof ListCache) { 16103 var pairs = data.__data__; 16104 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { 16105 pairs.push([key, value]); 16106 this.size = ++data.size; 16107 return this; 16108 } 16109 data = this.__data__ = new MapCache(pairs); 16110 } 16111 data.set(key, value); 16112 this.size = data.size; 16113 return this; 16114 } 16115 16116 // Add methods to `Stack`. 16117 Stack.prototype.clear = stackClear; 16118 Stack.prototype['delete'] = stackDelete; 16119 Stack.prototype.get = stackGet; 16120 Stack.prototype.has = stackHas; 16121 Stack.prototype.set = stackSet; 16122 16123 /*------------------------------------------------------------------------*/ 16124 16125 /** 16126 * Creates an array of the enumerable property names of the array-like `value`. 16127 * 16128 * @private 16129 * @param {*} value The value to query. 16130 * @param {boolean} inherited Specify returning inherited property names. 16131 * @returns {Array} Returns the array of property names. 16132 */ 16133 function arrayLikeKeys(value, inherited) { 16134 var isArr = isArray(value), 16135 isArg = !isArr && isArguments(value), 16136 isBuff = !isArr && !isArg && isBuffer(value), 16137 isType = !isArr && !isArg && !isBuff && isTypedArray(value), 16138 skipIndexes = isArr || isArg || isBuff || isType, 16139 result = skipIndexes ? baseTimes(value.length, String) : [], 16140 length = result.length; 16141 16142 for (var key in value) { 16143 if ((inherited || hasOwnProperty.call(value, key)) && 16144 !(skipIndexes && ( 16145 // Safari 9 has enumerable `arguments.length` in strict mode. 16146 key == 'length' || 16147 // Node.js 0.10 has enumerable non-index properties on buffers. 16148 (isBuff && (key == 'offset' || key == 'parent')) || 16149 // PhantomJS 2 has enumerable non-index properties on typed arrays. 16150 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || 16151 // Skip index properties. 16152 isIndex(key, length) 16153 ))) { 16154 result.push(key); 16155 } 16156 } 16157 return result; 16158 } 16159 16160 /** 16161 * A specialized version of `_.sample` for arrays. 16162 * 16163 * @private 16164 * @param {Array} array The array to sample. 16165 * @returns {*} Returns the random element. 16166 */ 16167 function arraySample(array) { 16168 var length = array.length; 16169 return length ? array[baseRandom(0, length - 1)] : undefined; 16170 } 16171 16172 /** 16173 * A specialized version of `_.sampleSize` for arrays. 16174 * 16175 * @private 16176 * @param {Array} array The array to sample. 16177 * @param {number} n The number of elements to sample. 16178 * @returns {Array} Returns the random elements. 16179 */ 16180 function arraySampleSize(array, n) { 16181 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 16182 } 16183 16184 /** 16185 * A specialized version of `_.shuffle` for arrays. 16186 * 16187 * @private 16188 * @param {Array} array The array to shuffle. 16189 * @returns {Array} Returns the new shuffled array. 16190 */ 16191 function arrayShuffle(array) { 16192 return shuffleSelf(copyArray(array)); 16193 } 16194 16195 /** 16196 * This function is like `assignValue` except that it doesn't assign 16197 * `undefined` values. 16198 * 16199 * @private 16200 * @param {Object} object The object to modify. 16201 * @param {string} key The key of the property to assign. 16202 * @param {*} value The value to assign. 16203 */ 16204 function assignMergeValue(object, key, value) { 16205 if ((value !== undefined && !eq(object[key], value)) || 16206 (value === undefined && !(key in object))) { 16207 baseAssignValue(object, key, value); 16208 } 16209 } 16210 16211 /** 16212 * Assigns `value` to `key` of `object` if the existing value is not equivalent 16213 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 16214 * for equality comparisons. 16215 * 16216 * @private 16217 * @param {Object} object The object to modify. 16218 * @param {string} key The key of the property to assign. 16219 * @param {*} value The value to assign. 16220 */ 16221 function assignValue(object, key, value) { 16222 var objValue = object[key]; 16223 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || 16224 (value === undefined && !(key in object))) { 16225 baseAssignValue(object, key, value); 16226 } 16227 } 16228 16229 /** 16230 * Gets the index at which the `key` is found in `array` of key-value pairs. 16231 * 16232 * @private 16233 * @param {Array} array The array to inspect. 16234 * @param {*} key The key to search for. 16235 * @returns {number} Returns the index of the matched value, else `-1`. 16236 */ 16237 function assocIndexOf(array, key) { 16238 var length = array.length; 16239 while (length--) { 16240 if (eq(array[length][0], key)) { 16241 return length; 16242 } 16243 } 16244 return -1; 16245 } 16246 16247 /** 16248 * Aggregates elements of `collection` on `accumulator` with keys transformed 16249 * by `iteratee` and values set by `setter`. 16250 * 16251 * @private 16252 * @param {Array|Object} collection The collection to iterate over. 16253 * @param {Function} setter The function to set `accumulator` values. 16254 * @param {Function} iteratee The iteratee to transform keys. 16255 * @param {Object} accumulator The initial aggregated object. 16256 * @returns {Function} Returns `accumulator`. 16257 */ 16258 function baseAggregator(collection, setter, iteratee, accumulator) { 16259 baseEach(collection, function(value, key, collection) { 16260 setter(accumulator, value, iteratee(value), collection); 16261 }); 16262 return accumulator; 16263 } 16264 16265 /** 16266 * The base implementation of `_.assign` without support for multiple sources 16267 * or `customizer` functions. 16268 * 16269 * @private 16270 * @param {Object} object The destination object. 16271 * @param {Object} source The source object. 16272 * @returns {Object} Returns `object`. 16273 */ 16274 function baseAssign(object, source) { 16275 return object && copyObject(source, keys(source), object); 16276 } 16277 16278 /** 16279 * The base implementation of `_.assignIn` without support for multiple sources 16280 * or `customizer` functions. 16281 * 16282 * @private 16283 * @param {Object} object The destination object. 16284 * @param {Object} source The source object. 16285 * @returns {Object} Returns `object`. 16286 */ 16287 function baseAssignIn(object, source) { 16288 return object && copyObject(source, keysIn(source), object); 16289 } 16290 16291 /** 16292 * The base implementation of `assignValue` and `assignMergeValue` without 16293 * value checks. 16294 * 16295 * @private 16296 * @param {Object} object The object to modify. 16297 * @param {string} key The key of the property to assign. 16298 * @param {*} value The value to assign. 16299 */ 16300 function baseAssignValue(object, key, value) { 16301 if (key == '__proto__' && defineProperty) { 16302 defineProperty(object, key, { 16303 'configurable': true, 16304 'enumerable': true, 16305 'value': value, 16306 'writable': true 16307 }); 16308 } else { 16309 object[key] = value; 16310 } 16311 } 16312 16313 /** 16314 * The base implementation of `_.at` without support for individual paths. 16315 * 16316 * @private 16317 * @param {Object} object The object to iterate over. 16318 * @param {string[]} paths The property paths to pick. 16319 * @returns {Array} Returns the picked elements. 16320 */ 16321 function baseAt(object, paths) { 16322 var index = -1, 16323 length = paths.length, 16324 result = Array(length), 16325 skip = object == null; 16326 16327 while (++index < length) { 16328 result[index] = skip ? undefined : get(object, paths[index]); 16329 } 16330 return result; 16331 } 16332 16333 /** 16334 * The base implementation of `_.clamp` which doesn't coerce arguments. 16335 * 16336 * @private 16337 * @param {number} number The number to clamp. 16338 * @param {number} [lower] The lower bound. 16339 * @param {number} upper The upper bound. 16340 * @returns {number} Returns the clamped number. 16341 */ 16342 function baseClamp(number, lower, upper) { 16343 if (number === number) { 16344 if (upper !== undefined) { 16345 number = number <= upper ? number : upper; 16346 } 16347 if (lower !== undefined) { 16348 number = number >= lower ? number : lower; 16349 } 16350 } 16351 return number; 16352 } 16353 16354 /** 16355 * The base implementation of `_.clone` and `_.cloneDeep` which tracks 16356 * traversed objects. 16357 * 16358 * @private 16359 * @param {*} value The value to clone. 16360 * @param {boolean} bitmask The bitmask flags. 16361 * 1 - Deep clone 16362 * 2 - Flatten inherited properties 16363 * 4 - Clone symbols 16364 * @param {Function} [customizer] The function to customize cloning. 16365 * @param {string} [key] The key of `value`. 16366 * @param {Object} [object] The parent object of `value`. 16367 * @param {Object} [stack] Tracks traversed objects and their clone counterparts. 16368 * @returns {*} Returns the cloned value. 16369 */ 16370 function baseClone(value, bitmask, customizer, key, object, stack) { 16371 var result, 16372 isDeep = bitmask & CLONE_DEEP_FLAG, 16373 isFlat = bitmask & CLONE_FLAT_FLAG, 16374 isFull = bitmask & CLONE_SYMBOLS_FLAG; 16375 16376 if (customizer) { 16377 result = object ? customizer(value, key, object, stack) : customizer(value); 16378 } 16379 if (result !== undefined) { 16380 return result; 16381 } 16382 if (!isObject(value)) { 16383 return value; 16384 } 16385 var isArr = isArray(value); 16386 if (isArr) { 16387 result = initCloneArray(value); 16388 if (!isDeep) { 16389 return copyArray(value, result); 16390 } 16391 } else { 16392 var tag = getTag(value), 16393 isFunc = tag == funcTag || tag == genTag; 16394 16395 if (isBuffer(value)) { 16396 return cloneBuffer(value, isDeep); 16397 } 16398 if (tag == objectTag || tag == argsTag || (isFunc && !object)) { 16399 result = (isFlat || isFunc) ? {} : initCloneObject(value); 16400 if (!isDeep) { 16401 return isFlat 16402 ? copySymbolsIn(value, baseAssignIn(result, value)) 16403 : copySymbols(value, baseAssign(result, value)); 16404 } 16405 } else { 16406 if (!cloneableTags[tag]) { 16407 return object ? value : {}; 16408 } 16409 result = initCloneByTag(value, tag, isDeep); 16410 } 16411 } 16412 // Check for circular references and return its corresponding clone. 16413 stack || (stack = new Stack); 16414 var stacked = stack.get(value); 16415 if (stacked) { 16416 return stacked; 16417 } 16418 stack.set(value, result); 16419 16420 if (isSet(value)) { 16421 value.forEach(function(subValue) { 16422 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); 16423 }); 16424 } else if (isMap(value)) { 16425 value.forEach(function(subValue, key) { 16426 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); 16427 }); 16428 } 16429 16430 var keysFunc = isFull 16431 ? (isFlat ? getAllKeysIn : getAllKeys) 16432 : (isFlat ? keysIn : keys); 16433 16434 var props = isArr ? undefined : keysFunc(value); 16435 arrayEach(props || value, function(subValue, key) { 16436 if (props) { 16437 key = subValue; 16438 subValue = value[key]; 16439 } 16440 // Recursively populate clone (susceptible to call stack limits). 16441 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); 16442 }); 16443 return result; 16444 } 16445 16446 /** 16447 * The base implementation of `_.conforms` which doesn't clone `source`. 16448 * 16449 * @private 16450 * @param {Object} source The object of property predicates to conform to. 16451 * @returns {Function} Returns the new spec function. 16452 */ 16453 function baseConforms(source) { 16454 var props = keys(source); 16455 return function(object) { 16456 return baseConformsTo(object, source, props); 16457 }; 16458 } 16459 16460 /** 16461 * The base implementation of `_.conformsTo` which accepts `props` to check. 16462 * 16463 * @private 16464 * @param {Object} object The object to inspect. 16465 * @param {Object} source The object of property predicates to conform to. 16466 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 16467 */ 16468 function baseConformsTo(object, source, props) { 16469 var length = props.length; 16470 if (object == null) { 16471 return !length; 16472 } 16473 object = Object(object); 16474 while (length--) { 16475 var key = props[length], 16476 predicate = source[key], 16477 value = object[key]; 16478 16479 if ((value === undefined && !(key in object)) || !predicate(value)) { 16480 return false; 16481 } 16482 } 16483 return true; 16484 } 16485 16486 /** 16487 * The base implementation of `_.delay` and `_.defer` which accepts `args` 16488 * to provide to `func`. 16489 * 16490 * @private 16491 * @param {Function} func The function to delay. 16492 * @param {number} wait The number of milliseconds to delay invocation. 16493 * @param {Array} args The arguments to provide to `func`. 16494 * @returns {number|Object} Returns the timer id or timeout object. 16495 */ 16496 function baseDelay(func, wait, args) { 16497 if (typeof func != 'function') { 16498 throw new TypeError(FUNC_ERROR_TEXT); 16499 } 16500 return setTimeout(function() { func.apply(undefined, args); }, wait); 16501 } 16502 16503 /** 16504 * The base implementation of methods like `_.difference` without support 16505 * for excluding multiple arrays or iteratee shorthands. 16506 * 16507 * @private 16508 * @param {Array} array The array to inspect. 16509 * @param {Array} values The values to exclude. 16510 * @param {Function} [iteratee] The iteratee invoked per element. 16511 * @param {Function} [comparator] The comparator invoked per element. 16512 * @returns {Array} Returns the new array of filtered values. 16513 */ 16514 function baseDifference(array, values, iteratee, comparator) { 16515 var index = -1, 16516 includes = arrayIncludes, 16517 isCommon = true, 16518 length = array.length, 16519 result = [], 16520 valuesLength = values.length; 16521 16522 if (!length) { 16523 return result; 16524 } 16525 if (iteratee) { 16526 values = arrayMap(values, baseUnary(iteratee)); 16527 } 16528 if (comparator) { 16529 includes = arrayIncludesWith; 16530 isCommon = false; 16531 } 16532 else if (values.length >= LARGE_ARRAY_SIZE) { 16533 includes = cacheHas; 16534 isCommon = false; 16535 values = new SetCache(values); 16536 } 16537 outer: 16538 while (++index < length) { 16539 var value = array[index], 16540 computed = iteratee == null ? value : iteratee(value); 16541 16542 value = (comparator || value !== 0) ? value : 0; 16543 if (isCommon && computed === computed) { 16544 var valuesIndex = valuesLength; 16545 while (valuesIndex--) { 16546 if (values[valuesIndex] === computed) { 16547 continue outer; 16548 } 16549 } 16550 result.push(value); 16551 } 16552 else if (!includes(values, computed, comparator)) { 16553 result.push(value); 16554 } 16555 } 16556 return result; 16557 } 16558 16559 /** 16560 * The base implementation of `_.forEach` without support for iteratee shorthands. 16561 * 16562 * @private 16563 * @param {Array|Object} collection The collection to iterate over. 16564 * @param {Function} iteratee The function invoked per iteration. 16565 * @returns {Array|Object} Returns `collection`. 16566 */ 16567 var baseEach = createBaseEach(baseForOwn); 16568 16569 /** 16570 * The base implementation of `_.forEachRight` without support for iteratee shorthands. 16571 * 16572 * @private 16573 * @param {Array|Object} collection The collection to iterate over. 16574 * @param {Function} iteratee The function invoked per iteration. 16575 * @returns {Array|Object} Returns `collection`. 16576 */ 16577 var baseEachRight = createBaseEach(baseForOwnRight, true); 16578 16579 /** 16580 * The base implementation of `_.every` without support for iteratee shorthands. 16581 * 16582 * @private 16583 * @param {Array|Object} collection The collection to iterate over. 16584 * @param {Function} predicate The function invoked per iteration. 16585 * @returns {boolean} Returns `true` if all elements pass the predicate check, 16586 * else `false` 16587 */ 16588 function baseEvery(collection, predicate) { 16589 var result = true; 16590 baseEach(collection, function(value, index, collection) { 16591 result = !!predicate(value, index, collection); 16592 return result; 16593 }); 16594 return result; 16595 } 16596 16597 /** 16598 * The base implementation of methods like `_.max` and `_.min` which accepts a 16599 * `comparator` to determine the extremum value. 16600 * 16601 * @private 16602 * @param {Array} array The array to iterate over. 16603 * @param {Function} iteratee The iteratee invoked per iteration. 16604 * @param {Function} comparator The comparator used to compare values. 16605 * @returns {*} Returns the extremum value. 16606 */ 16607 function baseExtremum(array, iteratee, comparator) { 16608 var index = -1, 16609 length = array.length; 16610 16611 while (++index < length) { 16612 var value = array[index], 16613 current = iteratee(value); 16614 16615 if (current != null && (computed === undefined 16616 ? (current === current && !isSymbol(current)) 16617 : comparator(current, computed) 16618 )) { 16619 var computed = current, 16620 result = value; 16621 } 16622 } 16623 return result; 16624 } 16625 16626 /** 16627 * The base implementation of `_.fill` without an iteratee call guard. 16628 * 16629 * @private 16630 * @param {Array} array The array to fill. 16631 * @param {*} value The value to fill `array` with. 16632 * @param {number} [start=0] The start position. 16633 * @param {number} [end=array.length] The end position. 16634 * @returns {Array} Returns `array`. 16635 */ 16636 function baseFill(array, value, start, end) { 16637 var length = array.length; 16638 16639 start = toInteger(start); 16640 if (start < 0) { 16641 start = -start > length ? 0 : (length + start); 16642 } 16643 end = (end === undefined || end > length) ? length : toInteger(end); 16644 if (end < 0) { 16645 end += length; 16646 } 16647 end = start > end ? 0 : toLength(end); 16648 while (start < end) { 16649 array[start++] = value; 16650 } 16651 return array; 16652 } 16653 16654 /** 16655 * The base implementation of `_.filter` without support for iteratee shorthands. 16656 * 16657 * @private 16658 * @param {Array|Object} collection The collection to iterate over. 16659 * @param {Function} predicate The function invoked per iteration. 16660 * @returns {Array} Returns the new filtered array. 16661 */ 16662 function baseFilter(collection, predicate) { 16663 var result = []; 16664 baseEach(collection, function(value, index, collection) { 16665 if (predicate(value, index, collection)) { 16666 result.push(value); 16667 } 16668 }); 16669 return result; 16670 } 16671 16672 /** 16673 * The base implementation of `_.flatten` with support for restricting flattening. 16674 * 16675 * @private 16676 * @param {Array} array The array to flatten. 16677 * @param {number} depth The maximum recursion depth. 16678 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. 16679 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. 16680 * @param {Array} [result=[]] The initial result value. 16681 * @returns {Array} Returns the new flattened array. 16682 */ 16683 function baseFlatten(array, depth, predicate, isStrict, result) { 16684 var index = -1, 16685 length = array.length; 16686 16687 predicate || (predicate = isFlattenable); 16688 result || (result = []); 16689 16690 while (++index < length) { 16691 var value = array[index]; 16692 if (depth > 0 && predicate(value)) { 16693 if (depth > 1) { 16694 // Recursively flatten arrays (susceptible to call stack limits). 16695 baseFlatten(value, depth - 1, predicate, isStrict, result); 16696 } else { 16697 arrayPush(result, value); 16698 } 16699 } else if (!isStrict) { 16700 result[result.length] = value; 16701 } 16702 } 16703 return result; 16704 } 16705 16706 /** 16707 * The base implementation of `baseForOwn` which iterates over `object` 16708 * properties returned by `keysFunc` and invokes `iteratee` for each property. 16709 * Iteratee functions may exit iteration early by explicitly returning `false`. 16710 * 16711 * @private 16712 * @param {Object} object The object to iterate over. 16713 * @param {Function} iteratee The function invoked per iteration. 16714 * @param {Function} keysFunc The function to get the keys of `object`. 16715 * @returns {Object} Returns `object`. 16716 */ 16717 var baseFor = createBaseFor(); 16718 16719 /** 16720 * This function is like `baseFor` except that it iterates over properties 16721 * in the opposite order. 16722 * 16723 * @private 16724 * @param {Object} object The object to iterate over. 16725 * @param {Function} iteratee The function invoked per iteration. 16726 * @param {Function} keysFunc The function to get the keys of `object`. 16727 * @returns {Object} Returns `object`. 16728 */ 16729 var baseForRight = createBaseFor(true); 16730 16731 /** 16732 * The base implementation of `_.forOwn` without support for iteratee shorthands. 16733 * 16734 * @private 16735 * @param {Object} object The object to iterate over. 16736 * @param {Function} iteratee The function invoked per iteration. 16737 * @returns {Object} Returns `object`. 16738 */ 16739 function baseForOwn(object, iteratee) { 16740 return object && baseFor(object, iteratee, keys); 16741 } 16742 16743 /** 16744 * The base implementation of `_.forOwnRight` without support for iteratee shorthands. 16745 * 16746 * @private 16747 * @param {Object} object The object to iterate over. 16748 * @param {Function} iteratee The function invoked per iteration. 16749 * @returns {Object} Returns `object`. 16750 */ 16751 function baseForOwnRight(object, iteratee) { 16752 return object && baseForRight(object, iteratee, keys); 16753 } 16754 16755 /** 16756 * The base implementation of `_.functions` which creates an array of 16757 * `object` function property names filtered from `props`. 16758 * 16759 * @private 16760 * @param {Object} object The object to inspect. 16761 * @param {Array} props The property names to filter. 16762 * @returns {Array} Returns the function names. 16763 */ 16764 function baseFunctions(object, props) { 16765 return arrayFilter(props, function(key) { 16766 return isFunction(object[key]); 16767 }); 16768 } 16769 16770 /** 16771 * The base implementation of `_.get` without support for default values. 16772 * 16773 * @private 16774 * @param {Object} object The object to query. 16775 * @param {Array|string} path The path of the property to get. 16776 * @returns {*} Returns the resolved value. 16777 */ 16778 function baseGet(object, path) { 16779 path = castPath(path, object); 16780 16781 var index = 0, 16782 length = path.length; 16783 16784 while (object != null && index < length) { 16785 object = object[toKey(path[index++])]; 16786 } 16787 return (index && index == length) ? object : undefined; 16788 } 16789 16790 /** 16791 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses 16792 * `keysFunc` and `symbolsFunc` to get the enumerable property names and 16793 * symbols of `object`. 16794 * 16795 * @private 16796 * @param {Object} object The object to query. 16797 * @param {Function} keysFunc The function to get the keys of `object`. 16798 * @param {Function} symbolsFunc The function to get the symbols of `object`. 16799 * @returns {Array} Returns the array of property names and symbols. 16800 */ 16801 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 16802 var result = keysFunc(object); 16803 return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); 16804 } 16805 16806 /** 16807 * The base implementation of `getTag` without fallbacks for buggy environments. 16808 * 16809 * @private 16810 * @param {*} value The value to query. 16811 * @returns {string} Returns the `toStringTag`. 16812 */ 16813 function baseGetTag(value) { 16814 if (value == null) { 16815 return value === undefined ? undefinedTag : nullTag; 16816 } 16817 return (symToStringTag && symToStringTag in Object(value)) 16818 ? getRawTag(value) 16819 : objectToString(value); 16820 } 16821 16822 /** 16823 * The base implementation of `_.gt` which doesn't coerce arguments. 16824 * 16825 * @private 16826 * @param {*} value The value to compare. 16827 * @param {*} other The other value to compare. 16828 * @returns {boolean} Returns `true` if `value` is greater than `other`, 16829 * else `false`. 16830 */ 16831 function baseGt(value, other) { 16832 return value > other; 16833 } 16834 16835 /** 16836 * The base implementation of `_.has` without support for deep paths. 16837 * 16838 * @private 16839 * @param {Object} [object] The object to query. 16840 * @param {Array|string} key The key to check. 16841 * @returns {boolean} Returns `true` if `key` exists, else `false`. 16842 */ 16843 function baseHas(object, key) { 16844 return object != null && hasOwnProperty.call(object, key); 16845 } 16846 16847 /** 16848 * The base implementation of `_.hasIn` without support for deep paths. 16849 * 16850 * @private 16851 * @param {Object} [object] The object to query. 16852 * @param {Array|string} key The key to check. 16853 * @returns {boolean} Returns `true` if `key` exists, else `false`. 16854 */ 16855 function baseHasIn(object, key) { 16856 return object != null && key in Object(object); 16857 } 16858 16859 /** 16860 * The base implementation of `_.inRange` which doesn't coerce arguments. 16861 * 16862 * @private 16863 * @param {number} number The number to check. 16864 * @param {number} start The start of the range. 16865 * @param {number} end The end of the range. 16866 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 16867 */ 16868 function baseInRange(number, start, end) { 16869 return number >= nativeMin(start, end) && number < nativeMax(start, end); 16870 } 16871 16872 /** 16873 * The base implementation of methods like `_.intersection`, without support 16874 * for iteratee shorthands, that accepts an array of arrays to inspect. 16875 * 16876 * @private 16877 * @param {Array} arrays The arrays to inspect. 16878 * @param {Function} [iteratee] The iteratee invoked per element. 16879 * @param {Function} [comparator] The comparator invoked per element. 16880 * @returns {Array} Returns the new array of shared values. 16881 */ 16882 function baseIntersection(arrays, iteratee, comparator) { 16883 var includes = comparator ? arrayIncludesWith : arrayIncludes, 16884 length = arrays[0].length, 16885 othLength = arrays.length, 16886 othIndex = othLength, 16887 caches = Array(othLength), 16888 maxLength = Infinity, 16889 result = []; 16890 16891 while (othIndex--) { 16892 var array = arrays[othIndex]; 16893 if (othIndex && iteratee) { 16894 array = arrayMap(array, baseUnary(iteratee)); 16895 } 16896 maxLength = nativeMin(array.length, maxLength); 16897 caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) 16898 ? new SetCache(othIndex && array) 16899 : undefined; 16900 } 16901 array = arrays[0]; 16902 16903 var index = -1, 16904 seen = caches[0]; 16905 16906 outer: 16907 while (++index < length && result.length < maxLength) { 16908 var value = array[index], 16909 computed = iteratee ? iteratee(value) : value; 16910 16911 value = (comparator || value !== 0) ? value : 0; 16912 if (!(seen 16913 ? cacheHas(seen, computed) 16914 : includes(result, computed, comparator) 16915 )) { 16916 othIndex = othLength; 16917 while (--othIndex) { 16918 var cache = caches[othIndex]; 16919 if (!(cache 16920 ? cacheHas(cache, computed) 16921 : includes(arrays[othIndex], computed, comparator)) 16922 ) { 16923 continue outer; 16924 } 16925 } 16926 if (seen) { 16927 seen.push(computed); 16928 } 16929 result.push(value); 16930 } 16931 } 16932 return result; 16933 } 16934 16935 /** 16936 * The base implementation of `_.invert` and `_.invertBy` which inverts 16937 * `object` with values transformed by `iteratee` and set by `setter`. 16938 * 16939 * @private 16940 * @param {Object} object The object to iterate over. 16941 * @param {Function} setter The function to set `accumulator` values. 16942 * @param {Function} iteratee The iteratee to transform values. 16943 * @param {Object} accumulator The initial inverted object. 16944 * @returns {Function} Returns `accumulator`. 16945 */ 16946 function baseInverter(object, setter, iteratee, accumulator) { 16947 baseForOwn(object, function(value, key, object) { 16948 setter(accumulator, iteratee(value), key, object); 16949 }); 16950 return accumulator; 16951 } 16952 16953 /** 16954 * The base implementation of `_.invoke` without support for individual 16955 * method arguments. 16956 * 16957 * @private 16958 * @param {Object} object The object to query. 16959 * @param {Array|string} path The path of the method to invoke. 16960 * @param {Array} args The arguments to invoke the method with. 16961 * @returns {*} Returns the result of the invoked method. 16962 */ 16963 function baseInvoke(object, path, args) { 16964 path = castPath(path, object); 16965 object = parent(object, path); 16966 var func = object == null ? object : object[toKey(last(path))]; 16967 return func == null ? undefined : apply(func, object, args); 16968 } 16969 16970 /** 16971 * The base implementation of `_.isArguments`. 16972 * 16973 * @private 16974 * @param {*} value The value to check. 16975 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 16976 */ 16977 function baseIsArguments(value) { 16978 return isObjectLike(value) && baseGetTag(value) == argsTag; 16979 } 16980 16981 /** 16982 * The base implementation of `_.isArrayBuffer` without Node.js optimizations. 16983 * 16984 * @private 16985 * @param {*} value The value to check. 16986 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 16987 */ 16988 function baseIsArrayBuffer(value) { 16989 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 16990 } 16991 16992 /** 16993 * The base implementation of `_.isDate` without Node.js optimizations. 16994 * 16995 * @private 16996 * @param {*} value The value to check. 16997 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 16998 */ 16999 function baseIsDate(value) { 17000 return isObjectLike(value) && baseGetTag(value) == dateTag; 17001 } 17002 17003 /** 17004 * The base implementation of `_.isEqual` which supports partial comparisons 17005 * and tracks traversed objects. 17006 * 17007 * @private 17008 * @param {*} value The value to compare. 17009 * @param {*} other The other value to compare. 17010 * @param {boolean} bitmask The bitmask flags. 17011 * 1 - Unordered comparison 17012 * 2 - Partial comparison 17013 * @param {Function} [customizer] The function to customize comparisons. 17014 * @param {Object} [stack] Tracks traversed `value` and `other` objects. 17015 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 17016 */ 17017 function baseIsEqual(value, other, bitmask, customizer, stack) { 17018 if (value === other) { 17019 return true; 17020 } 17021 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { 17022 return value !== value && other !== other; 17023 } 17024 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 17025 } 17026 17027 /** 17028 * A specialized version of `baseIsEqual` for arrays and objects which performs 17029 * deep comparisons and tracks traversed objects enabling objects with circular 17030 * references to be compared. 17031 * 17032 * @private 17033 * @param {Object} object The object to compare. 17034 * @param {Object} other The other object to compare. 17035 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 17036 * @param {Function} customizer The function to customize comparisons. 17037 * @param {Function} equalFunc The function to determine equivalents of values. 17038 * @param {Object} [stack] Tracks traversed `object` and `other` objects. 17039 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 17040 */ 17041 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 17042 var objIsArr = isArray(object), 17043 othIsArr = isArray(other), 17044 objTag = objIsArr ? arrayTag : getTag(object), 17045 othTag = othIsArr ? arrayTag : getTag(other); 17046 17047 objTag = objTag == argsTag ? objectTag : objTag; 17048 othTag = othTag == argsTag ? objectTag : othTag; 17049 17050 var objIsObj = objTag == objectTag, 17051 othIsObj = othTag == objectTag, 17052 isSameTag = objTag == othTag; 17053 17054 if (isSameTag && isBuffer(object)) { 17055 if (!isBuffer(other)) { 17056 return false; 17057 } 17058 objIsArr = true; 17059 objIsObj = false; 17060 } 17061 if (isSameTag && !objIsObj) { 17062 stack || (stack = new Stack); 17063 return (objIsArr || isTypedArray(object)) 17064 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) 17065 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 17066 } 17067 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 17068 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), 17069 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); 17070 17071 if (objIsWrapped || othIsWrapped) { 17072 var objUnwrapped = objIsWrapped ? object.value() : object, 17073 othUnwrapped = othIsWrapped ? other.value() : other; 17074 17075 stack || (stack = new Stack); 17076 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 17077 } 17078 } 17079 if (!isSameTag) { 17080 return false; 17081 } 17082 stack || (stack = new Stack); 17083 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 17084 } 17085 17086 /** 17087 * The base implementation of `_.isMap` without Node.js optimizations. 17088 * 17089 * @private 17090 * @param {*} value The value to check. 17091 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 17092 */ 17093 function baseIsMap(value) { 17094 return isObjectLike(value) && getTag(value) == mapTag; 17095 } 17096 17097 /** 17098 * The base implementation of `_.isMatch` without support for iteratee shorthands. 17099 * 17100 * @private 17101 * @param {Object} object The object to inspect. 17102 * @param {Object} source The object of property values to match. 17103 * @param {Array} matchData The property names, values, and compare flags to match. 17104 * @param {Function} [customizer] The function to customize comparisons. 17105 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 17106 */ 17107 function baseIsMatch(object, source, matchData, customizer) { 17108 var index = matchData.length, 17109 length = index, 17110 noCustomizer = !customizer; 17111 17112 if (object == null) { 17113 return !length; 17114 } 17115 object = Object(object); 17116 while (index--) { 17117 var data = matchData[index]; 17118 if ((noCustomizer && data[2]) 17119 ? data[1] !== object[data[0]] 17120 : !(data[0] in object) 17121 ) { 17122 return false; 17123 } 17124 } 17125 while (++index < length) { 17126 data = matchData[index]; 17127 var key = data[0], 17128 objValue = object[key], 17129 srcValue = data[1]; 17130 17131 if (noCustomizer && data[2]) { 17132 if (objValue === undefined && !(key in object)) { 17133 return false; 17134 } 17135 } else { 17136 var stack = new Stack; 17137 if (customizer) { 17138 var result = customizer(objValue, srcValue, key, object, source, stack); 17139 } 17140 if (!(result === undefined 17141 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) 17142 : result 17143 )) { 17144 return false; 17145 } 17146 } 17147 } 17148 return true; 17149 } 17150 17151 /** 17152 * The base implementation of `_.isNative` without bad shim checks. 17153 * 17154 * @private 17155 * @param {*} value The value to check. 17156 * @returns {boolean} Returns `true` if `value` is a native function, 17157 * else `false`. 17158 */ 17159 function baseIsNative(value) { 17160 if (!isObject(value) || isMasked(value)) { 17161 return false; 17162 } 17163 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 17164 return pattern.test(toSource(value)); 17165 } 17166 17167 /** 17168 * The base implementation of `_.isRegExp` without Node.js optimizations. 17169 * 17170 * @private 17171 * @param {*} value The value to check. 17172 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 17173 */ 17174 function baseIsRegExp(value) { 17175 return isObjectLike(value) && baseGetTag(value) == regexpTag; 17176 } 17177 17178 /** 17179 * The base implementation of `_.isSet` without Node.js optimizations. 17180 * 17181 * @private 17182 * @param {*} value The value to check. 17183 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 17184 */ 17185 function baseIsSet(value) { 17186 return isObjectLike(value) && getTag(value) == setTag; 17187 } 17188 17189 /** 17190 * The base implementation of `_.isTypedArray` without Node.js optimizations. 17191 * 17192 * @private 17193 * @param {*} value The value to check. 17194 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 17195 */ 17196 function baseIsTypedArray(value) { 17197 return isObjectLike(value) && 17198 isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 17199 } 17200 17201 /** 17202 * The base implementation of `_.iteratee`. 17203 * 17204 * @private 17205 * @param {*} [value=_.identity] The value to convert to an iteratee. 17206 * @returns {Function} Returns the iteratee. 17207 */ 17208 function baseIteratee(value) { 17209 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. 17210 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. 17211 if (typeof value == 'function') { 17212 return value; 17213 } 17214 if (value == null) { 17215 return identity; 17216 } 17217 if (typeof value == 'object') { 17218 return isArray(value) 17219 ? baseMatchesProperty(value[0], value[1]) 17220 : baseMatches(value); 17221 } 17222 return property(value); 17223 } 17224 17225 /** 17226 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. 17227 * 17228 * @private 17229 * @param {Object} object The object to query. 17230 * @returns {Array} Returns the array of property names. 17231 */ 17232 function baseKeys(object) { 17233 if (!isPrototype(object)) { 17234 return nativeKeys(object); 17235 } 17236 var result = []; 17237 for (var key in Object(object)) { 17238 if (hasOwnProperty.call(object, key) && key != 'constructor') { 17239 result.push(key); 17240 } 17241 } 17242 return result; 17243 } 17244 17245 /** 17246 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. 17247 * 17248 * @private 17249 * @param {Object} object The object to query. 17250 * @returns {Array} Returns the array of property names. 17251 */ 17252 function baseKeysIn(object) { 17253 if (!isObject(object)) { 17254 return nativeKeysIn(object); 17255 } 17256 var isProto = isPrototype(object), 17257 result = []; 17258 17259 for (var key in object) { 17260 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { 17261 result.push(key); 17262 } 17263 } 17264 return result; 17265 } 17266 17267 /** 17268 * The base implementation of `_.lt` which doesn't coerce arguments. 17269 * 17270 * @private 17271 * @param {*} value The value to compare. 17272 * @param {*} other The other value to compare. 17273 * @returns {boolean} Returns `true` if `value` is less than `other`, 17274 * else `false`. 17275 */ 17276 function baseLt(value, other) { 17277 return value < other; 17278 } 17279 17280 /** 17281 * The base implementation of `_.map` without support for iteratee shorthands. 17282 * 17283 * @private 17284 * @param {Array|Object} collection The collection to iterate over. 17285 * @param {Function} iteratee The function invoked per iteration. 17286 * @returns {Array} Returns the new mapped array. 17287 */ 17288 function baseMap(collection, iteratee) { 17289 var index = -1, 17290 result = isArrayLike(collection) ? Array(collection.length) : []; 17291 17292 baseEach(collection, function(value, key, collection) { 17293 result[++index] = iteratee(value, key, collection); 17294 }); 17295 return result; 17296 } 17297 17298 /** 17299 * The base implementation of `_.matches` which doesn't clone `source`. 17300 * 17301 * @private 17302 * @param {Object} source The object of property values to match. 17303 * @returns {Function} Returns the new spec function. 17304 */ 17305 function baseMatches(source) { 17306 var matchData = getMatchData(source); 17307 if (matchData.length == 1 && matchData[0][2]) { 17308 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 17309 } 17310 return function(object) { 17311 return object === source || baseIsMatch(object, source, matchData); 17312 }; 17313 } 17314 17315 /** 17316 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. 17317 * 17318 * @private 17319 * @param {string} path The path of the property to get. 17320 * @param {*} srcValue The value to match. 17321 * @returns {Function} Returns the new spec function. 17322 */ 17323 function baseMatchesProperty(path, srcValue) { 17324 if (isKey(path) && isStrictComparable(srcValue)) { 17325 return matchesStrictComparable(toKey(path), srcValue); 17326 } 17327 return function(object) { 17328 var objValue = get(object, path); 17329 return (objValue === undefined && objValue === srcValue) 17330 ? hasIn(object, path) 17331 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 17332 }; 17333 } 17334 17335 /** 17336 * The base implementation of `_.merge` without support for multiple sources. 17337 * 17338 * @private 17339 * @param {Object} object The destination object. 17340 * @param {Object} source The source object. 17341 * @param {number} srcIndex The index of `source`. 17342 * @param {Function} [customizer] The function to customize merged values. 17343 * @param {Object} [stack] Tracks traversed source values and their merged 17344 * counterparts. 17345 */ 17346 function baseMerge(object, source, srcIndex, customizer, stack) { 17347 if (object === source) { 17348 return; 17349 } 17350 baseFor(source, function(srcValue, key) { 17351 stack || (stack = new Stack); 17352 if (isObject(srcValue)) { 17353 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 17354 } 17355 else { 17356 var newValue = customizer 17357 ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) 17358 : undefined; 17359 17360 if (newValue === undefined) { 17361 newValue = srcValue; 17362 } 17363 assignMergeValue(object, key, newValue); 17364 } 17365 }, keysIn); 17366 } 17367 17368 /** 17369 * A specialized version of `baseMerge` for arrays and objects which performs 17370 * deep merges and tracks traversed objects enabling objects with circular 17371 * references to be merged. 17372 * 17373 * @private 17374 * @param {Object} object The destination object. 17375 * @param {Object} source The source object. 17376 * @param {string} key The key of the value to merge. 17377 * @param {number} srcIndex The index of `source`. 17378 * @param {Function} mergeFunc The function to merge values. 17379 * @param {Function} [customizer] The function to customize assigned values. 17380 * @param {Object} [stack] Tracks traversed source values and their merged 17381 * counterparts. 17382 */ 17383 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 17384 var objValue = safeGet(object, key), 17385 srcValue = safeGet(source, key), 17386 stacked = stack.get(srcValue); 17387 17388 if (stacked) { 17389 assignMergeValue(object, key, stacked); 17390 return; 17391 } 17392 var newValue = customizer 17393 ? customizer(objValue, srcValue, (key + ''), object, source, stack) 17394 : undefined; 17395 17396 var isCommon = newValue === undefined; 17397 17398 if (isCommon) { 17399 var isArr = isArray(srcValue), 17400 isBuff = !isArr && isBuffer(srcValue), 17401 isTyped = !isArr && !isBuff && isTypedArray(srcValue); 17402 17403 newValue = srcValue; 17404 if (isArr || isBuff || isTyped) { 17405 if (isArray(objValue)) { 17406 newValue = objValue; 17407 } 17408 else if (isArrayLikeObject(objValue)) { 17409 newValue = copyArray(objValue); 17410 } 17411 else if (isBuff) { 17412 isCommon = false; 17413 newValue = cloneBuffer(srcValue, true); 17414 } 17415 else if (isTyped) { 17416 isCommon = false; 17417 newValue = cloneTypedArray(srcValue, true); 17418 } 17419 else { 17420 newValue = []; 17421 } 17422 } 17423 else if (isPlainObject(srcValue) || isArguments(srcValue)) { 17424 newValue = objValue; 17425 if (isArguments(objValue)) { 17426 newValue = toPlainObject(objValue); 17427 } 17428 else if (!isObject(objValue) || isFunction(objValue)) { 17429 newValue = initCloneObject(srcValue); 17430 } 17431 } 17432 else { 17433 isCommon = false; 17434 } 17435 } 17436 if (isCommon) { 17437 // Recursively merge objects and arrays (susceptible to call stack limits). 17438 stack.set(srcValue, newValue); 17439 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 17440 stack['delete'](srcValue); 17441 } 17442 assignMergeValue(object, key, newValue); 17443 } 17444 17445 /** 17446 * The base implementation of `_.nth` which doesn't coerce arguments. 17447 * 17448 * @private 17449 * @param {Array} array The array to query. 17450 * @param {number} n The index of the element to return. 17451 * @returns {*} Returns the nth element of `array`. 17452 */ 17453 function baseNth(array, n) { 17454 var length = array.length; 17455 if (!length) { 17456 return; 17457 } 17458 n += n < 0 ? length : 0; 17459 return isIndex(n, length) ? array[n] : undefined; 17460 } 17461 17462 /** 17463 * The base implementation of `_.orderBy` without param guards. 17464 * 17465 * @private 17466 * @param {Array|Object} collection The collection to iterate over. 17467 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. 17468 * @param {string[]} orders The sort orders of `iteratees`. 17469 * @returns {Array} Returns the new sorted array. 17470 */ 17471 function baseOrderBy(collection, iteratees, orders) { 17472 if (iteratees.length) { 17473 iteratees = arrayMap(iteratees, function(iteratee) { 17474 if (isArray(iteratee)) { 17475 return function(value) { 17476 return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); 17477 } 17478 } 17479 return iteratee; 17480 }); 17481 } else { 17482 iteratees = [identity]; 17483 } 17484 17485 var index = -1; 17486 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 17487 17488 var result = baseMap(collection, function(value, key, collection) { 17489 var criteria = arrayMap(iteratees, function(iteratee) { 17490 return iteratee(value); 17491 }); 17492 return { 'criteria': criteria, 'index': ++index, 'value': value }; 17493 }); 17494 17495 return baseSortBy(result, function(object, other) { 17496 return compareMultiple(object, other, orders); 17497 }); 17498 } 17499 17500 /** 17501 * The base implementation of `_.pick` without support for individual 17502 * property identifiers. 17503 * 17504 * @private 17505 * @param {Object} object The source object. 17506 * @param {string[]} paths The property paths to pick. 17507 * @returns {Object} Returns the new object. 17508 */ 17509 function basePick(object, paths) { 17510 return basePickBy(object, paths, function(value, path) { 17511 return hasIn(object, path); 17512 }); 17513 } 17514 17515 /** 17516 * The base implementation of `_.pickBy` without support for iteratee shorthands. 17517 * 17518 * @private 17519 * @param {Object} object The source object. 17520 * @param {string[]} paths The property paths to pick. 17521 * @param {Function} predicate The function invoked per property. 17522 * @returns {Object} Returns the new object. 17523 */ 17524 function basePickBy(object, paths, predicate) { 17525 var index = -1, 17526 length = paths.length, 17527 result = {}; 17528 17529 while (++index < length) { 17530 var path = paths[index], 17531 value = baseGet(object, path); 17532 17533 if (predicate(value, path)) { 17534 baseSet(result, castPath(path, object), value); 17535 } 17536 } 17537 return result; 17538 } 17539 17540 /** 17541 * A specialized version of `baseProperty` which supports deep paths. 17542 * 17543 * @private 17544 * @param {Array|string} path The path of the property to get. 17545 * @returns {Function} Returns the new accessor function. 17546 */ 17547 function basePropertyDeep(path) { 17548 return function(object) { 17549 return baseGet(object, path); 17550 }; 17551 } 17552 17553 /** 17554 * The base implementation of `_.pullAllBy` without support for iteratee 17555 * shorthands. 17556 * 17557 * @private 17558 * @param {Array} array The array to modify. 17559 * @param {Array} values The values to remove. 17560 * @param {Function} [iteratee] The iteratee invoked per element. 17561 * @param {Function} [comparator] The comparator invoked per element. 17562 * @returns {Array} Returns `array`. 17563 */ 17564 function basePullAll(array, values, iteratee, comparator) { 17565 var indexOf = comparator ? baseIndexOfWith : baseIndexOf, 17566 index = -1, 17567 length = values.length, 17568 seen = array; 17569 17570 if (array === values) { 17571 values = copyArray(values); 17572 } 17573 if (iteratee) { 17574 seen = arrayMap(array, baseUnary(iteratee)); 17575 } 17576 while (++index < length) { 17577 var fromIndex = 0, 17578 value = values[index], 17579 computed = iteratee ? iteratee(value) : value; 17580 17581 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { 17582 if (seen !== array) { 17583 splice.call(seen, fromIndex, 1); 17584 } 17585 splice.call(array, fromIndex, 1); 17586 } 17587 } 17588 return array; 17589 } 17590 17591 /** 17592 * The base implementation of `_.pullAt` without support for individual 17593 * indexes or capturing the removed elements. 17594 * 17595 * @private 17596 * @param {Array} array The array to modify. 17597 * @param {number[]} indexes The indexes of elements to remove. 17598 * @returns {Array} Returns `array`. 17599 */ 17600 function basePullAt(array, indexes) { 17601 var length = array ? indexes.length : 0, 17602 lastIndex = length - 1; 17603 17604 while (length--) { 17605 var index = indexes[length]; 17606 if (length == lastIndex || index !== previous) { 17607 var previous = index; 17608 if (isIndex(index)) { 17609 splice.call(array, index, 1); 17610 } else { 17611 baseUnset(array, index); 17612 } 17613 } 17614 } 17615 return array; 17616 } 17617 17618 /** 17619 * The base implementation of `_.random` without support for returning 17620 * floating-point numbers. 17621 * 17622 * @private 17623 * @param {number} lower The lower bound. 17624 * @param {number} upper The upper bound. 17625 * @returns {number} Returns the random number. 17626 */ 17627 function baseRandom(lower, upper) { 17628 return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); 17629 } 17630 17631 /** 17632 * The base implementation of `_.range` and `_.rangeRight` which doesn't 17633 * coerce arguments. 17634 * 17635 * @private 17636 * @param {number} start The start of the range. 17637 * @param {number} end The end of the range. 17638 * @param {number} step The value to increment or decrement by. 17639 * @param {boolean} [fromRight] Specify iterating from right to left. 17640 * @returns {Array} Returns the range of numbers. 17641 */ 17642 function baseRange(start, end, step, fromRight) { 17643 var index = -1, 17644 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), 17645 result = Array(length); 17646 17647 while (length--) { 17648 result[fromRight ? length : ++index] = start; 17649 start += step; 17650 } 17651 return result; 17652 } 17653 17654 /** 17655 * The base implementation of `_.repeat` which doesn't coerce arguments. 17656 * 17657 * @private 17658 * @param {string} string The string to repeat. 17659 * @param {number} n The number of times to repeat the string. 17660 * @returns {string} Returns the repeated string. 17661 */ 17662 function baseRepeat(string, n) { 17663 var result = ''; 17664 if (!string || n < 1 || n > MAX_SAFE_INTEGER) { 17665 return result; 17666 } 17667 // Leverage the exponentiation by squaring algorithm for a faster repeat. 17668 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. 17669 do { 17670 if (n % 2) { 17671 result += string; 17672 } 17673 n = nativeFloor(n / 2); 17674 if (n) { 17675 string += string; 17676 } 17677 } while (n); 17678 17679 return result; 17680 } 17681 17682 /** 17683 * The base implementation of `_.rest` which doesn't validate or coerce arguments. 17684 * 17685 * @private 17686 * @param {Function} func The function to apply a rest parameter to. 17687 * @param {number} [start=func.length-1] The start position of the rest parameter. 17688 * @returns {Function} Returns the new function. 17689 */ 17690 function baseRest(func, start) { 17691 return setToString(overRest(func, start, identity), func + ''); 17692 } 17693 17694 /** 17695 * The base implementation of `_.sample`. 17696 * 17697 * @private 17698 * @param {Array|Object} collection The collection to sample. 17699 * @returns {*} Returns the random element. 17700 */ 17701 function baseSample(collection) { 17702 return arraySample(values(collection)); 17703 } 17704 17705 /** 17706 * The base implementation of `_.sampleSize` without param guards. 17707 * 17708 * @private 17709 * @param {Array|Object} collection The collection to sample. 17710 * @param {number} n The number of elements to sample. 17711 * @returns {Array} Returns the random elements. 17712 */ 17713 function baseSampleSize(collection, n) { 17714 var array = values(collection); 17715 return shuffleSelf(array, baseClamp(n, 0, array.length)); 17716 } 17717 17718 /** 17719 * The base implementation of `_.set`. 17720 * 17721 * @private 17722 * @param {Object} object The object to modify. 17723 * @param {Array|string} path The path of the property to set. 17724 * @param {*} value The value to set. 17725 * @param {Function} [customizer] The function to customize path creation. 17726 * @returns {Object} Returns `object`. 17727 */ 17728 function baseSet(object, path, value, customizer) { 17729 if (!isObject(object)) { 17730 return object; 17731 } 17732 path = castPath(path, object); 17733 17734 var index = -1, 17735 length = path.length, 17736 lastIndex = length - 1, 17737 nested = object; 17738 17739 while (nested != null && ++index < length) { 17740 var key = toKey(path[index]), 17741 newValue = value; 17742 17743 if (key === '__proto__' || key === 'constructor' || key === 'prototype') { 17744 return object; 17745 } 17746 17747 if (index != lastIndex) { 17748 var objValue = nested[key]; 17749 newValue = customizer ? customizer(objValue, key, nested) : undefined; 17750 if (newValue === undefined) { 17751 newValue = isObject(objValue) 17752 ? objValue 17753 : (isIndex(path[index + 1]) ? [] : {}); 17754 } 17755 } 17756 assignValue(nested, key, newValue); 17757 nested = nested[key]; 17758 } 17759 return object; 17760 } 17761 17762 /** 17763 * The base implementation of `setData` without support for hot loop shorting. 17764 * 17765 * @private 17766 * @param {Function} func The function to associate metadata with. 17767 * @param {*} data The metadata. 17768 * @returns {Function} Returns `func`. 17769 */ 17770 var baseSetData = !metaMap ? identity : function(func, data) { 17771 metaMap.set(func, data); 17772 return func; 17773 }; 17774 17775 /** 17776 * The base implementation of `setToString` without support for hot loop shorting. 17777 * 17778 * @private 17779 * @param {Function} func The function to modify. 17780 * @param {Function} string The `toString` result. 17781 * @returns {Function} Returns `func`. 17782 */ 17783 var baseSetToString = !defineProperty ? identity : function(func, string) { 17784 return defineProperty(func, 'toString', { 17785 'configurable': true, 17786 'enumerable': false, 17787 'value': constant(string), 17788 'writable': true 17789 }); 17790 }; 17791 17792 /** 17793 * The base implementation of `_.shuffle`. 17794 * 17795 * @private 17796 * @param {Array|Object} collection The collection to shuffle. 17797 * @returns {Array} Returns the new shuffled array. 17798 */ 17799 function baseShuffle(collection) { 17800 return shuffleSelf(values(collection)); 17801 } 17802 17803 /** 17804 * The base implementation of `_.slice` without an iteratee call guard. 17805 * 17806 * @private 17807 * @param {Array} array The array to slice. 17808 * @param {number} [start=0] The start position. 17809 * @param {number} [end=array.length] The end position. 17810 * @returns {Array} Returns the slice of `array`. 17811 */ 17812 function baseSlice(array, start, end) { 17813 var index = -1, 17814 length = array.length; 17815 17816 if (start < 0) { 17817 start = -start > length ? 0 : (length + start); 17818 } 17819 end = end > length ? length : end; 17820 if (end < 0) { 17821 end += length; 17822 } 17823 length = start > end ? 0 : ((end - start) >>> 0); 17824 start >>>= 0; 17825 17826 var result = Array(length); 17827 while (++index < length) { 17828 result[index] = array[index + start]; 17829 } 17830 return result; 17831 } 17832 17833 /** 17834 * The base implementation of `_.some` without support for iteratee shorthands. 17835 * 17836 * @private 17837 * @param {Array|Object} collection The collection to iterate over. 17838 * @param {Function} predicate The function invoked per iteration. 17839 * @returns {boolean} Returns `true` if any element passes the predicate check, 17840 * else `false`. 17841 */ 17842 function baseSome(collection, predicate) { 17843 var result; 17844 17845 baseEach(collection, function(value, index, collection) { 17846 result = predicate(value, index, collection); 17847 return !result; 17848 }); 17849 return !!result; 17850 } 17851 17852 /** 17853 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which 17854 * performs a binary search of `array` to determine the index at which `value` 17855 * should be inserted into `array` in order to maintain its sort order. 17856 * 17857 * @private 17858 * @param {Array} array The sorted array to inspect. 17859 * @param {*} value The value to evaluate. 17860 * @param {boolean} [retHighest] Specify returning the highest qualified index. 17861 * @returns {number} Returns the index at which `value` should be inserted 17862 * into `array`. 17863 */ 17864 function baseSortedIndex(array, value, retHighest) { 17865 var low = 0, 17866 high = array == null ? low : array.length; 17867 17868 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 17869 while (low < high) { 17870 var mid = (low + high) >>> 1, 17871 computed = array[mid]; 17872 17873 if (computed !== null && !isSymbol(computed) && 17874 (retHighest ? (computed <= value) : (computed < value))) { 17875 low = mid + 1; 17876 } else { 17877 high = mid; 17878 } 17879 } 17880 return high; 17881 } 17882 return baseSortedIndexBy(array, value, identity, retHighest); 17883 } 17884 17885 /** 17886 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` 17887 * which invokes `iteratee` for `value` and each element of `array` to compute 17888 * their sort ranking. The iteratee is invoked with one argument; (value). 17889 * 17890 * @private 17891 * @param {Array} array The sorted array to inspect. 17892 * @param {*} value The value to evaluate. 17893 * @param {Function} iteratee The iteratee invoked per element. 17894 * @param {boolean} [retHighest] Specify returning the highest qualified index. 17895 * @returns {number} Returns the index at which `value` should be inserted 17896 * into `array`. 17897 */ 17898 function baseSortedIndexBy(array, value, iteratee, retHighest) { 17899 var low = 0, 17900 high = array == null ? 0 : array.length; 17901 if (high === 0) { 17902 return 0; 17903 } 17904 17905 value = iteratee(value); 17906 var valIsNaN = value !== value, 17907 valIsNull = value === null, 17908 valIsSymbol = isSymbol(value), 17909 valIsUndefined = value === undefined; 17910 17911 while (low < high) { 17912 var mid = nativeFloor((low + high) / 2), 17913 computed = iteratee(array[mid]), 17914 othIsDefined = computed !== undefined, 17915 othIsNull = computed === null, 17916 othIsReflexive = computed === computed, 17917 othIsSymbol = isSymbol(computed); 17918 17919 if (valIsNaN) { 17920 var setLow = retHighest || othIsReflexive; 17921 } else if (valIsUndefined) { 17922 setLow = othIsReflexive && (retHighest || othIsDefined); 17923 } else if (valIsNull) { 17924 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 17925 } else if (valIsSymbol) { 17926 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 17927 } else if (othIsNull || othIsSymbol) { 17928 setLow = false; 17929 } else { 17930 setLow = retHighest ? (computed <= value) : (computed < value); 17931 } 17932 if (setLow) { 17933 low = mid + 1; 17934 } else { 17935 high = mid; 17936 } 17937 } 17938 return nativeMin(high, MAX_ARRAY_INDEX); 17939 } 17940 17941 /** 17942 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without 17943 * support for iteratee shorthands. 17944 * 17945 * @private 17946 * @param {Array} array The array to inspect. 17947 * @param {Function} [iteratee] The iteratee invoked per element. 17948 * @returns {Array} Returns the new duplicate free array. 17949 */ 17950 function baseSortedUniq(array, iteratee) { 17951 var index = -1, 17952 length = array.length, 17953 resIndex = 0, 17954 result = []; 17955 17956 while (++index < length) { 17957 var value = array[index], 17958 computed = iteratee ? iteratee(value) : value; 17959 17960 if (!index || !eq(computed, seen)) { 17961 var seen = computed; 17962 result[resIndex++] = value === 0 ? 0 : value; 17963 } 17964 } 17965 return result; 17966 } 17967 17968 /** 17969 * The base implementation of `_.toNumber` which doesn't ensure correct 17970 * conversions of binary, hexadecimal, or octal string values. 17971 * 17972 * @private 17973 * @param {*} value The value to process. 17974 * @returns {number} Returns the number. 17975 */ 17976 function baseToNumber(value) { 17977 if (typeof value == 'number') { 17978 return value; 17979 } 17980 if (isSymbol(value)) { 17981 return NAN; 17982 } 17983 return +value; 17984 } 17985 17986 /** 17987 * The base implementation of `_.toString` which doesn't convert nullish 17988 * values to empty strings. 17989 * 17990 * @private 17991 * @param {*} value The value to process. 17992 * @returns {string} Returns the string. 17993 */ 17994 function baseToString(value) { 17995 // Exit early for strings to avoid a performance hit in some environments. 17996 if (typeof value == 'string') { 17997 return value; 17998 } 17999 if (isArray(value)) { 18000 // Recursively convert values (susceptible to call stack limits). 18001 return arrayMap(value, baseToString) + ''; 18002 } 18003 if (isSymbol(value)) { 18004 return symbolToString ? symbolToString.call(value) : ''; 18005 } 18006 var result = (value + ''); 18007 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 18008 } 18009 18010 /** 18011 * The base implementation of `_.uniqBy` without support for iteratee shorthands. 18012 * 18013 * @private 18014 * @param {Array} array The array to inspect. 18015 * @param {Function} [iteratee] The iteratee invoked per element. 18016 * @param {Function} [comparator] The comparator invoked per element. 18017 * @returns {Array} Returns the new duplicate free array. 18018 */ 18019 function baseUniq(array, iteratee, comparator) { 18020 var index = -1, 18021 includes = arrayIncludes, 18022 length = array.length, 18023 isCommon = true, 18024 result = [], 18025 seen = result; 18026 18027 if (comparator) { 18028 isCommon = false; 18029 includes = arrayIncludesWith; 18030 } 18031 else if (length >= LARGE_ARRAY_SIZE) { 18032 var set = iteratee ? null : createSet(array); 18033 if (set) { 18034 return setToArray(set); 18035 } 18036 isCommon = false; 18037 includes = cacheHas; 18038 seen = new SetCache; 18039 } 18040 else { 18041 seen = iteratee ? [] : result; 18042 } 18043 outer: 18044 while (++index < length) { 18045 var value = array[index], 18046 computed = iteratee ? iteratee(value) : value; 18047 18048 value = (comparator || value !== 0) ? value : 0; 18049 if (isCommon && computed === computed) { 18050 var seenIndex = seen.length; 18051 while (seenIndex--) { 18052 if (seen[seenIndex] === computed) { 18053 continue outer; 18054 } 18055 } 18056 if (iteratee) { 18057 seen.push(computed); 18058 } 18059 result.push(value); 18060 } 18061 else if (!includes(seen, computed, comparator)) { 18062 if (seen !== result) { 18063 seen.push(computed); 18064 } 18065 result.push(value); 18066 } 18067 } 18068 return result; 18069 } 18070 18071 /** 18072 * The base implementation of `_.unset`. 18073 * 18074 * @private 18075 * @param {Object} object The object to modify. 18076 * @param {Array|string} path The property path to unset. 18077 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 18078 */ 18079 function baseUnset(object, path) { 18080 path = castPath(path, object); 18081 object = parent(object, path); 18082 return object == null || delete object[toKey(last(path))]; 18083 } 18084 18085 /** 18086 * The base implementation of `_.update`. 18087 * 18088 * @private 18089 * @param {Object} object The object to modify. 18090 * @param {Array|string} path The path of the property to update. 18091 * @param {Function} updater The function to produce the updated value. 18092 * @param {Function} [customizer] The function to customize path creation. 18093 * @returns {Object} Returns `object`. 18094 */ 18095 function baseUpdate(object, path, updater, customizer) { 18096 return baseSet(object, path, updater(baseGet(object, path)), customizer); 18097 } 18098 18099 /** 18100 * The base implementation of methods like `_.dropWhile` and `_.takeWhile` 18101 * without support for iteratee shorthands. 18102 * 18103 * @private 18104 * @param {Array} array The array to query. 18105 * @param {Function} predicate The function invoked per iteration. 18106 * @param {boolean} [isDrop] Specify dropping elements instead of taking them. 18107 * @param {boolean} [fromRight] Specify iterating from right to left. 18108 * @returns {Array} Returns the slice of `array`. 18109 */ 18110 function baseWhile(array, predicate, isDrop, fromRight) { 18111 var length = array.length, 18112 index = fromRight ? length : -1; 18113 18114 while ((fromRight ? index-- : ++index < length) && 18115 predicate(array[index], index, array)) {} 18116 18117 return isDrop 18118 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) 18119 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); 18120 } 18121 18122 /** 18123 * The base implementation of `wrapperValue` which returns the result of 18124 * performing a sequence of actions on the unwrapped `value`, where each 18125 * successive action is supplied the return value of the previous. 18126 * 18127 * @private 18128 * @param {*} value The unwrapped value. 18129 * @param {Array} actions Actions to perform to resolve the unwrapped value. 18130 * @returns {*} Returns the resolved value. 18131 */ 18132 function baseWrapperValue(value, actions) { 18133 var result = value; 18134 if (result instanceof LazyWrapper) { 18135 result = result.value(); 18136 } 18137 return arrayReduce(actions, function(result, action) { 18138 return action.func.apply(action.thisArg, arrayPush([result], action.args)); 18139 }, result); 18140 } 18141 18142 /** 18143 * The base implementation of methods like `_.xor`, without support for 18144 * iteratee shorthands, that accepts an array of arrays to inspect. 18145 * 18146 * @private 18147 * @param {Array} arrays The arrays to inspect. 18148 * @param {Function} [iteratee] The iteratee invoked per element. 18149 * @param {Function} [comparator] The comparator invoked per element. 18150 * @returns {Array} Returns the new array of values. 18151 */ 18152 function baseXor(arrays, iteratee, comparator) { 18153 var length = arrays.length; 18154 if (length < 2) { 18155 return length ? baseUniq(arrays[0]) : []; 18156 } 18157 var index = -1, 18158 result = Array(length); 18159 18160 while (++index < length) { 18161 var array = arrays[index], 18162 othIndex = -1; 18163 18164 while (++othIndex < length) { 18165 if (othIndex != index) { 18166 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); 18167 } 18168 } 18169 } 18170 return baseUniq(baseFlatten(result, 1), iteratee, comparator); 18171 } 18172 18173 /** 18174 * This base implementation of `_.zipObject` which assigns values using `assignFunc`. 18175 * 18176 * @private 18177 * @param {Array} props The property identifiers. 18178 * @param {Array} values The property values. 18179 * @param {Function} assignFunc The function to assign values. 18180 * @returns {Object} Returns the new object. 18181 */ 18182 function baseZipObject(props, values, assignFunc) { 18183 var index = -1, 18184 length = props.length, 18185 valsLength = values.length, 18186 result = {}; 18187 18188 while (++index < length) { 18189 var value = index < valsLength ? values[index] : undefined; 18190 assignFunc(result, props[index], value); 18191 } 18192 return result; 18193 } 18194 18195 /** 18196 * Casts `value` to an empty array if it's not an array like object. 18197 * 18198 * @private 18199 * @param {*} value The value to inspect. 18200 * @returns {Array|Object} Returns the cast array-like object. 18201 */ 18202 function castArrayLikeObject(value) { 18203 return isArrayLikeObject(value) ? value : []; 18204 } 18205 18206 /** 18207 * Casts `value` to `identity` if it's not a function. 18208 * 18209 * @private 18210 * @param {*} value The value to inspect. 18211 * @returns {Function} Returns cast function. 18212 */ 18213 function castFunction(value) { 18214 return typeof value == 'function' ? value : identity; 18215 } 18216 18217 /** 18218 * Casts `value` to a path array if it's not one. 18219 * 18220 * @private 18221 * @param {*} value The value to inspect. 18222 * @param {Object} [object] The object to query keys on. 18223 * @returns {Array} Returns the cast property path array. 18224 */ 18225 function castPath(value, object) { 18226 if (isArray(value)) { 18227 return value; 18228 } 18229 return isKey(value, object) ? [value] : stringToPath(toString(value)); 18230 } 18231 18232 /** 18233 * A `baseRest` alias which can be replaced with `identity` by module 18234 * replacement plugins. 18235 * 18236 * @private 18237 * @type {Function} 18238 * @param {Function} func The function to apply a rest parameter to. 18239 * @returns {Function} Returns the new function. 18240 */ 18241 var castRest = baseRest; 18242 18243 /** 18244 * Casts `array` to a slice if it's needed. 18245 * 18246 * @private 18247 * @param {Array} array The array to inspect. 18248 * @param {number} start The start position. 18249 * @param {number} [end=array.length] The end position. 18250 * @returns {Array} Returns the cast slice. 18251 */ 18252 function castSlice(array, start, end) { 18253 var length = array.length; 18254 end = end === undefined ? length : end; 18255 return (!start && end >= length) ? array : baseSlice(array, start, end); 18256 } 18257 18258 /** 18259 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). 18260 * 18261 * @private 18262 * @param {number|Object} id The timer id or timeout object of the timer to clear. 18263 */ 18264 var clearTimeout = ctxClearTimeout || function(id) { 18265 return root.clearTimeout(id); 18266 }; 18267 18268 /** 18269 * Creates a clone of `buffer`. 18270 * 18271 * @private 18272 * @param {Buffer} buffer The buffer to clone. 18273 * @param {boolean} [isDeep] Specify a deep clone. 18274 * @returns {Buffer} Returns the cloned buffer. 18275 */ 18276 function cloneBuffer(buffer, isDeep) { 18277 if (isDeep) { 18278 return buffer.slice(); 18279 } 18280 var length = buffer.length, 18281 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 18282 18283 buffer.copy(result); 18284 return result; 18285 } 18286 18287 /** 18288 * Creates a clone of `arrayBuffer`. 18289 * 18290 * @private 18291 * @param {ArrayBuffer} arrayBuffer The array buffer to clone. 18292 * @returns {ArrayBuffer} Returns the cloned array buffer. 18293 */ 18294 function cloneArrayBuffer(arrayBuffer) { 18295 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 18296 new Uint8Array(result).set(new Uint8Array(arrayBuffer)); 18297 return result; 18298 } 18299 18300 /** 18301 * Creates a clone of `dataView`. 18302 * 18303 * @private 18304 * @param {Object} dataView The data view to clone. 18305 * @param {boolean} [isDeep] Specify a deep clone. 18306 * @returns {Object} Returns the cloned data view. 18307 */ 18308 function cloneDataView(dataView, isDeep) { 18309 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 18310 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 18311 } 18312 18313 /** 18314 * Creates a clone of `regexp`. 18315 * 18316 * @private 18317 * @param {Object} regexp The regexp to clone. 18318 * @returns {Object} Returns the cloned regexp. 18319 */ 18320 function cloneRegExp(regexp) { 18321 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); 18322 result.lastIndex = regexp.lastIndex; 18323 return result; 18324 } 18325 18326 /** 18327 * Creates a clone of the `symbol` object. 18328 * 18329 * @private 18330 * @param {Object} symbol The symbol object to clone. 18331 * @returns {Object} Returns the cloned symbol object. 18332 */ 18333 function cloneSymbol(symbol) { 18334 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; 18335 } 18336 18337 /** 18338 * Creates a clone of `typedArray`. 18339 * 18340 * @private 18341 * @param {Object} typedArray The typed array to clone. 18342 * @param {boolean} [isDeep] Specify a deep clone. 18343 * @returns {Object} Returns the cloned typed array. 18344 */ 18345 function cloneTypedArray(typedArray, isDeep) { 18346 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 18347 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 18348 } 18349 18350 /** 18351 * Compares values to sort them in ascending order. 18352 * 18353 * @private 18354 * @param {*} value The value to compare. 18355 * @param {*} other The other value to compare. 18356 * @returns {number} Returns the sort order indicator for `value`. 18357 */ 18358 function compareAscending(value, other) { 18359 if (value !== other) { 18360 var valIsDefined = value !== undefined, 18361 valIsNull = value === null, 18362 valIsReflexive = value === value, 18363 valIsSymbol = isSymbol(value); 18364 18365 var othIsDefined = other !== undefined, 18366 othIsNull = other === null, 18367 othIsReflexive = other === other, 18368 othIsSymbol = isSymbol(other); 18369 18370 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || 18371 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || 18372 (valIsNull && othIsDefined && othIsReflexive) || 18373 (!valIsDefined && othIsReflexive) || 18374 !valIsReflexive) { 18375 return 1; 18376 } 18377 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || 18378 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || 18379 (othIsNull && valIsDefined && valIsReflexive) || 18380 (!othIsDefined && valIsReflexive) || 18381 !othIsReflexive) { 18382 return -1; 18383 } 18384 } 18385 return 0; 18386 } 18387 18388 /** 18389 * Used by `_.orderBy` to compare multiple properties of a value to another 18390 * and stable sort them. 18391 * 18392 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, 18393 * specify an order of "desc" for descending or "asc" for ascending sort order 18394 * of corresponding values. 18395 * 18396 * @private 18397 * @param {Object} object The object to compare. 18398 * @param {Object} other The other object to compare. 18399 * @param {boolean[]|string[]} orders The order to sort by for each property. 18400 * @returns {number} Returns the sort order indicator for `object`. 18401 */ 18402 function compareMultiple(object, other, orders) { 18403 var index = -1, 18404 objCriteria = object.criteria, 18405 othCriteria = other.criteria, 18406 length = objCriteria.length, 18407 ordersLength = orders.length; 18408 18409 while (++index < length) { 18410 var result = compareAscending(objCriteria[index], othCriteria[index]); 18411 if (result) { 18412 if (index >= ordersLength) { 18413 return result; 18414 } 18415 var order = orders[index]; 18416 return result * (order == 'desc' ? -1 : 1); 18417 } 18418 } 18419 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications 18420 // that causes it, under certain circumstances, to provide the same value for 18421 // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 18422 // for more details. 18423 // 18424 // This also ensures a stable sort in V8 and other engines. 18425 // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. 18426 return object.index - other.index; 18427 } 18428 18429 /** 18430 * Creates an array that is the composition of partially applied arguments, 18431 * placeholders, and provided arguments into a single array of arguments. 18432 * 18433 * @private 18434 * @param {Array} args The provided arguments. 18435 * @param {Array} partials The arguments to prepend to those provided. 18436 * @param {Array} holders The `partials` placeholder indexes. 18437 * @params {boolean} [isCurried] Specify composing for a curried function. 18438 * @returns {Array} Returns the new array of composed arguments. 18439 */ 18440 function composeArgs(args, partials, holders, isCurried) { 18441 var argsIndex = -1, 18442 argsLength = args.length, 18443 holdersLength = holders.length, 18444 leftIndex = -1, 18445 leftLength = partials.length, 18446 rangeLength = nativeMax(argsLength - holdersLength, 0), 18447 result = Array(leftLength + rangeLength), 18448 isUncurried = !isCurried; 18449 18450 while (++leftIndex < leftLength) { 18451 result[leftIndex] = partials[leftIndex]; 18452 } 18453 while (++argsIndex < holdersLength) { 18454 if (isUncurried || argsIndex < argsLength) { 18455 result[holders[argsIndex]] = args[argsIndex]; 18456 } 18457 } 18458 while (rangeLength--) { 18459 result[leftIndex++] = args[argsIndex++]; 18460 } 18461 return result; 18462 } 18463 18464 /** 18465 * This function is like `composeArgs` except that the arguments composition 18466 * is tailored for `_.partialRight`. 18467 * 18468 * @private 18469 * @param {Array} args The provided arguments. 18470 * @param {Array} partials The arguments to append to those provided. 18471 * @param {Array} holders The `partials` placeholder indexes. 18472 * @params {boolean} [isCurried] Specify composing for a curried function. 18473 * @returns {Array} Returns the new array of composed arguments. 18474 */ 18475 function composeArgsRight(args, partials, holders, isCurried) { 18476 var argsIndex = -1, 18477 argsLength = args.length, 18478 holdersIndex = -1, 18479 holdersLength = holders.length, 18480 rightIndex = -1, 18481 rightLength = partials.length, 18482 rangeLength = nativeMax(argsLength - holdersLength, 0), 18483 result = Array(rangeLength + rightLength), 18484 isUncurried = !isCurried; 18485 18486 while (++argsIndex < rangeLength) { 18487 result[argsIndex] = args[argsIndex]; 18488 } 18489 var offset = argsIndex; 18490 while (++rightIndex < rightLength) { 18491 result[offset + rightIndex] = partials[rightIndex]; 18492 } 18493 while (++holdersIndex < holdersLength) { 18494 if (isUncurried || argsIndex < argsLength) { 18495 result[offset + holders[holdersIndex]] = args[argsIndex++]; 18496 } 18497 } 18498 return result; 18499 } 18500 18501 /** 18502 * Copies the values of `source` to `array`. 18503 * 18504 * @private 18505 * @param {Array} source The array to copy values from. 18506 * @param {Array} [array=[]] The array to copy values to. 18507 * @returns {Array} Returns `array`. 18508 */ 18509 function copyArray(source, array) { 18510 var index = -1, 18511 length = source.length; 18512 18513 array || (array = Array(length)); 18514 while (++index < length) { 18515 array[index] = source[index]; 18516 } 18517 return array; 18518 } 18519 18520 /** 18521 * Copies properties of `source` to `object`. 18522 * 18523 * @private 18524 * @param {Object} source The object to copy properties from. 18525 * @param {Array} props The property identifiers to copy. 18526 * @param {Object} [object={}] The object to copy properties to. 18527 * @param {Function} [customizer] The function to customize copied values. 18528 * @returns {Object} Returns `object`. 18529 */ 18530 function copyObject(source, props, object, customizer) { 18531 var isNew = !object; 18532 object || (object = {}); 18533 18534 var index = -1, 18535 length = props.length; 18536 18537 while (++index < length) { 18538 var key = props[index]; 18539 18540 var newValue = customizer 18541 ? customizer(object[key], source[key], key, object, source) 18542 : undefined; 18543 18544 if (newValue === undefined) { 18545 newValue = source[key]; 18546 } 18547 if (isNew) { 18548 baseAssignValue(object, key, newValue); 18549 } else { 18550 assignValue(object, key, newValue); 18551 } 18552 } 18553 return object; 18554 } 18555 18556 /** 18557 * Copies own symbols of `source` to `object`. 18558 * 18559 * @private 18560 * @param {Object} source The object to copy symbols from. 18561 * @param {Object} [object={}] The object to copy symbols to. 18562 * @returns {Object} Returns `object`. 18563 */ 18564 function copySymbols(source, object) { 18565 return copyObject(source, getSymbols(source), object); 18566 } 18567 18568 /** 18569 * Copies own and inherited symbols of `source` to `object`. 18570 * 18571 * @private 18572 * @param {Object} source The object to copy symbols from. 18573 * @param {Object} [object={}] The object to copy symbols to. 18574 * @returns {Object} Returns `object`. 18575 */ 18576 function copySymbolsIn(source, object) { 18577 return copyObject(source, getSymbolsIn(source), object); 18578 } 18579 18580 /** 18581 * Creates a function like `_.groupBy`. 18582 * 18583 * @private 18584 * @param {Function} setter The function to set accumulator values. 18585 * @param {Function} [initializer] The accumulator object initializer. 18586 * @returns {Function} Returns the new aggregator function. 18587 */ 18588 function createAggregator(setter, initializer) { 18589 return function(collection, iteratee) { 18590 var func = isArray(collection) ? arrayAggregator : baseAggregator, 18591 accumulator = initializer ? initializer() : {}; 18592 18593 return func(collection, setter, getIteratee(iteratee, 2), accumulator); 18594 }; 18595 } 18596 18597 /** 18598 * Creates a function like `_.assign`. 18599 * 18600 * @private 18601 * @param {Function} assigner The function to assign values. 18602 * @returns {Function} Returns the new assigner function. 18603 */ 18604 function createAssigner(assigner) { 18605 return baseRest(function(object, sources) { 18606 var index = -1, 18607 length = sources.length, 18608 customizer = length > 1 ? sources[length - 1] : undefined, 18609 guard = length > 2 ? sources[2] : undefined; 18610 18611 customizer = (assigner.length > 3 && typeof customizer == 'function') 18612 ? (length--, customizer) 18613 : undefined; 18614 18615 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 18616 customizer = length < 3 ? undefined : customizer; 18617 length = 1; 18618 } 18619 object = Object(object); 18620 while (++index < length) { 18621 var source = sources[index]; 18622 if (source) { 18623 assigner(object, source, index, customizer); 18624 } 18625 } 18626 return object; 18627 }); 18628 } 18629 18630 /** 18631 * Creates a `baseEach` or `baseEachRight` function. 18632 * 18633 * @private 18634 * @param {Function} eachFunc The function to iterate over a collection. 18635 * @param {boolean} [fromRight] Specify iterating from right to left. 18636 * @returns {Function} Returns the new base function. 18637 */ 18638 function createBaseEach(eachFunc, fromRight) { 18639 return function(collection, iteratee) { 18640 if (collection == null) { 18641 return collection; 18642 } 18643 if (!isArrayLike(collection)) { 18644 return eachFunc(collection, iteratee); 18645 } 18646 var length = collection.length, 18647 index = fromRight ? length : -1, 18648 iterable = Object(collection); 18649 18650 while ((fromRight ? index-- : ++index < length)) { 18651 if (iteratee(iterable[index], index, iterable) === false) { 18652 break; 18653 } 18654 } 18655 return collection; 18656 }; 18657 } 18658 18659 /** 18660 * Creates a base function for methods like `_.forIn` and `_.forOwn`. 18661 * 18662 * @private 18663 * @param {boolean} [fromRight] Specify iterating from right to left. 18664 * @returns {Function} Returns the new base function. 18665 */ 18666 function createBaseFor(fromRight) { 18667 return function(object, iteratee, keysFunc) { 18668 var index = -1, 18669 iterable = Object(object), 18670 props = keysFunc(object), 18671 length = props.length; 18672 18673 while (length--) { 18674 var key = props[fromRight ? length : ++index]; 18675 if (iteratee(iterable[key], key, iterable) === false) { 18676 break; 18677 } 18678 } 18679 return object; 18680 }; 18681 } 18682 18683 /** 18684 * Creates a function that wraps `func` to invoke it with the optional `this` 18685 * binding of `thisArg`. 18686 * 18687 * @private 18688 * @param {Function} func The function to wrap. 18689 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 18690 * @param {*} [thisArg] The `this` binding of `func`. 18691 * @returns {Function} Returns the new wrapped function. 18692 */ 18693 function createBind(func, bitmask, thisArg) { 18694 var isBind = bitmask & WRAP_BIND_FLAG, 18695 Ctor = createCtor(func); 18696 18697 function wrapper() { 18698 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 18699 return fn.apply(isBind ? thisArg : this, arguments); 18700 } 18701 return wrapper; 18702 } 18703 18704 /** 18705 * Creates a function like `_.lowerFirst`. 18706 * 18707 * @private 18708 * @param {string} methodName The name of the `String` case method to use. 18709 * @returns {Function} Returns the new case function. 18710 */ 18711 function createCaseFirst(methodName) { 18712 return function(string) { 18713 string = toString(string); 18714 18715 var strSymbols = hasUnicode(string) 18716 ? stringToArray(string) 18717 : undefined; 18718 18719 var chr = strSymbols 18720 ? strSymbols[0] 18721 : string.charAt(0); 18722 18723 var trailing = strSymbols 18724 ? castSlice(strSymbols, 1).join('') 18725 : string.slice(1); 18726 18727 return chr[methodName]() + trailing; 18728 }; 18729 } 18730 18731 /** 18732 * Creates a function like `_.camelCase`. 18733 * 18734 * @private 18735 * @param {Function} callback The function to combine each word. 18736 * @returns {Function} Returns the new compounder function. 18737 */ 18738 function createCompounder(callback) { 18739 return function(string) { 18740 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); 18741 }; 18742 } 18743 18744 /** 18745 * Creates a function that produces an instance of `Ctor` regardless of 18746 * whether it was invoked as part of a `new` expression or by `call` or `apply`. 18747 * 18748 * @private 18749 * @param {Function} Ctor The constructor to wrap. 18750 * @returns {Function} Returns the new wrapped function. 18751 */ 18752 function createCtor(Ctor) { 18753 return function() { 18754 // Use a `switch` statement to work with class constructors. See 18755 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist 18756 // for more details. 18757 var args = arguments; 18758 switch (args.length) { 18759 case 0: return new Ctor; 18760 case 1: return new Ctor(args[0]); 18761 case 2: return new Ctor(args[0], args[1]); 18762 case 3: return new Ctor(args[0], args[1], args[2]); 18763 case 4: return new Ctor(args[0], args[1], args[2], args[3]); 18764 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); 18765 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 18766 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 18767 } 18768 var thisBinding = baseCreate(Ctor.prototype), 18769 result = Ctor.apply(thisBinding, args); 18770 18771 // Mimic the constructor's `return` behavior. 18772 // See https://es5.github.io/#x13.2.2 for more details. 18773 return isObject(result) ? result : thisBinding; 18774 }; 18775 } 18776 18777 /** 18778 * Creates a function that wraps `func` to enable currying. 18779 * 18780 * @private 18781 * @param {Function} func The function to wrap. 18782 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 18783 * @param {number} arity The arity of `func`. 18784 * @returns {Function} Returns the new wrapped function. 18785 */ 18786 function createCurry(func, bitmask, arity) { 18787 var Ctor = createCtor(func); 18788 18789 function wrapper() { 18790 var length = arguments.length, 18791 args = Array(length), 18792 index = length, 18793 placeholder = getHolder(wrapper); 18794 18795 while (index--) { 18796 args[index] = arguments[index]; 18797 } 18798 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) 18799 ? [] 18800 : replaceHolders(args, placeholder); 18801 18802 length -= holders.length; 18803 if (length < arity) { 18804 return createRecurry( 18805 func, bitmask, createHybrid, wrapper.placeholder, undefined, 18806 args, holders, undefined, undefined, arity - length); 18807 } 18808 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 18809 return apply(fn, this, args); 18810 } 18811 return wrapper; 18812 } 18813 18814 /** 18815 * Creates a `_.find` or `_.findLast` function. 18816 * 18817 * @private 18818 * @param {Function} findIndexFunc The function to find the collection index. 18819 * @returns {Function} Returns the new find function. 18820 */ 18821 function createFind(findIndexFunc) { 18822 return function(collection, predicate, fromIndex) { 18823 var iterable = Object(collection); 18824 if (!isArrayLike(collection)) { 18825 var iteratee = getIteratee(predicate, 3); 18826 collection = keys(collection); 18827 predicate = function(key) { return iteratee(iterable[key], key, iterable); }; 18828 } 18829 var index = findIndexFunc(collection, predicate, fromIndex); 18830 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; 18831 }; 18832 } 18833 18834 /** 18835 * Creates a `_.flow` or `_.flowRight` function. 18836 * 18837 * @private 18838 * @param {boolean} [fromRight] Specify iterating from right to left. 18839 * @returns {Function} Returns the new flow function. 18840 */ 18841 function createFlow(fromRight) { 18842 return flatRest(function(funcs) { 18843 var length = funcs.length, 18844 index = length, 18845 prereq = LodashWrapper.prototype.thru; 18846 18847 if (fromRight) { 18848 funcs.reverse(); 18849 } 18850 while (index--) { 18851 var func = funcs[index]; 18852 if (typeof func != 'function') { 18853 throw new TypeError(FUNC_ERROR_TEXT); 18854 } 18855 if (prereq && !wrapper && getFuncName(func) == 'wrapper') { 18856 var wrapper = new LodashWrapper([], true); 18857 } 18858 } 18859 index = wrapper ? index : length; 18860 while (++index < length) { 18861 func = funcs[index]; 18862 18863 var funcName = getFuncName(func), 18864 data = funcName == 'wrapper' ? getData(func) : undefined; 18865 18866 if (data && isLaziable(data[0]) && 18867 data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && 18868 !data[4].length && data[9] == 1 18869 ) { 18870 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 18871 } else { 18872 wrapper = (func.length == 1 && isLaziable(func)) 18873 ? wrapper[funcName]() 18874 : wrapper.thru(func); 18875 } 18876 } 18877 return function() { 18878 var args = arguments, 18879 value = args[0]; 18880 18881 if (wrapper && args.length == 1 && isArray(value)) { 18882 return wrapper.plant(value).value(); 18883 } 18884 var index = 0, 18885 result = length ? funcs[index].apply(this, args) : value; 18886 18887 while (++index < length) { 18888 result = funcs[index].call(this, result); 18889 } 18890 return result; 18891 }; 18892 }); 18893 } 18894 18895 /** 18896 * Creates a function that wraps `func` to invoke it with optional `this` 18897 * binding of `thisArg`, partial application, and currying. 18898 * 18899 * @private 18900 * @param {Function|string} func The function or method name to wrap. 18901 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 18902 * @param {*} [thisArg] The `this` binding of `func`. 18903 * @param {Array} [partials] The arguments to prepend to those provided to 18904 * the new function. 18905 * @param {Array} [holders] The `partials` placeholder indexes. 18906 * @param {Array} [partialsRight] The arguments to append to those provided 18907 * to the new function. 18908 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. 18909 * @param {Array} [argPos] The argument positions of the new function. 18910 * @param {number} [ary] The arity cap of `func`. 18911 * @param {number} [arity] The arity of `func`. 18912 * @returns {Function} Returns the new wrapped function. 18913 */ 18914 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { 18915 var isAry = bitmask & WRAP_ARY_FLAG, 18916 isBind = bitmask & WRAP_BIND_FLAG, 18917 isBindKey = bitmask & WRAP_BIND_KEY_FLAG, 18918 isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), 18919 isFlip = bitmask & WRAP_FLIP_FLAG, 18920 Ctor = isBindKey ? undefined : createCtor(func); 18921 18922 function wrapper() { 18923 var length = arguments.length, 18924 args = Array(length), 18925 index = length; 18926 18927 while (index--) { 18928 args[index] = arguments[index]; 18929 } 18930 if (isCurried) { 18931 var placeholder = getHolder(wrapper), 18932 holdersCount = countHolders(args, placeholder); 18933 } 18934 if (partials) { 18935 args = composeArgs(args, partials, holders, isCurried); 18936 } 18937 if (partialsRight) { 18938 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 18939 } 18940 length -= holdersCount; 18941 if (isCurried && length < arity) { 18942 var newHolders = replaceHolders(args, placeholder); 18943 return createRecurry( 18944 func, bitmask, createHybrid, wrapper.placeholder, thisArg, 18945 args, newHolders, argPos, ary, arity - length 18946 ); 18947 } 18948 var thisBinding = isBind ? thisArg : this, 18949 fn = isBindKey ? thisBinding[func] : func; 18950 18951 length = args.length; 18952 if (argPos) { 18953 args = reorder(args, argPos); 18954 } else if (isFlip && length > 1) { 18955 args.reverse(); 18956 } 18957 if (isAry && ary < length) { 18958 args.length = ary; 18959 } 18960 if (this && this !== root && this instanceof wrapper) { 18961 fn = Ctor || createCtor(fn); 18962 } 18963 return fn.apply(thisBinding, args); 18964 } 18965 return wrapper; 18966 } 18967 18968 /** 18969 * Creates a function like `_.invertBy`. 18970 * 18971 * @private 18972 * @param {Function} setter The function to set accumulator values. 18973 * @param {Function} toIteratee The function to resolve iteratees. 18974 * @returns {Function} Returns the new inverter function. 18975 */ 18976 function createInverter(setter, toIteratee) { 18977 return function(object, iteratee) { 18978 return baseInverter(object, setter, toIteratee(iteratee), {}); 18979 }; 18980 } 18981 18982 /** 18983 * Creates a function that performs a mathematical operation on two values. 18984 * 18985 * @private 18986 * @param {Function} operator The function to perform the operation. 18987 * @param {number} [defaultValue] The value used for `undefined` arguments. 18988 * @returns {Function} Returns the new mathematical operation function. 18989 */ 18990 function createMathOperation(operator, defaultValue) { 18991 return function(value, other) { 18992 var result; 18993 if (value === undefined && other === undefined) { 18994 return defaultValue; 18995 } 18996 if (value !== undefined) { 18997 result = value; 18998 } 18999 if (other !== undefined) { 19000 if (result === undefined) { 19001 return other; 19002 } 19003 if (typeof value == 'string' || typeof other == 'string') { 19004 value = baseToString(value); 19005 other = baseToString(other); 19006 } else { 19007 value = baseToNumber(value); 19008 other = baseToNumber(other); 19009 } 19010 result = operator(value, other); 19011 } 19012 return result; 19013 }; 19014 } 19015 19016 /** 19017 * Creates a function like `_.over`. 19018 * 19019 * @private 19020 * @param {Function} arrayFunc The function to iterate over iteratees. 19021 * @returns {Function} Returns the new over function. 19022 */ 19023 function createOver(arrayFunc) { 19024 return flatRest(function(iteratees) { 19025 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 19026 return baseRest(function(args) { 19027 var thisArg = this; 19028 return arrayFunc(iteratees, function(iteratee) { 19029 return apply(iteratee, thisArg, args); 19030 }); 19031 }); 19032 }); 19033 } 19034 19035 /** 19036 * Creates the padding for `string` based on `length`. The `chars` string 19037 * is truncated if the number of characters exceeds `length`. 19038 * 19039 * @private 19040 * @param {number} length The padding length. 19041 * @param {string} [chars=' '] The string used as padding. 19042 * @returns {string} Returns the padding for `string`. 19043 */ 19044 function createPadding(length, chars) { 19045 chars = chars === undefined ? ' ' : baseToString(chars); 19046 19047 var charsLength = chars.length; 19048 if (charsLength < 2) { 19049 return charsLength ? baseRepeat(chars, length) : chars; 19050 } 19051 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); 19052 return hasUnicode(chars) 19053 ? castSlice(stringToArray(result), 0, length).join('') 19054 : result.slice(0, length); 19055 } 19056 19057 /** 19058 * Creates a function that wraps `func` to invoke it with the `this` binding 19059 * of `thisArg` and `partials` prepended to the arguments it receives. 19060 * 19061 * @private 19062 * @param {Function} func The function to wrap. 19063 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 19064 * @param {*} thisArg The `this` binding of `func`. 19065 * @param {Array} partials The arguments to prepend to those provided to 19066 * the new function. 19067 * @returns {Function} Returns the new wrapped function. 19068 */ 19069 function createPartial(func, bitmask, thisArg, partials) { 19070 var isBind = bitmask & WRAP_BIND_FLAG, 19071 Ctor = createCtor(func); 19072 19073 function wrapper() { 19074 var argsIndex = -1, 19075 argsLength = arguments.length, 19076 leftIndex = -1, 19077 leftLength = partials.length, 19078 args = Array(leftLength + argsLength), 19079 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 19080 19081 while (++leftIndex < leftLength) { 19082 args[leftIndex] = partials[leftIndex]; 19083 } 19084 while (argsLength--) { 19085 args[leftIndex++] = arguments[++argsIndex]; 19086 } 19087 return apply(fn, isBind ? thisArg : this, args); 19088 } 19089 return wrapper; 19090 } 19091 19092 /** 19093 * Creates a `_.range` or `_.rangeRight` function. 19094 * 19095 * @private 19096 * @param {boolean} [fromRight] Specify iterating from right to left. 19097 * @returns {Function} Returns the new range function. 19098 */ 19099 function createRange(fromRight) { 19100 return function(start, end, step) { 19101 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { 19102 end = step = undefined; 19103 } 19104 // Ensure the sign of `-0` is preserved. 19105 start = toFinite(start); 19106 if (end === undefined) { 19107 end = start; 19108 start = 0; 19109 } else { 19110 end = toFinite(end); 19111 } 19112 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); 19113 return baseRange(start, end, step, fromRight); 19114 }; 19115 } 19116 19117 /** 19118 * Creates a function that performs a relational operation on two values. 19119 * 19120 * @private 19121 * @param {Function} operator The function to perform the operation. 19122 * @returns {Function} Returns the new relational operation function. 19123 */ 19124 function createRelationalOperation(operator) { 19125 return function(value, other) { 19126 if (!(typeof value == 'string' && typeof other == 'string')) { 19127 value = toNumber(value); 19128 other = toNumber(other); 19129 } 19130 return operator(value, other); 19131 }; 19132 } 19133 19134 /** 19135 * Creates a function that wraps `func` to continue currying. 19136 * 19137 * @private 19138 * @param {Function} func The function to wrap. 19139 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 19140 * @param {Function} wrapFunc The function to create the `func` wrapper. 19141 * @param {*} placeholder The placeholder value. 19142 * @param {*} [thisArg] The `this` binding of `func`. 19143 * @param {Array} [partials] The arguments to prepend to those provided to 19144 * the new function. 19145 * @param {Array} [holders] The `partials` placeholder indexes. 19146 * @param {Array} [argPos] The argument positions of the new function. 19147 * @param {number} [ary] The arity cap of `func`. 19148 * @param {number} [arity] The arity of `func`. 19149 * @returns {Function} Returns the new wrapped function. 19150 */ 19151 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { 19152 var isCurry = bitmask & WRAP_CURRY_FLAG, 19153 newHolders = isCurry ? holders : undefined, 19154 newHoldersRight = isCurry ? undefined : holders, 19155 newPartials = isCurry ? partials : undefined, 19156 newPartialsRight = isCurry ? undefined : partials; 19157 19158 bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); 19159 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); 19160 19161 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { 19162 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); 19163 } 19164 var newData = [ 19165 func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, 19166 newHoldersRight, argPos, ary, arity 19167 ]; 19168 19169 var result = wrapFunc.apply(undefined, newData); 19170 if (isLaziable(func)) { 19171 setData(result, newData); 19172 } 19173 result.placeholder = placeholder; 19174 return setWrapToString(result, func, bitmask); 19175 } 19176 19177 /** 19178 * Creates a function like `_.round`. 19179 * 19180 * @private 19181 * @param {string} methodName The name of the `Math` method to use when rounding. 19182 * @returns {Function} Returns the new round function. 19183 */ 19184 function createRound(methodName) { 19185 var func = Math[methodName]; 19186 return function(number, precision) { 19187 number = toNumber(number); 19188 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); 19189 if (precision && nativeIsFinite(number)) { 19190 // Shift with exponential notation to avoid floating-point issues. 19191 // See [MDN](https://mdn.io/round#Examples) for more details. 19192 var pair = (toString(number) + 'e').split('e'), 19193 value = func(pair[0] + 'e' + (+pair[1] + precision)); 19194 19195 pair = (toString(value) + 'e').split('e'); 19196 return +(pair[0] + 'e' + (+pair[1] - precision)); 19197 } 19198 return func(number); 19199 }; 19200 } 19201 19202 /** 19203 * Creates a set object of `values`. 19204 * 19205 * @private 19206 * @param {Array} values The values to add to the set. 19207 * @returns {Object} Returns the new set. 19208 */ 19209 var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { 19210 return new Set(values); 19211 }; 19212 19213 /** 19214 * Creates a `_.toPairs` or `_.toPairsIn` function. 19215 * 19216 * @private 19217 * @param {Function} keysFunc The function to get the keys of a given object. 19218 * @returns {Function} Returns the new pairs function. 19219 */ 19220 function createToPairs(keysFunc) { 19221 return function(object) { 19222 var tag = getTag(object); 19223 if (tag == mapTag) { 19224 return mapToArray(object); 19225 } 19226 if (tag == setTag) { 19227 return setToPairs(object); 19228 } 19229 return baseToPairs(object, keysFunc(object)); 19230 }; 19231 } 19232 19233 /** 19234 * Creates a function that either curries or invokes `func` with optional 19235 * `this` binding and partially applied arguments. 19236 * 19237 * @private 19238 * @param {Function|string} func The function or method name to wrap. 19239 * @param {number} bitmask The bitmask flags. 19240 * 1 - `_.bind` 19241 * 2 - `_.bindKey` 19242 * 4 - `_.curry` or `_.curryRight` of a bound function 19243 * 8 - `_.curry` 19244 * 16 - `_.curryRight` 19245 * 32 - `_.partial` 19246 * 64 - `_.partialRight` 19247 * 128 - `_.rearg` 19248 * 256 - `_.ary` 19249 * 512 - `_.flip` 19250 * @param {*} [thisArg] The `this` binding of `func`. 19251 * @param {Array} [partials] The arguments to be partially applied. 19252 * @param {Array} [holders] The `partials` placeholder indexes. 19253 * @param {Array} [argPos] The argument positions of the new function. 19254 * @param {number} [ary] The arity cap of `func`. 19255 * @param {number} [arity] The arity of `func`. 19256 * @returns {Function} Returns the new wrapped function. 19257 */ 19258 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { 19259 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; 19260 if (!isBindKey && typeof func != 'function') { 19261 throw new TypeError(FUNC_ERROR_TEXT); 19262 } 19263 var length = partials ? partials.length : 0; 19264 if (!length) { 19265 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); 19266 partials = holders = undefined; 19267 } 19268 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); 19269 arity = arity === undefined ? arity : toInteger(arity); 19270 length -= holders ? holders.length : 0; 19271 19272 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { 19273 var partialsRight = partials, 19274 holdersRight = holders; 19275 19276 partials = holders = undefined; 19277 } 19278 var data = isBindKey ? undefined : getData(func); 19279 19280 var newData = [ 19281 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, 19282 argPos, ary, arity 19283 ]; 19284 19285 if (data) { 19286 mergeData(newData, data); 19287 } 19288 func = newData[0]; 19289 bitmask = newData[1]; 19290 thisArg = newData[2]; 19291 partials = newData[3]; 19292 holders = newData[4]; 19293 arity = newData[9] = newData[9] === undefined 19294 ? (isBindKey ? 0 : func.length) 19295 : nativeMax(newData[9] - length, 0); 19296 19297 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { 19298 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); 19299 } 19300 if (!bitmask || bitmask == WRAP_BIND_FLAG) { 19301 var result = createBind(func, bitmask, thisArg); 19302 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { 19303 result = createCurry(func, bitmask, arity); 19304 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { 19305 result = createPartial(func, bitmask, thisArg, partials); 19306 } else { 19307 result = createHybrid.apply(undefined, newData); 19308 } 19309 var setter = data ? baseSetData : setData; 19310 return setWrapToString(setter(result, newData), func, bitmask); 19311 } 19312 19313 /** 19314 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties 19315 * of source objects to the destination object for all destination properties 19316 * that resolve to `undefined`. 19317 * 19318 * @private 19319 * @param {*} objValue The destination value. 19320 * @param {*} srcValue The source value. 19321 * @param {string} key The key of the property to assign. 19322 * @param {Object} object The parent object of `objValue`. 19323 * @returns {*} Returns the value to assign. 19324 */ 19325 function customDefaultsAssignIn(objValue, srcValue, key, object) { 19326 if (objValue === undefined || 19327 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { 19328 return srcValue; 19329 } 19330 return objValue; 19331 } 19332 19333 /** 19334 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source 19335 * objects into destination objects that are passed thru. 19336 * 19337 * @private 19338 * @param {*} objValue The destination value. 19339 * @param {*} srcValue The source value. 19340 * @param {string} key The key of the property to merge. 19341 * @param {Object} object The parent object of `objValue`. 19342 * @param {Object} source The parent object of `srcValue`. 19343 * @param {Object} [stack] Tracks traversed source values and their merged 19344 * counterparts. 19345 * @returns {*} Returns the value to assign. 19346 */ 19347 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 19348 if (isObject(objValue) && isObject(srcValue)) { 19349 // Recursively merge objects and arrays (susceptible to call stack limits). 19350 stack.set(srcValue, objValue); 19351 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); 19352 stack['delete'](srcValue); 19353 } 19354 return objValue; 19355 } 19356 19357 /** 19358 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain 19359 * objects. 19360 * 19361 * @private 19362 * @param {*} value The value to inspect. 19363 * @param {string} key The key of the property to inspect. 19364 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. 19365 */ 19366 function customOmitClone(value) { 19367 return isPlainObject(value) ? undefined : value; 19368 } 19369 19370 /** 19371 * A specialized version of `baseIsEqualDeep` for arrays with support for 19372 * partial deep comparisons. 19373 * 19374 * @private 19375 * @param {Array} array The array to compare. 19376 * @param {Array} other The other array to compare. 19377 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 19378 * @param {Function} customizer The function to customize comparisons. 19379 * @param {Function} equalFunc The function to determine equivalents of values. 19380 * @param {Object} stack Tracks traversed `array` and `other` objects. 19381 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. 19382 */ 19383 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 19384 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 19385 arrLength = array.length, 19386 othLength = other.length; 19387 19388 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 19389 return false; 19390 } 19391 // Check that cyclic values are equal. 19392 var arrStacked = stack.get(array); 19393 var othStacked = stack.get(other); 19394 if (arrStacked && othStacked) { 19395 return arrStacked == other && othStacked == array; 19396 } 19397 var index = -1, 19398 result = true, 19399 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; 19400 19401 stack.set(array, other); 19402 stack.set(other, array); 19403 19404 // Ignore non-index properties. 19405 while (++index < arrLength) { 19406 var arrValue = array[index], 19407 othValue = other[index]; 19408 19409 if (customizer) { 19410 var compared = isPartial 19411 ? customizer(othValue, arrValue, index, other, array, stack) 19412 : customizer(arrValue, othValue, index, array, other, stack); 19413 } 19414 if (compared !== undefined) { 19415 if (compared) { 19416 continue; 19417 } 19418 result = false; 19419 break; 19420 } 19421 // Recursively compare arrays (susceptible to call stack limits). 19422 if (seen) { 19423 if (!arraySome(other, function(othValue, othIndex) { 19424 if (!cacheHas(seen, othIndex) && 19425 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 19426 return seen.push(othIndex); 19427 } 19428 })) { 19429 result = false; 19430 break; 19431 } 19432 } else if (!( 19433 arrValue === othValue || 19434 equalFunc(arrValue, othValue, bitmask, customizer, stack) 19435 )) { 19436 result = false; 19437 break; 19438 } 19439 } 19440 stack['delete'](array); 19441 stack['delete'](other); 19442 return result; 19443 } 19444 19445 /** 19446 * A specialized version of `baseIsEqualDeep` for comparing objects of 19447 * the same `toStringTag`. 19448 * 19449 * **Note:** This function only supports comparing values with tags of 19450 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. 19451 * 19452 * @private 19453 * @param {Object} object The object to compare. 19454 * @param {Object} other The other object to compare. 19455 * @param {string} tag The `toStringTag` of the objects to compare. 19456 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 19457 * @param {Function} customizer The function to customize comparisons. 19458 * @param {Function} equalFunc The function to determine equivalents of values. 19459 * @param {Object} stack Tracks traversed `object` and `other` objects. 19460 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 19461 */ 19462 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 19463 switch (tag) { 19464 case dataViewTag: 19465 if ((object.byteLength != other.byteLength) || 19466 (object.byteOffset != other.byteOffset)) { 19467 return false; 19468 } 19469 object = object.buffer; 19470 other = other.buffer; 19471 19472 case arrayBufferTag: 19473 if ((object.byteLength != other.byteLength) || 19474 !equalFunc(new Uint8Array(object), new Uint8Array(other))) { 19475 return false; 19476 } 19477 return true; 19478 19479 case boolTag: 19480 case dateTag: 19481 case numberTag: 19482 // Coerce booleans to `1` or `0` and dates to milliseconds. 19483 // Invalid dates are coerced to `NaN`. 19484 return eq(+object, +other); 19485 19486 case errorTag: 19487 return object.name == other.name && object.message == other.message; 19488 19489 case regexpTag: 19490 case stringTag: 19491 // Coerce regexes to strings and treat strings, primitives and objects, 19492 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring 19493 // for more details. 19494 return object == (other + ''); 19495 19496 case mapTag: 19497 var convert = mapToArray; 19498 19499 case setTag: 19500 var isPartial = bitmask & COMPARE_PARTIAL_FLAG; 19501 convert || (convert = setToArray); 19502 19503 if (object.size != other.size && !isPartial) { 19504 return false; 19505 } 19506 // Assume cyclic values are equal. 19507 var stacked = stack.get(object); 19508 if (stacked) { 19509 return stacked == other; 19510 } 19511 bitmask |= COMPARE_UNORDERED_FLAG; 19512 19513 // Recursively compare objects (susceptible to call stack limits). 19514 stack.set(object, other); 19515 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 19516 stack['delete'](object); 19517 return result; 19518 19519 case symbolTag: 19520 if (symbolValueOf) { 19521 return symbolValueOf.call(object) == symbolValueOf.call(other); 19522 } 19523 } 19524 return false; 19525 } 19526 19527 /** 19528 * A specialized version of `baseIsEqualDeep` for objects with support for 19529 * partial deep comparisons. 19530 * 19531 * @private 19532 * @param {Object} object The object to compare. 19533 * @param {Object} other The other object to compare. 19534 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 19535 * @param {Function} customizer The function to customize comparisons. 19536 * @param {Function} equalFunc The function to determine equivalents of values. 19537 * @param {Object} stack Tracks traversed `object` and `other` objects. 19538 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 19539 */ 19540 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 19541 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 19542 objProps = getAllKeys(object), 19543 objLength = objProps.length, 19544 othProps = getAllKeys(other), 19545 othLength = othProps.length; 19546 19547 if (objLength != othLength && !isPartial) { 19548 return false; 19549 } 19550 var index = objLength; 19551 while (index--) { 19552 var key = objProps[index]; 19553 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 19554 return false; 19555 } 19556 } 19557 // Check that cyclic values are equal. 19558 var objStacked = stack.get(object); 19559 var othStacked = stack.get(other); 19560 if (objStacked && othStacked) { 19561 return objStacked == other && othStacked == object; 19562 } 19563 var result = true; 19564 stack.set(object, other); 19565 stack.set(other, object); 19566 19567 var skipCtor = isPartial; 19568 while (++index < objLength) { 19569 key = objProps[index]; 19570 var objValue = object[key], 19571 othValue = other[key]; 19572 19573 if (customizer) { 19574 var compared = isPartial 19575 ? customizer(othValue, objValue, key, other, object, stack) 19576 : customizer(objValue, othValue, key, object, other, stack); 19577 } 19578 // Recursively compare objects (susceptible to call stack limits). 19579 if (!(compared === undefined 19580 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) 19581 : compared 19582 )) { 19583 result = false; 19584 break; 19585 } 19586 skipCtor || (skipCtor = key == 'constructor'); 19587 } 19588 if (result && !skipCtor) { 19589 var objCtor = object.constructor, 19590 othCtor = other.constructor; 19591 19592 // Non `Object` object instances with different constructors are not equal. 19593 if (objCtor != othCtor && 19594 ('constructor' in object && 'constructor' in other) && 19595 !(typeof objCtor == 'function' && objCtor instanceof objCtor && 19596 typeof othCtor == 'function' && othCtor instanceof othCtor)) { 19597 result = false; 19598 } 19599 } 19600 stack['delete'](object); 19601 stack['delete'](other); 19602 return result; 19603 } 19604 19605 /** 19606 * A specialized version of `baseRest` which flattens the rest array. 19607 * 19608 * @private 19609 * @param {Function} func The function to apply a rest parameter to. 19610 * @returns {Function} Returns the new function. 19611 */ 19612 function flatRest(func) { 19613 return setToString(overRest(func, undefined, flatten), func + ''); 19614 } 19615 19616 /** 19617 * Creates an array of own enumerable property names and symbols of `object`. 19618 * 19619 * @private 19620 * @param {Object} object The object to query. 19621 * @returns {Array} Returns the array of property names and symbols. 19622 */ 19623 function getAllKeys(object) { 19624 return baseGetAllKeys(object, keys, getSymbols); 19625 } 19626 19627 /** 19628 * Creates an array of own and inherited enumerable property names and 19629 * symbols of `object`. 19630 * 19631 * @private 19632 * @param {Object} object The object to query. 19633 * @returns {Array} Returns the array of property names and symbols. 19634 */ 19635 function getAllKeysIn(object) { 19636 return baseGetAllKeys(object, keysIn, getSymbolsIn); 19637 } 19638 19639 /** 19640 * Gets metadata for `func`. 19641 * 19642 * @private 19643 * @param {Function} func The function to query. 19644 * @returns {*} Returns the metadata for `func`. 19645 */ 19646 var getData = !metaMap ? noop : function(func) { 19647 return metaMap.get(func); 19648 }; 19649 19650 /** 19651 * Gets the name of `func`. 19652 * 19653 * @private 19654 * @param {Function} func The function to query. 19655 * @returns {string} Returns the function name. 19656 */ 19657 function getFuncName(func) { 19658 var result = (func.name + ''), 19659 array = realNames[result], 19660 length = hasOwnProperty.call(realNames, result) ? array.length : 0; 19661 19662 while (length--) { 19663 var data = array[length], 19664 otherFunc = data.func; 19665 if (otherFunc == null || otherFunc == func) { 19666 return data.name; 19667 } 19668 } 19669 return result; 19670 } 19671 19672 /** 19673 * Gets the argument placeholder value for `func`. 19674 * 19675 * @private 19676 * @param {Function} func The function to inspect. 19677 * @returns {*} Returns the placeholder value. 19678 */ 19679 function getHolder(func) { 19680 var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; 19681 return object.placeholder; 19682 } 19683 19684 /** 19685 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, 19686 * this function returns the custom method, otherwise it returns `baseIteratee`. 19687 * If arguments are provided, the chosen function is invoked with them and 19688 * its result is returned. 19689 * 19690 * @private 19691 * @param {*} [value] The value to convert to an iteratee. 19692 * @param {number} [arity] The arity of the created iteratee. 19693 * @returns {Function} Returns the chosen function or its result. 19694 */ 19695 function getIteratee() { 19696 var result = lodash.iteratee || iteratee; 19697 result = result === iteratee ? baseIteratee : result; 19698 return arguments.length ? result(arguments[0], arguments[1]) : result; 19699 } 19700 19701 /** 19702 * Gets the data for `map`. 19703 * 19704 * @private 19705 * @param {Object} map The map to query. 19706 * @param {string} key The reference key. 19707 * @returns {*} Returns the map data. 19708 */ 19709 function getMapData(map, key) { 19710 var data = map.__data__; 19711 return isKeyable(key) 19712 ? data[typeof key == 'string' ? 'string' : 'hash'] 19713 : data.map; 19714 } 19715 19716 /** 19717 * Gets the property names, values, and compare flags of `object`. 19718 * 19719 * @private 19720 * @param {Object} object The object to query. 19721 * @returns {Array} Returns the match data of `object`. 19722 */ 19723 function getMatchData(object) { 19724 var result = keys(object), 19725 length = result.length; 19726 19727 while (length--) { 19728 var key = result[length], 19729 value = object[key]; 19730 19731 result[length] = [key, value, isStrictComparable(value)]; 19732 } 19733 return result; 19734 } 19735 19736 /** 19737 * Gets the native function at `key` of `object`. 19738 * 19739 * @private 19740 * @param {Object} object The object to query. 19741 * @param {string} key The key of the method to get. 19742 * @returns {*} Returns the function if it's native, else `undefined`. 19743 */ 19744 function getNative(object, key) { 19745 var value = getValue(object, key); 19746 return baseIsNative(value) ? value : undefined; 19747 } 19748 19749 /** 19750 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 19751 * 19752 * @private 19753 * @param {*} value The value to query. 19754 * @returns {string} Returns the raw `toStringTag`. 19755 */ 19756 function getRawTag(value) { 19757 var isOwn = hasOwnProperty.call(value, symToStringTag), 19758 tag = value[symToStringTag]; 19759 19760 try { 19761 value[symToStringTag] = undefined; 19762 var unmasked = true; 19763 } catch (e) {} 19764 19765 var result = nativeObjectToString.call(value); 19766 if (unmasked) { 19767 if (isOwn) { 19768 value[symToStringTag] = tag; 19769 } else { 19770 delete value[symToStringTag]; 19771 } 19772 } 19773 return result; 19774 } 19775 19776 /** 19777 * Creates an array of the own enumerable symbols of `object`. 19778 * 19779 * @private 19780 * @param {Object} object The object to query. 19781 * @returns {Array} Returns the array of symbols. 19782 */ 19783 var getSymbols = !nativeGetSymbols ? stubArray : function(object) { 19784 if (object == null) { 19785 return []; 19786 } 19787 object = Object(object); 19788 return arrayFilter(nativeGetSymbols(object), function(symbol) { 19789 return propertyIsEnumerable.call(object, symbol); 19790 }); 19791 }; 19792 19793 /** 19794 * Creates an array of the own and inherited enumerable symbols of `object`. 19795 * 19796 * @private 19797 * @param {Object} object The object to query. 19798 * @returns {Array} Returns the array of symbols. 19799 */ 19800 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 19801 var result = []; 19802 while (object) { 19803 arrayPush(result, getSymbols(object)); 19804 object = getPrototype(object); 19805 } 19806 return result; 19807 }; 19808 19809 /** 19810 * Gets the `toStringTag` of `value`. 19811 * 19812 * @private 19813 * @param {*} value The value to query. 19814 * @returns {string} Returns the `toStringTag`. 19815 */ 19816 var getTag = baseGetTag; 19817 19818 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. 19819 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || 19820 (Map && getTag(new Map) != mapTag) || 19821 (Promise && getTag(Promise.resolve()) != promiseTag) || 19822 (Set && getTag(new Set) != setTag) || 19823 (WeakMap && getTag(new WeakMap) != weakMapTag)) { 19824 getTag = function(value) { 19825 var result = baseGetTag(value), 19826 Ctor = result == objectTag ? value.constructor : undefined, 19827 ctorString = Ctor ? toSource(Ctor) : ''; 19828 19829 if (ctorString) { 19830 switch (ctorString) { 19831 case dataViewCtorString: return dataViewTag; 19832 case mapCtorString: return mapTag; 19833 case promiseCtorString: return promiseTag; 19834 case setCtorString: return setTag; 19835 case weakMapCtorString: return weakMapTag; 19836 } 19837 } 19838 return result; 19839 }; 19840 } 19841 19842 /** 19843 * Gets the view, applying any `transforms` to the `start` and `end` positions. 19844 * 19845 * @private 19846 * @param {number} start The start of the view. 19847 * @param {number} end The end of the view. 19848 * @param {Array} transforms The transformations to apply to the view. 19849 * @returns {Object} Returns an object containing the `start` and `end` 19850 * positions of the view. 19851 */ 19852 function getView(start, end, transforms) { 19853 var index = -1, 19854 length = transforms.length; 19855 19856 while (++index < length) { 19857 var data = transforms[index], 19858 size = data.size; 19859 19860 switch (data.type) { 19861 case 'drop': start += size; break; 19862 case 'dropRight': end -= size; break; 19863 case 'take': end = nativeMin(end, start + size); break; 19864 case 'takeRight': start = nativeMax(start, end - size); break; 19865 } 19866 } 19867 return { 'start': start, 'end': end }; 19868 } 19869 19870 /** 19871 * Extracts wrapper details from the `source` body comment. 19872 * 19873 * @private 19874 * @param {string} source The source to inspect. 19875 * @returns {Array} Returns the wrapper details. 19876 */ 19877 function getWrapDetails(source) { 19878 var match = source.match(reWrapDetails); 19879 return match ? match[1].split(reSplitDetails) : []; 19880 } 19881 19882 /** 19883 * Checks if `path` exists on `object`. 19884 * 19885 * @private 19886 * @param {Object} object The object to query. 19887 * @param {Array|string} path The path to check. 19888 * @param {Function} hasFunc The function to check properties. 19889 * @returns {boolean} Returns `true` if `path` exists, else `false`. 19890 */ 19891 function hasPath(object, path, hasFunc) { 19892 path = castPath(path, object); 19893 19894 var index = -1, 19895 length = path.length, 19896 result = false; 19897 19898 while (++index < length) { 19899 var key = toKey(path[index]); 19900 if (!(result = object != null && hasFunc(object, key))) { 19901 break; 19902 } 19903 object = object[key]; 19904 } 19905 if (result || ++index != length) { 19906 return result; 19907 } 19908 length = object == null ? 0 : object.length; 19909 return !!length && isLength(length) && isIndex(key, length) && 19910 (isArray(object) || isArguments(object)); 19911 } 19912 19913 /** 19914 * Initializes an array clone. 19915 * 19916 * @private 19917 * @param {Array} array The array to clone. 19918 * @returns {Array} Returns the initialized clone. 19919 */ 19920 function initCloneArray(array) { 19921 var length = array.length, 19922 result = new array.constructor(length); 19923 19924 // Add properties assigned by `RegExp#exec`. 19925 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { 19926 result.index = array.index; 19927 result.input = array.input; 19928 } 19929 return result; 19930 } 19931 19932 /** 19933 * Initializes an object clone. 19934 * 19935 * @private 19936 * @param {Object} object The object to clone. 19937 * @returns {Object} Returns the initialized clone. 19938 */ 19939 function initCloneObject(object) { 19940 return (typeof object.constructor == 'function' && !isPrototype(object)) 19941 ? baseCreate(getPrototype(object)) 19942 : {}; 19943 } 19944 19945 /** 19946 * Initializes an object clone based on its `toStringTag`. 19947 * 19948 * **Note:** This function only supports cloning values with tags of 19949 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. 19950 * 19951 * @private 19952 * @param {Object} object The object to clone. 19953 * @param {string} tag The `toStringTag` of the object to clone. 19954 * @param {boolean} [isDeep] Specify a deep clone. 19955 * @returns {Object} Returns the initialized clone. 19956 */ 19957 function initCloneByTag(object, tag, isDeep) { 19958 var Ctor = object.constructor; 19959 switch (tag) { 19960 case arrayBufferTag: 19961 return cloneArrayBuffer(object); 19962 19963 case boolTag: 19964 case dateTag: 19965 return new Ctor(+object); 19966 19967 case dataViewTag: 19968 return cloneDataView(object, isDeep); 19969 19970 case float32Tag: case float64Tag: 19971 case int8Tag: case int16Tag: case int32Tag: 19972 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: 19973 return cloneTypedArray(object, isDeep); 19974 19975 case mapTag: 19976 return new Ctor; 19977 19978 case numberTag: 19979 case stringTag: 19980 return new Ctor(object); 19981 19982 case regexpTag: 19983 return cloneRegExp(object); 19984 19985 case setTag: 19986 return new Ctor; 19987 19988 case symbolTag: 19989 return cloneSymbol(object); 19990 } 19991 } 19992 19993 /** 19994 * Inserts wrapper `details` in a comment at the top of the `source` body. 19995 * 19996 * @private 19997 * @param {string} source The source to modify. 19998 * @returns {Array} details The details to insert. 19999 * @returns {string} Returns the modified source. 20000 */ 20001 function insertWrapDetails(source, details) { 20002 var length = details.length; 20003 if (!length) { 20004 return source; 20005 } 20006 var lastIndex = length - 1; 20007 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; 20008 details = details.join(length > 2 ? ', ' : ' '); 20009 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); 20010 } 20011 20012 /** 20013 * Checks if `value` is a flattenable `arguments` object or array. 20014 * 20015 * @private 20016 * @param {*} value The value to check. 20017 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. 20018 */ 20019 function isFlattenable(value) { 20020 return isArray(value) || isArguments(value) || 20021 !!(spreadableSymbol && value && value[spreadableSymbol]); 20022 } 20023 20024 /** 20025 * Checks if `value` is a valid array-like index. 20026 * 20027 * @private 20028 * @param {*} value The value to check. 20029 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. 20030 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. 20031 */ 20032 function isIndex(value, length) { 20033 var type = typeof value; 20034 length = length == null ? MAX_SAFE_INTEGER : length; 20035 20036 return !!length && 20037 (type == 'number' || 20038 (type != 'symbol' && reIsUint.test(value))) && 20039 (value > -1 && value % 1 == 0 && value < length); 20040 } 20041 20042 /** 20043 * Checks if the given arguments are from an iteratee call. 20044 * 20045 * @private 20046 * @param {*} value The potential iteratee value argument. 20047 * @param {*} index The potential iteratee index or key argument. 20048 * @param {*} object The potential iteratee object argument. 20049 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, 20050 * else `false`. 20051 */ 20052 function isIterateeCall(value, index, object) { 20053 if (!isObject(object)) { 20054 return false; 20055 } 20056 var type = typeof index; 20057 if (type == 'number' 20058 ? (isArrayLike(object) && isIndex(index, object.length)) 20059 : (type == 'string' && index in object) 20060 ) { 20061 return eq(object[index], value); 20062 } 20063 return false; 20064 } 20065 20066 /** 20067 * Checks if `value` is a property name and not a property path. 20068 * 20069 * @private 20070 * @param {*} value The value to check. 20071 * @param {Object} [object] The object to query keys on. 20072 * @returns {boolean} Returns `true` if `value` is a property name, else `false`. 20073 */ 20074 function isKey(value, object) { 20075 if (isArray(value)) { 20076 return false; 20077 } 20078 var type = typeof value; 20079 if (type == 'number' || type == 'symbol' || type == 'boolean' || 20080 value == null || isSymbol(value)) { 20081 return true; 20082 } 20083 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || 20084 (object != null && value in Object(object)); 20085 } 20086 20087 /** 20088 * Checks if `value` is suitable for use as unique object key. 20089 * 20090 * @private 20091 * @param {*} value The value to check. 20092 * @returns {boolean} Returns `true` if `value` is suitable, else `false`. 20093 */ 20094 function isKeyable(value) { 20095 var type = typeof value; 20096 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') 20097 ? (value !== '__proto__') 20098 : (value === null); 20099 } 20100 20101 /** 20102 * Checks if `func` has a lazy counterpart. 20103 * 20104 * @private 20105 * @param {Function} func The function to check. 20106 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, 20107 * else `false`. 20108 */ 20109 function isLaziable(func) { 20110 var funcName = getFuncName(func), 20111 other = lodash[funcName]; 20112 20113 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { 20114 return false; 20115 } 20116 if (func === other) { 20117 return true; 20118 } 20119 var data = getData(other); 20120 return !!data && func === data[0]; 20121 } 20122 20123 /** 20124 * Checks if `func` has its source masked. 20125 * 20126 * @private 20127 * @param {Function} func The function to check. 20128 * @returns {boolean} Returns `true` if `func` is masked, else `false`. 20129 */ 20130 function isMasked(func) { 20131 return !!maskSrcKey && (maskSrcKey in func); 20132 } 20133 20134 /** 20135 * Checks if `func` is capable of being masked. 20136 * 20137 * @private 20138 * @param {*} value The value to check. 20139 * @returns {boolean} Returns `true` if `func` is maskable, else `false`. 20140 */ 20141 var isMaskable = coreJsData ? isFunction : stubFalse; 20142 20143 /** 20144 * Checks if `value` is likely a prototype object. 20145 * 20146 * @private 20147 * @param {*} value The value to check. 20148 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. 20149 */ 20150 function isPrototype(value) { 20151 var Ctor = value && value.constructor, 20152 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; 20153 20154 return value === proto; 20155 } 20156 20157 /** 20158 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. 20159 * 20160 * @private 20161 * @param {*} value The value to check. 20162 * @returns {boolean} Returns `true` if `value` if suitable for strict 20163 * equality comparisons, else `false`. 20164 */ 20165 function isStrictComparable(value) { 20166 return value === value && !isObject(value); 20167 } 20168 20169 /** 20170 * A specialized version of `matchesProperty` for source values suitable 20171 * for strict equality comparisons, i.e. `===`. 20172 * 20173 * @private 20174 * @param {string} key The key of the property to get. 20175 * @param {*} srcValue The value to match. 20176 * @returns {Function} Returns the new spec function. 20177 */ 20178 function matchesStrictComparable(key, srcValue) { 20179 return function(object) { 20180 if (object == null) { 20181 return false; 20182 } 20183 return object[key] === srcValue && 20184 (srcValue !== undefined || (key in Object(object))); 20185 }; 20186 } 20187 20188 /** 20189 * A specialized version of `_.memoize` which clears the memoized function's 20190 * cache when it exceeds `MAX_MEMOIZE_SIZE`. 20191 * 20192 * @private 20193 * @param {Function} func The function to have its output memoized. 20194 * @returns {Function} Returns the new memoized function. 20195 */ 20196 function memoizeCapped(func) { 20197 var result = memoize(func, function(key) { 20198 if (cache.size === MAX_MEMOIZE_SIZE) { 20199 cache.clear(); 20200 } 20201 return key; 20202 }); 20203 20204 var cache = result.cache; 20205 return result; 20206 } 20207 20208 /** 20209 * Merges the function metadata of `source` into `data`. 20210 * 20211 * Merging metadata reduces the number of wrappers used to invoke a function. 20212 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` 20213 * may be applied regardless of execution order. Methods like `_.ary` and 20214 * `_.rearg` modify function arguments, making the order in which they are 20215 * executed important, preventing the merging of metadata. However, we make 20216 * an exception for a safe combined case where curried functions have `_.ary` 20217 * and or `_.rearg` applied. 20218 * 20219 * @private 20220 * @param {Array} data The destination metadata. 20221 * @param {Array} source The source metadata. 20222 * @returns {Array} Returns `data`. 20223 */ 20224 function mergeData(data, source) { 20225 var bitmask = data[1], 20226 srcBitmask = source[1], 20227 newBitmask = bitmask | srcBitmask, 20228 isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); 20229 20230 var isCombo = 20231 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || 20232 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || 20233 ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); 20234 20235 // Exit early if metadata can't be merged. 20236 if (!(isCommon || isCombo)) { 20237 return data; 20238 } 20239 // Use source `thisArg` if available. 20240 if (srcBitmask & WRAP_BIND_FLAG) { 20241 data[2] = source[2]; 20242 // Set when currying a bound function. 20243 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; 20244 } 20245 // Compose partial arguments. 20246 var value = source[3]; 20247 if (value) { 20248 var partials = data[3]; 20249 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 20250 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 20251 } 20252 // Compose partial right arguments. 20253 value = source[5]; 20254 if (value) { 20255 partials = data[5]; 20256 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 20257 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 20258 } 20259 // Use source `argPos` if available. 20260 value = source[7]; 20261 if (value) { 20262 data[7] = value; 20263 } 20264 // Use source `ary` if it's smaller. 20265 if (srcBitmask & WRAP_ARY_FLAG) { 20266 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); 20267 } 20268 // Use source `arity` if one is not provided. 20269 if (data[9] == null) { 20270 data[9] = source[9]; 20271 } 20272 // Use source `func` and merge bitmasks. 20273 data[0] = source[0]; 20274 data[1] = newBitmask; 20275 20276 return data; 20277 } 20278 20279 /** 20280 * This function is like 20281 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 20282 * except that it includes inherited enumerable properties. 20283 * 20284 * @private 20285 * @param {Object} object The object to query. 20286 * @returns {Array} Returns the array of property names. 20287 */ 20288 function nativeKeysIn(object) { 20289 var result = []; 20290 if (object != null) { 20291 for (var key in Object(object)) { 20292 result.push(key); 20293 } 20294 } 20295 return result; 20296 } 20297 20298 /** 20299 * Converts `value` to a string using `Object.prototype.toString`. 20300 * 20301 * @private 20302 * @param {*} value The value to convert. 20303 * @returns {string} Returns the converted string. 20304 */ 20305 function objectToString(value) { 20306 return nativeObjectToString.call(value); 20307 } 20308 20309 /** 20310 * A specialized version of `baseRest` which transforms the rest array. 20311 * 20312 * @private 20313 * @param {Function} func The function to apply a rest parameter to. 20314 * @param {number} [start=func.length-1] The start position of the rest parameter. 20315 * @param {Function} transform The rest array transform. 20316 * @returns {Function} Returns the new function. 20317 */ 20318 function overRest(func, start, transform) { 20319 start = nativeMax(start === undefined ? (func.length - 1) : start, 0); 20320 return function() { 20321 var args = arguments, 20322 index = -1, 20323 length = nativeMax(args.length - start, 0), 20324 array = Array(length); 20325 20326 while (++index < length) { 20327 array[index] = args[start + index]; 20328 } 20329 index = -1; 20330 var otherArgs = Array(start + 1); 20331 while (++index < start) { 20332 otherArgs[index] = args[index]; 20333 } 20334 otherArgs[start] = transform(array); 20335 return apply(func, this, otherArgs); 20336 }; 20337 } 20338 20339 /** 20340 * Gets the parent value at `path` of `object`. 20341 * 20342 * @private 20343 * @param {Object} object The object to query. 20344 * @param {Array} path The path to get the parent value of. 20345 * @returns {*} Returns the parent value. 20346 */ 20347 function parent(object, path) { 20348 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 20349 } 20350 20351 /** 20352 * Reorder `array` according to the specified indexes where the element at 20353 * the first index is assigned as the first element, the element at 20354 * the second index is assigned as the second element, and so on. 20355 * 20356 * @private 20357 * @param {Array} array The array to reorder. 20358 * @param {Array} indexes The arranged array indexes. 20359 * @returns {Array} Returns `array`. 20360 */ 20361 function reorder(array, indexes) { 20362 var arrLength = array.length, 20363 length = nativeMin(indexes.length, arrLength), 20364 oldArray = copyArray(array); 20365 20366 while (length--) { 20367 var index = indexes[length]; 20368 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; 20369 } 20370 return array; 20371 } 20372 20373 /** 20374 * Gets the value at `key`, unless `key` is "__proto__" or "constructor". 20375 * 20376 * @private 20377 * @param {Object} object The object to query. 20378 * @param {string} key The key of the property to get. 20379 * @returns {*} Returns the property value. 20380 */ 20381 function safeGet(object, key) { 20382 if (key === 'constructor' && typeof object[key] === 'function') { 20383 return; 20384 } 20385 20386 if (key == '__proto__') { 20387 return; 20388 } 20389 20390 return object[key]; 20391 } 20392 20393 /** 20394 * Sets metadata for `func`. 20395 * 20396 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short 20397 * period of time, it will trip its breaker and transition to an identity 20398 * function to avoid garbage collection pauses in V8. See 20399 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) 20400 * for more details. 20401 * 20402 * @private 20403 * @param {Function} func The function to associate metadata with. 20404 * @param {*} data The metadata. 20405 * @returns {Function} Returns `func`. 20406 */ 20407 var setData = shortOut(baseSetData); 20408 20409 /** 20410 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). 20411 * 20412 * @private 20413 * @param {Function} func The function to delay. 20414 * @param {number} wait The number of milliseconds to delay invocation. 20415 * @returns {number|Object} Returns the timer id or timeout object. 20416 */ 20417 var setTimeout = ctxSetTimeout || function(func, wait) { 20418 return root.setTimeout(func, wait); 20419 }; 20420 20421 /** 20422 * Sets the `toString` method of `func` to return `string`. 20423 * 20424 * @private 20425 * @param {Function} func The function to modify. 20426 * @param {Function} string The `toString` result. 20427 * @returns {Function} Returns `func`. 20428 */ 20429 var setToString = shortOut(baseSetToString); 20430 20431 /** 20432 * Sets the `toString` method of `wrapper` to mimic the source of `reference` 20433 * with wrapper details in a comment at the top of the source body. 20434 * 20435 * @private 20436 * @param {Function} wrapper The function to modify. 20437 * @param {Function} reference The reference function. 20438 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 20439 * @returns {Function} Returns `wrapper`. 20440 */ 20441 function setWrapToString(wrapper, reference, bitmask) { 20442 var source = (reference + ''); 20443 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 20444 } 20445 20446 /** 20447 * Creates a function that'll short out and invoke `identity` instead 20448 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` 20449 * milliseconds. 20450 * 20451 * @private 20452 * @param {Function} func The function to restrict. 20453 * @returns {Function} Returns the new shortable function. 20454 */ 20455 function shortOut(func) { 20456 var count = 0, 20457 lastCalled = 0; 20458 20459 return function() { 20460 var stamp = nativeNow(), 20461 remaining = HOT_SPAN - (stamp - lastCalled); 20462 20463 lastCalled = stamp; 20464 if (remaining > 0) { 20465 if (++count >= HOT_COUNT) { 20466 return arguments[0]; 20467 } 20468 } else { 20469 count = 0; 20470 } 20471 return func.apply(undefined, arguments); 20472 }; 20473 } 20474 20475 /** 20476 * A specialized version of `_.shuffle` which mutates and sets the size of `array`. 20477 * 20478 * @private 20479 * @param {Array} array The array to shuffle. 20480 * @param {number} [size=array.length] The size of `array`. 20481 * @returns {Array} Returns `array`. 20482 */ 20483 function shuffleSelf(array, size) { 20484 var index = -1, 20485 length = array.length, 20486 lastIndex = length - 1; 20487 20488 size = size === undefined ? length : size; 20489 while (++index < size) { 20490 var rand = baseRandom(index, lastIndex), 20491 value = array[rand]; 20492 20493 array[rand] = array[index]; 20494 array[index] = value; 20495 } 20496 array.length = size; 20497 return array; 20498 } 20499 20500 /** 20501 * Converts `string` to a property path array. 20502 * 20503 * @private 20504 * @param {string} string The string to convert. 20505 * @returns {Array} Returns the property path array. 20506 */ 20507 var stringToPath = memoizeCapped(function(string) { 20508 var result = []; 20509 if (string.charCodeAt(0) === 46 /* . */) { 20510 result.push(''); 20511 } 20512 string.replace(rePropName, function(match, number, quote, subString) { 20513 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); 20514 }); 20515 return result; 20516 }); 20517 20518 /** 20519 * Converts `value` to a string key if it's not a string or symbol. 20520 * 20521 * @private 20522 * @param {*} value The value to inspect. 20523 * @returns {string|symbol} Returns the key. 20524 */ 20525 function toKey(value) { 20526 if (typeof value == 'string' || isSymbol(value)) { 20527 return value; 20528 } 20529 var result = (value + ''); 20530 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 20531 } 20532 20533 /** 20534 * Converts `func` to its source code. 20535 * 20536 * @private 20537 * @param {Function} func The function to convert. 20538 * @returns {string} Returns the source code. 20539 */ 20540 function toSource(func) { 20541 if (func != null) { 20542 try { 20543 return funcToString.call(func); 20544 } catch (e) {} 20545 try { 20546 return (func + ''); 20547 } catch (e) {} 20548 } 20549 return ''; 20550 } 20551 20552 /** 20553 * Updates wrapper `details` based on `bitmask` flags. 20554 * 20555 * @private 20556 * @returns {Array} details The details to modify. 20557 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 20558 * @returns {Array} Returns `details`. 20559 */ 20560 function updateWrapDetails(details, bitmask) { 20561 arrayEach(wrapFlags, function(pair) { 20562 var value = '_.' + pair[0]; 20563 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { 20564 details.push(value); 20565 } 20566 }); 20567 return details.sort(); 20568 } 20569 20570 /** 20571 * Creates a clone of `wrapper`. 20572 * 20573 * @private 20574 * @param {Object} wrapper The wrapper to clone. 20575 * @returns {Object} Returns the cloned wrapper. 20576 */ 20577 function wrapperClone(wrapper) { 20578 if (wrapper instanceof LazyWrapper) { 20579 return wrapper.clone(); 20580 } 20581 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 20582 result.__actions__ = copyArray(wrapper.__actions__); 20583 result.__index__ = wrapper.__index__; 20584 result.__values__ = wrapper.__values__; 20585 return result; 20586 } 20587 20588 /*------------------------------------------------------------------------*/ 20589 20590 /** 20591 * Creates an array of elements split into groups the length of `size`. 20592 * If `array` can't be split evenly, the final chunk will be the remaining 20593 * elements. 20594 * 20595 * @static 20596 * @memberOf _ 20597 * @since 3.0.0 20598 * @category Array 20599 * @param {Array} array The array to process. 20600 * @param {number} [size=1] The length of each chunk 20601 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 20602 * @returns {Array} Returns the new array of chunks. 20603 * @example 20604 * 20605 * _.chunk(['a', 'b', 'c', 'd'], 2); 20606 * // => [['a', 'b'], ['c', 'd']] 20607 * 20608 * _.chunk(['a', 'b', 'c', 'd'], 3); 20609 * // => [['a', 'b', 'c'], ['d']] 20610 */ 20611 function chunk(array, size, guard) { 20612 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { 20613 size = 1; 20614 } else { 20615 size = nativeMax(toInteger(size), 0); 20616 } 20617 var length = array == null ? 0 : array.length; 20618 if (!length || size < 1) { 20619 return []; 20620 } 20621 var index = 0, 20622 resIndex = 0, 20623 result = Array(nativeCeil(length / size)); 20624 20625 while (index < length) { 20626 result[resIndex++] = baseSlice(array, index, (index += size)); 20627 } 20628 return result; 20629 } 20630 20631 /** 20632 * Creates an array with all falsey values removed. The values `false`, `null`, 20633 * `0`, `""`, `undefined`, and `NaN` are falsey. 20634 * 20635 * @static 20636 * @memberOf _ 20637 * @since 0.1.0 20638 * @category Array 20639 * @param {Array} array The array to compact. 20640 * @returns {Array} Returns the new array of filtered values. 20641 * @example 20642 * 20643 * _.compact([0, 1, false, 2, '', 3]); 20644 * // => [1, 2, 3] 20645 */ 20646 function compact(array) { 20647 var index = -1, 20648 length = array == null ? 0 : array.length, 20649 resIndex = 0, 20650 result = []; 20651 20652 while (++index < length) { 20653 var value = array[index]; 20654 if (value) { 20655 result[resIndex++] = value; 20656 } 20657 } 20658 return result; 20659 } 20660 20661 /** 20662 * Creates a new array concatenating `array` with any additional arrays 20663 * and/or values. 20664 * 20665 * @static 20666 * @memberOf _ 20667 * @since 4.0.0 20668 * @category Array 20669 * @param {Array} array The array to concatenate. 20670 * @param {...*} [values] The values to concatenate. 20671 * @returns {Array} Returns the new concatenated array. 20672 * @example 20673 * 20674 * var array = [1]; 20675 * var other = _.concat(array, 2, [3], [[4]]); 20676 * 20677 * console.log(other); 20678 * // => [1, 2, 3, [4]] 20679 * 20680 * console.log(array); 20681 * // => [1] 20682 */ 20683 function concat() { 20684 var length = arguments.length; 20685 if (!length) { 20686 return []; 20687 } 20688 var args = Array(length - 1), 20689 array = arguments[0], 20690 index = length; 20691 20692 while (index--) { 20693 args[index - 1] = arguments[index]; 20694 } 20695 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 20696 } 20697 20698 /** 20699 * Creates an array of `array` values not included in the other given arrays 20700 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 20701 * for equality comparisons. The order and references of result values are 20702 * determined by the first array. 20703 * 20704 * **Note:** Unlike `_.pullAll`, this method returns a new array. 20705 * 20706 * @static 20707 * @memberOf _ 20708 * @since 0.1.0 20709 * @category Array 20710 * @param {Array} array The array to inspect. 20711 * @param {...Array} [values] The values to exclude. 20712 * @returns {Array} Returns the new array of filtered values. 20713 * @see _.without, _.xor 20714 * @example 20715 * 20716 * _.difference([2, 1], [2, 3]); 20717 * // => [1] 20718 */ 20719 var difference = baseRest(function(array, values) { 20720 return isArrayLikeObject(array) 20721 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) 20722 : []; 20723 }); 20724 20725 /** 20726 * This method is like `_.difference` except that it accepts `iteratee` which 20727 * is invoked for each element of `array` and `values` to generate the criterion 20728 * by which they're compared. The order and references of result values are 20729 * determined by the first array. The iteratee is invoked with one argument: 20730 * (value). 20731 * 20732 * **Note:** Unlike `_.pullAllBy`, this method returns a new array. 20733 * 20734 * @static 20735 * @memberOf _ 20736 * @since 4.0.0 20737 * @category Array 20738 * @param {Array} array The array to inspect. 20739 * @param {...Array} [values] The values to exclude. 20740 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 20741 * @returns {Array} Returns the new array of filtered values. 20742 * @example 20743 * 20744 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); 20745 * // => [1.2] 20746 * 20747 * // The `_.property` iteratee shorthand. 20748 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); 20749 * // => [{ 'x': 2 }] 20750 */ 20751 var differenceBy = baseRest(function(array, values) { 20752 var iteratee = last(values); 20753 if (isArrayLikeObject(iteratee)) { 20754 iteratee = undefined; 20755 } 20756 return isArrayLikeObject(array) 20757 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) 20758 : []; 20759 }); 20760 20761 /** 20762 * This method is like `_.difference` except that it accepts `comparator` 20763 * which is invoked to compare elements of `array` to `values`. The order and 20764 * references of result values are determined by the first array. The comparator 20765 * is invoked with two arguments: (arrVal, othVal). 20766 * 20767 * **Note:** Unlike `_.pullAllWith`, this method returns a new array. 20768 * 20769 * @static 20770 * @memberOf _ 20771 * @since 4.0.0 20772 * @category Array 20773 * @param {Array} array The array to inspect. 20774 * @param {...Array} [values] The values to exclude. 20775 * @param {Function} [comparator] The comparator invoked per element. 20776 * @returns {Array} Returns the new array of filtered values. 20777 * @example 20778 * 20779 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 20780 * 20781 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); 20782 * // => [{ 'x': 2, 'y': 1 }] 20783 */ 20784 var differenceWith = baseRest(function(array, values) { 20785 var comparator = last(values); 20786 if (isArrayLikeObject(comparator)) { 20787 comparator = undefined; 20788 } 20789 return isArrayLikeObject(array) 20790 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) 20791 : []; 20792 }); 20793 20794 /** 20795 * Creates a slice of `array` with `n` elements dropped from the beginning. 20796 * 20797 * @static 20798 * @memberOf _ 20799 * @since 0.5.0 20800 * @category Array 20801 * @param {Array} array The array to query. 20802 * @param {number} [n=1] The number of elements to drop. 20803 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 20804 * @returns {Array} Returns the slice of `array`. 20805 * @example 20806 * 20807 * _.drop([1, 2, 3]); 20808 * // => [2, 3] 20809 * 20810 * _.drop([1, 2, 3], 2); 20811 * // => [3] 20812 * 20813 * _.drop([1, 2, 3], 5); 20814 * // => [] 20815 * 20816 * _.drop([1, 2, 3], 0); 20817 * // => [1, 2, 3] 20818 */ 20819 function drop(array, n, guard) { 20820 var length = array == null ? 0 : array.length; 20821 if (!length) { 20822 return []; 20823 } 20824 n = (guard || n === undefined) ? 1 : toInteger(n); 20825 return baseSlice(array, n < 0 ? 0 : n, length); 20826 } 20827 20828 /** 20829 * Creates a slice of `array` with `n` elements dropped from the end. 20830 * 20831 * @static 20832 * @memberOf _ 20833 * @since 3.0.0 20834 * @category Array 20835 * @param {Array} array The array to query. 20836 * @param {number} [n=1] The number of elements to drop. 20837 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 20838 * @returns {Array} Returns the slice of `array`. 20839 * @example 20840 * 20841 * _.dropRight([1, 2, 3]); 20842 * // => [1, 2] 20843 * 20844 * _.dropRight([1, 2, 3], 2); 20845 * // => [1] 20846 * 20847 * _.dropRight([1, 2, 3], 5); 20848 * // => [] 20849 * 20850 * _.dropRight([1, 2, 3], 0); 20851 * // => [1, 2, 3] 20852 */ 20853 function dropRight(array, n, guard) { 20854 var length = array == null ? 0 : array.length; 20855 if (!length) { 20856 return []; 20857 } 20858 n = (guard || n === undefined) ? 1 : toInteger(n); 20859 n = length - n; 20860 return baseSlice(array, 0, n < 0 ? 0 : n); 20861 } 20862 20863 /** 20864 * Creates a slice of `array` excluding elements dropped from the end. 20865 * Elements are dropped until `predicate` returns falsey. The predicate is 20866 * invoked with three arguments: (value, index, array). 20867 * 20868 * @static 20869 * @memberOf _ 20870 * @since 3.0.0 20871 * @category Array 20872 * @param {Array} array The array to query. 20873 * @param {Function} [predicate=_.identity] The function invoked per iteration. 20874 * @returns {Array} Returns the slice of `array`. 20875 * @example 20876 * 20877 * var users = [ 20878 * { 'user': 'barney', 'active': true }, 20879 * { 'user': 'fred', 'active': false }, 20880 * { 'user': 'pebbles', 'active': false } 20881 * ]; 20882 * 20883 * _.dropRightWhile(users, function(o) { return !o.active; }); 20884 * // => objects for ['barney'] 20885 * 20886 * // The `_.matches` iteratee shorthand. 20887 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); 20888 * // => objects for ['barney', 'fred'] 20889 * 20890 * // The `_.matchesProperty` iteratee shorthand. 20891 * _.dropRightWhile(users, ['active', false]); 20892 * // => objects for ['barney'] 20893 * 20894 * // The `_.property` iteratee shorthand. 20895 * _.dropRightWhile(users, 'active'); 20896 * // => objects for ['barney', 'fred', 'pebbles'] 20897 */ 20898 function dropRightWhile(array, predicate) { 20899 return (array && array.length) 20900 ? baseWhile(array, getIteratee(predicate, 3), true, true) 20901 : []; 20902 } 20903 20904 /** 20905 * Creates a slice of `array` excluding elements dropped from the beginning. 20906 * Elements are dropped until `predicate` returns falsey. The predicate is 20907 * invoked with three arguments: (value, index, array). 20908 * 20909 * @static 20910 * @memberOf _ 20911 * @since 3.0.0 20912 * @category Array 20913 * @param {Array} array The array to query. 20914 * @param {Function} [predicate=_.identity] The function invoked per iteration. 20915 * @returns {Array} Returns the slice of `array`. 20916 * @example 20917 * 20918 * var users = [ 20919 * { 'user': 'barney', 'active': false }, 20920 * { 'user': 'fred', 'active': false }, 20921 * { 'user': 'pebbles', 'active': true } 20922 * ]; 20923 * 20924 * _.dropWhile(users, function(o) { return !o.active; }); 20925 * // => objects for ['pebbles'] 20926 * 20927 * // The `_.matches` iteratee shorthand. 20928 * _.dropWhile(users, { 'user': 'barney', 'active': false }); 20929 * // => objects for ['fred', 'pebbles'] 20930 * 20931 * // The `_.matchesProperty` iteratee shorthand. 20932 * _.dropWhile(users, ['active', false]); 20933 * // => objects for ['pebbles'] 20934 * 20935 * // The `_.property` iteratee shorthand. 20936 * _.dropWhile(users, 'active'); 20937 * // => objects for ['barney', 'fred', 'pebbles'] 20938 */ 20939 function dropWhile(array, predicate) { 20940 return (array && array.length) 20941 ? baseWhile(array, getIteratee(predicate, 3), true) 20942 : []; 20943 } 20944 20945 /** 20946 * Fills elements of `array` with `value` from `start` up to, but not 20947 * including, `end`. 20948 * 20949 * **Note:** This method mutates `array`. 20950 * 20951 * @static 20952 * @memberOf _ 20953 * @since 3.2.0 20954 * @category Array 20955 * @param {Array} array The array to fill. 20956 * @param {*} value The value to fill `array` with. 20957 * @param {number} [start=0] The start position. 20958 * @param {number} [end=array.length] The end position. 20959 * @returns {Array} Returns `array`. 20960 * @example 20961 * 20962 * var array = [1, 2, 3]; 20963 * 20964 * _.fill(array, 'a'); 20965 * console.log(array); 20966 * // => ['a', 'a', 'a'] 20967 * 20968 * _.fill(Array(3), 2); 20969 * // => [2, 2, 2] 20970 * 20971 * _.fill([4, 6, 8, 10], '*', 1, 3); 20972 * // => [4, '*', '*', 10] 20973 */ 20974 function fill(array, value, start, end) { 20975 var length = array == null ? 0 : array.length; 20976 if (!length) { 20977 return []; 20978 } 20979 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { 20980 start = 0; 20981 end = length; 20982 } 20983 return baseFill(array, value, start, end); 20984 } 20985 20986 /** 20987 * This method is like `_.find` except that it returns the index of the first 20988 * element `predicate` returns truthy for instead of the element itself. 20989 * 20990 * @static 20991 * @memberOf _ 20992 * @since 1.1.0 20993 * @category Array 20994 * @param {Array} array The array to inspect. 20995 * @param {Function} [predicate=_.identity] The function invoked per iteration. 20996 * @param {number} [fromIndex=0] The index to search from. 20997 * @returns {number} Returns the index of the found element, else `-1`. 20998 * @example 20999 * 21000 * var users = [ 21001 * { 'user': 'barney', 'active': false }, 21002 * { 'user': 'fred', 'active': false }, 21003 * { 'user': 'pebbles', 'active': true } 21004 * ]; 21005 * 21006 * _.findIndex(users, function(o) { return o.user == 'barney'; }); 21007 * // => 0 21008 * 21009 * // The `_.matches` iteratee shorthand. 21010 * _.findIndex(users, { 'user': 'fred', 'active': false }); 21011 * // => 1 21012 * 21013 * // The `_.matchesProperty` iteratee shorthand. 21014 * _.findIndex(users, ['active', false]); 21015 * // => 0 21016 * 21017 * // The `_.property` iteratee shorthand. 21018 * _.findIndex(users, 'active'); 21019 * // => 2 21020 */ 21021 function findIndex(array, predicate, fromIndex) { 21022 var length = array == null ? 0 : array.length; 21023 if (!length) { 21024 return -1; 21025 } 21026 var index = fromIndex == null ? 0 : toInteger(fromIndex); 21027 if (index < 0) { 21028 index = nativeMax(length + index, 0); 21029 } 21030 return baseFindIndex(array, getIteratee(predicate, 3), index); 21031 } 21032 21033 /** 21034 * This method is like `_.findIndex` except that it iterates over elements 21035 * of `collection` from right to left. 21036 * 21037 * @static 21038 * @memberOf _ 21039 * @since 2.0.0 21040 * @category Array 21041 * @param {Array} array The array to inspect. 21042 * @param {Function} [predicate=_.identity] The function invoked per iteration. 21043 * @param {number} [fromIndex=array.length-1] The index to search from. 21044 * @returns {number} Returns the index of the found element, else `-1`. 21045 * @example 21046 * 21047 * var users = [ 21048 * { 'user': 'barney', 'active': true }, 21049 * { 'user': 'fred', 'active': false }, 21050 * { 'user': 'pebbles', 'active': false } 21051 * ]; 21052 * 21053 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); 21054 * // => 2 21055 * 21056 * // The `_.matches` iteratee shorthand. 21057 * _.findLastIndex(users, { 'user': 'barney', 'active': true }); 21058 * // => 0 21059 * 21060 * // The `_.matchesProperty` iteratee shorthand. 21061 * _.findLastIndex(users, ['active', false]); 21062 * // => 2 21063 * 21064 * // The `_.property` iteratee shorthand. 21065 * _.findLastIndex(users, 'active'); 21066 * // => 0 21067 */ 21068 function findLastIndex(array, predicate, fromIndex) { 21069 var length = array == null ? 0 : array.length; 21070 if (!length) { 21071 return -1; 21072 } 21073 var index = length - 1; 21074 if (fromIndex !== undefined) { 21075 index = toInteger(fromIndex); 21076 index = fromIndex < 0 21077 ? nativeMax(length + index, 0) 21078 : nativeMin(index, length - 1); 21079 } 21080 return baseFindIndex(array, getIteratee(predicate, 3), index, true); 21081 } 21082 21083 /** 21084 * Flattens `array` a single level deep. 21085 * 21086 * @static 21087 * @memberOf _ 21088 * @since 0.1.0 21089 * @category Array 21090 * @param {Array} array The array to flatten. 21091 * @returns {Array} Returns the new flattened array. 21092 * @example 21093 * 21094 * _.flatten([1, [2, [3, [4]], 5]]); 21095 * // => [1, 2, [3, [4]], 5] 21096 */ 21097 function flatten(array) { 21098 var length = array == null ? 0 : array.length; 21099 return length ? baseFlatten(array, 1) : []; 21100 } 21101 21102 /** 21103 * Recursively flattens `array`. 21104 * 21105 * @static 21106 * @memberOf _ 21107 * @since 3.0.0 21108 * @category Array 21109 * @param {Array} array The array to flatten. 21110 * @returns {Array} Returns the new flattened array. 21111 * @example 21112 * 21113 * _.flattenDeep([1, [2, [3, [4]], 5]]); 21114 * // => [1, 2, 3, 4, 5] 21115 */ 21116 function flattenDeep(array) { 21117 var length = array == null ? 0 : array.length; 21118 return length ? baseFlatten(array, INFINITY) : []; 21119 } 21120 21121 /** 21122 * Recursively flatten `array` up to `depth` times. 21123 * 21124 * @static 21125 * @memberOf _ 21126 * @since 4.4.0 21127 * @category Array 21128 * @param {Array} array The array to flatten. 21129 * @param {number} [depth=1] The maximum recursion depth. 21130 * @returns {Array} Returns the new flattened array. 21131 * @example 21132 * 21133 * var array = [1, [2, [3, [4]], 5]]; 21134 * 21135 * _.flattenDepth(array, 1); 21136 * // => [1, 2, [3, [4]], 5] 21137 * 21138 * _.flattenDepth(array, 2); 21139 * // => [1, 2, 3, [4], 5] 21140 */ 21141 function flattenDepth(array, depth) { 21142 var length = array == null ? 0 : array.length; 21143 if (!length) { 21144 return []; 21145 } 21146 depth = depth === undefined ? 1 : toInteger(depth); 21147 return baseFlatten(array, depth); 21148 } 21149 21150 /** 21151 * The inverse of `_.toPairs`; this method returns an object composed 21152 * from key-value `pairs`. 21153 * 21154 * @static 21155 * @memberOf _ 21156 * @since 4.0.0 21157 * @category Array 21158 * @param {Array} pairs The key-value pairs. 21159 * @returns {Object} Returns the new object. 21160 * @example 21161 * 21162 * _.fromPairs([['a', 1], ['b', 2]]); 21163 * // => { 'a': 1, 'b': 2 } 21164 */ 21165 function fromPairs(pairs) { 21166 var index = -1, 21167 length = pairs == null ? 0 : pairs.length, 21168 result = {}; 21169 21170 while (++index < length) { 21171 var pair = pairs[index]; 21172 result[pair[0]] = pair[1]; 21173 } 21174 return result; 21175 } 21176 21177 /** 21178 * Gets the first element of `array`. 21179 * 21180 * @static 21181 * @memberOf _ 21182 * @since 0.1.0 21183 * @alias first 21184 * @category Array 21185 * @param {Array} array The array to query. 21186 * @returns {*} Returns the first element of `array`. 21187 * @example 21188 * 21189 * _.head([1, 2, 3]); 21190 * // => 1 21191 * 21192 * _.head([]); 21193 * // => undefined 21194 */ 21195 function head(array) { 21196 return (array && array.length) ? array[0] : undefined; 21197 } 21198 21199 /** 21200 * Gets the index at which the first occurrence of `value` is found in `array` 21201 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 21202 * for equality comparisons. If `fromIndex` is negative, it's used as the 21203 * offset from the end of `array`. 21204 * 21205 * @static 21206 * @memberOf _ 21207 * @since 0.1.0 21208 * @category Array 21209 * @param {Array} array The array to inspect. 21210 * @param {*} value The value to search for. 21211 * @param {number} [fromIndex=0] The index to search from. 21212 * @returns {number} Returns the index of the matched value, else `-1`. 21213 * @example 21214 * 21215 * _.indexOf([1, 2, 1, 2], 2); 21216 * // => 1 21217 * 21218 * // Search from the `fromIndex`. 21219 * _.indexOf([1, 2, 1, 2], 2, 2); 21220 * // => 3 21221 */ 21222 function indexOf(array, value, fromIndex) { 21223 var length = array == null ? 0 : array.length; 21224 if (!length) { 21225 return -1; 21226 } 21227 var index = fromIndex == null ? 0 : toInteger(fromIndex); 21228 if (index < 0) { 21229 index = nativeMax(length + index, 0); 21230 } 21231 return baseIndexOf(array, value, index); 21232 } 21233 21234 /** 21235 * Gets all but the last element of `array`. 21236 * 21237 * @static 21238 * @memberOf _ 21239 * @since 0.1.0 21240 * @category Array 21241 * @param {Array} array The array to query. 21242 * @returns {Array} Returns the slice of `array`. 21243 * @example 21244 * 21245 * _.initial([1, 2, 3]); 21246 * // => [1, 2] 21247 */ 21248 function initial(array) { 21249 var length = array == null ? 0 : array.length; 21250 return length ? baseSlice(array, 0, -1) : []; 21251 } 21252 21253 /** 21254 * Creates an array of unique values that are included in all given arrays 21255 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 21256 * for equality comparisons. The order and references of result values are 21257 * determined by the first array. 21258 * 21259 * @static 21260 * @memberOf _ 21261 * @since 0.1.0 21262 * @category Array 21263 * @param {...Array} [arrays] The arrays to inspect. 21264 * @returns {Array} Returns the new array of intersecting values. 21265 * @example 21266 * 21267 * _.intersection([2, 1], [2, 3]); 21268 * // => [2] 21269 */ 21270 var intersection = baseRest(function(arrays) { 21271 var mapped = arrayMap(arrays, castArrayLikeObject); 21272 return (mapped.length && mapped[0] === arrays[0]) 21273 ? baseIntersection(mapped) 21274 : []; 21275 }); 21276 21277 /** 21278 * This method is like `_.intersection` except that it accepts `iteratee` 21279 * which is invoked for each element of each `arrays` to generate the criterion 21280 * by which they're compared. The order and references of result values are 21281 * determined by the first array. The iteratee is invoked with one argument: 21282 * (value). 21283 * 21284 * @static 21285 * @memberOf _ 21286 * @since 4.0.0 21287 * @category Array 21288 * @param {...Array} [arrays] The arrays to inspect. 21289 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 21290 * @returns {Array} Returns the new array of intersecting values. 21291 * @example 21292 * 21293 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); 21294 * // => [2.1] 21295 * 21296 * // The `_.property` iteratee shorthand. 21297 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 21298 * // => [{ 'x': 1 }] 21299 */ 21300 var intersectionBy = baseRest(function(arrays) { 21301 var iteratee = last(arrays), 21302 mapped = arrayMap(arrays, castArrayLikeObject); 21303 21304 if (iteratee === last(mapped)) { 21305 iteratee = undefined; 21306 } else { 21307 mapped.pop(); 21308 } 21309 return (mapped.length && mapped[0] === arrays[0]) 21310 ? baseIntersection(mapped, getIteratee(iteratee, 2)) 21311 : []; 21312 }); 21313 21314 /** 21315 * This method is like `_.intersection` except that it accepts `comparator` 21316 * which is invoked to compare elements of `arrays`. The order and references 21317 * of result values are determined by the first array. The comparator is 21318 * invoked with two arguments: (arrVal, othVal). 21319 * 21320 * @static 21321 * @memberOf _ 21322 * @since 4.0.0 21323 * @category Array 21324 * @param {...Array} [arrays] The arrays to inspect. 21325 * @param {Function} [comparator] The comparator invoked per element. 21326 * @returns {Array} Returns the new array of intersecting values. 21327 * @example 21328 * 21329 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 21330 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 21331 * 21332 * _.intersectionWith(objects, others, _.isEqual); 21333 * // => [{ 'x': 1, 'y': 2 }] 21334 */ 21335 var intersectionWith = baseRest(function(arrays) { 21336 var comparator = last(arrays), 21337 mapped = arrayMap(arrays, castArrayLikeObject); 21338 21339 comparator = typeof comparator == 'function' ? comparator : undefined; 21340 if (comparator) { 21341 mapped.pop(); 21342 } 21343 return (mapped.length && mapped[0] === arrays[0]) 21344 ? baseIntersection(mapped, undefined, comparator) 21345 : []; 21346 }); 21347 21348 /** 21349 * Converts all elements in `array` into a string separated by `separator`. 21350 * 21351 * @static 21352 * @memberOf _ 21353 * @since 4.0.0 21354 * @category Array 21355 * @param {Array} array The array to convert. 21356 * @param {string} [separator=','] The element separator. 21357 * @returns {string} Returns the joined string. 21358 * @example 21359 * 21360 * _.join(['a', 'b', 'c'], '~'); 21361 * // => 'a~b~c' 21362 */ 21363 function join(array, separator) { 21364 return array == null ? '' : nativeJoin.call(array, separator); 21365 } 21366 21367 /** 21368 * Gets the last element of `array`. 21369 * 21370 * @static 21371 * @memberOf _ 21372 * @since 0.1.0 21373 * @category Array 21374 * @param {Array} array The array to query. 21375 * @returns {*} Returns the last element of `array`. 21376 * @example 21377 * 21378 * _.last([1, 2, 3]); 21379 * // => 3 21380 */ 21381 function last(array) { 21382 var length = array == null ? 0 : array.length; 21383 return length ? array[length - 1] : undefined; 21384 } 21385 21386 /** 21387 * This method is like `_.indexOf` except that it iterates over elements of 21388 * `array` from right to left. 21389 * 21390 * @static 21391 * @memberOf _ 21392 * @since 0.1.0 21393 * @category Array 21394 * @param {Array} array The array to inspect. 21395 * @param {*} value The value to search for. 21396 * @param {number} [fromIndex=array.length-1] The index to search from. 21397 * @returns {number} Returns the index of the matched value, else `-1`. 21398 * @example 21399 * 21400 * _.lastIndexOf([1, 2, 1, 2], 2); 21401 * // => 3 21402 * 21403 * // Search from the `fromIndex`. 21404 * _.lastIndexOf([1, 2, 1, 2], 2, 2); 21405 * // => 1 21406 */ 21407 function lastIndexOf(array, value, fromIndex) { 21408 var length = array == null ? 0 : array.length; 21409 if (!length) { 21410 return -1; 21411 } 21412 var index = length; 21413 if (fromIndex !== undefined) { 21414 index = toInteger(fromIndex); 21415 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 21416 } 21417 return value === value 21418 ? strictLastIndexOf(array, value, index) 21419 : baseFindIndex(array, baseIsNaN, index, true); 21420 } 21421 21422 /** 21423 * Gets the element at index `n` of `array`. If `n` is negative, the nth 21424 * element from the end is returned. 21425 * 21426 * @static 21427 * @memberOf _ 21428 * @since 4.11.0 21429 * @category Array 21430 * @param {Array} array The array to query. 21431 * @param {number} [n=0] The index of the element to return. 21432 * @returns {*} Returns the nth element of `array`. 21433 * @example 21434 * 21435 * var array = ['a', 'b', 'c', 'd']; 21436 * 21437 * _.nth(array, 1); 21438 * // => 'b' 21439 * 21440 * _.nth(array, -2); 21441 * // => 'c'; 21442 */ 21443 function nth(array, n) { 21444 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; 21445 } 21446 21447 /** 21448 * Removes all given values from `array` using 21449 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 21450 * for equality comparisons. 21451 * 21452 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` 21453 * to remove elements from an array by predicate. 21454 * 21455 * @static 21456 * @memberOf _ 21457 * @since 2.0.0 21458 * @category Array 21459 * @param {Array} array The array to modify. 21460 * @param {...*} [values] The values to remove. 21461 * @returns {Array} Returns `array`. 21462 * @example 21463 * 21464 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 21465 * 21466 * _.pull(array, 'a', 'c'); 21467 * console.log(array); 21468 * // => ['b', 'b'] 21469 */ 21470 var pull = baseRest(pullAll); 21471 21472 /** 21473 * This method is like `_.pull` except that it accepts an array of values to remove. 21474 * 21475 * **Note:** Unlike `_.difference`, this method mutates `array`. 21476 * 21477 * @static 21478 * @memberOf _ 21479 * @since 4.0.0 21480 * @category Array 21481 * @param {Array} array The array to modify. 21482 * @param {Array} values The values to remove. 21483 * @returns {Array} Returns `array`. 21484 * @example 21485 * 21486 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 21487 * 21488 * _.pullAll(array, ['a', 'c']); 21489 * console.log(array); 21490 * // => ['b', 'b'] 21491 */ 21492 function pullAll(array, values) { 21493 return (array && array.length && values && values.length) 21494 ? basePullAll(array, values) 21495 : array; 21496 } 21497 21498 /** 21499 * This method is like `_.pullAll` except that it accepts `iteratee` which is 21500 * invoked for each element of `array` and `values` to generate the criterion 21501 * by which they're compared. The iteratee is invoked with one argument: (value). 21502 * 21503 * **Note:** Unlike `_.differenceBy`, this method mutates `array`. 21504 * 21505 * @static 21506 * @memberOf _ 21507 * @since 4.0.0 21508 * @category Array 21509 * @param {Array} array The array to modify. 21510 * @param {Array} values The values to remove. 21511 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 21512 * @returns {Array} Returns `array`. 21513 * @example 21514 * 21515 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; 21516 * 21517 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); 21518 * console.log(array); 21519 * // => [{ 'x': 2 }] 21520 */ 21521 function pullAllBy(array, values, iteratee) { 21522 return (array && array.length && values && values.length) 21523 ? basePullAll(array, values, getIteratee(iteratee, 2)) 21524 : array; 21525 } 21526 21527 /** 21528 * This method is like `_.pullAll` except that it accepts `comparator` which 21529 * is invoked to compare elements of `array` to `values`. The comparator is 21530 * invoked with two arguments: (arrVal, othVal). 21531 * 21532 * **Note:** Unlike `_.differenceWith`, this method mutates `array`. 21533 * 21534 * @static 21535 * @memberOf _ 21536 * @since 4.6.0 21537 * @category Array 21538 * @param {Array} array The array to modify. 21539 * @param {Array} values The values to remove. 21540 * @param {Function} [comparator] The comparator invoked per element. 21541 * @returns {Array} Returns `array`. 21542 * @example 21543 * 21544 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; 21545 * 21546 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); 21547 * console.log(array); 21548 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] 21549 */ 21550 function pullAllWith(array, values, comparator) { 21551 return (array && array.length && values && values.length) 21552 ? basePullAll(array, values, undefined, comparator) 21553 : array; 21554 } 21555 21556 /** 21557 * Removes elements from `array` corresponding to `indexes` and returns an 21558 * array of removed elements. 21559 * 21560 * **Note:** Unlike `_.at`, this method mutates `array`. 21561 * 21562 * @static 21563 * @memberOf _ 21564 * @since 3.0.0 21565 * @category Array 21566 * @param {Array} array The array to modify. 21567 * @param {...(number|number[])} [indexes] The indexes of elements to remove. 21568 * @returns {Array} Returns the new array of removed elements. 21569 * @example 21570 * 21571 * var array = ['a', 'b', 'c', 'd']; 21572 * var pulled = _.pullAt(array, [1, 3]); 21573 * 21574 * console.log(array); 21575 * // => ['a', 'c'] 21576 * 21577 * console.log(pulled); 21578 * // => ['b', 'd'] 21579 */ 21580 var pullAt = flatRest(function(array, indexes) { 21581 var length = array == null ? 0 : array.length, 21582 result = baseAt(array, indexes); 21583 21584 basePullAt(array, arrayMap(indexes, function(index) { 21585 return isIndex(index, length) ? +index : index; 21586 }).sort(compareAscending)); 21587 21588 return result; 21589 }); 21590 21591 /** 21592 * Removes all elements from `array` that `predicate` returns truthy for 21593 * and returns an array of the removed elements. The predicate is invoked 21594 * with three arguments: (value, index, array). 21595 * 21596 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` 21597 * to pull elements from an array by value. 21598 * 21599 * @static 21600 * @memberOf _ 21601 * @since 2.0.0 21602 * @category Array 21603 * @param {Array} array The array to modify. 21604 * @param {Function} [predicate=_.identity] The function invoked per iteration. 21605 * @returns {Array} Returns the new array of removed elements. 21606 * @example 21607 * 21608 * var array = [1, 2, 3, 4]; 21609 * var evens = _.remove(array, function(n) { 21610 * return n % 2 == 0; 21611 * }); 21612 * 21613 * console.log(array); 21614 * // => [1, 3] 21615 * 21616 * console.log(evens); 21617 * // => [2, 4] 21618 */ 21619 function remove(array, predicate) { 21620 var result = []; 21621 if (!(array && array.length)) { 21622 return result; 21623 } 21624 var index = -1, 21625 indexes = [], 21626 length = array.length; 21627 21628 predicate = getIteratee(predicate, 3); 21629 while (++index < length) { 21630 var value = array[index]; 21631 if (predicate(value, index, array)) { 21632 result.push(value); 21633 indexes.push(index); 21634 } 21635 } 21636 basePullAt(array, indexes); 21637 return result; 21638 } 21639 21640 /** 21641 * Reverses `array` so that the first element becomes the last, the second 21642 * element becomes the second to last, and so on. 21643 * 21644 * **Note:** This method mutates `array` and is based on 21645 * [`Array#reverse`](https://mdn.io/Array/reverse). 21646 * 21647 * @static 21648 * @memberOf _ 21649 * @since 4.0.0 21650 * @category Array 21651 * @param {Array} array The array to modify. 21652 * @returns {Array} Returns `array`. 21653 * @example 21654 * 21655 * var array = [1, 2, 3]; 21656 * 21657 * _.reverse(array); 21658 * // => [3, 2, 1] 21659 * 21660 * console.log(array); 21661 * // => [3, 2, 1] 21662 */ 21663 function reverse(array) { 21664 return array == null ? array : nativeReverse.call(array); 21665 } 21666 21667 /** 21668 * Creates a slice of `array` from `start` up to, but not including, `end`. 21669 * 21670 * **Note:** This method is used instead of 21671 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are 21672 * returned. 21673 * 21674 * @static 21675 * @memberOf _ 21676 * @since 3.0.0 21677 * @category Array 21678 * @param {Array} array The array to slice. 21679 * @param {number} [start=0] The start position. 21680 * @param {number} [end=array.length] The end position. 21681 * @returns {Array} Returns the slice of `array`. 21682 */ 21683 function slice(array, start, end) { 21684 var length = array == null ? 0 : array.length; 21685 if (!length) { 21686 return []; 21687 } 21688 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { 21689 start = 0; 21690 end = length; 21691 } 21692 else { 21693 start = start == null ? 0 : toInteger(start); 21694 end = end === undefined ? length : toInteger(end); 21695 } 21696 return baseSlice(array, start, end); 21697 } 21698 21699 /** 21700 * Uses a binary search to determine the lowest index at which `value` 21701 * should be inserted into `array` in order to maintain its sort order. 21702 * 21703 * @static 21704 * @memberOf _ 21705 * @since 0.1.0 21706 * @category Array 21707 * @param {Array} array The sorted array to inspect. 21708 * @param {*} value The value to evaluate. 21709 * @returns {number} Returns the index at which `value` should be inserted 21710 * into `array`. 21711 * @example 21712 * 21713 * _.sortedIndex([30, 50], 40); 21714 * // => 1 21715 */ 21716 function sortedIndex(array, value) { 21717 return baseSortedIndex(array, value); 21718 } 21719 21720 /** 21721 * This method is like `_.sortedIndex` except that it accepts `iteratee` 21722 * which is invoked for `value` and each element of `array` to compute their 21723 * sort ranking. The iteratee is invoked with one argument: (value). 21724 * 21725 * @static 21726 * @memberOf _ 21727 * @since 4.0.0 21728 * @category Array 21729 * @param {Array} array The sorted array to inspect. 21730 * @param {*} value The value to evaluate. 21731 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 21732 * @returns {number} Returns the index at which `value` should be inserted 21733 * into `array`. 21734 * @example 21735 * 21736 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 21737 * 21738 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 21739 * // => 0 21740 * 21741 * // The `_.property` iteratee shorthand. 21742 * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); 21743 * // => 0 21744 */ 21745 function sortedIndexBy(array, value, iteratee) { 21746 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); 21747 } 21748 21749 /** 21750 * This method is like `_.indexOf` except that it performs a binary 21751 * search on a sorted `array`. 21752 * 21753 * @static 21754 * @memberOf _ 21755 * @since 4.0.0 21756 * @category Array 21757 * @param {Array} array The array to inspect. 21758 * @param {*} value The value to search for. 21759 * @returns {number} Returns the index of the matched value, else `-1`. 21760 * @example 21761 * 21762 * _.sortedIndexOf([4, 5, 5, 5, 6], 5); 21763 * // => 1 21764 */ 21765 function sortedIndexOf(array, value) { 21766 var length = array == null ? 0 : array.length; 21767 if (length) { 21768 var index = baseSortedIndex(array, value); 21769 if (index < length && eq(array[index], value)) { 21770 return index; 21771 } 21772 } 21773 return -1; 21774 } 21775 21776 /** 21777 * This method is like `_.sortedIndex` except that it returns the highest 21778 * index at which `value` should be inserted into `array` in order to 21779 * maintain its sort order. 21780 * 21781 * @static 21782 * @memberOf _ 21783 * @since 3.0.0 21784 * @category Array 21785 * @param {Array} array The sorted array to inspect. 21786 * @param {*} value The value to evaluate. 21787 * @returns {number} Returns the index at which `value` should be inserted 21788 * into `array`. 21789 * @example 21790 * 21791 * _.sortedLastIndex([4, 5, 5, 5, 6], 5); 21792 * // => 4 21793 */ 21794 function sortedLastIndex(array, value) { 21795 return baseSortedIndex(array, value, true); 21796 } 21797 21798 /** 21799 * This method is like `_.sortedLastIndex` except that it accepts `iteratee` 21800 * which is invoked for `value` and each element of `array` to compute their 21801 * sort ranking. The iteratee is invoked with one argument: (value). 21802 * 21803 * @static 21804 * @memberOf _ 21805 * @since 4.0.0 21806 * @category Array 21807 * @param {Array} array The sorted array to inspect. 21808 * @param {*} value The value to evaluate. 21809 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 21810 * @returns {number} Returns the index at which `value` should be inserted 21811 * into `array`. 21812 * @example 21813 * 21814 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 21815 * 21816 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 21817 * // => 1 21818 * 21819 * // The `_.property` iteratee shorthand. 21820 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); 21821 * // => 1 21822 */ 21823 function sortedLastIndexBy(array, value, iteratee) { 21824 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); 21825 } 21826 21827 /** 21828 * This method is like `_.lastIndexOf` except that it performs a binary 21829 * search on a sorted `array`. 21830 * 21831 * @static 21832 * @memberOf _ 21833 * @since 4.0.0 21834 * @category Array 21835 * @param {Array} array The array to inspect. 21836 * @param {*} value The value to search for. 21837 * @returns {number} Returns the index of the matched value, else `-1`. 21838 * @example 21839 * 21840 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); 21841 * // => 3 21842 */ 21843 function sortedLastIndexOf(array, value) { 21844 var length = array == null ? 0 : array.length; 21845 if (length) { 21846 var index = baseSortedIndex(array, value, true) - 1; 21847 if (eq(array[index], value)) { 21848 return index; 21849 } 21850 } 21851 return -1; 21852 } 21853 21854 /** 21855 * This method is like `_.uniq` except that it's designed and optimized 21856 * for sorted arrays. 21857 * 21858 * @static 21859 * @memberOf _ 21860 * @since 4.0.0 21861 * @category Array 21862 * @param {Array} array The array to inspect. 21863 * @returns {Array} Returns the new duplicate free array. 21864 * @example 21865 * 21866 * _.sortedUniq([1, 1, 2]); 21867 * // => [1, 2] 21868 */ 21869 function sortedUniq(array) { 21870 return (array && array.length) 21871 ? baseSortedUniq(array) 21872 : []; 21873 } 21874 21875 /** 21876 * This method is like `_.uniqBy` except that it's designed and optimized 21877 * for sorted arrays. 21878 * 21879 * @static 21880 * @memberOf _ 21881 * @since 4.0.0 21882 * @category Array 21883 * @param {Array} array The array to inspect. 21884 * @param {Function} [iteratee] The iteratee invoked per element. 21885 * @returns {Array} Returns the new duplicate free array. 21886 * @example 21887 * 21888 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); 21889 * // => [1.1, 2.3] 21890 */ 21891 function sortedUniqBy(array, iteratee) { 21892 return (array && array.length) 21893 ? baseSortedUniq(array, getIteratee(iteratee, 2)) 21894 : []; 21895 } 21896 21897 /** 21898 * Gets all but the first element of `array`. 21899 * 21900 * @static 21901 * @memberOf _ 21902 * @since 4.0.0 21903 * @category Array 21904 * @param {Array} array The array to query. 21905 * @returns {Array} Returns the slice of `array`. 21906 * @example 21907 * 21908 * _.tail([1, 2, 3]); 21909 * // => [2, 3] 21910 */ 21911 function tail(array) { 21912 var length = array == null ? 0 : array.length; 21913 return length ? baseSlice(array, 1, length) : []; 21914 } 21915 21916 /** 21917 * Creates a slice of `array` with `n` elements taken from the beginning. 21918 * 21919 * @static 21920 * @memberOf _ 21921 * @since 0.1.0 21922 * @category Array 21923 * @param {Array} array The array to query. 21924 * @param {number} [n=1] The number of elements to take. 21925 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 21926 * @returns {Array} Returns the slice of `array`. 21927 * @example 21928 * 21929 * _.take([1, 2, 3]); 21930 * // => [1] 21931 * 21932 * _.take([1, 2, 3], 2); 21933 * // => [1, 2] 21934 * 21935 * _.take([1, 2, 3], 5); 21936 * // => [1, 2, 3] 21937 * 21938 * _.take([1, 2, 3], 0); 21939 * // => [] 21940 */ 21941 function take(array, n, guard) { 21942 if (!(array && array.length)) { 21943 return []; 21944 } 21945 n = (guard || n === undefined) ? 1 : toInteger(n); 21946 return baseSlice(array, 0, n < 0 ? 0 : n); 21947 } 21948 21949 /** 21950 * Creates a slice of `array` with `n` elements taken from the end. 21951 * 21952 * @static 21953 * @memberOf _ 21954 * @since 3.0.0 21955 * @category Array 21956 * @param {Array} array The array to query. 21957 * @param {number} [n=1] The number of elements to take. 21958 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 21959 * @returns {Array} Returns the slice of `array`. 21960 * @example 21961 * 21962 * _.takeRight([1, 2, 3]); 21963 * // => [3] 21964 * 21965 * _.takeRight([1, 2, 3], 2); 21966 * // => [2, 3] 21967 * 21968 * _.takeRight([1, 2, 3], 5); 21969 * // => [1, 2, 3] 21970 * 21971 * _.takeRight([1, 2, 3], 0); 21972 * // => [] 21973 */ 21974 function takeRight(array, n, guard) { 21975 var length = array == null ? 0 : array.length; 21976 if (!length) { 21977 return []; 21978 } 21979 n = (guard || n === undefined) ? 1 : toInteger(n); 21980 n = length - n; 21981 return baseSlice(array, n < 0 ? 0 : n, length); 21982 } 21983 21984 /** 21985 * Creates a slice of `array` with elements taken from the end. Elements are 21986 * taken until `predicate` returns falsey. The predicate is invoked with 21987 * three arguments: (value, index, array). 21988 * 21989 * @static 21990 * @memberOf _ 21991 * @since 3.0.0 21992 * @category Array 21993 * @param {Array} array The array to query. 21994 * @param {Function} [predicate=_.identity] The function invoked per iteration. 21995 * @returns {Array} Returns the slice of `array`. 21996 * @example 21997 * 21998 * var users = [ 21999 * { 'user': 'barney', 'active': true }, 22000 * { 'user': 'fred', 'active': false }, 22001 * { 'user': 'pebbles', 'active': false } 22002 * ]; 22003 * 22004 * _.takeRightWhile(users, function(o) { return !o.active; }); 22005 * // => objects for ['fred', 'pebbles'] 22006 * 22007 * // The `_.matches` iteratee shorthand. 22008 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); 22009 * // => objects for ['pebbles'] 22010 * 22011 * // The `_.matchesProperty` iteratee shorthand. 22012 * _.takeRightWhile(users, ['active', false]); 22013 * // => objects for ['fred', 'pebbles'] 22014 * 22015 * // The `_.property` iteratee shorthand. 22016 * _.takeRightWhile(users, 'active'); 22017 * // => [] 22018 */ 22019 function takeRightWhile(array, predicate) { 22020 return (array && array.length) 22021 ? baseWhile(array, getIteratee(predicate, 3), false, true) 22022 : []; 22023 } 22024 22025 /** 22026 * Creates a slice of `array` with elements taken from the beginning. Elements 22027 * are taken until `predicate` returns falsey. The predicate is invoked with 22028 * three arguments: (value, index, array). 22029 * 22030 * @static 22031 * @memberOf _ 22032 * @since 3.0.0 22033 * @category Array 22034 * @param {Array} array The array to query. 22035 * @param {Function} [predicate=_.identity] The function invoked per iteration. 22036 * @returns {Array} Returns the slice of `array`. 22037 * @example 22038 * 22039 * var users = [ 22040 * { 'user': 'barney', 'active': false }, 22041 * { 'user': 'fred', 'active': false }, 22042 * { 'user': 'pebbles', 'active': true } 22043 * ]; 22044 * 22045 * _.takeWhile(users, function(o) { return !o.active; }); 22046 * // => objects for ['barney', 'fred'] 22047 * 22048 * // The `_.matches` iteratee shorthand. 22049 * _.takeWhile(users, { 'user': 'barney', 'active': false }); 22050 * // => objects for ['barney'] 22051 * 22052 * // The `_.matchesProperty` iteratee shorthand. 22053 * _.takeWhile(users, ['active', false]); 22054 * // => objects for ['barney', 'fred'] 22055 * 22056 * // The `_.property` iteratee shorthand. 22057 * _.takeWhile(users, 'active'); 22058 * // => [] 22059 */ 22060 function takeWhile(array, predicate) { 22061 return (array && array.length) 22062 ? baseWhile(array, getIteratee(predicate, 3)) 22063 : []; 22064 } 22065 22066 /** 22067 * Creates an array of unique values, in order, from all given arrays using 22068 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 22069 * for equality comparisons. 22070 * 22071 * @static 22072 * @memberOf _ 22073 * @since 0.1.0 22074 * @category Array 22075 * @param {...Array} [arrays] The arrays to inspect. 22076 * @returns {Array} Returns the new array of combined values. 22077 * @example 22078 * 22079 * _.union([2], [1, 2]); 22080 * // => [2, 1] 22081 */ 22082 var union = baseRest(function(arrays) { 22083 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 22084 }); 22085 22086 /** 22087 * This method is like `_.union` except that it accepts `iteratee` which is 22088 * invoked for each element of each `arrays` to generate the criterion by 22089 * which uniqueness is computed. Result values are chosen from the first 22090 * array in which the value occurs. The iteratee is invoked with one argument: 22091 * (value). 22092 * 22093 * @static 22094 * @memberOf _ 22095 * @since 4.0.0 22096 * @category Array 22097 * @param {...Array} [arrays] The arrays to inspect. 22098 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 22099 * @returns {Array} Returns the new array of combined values. 22100 * @example 22101 * 22102 * _.unionBy([2.1], [1.2, 2.3], Math.floor); 22103 * // => [2.1, 1.2] 22104 * 22105 * // The `_.property` iteratee shorthand. 22106 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 22107 * // => [{ 'x': 1 }, { 'x': 2 }] 22108 */ 22109 var unionBy = baseRest(function(arrays) { 22110 var iteratee = last(arrays); 22111 if (isArrayLikeObject(iteratee)) { 22112 iteratee = undefined; 22113 } 22114 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); 22115 }); 22116 22117 /** 22118 * This method is like `_.union` except that it accepts `comparator` which 22119 * is invoked to compare elements of `arrays`. Result values are chosen from 22120 * the first array in which the value occurs. The comparator is invoked 22121 * with two arguments: (arrVal, othVal). 22122 * 22123 * @static 22124 * @memberOf _ 22125 * @since 4.0.0 22126 * @category Array 22127 * @param {...Array} [arrays] The arrays to inspect. 22128 * @param {Function} [comparator] The comparator invoked per element. 22129 * @returns {Array} Returns the new array of combined values. 22130 * @example 22131 * 22132 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 22133 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 22134 * 22135 * _.unionWith(objects, others, _.isEqual); 22136 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 22137 */ 22138 var unionWith = baseRest(function(arrays) { 22139 var comparator = last(arrays); 22140 comparator = typeof comparator == 'function' ? comparator : undefined; 22141 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); 22142 }); 22143 22144 /** 22145 * Creates a duplicate-free version of an array, using 22146 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 22147 * for equality comparisons, in which only the first occurrence of each element 22148 * is kept. The order of result values is determined by the order they occur 22149 * in the array. 22150 * 22151 * @static 22152 * @memberOf _ 22153 * @since 0.1.0 22154 * @category Array 22155 * @param {Array} array The array to inspect. 22156 * @returns {Array} Returns the new duplicate free array. 22157 * @example 22158 * 22159 * _.uniq([2, 1, 2]); 22160 * // => [2, 1] 22161 */ 22162 function uniq(array) { 22163 return (array && array.length) ? baseUniq(array) : []; 22164 } 22165 22166 /** 22167 * This method is like `_.uniq` except that it accepts `iteratee` which is 22168 * invoked for each element in `array` to generate the criterion by which 22169 * uniqueness is computed. The order of result values is determined by the 22170 * order they occur in the array. The iteratee is invoked with one argument: 22171 * (value). 22172 * 22173 * @static 22174 * @memberOf _ 22175 * @since 4.0.0 22176 * @category Array 22177 * @param {Array} array The array to inspect. 22178 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 22179 * @returns {Array} Returns the new duplicate free array. 22180 * @example 22181 * 22182 * _.uniqBy([2.1, 1.2, 2.3], Math.floor); 22183 * // => [2.1, 1.2] 22184 * 22185 * // The `_.property` iteratee shorthand. 22186 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); 22187 * // => [{ 'x': 1 }, { 'x': 2 }] 22188 */ 22189 function uniqBy(array, iteratee) { 22190 return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; 22191 } 22192 22193 /** 22194 * This method is like `_.uniq` except that it accepts `comparator` which 22195 * is invoked to compare elements of `array`. The order of result values is 22196 * determined by the order they occur in the array.The comparator is invoked 22197 * with two arguments: (arrVal, othVal). 22198 * 22199 * @static 22200 * @memberOf _ 22201 * @since 4.0.0 22202 * @category Array 22203 * @param {Array} array The array to inspect. 22204 * @param {Function} [comparator] The comparator invoked per element. 22205 * @returns {Array} Returns the new duplicate free array. 22206 * @example 22207 * 22208 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; 22209 * 22210 * _.uniqWith(objects, _.isEqual); 22211 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] 22212 */ 22213 function uniqWith(array, comparator) { 22214 comparator = typeof comparator == 'function' ? comparator : undefined; 22215 return (array && array.length) ? baseUniq(array, undefined, comparator) : []; 22216 } 22217 22218 /** 22219 * This method is like `_.zip` except that it accepts an array of grouped 22220 * elements and creates an array regrouping the elements to their pre-zip 22221 * configuration. 22222 * 22223 * @static 22224 * @memberOf _ 22225 * @since 1.2.0 22226 * @category Array 22227 * @param {Array} array The array of grouped elements to process. 22228 * @returns {Array} Returns the new array of regrouped elements. 22229 * @example 22230 * 22231 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); 22232 * // => [['a', 1, true], ['b', 2, false]] 22233 * 22234 * _.unzip(zipped); 22235 * // => [['a', 'b'], [1, 2], [true, false]] 22236 */ 22237 function unzip(array) { 22238 if (!(array && array.length)) { 22239 return []; 22240 } 22241 var length = 0; 22242 array = arrayFilter(array, function(group) { 22243 if (isArrayLikeObject(group)) { 22244 length = nativeMax(group.length, length); 22245 return true; 22246 } 22247 }); 22248 return baseTimes(length, function(index) { 22249 return arrayMap(array, baseProperty(index)); 22250 }); 22251 } 22252 22253 /** 22254 * This method is like `_.unzip` except that it accepts `iteratee` to specify 22255 * how regrouped values should be combined. The iteratee is invoked with the 22256 * elements of each group: (...group). 22257 * 22258 * @static 22259 * @memberOf _ 22260 * @since 3.8.0 22261 * @category Array 22262 * @param {Array} array The array of grouped elements to process. 22263 * @param {Function} [iteratee=_.identity] The function to combine 22264 * regrouped values. 22265 * @returns {Array} Returns the new array of regrouped elements. 22266 * @example 22267 * 22268 * var zipped = _.zip([1, 2], [10, 20], [100, 200]); 22269 * // => [[1, 10, 100], [2, 20, 200]] 22270 * 22271 * _.unzipWith(zipped, _.add); 22272 * // => [3, 30, 300] 22273 */ 22274 function unzipWith(array, iteratee) { 22275 if (!(array && array.length)) { 22276 return []; 22277 } 22278 var result = unzip(array); 22279 if (iteratee == null) { 22280 return result; 22281 } 22282 return arrayMap(result, function(group) { 22283 return apply(iteratee, undefined, group); 22284 }); 22285 } 22286 22287 /** 22288 * Creates an array excluding all given values using 22289 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 22290 * for equality comparisons. 22291 * 22292 * **Note:** Unlike `_.pull`, this method returns a new array. 22293 * 22294 * @static 22295 * @memberOf _ 22296 * @since 0.1.0 22297 * @category Array 22298 * @param {Array} array The array to inspect. 22299 * @param {...*} [values] The values to exclude. 22300 * @returns {Array} Returns the new array of filtered values. 22301 * @see _.difference, _.xor 22302 * @example 22303 * 22304 * _.without([2, 1, 2, 3], 1, 2); 22305 * // => [3] 22306 */ 22307 var without = baseRest(function(array, values) { 22308 return isArrayLikeObject(array) 22309 ? baseDifference(array, values) 22310 : []; 22311 }); 22312 22313 /** 22314 * Creates an array of unique values that is the 22315 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) 22316 * of the given arrays. The order of result values is determined by the order 22317 * they occur in the arrays. 22318 * 22319 * @static 22320 * @memberOf _ 22321 * @since 2.4.0 22322 * @category Array 22323 * @param {...Array} [arrays] The arrays to inspect. 22324 * @returns {Array} Returns the new array of filtered values. 22325 * @see _.difference, _.without 22326 * @example 22327 * 22328 * _.xor([2, 1], [2, 3]); 22329 * // => [1, 3] 22330 */ 22331 var xor = baseRest(function(arrays) { 22332 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 22333 }); 22334 22335 /** 22336 * This method is like `_.xor` except that it accepts `iteratee` which is 22337 * invoked for each element of each `arrays` to generate the criterion by 22338 * which by which they're compared. The order of result values is determined 22339 * by the order they occur in the arrays. The iteratee is invoked with one 22340 * argument: (value). 22341 * 22342 * @static 22343 * @memberOf _ 22344 * @since 4.0.0 22345 * @category Array 22346 * @param {...Array} [arrays] The arrays to inspect. 22347 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 22348 * @returns {Array} Returns the new array of filtered values. 22349 * @example 22350 * 22351 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); 22352 * // => [1.2, 3.4] 22353 * 22354 * // The `_.property` iteratee shorthand. 22355 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 22356 * // => [{ 'x': 2 }] 22357 */ 22358 var xorBy = baseRest(function(arrays) { 22359 var iteratee = last(arrays); 22360 if (isArrayLikeObject(iteratee)) { 22361 iteratee = undefined; 22362 } 22363 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); 22364 }); 22365 22366 /** 22367 * This method is like `_.xor` except that it accepts `comparator` which is 22368 * invoked to compare elements of `arrays`. The order of result values is 22369 * determined by the order they occur in the arrays. The comparator is invoked 22370 * with two arguments: (arrVal, othVal). 22371 * 22372 * @static 22373 * @memberOf _ 22374 * @since 4.0.0 22375 * @category Array 22376 * @param {...Array} [arrays] The arrays to inspect. 22377 * @param {Function} [comparator] The comparator invoked per element. 22378 * @returns {Array} Returns the new array of filtered values. 22379 * @example 22380 * 22381 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 22382 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 22383 * 22384 * _.xorWith(objects, others, _.isEqual); 22385 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 22386 */ 22387 var xorWith = baseRest(function(arrays) { 22388 var comparator = last(arrays); 22389 comparator = typeof comparator == 'function' ? comparator : undefined; 22390 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); 22391 }); 22392 22393 /** 22394 * Creates an array of grouped elements, the first of which contains the 22395 * first elements of the given arrays, the second of which contains the 22396 * second elements of the given arrays, and so on. 22397 * 22398 * @static 22399 * @memberOf _ 22400 * @since 0.1.0 22401 * @category Array 22402 * @param {...Array} [arrays] The arrays to process. 22403 * @returns {Array} Returns the new array of grouped elements. 22404 * @example 22405 * 22406 * _.zip(['a', 'b'], [1, 2], [true, false]); 22407 * // => [['a', 1, true], ['b', 2, false]] 22408 */ 22409 var zip = baseRest(unzip); 22410 22411 /** 22412 * This method is like `_.fromPairs` except that it accepts two arrays, 22413 * one of property identifiers and one of corresponding values. 22414 * 22415 * @static 22416 * @memberOf _ 22417 * @since 0.4.0 22418 * @category Array 22419 * @param {Array} [props=[]] The property identifiers. 22420 * @param {Array} [values=[]] The property values. 22421 * @returns {Object} Returns the new object. 22422 * @example 22423 * 22424 * _.zipObject(['a', 'b'], [1, 2]); 22425 * // => { 'a': 1, 'b': 2 } 22426 */ 22427 function zipObject(props, values) { 22428 return baseZipObject(props || [], values || [], assignValue); 22429 } 22430 22431 /** 22432 * This method is like `_.zipObject` except that it supports property paths. 22433 * 22434 * @static 22435 * @memberOf _ 22436 * @since 4.1.0 22437 * @category Array 22438 * @param {Array} [props=[]] The property identifiers. 22439 * @param {Array} [values=[]] The property values. 22440 * @returns {Object} Returns the new object. 22441 * @example 22442 * 22443 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); 22444 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } 22445 */ 22446 function zipObjectDeep(props, values) { 22447 return baseZipObject(props || [], values || [], baseSet); 22448 } 22449 22450 /** 22451 * This method is like `_.zip` except that it accepts `iteratee` to specify 22452 * how grouped values should be combined. The iteratee is invoked with the 22453 * elements of each group: (...group). 22454 * 22455 * @static 22456 * @memberOf _ 22457 * @since 3.8.0 22458 * @category Array 22459 * @param {...Array} [arrays] The arrays to process. 22460 * @param {Function} [iteratee=_.identity] The function to combine 22461 * grouped values. 22462 * @returns {Array} Returns the new array of grouped elements. 22463 * @example 22464 * 22465 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { 22466 * return a + b + c; 22467 * }); 22468 * // => [111, 222] 22469 */ 22470 var zipWith = baseRest(function(arrays) { 22471 var length = arrays.length, 22472 iteratee = length > 1 ? arrays[length - 1] : undefined; 22473 22474 iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; 22475 return unzipWith(arrays, iteratee); 22476 }); 22477 22478 /*------------------------------------------------------------------------*/ 22479 22480 /** 22481 * Creates a `lodash` wrapper instance that wraps `value` with explicit method 22482 * chain sequences enabled. The result of such sequences must be unwrapped 22483 * with `_#value`. 22484 * 22485 * @static 22486 * @memberOf _ 22487 * @since 1.3.0 22488 * @category Seq 22489 * @param {*} value The value to wrap. 22490 * @returns {Object} Returns the new `lodash` wrapper instance. 22491 * @example 22492 * 22493 * var users = [ 22494 * { 'user': 'barney', 'age': 36 }, 22495 * { 'user': 'fred', 'age': 40 }, 22496 * { 'user': 'pebbles', 'age': 1 } 22497 * ]; 22498 * 22499 * var youngest = _ 22500 * .chain(users) 22501 * .sortBy('age') 22502 * .map(function(o) { 22503 * return o.user + ' is ' + o.age; 22504 * }) 22505 * .head() 22506 * .value(); 22507 * // => 'pebbles is 1' 22508 */ 22509 function chain(value) { 22510 var result = lodash(value); 22511 result.__chain__ = true; 22512 return result; 22513 } 22514 22515 /** 22516 * This method invokes `interceptor` and returns `value`. The interceptor 22517 * is invoked with one argument; (value). The purpose of this method is to 22518 * "tap into" a method chain sequence in order to modify intermediate results. 22519 * 22520 * @static 22521 * @memberOf _ 22522 * @since 0.1.0 22523 * @category Seq 22524 * @param {*} value The value to provide to `interceptor`. 22525 * @param {Function} interceptor The function to invoke. 22526 * @returns {*} Returns `value`. 22527 * @example 22528 * 22529 * _([1, 2, 3]) 22530 * .tap(function(array) { 22531 * // Mutate input array. 22532 * array.pop(); 22533 * }) 22534 * .reverse() 22535 * .value(); 22536 * // => [2, 1] 22537 */ 22538 function tap(value, interceptor) { 22539 interceptor(value); 22540 return value; 22541 } 22542 22543 /** 22544 * This method is like `_.tap` except that it returns the result of `interceptor`. 22545 * The purpose of this method is to "pass thru" values replacing intermediate 22546 * results in a method chain sequence. 22547 * 22548 * @static 22549 * @memberOf _ 22550 * @since 3.0.0 22551 * @category Seq 22552 * @param {*} value The value to provide to `interceptor`. 22553 * @param {Function} interceptor The function to invoke. 22554 * @returns {*} Returns the result of `interceptor`. 22555 * @example 22556 * 22557 * _(' abc ') 22558 * .chain() 22559 * .trim() 22560 * .thru(function(value) { 22561 * return [value]; 22562 * }) 22563 * .value(); 22564 * // => ['abc'] 22565 */ 22566 function thru(value, interceptor) { 22567 return interceptor(value); 22568 } 22569 22570 /** 22571 * This method is the wrapper version of `_.at`. 22572 * 22573 * @name at 22574 * @memberOf _ 22575 * @since 1.0.0 22576 * @category Seq 22577 * @param {...(string|string[])} [paths] The property paths to pick. 22578 * @returns {Object} Returns the new `lodash` wrapper instance. 22579 * @example 22580 * 22581 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 22582 * 22583 * _(object).at(['a[0].b.c', 'a[1]']).value(); 22584 * // => [3, 4] 22585 */ 22586 var wrapperAt = flatRest(function(paths) { 22587 var length = paths.length, 22588 start = length ? paths[0] : 0, 22589 value = this.__wrapped__, 22590 interceptor = function(object) { return baseAt(object, paths); }; 22591 22592 if (length > 1 || this.__actions__.length || 22593 !(value instanceof LazyWrapper) || !isIndex(start)) { 22594 return this.thru(interceptor); 22595 } 22596 value = value.slice(start, +start + (length ? 1 : 0)); 22597 value.__actions__.push({ 22598 'func': thru, 22599 'args': [interceptor], 22600 'thisArg': undefined 22601 }); 22602 return new LodashWrapper(value, this.__chain__).thru(function(array) { 22603 if (length && !array.length) { 22604 array.push(undefined); 22605 } 22606 return array; 22607 }); 22608 }); 22609 22610 /** 22611 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. 22612 * 22613 * @name chain 22614 * @memberOf _ 22615 * @since 0.1.0 22616 * @category Seq 22617 * @returns {Object} Returns the new `lodash` wrapper instance. 22618 * @example 22619 * 22620 * var users = [ 22621 * { 'user': 'barney', 'age': 36 }, 22622 * { 'user': 'fred', 'age': 40 } 22623 * ]; 22624 * 22625 * // A sequence without explicit chaining. 22626 * _(users).head(); 22627 * // => { 'user': 'barney', 'age': 36 } 22628 * 22629 * // A sequence with explicit chaining. 22630 * _(users) 22631 * .chain() 22632 * .head() 22633 * .pick('user') 22634 * .value(); 22635 * // => { 'user': 'barney' } 22636 */ 22637 function wrapperChain() { 22638 return chain(this); 22639 } 22640 22641 /** 22642 * Executes the chain sequence and returns the wrapped result. 22643 * 22644 * @name commit 22645 * @memberOf _ 22646 * @since 3.2.0 22647 * @category Seq 22648 * @returns {Object} Returns the new `lodash` wrapper instance. 22649 * @example 22650 * 22651 * var array = [1, 2]; 22652 * var wrapped = _(array).push(3); 22653 * 22654 * console.log(array); 22655 * // => [1, 2] 22656 * 22657 * wrapped = wrapped.commit(); 22658 * console.log(array); 22659 * // => [1, 2, 3] 22660 * 22661 * wrapped.last(); 22662 * // => 3 22663 * 22664 * console.log(array); 22665 * // => [1, 2, 3] 22666 */ 22667 function wrapperCommit() { 22668 return new LodashWrapper(this.value(), this.__chain__); 22669 } 22670 22671 /** 22672 * Gets the next value on a wrapped object following the 22673 * [iterator protocol](https://mdn.io/iteration_protocols#iterator). 22674 * 22675 * @name next 22676 * @memberOf _ 22677 * @since 4.0.0 22678 * @category Seq 22679 * @returns {Object} Returns the next iterator value. 22680 * @example 22681 * 22682 * var wrapped = _([1, 2]); 22683 * 22684 * wrapped.next(); 22685 * // => { 'done': false, 'value': 1 } 22686 * 22687 * wrapped.next(); 22688 * // => { 'done': false, 'value': 2 } 22689 * 22690 * wrapped.next(); 22691 * // => { 'done': true, 'value': undefined } 22692 */ 22693 function wrapperNext() { 22694 if (this.__values__ === undefined) { 22695 this.__values__ = toArray(this.value()); 22696 } 22697 var done = this.__index__ >= this.__values__.length, 22698 value = done ? undefined : this.__values__[this.__index__++]; 22699 22700 return { 'done': done, 'value': value }; 22701 } 22702 22703 /** 22704 * Enables the wrapper to be iterable. 22705 * 22706 * @name Symbol.iterator 22707 * @memberOf _ 22708 * @since 4.0.0 22709 * @category Seq 22710 * @returns {Object} Returns the wrapper object. 22711 * @example 22712 * 22713 * var wrapped = _([1, 2]); 22714 * 22715 * wrapped[Symbol.iterator]() === wrapped; 22716 * // => true 22717 * 22718 * Array.from(wrapped); 22719 * // => [1, 2] 22720 */ 22721 function wrapperToIterator() { 22722 return this; 22723 } 22724 22725 /** 22726 * Creates a clone of the chain sequence planting `value` as the wrapped value. 22727 * 22728 * @name plant 22729 * @memberOf _ 22730 * @since 3.2.0 22731 * @category Seq 22732 * @param {*} value The value to plant. 22733 * @returns {Object} Returns the new `lodash` wrapper instance. 22734 * @example 22735 * 22736 * function square(n) { 22737 * return n * n; 22738 * } 22739 * 22740 * var wrapped = _([1, 2]).map(square); 22741 * var other = wrapped.plant([3, 4]); 22742 * 22743 * other.value(); 22744 * // => [9, 16] 22745 * 22746 * wrapped.value(); 22747 * // => [1, 4] 22748 */ 22749 function wrapperPlant(value) { 22750 var result, 22751 parent = this; 22752 22753 while (parent instanceof baseLodash) { 22754 var clone = wrapperClone(parent); 22755 clone.__index__ = 0; 22756 clone.__values__ = undefined; 22757 if (result) { 22758 previous.__wrapped__ = clone; 22759 } else { 22760 result = clone; 22761 } 22762 var previous = clone; 22763 parent = parent.__wrapped__; 22764 } 22765 previous.__wrapped__ = value; 22766 return result; 22767 } 22768 22769 /** 22770 * This method is the wrapper version of `_.reverse`. 22771 * 22772 * **Note:** This method mutates the wrapped array. 22773 * 22774 * @name reverse 22775 * @memberOf _ 22776 * @since 0.1.0 22777 * @category Seq 22778 * @returns {Object} Returns the new `lodash` wrapper instance. 22779 * @example 22780 * 22781 * var array = [1, 2, 3]; 22782 * 22783 * _(array).reverse().value() 22784 * // => [3, 2, 1] 22785 * 22786 * console.log(array); 22787 * // => [3, 2, 1] 22788 */ 22789 function wrapperReverse() { 22790 var value = this.__wrapped__; 22791 if (value instanceof LazyWrapper) { 22792 var wrapped = value; 22793 if (this.__actions__.length) { 22794 wrapped = new LazyWrapper(this); 22795 } 22796 wrapped = wrapped.reverse(); 22797 wrapped.__actions__.push({ 22798 'func': thru, 22799 'args': [reverse], 22800 'thisArg': undefined 22801 }); 22802 return new LodashWrapper(wrapped, this.__chain__); 22803 } 22804 return this.thru(reverse); 22805 } 22806 22807 /** 22808 * Executes the chain sequence to resolve the unwrapped value. 22809 * 22810 * @name value 22811 * @memberOf _ 22812 * @since 0.1.0 22813 * @alias toJSON, valueOf 22814 * @category Seq 22815 * @returns {*} Returns the resolved unwrapped value. 22816 * @example 22817 * 22818 * _([1, 2, 3]).value(); 22819 * // => [1, 2, 3] 22820 */ 22821 function wrapperValue() { 22822 return baseWrapperValue(this.__wrapped__, this.__actions__); 22823 } 22824 22825 /*------------------------------------------------------------------------*/ 22826 22827 /** 22828 * Creates an object composed of keys generated from the results of running 22829 * each element of `collection` thru `iteratee`. The corresponding value of 22830 * each key is the number of times the key was returned by `iteratee`. The 22831 * iteratee is invoked with one argument: (value). 22832 * 22833 * @static 22834 * @memberOf _ 22835 * @since 0.5.0 22836 * @category Collection 22837 * @param {Array|Object} collection The collection to iterate over. 22838 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 22839 * @returns {Object} Returns the composed aggregate object. 22840 * @example 22841 * 22842 * _.countBy([6.1, 4.2, 6.3], Math.floor); 22843 * // => { '4': 1, '6': 2 } 22844 * 22845 * // The `_.property` iteratee shorthand. 22846 * _.countBy(['one', 'two', 'three'], 'length'); 22847 * // => { '3': 2, '5': 1 } 22848 */ 22849 var countBy = createAggregator(function(result, value, key) { 22850 if (hasOwnProperty.call(result, key)) { 22851 ++result[key]; 22852 } else { 22853 baseAssignValue(result, key, 1); 22854 } 22855 }); 22856 22857 /** 22858 * Checks if `predicate` returns truthy for **all** elements of `collection`. 22859 * Iteration is stopped once `predicate` returns falsey. The predicate is 22860 * invoked with three arguments: (value, index|key, collection). 22861 * 22862 * **Note:** This method returns `true` for 22863 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because 22864 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of 22865 * elements of empty collections. 22866 * 22867 * @static 22868 * @memberOf _ 22869 * @since 0.1.0 22870 * @category Collection 22871 * @param {Array|Object} collection The collection to iterate over. 22872 * @param {Function} [predicate=_.identity] The function invoked per iteration. 22873 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 22874 * @returns {boolean} Returns `true` if all elements pass the predicate check, 22875 * else `false`. 22876 * @example 22877 * 22878 * _.every([true, 1, null, 'yes'], Boolean); 22879 * // => false 22880 * 22881 * var users = [ 22882 * { 'user': 'barney', 'age': 36, 'active': false }, 22883 * { 'user': 'fred', 'age': 40, 'active': false } 22884 * ]; 22885 * 22886 * // The `_.matches` iteratee shorthand. 22887 * _.every(users, { 'user': 'barney', 'active': false }); 22888 * // => false 22889 * 22890 * // The `_.matchesProperty` iteratee shorthand. 22891 * _.every(users, ['active', false]); 22892 * // => true 22893 * 22894 * // The `_.property` iteratee shorthand. 22895 * _.every(users, 'active'); 22896 * // => false 22897 */ 22898 function every(collection, predicate, guard) { 22899 var func = isArray(collection) ? arrayEvery : baseEvery; 22900 if (guard && isIterateeCall(collection, predicate, guard)) { 22901 predicate = undefined; 22902 } 22903 return func(collection, getIteratee(predicate, 3)); 22904 } 22905 22906 /** 22907 * Iterates over elements of `collection`, returning an array of all elements 22908 * `predicate` returns truthy for. The predicate is invoked with three 22909 * arguments: (value, index|key, collection). 22910 * 22911 * **Note:** Unlike `_.remove`, this method returns a new array. 22912 * 22913 * @static 22914 * @memberOf _ 22915 * @since 0.1.0 22916 * @category Collection 22917 * @param {Array|Object} collection The collection to iterate over. 22918 * @param {Function} [predicate=_.identity] The function invoked per iteration. 22919 * @returns {Array} Returns the new filtered array. 22920 * @see _.reject 22921 * @example 22922 * 22923 * var users = [ 22924 * { 'user': 'barney', 'age': 36, 'active': true }, 22925 * { 'user': 'fred', 'age': 40, 'active': false } 22926 * ]; 22927 * 22928 * _.filter(users, function(o) { return !o.active; }); 22929 * // => objects for ['fred'] 22930 * 22931 * // The `_.matches` iteratee shorthand. 22932 * _.filter(users, { 'age': 36, 'active': true }); 22933 * // => objects for ['barney'] 22934 * 22935 * // The `_.matchesProperty` iteratee shorthand. 22936 * _.filter(users, ['active', false]); 22937 * // => objects for ['fred'] 22938 * 22939 * // The `_.property` iteratee shorthand. 22940 * _.filter(users, 'active'); 22941 * // => objects for ['barney'] 22942 * 22943 * // Combining several predicates using `_.overEvery` or `_.overSome`. 22944 * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); 22945 * // => objects for ['fred', 'barney'] 22946 */ 22947 function filter(collection, predicate) { 22948 var func = isArray(collection) ? arrayFilter : baseFilter; 22949 return func(collection, getIteratee(predicate, 3)); 22950 } 22951 22952 /** 22953 * Iterates over elements of `collection`, returning the first element 22954 * `predicate` returns truthy for. The predicate is invoked with three 22955 * arguments: (value, index|key, collection). 22956 * 22957 * @static 22958 * @memberOf _ 22959 * @since 0.1.0 22960 * @category Collection 22961 * @param {Array|Object} collection The collection to inspect. 22962 * @param {Function} [predicate=_.identity] The function invoked per iteration. 22963 * @param {number} [fromIndex=0] The index to search from. 22964 * @returns {*} Returns the matched element, else `undefined`. 22965 * @example 22966 * 22967 * var users = [ 22968 * { 'user': 'barney', 'age': 36, 'active': true }, 22969 * { 'user': 'fred', 'age': 40, 'active': false }, 22970 * { 'user': 'pebbles', 'age': 1, 'active': true } 22971 * ]; 22972 * 22973 * _.find(users, function(o) { return o.age < 40; }); 22974 * // => object for 'barney' 22975 * 22976 * // The `_.matches` iteratee shorthand. 22977 * _.find(users, { 'age': 1, 'active': true }); 22978 * // => object for 'pebbles' 22979 * 22980 * // The `_.matchesProperty` iteratee shorthand. 22981 * _.find(users, ['active', false]); 22982 * // => object for 'fred' 22983 * 22984 * // The `_.property` iteratee shorthand. 22985 * _.find(users, 'active'); 22986 * // => object for 'barney' 22987 */ 22988 var find = createFind(findIndex); 22989 22990 /** 22991 * This method is like `_.find` except that it iterates over elements of 22992 * `collection` from right to left. 22993 * 22994 * @static 22995 * @memberOf _ 22996 * @since 2.0.0 22997 * @category Collection 22998 * @param {Array|Object} collection The collection to inspect. 22999 * @param {Function} [predicate=_.identity] The function invoked per iteration. 23000 * @param {number} [fromIndex=collection.length-1] The index to search from. 23001 * @returns {*} Returns the matched element, else `undefined`. 23002 * @example 23003 * 23004 * _.findLast([1, 2, 3, 4], function(n) { 23005 * return n % 2 == 1; 23006 * }); 23007 * // => 3 23008 */ 23009 var findLast = createFind(findLastIndex); 23010 23011 /** 23012 * Creates a flattened array of values by running each element in `collection` 23013 * thru `iteratee` and flattening the mapped results. The iteratee is invoked 23014 * with three arguments: (value, index|key, collection). 23015 * 23016 * @static 23017 * @memberOf _ 23018 * @since 4.0.0 23019 * @category Collection 23020 * @param {Array|Object} collection The collection to iterate over. 23021 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 23022 * @returns {Array} Returns the new flattened array. 23023 * @example 23024 * 23025 * function duplicate(n) { 23026 * return [n, n]; 23027 * } 23028 * 23029 * _.flatMap([1, 2], duplicate); 23030 * // => [1, 1, 2, 2] 23031 */ 23032 function flatMap(collection, iteratee) { 23033 return baseFlatten(map(collection, iteratee), 1); 23034 } 23035 23036 /** 23037 * This method is like `_.flatMap` except that it recursively flattens the 23038 * mapped results. 23039 * 23040 * @static 23041 * @memberOf _ 23042 * @since 4.7.0 23043 * @category Collection 23044 * @param {Array|Object} collection The collection to iterate over. 23045 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 23046 * @returns {Array} Returns the new flattened array. 23047 * @example 23048 * 23049 * function duplicate(n) { 23050 * return [[[n, n]]]; 23051 * } 23052 * 23053 * _.flatMapDeep([1, 2], duplicate); 23054 * // => [1, 1, 2, 2] 23055 */ 23056 function flatMapDeep(collection, iteratee) { 23057 return baseFlatten(map(collection, iteratee), INFINITY); 23058 } 23059 23060 /** 23061 * This method is like `_.flatMap` except that it recursively flattens the 23062 * mapped results up to `depth` times. 23063 * 23064 * @static 23065 * @memberOf _ 23066 * @since 4.7.0 23067 * @category Collection 23068 * @param {Array|Object} collection The collection to iterate over. 23069 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 23070 * @param {number} [depth=1] The maximum recursion depth. 23071 * @returns {Array} Returns the new flattened array. 23072 * @example 23073 * 23074 * function duplicate(n) { 23075 * return [[[n, n]]]; 23076 * } 23077 * 23078 * _.flatMapDepth([1, 2], duplicate, 2); 23079 * // => [[1, 1], [2, 2]] 23080 */ 23081 function flatMapDepth(collection, iteratee, depth) { 23082 depth = depth === undefined ? 1 : toInteger(depth); 23083 return baseFlatten(map(collection, iteratee), depth); 23084 } 23085 23086 /** 23087 * Iterates over elements of `collection` and invokes `iteratee` for each element. 23088 * The iteratee is invoked with three arguments: (value, index|key, collection). 23089 * Iteratee functions may exit iteration early by explicitly returning `false`. 23090 * 23091 * **Note:** As with other "Collections" methods, objects with a "length" 23092 * property are iterated like arrays. To avoid this behavior use `_.forIn` 23093 * or `_.forOwn` for object iteration. 23094 * 23095 * @static 23096 * @memberOf _ 23097 * @since 0.1.0 23098 * @alias each 23099 * @category Collection 23100 * @param {Array|Object} collection The collection to iterate over. 23101 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 23102 * @returns {Array|Object} Returns `collection`. 23103 * @see _.forEachRight 23104 * @example 23105 * 23106 * _.forEach([1, 2], function(value) { 23107 * console.log(value); 23108 * }); 23109 * // => Logs `1` then `2`. 23110 * 23111 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { 23112 * console.log(key); 23113 * }); 23114 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 23115 */ 23116 function forEach(collection, iteratee) { 23117 var func = isArray(collection) ? arrayEach : baseEach; 23118 return func(collection, getIteratee(iteratee, 3)); 23119 } 23120 23121 /** 23122 * This method is like `_.forEach` except that it iterates over elements of 23123 * `collection` from right to left. 23124 * 23125 * @static 23126 * @memberOf _ 23127 * @since 2.0.0 23128 * @alias eachRight 23129 * @category Collection 23130 * @param {Array|Object} collection The collection to iterate over. 23131 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 23132 * @returns {Array|Object} Returns `collection`. 23133 * @see _.forEach 23134 * @example 23135 * 23136 * _.forEachRight([1, 2], function(value) { 23137 * console.log(value); 23138 * }); 23139 * // => Logs `2` then `1`. 23140 */ 23141 function forEachRight(collection, iteratee) { 23142 var func = isArray(collection) ? arrayEachRight : baseEachRight; 23143 return func(collection, getIteratee(iteratee, 3)); 23144 } 23145 23146 /** 23147 * Creates an object composed of keys generated from the results of running 23148 * each element of `collection` thru `iteratee`. The order of grouped values 23149 * is determined by the order they occur in `collection`. The corresponding 23150 * value of each key is an array of elements responsible for generating the 23151 * key. The iteratee is invoked with one argument: (value). 23152 * 23153 * @static 23154 * @memberOf _ 23155 * @since 0.1.0 23156 * @category Collection 23157 * @param {Array|Object} collection The collection to iterate over. 23158 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 23159 * @returns {Object} Returns the composed aggregate object. 23160 * @example 23161 * 23162 * _.groupBy([6.1, 4.2, 6.3], Math.floor); 23163 * // => { '4': [4.2], '6': [6.1, 6.3] } 23164 * 23165 * // The `_.property` iteratee shorthand. 23166 * _.groupBy(['one', 'two', 'three'], 'length'); 23167 * // => { '3': ['one', 'two'], '5': ['three'] } 23168 */ 23169 var groupBy = createAggregator(function(result, value, key) { 23170 if (hasOwnProperty.call(result, key)) { 23171 result[key].push(value); 23172 } else { 23173 baseAssignValue(result, key, [value]); 23174 } 23175 }); 23176 23177 /** 23178 * Checks if `value` is in `collection`. If `collection` is a string, it's 23179 * checked for a substring of `value`, otherwise 23180 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 23181 * is used for equality comparisons. If `fromIndex` is negative, it's used as 23182 * the offset from the end of `collection`. 23183 * 23184 * @static 23185 * @memberOf _ 23186 * @since 0.1.0 23187 * @category Collection 23188 * @param {Array|Object|string} collection The collection to inspect. 23189 * @param {*} value The value to search for. 23190 * @param {number} [fromIndex=0] The index to search from. 23191 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 23192 * @returns {boolean} Returns `true` if `value` is found, else `false`. 23193 * @example 23194 * 23195 * _.includes([1, 2, 3], 1); 23196 * // => true 23197 * 23198 * _.includes([1, 2, 3], 1, 2); 23199 * // => false 23200 * 23201 * _.includes({ 'a': 1, 'b': 2 }, 1); 23202 * // => true 23203 * 23204 * _.includes('abcd', 'bc'); 23205 * // => true 23206 */ 23207 function includes(collection, value, fromIndex, guard) { 23208 collection = isArrayLike(collection) ? collection : values(collection); 23209 fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; 23210 23211 var length = collection.length; 23212 if (fromIndex < 0) { 23213 fromIndex = nativeMax(length + fromIndex, 0); 23214 } 23215 return isString(collection) 23216 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) 23217 : (!!length && baseIndexOf(collection, value, fromIndex) > -1); 23218 } 23219 23220 /** 23221 * Invokes the method at `path` of each element in `collection`, returning 23222 * an array of the results of each invoked method. Any additional arguments 23223 * are provided to each invoked method. If `path` is a function, it's invoked 23224 * for, and `this` bound to, each element in `collection`. 23225 * 23226 * @static 23227 * @memberOf _ 23228 * @since 4.0.0 23229 * @category Collection 23230 * @param {Array|Object} collection The collection to iterate over. 23231 * @param {Array|Function|string} path The path of the method to invoke or 23232 * the function invoked per iteration. 23233 * @param {...*} [args] The arguments to invoke each method with. 23234 * @returns {Array} Returns the array of results. 23235 * @example 23236 * 23237 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); 23238 * // => [[1, 5, 7], [1, 2, 3]] 23239 * 23240 * _.invokeMap([123, 456], String.prototype.split, ''); 23241 * // => [['1', '2', '3'], ['4', '5', '6']] 23242 */ 23243 var invokeMap = baseRest(function(collection, path, args) { 23244 var index = -1, 23245 isFunc = typeof path == 'function', 23246 result = isArrayLike(collection) ? Array(collection.length) : []; 23247 23248 baseEach(collection, function(value) { 23249 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 23250 }); 23251 return result; 23252 }); 23253 23254 /** 23255 * Creates an object composed of keys generated from the results of running 23256 * each element of `collection` thru `iteratee`. The corresponding value of 23257 * each key is the last element responsible for generating the key. The 23258 * iteratee is invoked with one argument: (value). 23259 * 23260 * @static 23261 * @memberOf _ 23262 * @since 4.0.0 23263 * @category Collection 23264 * @param {Array|Object} collection The collection to iterate over. 23265 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 23266 * @returns {Object} Returns the composed aggregate object. 23267 * @example 23268 * 23269 * var array = [ 23270 * { 'dir': 'left', 'code': 97 }, 23271 * { 'dir': 'right', 'code': 100 } 23272 * ]; 23273 * 23274 * _.keyBy(array, function(o) { 23275 * return String.fromCharCode(o.code); 23276 * }); 23277 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } 23278 * 23279 * _.keyBy(array, 'dir'); 23280 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } 23281 */ 23282 var keyBy = createAggregator(function(result, value, key) { 23283 baseAssignValue(result, key, value); 23284 }); 23285 23286 /** 23287 * Creates an array of values by running each element in `collection` thru 23288 * `iteratee`. The iteratee is invoked with three arguments: 23289 * (value, index|key, collection). 23290 * 23291 * Many lodash methods are guarded to work as iteratees for methods like 23292 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. 23293 * 23294 * The guarded methods are: 23295 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, 23296 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, 23297 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, 23298 * `template`, `trim`, `trimEnd`, `trimStart`, and `words` 23299 * 23300 * @static 23301 * @memberOf _ 23302 * @since 0.1.0 23303 * @category Collection 23304 * @param {Array|Object} collection The collection to iterate over. 23305 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 23306 * @returns {Array} Returns the new mapped array. 23307 * @example 23308 * 23309 * function square(n) { 23310 * return n * n; 23311 * } 23312 * 23313 * _.map([4, 8], square); 23314 * // => [16, 64] 23315 * 23316 * _.map({ 'a': 4, 'b': 8 }, square); 23317 * // => [16, 64] (iteration order is not guaranteed) 23318 * 23319 * var users = [ 23320 * { 'user': 'barney' }, 23321 * { 'user': 'fred' } 23322 * ]; 23323 * 23324 * // The `_.property` iteratee shorthand. 23325 * _.map(users, 'user'); 23326 * // => ['barney', 'fred'] 23327 */ 23328 function map(collection, iteratee) { 23329 var func = isArray(collection) ? arrayMap : baseMap; 23330 return func(collection, getIteratee(iteratee, 3)); 23331 } 23332 23333 /** 23334 * This method is like `_.sortBy` except that it allows specifying the sort 23335 * orders of the iteratees to sort by. If `orders` is unspecified, all values 23336 * are sorted in ascending order. Otherwise, specify an order of "desc" for 23337 * descending or "asc" for ascending sort order of corresponding values. 23338 * 23339 * @static 23340 * @memberOf _ 23341 * @since 4.0.0 23342 * @category Collection 23343 * @param {Array|Object} collection The collection to iterate over. 23344 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] 23345 * The iteratees to sort by. 23346 * @param {string[]} [orders] The sort orders of `iteratees`. 23347 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 23348 * @returns {Array} Returns the new sorted array. 23349 * @example 23350 * 23351 * var users = [ 23352 * { 'user': 'fred', 'age': 48 }, 23353 * { 'user': 'barney', 'age': 34 }, 23354 * { 'user': 'fred', 'age': 40 }, 23355 * { 'user': 'barney', 'age': 36 } 23356 * ]; 23357 * 23358 * // Sort by `user` in ascending order and by `age` in descending order. 23359 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); 23360 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 23361 */ 23362 function orderBy(collection, iteratees, orders, guard) { 23363 if (collection == null) { 23364 return []; 23365 } 23366 if (!isArray(iteratees)) { 23367 iteratees = iteratees == null ? [] : [iteratees]; 23368 } 23369 orders = guard ? undefined : orders; 23370 if (!isArray(orders)) { 23371 orders = orders == null ? [] : [orders]; 23372 } 23373 return baseOrderBy(collection, iteratees, orders); 23374 } 23375 23376 /** 23377 * Creates an array of elements split into two groups, the first of which 23378 * contains elements `predicate` returns truthy for, the second of which 23379 * contains elements `predicate` returns falsey for. The predicate is 23380 * invoked with one argument: (value). 23381 * 23382 * @static 23383 * @memberOf _ 23384 * @since 3.0.0 23385 * @category Collection 23386 * @param {Array|Object} collection The collection to iterate over. 23387 * @param {Function} [predicate=_.identity] The function invoked per iteration. 23388 * @returns {Array} Returns the array of grouped elements. 23389 * @example 23390 * 23391 * var users = [ 23392 * { 'user': 'barney', 'age': 36, 'active': false }, 23393 * { 'user': 'fred', 'age': 40, 'active': true }, 23394 * { 'user': 'pebbles', 'age': 1, 'active': false } 23395 * ]; 23396 * 23397 * _.partition(users, function(o) { return o.active; }); 23398 * // => objects for [['fred'], ['barney', 'pebbles']] 23399 * 23400 * // The `_.matches` iteratee shorthand. 23401 * _.partition(users, { 'age': 1, 'active': false }); 23402 * // => objects for [['pebbles'], ['barney', 'fred']] 23403 * 23404 * // The `_.matchesProperty` iteratee shorthand. 23405 * _.partition(users, ['active', false]); 23406 * // => objects for [['barney', 'pebbles'], ['fred']] 23407 * 23408 * // The `_.property` iteratee shorthand. 23409 * _.partition(users, 'active'); 23410 * // => objects for [['fred'], ['barney', 'pebbles']] 23411 */ 23412 var partition = createAggregator(function(result, value, key) { 23413 result[key ? 0 : 1].push(value); 23414 }, function() { return [[], []]; }); 23415 23416 /** 23417 * Reduces `collection` to a value which is the accumulated result of running 23418 * each element in `collection` thru `iteratee`, where each successive 23419 * invocation is supplied the return value of the previous. If `accumulator` 23420 * is not given, the first element of `collection` is used as the initial 23421 * value. The iteratee is invoked with four arguments: 23422 * (accumulator, value, index|key, collection). 23423 * 23424 * Many lodash methods are guarded to work as iteratees for methods like 23425 * `_.reduce`, `_.reduceRight`, and `_.transform`. 23426 * 23427 * The guarded methods are: 23428 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, 23429 * and `sortBy` 23430 * 23431 * @static 23432 * @memberOf _ 23433 * @since 0.1.0 23434 * @category Collection 23435 * @param {Array|Object} collection The collection to iterate over. 23436 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 23437 * @param {*} [accumulator] The initial value. 23438 * @returns {*} Returns the accumulated value. 23439 * @see _.reduceRight 23440 * @example 23441 * 23442 * _.reduce([1, 2], function(sum, n) { 23443 * return sum + n; 23444 * }, 0); 23445 * // => 3 23446 * 23447 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 23448 * (result[value] || (result[value] = [])).push(key); 23449 * return result; 23450 * }, {}); 23451 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) 23452 */ 23453 function reduce(collection, iteratee, accumulator) { 23454 var func = isArray(collection) ? arrayReduce : baseReduce, 23455 initAccum = arguments.length < 3; 23456 23457 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); 23458 } 23459 23460 /** 23461 * This method is like `_.reduce` except that it iterates over elements of 23462 * `collection` from right to left. 23463 * 23464 * @static 23465 * @memberOf _ 23466 * @since 0.1.0 23467 * @category Collection 23468 * @param {Array|Object} collection The collection to iterate over. 23469 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 23470 * @param {*} [accumulator] The initial value. 23471 * @returns {*} Returns the accumulated value. 23472 * @see _.reduce 23473 * @example 23474 * 23475 * var array = [[0, 1], [2, 3], [4, 5]]; 23476 * 23477 * _.reduceRight(array, function(flattened, other) { 23478 * return flattened.concat(other); 23479 * }, []); 23480 * // => [4, 5, 2, 3, 0, 1] 23481 */ 23482 function reduceRight(collection, iteratee, accumulator) { 23483 var func = isArray(collection) ? arrayReduceRight : baseReduce, 23484 initAccum = arguments.length < 3; 23485 23486 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); 23487 } 23488 23489 /** 23490 * The opposite of `_.filter`; this method returns the elements of `collection` 23491 * that `predicate` does **not** return truthy for. 23492 * 23493 * @static 23494 * @memberOf _ 23495 * @since 0.1.0 23496 * @category Collection 23497 * @param {Array|Object} collection The collection to iterate over. 23498 * @param {Function} [predicate=_.identity] The function invoked per iteration. 23499 * @returns {Array} Returns the new filtered array. 23500 * @see _.filter 23501 * @example 23502 * 23503 * var users = [ 23504 * { 'user': 'barney', 'age': 36, 'active': false }, 23505 * { 'user': 'fred', 'age': 40, 'active': true } 23506 * ]; 23507 * 23508 * _.reject(users, function(o) { return !o.active; }); 23509 * // => objects for ['fred'] 23510 * 23511 * // The `_.matches` iteratee shorthand. 23512 * _.reject(users, { 'age': 40, 'active': true }); 23513 * // => objects for ['barney'] 23514 * 23515 * // The `_.matchesProperty` iteratee shorthand. 23516 * _.reject(users, ['active', false]); 23517 * // => objects for ['fred'] 23518 * 23519 * // The `_.property` iteratee shorthand. 23520 * _.reject(users, 'active'); 23521 * // => objects for ['barney'] 23522 */ 23523 function reject(collection, predicate) { 23524 var func = isArray(collection) ? arrayFilter : baseFilter; 23525 return func(collection, negate(getIteratee(predicate, 3))); 23526 } 23527 23528 /** 23529 * Gets a random element from `collection`. 23530 * 23531 * @static 23532 * @memberOf _ 23533 * @since 2.0.0 23534 * @category Collection 23535 * @param {Array|Object} collection The collection to sample. 23536 * @returns {*} Returns the random element. 23537 * @example 23538 * 23539 * _.sample([1, 2, 3, 4]); 23540 * // => 2 23541 */ 23542 function sample(collection) { 23543 var func = isArray(collection) ? arraySample : baseSample; 23544 return func(collection); 23545 } 23546 23547 /** 23548 * Gets `n` random elements at unique keys from `collection` up to the 23549 * size of `collection`. 23550 * 23551 * @static 23552 * @memberOf _ 23553 * @since 4.0.0 23554 * @category Collection 23555 * @param {Array|Object} collection The collection to sample. 23556 * @param {number} [n=1] The number of elements to sample. 23557 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23558 * @returns {Array} Returns the random elements. 23559 * @example 23560 * 23561 * _.sampleSize([1, 2, 3], 2); 23562 * // => [3, 1] 23563 * 23564 * _.sampleSize([1, 2, 3], 4); 23565 * // => [2, 3, 1] 23566 */ 23567 function sampleSize(collection, n, guard) { 23568 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { 23569 n = 1; 23570 } else { 23571 n = toInteger(n); 23572 } 23573 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 23574 return func(collection, n); 23575 } 23576 23577 /** 23578 * Creates an array of shuffled values, using a version of the 23579 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 23580 * 23581 * @static 23582 * @memberOf _ 23583 * @since 0.1.0 23584 * @category Collection 23585 * @param {Array|Object} collection The collection to shuffle. 23586 * @returns {Array} Returns the new shuffled array. 23587 * @example 23588 * 23589 * _.shuffle([1, 2, 3, 4]); 23590 * // => [4, 1, 3, 2] 23591 */ 23592 function shuffle(collection) { 23593 var func = isArray(collection) ? arrayShuffle : baseShuffle; 23594 return func(collection); 23595 } 23596 23597 /** 23598 * Gets the size of `collection` by returning its length for array-like 23599 * values or the number of own enumerable string keyed properties for objects. 23600 * 23601 * @static 23602 * @memberOf _ 23603 * @since 0.1.0 23604 * @category Collection 23605 * @param {Array|Object|string} collection The collection to inspect. 23606 * @returns {number} Returns the collection size. 23607 * @example 23608 * 23609 * _.size([1, 2, 3]); 23610 * // => 3 23611 * 23612 * _.size({ 'a': 1, 'b': 2 }); 23613 * // => 2 23614 * 23615 * _.size('pebbles'); 23616 * // => 7 23617 */ 23618 function size(collection) { 23619 if (collection == null) { 23620 return 0; 23621 } 23622 if (isArrayLike(collection)) { 23623 return isString(collection) ? stringSize(collection) : collection.length; 23624 } 23625 var tag = getTag(collection); 23626 if (tag == mapTag || tag == setTag) { 23627 return collection.size; 23628 } 23629 return baseKeys(collection).length; 23630 } 23631 23632 /** 23633 * Checks if `predicate` returns truthy for **any** element of `collection`. 23634 * Iteration is stopped once `predicate` returns truthy. The predicate is 23635 * invoked with three arguments: (value, index|key, collection). 23636 * 23637 * @static 23638 * @memberOf _ 23639 * @since 0.1.0 23640 * @category Collection 23641 * @param {Array|Object} collection The collection to iterate over. 23642 * @param {Function} [predicate=_.identity] The function invoked per iteration. 23643 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23644 * @returns {boolean} Returns `true` if any element passes the predicate check, 23645 * else `false`. 23646 * @example 23647 * 23648 * _.some([null, 0, 'yes', false], Boolean); 23649 * // => true 23650 * 23651 * var users = [ 23652 * { 'user': 'barney', 'active': true }, 23653 * { 'user': 'fred', 'active': false } 23654 * ]; 23655 * 23656 * // The `_.matches` iteratee shorthand. 23657 * _.some(users, { 'user': 'barney', 'active': false }); 23658 * // => false 23659 * 23660 * // The `_.matchesProperty` iteratee shorthand. 23661 * _.some(users, ['active', false]); 23662 * // => true 23663 * 23664 * // The `_.property` iteratee shorthand. 23665 * _.some(users, 'active'); 23666 * // => true 23667 */ 23668 function some(collection, predicate, guard) { 23669 var func = isArray(collection) ? arraySome : baseSome; 23670 if (guard && isIterateeCall(collection, predicate, guard)) { 23671 predicate = undefined; 23672 } 23673 return func(collection, getIteratee(predicate, 3)); 23674 } 23675 23676 /** 23677 * Creates an array of elements, sorted in ascending order by the results of 23678 * running each element in a collection thru each iteratee. This method 23679 * performs a stable sort, that is, it preserves the original sort order of 23680 * equal elements. The iteratees are invoked with one argument: (value). 23681 * 23682 * @static 23683 * @memberOf _ 23684 * @since 0.1.0 23685 * @category Collection 23686 * @param {Array|Object} collection The collection to iterate over. 23687 * @param {...(Function|Function[])} [iteratees=[_.identity]] 23688 * The iteratees to sort by. 23689 * @returns {Array} Returns the new sorted array. 23690 * @example 23691 * 23692 * var users = [ 23693 * { 'user': 'fred', 'age': 48 }, 23694 * { 'user': 'barney', 'age': 36 }, 23695 * { 'user': 'fred', 'age': 30 }, 23696 * { 'user': 'barney', 'age': 34 } 23697 * ]; 23698 * 23699 * _.sortBy(users, [function(o) { return o.user; }]); 23700 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] 23701 * 23702 * _.sortBy(users, ['user', 'age']); 23703 * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] 23704 */ 23705 var sortBy = baseRest(function(collection, iteratees) { 23706 if (collection == null) { 23707 return []; 23708 } 23709 var length = iteratees.length; 23710 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 23711 iteratees = []; 23712 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 23713 iteratees = [iteratees[0]]; 23714 } 23715 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 23716 }); 23717 23718 /*------------------------------------------------------------------------*/ 23719 23720 /** 23721 * Gets the timestamp of the number of milliseconds that have elapsed since 23722 * the Unix epoch (1 January 1970 00:00:00 UTC). 23723 * 23724 * @static 23725 * @memberOf _ 23726 * @since 2.4.0 23727 * @category Date 23728 * @returns {number} Returns the timestamp. 23729 * @example 23730 * 23731 * _.defer(function(stamp) { 23732 * console.log(_.now() - stamp); 23733 * }, _.now()); 23734 * // => Logs the number of milliseconds it took for the deferred invocation. 23735 */ 23736 var now = ctxNow || function() { 23737 return root.Date.now(); 23738 }; 23739 23740 /*------------------------------------------------------------------------*/ 23741 23742 /** 23743 * The opposite of `_.before`; this method creates a function that invokes 23744 * `func` once it's called `n` or more times. 23745 * 23746 * @static 23747 * @memberOf _ 23748 * @since 0.1.0 23749 * @category Function 23750 * @param {number} n The number of calls before `func` is invoked. 23751 * @param {Function} func The function to restrict. 23752 * @returns {Function} Returns the new restricted function. 23753 * @example 23754 * 23755 * var saves = ['profile', 'settings']; 23756 * 23757 * var done = _.after(saves.length, function() { 23758 * console.log('done saving!'); 23759 * }); 23760 * 23761 * _.forEach(saves, function(type) { 23762 * asyncSave({ 'type': type, 'complete': done }); 23763 * }); 23764 * // => Logs 'done saving!' after the two async saves have completed. 23765 */ 23766 function after(n, func) { 23767 if (typeof func != 'function') { 23768 throw new TypeError(FUNC_ERROR_TEXT); 23769 } 23770 n = toInteger(n); 23771 return function() { 23772 if (--n < 1) { 23773 return func.apply(this, arguments); 23774 } 23775 }; 23776 } 23777 23778 /** 23779 * Creates a function that invokes `func`, with up to `n` arguments, 23780 * ignoring any additional arguments. 23781 * 23782 * @static 23783 * @memberOf _ 23784 * @since 3.0.0 23785 * @category Function 23786 * @param {Function} func The function to cap arguments for. 23787 * @param {number} [n=func.length] The arity cap. 23788 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23789 * @returns {Function} Returns the new capped function. 23790 * @example 23791 * 23792 * _.map(['6', '8', '10'], _.ary(parseInt, 1)); 23793 * // => [6, 8, 10] 23794 */ 23795 function ary(func, n, guard) { 23796 n = guard ? undefined : n; 23797 n = (func && n == null) ? func.length : n; 23798 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); 23799 } 23800 23801 /** 23802 * Creates a function that invokes `func`, with the `this` binding and arguments 23803 * of the created function, while it's called less than `n` times. Subsequent 23804 * calls to the created function return the result of the last `func` invocation. 23805 * 23806 * @static 23807 * @memberOf _ 23808 * @since 3.0.0 23809 * @category Function 23810 * @param {number} n The number of calls at which `func` is no longer invoked. 23811 * @param {Function} func The function to restrict. 23812 * @returns {Function} Returns the new restricted function. 23813 * @example 23814 * 23815 * jQuery(element).on('click', _.before(5, addContactToList)); 23816 * // => Allows adding up to 4 contacts to the list. 23817 */ 23818 function before(n, func) { 23819 var result; 23820 if (typeof func != 'function') { 23821 throw new TypeError(FUNC_ERROR_TEXT); 23822 } 23823 n = toInteger(n); 23824 return function() { 23825 if (--n > 0) { 23826 result = func.apply(this, arguments); 23827 } 23828 if (n <= 1) { 23829 func = undefined; 23830 } 23831 return result; 23832 }; 23833 } 23834 23835 /** 23836 * Creates a function that invokes `func` with the `this` binding of `thisArg` 23837 * and `partials` prepended to the arguments it receives. 23838 * 23839 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, 23840 * may be used as a placeholder for partially applied arguments. 23841 * 23842 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" 23843 * property of bound functions. 23844 * 23845 * @static 23846 * @memberOf _ 23847 * @since 0.1.0 23848 * @category Function 23849 * @param {Function} func The function to bind. 23850 * @param {*} thisArg The `this` binding of `func`. 23851 * @param {...*} [partials] The arguments to be partially applied. 23852 * @returns {Function} Returns the new bound function. 23853 * @example 23854 * 23855 * function greet(greeting, punctuation) { 23856 * return greeting + ' ' + this.user + punctuation; 23857 * } 23858 * 23859 * var object = { 'user': 'fred' }; 23860 * 23861 * var bound = _.bind(greet, object, 'hi'); 23862 * bound('!'); 23863 * // => 'hi fred!' 23864 * 23865 * // Bound with placeholders. 23866 * var bound = _.bind(greet, object, _, '!'); 23867 * bound('hi'); 23868 * // => 'hi fred!' 23869 */ 23870 var bind = baseRest(function(func, thisArg, partials) { 23871 var bitmask = WRAP_BIND_FLAG; 23872 if (partials.length) { 23873 var holders = replaceHolders(partials, getHolder(bind)); 23874 bitmask |= WRAP_PARTIAL_FLAG; 23875 } 23876 return createWrap(func, bitmask, thisArg, partials, holders); 23877 }); 23878 23879 /** 23880 * Creates a function that invokes the method at `object[key]` with `partials` 23881 * prepended to the arguments it receives. 23882 * 23883 * This method differs from `_.bind` by allowing bound functions to reference 23884 * methods that may be redefined or don't yet exist. See 23885 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) 23886 * for more details. 23887 * 23888 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic 23889 * builds, may be used as a placeholder for partially applied arguments. 23890 * 23891 * @static 23892 * @memberOf _ 23893 * @since 0.10.0 23894 * @category Function 23895 * @param {Object} object The object to invoke the method on. 23896 * @param {string} key The key of the method. 23897 * @param {...*} [partials] The arguments to be partially applied. 23898 * @returns {Function} Returns the new bound function. 23899 * @example 23900 * 23901 * var object = { 23902 * 'user': 'fred', 23903 * 'greet': function(greeting, punctuation) { 23904 * return greeting + ' ' + this.user + punctuation; 23905 * } 23906 * }; 23907 * 23908 * var bound = _.bindKey(object, 'greet', 'hi'); 23909 * bound('!'); 23910 * // => 'hi fred!' 23911 * 23912 * object.greet = function(greeting, punctuation) { 23913 * return greeting + 'ya ' + this.user + punctuation; 23914 * }; 23915 * 23916 * bound('!'); 23917 * // => 'hiya fred!' 23918 * 23919 * // Bound with placeholders. 23920 * var bound = _.bindKey(object, 'greet', _, '!'); 23921 * bound('hi'); 23922 * // => 'hiya fred!' 23923 */ 23924 var bindKey = baseRest(function(object, key, partials) { 23925 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; 23926 if (partials.length) { 23927 var holders = replaceHolders(partials, getHolder(bindKey)); 23928 bitmask |= WRAP_PARTIAL_FLAG; 23929 } 23930 return createWrap(key, bitmask, object, partials, holders); 23931 }); 23932 23933 /** 23934 * Creates a function that accepts arguments of `func` and either invokes 23935 * `func` returning its result, if at least `arity` number of arguments have 23936 * been provided, or returns a function that accepts the remaining `func` 23937 * arguments, and so on. The arity of `func` may be specified if `func.length` 23938 * is not sufficient. 23939 * 23940 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, 23941 * may be used as a placeholder for provided arguments. 23942 * 23943 * **Note:** This method doesn't set the "length" property of curried functions. 23944 * 23945 * @static 23946 * @memberOf _ 23947 * @since 2.0.0 23948 * @category Function 23949 * @param {Function} func The function to curry. 23950 * @param {number} [arity=func.length] The arity of `func`. 23951 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23952 * @returns {Function} Returns the new curried function. 23953 * @example 23954 * 23955 * var abc = function(a, b, c) { 23956 * return [a, b, c]; 23957 * }; 23958 * 23959 * var curried = _.curry(abc); 23960 * 23961 * curried(1)(2)(3); 23962 * // => [1, 2, 3] 23963 * 23964 * curried(1, 2)(3); 23965 * // => [1, 2, 3] 23966 * 23967 * curried(1, 2, 3); 23968 * // => [1, 2, 3] 23969 * 23970 * // Curried with placeholders. 23971 * curried(1)(_, 3)(2); 23972 * // => [1, 2, 3] 23973 */ 23974 function curry(func, arity, guard) { 23975 arity = guard ? undefined : arity; 23976 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 23977 result.placeholder = curry.placeholder; 23978 return result; 23979 } 23980 23981 /** 23982 * This method is like `_.curry` except that arguments are applied to `func` 23983 * in the manner of `_.partialRight` instead of `_.partial`. 23984 * 23985 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic 23986 * builds, may be used as a placeholder for provided arguments. 23987 * 23988 * **Note:** This method doesn't set the "length" property of curried functions. 23989 * 23990 * @static 23991 * @memberOf _ 23992 * @since 3.0.0 23993 * @category Function 23994 * @param {Function} func The function to curry. 23995 * @param {number} [arity=func.length] The arity of `func`. 23996 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23997 * @returns {Function} Returns the new curried function. 23998 * @example 23999 * 24000 * var abc = function(a, b, c) { 24001 * return [a, b, c]; 24002 * }; 24003 * 24004 * var curried = _.curryRight(abc); 24005 * 24006 * curried(3)(2)(1); 24007 * // => [1, 2, 3] 24008 * 24009 * curried(2, 3)(1); 24010 * // => [1, 2, 3] 24011 * 24012 * curried(1, 2, 3); 24013 * // => [1, 2, 3] 24014 * 24015 * // Curried with placeholders. 24016 * curried(3)(1, _)(2); 24017 * // => [1, 2, 3] 24018 */ 24019 function curryRight(func, arity, guard) { 24020 arity = guard ? undefined : arity; 24021 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 24022 result.placeholder = curryRight.placeholder; 24023 return result; 24024 } 24025 24026 /** 24027 * Creates a debounced function that delays invoking `func` until after `wait` 24028 * milliseconds have elapsed since the last time the debounced function was 24029 * invoked. The debounced function comes with a `cancel` method to cancel 24030 * delayed `func` invocations and a `flush` method to immediately invoke them. 24031 * Provide `options` to indicate whether `func` should be invoked on the 24032 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 24033 * with the last arguments provided to the debounced function. Subsequent 24034 * calls to the debounced function return the result of the last `func` 24035 * invocation. 24036 * 24037 * **Note:** If `leading` and `trailing` options are `true`, `func` is 24038 * invoked on the trailing edge of the timeout only if the debounced function 24039 * is invoked more than once during the `wait` timeout. 24040 * 24041 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 24042 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 24043 * 24044 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 24045 * for details over the differences between `_.debounce` and `_.throttle`. 24046 * 24047 * @static 24048 * @memberOf _ 24049 * @since 0.1.0 24050 * @category Function 24051 * @param {Function} func The function to debounce. 24052 * @param {number} [wait=0] The number of milliseconds to delay. 24053 * @param {Object} [options={}] The options object. 24054 * @param {boolean} [options.leading=false] 24055 * Specify invoking on the leading edge of the timeout. 24056 * @param {number} [options.maxWait] 24057 * The maximum time `func` is allowed to be delayed before it's invoked. 24058 * @param {boolean} [options.trailing=true] 24059 * Specify invoking on the trailing edge of the timeout. 24060 * @returns {Function} Returns the new debounced function. 24061 * @example 24062 * 24063 * // Avoid costly calculations while the window size is in flux. 24064 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 24065 * 24066 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 24067 * jQuery(element).on('click', _.debounce(sendMail, 300, { 24068 * 'leading': true, 24069 * 'trailing': false 24070 * })); 24071 * 24072 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 24073 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 24074 * var source = new EventSource('/stream'); 24075 * jQuery(source).on('message', debounced); 24076 * 24077 * // Cancel the trailing debounced invocation. 24078 * jQuery(window).on('popstate', debounced.cancel); 24079 */ 24080 function debounce(func, wait, options) { 24081 var lastArgs, 24082 lastThis, 24083 maxWait, 24084 result, 24085 timerId, 24086 lastCallTime, 24087 lastInvokeTime = 0, 24088 leading = false, 24089 maxing = false, 24090 trailing = true; 24091 24092 if (typeof func != 'function') { 24093 throw new TypeError(FUNC_ERROR_TEXT); 24094 } 24095 wait = toNumber(wait) || 0; 24096 if (isObject(options)) { 24097 leading = !!options.leading; 24098 maxing = 'maxWait' in options; 24099 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 24100 trailing = 'trailing' in options ? !!options.trailing : trailing; 24101 } 24102 24103 function invokeFunc(time) { 24104 var args = lastArgs, 24105 thisArg = lastThis; 24106 24107 lastArgs = lastThis = undefined; 24108 lastInvokeTime = time; 24109 result = func.apply(thisArg, args); 24110 return result; 24111 } 24112 24113 function leadingEdge(time) { 24114 // Reset any `maxWait` timer. 24115 lastInvokeTime = time; 24116 // Start the timer for the trailing edge. 24117 timerId = setTimeout(timerExpired, wait); 24118 // Invoke the leading edge. 24119 return leading ? invokeFunc(time) : result; 24120 } 24121 24122 function remainingWait(time) { 24123 var timeSinceLastCall = time - lastCallTime, 24124 timeSinceLastInvoke = time - lastInvokeTime, 24125 timeWaiting = wait - timeSinceLastCall; 24126 24127 return maxing 24128 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) 24129 : timeWaiting; 24130 } 24131 24132 function shouldInvoke(time) { 24133 var timeSinceLastCall = time - lastCallTime, 24134 timeSinceLastInvoke = time - lastInvokeTime; 24135 24136 // Either this is the first call, activity has stopped and we're at the 24137 // trailing edge, the system time has gone backwards and we're treating 24138 // it as the trailing edge, or we've hit the `maxWait` limit. 24139 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 24140 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 24141 } 24142 24143 function timerExpired() { 24144 var time = now(); 24145 if (shouldInvoke(time)) { 24146 return trailingEdge(time); 24147 } 24148 // Restart the timer. 24149 timerId = setTimeout(timerExpired, remainingWait(time)); 24150 } 24151 24152 function trailingEdge(time) { 24153 timerId = undefined; 24154 24155 // Only invoke if we have `lastArgs` which means `func` has been 24156 // debounced at least once. 24157 if (trailing && lastArgs) { 24158 return invokeFunc(time); 24159 } 24160 lastArgs = lastThis = undefined; 24161 return result; 24162 } 24163 24164 function cancel() { 24165 if (timerId !== undefined) { 24166 clearTimeout(timerId); 24167 } 24168 lastInvokeTime = 0; 24169 lastArgs = lastCallTime = lastThis = timerId = undefined; 24170 } 24171 24172 function flush() { 24173 return timerId === undefined ? result : trailingEdge(now()); 24174 } 24175 24176 function debounced() { 24177 var time = now(), 24178 isInvoking = shouldInvoke(time); 24179 24180 lastArgs = arguments; 24181 lastThis = this; 24182 lastCallTime = time; 24183 24184 if (isInvoking) { 24185 if (timerId === undefined) { 24186 return leadingEdge(lastCallTime); 24187 } 24188 if (maxing) { 24189 // Handle invocations in a tight loop. 24190 clearTimeout(timerId); 24191 timerId = setTimeout(timerExpired, wait); 24192 return invokeFunc(lastCallTime); 24193 } 24194 } 24195 if (timerId === undefined) { 24196 timerId = setTimeout(timerExpired, wait); 24197 } 24198 return result; 24199 } 24200 debounced.cancel = cancel; 24201 debounced.flush = flush; 24202 return debounced; 24203 } 24204 24205 /** 24206 * Defers invoking the `func` until the current call stack has cleared. Any 24207 * additional arguments are provided to `func` when it's invoked. 24208 * 24209 * @static 24210 * @memberOf _ 24211 * @since 0.1.0 24212 * @category Function 24213 * @param {Function} func The function to defer. 24214 * @param {...*} [args] The arguments to invoke `func` with. 24215 * @returns {number} Returns the timer id. 24216 * @example 24217 * 24218 * _.defer(function(text) { 24219 * console.log(text); 24220 * }, 'deferred'); 24221 * // => Logs 'deferred' after one millisecond. 24222 */ 24223 var defer = baseRest(function(func, args) { 24224 return baseDelay(func, 1, args); 24225 }); 24226 24227 /** 24228 * Invokes `func` after `wait` milliseconds. Any additional arguments are 24229 * provided to `func` when it's invoked. 24230 * 24231 * @static 24232 * @memberOf _ 24233 * @since 0.1.0 24234 * @category Function 24235 * @param {Function} func The function to delay. 24236 * @param {number} wait The number of milliseconds to delay invocation. 24237 * @param {...*} [args] The arguments to invoke `func` with. 24238 * @returns {number} Returns the timer id. 24239 * @example 24240 * 24241 * _.delay(function(text) { 24242 * console.log(text); 24243 * }, 1000, 'later'); 24244 * // => Logs 'later' after one second. 24245 */ 24246 var delay = baseRest(function(func, wait, args) { 24247 return baseDelay(func, toNumber(wait) || 0, args); 24248 }); 24249 24250 /** 24251 * Creates a function that invokes `func` with arguments reversed. 24252 * 24253 * @static 24254 * @memberOf _ 24255 * @since 4.0.0 24256 * @category Function 24257 * @param {Function} func The function to flip arguments for. 24258 * @returns {Function} Returns the new flipped function. 24259 * @example 24260 * 24261 * var flipped = _.flip(function() { 24262 * return _.toArray(arguments); 24263 * }); 24264 * 24265 * flipped('a', 'b', 'c', 'd'); 24266 * // => ['d', 'c', 'b', 'a'] 24267 */ 24268 function flip(func) { 24269 return createWrap(func, WRAP_FLIP_FLAG); 24270 } 24271 24272 /** 24273 * Creates a function that memoizes the result of `func`. If `resolver` is 24274 * provided, it determines the cache key for storing the result based on the 24275 * arguments provided to the memoized function. By default, the first argument 24276 * provided to the memoized function is used as the map cache key. The `func` 24277 * is invoked with the `this` binding of the memoized function. 24278 * 24279 * **Note:** The cache is exposed as the `cache` property on the memoized 24280 * function. Its creation may be customized by replacing the `_.memoize.Cache` 24281 * constructor with one whose instances implement the 24282 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) 24283 * method interface of `clear`, `delete`, `get`, `has`, and `set`. 24284 * 24285 * @static 24286 * @memberOf _ 24287 * @since 0.1.0 24288 * @category Function 24289 * @param {Function} func The function to have its output memoized. 24290 * @param {Function} [resolver] The function to resolve the cache key. 24291 * @returns {Function} Returns the new memoized function. 24292 * @example 24293 * 24294 * var object = { 'a': 1, 'b': 2 }; 24295 * var other = { 'c': 3, 'd': 4 }; 24296 * 24297 * var values = _.memoize(_.values); 24298 * values(object); 24299 * // => [1, 2] 24300 * 24301 * values(other); 24302 * // => [3, 4] 24303 * 24304 * object.a = 2; 24305 * values(object); 24306 * // => [1, 2] 24307 * 24308 * // Modify the result cache. 24309 * values.cache.set(object, ['a', 'b']); 24310 * values(object); 24311 * // => ['a', 'b'] 24312 * 24313 * // Replace `_.memoize.Cache`. 24314 * _.memoize.Cache = WeakMap; 24315 */ 24316 function memoize(func, resolver) { 24317 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { 24318 throw new TypeError(FUNC_ERROR_TEXT); 24319 } 24320 var memoized = function() { 24321 var args = arguments, 24322 key = resolver ? resolver.apply(this, args) : args[0], 24323 cache = memoized.cache; 24324 24325 if (cache.has(key)) { 24326 return cache.get(key); 24327 } 24328 var result = func.apply(this, args); 24329 memoized.cache = cache.set(key, result) || cache; 24330 return result; 24331 }; 24332 memoized.cache = new (memoize.Cache || MapCache); 24333 return memoized; 24334 } 24335 24336 // Expose `MapCache`. 24337 memoize.Cache = MapCache; 24338 24339 /** 24340 * Creates a function that negates the result of the predicate `func`. The 24341 * `func` predicate is invoked with the `this` binding and arguments of the 24342 * created function. 24343 * 24344 * @static 24345 * @memberOf _ 24346 * @since 3.0.0 24347 * @category Function 24348 * @param {Function} predicate The predicate to negate. 24349 * @returns {Function} Returns the new negated function. 24350 * @example 24351 * 24352 * function isEven(n) { 24353 * return n % 2 == 0; 24354 * } 24355 * 24356 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); 24357 * // => [1, 3, 5] 24358 */ 24359 function negate(predicate) { 24360 if (typeof predicate != 'function') { 24361 throw new TypeError(FUNC_ERROR_TEXT); 24362 } 24363 return function() { 24364 var args = arguments; 24365 switch (args.length) { 24366 case 0: return !predicate.call(this); 24367 case 1: return !predicate.call(this, args[0]); 24368 case 2: return !predicate.call(this, args[0], args[1]); 24369 case 3: return !predicate.call(this, args[0], args[1], args[2]); 24370 } 24371 return !predicate.apply(this, args); 24372 }; 24373 } 24374 24375 /** 24376 * Creates a function that is restricted to invoking `func` once. Repeat calls 24377 * to the function return the value of the first invocation. The `func` is 24378 * invoked with the `this` binding and arguments of the created function. 24379 * 24380 * @static 24381 * @memberOf _ 24382 * @since 0.1.0 24383 * @category Function 24384 * @param {Function} func The function to restrict. 24385 * @returns {Function} Returns the new restricted function. 24386 * @example 24387 * 24388 * var initialize = _.once(createApplication); 24389 * initialize(); 24390 * initialize(); 24391 * // => `createApplication` is invoked once 24392 */ 24393 function once(func) { 24394 return before(2, func); 24395 } 24396 24397 /** 24398 * Creates a function that invokes `func` with its arguments transformed. 24399 * 24400 * @static 24401 * @since 4.0.0 24402 * @memberOf _ 24403 * @category Function 24404 * @param {Function} func The function to wrap. 24405 * @param {...(Function|Function[])} [transforms=[_.identity]] 24406 * The argument transforms. 24407 * @returns {Function} Returns the new function. 24408 * @example 24409 * 24410 * function doubled(n) { 24411 * return n * 2; 24412 * } 24413 * 24414 * function square(n) { 24415 * return n * n; 24416 * } 24417 * 24418 * var func = _.overArgs(function(x, y) { 24419 * return [x, y]; 24420 * }, [square, doubled]); 24421 * 24422 * func(9, 3); 24423 * // => [81, 6] 24424 * 24425 * func(10, 5); 24426 * // => [100, 10] 24427 */ 24428 var overArgs = castRest(function(func, transforms) { 24429 transforms = (transforms.length == 1 && isArray(transforms[0])) 24430 ? arrayMap(transforms[0], baseUnary(getIteratee())) 24431 : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); 24432 24433 var funcsLength = transforms.length; 24434 return baseRest(function(args) { 24435 var index = -1, 24436 length = nativeMin(args.length, funcsLength); 24437 24438 while (++index < length) { 24439 args[index] = transforms[index].call(this, args[index]); 24440 } 24441 return apply(func, this, args); 24442 }); 24443 }); 24444 24445 /** 24446 * Creates a function that invokes `func` with `partials` prepended to the 24447 * arguments it receives. This method is like `_.bind` except it does **not** 24448 * alter the `this` binding. 24449 * 24450 * The `_.partial.placeholder` value, which defaults to `_` in monolithic 24451 * builds, may be used as a placeholder for partially applied arguments. 24452 * 24453 * **Note:** This method doesn't set the "length" property of partially 24454 * applied functions. 24455 * 24456 * @static 24457 * @memberOf _ 24458 * @since 0.2.0 24459 * @category Function 24460 * @param {Function} func The function to partially apply arguments to. 24461 * @param {...*} [partials] The arguments to be partially applied. 24462 * @returns {Function} Returns the new partially applied function. 24463 * @example 24464 * 24465 * function greet(greeting, name) { 24466 * return greeting + ' ' + name; 24467 * } 24468 * 24469 * var sayHelloTo = _.partial(greet, 'hello'); 24470 * sayHelloTo('fred'); 24471 * // => 'hello fred' 24472 * 24473 * // Partially applied with placeholders. 24474 * var greetFred = _.partial(greet, _, 'fred'); 24475 * greetFred('hi'); 24476 * // => 'hi fred' 24477 */ 24478 var partial = baseRest(function(func, partials) { 24479 var holders = replaceHolders(partials, getHolder(partial)); 24480 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); 24481 }); 24482 24483 /** 24484 * This method is like `_.partial` except that partially applied arguments 24485 * are appended to the arguments it receives. 24486 * 24487 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic 24488 * builds, may be used as a placeholder for partially applied arguments. 24489 * 24490 * **Note:** This method doesn't set the "length" property of partially 24491 * applied functions. 24492 * 24493 * @static 24494 * @memberOf _ 24495 * @since 1.0.0 24496 * @category Function 24497 * @param {Function} func The function to partially apply arguments to. 24498 * @param {...*} [partials] The arguments to be partially applied. 24499 * @returns {Function} Returns the new partially applied function. 24500 * @example 24501 * 24502 * function greet(greeting, name) { 24503 * return greeting + ' ' + name; 24504 * } 24505 * 24506 * var greetFred = _.partialRight(greet, 'fred'); 24507 * greetFred('hi'); 24508 * // => 'hi fred' 24509 * 24510 * // Partially applied with placeholders. 24511 * var sayHelloTo = _.partialRight(greet, 'hello', _); 24512 * sayHelloTo('fred'); 24513 * // => 'hello fred' 24514 */ 24515 var partialRight = baseRest(function(func, partials) { 24516 var holders = replaceHolders(partials, getHolder(partialRight)); 24517 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); 24518 }); 24519 24520 /** 24521 * Creates a function that invokes `func` with arguments arranged according 24522 * to the specified `indexes` where the argument value at the first index is 24523 * provided as the first argument, the argument value at the second index is 24524 * provided as the second argument, and so on. 24525 * 24526 * @static 24527 * @memberOf _ 24528 * @since 3.0.0 24529 * @category Function 24530 * @param {Function} func The function to rearrange arguments for. 24531 * @param {...(number|number[])} indexes The arranged argument indexes. 24532 * @returns {Function} Returns the new function. 24533 * @example 24534 * 24535 * var rearged = _.rearg(function(a, b, c) { 24536 * return [a, b, c]; 24537 * }, [2, 0, 1]); 24538 * 24539 * rearged('b', 'c', 'a') 24540 * // => ['a', 'b', 'c'] 24541 */ 24542 var rearg = flatRest(function(func, indexes) { 24543 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); 24544 }); 24545 24546 /** 24547 * Creates a function that invokes `func` with the `this` binding of the 24548 * created function and arguments from `start` and beyond provided as 24549 * an array. 24550 * 24551 * **Note:** This method is based on the 24552 * [rest parameter](https://mdn.io/rest_parameters). 24553 * 24554 * @static 24555 * @memberOf _ 24556 * @since 4.0.0 24557 * @category Function 24558 * @param {Function} func The function to apply a rest parameter to. 24559 * @param {number} [start=func.length-1] The start position of the rest parameter. 24560 * @returns {Function} Returns the new function. 24561 * @example 24562 * 24563 * var say = _.rest(function(what, names) { 24564 * return what + ' ' + _.initial(names).join(', ') + 24565 * (_.size(names) > 1 ? ', & ' : '') + _.last(names); 24566 * }); 24567 * 24568 * say('hello', 'fred', 'barney', 'pebbles'); 24569 * // => 'hello fred, barney, & pebbles' 24570 */ 24571 function rest(func, start) { 24572 if (typeof func != 'function') { 24573 throw new TypeError(FUNC_ERROR_TEXT); 24574 } 24575 start = start === undefined ? start : toInteger(start); 24576 return baseRest(func, start); 24577 } 24578 24579 /** 24580 * Creates a function that invokes `func` with the `this` binding of the 24581 * create function and an array of arguments much like 24582 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). 24583 * 24584 * **Note:** This method is based on the 24585 * [spread operator](https://mdn.io/spread_operator). 24586 * 24587 * @static 24588 * @memberOf _ 24589 * @since 3.2.0 24590 * @category Function 24591 * @param {Function} func The function to spread arguments over. 24592 * @param {number} [start=0] The start position of the spread. 24593 * @returns {Function} Returns the new function. 24594 * @example 24595 * 24596 * var say = _.spread(function(who, what) { 24597 * return who + ' says ' + what; 24598 * }); 24599 * 24600 * say(['fred', 'hello']); 24601 * // => 'fred says hello' 24602 * 24603 * var numbers = Promise.all([ 24604 * Promise.resolve(40), 24605 * Promise.resolve(36) 24606 * ]); 24607 * 24608 * numbers.then(_.spread(function(x, y) { 24609 * return x + y; 24610 * })); 24611 * // => a Promise of 76 24612 */ 24613 function spread(func, start) { 24614 if (typeof func != 'function') { 24615 throw new TypeError(FUNC_ERROR_TEXT); 24616 } 24617 start = start == null ? 0 : nativeMax(toInteger(start), 0); 24618 return baseRest(function(args) { 24619 var array = args[start], 24620 otherArgs = castSlice(args, 0, start); 24621 24622 if (array) { 24623 arrayPush(otherArgs, array); 24624 } 24625 return apply(func, this, otherArgs); 24626 }); 24627 } 24628 24629 /** 24630 * Creates a throttled function that only invokes `func` at most once per 24631 * every `wait` milliseconds. The throttled function comes with a `cancel` 24632 * method to cancel delayed `func` invocations and a `flush` method to 24633 * immediately invoke them. Provide `options` to indicate whether `func` 24634 * should be invoked on the leading and/or trailing edge of the `wait` 24635 * timeout. The `func` is invoked with the last arguments provided to the 24636 * throttled function. Subsequent calls to the throttled function return the 24637 * result of the last `func` invocation. 24638 * 24639 * **Note:** If `leading` and `trailing` options are `true`, `func` is 24640 * invoked on the trailing edge of the timeout only if the throttled function 24641 * is invoked more than once during the `wait` timeout. 24642 * 24643 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 24644 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 24645 * 24646 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 24647 * for details over the differences between `_.throttle` and `_.debounce`. 24648 * 24649 * @static 24650 * @memberOf _ 24651 * @since 0.1.0 24652 * @category Function 24653 * @param {Function} func The function to throttle. 24654 * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 24655 * @param {Object} [options={}] The options object. 24656 * @param {boolean} [options.leading=true] 24657 * Specify invoking on the leading edge of the timeout. 24658 * @param {boolean} [options.trailing=true] 24659 * Specify invoking on the trailing edge of the timeout. 24660 * @returns {Function} Returns the new throttled function. 24661 * @example 24662 * 24663 * // Avoid excessively updating the position while scrolling. 24664 * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 24665 * 24666 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 24667 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 24668 * jQuery(element).on('click', throttled); 24669 * 24670 * // Cancel the trailing throttled invocation. 24671 * jQuery(window).on('popstate', throttled.cancel); 24672 */ 24673 function throttle(func, wait, options) { 24674 var leading = true, 24675 trailing = true; 24676 24677 if (typeof func != 'function') { 24678 throw new TypeError(FUNC_ERROR_TEXT); 24679 } 24680 if (isObject(options)) { 24681 leading = 'leading' in options ? !!options.leading : leading; 24682 trailing = 'trailing' in options ? !!options.trailing : trailing; 24683 } 24684 return debounce(func, wait, { 24685 'leading': leading, 24686 'maxWait': wait, 24687 'trailing': trailing 24688 }); 24689 } 24690 24691 /** 24692 * Creates a function that accepts up to one argument, ignoring any 24693 * additional arguments. 24694 * 24695 * @static 24696 * @memberOf _ 24697 * @since 4.0.0 24698 * @category Function 24699 * @param {Function} func The function to cap arguments for. 24700 * @returns {Function} Returns the new capped function. 24701 * @example 24702 * 24703 * _.map(['6', '8', '10'], _.unary(parseInt)); 24704 * // => [6, 8, 10] 24705 */ 24706 function unary(func) { 24707 return ary(func, 1); 24708 } 24709 24710 /** 24711 * Creates a function that provides `value` to `wrapper` as its first 24712 * argument. Any additional arguments provided to the function are appended 24713 * to those provided to the `wrapper`. The wrapper is invoked with the `this` 24714 * binding of the created function. 24715 * 24716 * @static 24717 * @memberOf _ 24718 * @since 0.1.0 24719 * @category Function 24720 * @param {*} value The value to wrap. 24721 * @param {Function} [wrapper=identity] The wrapper function. 24722 * @returns {Function} Returns the new function. 24723 * @example 24724 * 24725 * var p = _.wrap(_.escape, function(func, text) { 24726 * return '<p>' + func(text) + '</p>'; 24727 * }); 24728 * 24729 * p('fred, barney, & pebbles'); 24730 * // => '<p>fred, barney, & pebbles</p>' 24731 */ 24732 function wrap(value, wrapper) { 24733 return partial(castFunction(wrapper), value); 24734 } 24735 24736 /*------------------------------------------------------------------------*/ 24737 24738 /** 24739 * Casts `value` as an array if it's not one. 24740 * 24741 * @static 24742 * @memberOf _ 24743 * @since 4.4.0 24744 * @category Lang 24745 * @param {*} value The value to inspect. 24746 * @returns {Array} Returns the cast array. 24747 * @example 24748 * 24749 * _.castArray(1); 24750 * // => [1] 24751 * 24752 * _.castArray({ 'a': 1 }); 24753 * // => [{ 'a': 1 }] 24754 * 24755 * _.castArray('abc'); 24756 * // => ['abc'] 24757 * 24758 * _.castArray(null); 24759 * // => [null] 24760 * 24761 * _.castArray(undefined); 24762 * // => [undefined] 24763 * 24764 * _.castArray(); 24765 * // => [] 24766 * 24767 * var array = [1, 2, 3]; 24768 * console.log(_.castArray(array) === array); 24769 * // => true 24770 */ 24771 function castArray() { 24772 if (!arguments.length) { 24773 return []; 24774 } 24775 var value = arguments[0]; 24776 return isArray(value) ? value : [value]; 24777 } 24778 24779 /** 24780 * Creates a shallow clone of `value`. 24781 * 24782 * **Note:** This method is loosely based on the 24783 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) 24784 * and supports cloning arrays, array buffers, booleans, date objects, maps, 24785 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed 24786 * arrays. The own enumerable properties of `arguments` objects are cloned 24787 * as plain objects. An empty object is returned for uncloneable values such 24788 * as error objects, functions, DOM nodes, and WeakMaps. 24789 * 24790 * @static 24791 * @memberOf _ 24792 * @since 0.1.0 24793 * @category Lang 24794 * @param {*} value The value to clone. 24795 * @returns {*} Returns the cloned value. 24796 * @see _.cloneDeep 24797 * @example 24798 * 24799 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 24800 * 24801 * var shallow = _.clone(objects); 24802 * console.log(shallow[0] === objects[0]); 24803 * // => true 24804 */ 24805 function clone(value) { 24806 return baseClone(value, CLONE_SYMBOLS_FLAG); 24807 } 24808 24809 /** 24810 * This method is like `_.clone` except that it accepts `customizer` which 24811 * is invoked to produce the cloned value. If `customizer` returns `undefined`, 24812 * cloning is handled by the method instead. The `customizer` is invoked with 24813 * up to four arguments; (value [, index|key, object, stack]). 24814 * 24815 * @static 24816 * @memberOf _ 24817 * @since 4.0.0 24818 * @category Lang 24819 * @param {*} value The value to clone. 24820 * @param {Function} [customizer] The function to customize cloning. 24821 * @returns {*} Returns the cloned value. 24822 * @see _.cloneDeepWith 24823 * @example 24824 * 24825 * function customizer(value) { 24826 * if (_.isElement(value)) { 24827 * return value.cloneNode(false); 24828 * } 24829 * } 24830 * 24831 * var el = _.cloneWith(document.body, customizer); 24832 * 24833 * console.log(el === document.body); 24834 * // => false 24835 * console.log(el.nodeName); 24836 * // => 'BODY' 24837 * console.log(el.childNodes.length); 24838 * // => 0 24839 */ 24840 function cloneWith(value, customizer) { 24841 customizer = typeof customizer == 'function' ? customizer : undefined; 24842 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); 24843 } 24844 24845 /** 24846 * This method is like `_.clone` except that it recursively clones `value`. 24847 * 24848 * @static 24849 * @memberOf _ 24850 * @since 1.0.0 24851 * @category Lang 24852 * @param {*} value The value to recursively clone. 24853 * @returns {*} Returns the deep cloned value. 24854 * @see _.clone 24855 * @example 24856 * 24857 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 24858 * 24859 * var deep = _.cloneDeep(objects); 24860 * console.log(deep[0] === objects[0]); 24861 * // => false 24862 */ 24863 function cloneDeep(value) { 24864 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 24865 } 24866 24867 /** 24868 * This method is like `_.cloneWith` except that it recursively clones `value`. 24869 * 24870 * @static 24871 * @memberOf _ 24872 * @since 4.0.0 24873 * @category Lang 24874 * @param {*} value The value to recursively clone. 24875 * @param {Function} [customizer] The function to customize cloning. 24876 * @returns {*} Returns the deep cloned value. 24877 * @see _.cloneWith 24878 * @example 24879 * 24880 * function customizer(value) { 24881 * if (_.isElement(value)) { 24882 * return value.cloneNode(true); 24883 * } 24884 * } 24885 * 24886 * var el = _.cloneDeepWith(document.body, customizer); 24887 * 24888 * console.log(el === document.body); 24889 * // => false 24890 * console.log(el.nodeName); 24891 * // => 'BODY' 24892 * console.log(el.childNodes.length); 24893 * // => 20 24894 */ 24895 function cloneDeepWith(value, customizer) { 24896 customizer = typeof customizer == 'function' ? customizer : undefined; 24897 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); 24898 } 24899 24900 /** 24901 * Checks if `object` conforms to `source` by invoking the predicate 24902 * properties of `source` with the corresponding property values of `object`. 24903 * 24904 * **Note:** This method is equivalent to `_.conforms` when `source` is 24905 * partially applied. 24906 * 24907 * @static 24908 * @memberOf _ 24909 * @since 4.14.0 24910 * @category Lang 24911 * @param {Object} object The object to inspect. 24912 * @param {Object} source The object of property predicates to conform to. 24913 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 24914 * @example 24915 * 24916 * var object = { 'a': 1, 'b': 2 }; 24917 * 24918 * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); 24919 * // => true 24920 * 24921 * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); 24922 * // => false 24923 */ 24924 function conformsTo(object, source) { 24925 return source == null || baseConformsTo(object, source, keys(source)); 24926 } 24927 24928 /** 24929 * Performs a 24930 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 24931 * comparison between two values to determine if they are equivalent. 24932 * 24933 * @static 24934 * @memberOf _ 24935 * @since 4.0.0 24936 * @category Lang 24937 * @param {*} value The value to compare. 24938 * @param {*} other The other value to compare. 24939 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 24940 * @example 24941 * 24942 * var object = { 'a': 1 }; 24943 * var other = { 'a': 1 }; 24944 * 24945 * _.eq(object, object); 24946 * // => true 24947 * 24948 * _.eq(object, other); 24949 * // => false 24950 * 24951 * _.eq('a', 'a'); 24952 * // => true 24953 * 24954 * _.eq('a', Object('a')); 24955 * // => false 24956 * 24957 * _.eq(NaN, NaN); 24958 * // => true 24959 */ 24960 function eq(value, other) { 24961 return value === other || (value !== value && other !== other); 24962 } 24963 24964 /** 24965 * Checks if `value` is greater than `other`. 24966 * 24967 * @static 24968 * @memberOf _ 24969 * @since 3.9.0 24970 * @category Lang 24971 * @param {*} value The value to compare. 24972 * @param {*} other The other value to compare. 24973 * @returns {boolean} Returns `true` if `value` is greater than `other`, 24974 * else `false`. 24975 * @see _.lt 24976 * @example 24977 * 24978 * _.gt(3, 1); 24979 * // => true 24980 * 24981 * _.gt(3, 3); 24982 * // => false 24983 * 24984 * _.gt(1, 3); 24985 * // => false 24986 */ 24987 var gt = createRelationalOperation(baseGt); 24988 24989 /** 24990 * Checks if `value` is greater than or equal to `other`. 24991 * 24992 * @static 24993 * @memberOf _ 24994 * @since 3.9.0 24995 * @category Lang 24996 * @param {*} value The value to compare. 24997 * @param {*} other The other value to compare. 24998 * @returns {boolean} Returns `true` if `value` is greater than or equal to 24999 * `other`, else `false`. 25000 * @see _.lte 25001 * @example 25002 * 25003 * _.gte(3, 1); 25004 * // => true 25005 * 25006 * _.gte(3, 3); 25007 * // => true 25008 * 25009 * _.gte(1, 3); 25010 * // => false 25011 */ 25012 var gte = createRelationalOperation(function(value, other) { 25013 return value >= other; 25014 }); 25015 25016 /** 25017 * Checks if `value` is likely an `arguments` object. 25018 * 25019 * @static 25020 * @memberOf _ 25021 * @since 0.1.0 25022 * @category Lang 25023 * @param {*} value The value to check. 25024 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 25025 * else `false`. 25026 * @example 25027 * 25028 * _.isArguments(function() { return arguments; }()); 25029 * // => true 25030 * 25031 * _.isArguments([1, 2, 3]); 25032 * // => false 25033 */ 25034 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { 25035 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && 25036 !propertyIsEnumerable.call(value, 'callee'); 25037 }; 25038 25039 /** 25040 * Checks if `value` is classified as an `Array` object. 25041 * 25042 * @static 25043 * @memberOf _ 25044 * @since 0.1.0 25045 * @category Lang 25046 * @param {*} value The value to check. 25047 * @returns {boolean} Returns `true` if `value` is an array, else `false`. 25048 * @example 25049 * 25050 * _.isArray([1, 2, 3]); 25051 * // => true 25052 * 25053 * _.isArray(document.body.children); 25054 * // => false 25055 * 25056 * _.isArray('abc'); 25057 * // => false 25058 * 25059 * _.isArray(_.noop); 25060 * // => false 25061 */ 25062 var isArray = Array.isArray; 25063 25064 /** 25065 * Checks if `value` is classified as an `ArrayBuffer` object. 25066 * 25067 * @static 25068 * @memberOf _ 25069 * @since 4.3.0 25070 * @category Lang 25071 * @param {*} value The value to check. 25072 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 25073 * @example 25074 * 25075 * _.isArrayBuffer(new ArrayBuffer(2)); 25076 * // => true 25077 * 25078 * _.isArrayBuffer(new Array(2)); 25079 * // => false 25080 */ 25081 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 25082 25083 /** 25084 * Checks if `value` is array-like. A value is considered array-like if it's 25085 * not a function and has a `value.length` that's an integer greater than or 25086 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. 25087 * 25088 * @static 25089 * @memberOf _ 25090 * @since 4.0.0 25091 * @category Lang 25092 * @param {*} value The value to check. 25093 * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 25094 * @example 25095 * 25096 * _.isArrayLike([1, 2, 3]); 25097 * // => true 25098 * 25099 * _.isArrayLike(document.body.children); 25100 * // => true 25101 * 25102 * _.isArrayLike('abc'); 25103 * // => true 25104 * 25105 * _.isArrayLike(_.noop); 25106 * // => false 25107 */ 25108 function isArrayLike(value) { 25109 return value != null && isLength(value.length) && !isFunction(value); 25110 } 25111 25112 /** 25113 * This method is like `_.isArrayLike` except that it also checks if `value` 25114 * is an object. 25115 * 25116 * @static 25117 * @memberOf _ 25118 * @since 4.0.0 25119 * @category Lang 25120 * @param {*} value The value to check. 25121 * @returns {boolean} Returns `true` if `value` is an array-like object, 25122 * else `false`. 25123 * @example 25124 * 25125 * _.isArrayLikeObject([1, 2, 3]); 25126 * // => true 25127 * 25128 * _.isArrayLikeObject(document.body.children); 25129 * // => true 25130 * 25131 * _.isArrayLikeObject('abc'); 25132 * // => false 25133 * 25134 * _.isArrayLikeObject(_.noop); 25135 * // => false 25136 */ 25137 function isArrayLikeObject(value) { 25138 return isObjectLike(value) && isArrayLike(value); 25139 } 25140 25141 /** 25142 * Checks if `value` is classified as a boolean primitive or object. 25143 * 25144 * @static 25145 * @memberOf _ 25146 * @since 0.1.0 25147 * @category Lang 25148 * @param {*} value The value to check. 25149 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. 25150 * @example 25151 * 25152 * _.isBoolean(false); 25153 * // => true 25154 * 25155 * _.isBoolean(null); 25156 * // => false 25157 */ 25158 function isBoolean(value) { 25159 return value === true || value === false || 25160 (isObjectLike(value) && baseGetTag(value) == boolTag); 25161 } 25162 25163 /** 25164 * Checks if `value` is a buffer. 25165 * 25166 * @static 25167 * @memberOf _ 25168 * @since 4.3.0 25169 * @category Lang 25170 * @param {*} value The value to check. 25171 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. 25172 * @example 25173 * 25174 * _.isBuffer(new Buffer(2)); 25175 * // => true 25176 * 25177 * _.isBuffer(new Uint8Array(2)); 25178 * // => false 25179 */ 25180 var isBuffer = nativeIsBuffer || stubFalse; 25181 25182 /** 25183 * Checks if `value` is classified as a `Date` object. 25184 * 25185 * @static 25186 * @memberOf _ 25187 * @since 0.1.0 25188 * @category Lang 25189 * @param {*} value The value to check. 25190 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 25191 * @example 25192 * 25193 * _.isDate(new Date); 25194 * // => true 25195 * 25196 * _.isDate('Mon April 23 2012'); 25197 * // => false 25198 */ 25199 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 25200 25201 /** 25202 * Checks if `value` is likely a DOM element. 25203 * 25204 * @static 25205 * @memberOf _ 25206 * @since 0.1.0 25207 * @category Lang 25208 * @param {*} value The value to check. 25209 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. 25210 * @example 25211 * 25212 * _.isElement(document.body); 25213 * // => true 25214 * 25215 * _.isElement('<body>'); 25216 * // => false 25217 */ 25218 function isElement(value) { 25219 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 25220 } 25221 25222 /** 25223 * Checks if `value` is an empty object, collection, map, or set. 25224 * 25225 * Objects are considered empty if they have no own enumerable string keyed 25226 * properties. 25227 * 25228 * Array-like values such as `arguments` objects, arrays, buffers, strings, or 25229 * jQuery-like collections are considered empty if they have a `length` of `0`. 25230 * Similarly, maps and sets are considered empty if they have a `size` of `0`. 25231 * 25232 * @static 25233 * @memberOf _ 25234 * @since 0.1.0 25235 * @category Lang 25236 * @param {*} value The value to check. 25237 * @returns {boolean} Returns `true` if `value` is empty, else `false`. 25238 * @example 25239 * 25240 * _.isEmpty(null); 25241 * // => true 25242 * 25243 * _.isEmpty(true); 25244 * // => true 25245 * 25246 * _.isEmpty(1); 25247 * // => true 25248 * 25249 * _.isEmpty([1, 2, 3]); 25250 * // => false 25251 * 25252 * _.isEmpty({ 'a': 1 }); 25253 * // => false 25254 */ 25255 function isEmpty(value) { 25256 if (value == null) { 25257 return true; 25258 } 25259 if (isArrayLike(value) && 25260 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || 25261 isBuffer(value) || isTypedArray(value) || isArguments(value))) { 25262 return !value.length; 25263 } 25264 var tag = getTag(value); 25265 if (tag == mapTag || tag == setTag) { 25266 return !value.size; 25267 } 25268 if (isPrototype(value)) { 25269 return !baseKeys(value).length; 25270 } 25271 for (var key in value) { 25272 if (hasOwnProperty.call(value, key)) { 25273 return false; 25274 } 25275 } 25276 return true; 25277 } 25278 25279 /** 25280 * Performs a deep comparison between two values to determine if they are 25281 * equivalent. 25282 * 25283 * **Note:** This method supports comparing arrays, array buffers, booleans, 25284 * date objects, error objects, maps, numbers, `Object` objects, regexes, 25285 * sets, strings, symbols, and typed arrays. `Object` objects are compared 25286 * by their own, not inherited, enumerable properties. Functions and DOM 25287 * nodes are compared by strict equality, i.e. `===`. 25288 * 25289 * @static 25290 * @memberOf _ 25291 * @since 0.1.0 25292 * @category Lang 25293 * @param {*} value The value to compare. 25294 * @param {*} other The other value to compare. 25295 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 25296 * @example 25297 * 25298 * var object = { 'a': 1 }; 25299 * var other = { 'a': 1 }; 25300 * 25301 * _.isEqual(object, other); 25302 * // => true 25303 * 25304 * object === other; 25305 * // => false 25306 */ 25307 function isEqual(value, other) { 25308 return baseIsEqual(value, other); 25309 } 25310 25311 /** 25312 * This method is like `_.isEqual` except that it accepts `customizer` which 25313 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 25314 * are handled by the method instead. The `customizer` is invoked with up to 25315 * six arguments: (objValue, othValue [, index|key, object, other, stack]). 25316 * 25317 * @static 25318 * @memberOf _ 25319 * @since 4.0.0 25320 * @category Lang 25321 * @param {*} value The value to compare. 25322 * @param {*} other The other value to compare. 25323 * @param {Function} [customizer] The function to customize comparisons. 25324 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 25325 * @example 25326 * 25327 * function isGreeting(value) { 25328 * return /^h(?:i|ello)$/.test(value); 25329 * } 25330 * 25331 * function customizer(objValue, othValue) { 25332 * if (isGreeting(objValue) && isGreeting(othValue)) { 25333 * return true; 25334 * } 25335 * } 25336 * 25337 * var array = ['hello', 'goodbye']; 25338 * var other = ['hi', 'goodbye']; 25339 * 25340 * _.isEqualWith(array, other, customizer); 25341 * // => true 25342 */ 25343 function isEqualWith(value, other, customizer) { 25344 customizer = typeof customizer == 'function' ? customizer : undefined; 25345 var result = customizer ? customizer(value, other) : undefined; 25346 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; 25347 } 25348 25349 /** 25350 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, 25351 * `SyntaxError`, `TypeError`, or `URIError` object. 25352 * 25353 * @static 25354 * @memberOf _ 25355 * @since 3.0.0 25356 * @category Lang 25357 * @param {*} value The value to check. 25358 * @returns {boolean} Returns `true` if `value` is an error object, else `false`. 25359 * @example 25360 * 25361 * _.isError(new Error); 25362 * // => true 25363 * 25364 * _.isError(Error); 25365 * // => false 25366 */ 25367 function isError(value) { 25368 if (!isObjectLike(value)) { 25369 return false; 25370 } 25371 var tag = baseGetTag(value); 25372 return tag == errorTag || tag == domExcTag || 25373 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); 25374 } 25375 25376 /** 25377 * Checks if `value` is a finite primitive number. 25378 * 25379 * **Note:** This method is based on 25380 * [`Number.isFinite`](https://mdn.io/Number/isFinite). 25381 * 25382 * @static 25383 * @memberOf _ 25384 * @since 0.1.0 25385 * @category Lang 25386 * @param {*} value The value to check. 25387 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. 25388 * @example 25389 * 25390 * _.isFinite(3); 25391 * // => true 25392 * 25393 * _.isFinite(Number.MIN_VALUE); 25394 * // => true 25395 * 25396 * _.isFinite(Infinity); 25397 * // => false 25398 * 25399 * _.isFinite('3'); 25400 * // => false 25401 */ 25402 function isFinite(value) { 25403 return typeof value == 'number' && nativeIsFinite(value); 25404 } 25405 25406 /** 25407 * Checks if `value` is classified as a `Function` object. 25408 * 25409 * @static 25410 * @memberOf _ 25411 * @since 0.1.0 25412 * @category Lang 25413 * @param {*} value The value to check. 25414 * @returns {boolean} Returns `true` if `value` is a function, else `false`. 25415 * @example 25416 * 25417 * _.isFunction(_); 25418 * // => true 25419 * 25420 * _.isFunction(/abc/); 25421 * // => false 25422 */ 25423 function isFunction(value) { 25424 if (!isObject(value)) { 25425 return false; 25426 } 25427 // The use of `Object#toString` avoids issues with the `typeof` operator 25428 // in Safari 9 which returns 'object' for typed arrays and other constructors. 25429 var tag = baseGetTag(value); 25430 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 25431 } 25432 25433 /** 25434 * Checks if `value` is an integer. 25435 * 25436 * **Note:** This method is based on 25437 * [`Number.isInteger`](https://mdn.io/Number/isInteger). 25438 * 25439 * @static 25440 * @memberOf _ 25441 * @since 4.0.0 25442 * @category Lang 25443 * @param {*} value The value to check. 25444 * @returns {boolean} Returns `true` if `value` is an integer, else `false`. 25445 * @example 25446 * 25447 * _.isInteger(3); 25448 * // => true 25449 * 25450 * _.isInteger(Number.MIN_VALUE); 25451 * // => false 25452 * 25453 * _.isInteger(Infinity); 25454 * // => false 25455 * 25456 * _.isInteger('3'); 25457 * // => false 25458 */ 25459 function isInteger(value) { 25460 return typeof value == 'number' && value == toInteger(value); 25461 } 25462 25463 /** 25464 * Checks if `value` is a valid array-like length. 25465 * 25466 * **Note:** This method is loosely based on 25467 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 25468 * 25469 * @static 25470 * @memberOf _ 25471 * @since 4.0.0 25472 * @category Lang 25473 * @param {*} value The value to check. 25474 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 25475 * @example 25476 * 25477 * _.isLength(3); 25478 * // => true 25479 * 25480 * _.isLength(Number.MIN_VALUE); 25481 * // => false 25482 * 25483 * _.isLength(Infinity); 25484 * // => false 25485 * 25486 * _.isLength('3'); 25487 * // => false 25488 */ 25489 function isLength(value) { 25490 return typeof value == 'number' && 25491 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 25492 } 25493 25494 /** 25495 * Checks if `value` is the 25496 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 25497 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 25498 * 25499 * @static 25500 * @memberOf _ 25501 * @since 0.1.0 25502 * @category Lang 25503 * @param {*} value The value to check. 25504 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 25505 * @example 25506 * 25507 * _.isObject({}); 25508 * // => true 25509 * 25510 * _.isObject([1, 2, 3]); 25511 * // => true 25512 * 25513 * _.isObject(_.noop); 25514 * // => true 25515 * 25516 * _.isObject(null); 25517 * // => false 25518 */ 25519 function isObject(value) { 25520 var type = typeof value; 25521 return value != null && (type == 'object' || type == 'function'); 25522 } 25523 25524 /** 25525 * Checks if `value` is object-like. A value is object-like if it's not `null` 25526 * and has a `typeof` result of "object". 25527 * 25528 * @static 25529 * @memberOf _ 25530 * @since 4.0.0 25531 * @category Lang 25532 * @param {*} value The value to check. 25533 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 25534 * @example 25535 * 25536 * _.isObjectLike({}); 25537 * // => true 25538 * 25539 * _.isObjectLike([1, 2, 3]); 25540 * // => true 25541 * 25542 * _.isObjectLike(_.noop); 25543 * // => false 25544 * 25545 * _.isObjectLike(null); 25546 * // => false 25547 */ 25548 function isObjectLike(value) { 25549 return value != null && typeof value == 'object'; 25550 } 25551 25552 /** 25553 * Checks if `value` is classified as a `Map` object. 25554 * 25555 * @static 25556 * @memberOf _ 25557 * @since 4.3.0 25558 * @category Lang 25559 * @param {*} value The value to check. 25560 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 25561 * @example 25562 * 25563 * _.isMap(new Map); 25564 * // => true 25565 * 25566 * _.isMap(new WeakMap); 25567 * // => false 25568 */ 25569 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 25570 25571 /** 25572 * Performs a partial deep comparison between `object` and `source` to 25573 * determine if `object` contains equivalent property values. 25574 * 25575 * **Note:** This method is equivalent to `_.matches` when `source` is 25576 * partially applied. 25577 * 25578 * Partial comparisons will match empty array and empty object `source` 25579 * values against any array or object value, respectively. See `_.isEqual` 25580 * for a list of supported value comparisons. 25581 * 25582 * @static 25583 * @memberOf _ 25584 * @since 3.0.0 25585 * @category Lang 25586 * @param {Object} object The object to inspect. 25587 * @param {Object} source The object of property values to match. 25588 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 25589 * @example 25590 * 25591 * var object = { 'a': 1, 'b': 2 }; 25592 * 25593 * _.isMatch(object, { 'b': 2 }); 25594 * // => true 25595 * 25596 * _.isMatch(object, { 'b': 1 }); 25597 * // => false 25598 */ 25599 function isMatch(object, source) { 25600 return object === source || baseIsMatch(object, source, getMatchData(source)); 25601 } 25602 25603 /** 25604 * This method is like `_.isMatch` except that it accepts `customizer` which 25605 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 25606 * are handled by the method instead. The `customizer` is invoked with five 25607 * arguments: (objValue, srcValue, index|key, object, source). 25608 * 25609 * @static 25610 * @memberOf _ 25611 * @since 4.0.0 25612 * @category Lang 25613 * @param {Object} object The object to inspect. 25614 * @param {Object} source The object of property values to match. 25615 * @param {Function} [customizer] The function to customize comparisons. 25616 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 25617 * @example 25618 * 25619 * function isGreeting(value) { 25620 * return /^h(?:i|ello)$/.test(value); 25621 * } 25622 * 25623 * function customizer(objValue, srcValue) { 25624 * if (isGreeting(objValue) && isGreeting(srcValue)) { 25625 * return true; 25626 * } 25627 * } 25628 * 25629 * var object = { 'greeting': 'hello' }; 25630 * var source = { 'greeting': 'hi' }; 25631 * 25632 * _.isMatchWith(object, source, customizer); 25633 * // => true 25634 */ 25635 function isMatchWith(object, source, customizer) { 25636 customizer = typeof customizer == 'function' ? customizer : undefined; 25637 return baseIsMatch(object, source, getMatchData(source), customizer); 25638 } 25639 25640 /** 25641 * Checks if `value` is `NaN`. 25642 * 25643 * **Note:** This method is based on 25644 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as 25645 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for 25646 * `undefined` and other non-number values. 25647 * 25648 * @static 25649 * @memberOf _ 25650 * @since 0.1.0 25651 * @category Lang 25652 * @param {*} value The value to check. 25653 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 25654 * @example 25655 * 25656 * _.isNaN(NaN); 25657 * // => true 25658 * 25659 * _.isNaN(new Number(NaN)); 25660 * // => true 25661 * 25662 * isNaN(undefined); 25663 * // => true 25664 * 25665 * _.isNaN(undefined); 25666 * // => false 25667 */ 25668 function isNaN(value) { 25669 // An `NaN` primitive is the only value that is not equal to itself. 25670 // Perform the `toStringTag` check first to avoid errors with some 25671 // ActiveX objects in IE. 25672 return isNumber(value) && value != +value; 25673 } 25674 25675 /** 25676 * Checks if `value` is a pristine native function. 25677 * 25678 * **Note:** This method can't reliably detect native functions in the presence 25679 * of the core-js package because core-js circumvents this kind of detection. 25680 * Despite multiple requests, the core-js maintainer has made it clear: any 25681 * attempt to fix the detection will be obstructed. As a result, we're left 25682 * with little choice but to throw an error. Unfortunately, this also affects 25683 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), 25684 * which rely on core-js. 25685 * 25686 * @static 25687 * @memberOf _ 25688 * @since 3.0.0 25689 * @category Lang 25690 * @param {*} value The value to check. 25691 * @returns {boolean} Returns `true` if `value` is a native function, 25692 * else `false`. 25693 * @example 25694 * 25695 * _.isNative(Array.prototype.push); 25696 * // => true 25697 * 25698 * _.isNative(_); 25699 * // => false 25700 */ 25701 function isNative(value) { 25702 if (isMaskable(value)) { 25703 throw new Error(CORE_ERROR_TEXT); 25704 } 25705 return baseIsNative(value); 25706 } 25707 25708 /** 25709 * Checks if `value` is `null`. 25710 * 25711 * @static 25712 * @memberOf _ 25713 * @since 0.1.0 25714 * @category Lang 25715 * @param {*} value The value to check. 25716 * @returns {boolean} Returns `true` if `value` is `null`, else `false`. 25717 * @example 25718 * 25719 * _.isNull(null); 25720 * // => true 25721 * 25722 * _.isNull(void 0); 25723 * // => false 25724 */ 25725 function isNull(value) { 25726 return value === null; 25727 } 25728 25729 /** 25730 * Checks if `value` is `null` or `undefined`. 25731 * 25732 * @static 25733 * @memberOf _ 25734 * @since 4.0.0 25735 * @category Lang 25736 * @param {*} value The value to check. 25737 * @returns {boolean} Returns `true` if `value` is nullish, else `false`. 25738 * @example 25739 * 25740 * _.isNil(null); 25741 * // => true 25742 * 25743 * _.isNil(void 0); 25744 * // => true 25745 * 25746 * _.isNil(NaN); 25747 * // => false 25748 */ 25749 function isNil(value) { 25750 return value == null; 25751 } 25752 25753 /** 25754 * Checks if `value` is classified as a `Number` primitive or object. 25755 * 25756 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are 25757 * classified as numbers, use the `_.isFinite` method. 25758 * 25759 * @static 25760 * @memberOf _ 25761 * @since 0.1.0 25762 * @category Lang 25763 * @param {*} value The value to check. 25764 * @returns {boolean} Returns `true` if `value` is a number, else `false`. 25765 * @example 25766 * 25767 * _.isNumber(3); 25768 * // => true 25769 * 25770 * _.isNumber(Number.MIN_VALUE); 25771 * // => true 25772 * 25773 * _.isNumber(Infinity); 25774 * // => true 25775 * 25776 * _.isNumber('3'); 25777 * // => false 25778 */ 25779 function isNumber(value) { 25780 return typeof value == 'number' || 25781 (isObjectLike(value) && baseGetTag(value) == numberTag); 25782 } 25783 25784 /** 25785 * Checks if `value` is a plain object, that is, an object created by the 25786 * `Object` constructor or one with a `[[Prototype]]` of `null`. 25787 * 25788 * @static 25789 * @memberOf _ 25790 * @since 0.8.0 25791 * @category Lang 25792 * @param {*} value The value to check. 25793 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. 25794 * @example 25795 * 25796 * function Foo() { 25797 * this.a = 1; 25798 * } 25799 * 25800 * _.isPlainObject(new Foo); 25801 * // => false 25802 * 25803 * _.isPlainObject([1, 2, 3]); 25804 * // => false 25805 * 25806 * _.isPlainObject({ 'x': 0, 'y': 0 }); 25807 * // => true 25808 * 25809 * _.isPlainObject(Object.create(null)); 25810 * // => true 25811 */ 25812 function isPlainObject(value) { 25813 if (!isObjectLike(value) || baseGetTag(value) != objectTag) { 25814 return false; 25815 } 25816 var proto = getPrototype(value); 25817 if (proto === null) { 25818 return true; 25819 } 25820 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; 25821 return typeof Ctor == 'function' && Ctor instanceof Ctor && 25822 funcToString.call(Ctor) == objectCtorString; 25823 } 25824 25825 /** 25826 * Checks if `value` is classified as a `RegExp` object. 25827 * 25828 * @static 25829 * @memberOf _ 25830 * @since 0.1.0 25831 * @category Lang 25832 * @param {*} value The value to check. 25833 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 25834 * @example 25835 * 25836 * _.isRegExp(/abc/); 25837 * // => true 25838 * 25839 * _.isRegExp('/abc/'); 25840 * // => false 25841 */ 25842 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 25843 25844 /** 25845 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 25846 * double precision number which isn't the result of a rounded unsafe integer. 25847 * 25848 * **Note:** This method is based on 25849 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). 25850 * 25851 * @static 25852 * @memberOf _ 25853 * @since 4.0.0 25854 * @category Lang 25855 * @param {*} value The value to check. 25856 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. 25857 * @example 25858 * 25859 * _.isSafeInteger(3); 25860 * // => true 25861 * 25862 * _.isSafeInteger(Number.MIN_VALUE); 25863 * // => false 25864 * 25865 * _.isSafeInteger(Infinity); 25866 * // => false 25867 * 25868 * _.isSafeInteger('3'); 25869 * // => false 25870 */ 25871 function isSafeInteger(value) { 25872 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; 25873 } 25874 25875 /** 25876 * Checks if `value` is classified as a `Set` object. 25877 * 25878 * @static 25879 * @memberOf _ 25880 * @since 4.3.0 25881 * @category Lang 25882 * @param {*} value The value to check. 25883 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 25884 * @example 25885 * 25886 * _.isSet(new Set); 25887 * // => true 25888 * 25889 * _.isSet(new WeakSet); 25890 * // => false 25891 */ 25892 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 25893 25894 /** 25895 * Checks if `value` is classified as a `String` primitive or object. 25896 * 25897 * @static 25898 * @since 0.1.0 25899 * @memberOf _ 25900 * @category Lang 25901 * @param {*} value The value to check. 25902 * @returns {boolean} Returns `true` if `value` is a string, else `false`. 25903 * @example 25904 * 25905 * _.isString('abc'); 25906 * // => true 25907 * 25908 * _.isString(1); 25909 * // => false 25910 */ 25911 function isString(value) { 25912 return typeof value == 'string' || 25913 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); 25914 } 25915 25916 /** 25917 * Checks if `value` is classified as a `Symbol` primitive or object. 25918 * 25919 * @static 25920 * @memberOf _ 25921 * @since 4.0.0 25922 * @category Lang 25923 * @param {*} value The value to check. 25924 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 25925 * @example 25926 * 25927 * _.isSymbol(Symbol.iterator); 25928 * // => true 25929 * 25930 * _.isSymbol('abc'); 25931 * // => false 25932 */ 25933 function isSymbol(value) { 25934 return typeof value == 'symbol' || 25935 (isObjectLike(value) && baseGetTag(value) == symbolTag); 25936 } 25937 25938 /** 25939 * Checks if `value` is classified as a typed array. 25940 * 25941 * @static 25942 * @memberOf _ 25943 * @since 3.0.0 25944 * @category Lang 25945 * @param {*} value The value to check. 25946 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 25947 * @example 25948 * 25949 * _.isTypedArray(new Uint8Array); 25950 * // => true 25951 * 25952 * _.isTypedArray([]); 25953 * // => false 25954 */ 25955 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 25956 25957 /** 25958 * Checks if `value` is `undefined`. 25959 * 25960 * @static 25961 * @since 0.1.0 25962 * @memberOf _ 25963 * @category Lang 25964 * @param {*} value The value to check. 25965 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. 25966 * @example 25967 * 25968 * _.isUndefined(void 0); 25969 * // => true 25970 * 25971 * _.isUndefined(null); 25972 * // => false 25973 */ 25974 function isUndefined(value) { 25975 return value === undefined; 25976 } 25977 25978 /** 25979 * Checks if `value` is classified as a `WeakMap` object. 25980 * 25981 * @static 25982 * @memberOf _ 25983 * @since 4.3.0 25984 * @category Lang 25985 * @param {*} value The value to check. 25986 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. 25987 * @example 25988 * 25989 * _.isWeakMap(new WeakMap); 25990 * // => true 25991 * 25992 * _.isWeakMap(new Map); 25993 * // => false 25994 */ 25995 function isWeakMap(value) { 25996 return isObjectLike(value) && getTag(value) == weakMapTag; 25997 } 25998 25999 /** 26000 * Checks if `value` is classified as a `WeakSet` object. 26001 * 26002 * @static 26003 * @memberOf _ 26004 * @since 4.3.0 26005 * @category Lang 26006 * @param {*} value The value to check. 26007 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. 26008 * @example 26009 * 26010 * _.isWeakSet(new WeakSet); 26011 * // => true 26012 * 26013 * _.isWeakSet(new Set); 26014 * // => false 26015 */ 26016 function isWeakSet(value) { 26017 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 26018 } 26019 26020 /** 26021 * Checks if `value` is less than `other`. 26022 * 26023 * @static 26024 * @memberOf _ 26025 * @since 3.9.0 26026 * @category Lang 26027 * @param {*} value The value to compare. 26028 * @param {*} other The other value to compare. 26029 * @returns {boolean} Returns `true` if `value` is less than `other`, 26030 * else `false`. 26031 * @see _.gt 26032 * @example 26033 * 26034 * _.lt(1, 3); 26035 * // => true 26036 * 26037 * _.lt(3, 3); 26038 * // => false 26039 * 26040 * _.lt(3, 1); 26041 * // => false 26042 */ 26043 var lt = createRelationalOperation(baseLt); 26044 26045 /** 26046 * Checks if `value` is less than or equal to `other`. 26047 * 26048 * @static 26049 * @memberOf _ 26050 * @since 3.9.0 26051 * @category Lang 26052 * @param {*} value The value to compare. 26053 * @param {*} other The other value to compare. 26054 * @returns {boolean} Returns `true` if `value` is less than or equal to 26055 * `other`, else `false`. 26056 * @see _.gte 26057 * @example 26058 * 26059 * _.lte(1, 3); 26060 * // => true 26061 * 26062 * _.lte(3, 3); 26063 * // => true 26064 * 26065 * _.lte(3, 1); 26066 * // => false 26067 */ 26068 var lte = createRelationalOperation(function(value, other) { 26069 return value <= other; 26070 }); 26071 26072 /** 26073 * Converts `value` to an array. 26074 * 26075 * @static 26076 * @since 0.1.0 26077 * @memberOf _ 26078 * @category Lang 26079 * @param {*} value The value to convert. 26080 * @returns {Array} Returns the converted array. 26081 * @example 26082 * 26083 * _.toArray({ 'a': 1, 'b': 2 }); 26084 * // => [1, 2] 26085 * 26086 * _.toArray('abc'); 26087 * // => ['a', 'b', 'c'] 26088 * 26089 * _.toArray(1); 26090 * // => [] 26091 * 26092 * _.toArray(null); 26093 * // => [] 26094 */ 26095 function toArray(value) { 26096 if (!value) { 26097 return []; 26098 } 26099 if (isArrayLike(value)) { 26100 return isString(value) ? stringToArray(value) : copyArray(value); 26101 } 26102 if (symIterator && value[symIterator]) { 26103 return iteratorToArray(value[symIterator]()); 26104 } 26105 var tag = getTag(value), 26106 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); 26107 26108 return func(value); 26109 } 26110 26111 /** 26112 * Converts `value` to a finite number. 26113 * 26114 * @static 26115 * @memberOf _ 26116 * @since 4.12.0 26117 * @category Lang 26118 * @param {*} value The value to convert. 26119 * @returns {number} Returns the converted number. 26120 * @example 26121 * 26122 * _.toFinite(3.2); 26123 * // => 3.2 26124 * 26125 * _.toFinite(Number.MIN_VALUE); 26126 * // => 5e-324 26127 * 26128 * _.toFinite(Infinity); 26129 * // => 1.7976931348623157e+308 26130 * 26131 * _.toFinite('3.2'); 26132 * // => 3.2 26133 */ 26134 function toFinite(value) { 26135 if (!value) { 26136 return value === 0 ? value : 0; 26137 } 26138 value = toNumber(value); 26139 if (value === INFINITY || value === -INFINITY) { 26140 var sign = (value < 0 ? -1 : 1); 26141 return sign * MAX_INTEGER; 26142 } 26143 return value === value ? value : 0; 26144 } 26145 26146 /** 26147 * Converts `value` to an integer. 26148 * 26149 * **Note:** This method is loosely based on 26150 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). 26151 * 26152 * @static 26153 * @memberOf _ 26154 * @since 4.0.0 26155 * @category Lang 26156 * @param {*} value The value to convert. 26157 * @returns {number} Returns the converted integer. 26158 * @example 26159 * 26160 * _.toInteger(3.2); 26161 * // => 3 26162 * 26163 * _.toInteger(Number.MIN_VALUE); 26164 * // => 0 26165 * 26166 * _.toInteger(Infinity); 26167 * // => 1.7976931348623157e+308 26168 * 26169 * _.toInteger('3.2'); 26170 * // => 3 26171 */ 26172 function toInteger(value) { 26173 var result = toFinite(value), 26174 remainder = result % 1; 26175 26176 return result === result ? (remainder ? result - remainder : result) : 0; 26177 } 26178 26179 /** 26180 * Converts `value` to an integer suitable for use as the length of an 26181 * array-like object. 26182 * 26183 * **Note:** This method is based on 26184 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 26185 * 26186 * @static 26187 * @memberOf _ 26188 * @since 4.0.0 26189 * @category Lang 26190 * @param {*} value The value to convert. 26191 * @returns {number} Returns the converted integer. 26192 * @example 26193 * 26194 * _.toLength(3.2); 26195 * // => 3 26196 * 26197 * _.toLength(Number.MIN_VALUE); 26198 * // => 0 26199 * 26200 * _.toLength(Infinity); 26201 * // => 4294967295 26202 * 26203 * _.toLength('3.2'); 26204 * // => 3 26205 */ 26206 function toLength(value) { 26207 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; 26208 } 26209 26210 /** 26211 * Converts `value` to a number. 26212 * 26213 * @static 26214 * @memberOf _ 26215 * @since 4.0.0 26216 * @category Lang 26217 * @param {*} value The value to process. 26218 * @returns {number} Returns the number. 26219 * @example 26220 * 26221 * _.toNumber(3.2); 26222 * // => 3.2 26223 * 26224 * _.toNumber(Number.MIN_VALUE); 26225 * // => 5e-324 26226 * 26227 * _.toNumber(Infinity); 26228 * // => Infinity 26229 * 26230 * _.toNumber('3.2'); 26231 * // => 3.2 26232 */ 26233 function toNumber(value) { 26234 if (typeof value == 'number') { 26235 return value; 26236 } 26237 if (isSymbol(value)) { 26238 return NAN; 26239 } 26240 if (isObject(value)) { 26241 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 26242 value = isObject(other) ? (other + '') : other; 26243 } 26244 if (typeof value != 'string') { 26245 return value === 0 ? value : +value; 26246 } 26247 value = baseTrim(value); 26248 var isBinary = reIsBinary.test(value); 26249 return (isBinary || reIsOctal.test(value)) 26250 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 26251 : (reIsBadHex.test(value) ? NAN : +value); 26252 } 26253 26254 /** 26255 * Converts `value` to a plain object flattening inherited enumerable string 26256 * keyed properties of `value` to own properties of the plain object. 26257 * 26258 * @static 26259 * @memberOf _ 26260 * @since 3.0.0 26261 * @category Lang 26262 * @param {*} value The value to convert. 26263 * @returns {Object} Returns the converted plain object. 26264 * @example 26265 * 26266 * function Foo() { 26267 * this.b = 2; 26268 * } 26269 * 26270 * Foo.prototype.c = 3; 26271 * 26272 * _.assign({ 'a': 1 }, new Foo); 26273 * // => { 'a': 1, 'b': 2 } 26274 * 26275 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); 26276 * // => { 'a': 1, 'b': 2, 'c': 3 } 26277 */ 26278 function toPlainObject(value) { 26279 return copyObject(value, keysIn(value)); 26280 } 26281 26282 /** 26283 * Converts `value` to a safe integer. A safe integer can be compared and 26284 * represented correctly. 26285 * 26286 * @static 26287 * @memberOf _ 26288 * @since 4.0.0 26289 * @category Lang 26290 * @param {*} value The value to convert. 26291 * @returns {number} Returns the converted integer. 26292 * @example 26293 * 26294 * _.toSafeInteger(3.2); 26295 * // => 3 26296 * 26297 * _.toSafeInteger(Number.MIN_VALUE); 26298 * // => 0 26299 * 26300 * _.toSafeInteger(Infinity); 26301 * // => 9007199254740991 26302 * 26303 * _.toSafeInteger('3.2'); 26304 * // => 3 26305 */ 26306 function toSafeInteger(value) { 26307 return value 26308 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) 26309 : (value === 0 ? value : 0); 26310 } 26311 26312 /** 26313 * Converts `value` to a string. An empty string is returned for `null` 26314 * and `undefined` values. The sign of `-0` is preserved. 26315 * 26316 * @static 26317 * @memberOf _ 26318 * @since 4.0.0 26319 * @category Lang 26320 * @param {*} value The value to convert. 26321 * @returns {string} Returns the converted string. 26322 * @example 26323 * 26324 * _.toString(null); 26325 * // => '' 26326 * 26327 * _.toString(-0); 26328 * // => '-0' 26329 * 26330 * _.toString([1, 2, 3]); 26331 * // => '1,2,3' 26332 */ 26333 function toString(value) { 26334 return value == null ? '' : baseToString(value); 26335 } 26336 26337 /*------------------------------------------------------------------------*/ 26338 26339 /** 26340 * Assigns own enumerable string keyed properties of source objects to the 26341 * destination object. Source objects are applied from left to right. 26342 * Subsequent sources overwrite property assignments of previous sources. 26343 * 26344 * **Note:** This method mutates `object` and is loosely based on 26345 * [`Object.assign`](https://mdn.io/Object/assign). 26346 * 26347 * @static 26348 * @memberOf _ 26349 * @since 0.10.0 26350 * @category Object 26351 * @param {Object} object The destination object. 26352 * @param {...Object} [sources] The source objects. 26353 * @returns {Object} Returns `object`. 26354 * @see _.assignIn 26355 * @example 26356 * 26357 * function Foo() { 26358 * this.a = 1; 26359 * } 26360 * 26361 * function Bar() { 26362 * this.c = 3; 26363 * } 26364 * 26365 * Foo.prototype.b = 2; 26366 * Bar.prototype.d = 4; 26367 * 26368 * _.assign({ 'a': 0 }, new Foo, new Bar); 26369 * // => { 'a': 1, 'c': 3 } 26370 */ 26371 var assign = createAssigner(function(object, source) { 26372 if (isPrototype(source) || isArrayLike(source)) { 26373 copyObject(source, keys(source), object); 26374 return; 26375 } 26376 for (var key in source) { 26377 if (hasOwnProperty.call(source, key)) { 26378 assignValue(object, key, source[key]); 26379 } 26380 } 26381 }); 26382 26383 /** 26384 * This method is like `_.assign` except that it iterates over own and 26385 * inherited source properties. 26386 * 26387 * **Note:** This method mutates `object`. 26388 * 26389 * @static 26390 * @memberOf _ 26391 * @since 4.0.0 26392 * @alias extend 26393 * @category Object 26394 * @param {Object} object The destination object. 26395 * @param {...Object} [sources] The source objects. 26396 * @returns {Object} Returns `object`. 26397 * @see _.assign 26398 * @example 26399 * 26400 * function Foo() { 26401 * this.a = 1; 26402 * } 26403 * 26404 * function Bar() { 26405 * this.c = 3; 26406 * } 26407 * 26408 * Foo.prototype.b = 2; 26409 * Bar.prototype.d = 4; 26410 * 26411 * _.assignIn({ 'a': 0 }, new Foo, new Bar); 26412 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } 26413 */ 26414 var assignIn = createAssigner(function(object, source) { 26415 copyObject(source, keysIn(source), object); 26416 }); 26417 26418 /** 26419 * This method is like `_.assignIn` except that it accepts `customizer` 26420 * which is invoked to produce the assigned values. If `customizer` returns 26421 * `undefined`, assignment is handled by the method instead. The `customizer` 26422 * is invoked with five arguments: (objValue, srcValue, key, object, source). 26423 * 26424 * **Note:** This method mutates `object`. 26425 * 26426 * @static 26427 * @memberOf _ 26428 * @since 4.0.0 26429 * @alias extendWith 26430 * @category Object 26431 * @param {Object} object The destination object. 26432 * @param {...Object} sources The source objects. 26433 * @param {Function} [customizer] The function to customize assigned values. 26434 * @returns {Object} Returns `object`. 26435 * @see _.assignWith 26436 * @example 26437 * 26438 * function customizer(objValue, srcValue) { 26439 * return _.isUndefined(objValue) ? srcValue : objValue; 26440 * } 26441 * 26442 * var defaults = _.partialRight(_.assignInWith, customizer); 26443 * 26444 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 26445 * // => { 'a': 1, 'b': 2 } 26446 */ 26447 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 26448 copyObject(source, keysIn(source), object, customizer); 26449 }); 26450 26451 /** 26452 * This method is like `_.assign` except that it accepts `customizer` 26453 * which is invoked to produce the assigned values. If `customizer` returns 26454 * `undefined`, assignment is handled by the method instead. The `customizer` 26455 * is invoked with five arguments: (objValue, srcValue, key, object, source). 26456 * 26457 * **Note:** This method mutates `object`. 26458 * 26459 * @static 26460 * @memberOf _ 26461 * @since 4.0.0 26462 * @category Object 26463 * @param {Object} object The destination object. 26464 * @param {...Object} sources The source objects. 26465 * @param {Function} [customizer] The function to customize assigned values. 26466 * @returns {Object} Returns `object`. 26467 * @see _.assignInWith 26468 * @example 26469 * 26470 * function customizer(objValue, srcValue) { 26471 * return _.isUndefined(objValue) ? srcValue : objValue; 26472 * } 26473 * 26474 * var defaults = _.partialRight(_.assignWith, customizer); 26475 * 26476 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 26477 * // => { 'a': 1, 'b': 2 } 26478 */ 26479 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 26480 copyObject(source, keys(source), object, customizer); 26481 }); 26482 26483 /** 26484 * Creates an array of values corresponding to `paths` of `object`. 26485 * 26486 * @static 26487 * @memberOf _ 26488 * @since 1.0.0 26489 * @category Object 26490 * @param {Object} object The object to iterate over. 26491 * @param {...(string|string[])} [paths] The property paths to pick. 26492 * @returns {Array} Returns the picked values. 26493 * @example 26494 * 26495 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 26496 * 26497 * _.at(object, ['a[0].b.c', 'a[1]']); 26498 * // => [3, 4] 26499 */ 26500 var at = flatRest(baseAt); 26501 26502 /** 26503 * Creates an object that inherits from the `prototype` object. If a 26504 * `properties` object is given, its own enumerable string keyed properties 26505 * are assigned to the created object. 26506 * 26507 * @static 26508 * @memberOf _ 26509 * @since 2.3.0 26510 * @category Object 26511 * @param {Object} prototype The object to inherit from. 26512 * @param {Object} [properties] The properties to assign to the object. 26513 * @returns {Object} Returns the new object. 26514 * @example 26515 * 26516 * function Shape() { 26517 * this.x = 0; 26518 * this.y = 0; 26519 * } 26520 * 26521 * function Circle() { 26522 * Shape.call(this); 26523 * } 26524 * 26525 * Circle.prototype = _.create(Shape.prototype, { 26526 * 'constructor': Circle 26527 * }); 26528 * 26529 * var circle = new Circle; 26530 * circle instanceof Circle; 26531 * // => true 26532 * 26533 * circle instanceof Shape; 26534 * // => true 26535 */ 26536 function create(prototype, properties) { 26537 var result = baseCreate(prototype); 26538 return properties == null ? result : baseAssign(result, properties); 26539 } 26540 26541 /** 26542 * Assigns own and inherited enumerable string keyed properties of source 26543 * objects to the destination object for all destination properties that 26544 * resolve to `undefined`. Source objects are applied from left to right. 26545 * Once a property is set, additional values of the same property are ignored. 26546 * 26547 * **Note:** This method mutates `object`. 26548 * 26549 * @static 26550 * @since 0.1.0 26551 * @memberOf _ 26552 * @category Object 26553 * @param {Object} object The destination object. 26554 * @param {...Object} [sources] The source objects. 26555 * @returns {Object} Returns `object`. 26556 * @see _.defaultsDeep 26557 * @example 26558 * 26559 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 26560 * // => { 'a': 1, 'b': 2 } 26561 */ 26562 var defaults = baseRest(function(object, sources) { 26563 object = Object(object); 26564 26565 var index = -1; 26566 var length = sources.length; 26567 var guard = length > 2 ? sources[2] : undefined; 26568 26569 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 26570 length = 1; 26571 } 26572 26573 while (++index < length) { 26574 var source = sources[index]; 26575 var props = keysIn(source); 26576 var propsIndex = -1; 26577 var propsLength = props.length; 26578 26579 while (++propsIndex < propsLength) { 26580 var key = props[propsIndex]; 26581 var value = object[key]; 26582 26583 if (value === undefined || 26584 (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { 26585 object[key] = source[key]; 26586 } 26587 } 26588 } 26589 26590 return object; 26591 }); 26592 26593 /** 26594 * This method is like `_.defaults` except that it recursively assigns 26595 * default properties. 26596 * 26597 * **Note:** This method mutates `object`. 26598 * 26599 * @static 26600 * @memberOf _ 26601 * @since 3.10.0 26602 * @category Object 26603 * @param {Object} object The destination object. 26604 * @param {...Object} [sources] The source objects. 26605 * @returns {Object} Returns `object`. 26606 * @see _.defaults 26607 * @example 26608 * 26609 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); 26610 * // => { 'a': { 'b': 2, 'c': 3 } } 26611 */ 26612 var defaultsDeep = baseRest(function(args) { 26613 args.push(undefined, customDefaultsMerge); 26614 return apply(mergeWith, undefined, args); 26615 }); 26616 26617 /** 26618 * This method is like `_.find` except that it returns the key of the first 26619 * element `predicate` returns truthy for instead of the element itself. 26620 * 26621 * @static 26622 * @memberOf _ 26623 * @since 1.1.0 26624 * @category Object 26625 * @param {Object} object The object to inspect. 26626 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26627 * @returns {string|undefined} Returns the key of the matched element, 26628 * else `undefined`. 26629 * @example 26630 * 26631 * var users = { 26632 * 'barney': { 'age': 36, 'active': true }, 26633 * 'fred': { 'age': 40, 'active': false }, 26634 * 'pebbles': { 'age': 1, 'active': true } 26635 * }; 26636 * 26637 * _.findKey(users, function(o) { return o.age < 40; }); 26638 * // => 'barney' (iteration order is not guaranteed) 26639 * 26640 * // The `_.matches` iteratee shorthand. 26641 * _.findKey(users, { 'age': 1, 'active': true }); 26642 * // => 'pebbles' 26643 * 26644 * // The `_.matchesProperty` iteratee shorthand. 26645 * _.findKey(users, ['active', false]); 26646 * // => 'fred' 26647 * 26648 * // The `_.property` iteratee shorthand. 26649 * _.findKey(users, 'active'); 26650 * // => 'barney' 26651 */ 26652 function findKey(object, predicate) { 26653 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); 26654 } 26655 26656 /** 26657 * This method is like `_.findKey` except that it iterates over elements of 26658 * a collection in the opposite order. 26659 * 26660 * @static 26661 * @memberOf _ 26662 * @since 2.0.0 26663 * @category Object 26664 * @param {Object} object The object to inspect. 26665 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26666 * @returns {string|undefined} Returns the key of the matched element, 26667 * else `undefined`. 26668 * @example 26669 * 26670 * var users = { 26671 * 'barney': { 'age': 36, 'active': true }, 26672 * 'fred': { 'age': 40, 'active': false }, 26673 * 'pebbles': { 'age': 1, 'active': true } 26674 * }; 26675 * 26676 * _.findLastKey(users, function(o) { return o.age < 40; }); 26677 * // => returns 'pebbles' assuming `_.findKey` returns 'barney' 26678 * 26679 * // The `_.matches` iteratee shorthand. 26680 * _.findLastKey(users, { 'age': 36, 'active': true }); 26681 * // => 'barney' 26682 * 26683 * // The `_.matchesProperty` iteratee shorthand. 26684 * _.findLastKey(users, ['active', false]); 26685 * // => 'fred' 26686 * 26687 * // The `_.property` iteratee shorthand. 26688 * _.findLastKey(users, 'active'); 26689 * // => 'pebbles' 26690 */ 26691 function findLastKey(object, predicate) { 26692 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); 26693 } 26694 26695 /** 26696 * Iterates over own and inherited enumerable string keyed properties of an 26697 * object and invokes `iteratee` for each property. The iteratee is invoked 26698 * with three arguments: (value, key, object). Iteratee functions may exit 26699 * iteration early by explicitly returning `false`. 26700 * 26701 * @static 26702 * @memberOf _ 26703 * @since 0.3.0 26704 * @category Object 26705 * @param {Object} object The object to iterate over. 26706 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26707 * @returns {Object} Returns `object`. 26708 * @see _.forInRight 26709 * @example 26710 * 26711 * function Foo() { 26712 * this.a = 1; 26713 * this.b = 2; 26714 * } 26715 * 26716 * Foo.prototype.c = 3; 26717 * 26718 * _.forIn(new Foo, function(value, key) { 26719 * console.log(key); 26720 * }); 26721 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). 26722 */ 26723 function forIn(object, iteratee) { 26724 return object == null 26725 ? object 26726 : baseFor(object, getIteratee(iteratee, 3), keysIn); 26727 } 26728 26729 /** 26730 * This method is like `_.forIn` except that it iterates over properties of 26731 * `object` in the opposite order. 26732 * 26733 * @static 26734 * @memberOf _ 26735 * @since 2.0.0 26736 * @category Object 26737 * @param {Object} object The object to iterate over. 26738 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26739 * @returns {Object} Returns `object`. 26740 * @see _.forIn 26741 * @example 26742 * 26743 * function Foo() { 26744 * this.a = 1; 26745 * this.b = 2; 26746 * } 26747 * 26748 * Foo.prototype.c = 3; 26749 * 26750 * _.forInRight(new Foo, function(value, key) { 26751 * console.log(key); 26752 * }); 26753 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. 26754 */ 26755 function forInRight(object, iteratee) { 26756 return object == null 26757 ? object 26758 : baseForRight(object, getIteratee(iteratee, 3), keysIn); 26759 } 26760 26761 /** 26762 * Iterates over own enumerable string keyed properties of an object and 26763 * invokes `iteratee` for each property. The iteratee is invoked with three 26764 * arguments: (value, key, object). Iteratee functions may exit iteration 26765 * early by explicitly returning `false`. 26766 * 26767 * @static 26768 * @memberOf _ 26769 * @since 0.3.0 26770 * @category Object 26771 * @param {Object} object The object to iterate over. 26772 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26773 * @returns {Object} Returns `object`. 26774 * @see _.forOwnRight 26775 * @example 26776 * 26777 * function Foo() { 26778 * this.a = 1; 26779 * this.b = 2; 26780 * } 26781 * 26782 * Foo.prototype.c = 3; 26783 * 26784 * _.forOwn(new Foo, function(value, key) { 26785 * console.log(key); 26786 * }); 26787 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 26788 */ 26789 function forOwn(object, iteratee) { 26790 return object && baseForOwn(object, getIteratee(iteratee, 3)); 26791 } 26792 26793 /** 26794 * This method is like `_.forOwn` except that it iterates over properties of 26795 * `object` in the opposite order. 26796 * 26797 * @static 26798 * @memberOf _ 26799 * @since 2.0.0 26800 * @category Object 26801 * @param {Object} object The object to iterate over. 26802 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26803 * @returns {Object} Returns `object`. 26804 * @see _.forOwn 26805 * @example 26806 * 26807 * function Foo() { 26808 * this.a = 1; 26809 * this.b = 2; 26810 * } 26811 * 26812 * Foo.prototype.c = 3; 26813 * 26814 * _.forOwnRight(new Foo, function(value, key) { 26815 * console.log(key); 26816 * }); 26817 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. 26818 */ 26819 function forOwnRight(object, iteratee) { 26820 return object && baseForOwnRight(object, getIteratee(iteratee, 3)); 26821 } 26822 26823 /** 26824 * Creates an array of function property names from own enumerable properties 26825 * of `object`. 26826 * 26827 * @static 26828 * @since 0.1.0 26829 * @memberOf _ 26830 * @category Object 26831 * @param {Object} object The object to inspect. 26832 * @returns {Array} Returns the function names. 26833 * @see _.functionsIn 26834 * @example 26835 * 26836 * function Foo() { 26837 * this.a = _.constant('a'); 26838 * this.b = _.constant('b'); 26839 * } 26840 * 26841 * Foo.prototype.c = _.constant('c'); 26842 * 26843 * _.functions(new Foo); 26844 * // => ['a', 'b'] 26845 */ 26846 function functions(object) { 26847 return object == null ? [] : baseFunctions(object, keys(object)); 26848 } 26849 26850 /** 26851 * Creates an array of function property names from own and inherited 26852 * enumerable properties of `object`. 26853 * 26854 * @static 26855 * @memberOf _ 26856 * @since 4.0.0 26857 * @category Object 26858 * @param {Object} object The object to inspect. 26859 * @returns {Array} Returns the function names. 26860 * @see _.functions 26861 * @example 26862 * 26863 * function Foo() { 26864 * this.a = _.constant('a'); 26865 * this.b = _.constant('b'); 26866 * } 26867 * 26868 * Foo.prototype.c = _.constant('c'); 26869 * 26870 * _.functionsIn(new Foo); 26871 * // => ['a', 'b', 'c'] 26872 */ 26873 function functionsIn(object) { 26874 return object == null ? [] : baseFunctions(object, keysIn(object)); 26875 } 26876 26877 /** 26878 * Gets the value at `path` of `object`. If the resolved value is 26879 * `undefined`, the `defaultValue` is returned in its place. 26880 * 26881 * @static 26882 * @memberOf _ 26883 * @since 3.7.0 26884 * @category Object 26885 * @param {Object} object The object to query. 26886 * @param {Array|string} path The path of the property to get. 26887 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 26888 * @returns {*} Returns the resolved value. 26889 * @example 26890 * 26891 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 26892 * 26893 * _.get(object, 'a[0].b.c'); 26894 * // => 3 26895 * 26896 * _.get(object, ['a', '0', 'b', 'c']); 26897 * // => 3 26898 * 26899 * _.get(object, 'a.b.c', 'default'); 26900 * // => 'default' 26901 */ 26902 function get(object, path, defaultValue) { 26903 var result = object == null ? undefined : baseGet(object, path); 26904 return result === undefined ? defaultValue : result; 26905 } 26906 26907 /** 26908 * Checks if `path` is a direct property of `object`. 26909 * 26910 * @static 26911 * @since 0.1.0 26912 * @memberOf _ 26913 * @category Object 26914 * @param {Object} object The object to query. 26915 * @param {Array|string} path The path to check. 26916 * @returns {boolean} Returns `true` if `path` exists, else `false`. 26917 * @example 26918 * 26919 * var object = { 'a': { 'b': 2 } }; 26920 * var other = _.create({ 'a': _.create({ 'b': 2 }) }); 26921 * 26922 * _.has(object, 'a'); 26923 * // => true 26924 * 26925 * _.has(object, 'a.b'); 26926 * // => true 26927 * 26928 * _.has(object, ['a', 'b']); 26929 * // => true 26930 * 26931 * _.has(other, 'a'); 26932 * // => false 26933 */ 26934 function has(object, path) { 26935 return object != null && hasPath(object, path, baseHas); 26936 } 26937 26938 /** 26939 * Checks if `path` is a direct or inherited property of `object`. 26940 * 26941 * @static 26942 * @memberOf _ 26943 * @since 4.0.0 26944 * @category Object 26945 * @param {Object} object The object to query. 26946 * @param {Array|string} path The path to check. 26947 * @returns {boolean} Returns `true` if `path` exists, else `false`. 26948 * @example 26949 * 26950 * var object = _.create({ 'a': _.create({ 'b': 2 }) }); 26951 * 26952 * _.hasIn(object, 'a'); 26953 * // => true 26954 * 26955 * _.hasIn(object, 'a.b'); 26956 * // => true 26957 * 26958 * _.hasIn(object, ['a', 'b']); 26959 * // => true 26960 * 26961 * _.hasIn(object, 'b'); 26962 * // => false 26963 */ 26964 function hasIn(object, path) { 26965 return object != null && hasPath(object, path, baseHasIn); 26966 } 26967 26968 /** 26969 * Creates an object composed of the inverted keys and values of `object`. 26970 * If `object` contains duplicate values, subsequent values overwrite 26971 * property assignments of previous values. 26972 * 26973 * @static 26974 * @memberOf _ 26975 * @since 0.7.0 26976 * @category Object 26977 * @param {Object} object The object to invert. 26978 * @returns {Object} Returns the new inverted object. 26979 * @example 26980 * 26981 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 26982 * 26983 * _.invert(object); 26984 * // => { '1': 'c', '2': 'b' } 26985 */ 26986 var invert = createInverter(function(result, value, key) { 26987 if (value != null && 26988 typeof value.toString != 'function') { 26989 value = nativeObjectToString.call(value); 26990 } 26991 26992 result[value] = key; 26993 }, constant(identity)); 26994 26995 /** 26996 * This method is like `_.invert` except that the inverted object is generated 26997 * from the results of running each element of `object` thru `iteratee`. The 26998 * corresponding inverted value of each inverted key is an array of keys 26999 * responsible for generating the inverted value. The iteratee is invoked 27000 * with one argument: (value). 27001 * 27002 * @static 27003 * @memberOf _ 27004 * @since 4.1.0 27005 * @category Object 27006 * @param {Object} object The object to invert. 27007 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 27008 * @returns {Object} Returns the new inverted object. 27009 * @example 27010 * 27011 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 27012 * 27013 * _.invertBy(object); 27014 * // => { '1': ['a', 'c'], '2': ['b'] } 27015 * 27016 * _.invertBy(object, function(value) { 27017 * return 'group' + value; 27018 * }); 27019 * // => { 'group1': ['a', 'c'], 'group2': ['b'] } 27020 */ 27021 var invertBy = createInverter(function(result, value, key) { 27022 if (value != null && 27023 typeof value.toString != 'function') { 27024 value = nativeObjectToString.call(value); 27025 } 27026 27027 if (hasOwnProperty.call(result, value)) { 27028 result[value].push(key); 27029 } else { 27030 result[value] = [key]; 27031 } 27032 }, getIteratee); 27033 27034 /** 27035 * Invokes the method at `path` of `object`. 27036 * 27037 * @static 27038 * @memberOf _ 27039 * @since 4.0.0 27040 * @category Object 27041 * @param {Object} object The object to query. 27042 * @param {Array|string} path The path of the method to invoke. 27043 * @param {...*} [args] The arguments to invoke the method with. 27044 * @returns {*} Returns the result of the invoked method. 27045 * @example 27046 * 27047 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; 27048 * 27049 * _.invoke(object, 'a[0].b.c.slice', 1, 3); 27050 * // => [2, 3] 27051 */ 27052 var invoke = baseRest(baseInvoke); 27053 27054 /** 27055 * Creates an array of the own enumerable property names of `object`. 27056 * 27057 * **Note:** Non-object values are coerced to objects. See the 27058 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 27059 * for more details. 27060 * 27061 * @static 27062 * @since 0.1.0 27063 * @memberOf _ 27064 * @category Object 27065 * @param {Object} object The object to query. 27066 * @returns {Array} Returns the array of property names. 27067 * @example 27068 * 27069 * function Foo() { 27070 * this.a = 1; 27071 * this.b = 2; 27072 * } 27073 * 27074 * Foo.prototype.c = 3; 27075 * 27076 * _.keys(new Foo); 27077 * // => ['a', 'b'] (iteration order is not guaranteed) 27078 * 27079 * _.keys('hi'); 27080 * // => ['0', '1'] 27081 */ 27082 function keys(object) { 27083 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 27084 } 27085 27086 /** 27087 * Creates an array of the own and inherited enumerable property names of `object`. 27088 * 27089 * **Note:** Non-object values are coerced to objects. 27090 * 27091 * @static 27092 * @memberOf _ 27093 * @since 3.0.0 27094 * @category Object 27095 * @param {Object} object The object to query. 27096 * @returns {Array} Returns the array of property names. 27097 * @example 27098 * 27099 * function Foo() { 27100 * this.a = 1; 27101 * this.b = 2; 27102 * } 27103 * 27104 * Foo.prototype.c = 3; 27105 * 27106 * _.keysIn(new Foo); 27107 * // => ['a', 'b', 'c'] (iteration order is not guaranteed) 27108 */ 27109 function keysIn(object) { 27110 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 27111 } 27112 27113 /** 27114 * The opposite of `_.mapValues`; this method creates an object with the 27115 * same values as `object` and keys generated by running each own enumerable 27116 * string keyed property of `object` thru `iteratee`. The iteratee is invoked 27117 * with three arguments: (value, key, object). 27118 * 27119 * @static 27120 * @memberOf _ 27121 * @since 3.8.0 27122 * @category Object 27123 * @param {Object} object The object to iterate over. 27124 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 27125 * @returns {Object} Returns the new mapped object. 27126 * @see _.mapValues 27127 * @example 27128 * 27129 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { 27130 * return key + value; 27131 * }); 27132 * // => { 'a1': 1, 'b2': 2 } 27133 */ 27134 function mapKeys(object, iteratee) { 27135 var result = {}; 27136 iteratee = getIteratee(iteratee, 3); 27137 27138 baseForOwn(object, function(value, key, object) { 27139 baseAssignValue(result, iteratee(value, key, object), value); 27140 }); 27141 return result; 27142 } 27143 27144 /** 27145 * Creates an object with the same keys as `object` and values generated 27146 * by running each own enumerable string keyed property of `object` thru 27147 * `iteratee`. The iteratee is invoked with three arguments: 27148 * (value, key, object). 27149 * 27150 * @static 27151 * @memberOf _ 27152 * @since 2.4.0 27153 * @category Object 27154 * @param {Object} object The object to iterate over. 27155 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 27156 * @returns {Object} Returns the new mapped object. 27157 * @see _.mapKeys 27158 * @example 27159 * 27160 * var users = { 27161 * 'fred': { 'user': 'fred', 'age': 40 }, 27162 * 'pebbles': { 'user': 'pebbles', 'age': 1 } 27163 * }; 27164 * 27165 * _.mapValues(users, function(o) { return o.age; }); 27166 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 27167 * 27168 * // The `_.property` iteratee shorthand. 27169 * _.mapValues(users, 'age'); 27170 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 27171 */ 27172 function mapValues(object, iteratee) { 27173 var result = {}; 27174 iteratee = getIteratee(iteratee, 3); 27175 27176 baseForOwn(object, function(value, key, object) { 27177 baseAssignValue(result, key, iteratee(value, key, object)); 27178 }); 27179 return result; 27180 } 27181 27182 /** 27183 * This method is like `_.assign` except that it recursively merges own and 27184 * inherited enumerable string keyed properties of source objects into the 27185 * destination object. Source properties that resolve to `undefined` are 27186 * skipped if a destination value exists. Array and plain object properties 27187 * are merged recursively. Other objects and value types are overridden by 27188 * assignment. Source objects are applied from left to right. Subsequent 27189 * sources overwrite property assignments of previous sources. 27190 * 27191 * **Note:** This method mutates `object`. 27192 * 27193 * @static 27194 * @memberOf _ 27195 * @since 0.5.0 27196 * @category Object 27197 * @param {Object} object The destination object. 27198 * @param {...Object} [sources] The source objects. 27199 * @returns {Object} Returns `object`. 27200 * @example 27201 * 27202 * var object = { 27203 * 'a': [{ 'b': 2 }, { 'd': 4 }] 27204 * }; 27205 * 27206 * var other = { 27207 * 'a': [{ 'c': 3 }, { 'e': 5 }] 27208 * }; 27209 * 27210 * _.merge(object, other); 27211 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } 27212 */ 27213 var merge = createAssigner(function(object, source, srcIndex) { 27214 baseMerge(object, source, srcIndex); 27215 }); 27216 27217 /** 27218 * This method is like `_.merge` except that it accepts `customizer` which 27219 * is invoked to produce the merged values of the destination and source 27220 * properties. If `customizer` returns `undefined`, merging is handled by the 27221 * method instead. The `customizer` is invoked with six arguments: 27222 * (objValue, srcValue, key, object, source, stack). 27223 * 27224 * **Note:** This method mutates `object`. 27225 * 27226 * @static 27227 * @memberOf _ 27228 * @since 4.0.0 27229 * @category Object 27230 * @param {Object} object The destination object. 27231 * @param {...Object} sources The source objects. 27232 * @param {Function} customizer The function to customize assigned values. 27233 * @returns {Object} Returns `object`. 27234 * @example 27235 * 27236 * function customizer(objValue, srcValue) { 27237 * if (_.isArray(objValue)) { 27238 * return objValue.concat(srcValue); 27239 * } 27240 * } 27241 * 27242 * var object = { 'a': [1], 'b': [2] }; 27243 * var other = { 'a': [3], 'b': [4] }; 27244 * 27245 * _.mergeWith(object, other, customizer); 27246 * // => { 'a': [1, 3], 'b': [2, 4] } 27247 */ 27248 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 27249 baseMerge(object, source, srcIndex, customizer); 27250 }); 27251 27252 /** 27253 * The opposite of `_.pick`; this method creates an object composed of the 27254 * own and inherited enumerable property paths of `object` that are not omitted. 27255 * 27256 * **Note:** This method is considerably slower than `_.pick`. 27257 * 27258 * @static 27259 * @since 0.1.0 27260 * @memberOf _ 27261 * @category Object 27262 * @param {Object} object The source object. 27263 * @param {...(string|string[])} [paths] The property paths to omit. 27264 * @returns {Object} Returns the new object. 27265 * @example 27266 * 27267 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 27268 * 27269 * _.omit(object, ['a', 'c']); 27270 * // => { 'b': '2' } 27271 */ 27272 var omit = flatRest(function(object, paths) { 27273 var result = {}; 27274 if (object == null) { 27275 return result; 27276 } 27277 var isDeep = false; 27278 paths = arrayMap(paths, function(path) { 27279 path = castPath(path, object); 27280 isDeep || (isDeep = path.length > 1); 27281 return path; 27282 }); 27283 copyObject(object, getAllKeysIn(object), result); 27284 if (isDeep) { 27285 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 27286 } 27287 var length = paths.length; 27288 while (length--) { 27289 baseUnset(result, paths[length]); 27290 } 27291 return result; 27292 }); 27293 27294 /** 27295 * The opposite of `_.pickBy`; this method creates an object composed of 27296 * the own and inherited enumerable string keyed properties of `object` that 27297 * `predicate` doesn't return truthy for. The predicate is invoked with two 27298 * arguments: (value, key). 27299 * 27300 * @static 27301 * @memberOf _ 27302 * @since 4.0.0 27303 * @category Object 27304 * @param {Object} object The source object. 27305 * @param {Function} [predicate=_.identity] The function invoked per property. 27306 * @returns {Object} Returns the new object. 27307 * @example 27308 * 27309 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 27310 * 27311 * _.omitBy(object, _.isNumber); 27312 * // => { 'b': '2' } 27313 */ 27314 function omitBy(object, predicate) { 27315 return pickBy(object, negate(getIteratee(predicate))); 27316 } 27317 27318 /** 27319 * Creates an object composed of the picked `object` properties. 27320 * 27321 * @static 27322 * @since 0.1.0 27323 * @memberOf _ 27324 * @category Object 27325 * @param {Object} object The source object. 27326 * @param {...(string|string[])} [paths] The property paths to pick. 27327 * @returns {Object} Returns the new object. 27328 * @example 27329 * 27330 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 27331 * 27332 * _.pick(object, ['a', 'c']); 27333 * // => { 'a': 1, 'c': 3 } 27334 */ 27335 var pick = flatRest(function(object, paths) { 27336 return object == null ? {} : basePick(object, paths); 27337 }); 27338 27339 /** 27340 * Creates an object composed of the `object` properties `predicate` returns 27341 * truthy for. The predicate is invoked with two arguments: (value, key). 27342 * 27343 * @static 27344 * @memberOf _ 27345 * @since 4.0.0 27346 * @category Object 27347 * @param {Object} object The source object. 27348 * @param {Function} [predicate=_.identity] The function invoked per property. 27349 * @returns {Object} Returns the new object. 27350 * @example 27351 * 27352 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 27353 * 27354 * _.pickBy(object, _.isNumber); 27355 * // => { 'a': 1, 'c': 3 } 27356 */ 27357 function pickBy(object, predicate) { 27358 if (object == null) { 27359 return {}; 27360 } 27361 var props = arrayMap(getAllKeysIn(object), function(prop) { 27362 return [prop]; 27363 }); 27364 predicate = getIteratee(predicate); 27365 return basePickBy(object, props, function(value, path) { 27366 return predicate(value, path[0]); 27367 }); 27368 } 27369 27370 /** 27371 * This method is like `_.get` except that if the resolved value is a 27372 * function it's invoked with the `this` binding of its parent object and 27373 * its result is returned. 27374 * 27375 * @static 27376 * @since 0.1.0 27377 * @memberOf _ 27378 * @category Object 27379 * @param {Object} object The object to query. 27380 * @param {Array|string} path The path of the property to resolve. 27381 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 27382 * @returns {*} Returns the resolved value. 27383 * @example 27384 * 27385 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; 27386 * 27387 * _.result(object, 'a[0].b.c1'); 27388 * // => 3 27389 * 27390 * _.result(object, 'a[0].b.c2'); 27391 * // => 4 27392 * 27393 * _.result(object, 'a[0].b.c3', 'default'); 27394 * // => 'default' 27395 * 27396 * _.result(object, 'a[0].b.c3', _.constant('default')); 27397 * // => 'default' 27398 */ 27399 function result(object, path, defaultValue) { 27400 path = castPath(path, object); 27401 27402 var index = -1, 27403 length = path.length; 27404 27405 // Ensure the loop is entered when path is empty. 27406 if (!length) { 27407 length = 1; 27408 object = undefined; 27409 } 27410 while (++index < length) { 27411 var value = object == null ? undefined : object[toKey(path[index])]; 27412 if (value === undefined) { 27413 index = length; 27414 value = defaultValue; 27415 } 27416 object = isFunction(value) ? value.call(object) : value; 27417 } 27418 return object; 27419 } 27420 27421 /** 27422 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, 27423 * it's created. Arrays are created for missing index properties while objects 27424 * are created for all other missing properties. Use `_.setWith` to customize 27425 * `path` creation. 27426 * 27427 * **Note:** This method mutates `object`. 27428 * 27429 * @static 27430 * @memberOf _ 27431 * @since 3.7.0 27432 * @category Object 27433 * @param {Object} object The object to modify. 27434 * @param {Array|string} path The path of the property to set. 27435 * @param {*} value The value to set. 27436 * @returns {Object} Returns `object`. 27437 * @example 27438 * 27439 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 27440 * 27441 * _.set(object, 'a[0].b.c', 4); 27442 * console.log(object.a[0].b.c); 27443 * // => 4 27444 * 27445 * _.set(object, ['x', '0', 'y', 'z'], 5); 27446 * console.log(object.x[0].y.z); 27447 * // => 5 27448 */ 27449 function set(object, path, value) { 27450 return object == null ? object : baseSet(object, path, value); 27451 } 27452 27453 /** 27454 * This method is like `_.set` except that it accepts `customizer` which is 27455 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 27456 * path creation is handled by the method instead. The `customizer` is invoked 27457 * with three arguments: (nsValue, key, nsObject). 27458 * 27459 * **Note:** This method mutates `object`. 27460 * 27461 * @static 27462 * @memberOf _ 27463 * @since 4.0.0 27464 * @category Object 27465 * @param {Object} object The object to modify. 27466 * @param {Array|string} path The path of the property to set. 27467 * @param {*} value The value to set. 27468 * @param {Function} [customizer] The function to customize assigned values. 27469 * @returns {Object} Returns `object`. 27470 * @example 27471 * 27472 * var object = {}; 27473 * 27474 * _.setWith(object, '[0][1]', 'a', Object); 27475 * // => { '0': { '1': 'a' } } 27476 */ 27477 function setWith(object, path, value, customizer) { 27478 customizer = typeof customizer == 'function' ? customizer : undefined; 27479 return object == null ? object : baseSet(object, path, value, customizer); 27480 } 27481 27482 /** 27483 * Creates an array of own enumerable string keyed-value pairs for `object` 27484 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its 27485 * entries are returned. 27486 * 27487 * @static 27488 * @memberOf _ 27489 * @since 4.0.0 27490 * @alias entries 27491 * @category Object 27492 * @param {Object} object The object to query. 27493 * @returns {Array} Returns the key-value pairs. 27494 * @example 27495 * 27496 * function Foo() { 27497 * this.a = 1; 27498 * this.b = 2; 27499 * } 27500 * 27501 * Foo.prototype.c = 3; 27502 * 27503 * _.toPairs(new Foo); 27504 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) 27505 */ 27506 var toPairs = createToPairs(keys); 27507 27508 /** 27509 * Creates an array of own and inherited enumerable string keyed-value pairs 27510 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map 27511 * or set, its entries are returned. 27512 * 27513 * @static 27514 * @memberOf _ 27515 * @since 4.0.0 27516 * @alias entriesIn 27517 * @category Object 27518 * @param {Object} object The object to query. 27519 * @returns {Array} Returns the key-value pairs. 27520 * @example 27521 * 27522 * function Foo() { 27523 * this.a = 1; 27524 * this.b = 2; 27525 * } 27526 * 27527 * Foo.prototype.c = 3; 27528 * 27529 * _.toPairsIn(new Foo); 27530 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) 27531 */ 27532 var toPairsIn = createToPairs(keysIn); 27533 27534 /** 27535 * An alternative to `_.reduce`; this method transforms `object` to a new 27536 * `accumulator` object which is the result of running each of its own 27537 * enumerable string keyed properties thru `iteratee`, with each invocation 27538 * potentially mutating the `accumulator` object. If `accumulator` is not 27539 * provided, a new object with the same `[[Prototype]]` will be used. The 27540 * iteratee is invoked with four arguments: (accumulator, value, key, object). 27541 * Iteratee functions may exit iteration early by explicitly returning `false`. 27542 * 27543 * @static 27544 * @memberOf _ 27545 * @since 1.3.0 27546 * @category Object 27547 * @param {Object} object The object to iterate over. 27548 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 27549 * @param {*} [accumulator] The custom accumulator value. 27550 * @returns {*} Returns the accumulated value. 27551 * @example 27552 * 27553 * _.transform([2, 3, 4], function(result, n) { 27554 * result.push(n *= n); 27555 * return n % 2 == 0; 27556 * }, []); 27557 * // => [4, 9] 27558 * 27559 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 27560 * (result[value] || (result[value] = [])).push(key); 27561 * }, {}); 27562 * // => { '1': ['a', 'c'], '2': ['b'] } 27563 */ 27564 function transform(object, iteratee, accumulator) { 27565 var isArr = isArray(object), 27566 isArrLike = isArr || isBuffer(object) || isTypedArray(object); 27567 27568 iteratee = getIteratee(iteratee, 4); 27569 if (accumulator == null) { 27570 var Ctor = object && object.constructor; 27571 if (isArrLike) { 27572 accumulator = isArr ? new Ctor : []; 27573 } 27574 else if (isObject(object)) { 27575 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 27576 } 27577 else { 27578 accumulator = {}; 27579 } 27580 } 27581 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { 27582 return iteratee(accumulator, value, index, object); 27583 }); 27584 return accumulator; 27585 } 27586 27587 /** 27588 * Removes the property at `path` of `object`. 27589 * 27590 * **Note:** This method mutates `object`. 27591 * 27592 * @static 27593 * @memberOf _ 27594 * @since 4.0.0 27595 * @category Object 27596 * @param {Object} object The object to modify. 27597 * @param {Array|string} path The path of the property to unset. 27598 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 27599 * @example 27600 * 27601 * var object = { 'a': [{ 'b': { 'c': 7 } }] }; 27602 * _.unset(object, 'a[0].b.c'); 27603 * // => true 27604 * 27605 * console.log(object); 27606 * // => { 'a': [{ 'b': {} }] }; 27607 * 27608 * _.unset(object, ['a', '0', 'b', 'c']); 27609 * // => true 27610 * 27611 * console.log(object); 27612 * // => { 'a': [{ 'b': {} }] }; 27613 */ 27614 function unset(object, path) { 27615 return object == null ? true : baseUnset(object, path); 27616 } 27617 27618 /** 27619 * This method is like `_.set` except that accepts `updater` to produce the 27620 * value to set. Use `_.updateWith` to customize `path` creation. The `updater` 27621 * is invoked with one argument: (value). 27622 * 27623 * **Note:** This method mutates `object`. 27624 * 27625 * @static 27626 * @memberOf _ 27627 * @since 4.6.0 27628 * @category Object 27629 * @param {Object} object The object to modify. 27630 * @param {Array|string} path The path of the property to set. 27631 * @param {Function} updater The function to produce the updated value. 27632 * @returns {Object} Returns `object`. 27633 * @example 27634 * 27635 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 27636 * 27637 * _.update(object, 'a[0].b.c', function(n) { return n * n; }); 27638 * console.log(object.a[0].b.c); 27639 * // => 9 27640 * 27641 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); 27642 * console.log(object.x[0].y.z); 27643 * // => 0 27644 */ 27645 function update(object, path, updater) { 27646 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 27647 } 27648 27649 /** 27650 * This method is like `_.update` except that it accepts `customizer` which is 27651 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 27652 * path creation is handled by the method instead. The `customizer` is invoked 27653 * with three arguments: (nsValue, key, nsObject). 27654 * 27655 * **Note:** This method mutates `object`. 27656 * 27657 * @static 27658 * @memberOf _ 27659 * @since 4.6.0 27660 * @category Object 27661 * @param {Object} object The object to modify. 27662 * @param {Array|string} path The path of the property to set. 27663 * @param {Function} updater The function to produce the updated value. 27664 * @param {Function} [customizer] The function to customize assigned values. 27665 * @returns {Object} Returns `object`. 27666 * @example 27667 * 27668 * var object = {}; 27669 * 27670 * _.updateWith(object, '[0][1]', _.constant('a'), Object); 27671 * // => { '0': { '1': 'a' } } 27672 */ 27673 function updateWith(object, path, updater, customizer) { 27674 customizer = typeof customizer == 'function' ? customizer : undefined; 27675 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 27676 } 27677 27678 /** 27679 * Creates an array of the own enumerable string keyed property values of `object`. 27680 * 27681 * **Note:** Non-object values are coerced to objects. 27682 * 27683 * @static 27684 * @since 0.1.0 27685 * @memberOf _ 27686 * @category Object 27687 * @param {Object} object The object to query. 27688 * @returns {Array} Returns the array of property values. 27689 * @example 27690 * 27691 * function Foo() { 27692 * this.a = 1; 27693 * this.b = 2; 27694 * } 27695 * 27696 * Foo.prototype.c = 3; 27697 * 27698 * _.values(new Foo); 27699 * // => [1, 2] (iteration order is not guaranteed) 27700 * 27701 * _.values('hi'); 27702 * // => ['h', 'i'] 27703 */ 27704 function values(object) { 27705 return object == null ? [] : baseValues(object, keys(object)); 27706 } 27707 27708 /** 27709 * Creates an array of the own and inherited enumerable string keyed property 27710 * values of `object`. 27711 * 27712 * **Note:** Non-object values are coerced to objects. 27713 * 27714 * @static 27715 * @memberOf _ 27716 * @since 3.0.0 27717 * @category Object 27718 * @param {Object} object The object to query. 27719 * @returns {Array} Returns the array of property values. 27720 * @example 27721 * 27722 * function Foo() { 27723 * this.a = 1; 27724 * this.b = 2; 27725 * } 27726 * 27727 * Foo.prototype.c = 3; 27728 * 27729 * _.valuesIn(new Foo); 27730 * // => [1, 2, 3] (iteration order is not guaranteed) 27731 */ 27732 function valuesIn(object) { 27733 return object == null ? [] : baseValues(object, keysIn(object)); 27734 } 27735 27736 /*------------------------------------------------------------------------*/ 27737 27738 /** 27739 * Clamps `number` within the inclusive `lower` and `upper` bounds. 27740 * 27741 * @static 27742 * @memberOf _ 27743 * @since 4.0.0 27744 * @category Number 27745 * @param {number} number The number to clamp. 27746 * @param {number} [lower] The lower bound. 27747 * @param {number} upper The upper bound. 27748 * @returns {number} Returns the clamped number. 27749 * @example 27750 * 27751 * _.clamp(-10, -5, 5); 27752 * // => -5 27753 * 27754 * _.clamp(10, -5, 5); 27755 * // => 5 27756 */ 27757 function clamp(number, lower, upper) { 27758 if (upper === undefined) { 27759 upper = lower; 27760 lower = undefined; 27761 } 27762 if (upper !== undefined) { 27763 upper = toNumber(upper); 27764 upper = upper === upper ? upper : 0; 27765 } 27766 if (lower !== undefined) { 27767 lower = toNumber(lower); 27768 lower = lower === lower ? lower : 0; 27769 } 27770 return baseClamp(toNumber(number), lower, upper); 27771 } 27772 27773 /** 27774 * Checks if `n` is between `start` and up to, but not including, `end`. If 27775 * `end` is not specified, it's set to `start` with `start` then set to `0`. 27776 * If `start` is greater than `end` the params are swapped to support 27777 * negative ranges. 27778 * 27779 * @static 27780 * @memberOf _ 27781 * @since 3.3.0 27782 * @category Number 27783 * @param {number} number The number to check. 27784 * @param {number} [start=0] The start of the range. 27785 * @param {number} end The end of the range. 27786 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 27787 * @see _.range, _.rangeRight 27788 * @example 27789 * 27790 * _.inRange(3, 2, 4); 27791 * // => true 27792 * 27793 * _.inRange(4, 8); 27794 * // => true 27795 * 27796 * _.inRange(4, 2); 27797 * // => false 27798 * 27799 * _.inRange(2, 2); 27800 * // => false 27801 * 27802 * _.inRange(1.2, 2); 27803 * // => true 27804 * 27805 * _.inRange(5.2, 4); 27806 * // => false 27807 * 27808 * _.inRange(-3, -2, -6); 27809 * // => true 27810 */ 27811 function inRange(number, start, end) { 27812 start = toFinite(start); 27813 if (end === undefined) { 27814 end = start; 27815 start = 0; 27816 } else { 27817 end = toFinite(end); 27818 } 27819 number = toNumber(number); 27820 return baseInRange(number, start, end); 27821 } 27822 27823 /** 27824 * Produces a random number between the inclusive `lower` and `upper` bounds. 27825 * If only one argument is provided a number between `0` and the given number 27826 * is returned. If `floating` is `true`, or either `lower` or `upper` are 27827 * floats, a floating-point number is returned instead of an integer. 27828 * 27829 * **Note:** JavaScript follows the IEEE-754 standard for resolving 27830 * floating-point values which can produce unexpected results. 27831 * 27832 * @static 27833 * @memberOf _ 27834 * @since 0.7.0 27835 * @category Number 27836 * @param {number} [lower=0] The lower bound. 27837 * @param {number} [upper=1] The upper bound. 27838 * @param {boolean} [floating] Specify returning a floating-point number. 27839 * @returns {number} Returns the random number. 27840 * @example 27841 * 27842 * _.random(0, 5); 27843 * // => an integer between 0 and 5 27844 * 27845 * _.random(5); 27846 * // => also an integer between 0 and 5 27847 * 27848 * _.random(5, true); 27849 * // => a floating-point number between 0 and 5 27850 * 27851 * _.random(1.2, 5.2); 27852 * // => a floating-point number between 1.2 and 5.2 27853 */ 27854 function random(lower, upper, floating) { 27855 if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { 27856 upper = floating = undefined; 27857 } 27858 if (floating === undefined) { 27859 if (typeof upper == 'boolean') { 27860 floating = upper; 27861 upper = undefined; 27862 } 27863 else if (typeof lower == 'boolean') { 27864 floating = lower; 27865 lower = undefined; 27866 } 27867 } 27868 if (lower === undefined && upper === undefined) { 27869 lower = 0; 27870 upper = 1; 27871 } 27872 else { 27873 lower = toFinite(lower); 27874 if (upper === undefined) { 27875 upper = lower; 27876 lower = 0; 27877 } else { 27878 upper = toFinite(upper); 27879 } 27880 } 27881 if (lower > upper) { 27882 var temp = lower; 27883 lower = upper; 27884 upper = temp; 27885 } 27886 if (floating || lower % 1 || upper % 1) { 27887 var rand = nativeRandom(); 27888 return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); 27889 } 27890 return baseRandom(lower, upper); 27891 } 27892 27893 /*------------------------------------------------------------------------*/ 27894 27895 /** 27896 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 27897 * 27898 * @static 27899 * @memberOf _ 27900 * @since 3.0.0 27901 * @category String 27902 * @param {string} [string=''] The string to convert. 27903 * @returns {string} Returns the camel cased string. 27904 * @example 27905 * 27906 * _.camelCase('Foo Bar'); 27907 * // => 'fooBar' 27908 * 27909 * _.camelCase('--foo-bar--'); 27910 * // => 'fooBar' 27911 * 27912 * _.camelCase('__FOO_BAR__'); 27913 * // => 'fooBar' 27914 */ 27915 var camelCase = createCompounder(function(result, word, index) { 27916 word = word.toLowerCase(); 27917 return result + (index ? capitalize(word) : word); 27918 }); 27919 27920 /** 27921 * Converts the first character of `string` to upper case and the remaining 27922 * to lower case. 27923 * 27924 * @static 27925 * @memberOf _ 27926 * @since 3.0.0 27927 * @category String 27928 * @param {string} [string=''] The string to capitalize. 27929 * @returns {string} Returns the capitalized string. 27930 * @example 27931 * 27932 * _.capitalize('FRED'); 27933 * // => 'Fred' 27934 */ 27935 function capitalize(string) { 27936 return upperFirst(toString(string).toLowerCase()); 27937 } 27938 27939 /** 27940 * Deburrs `string` by converting 27941 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) 27942 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) 27943 * letters to basic Latin letters and removing 27944 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). 27945 * 27946 * @static 27947 * @memberOf _ 27948 * @since 3.0.0 27949 * @category String 27950 * @param {string} [string=''] The string to deburr. 27951 * @returns {string} Returns the deburred string. 27952 * @example 27953 * 27954 * _.deburr('déjàvu'); 27955 * // => 'deja vu' 27956 */ 27957 function deburr(string) { 27958 string = toString(string); 27959 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); 27960 } 27961 27962 /** 27963 * Checks if `string` ends with the given target string. 27964 * 27965 * @static 27966 * @memberOf _ 27967 * @since 3.0.0 27968 * @category String 27969 * @param {string} [string=''] The string to inspect. 27970 * @param {string} [target] The string to search for. 27971 * @param {number} [position=string.length] The position to search up to. 27972 * @returns {boolean} Returns `true` if `string` ends with `target`, 27973 * else `false`. 27974 * @example 27975 * 27976 * _.endsWith('abc', 'c'); 27977 * // => true 27978 * 27979 * _.endsWith('abc', 'b'); 27980 * // => false 27981 * 27982 * _.endsWith('abc', 'b', 2); 27983 * // => true 27984 */ 27985 function endsWith(string, target, position) { 27986 string = toString(string); 27987 target = baseToString(target); 27988 27989 var length = string.length; 27990 position = position === undefined 27991 ? length 27992 : baseClamp(toInteger(position), 0, length); 27993 27994 var end = position; 27995 position -= target.length; 27996 return position >= 0 && string.slice(position, end) == target; 27997 } 27998 27999 /** 28000 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their 28001 * corresponding HTML entities. 28002 * 28003 * **Note:** No other characters are escaped. To escape additional 28004 * characters use a third-party library like [_he_](https://mths.be/he). 28005 * 28006 * Though the ">" character is escaped for symmetry, characters like 28007 * ">" and "/" don't need escaping in HTML and have no special meaning 28008 * unless they're part of a tag or unquoted attribute value. See 28009 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) 28010 * (under "semi-related fun fact") for more details. 28011 * 28012 * When working with HTML you should always 28013 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce 28014 * XSS vectors. 28015 * 28016 * @static 28017 * @since 0.1.0 28018 * @memberOf _ 28019 * @category String 28020 * @param {string} [string=''] The string to escape. 28021 * @returns {string} Returns the escaped string. 28022 * @example 28023 * 28024 * _.escape('fred, barney, & pebbles'); 28025 * // => 'fred, barney, & pebbles' 28026 */ 28027 function escape(string) { 28028 string = toString(string); 28029 return (string && reHasUnescapedHtml.test(string)) 28030 ? string.replace(reUnescapedHtml, escapeHtmlChar) 28031 : string; 28032 } 28033 28034 /** 28035 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", 28036 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. 28037 * 28038 * @static 28039 * @memberOf _ 28040 * @since 3.0.0 28041 * @category String 28042 * @param {string} [string=''] The string to escape. 28043 * @returns {string} Returns the escaped string. 28044 * @example 28045 * 28046 * _.escapeRegExp('[lodash](https://lodash.com/)'); 28047 * // => '\[lodash\]\(https://lodash\.com/\)' 28048 */ 28049 function escapeRegExp(string) { 28050 string = toString(string); 28051 return (string && reHasRegExpChar.test(string)) 28052 ? string.replace(reRegExpChar, '\\$&') 28053 : string; 28054 } 28055 28056 /** 28057 * Converts `string` to 28058 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 28059 * 28060 * @static 28061 * @memberOf _ 28062 * @since 3.0.0 28063 * @category String 28064 * @param {string} [string=''] The string to convert. 28065 * @returns {string} Returns the kebab cased string. 28066 * @example 28067 * 28068 * _.kebabCase('Foo Bar'); 28069 * // => 'foo-bar' 28070 * 28071 * _.kebabCase('fooBar'); 28072 * // => 'foo-bar' 28073 * 28074 * _.kebabCase('__FOO_BAR__'); 28075 * // => 'foo-bar' 28076 */ 28077 var kebabCase = createCompounder(function(result, word, index) { 28078 return result + (index ? '-' : '') + word.toLowerCase(); 28079 }); 28080 28081 /** 28082 * Converts `string`, as space separated words, to lower case. 28083 * 28084 * @static 28085 * @memberOf _ 28086 * @since 4.0.0 28087 * @category String 28088 * @param {string} [string=''] The string to convert. 28089 * @returns {string} Returns the lower cased string. 28090 * @example 28091 * 28092 * _.lowerCase('--Foo-Bar--'); 28093 * // => 'foo bar' 28094 * 28095 * _.lowerCase('fooBar'); 28096 * // => 'foo bar' 28097 * 28098 * _.lowerCase('__FOO_BAR__'); 28099 * // => 'foo bar' 28100 */ 28101 var lowerCase = createCompounder(function(result, word, index) { 28102 return result + (index ? ' ' : '') + word.toLowerCase(); 28103 }); 28104 28105 /** 28106 * Converts the first character of `string` to lower case. 28107 * 28108 * @static 28109 * @memberOf _ 28110 * @since 4.0.0 28111 * @category String 28112 * @param {string} [string=''] The string to convert. 28113 * @returns {string} Returns the converted string. 28114 * @example 28115 * 28116 * _.lowerFirst('Fred'); 28117 * // => 'fred' 28118 * 28119 * _.lowerFirst('FRED'); 28120 * // => 'fRED' 28121 */ 28122 var lowerFirst = createCaseFirst('toLowerCase'); 28123 28124 /** 28125 * Pads `string` on the left and right sides if it's shorter than `length`. 28126 * Padding characters are truncated if they can't be evenly divided by `length`. 28127 * 28128 * @static 28129 * @memberOf _ 28130 * @since 3.0.0 28131 * @category String 28132 * @param {string} [string=''] The string to pad. 28133 * @param {number} [length=0] The padding length. 28134 * @param {string} [chars=' '] The string used as padding. 28135 * @returns {string} Returns the padded string. 28136 * @example 28137 * 28138 * _.pad('abc', 8); 28139 * // => ' abc ' 28140 * 28141 * _.pad('abc', 8, '_-'); 28142 * // => '_-abc_-_' 28143 * 28144 * _.pad('abc', 3); 28145 * // => 'abc' 28146 */ 28147 function pad(string, length, chars) { 28148 string = toString(string); 28149 length = toInteger(length); 28150 28151 var strLength = length ? stringSize(string) : 0; 28152 if (!length || strLength >= length) { 28153 return string; 28154 } 28155 var mid = (length - strLength) / 2; 28156 return ( 28157 createPadding(nativeFloor(mid), chars) + 28158 string + 28159 createPadding(nativeCeil(mid), chars) 28160 ); 28161 } 28162 28163 /** 28164 * Pads `string` on the right side if it's shorter than `length`. Padding 28165 * characters are truncated if they exceed `length`. 28166 * 28167 * @static 28168 * @memberOf _ 28169 * @since 4.0.0 28170 * @category String 28171 * @param {string} [string=''] The string to pad. 28172 * @param {number} [length=0] The padding length. 28173 * @param {string} [chars=' '] The string used as padding. 28174 * @returns {string} Returns the padded string. 28175 * @example 28176 * 28177 * _.padEnd('abc', 6); 28178 * // => 'abc ' 28179 * 28180 * _.padEnd('abc', 6, '_-'); 28181 * // => 'abc_-_' 28182 * 28183 * _.padEnd('abc', 3); 28184 * // => 'abc' 28185 */ 28186 function padEnd(string, length, chars) { 28187 string = toString(string); 28188 length = toInteger(length); 28189 28190 var strLength = length ? stringSize(string) : 0; 28191 return (length && strLength < length) 28192 ? (string + createPadding(length - strLength, chars)) 28193 : string; 28194 } 28195 28196 /** 28197 * Pads `string` on the left side if it's shorter than `length`. Padding 28198 * characters are truncated if they exceed `length`. 28199 * 28200 * @static 28201 * @memberOf _ 28202 * @since 4.0.0 28203 * @category String 28204 * @param {string} [string=''] The string to pad. 28205 * @param {number} [length=0] The padding length. 28206 * @param {string} [chars=' '] The string used as padding. 28207 * @returns {string} Returns the padded string. 28208 * @example 28209 * 28210 * _.padStart('abc', 6); 28211 * // => ' abc' 28212 * 28213 * _.padStart('abc', 6, '_-'); 28214 * // => '_-_abc' 28215 * 28216 * _.padStart('abc', 3); 28217 * // => 'abc' 28218 */ 28219 function padStart(string, length, chars) { 28220 string = toString(string); 28221 length = toInteger(length); 28222 28223 var strLength = length ? stringSize(string) : 0; 28224 return (length && strLength < length) 28225 ? (createPadding(length - strLength, chars) + string) 28226 : string; 28227 } 28228 28229 /** 28230 * Converts `string` to an integer of the specified radix. If `radix` is 28231 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a 28232 * hexadecimal, in which case a `radix` of `16` is used. 28233 * 28234 * **Note:** This method aligns with the 28235 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. 28236 * 28237 * @static 28238 * @memberOf _ 28239 * @since 1.1.0 28240 * @category String 28241 * @param {string} string The string to convert. 28242 * @param {number} [radix=10] The radix to interpret `value` by. 28243 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28244 * @returns {number} Returns the converted integer. 28245 * @example 28246 * 28247 * _.parseInt('08'); 28248 * // => 8 28249 * 28250 * _.map(['6', '08', '10'], _.parseInt); 28251 * // => [6, 8, 10] 28252 */ 28253 function parseInt(string, radix, guard) { 28254 if (guard || radix == null) { 28255 radix = 0; 28256 } else if (radix) { 28257 radix = +radix; 28258 } 28259 return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); 28260 } 28261 28262 /** 28263 * Repeats the given string `n` times. 28264 * 28265 * @static 28266 * @memberOf _ 28267 * @since 3.0.0 28268 * @category String 28269 * @param {string} [string=''] The string to repeat. 28270 * @param {number} [n=1] The number of times to repeat the string. 28271 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28272 * @returns {string} Returns the repeated string. 28273 * @example 28274 * 28275 * _.repeat('*', 3); 28276 * // => '***' 28277 * 28278 * _.repeat('abc', 2); 28279 * // => 'abcabc' 28280 * 28281 * _.repeat('abc', 0); 28282 * // => '' 28283 */ 28284 function repeat(string, n, guard) { 28285 if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { 28286 n = 1; 28287 } else { 28288 n = toInteger(n); 28289 } 28290 return baseRepeat(toString(string), n); 28291 } 28292 28293 /** 28294 * Replaces matches for `pattern` in `string` with `replacement`. 28295 * 28296 * **Note:** This method is based on 28297 * [`String#replace`](https://mdn.io/String/replace). 28298 * 28299 * @static 28300 * @memberOf _ 28301 * @since 4.0.0 28302 * @category String 28303 * @param {string} [string=''] The string to modify. 28304 * @param {RegExp|string} pattern The pattern to replace. 28305 * @param {Function|string} replacement The match replacement. 28306 * @returns {string} Returns the modified string. 28307 * @example 28308 * 28309 * _.replace('Hi Fred', 'Fred', 'Barney'); 28310 * // => 'Hi Barney' 28311 */ 28312 function replace() { 28313 var args = arguments, 28314 string = toString(args[0]); 28315 28316 return args.length < 3 ? string : string.replace(args[1], args[2]); 28317 } 28318 28319 /** 28320 * Converts `string` to 28321 * [snake case](https://en.wikipedia.org/wiki/Snake_case). 28322 * 28323 * @static 28324 * @memberOf _ 28325 * @since 3.0.0 28326 * @category String 28327 * @param {string} [string=''] The string to convert. 28328 * @returns {string} Returns the snake cased string. 28329 * @example 28330 * 28331 * _.snakeCase('Foo Bar'); 28332 * // => 'foo_bar' 28333 * 28334 * _.snakeCase('fooBar'); 28335 * // => 'foo_bar' 28336 * 28337 * _.snakeCase('--FOO-BAR--'); 28338 * // => 'foo_bar' 28339 */ 28340 var snakeCase = createCompounder(function(result, word, index) { 28341 return result + (index ? '_' : '') + word.toLowerCase(); 28342 }); 28343 28344 /** 28345 * Splits `string` by `separator`. 28346 * 28347 * **Note:** This method is based on 28348 * [`String#split`](https://mdn.io/String/split). 28349 * 28350 * @static 28351 * @memberOf _ 28352 * @since 4.0.0 28353 * @category String 28354 * @param {string} [string=''] The string to split. 28355 * @param {RegExp|string} separator The separator pattern to split by. 28356 * @param {number} [limit] The length to truncate results to. 28357 * @returns {Array} Returns the string segments. 28358 * @example 28359 * 28360 * _.split('a-b-c', '-', 2); 28361 * // => ['a', 'b'] 28362 */ 28363 function split(string, separator, limit) { 28364 if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { 28365 separator = limit = undefined; 28366 } 28367 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; 28368 if (!limit) { 28369 return []; 28370 } 28371 string = toString(string); 28372 if (string && ( 28373 typeof separator == 'string' || 28374 (separator != null && !isRegExp(separator)) 28375 )) { 28376 separator = baseToString(separator); 28377 if (!separator && hasUnicode(string)) { 28378 return castSlice(stringToArray(string), 0, limit); 28379 } 28380 } 28381 return string.split(separator, limit); 28382 } 28383 28384 /** 28385 * Converts `string` to 28386 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). 28387 * 28388 * @static 28389 * @memberOf _ 28390 * @since 3.1.0 28391 * @category String 28392 * @param {string} [string=''] The string to convert. 28393 * @returns {string} Returns the start cased string. 28394 * @example 28395 * 28396 * _.startCase('--foo-bar--'); 28397 * // => 'Foo Bar' 28398 * 28399 * _.startCase('fooBar'); 28400 * // => 'Foo Bar' 28401 * 28402 * _.startCase('__FOO_BAR__'); 28403 * // => 'FOO BAR' 28404 */ 28405 var startCase = createCompounder(function(result, word, index) { 28406 return result + (index ? ' ' : '') + upperFirst(word); 28407 }); 28408 28409 /** 28410 * Checks if `string` starts with the given target string. 28411 * 28412 * @static 28413 * @memberOf _ 28414 * @since 3.0.0 28415 * @category String 28416 * @param {string} [string=''] The string to inspect. 28417 * @param {string} [target] The string to search for. 28418 * @param {number} [position=0] The position to search from. 28419 * @returns {boolean} Returns `true` if `string` starts with `target`, 28420 * else `false`. 28421 * @example 28422 * 28423 * _.startsWith('abc', 'a'); 28424 * // => true 28425 * 28426 * _.startsWith('abc', 'b'); 28427 * // => false 28428 * 28429 * _.startsWith('abc', 'b', 1); 28430 * // => true 28431 */ 28432 function startsWith(string, target, position) { 28433 string = toString(string); 28434 position = position == null 28435 ? 0 28436 : baseClamp(toInteger(position), 0, string.length); 28437 28438 target = baseToString(target); 28439 return string.slice(position, position + target.length) == target; 28440 } 28441 28442 /** 28443 * Creates a compiled template function that can interpolate data properties 28444 * in "interpolate" delimiters, HTML-escape interpolated data properties in 28445 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data 28446 * properties may be accessed as free variables in the template. If a setting 28447 * object is given, it takes precedence over `_.templateSettings` values. 28448 * 28449 * **Note:** In the development build `_.template` utilizes 28450 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) 28451 * for easier debugging. 28452 * 28453 * For more information on precompiling templates see 28454 * [lodash's custom builds documentation](https://lodash.com/custom-builds). 28455 * 28456 * For more information on Chrome extension sandboxes see 28457 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). 28458 * 28459 * @static 28460 * @since 0.1.0 28461 * @memberOf _ 28462 * @category String 28463 * @param {string} [string=''] The template string. 28464 * @param {Object} [options={}] The options object. 28465 * @param {RegExp} [options.escape=_.templateSettings.escape] 28466 * The HTML "escape" delimiter. 28467 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] 28468 * The "evaluate" delimiter. 28469 * @param {Object} [options.imports=_.templateSettings.imports] 28470 * An object to import into the template as free variables. 28471 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] 28472 * The "interpolate" delimiter. 28473 * @param {string} [options.sourceURL='lodash.templateSources[n]'] 28474 * The sourceURL of the compiled template. 28475 * @param {string} [options.variable='obj'] 28476 * The data object variable name. 28477 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28478 * @returns {Function} Returns the compiled template function. 28479 * @example 28480 * 28481 * // Use the "interpolate" delimiter to create a compiled template. 28482 * var compiled = _.template('hello <%= user %>!'); 28483 * compiled({ 'user': 'fred' }); 28484 * // => 'hello fred!' 28485 * 28486 * // Use the HTML "escape" delimiter to escape data property values. 28487 * var compiled = _.template('<b><%- value %></b>'); 28488 * compiled({ 'value': '<script>' }); 28489 * // => '<b><script></b>' 28490 * 28491 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. 28492 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); 28493 * compiled({ 'users': ['fred', 'barney'] }); 28494 * // => '<li>fred</li><li>barney</li>' 28495 * 28496 * // Use the internal `print` function in "evaluate" delimiters. 28497 * var compiled = _.template('<% print("hello " + user); %>!'); 28498 * compiled({ 'user': 'barney' }); 28499 * // => 'hello barney!' 28500 * 28501 * // Use the ES template literal delimiter as an "interpolate" delimiter. 28502 * // Disable support by replacing the "interpolate" delimiter. 28503 * var compiled = _.template('hello ${ user }!'); 28504 * compiled({ 'user': 'pebbles' }); 28505 * // => 'hello pebbles!' 28506 * 28507 * // Use backslashes to treat delimiters as plain text. 28508 * var compiled = _.template('<%= "\\<%- value %\\>" %>'); 28509 * compiled({ 'value': 'ignored' }); 28510 * // => '<%- value %>' 28511 * 28512 * // Use the `imports` option to import `jQuery` as `jq`. 28513 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; 28514 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); 28515 * compiled({ 'users': ['fred', 'barney'] }); 28516 * // => '<li>fred</li><li>barney</li>' 28517 * 28518 * // Use the `sourceURL` option to specify a custom sourceURL for the template. 28519 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); 28520 * compiled(data); 28521 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. 28522 * 28523 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. 28524 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); 28525 * compiled.source; 28526 * // => function(data) { 28527 * // var __t, __p = ''; 28528 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; 28529 * // return __p; 28530 * // } 28531 * 28532 * // Use custom template delimiters. 28533 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; 28534 * var compiled = _.template('hello {{ user }}!'); 28535 * compiled({ 'user': 'mustache' }); 28536 * // => 'hello mustache!' 28537 * 28538 * // Use the `source` property to inline compiled templates for meaningful 28539 * // line numbers in error messages and stack traces. 28540 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ 28541 * var JST = {\ 28542 * "main": ' + _.template(mainText).source + '\ 28543 * };\ 28544 * '); 28545 */ 28546 function template(string, options, guard) { 28547 // Based on John Resig's `tmpl` implementation 28548 // (http://ejohn.org/blog/javascript-micro-templating/) 28549 // and Laura Doktorova's doT.js (https://github.com/olado/doT). 28550 var settings = lodash.templateSettings; 28551 28552 if (guard && isIterateeCall(string, options, guard)) { 28553 options = undefined; 28554 } 28555 string = toString(string); 28556 options = assignInWith({}, options, settings, customDefaultsAssignIn); 28557 28558 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), 28559 importsKeys = keys(imports), 28560 importsValues = baseValues(imports, importsKeys); 28561 28562 var isEscaping, 28563 isEvaluating, 28564 index = 0, 28565 interpolate = options.interpolate || reNoMatch, 28566 source = "__p += '"; 28567 28568 // Compile the regexp to match each delimiter. 28569 var reDelimiters = RegExp( 28570 (options.escape || reNoMatch).source + '|' + 28571 interpolate.source + '|' + 28572 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + 28573 (options.evaluate || reNoMatch).source + '|$' 28574 , 'g'); 28575 28576 // Use a sourceURL for easier debugging. 28577 // The sourceURL gets injected into the source that's eval-ed, so be careful 28578 // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in 28579 // and escape the comment, thus injecting code that gets evaled. 28580 var sourceURL = '//# sourceURL=' + 28581 (hasOwnProperty.call(options, 'sourceURL') 28582 ? (options.sourceURL + '').replace(/\s/g, ' ') 28583 : ('lodash.templateSources[' + (++templateCounter) + ']') 28584 ) + '\n'; 28585 28586 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 28587 interpolateValue || (interpolateValue = esTemplateValue); 28588 28589 // Escape characters that can't be included in string literals. 28590 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 28591 28592 // Replace delimiters with snippets. 28593 if (escapeValue) { 28594 isEscaping = true; 28595 source += "' +\n__e(" + escapeValue + ") +\n'"; 28596 } 28597 if (evaluateValue) { 28598 isEvaluating = true; 28599 source += "';\n" + evaluateValue + ";\n__p += '"; 28600 } 28601 if (interpolateValue) { 28602 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 28603 } 28604 index = offset + match.length; 28605 28606 // The JS engine embedded in Adobe products needs `match` returned in 28607 // order to produce the correct `offset` value. 28608 return match; 28609 }); 28610 28611 source += "';\n"; 28612 28613 // If `variable` is not specified wrap a with-statement around the generated 28614 // code to add the data object to the top of the scope chain. 28615 var variable = hasOwnProperty.call(options, 'variable') && options.variable; 28616 if (!variable) { 28617 source = 'with (obj) {\n' + source + '\n}\n'; 28618 } 28619 // Throw an error if a forbidden character was found in `variable`, to prevent 28620 // potential command injection attacks. 28621 else if (reForbiddenIdentifierChars.test(variable)) { 28622 throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT); 28623 } 28624 28625 // Cleanup code by stripping empty strings. 28626 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) 28627 .replace(reEmptyStringMiddle, '$1') 28628 .replace(reEmptyStringTrailing, '$1;'); 28629 28630 // Frame code as the function body. 28631 source = 'function(' + (variable || 'obj') + ') {\n' + 28632 (variable 28633 ? '' 28634 : 'obj || (obj = {});\n' 28635 ) + 28636 "var __t, __p = ''" + 28637 (isEscaping 28638 ? ', __e = _.escape' 28639 : '' 28640 ) + 28641 (isEvaluating 28642 ? ', __j = Array.prototype.join;\n' + 28643 "function print() { __p += __j.call(arguments, '') }\n" 28644 : ';\n' 28645 ) + 28646 source + 28647 'return __p\n}'; 28648 28649 var result = attempt(function() { 28650 return Function(importsKeys, sourceURL + 'return ' + source) 28651 .apply(undefined, importsValues); 28652 }); 28653 28654 // Provide the compiled function's source by its `toString` method or 28655 // the `source` property as a convenience for inlining compiled templates. 28656 result.source = source; 28657 if (isError(result)) { 28658 throw result; 28659 } 28660 return result; 28661 } 28662 28663 /** 28664 * Converts `string`, as a whole, to lower case just like 28665 * [String#toLowerCase](https://mdn.io/toLowerCase). 28666 * 28667 * @static 28668 * @memberOf _ 28669 * @since 4.0.0 28670 * @category String 28671 * @param {string} [string=''] The string to convert. 28672 * @returns {string} Returns the lower cased string. 28673 * @example 28674 * 28675 * _.toLower('--Foo-Bar--'); 28676 * // => '--foo-bar--' 28677 * 28678 * _.toLower('fooBar'); 28679 * // => 'foobar' 28680 * 28681 * _.toLower('__FOO_BAR__'); 28682 * // => '__foo_bar__' 28683 */ 28684 function toLower(value) { 28685 return toString(value).toLowerCase(); 28686 } 28687 28688 /** 28689 * Converts `string`, as a whole, to upper case just like 28690 * [String#toUpperCase](https://mdn.io/toUpperCase). 28691 * 28692 * @static 28693 * @memberOf _ 28694 * @since 4.0.0 28695 * @category String 28696 * @param {string} [string=''] The string to convert. 28697 * @returns {string} Returns the upper cased string. 28698 * @example 28699 * 28700 * _.toUpper('--foo-bar--'); 28701 * // => '--FOO-BAR--' 28702 * 28703 * _.toUpper('fooBar'); 28704 * // => 'FOOBAR' 28705 * 28706 * _.toUpper('__foo_bar__'); 28707 * // => '__FOO_BAR__' 28708 */ 28709 function toUpper(value) { 28710 return toString(value).toUpperCase(); 28711 } 28712 28713 /** 28714 * Removes leading and trailing whitespace or specified characters from `string`. 28715 * 28716 * @static 28717 * @memberOf _ 28718 * @since 3.0.0 28719 * @category String 28720 * @param {string} [string=''] The string to trim. 28721 * @param {string} [chars=whitespace] The characters to trim. 28722 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28723 * @returns {string} Returns the trimmed string. 28724 * @example 28725 * 28726 * _.trim(' abc '); 28727 * // => 'abc' 28728 * 28729 * _.trim('-_-abc-_-', '_-'); 28730 * // => 'abc' 28731 * 28732 * _.map([' foo ', ' bar '], _.trim); 28733 * // => ['foo', 'bar'] 28734 */ 28735 function trim(string, chars, guard) { 28736 string = toString(string); 28737 if (string && (guard || chars === undefined)) { 28738 return baseTrim(string); 28739 } 28740 if (!string || !(chars = baseToString(chars))) { 28741 return string; 28742 } 28743 var strSymbols = stringToArray(string), 28744 chrSymbols = stringToArray(chars), 28745 start = charsStartIndex(strSymbols, chrSymbols), 28746 end = charsEndIndex(strSymbols, chrSymbols) + 1; 28747 28748 return castSlice(strSymbols, start, end).join(''); 28749 } 28750 28751 /** 28752 * Removes trailing whitespace or specified characters from `string`. 28753 * 28754 * @static 28755 * @memberOf _ 28756 * @since 4.0.0 28757 * @category String 28758 * @param {string} [string=''] The string to trim. 28759 * @param {string} [chars=whitespace] The characters to trim. 28760 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28761 * @returns {string} Returns the trimmed string. 28762 * @example 28763 * 28764 * _.trimEnd(' abc '); 28765 * // => ' abc' 28766 * 28767 * _.trimEnd('-_-abc-_-', '_-'); 28768 * // => '-_-abc' 28769 */ 28770 function trimEnd(string, chars, guard) { 28771 string = toString(string); 28772 if (string && (guard || chars === undefined)) { 28773 return string.slice(0, trimmedEndIndex(string) + 1); 28774 } 28775 if (!string || !(chars = baseToString(chars))) { 28776 return string; 28777 } 28778 var strSymbols = stringToArray(string), 28779 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 28780 28781 return castSlice(strSymbols, 0, end).join(''); 28782 } 28783 28784 /** 28785 * Removes leading whitespace or specified characters from `string`. 28786 * 28787 * @static 28788 * @memberOf _ 28789 * @since 4.0.0 28790 * @category String 28791 * @param {string} [string=''] The string to trim. 28792 * @param {string} [chars=whitespace] The characters to trim. 28793 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28794 * @returns {string} Returns the trimmed string. 28795 * @example 28796 * 28797 * _.trimStart(' abc '); 28798 * // => 'abc ' 28799 * 28800 * _.trimStart('-_-abc-_-', '_-'); 28801 * // => 'abc-_-' 28802 */ 28803 function trimStart(string, chars, guard) { 28804 string = toString(string); 28805 if (string && (guard || chars === undefined)) { 28806 return string.replace(reTrimStart, ''); 28807 } 28808 if (!string || !(chars = baseToString(chars))) { 28809 return string; 28810 } 28811 var strSymbols = stringToArray(string), 28812 start = charsStartIndex(strSymbols, stringToArray(chars)); 28813 28814 return castSlice(strSymbols, start).join(''); 28815 } 28816 28817 /** 28818 * Truncates `string` if it's longer than the given maximum string length. 28819 * The last characters of the truncated string are replaced with the omission 28820 * string which defaults to "...". 28821 * 28822 * @static 28823 * @memberOf _ 28824 * @since 4.0.0 28825 * @category String 28826 * @param {string} [string=''] The string to truncate. 28827 * @param {Object} [options={}] The options object. 28828 * @param {number} [options.length=30] The maximum string length. 28829 * @param {string} [options.omission='...'] The string to indicate text is omitted. 28830 * @param {RegExp|string} [options.separator] The separator pattern to truncate to. 28831 * @returns {string} Returns the truncated string. 28832 * @example 28833 * 28834 * _.truncate('hi-diddly-ho there, neighborino'); 28835 * // => 'hi-diddly-ho there, neighbo...' 28836 * 28837 * _.truncate('hi-diddly-ho there, neighborino', { 28838 * 'length': 24, 28839 * 'separator': ' ' 28840 * }); 28841 * // => 'hi-diddly-ho there,...' 28842 * 28843 * _.truncate('hi-diddly-ho there, neighborino', { 28844 * 'length': 24, 28845 * 'separator': /,? +/ 28846 * }); 28847 * // => 'hi-diddly-ho there...' 28848 * 28849 * _.truncate('hi-diddly-ho there, neighborino', { 28850 * 'omission': ' [...]' 28851 * }); 28852 * // => 'hi-diddly-ho there, neig [...]' 28853 */ 28854 function truncate(string, options) { 28855 var length = DEFAULT_TRUNC_LENGTH, 28856 omission = DEFAULT_TRUNC_OMISSION; 28857 28858 if (isObject(options)) { 28859 var separator = 'separator' in options ? options.separator : separator; 28860 length = 'length' in options ? toInteger(options.length) : length; 28861 omission = 'omission' in options ? baseToString(options.omission) : omission; 28862 } 28863 string = toString(string); 28864 28865 var strLength = string.length; 28866 if (hasUnicode(string)) { 28867 var strSymbols = stringToArray(string); 28868 strLength = strSymbols.length; 28869 } 28870 if (length >= strLength) { 28871 return string; 28872 } 28873 var end = length - stringSize(omission); 28874 if (end < 1) { 28875 return omission; 28876 } 28877 var result = strSymbols 28878 ? castSlice(strSymbols, 0, end).join('') 28879 : string.slice(0, end); 28880 28881 if (separator === undefined) { 28882 return result + omission; 28883 } 28884 if (strSymbols) { 28885 end += (result.length - end); 28886 } 28887 if (isRegExp(separator)) { 28888 if (string.slice(end).search(separator)) { 28889 var match, 28890 substring = result; 28891 28892 if (!separator.global) { 28893 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); 28894 } 28895 separator.lastIndex = 0; 28896 while ((match = separator.exec(substring))) { 28897 var newEnd = match.index; 28898 } 28899 result = result.slice(0, newEnd === undefined ? end : newEnd); 28900 } 28901 } else if (string.indexOf(baseToString(separator), end) != end) { 28902 var index = result.lastIndexOf(separator); 28903 if (index > -1) { 28904 result = result.slice(0, index); 28905 } 28906 } 28907 return result + omission; 28908 } 28909 28910 /** 28911 * The inverse of `_.escape`; this method converts the HTML entities 28912 * `&`, `<`, `>`, `"`, and `'` in `string` to 28913 * their corresponding characters. 28914 * 28915 * **Note:** No other HTML entities are unescaped. To unescape additional 28916 * HTML entities use a third-party library like [_he_](https://mths.be/he). 28917 * 28918 * @static 28919 * @memberOf _ 28920 * @since 0.6.0 28921 * @category String 28922 * @param {string} [string=''] The string to unescape. 28923 * @returns {string} Returns the unescaped string. 28924 * @example 28925 * 28926 * _.unescape('fred, barney, & pebbles'); 28927 * // => 'fred, barney, & pebbles' 28928 */ 28929 function unescape(string) { 28930 string = toString(string); 28931 return (string && reHasEscapedHtml.test(string)) 28932 ? string.replace(reEscapedHtml, unescapeHtmlChar) 28933 : string; 28934 } 28935 28936 /** 28937 * Converts `string`, as space separated words, to upper case. 28938 * 28939 * @static 28940 * @memberOf _ 28941 * @since 4.0.0 28942 * @category String 28943 * @param {string} [string=''] The string to convert. 28944 * @returns {string} Returns the upper cased string. 28945 * @example 28946 * 28947 * _.upperCase('--foo-bar'); 28948 * // => 'FOO BAR' 28949 * 28950 * _.upperCase('fooBar'); 28951 * // => 'FOO BAR' 28952 * 28953 * _.upperCase('__foo_bar__'); 28954 * // => 'FOO BAR' 28955 */ 28956 var upperCase = createCompounder(function(result, word, index) { 28957 return result + (index ? ' ' : '') + word.toUpperCase(); 28958 }); 28959 28960 /** 28961 * Converts the first character of `string` to upper case. 28962 * 28963 * @static 28964 * @memberOf _ 28965 * @since 4.0.0 28966 * @category String 28967 * @param {string} [string=''] The string to convert. 28968 * @returns {string} Returns the converted string. 28969 * @example 28970 * 28971 * _.upperFirst('fred'); 28972 * // => 'Fred' 28973 * 28974 * _.upperFirst('FRED'); 28975 * // => 'FRED' 28976 */ 28977 var upperFirst = createCaseFirst('toUpperCase'); 28978 28979 /** 28980 * Splits `string` into an array of its words. 28981 * 28982 * @static 28983 * @memberOf _ 28984 * @since 3.0.0 28985 * @category String 28986 * @param {string} [string=''] The string to inspect. 28987 * @param {RegExp|string} [pattern] The pattern to match words. 28988 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28989 * @returns {Array} Returns the words of `string`. 28990 * @example 28991 * 28992 * _.words('fred, barney, & pebbles'); 28993 * // => ['fred', 'barney', 'pebbles'] 28994 * 28995 * _.words('fred, barney, & pebbles', /[^, ]+/g); 28996 * // => ['fred', 'barney', '&', 'pebbles'] 28997 */ 28998 function words(string, pattern, guard) { 28999 string = toString(string); 29000 pattern = guard ? undefined : pattern; 29001 29002 if (pattern === undefined) { 29003 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 29004 } 29005 return string.match(pattern) || []; 29006 } 29007 29008 /*------------------------------------------------------------------------*/ 29009 29010 /** 29011 * Attempts to invoke `func`, returning either the result or the caught error 29012 * object. Any additional arguments are provided to `func` when it's invoked. 29013 * 29014 * @static 29015 * @memberOf _ 29016 * @since 3.0.0 29017 * @category Util 29018 * @param {Function} func The function to attempt. 29019 * @param {...*} [args] The arguments to invoke `func` with. 29020 * @returns {*} Returns the `func` result or error object. 29021 * @example 29022 * 29023 * // Avoid throwing errors for invalid selectors. 29024 * var elements = _.attempt(function(selector) { 29025 * return document.querySelectorAll(selector); 29026 * }, '>_>'); 29027 * 29028 * if (_.isError(elements)) { 29029 * elements = []; 29030 * } 29031 */ 29032 var attempt = baseRest(function(func, args) { 29033 try { 29034 return apply(func, undefined, args); 29035 } catch (e) { 29036 return isError(e) ? e : new Error(e); 29037 } 29038 }); 29039 29040 /** 29041 * Binds methods of an object to the object itself, overwriting the existing 29042 * method. 29043 * 29044 * **Note:** This method doesn't set the "length" property of bound functions. 29045 * 29046 * @static 29047 * @since 0.1.0 29048 * @memberOf _ 29049 * @category Util 29050 * @param {Object} object The object to bind and assign the bound methods to. 29051 * @param {...(string|string[])} methodNames The object method names to bind. 29052 * @returns {Object} Returns `object`. 29053 * @example 29054 * 29055 * var view = { 29056 * 'label': 'docs', 29057 * 'click': function() { 29058 * console.log('clicked ' + this.label); 29059 * } 29060 * }; 29061 * 29062 * _.bindAll(view, ['click']); 29063 * jQuery(element).on('click', view.click); 29064 * // => Logs 'clicked docs' when clicked. 29065 */ 29066 var bindAll = flatRest(function(object, methodNames) { 29067 arrayEach(methodNames, function(key) { 29068 key = toKey(key); 29069 baseAssignValue(object, key, bind(object[key], object)); 29070 }); 29071 return object; 29072 }); 29073 29074 /** 29075 * Creates a function that iterates over `pairs` and invokes the corresponding 29076 * function of the first predicate to return truthy. The predicate-function 29077 * pairs are invoked with the `this` binding and arguments of the created 29078 * function. 29079 * 29080 * @static 29081 * @memberOf _ 29082 * @since 4.0.0 29083 * @category Util 29084 * @param {Array} pairs The predicate-function pairs. 29085 * @returns {Function} Returns the new composite function. 29086 * @example 29087 * 29088 * var func = _.cond([ 29089 * [_.matches({ 'a': 1 }), _.constant('matches A')], 29090 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], 29091 * [_.stubTrue, _.constant('no match')] 29092 * ]); 29093 * 29094 * func({ 'a': 1, 'b': 2 }); 29095 * // => 'matches A' 29096 * 29097 * func({ 'a': 0, 'b': 1 }); 29098 * // => 'matches B' 29099 * 29100 * func({ 'a': '1', 'b': '2' }); 29101 * // => 'no match' 29102 */ 29103 function cond(pairs) { 29104 var length = pairs == null ? 0 : pairs.length, 29105 toIteratee = getIteratee(); 29106 29107 pairs = !length ? [] : arrayMap(pairs, function(pair) { 29108 if (typeof pair[1] != 'function') { 29109 throw new TypeError(FUNC_ERROR_TEXT); 29110 } 29111 return [toIteratee(pair[0]), pair[1]]; 29112 }); 29113 29114 return baseRest(function(args) { 29115 var index = -1; 29116 while (++index < length) { 29117 var pair = pairs[index]; 29118 if (apply(pair[0], this, args)) { 29119 return apply(pair[1], this, args); 29120 } 29121 } 29122 }); 29123 } 29124 29125 /** 29126 * Creates a function that invokes the predicate properties of `source` with 29127 * the corresponding property values of a given object, returning `true` if 29128 * all predicates return truthy, else `false`. 29129 * 29130 * **Note:** The created function is equivalent to `_.conformsTo` with 29131 * `source` partially applied. 29132 * 29133 * @static 29134 * @memberOf _ 29135 * @since 4.0.0 29136 * @category Util 29137 * @param {Object} source The object of property predicates to conform to. 29138 * @returns {Function} Returns the new spec function. 29139 * @example 29140 * 29141 * var objects = [ 29142 * { 'a': 2, 'b': 1 }, 29143 * { 'a': 1, 'b': 2 } 29144 * ]; 29145 * 29146 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); 29147 * // => [{ 'a': 1, 'b': 2 }] 29148 */ 29149 function conforms(source) { 29150 return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); 29151 } 29152 29153 /** 29154 * Creates a function that returns `value`. 29155 * 29156 * @static 29157 * @memberOf _ 29158 * @since 2.4.0 29159 * @category Util 29160 * @param {*} value The value to return from the new function. 29161 * @returns {Function} Returns the new constant function. 29162 * @example 29163 * 29164 * var objects = _.times(2, _.constant({ 'a': 1 })); 29165 * 29166 * console.log(objects); 29167 * // => [{ 'a': 1 }, { 'a': 1 }] 29168 * 29169 * console.log(objects[0] === objects[1]); 29170 * // => true 29171 */ 29172 function constant(value) { 29173 return function() { 29174 return value; 29175 }; 29176 } 29177 29178 /** 29179 * Checks `value` to determine whether a default value should be returned in 29180 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, 29181 * or `undefined`. 29182 * 29183 * @static 29184 * @memberOf _ 29185 * @since 4.14.0 29186 * @category Util 29187 * @param {*} value The value to check. 29188 * @param {*} defaultValue The default value. 29189 * @returns {*} Returns the resolved value. 29190 * @example 29191 * 29192 * _.defaultTo(1, 10); 29193 * // => 1 29194 * 29195 * _.defaultTo(undefined, 10); 29196 * // => 10 29197 */ 29198 function defaultTo(value, defaultValue) { 29199 return (value == null || value !== value) ? defaultValue : value; 29200 } 29201 29202 /** 29203 * Creates a function that returns the result of invoking the given functions 29204 * with the `this` binding of the created function, where each successive 29205 * invocation is supplied the return value of the previous. 29206 * 29207 * @static 29208 * @memberOf _ 29209 * @since 3.0.0 29210 * @category Util 29211 * @param {...(Function|Function[])} [funcs] The functions to invoke. 29212 * @returns {Function} Returns the new composite function. 29213 * @see _.flowRight 29214 * @example 29215 * 29216 * function square(n) { 29217 * return n * n; 29218 * } 29219 * 29220 * var addSquare = _.flow([_.add, square]); 29221 * addSquare(1, 2); 29222 * // => 9 29223 */ 29224 var flow = createFlow(); 29225 29226 /** 29227 * This method is like `_.flow` except that it creates a function that 29228 * invokes the given functions from right to left. 29229 * 29230 * @static 29231 * @since 3.0.0 29232 * @memberOf _ 29233 * @category Util 29234 * @param {...(Function|Function[])} [funcs] The functions to invoke. 29235 * @returns {Function} Returns the new composite function. 29236 * @see _.flow 29237 * @example 29238 * 29239 * function square(n) { 29240 * return n * n; 29241 * } 29242 * 29243 * var addSquare = _.flowRight([square, _.add]); 29244 * addSquare(1, 2); 29245 * // => 9 29246 */ 29247 var flowRight = createFlow(true); 29248 29249 /** 29250 * This method returns the first argument it receives. 29251 * 29252 * @static 29253 * @since 0.1.0 29254 * @memberOf _ 29255 * @category Util 29256 * @param {*} value Any value. 29257 * @returns {*} Returns `value`. 29258 * @example 29259 * 29260 * var object = { 'a': 1 }; 29261 * 29262 * console.log(_.identity(object) === object); 29263 * // => true 29264 */ 29265 function identity(value) { 29266 return value; 29267 } 29268 29269 /** 29270 * Creates a function that invokes `func` with the arguments of the created 29271 * function. If `func` is a property name, the created function returns the 29272 * property value for a given element. If `func` is an array or object, the 29273 * created function returns `true` for elements that contain the equivalent 29274 * source properties, otherwise it returns `false`. 29275 * 29276 * @static 29277 * @since 4.0.0 29278 * @memberOf _ 29279 * @category Util 29280 * @param {*} [func=_.identity] The value to convert to a callback. 29281 * @returns {Function} Returns the callback. 29282 * @example 29283 * 29284 * var users = [ 29285 * { 'user': 'barney', 'age': 36, 'active': true }, 29286 * { 'user': 'fred', 'age': 40, 'active': false } 29287 * ]; 29288 * 29289 * // The `_.matches` iteratee shorthand. 29290 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); 29291 * // => [{ 'user': 'barney', 'age': 36, 'active': true }] 29292 * 29293 * // The `_.matchesProperty` iteratee shorthand. 29294 * _.filter(users, _.iteratee(['user', 'fred'])); 29295 * // => [{ 'user': 'fred', 'age': 40 }] 29296 * 29297 * // The `_.property` iteratee shorthand. 29298 * _.map(users, _.iteratee('user')); 29299 * // => ['barney', 'fred'] 29300 * 29301 * // Create custom iteratee shorthands. 29302 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { 29303 * return !_.isRegExp(func) ? iteratee(func) : function(string) { 29304 * return func.test(string); 29305 * }; 29306 * }); 29307 * 29308 * _.filter(['abc', 'def'], /ef/); 29309 * // => ['def'] 29310 */ 29311 function iteratee(func) { 29312 return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); 29313 } 29314 29315 /** 29316 * Creates a function that performs a partial deep comparison between a given 29317 * object and `source`, returning `true` if the given object has equivalent 29318 * property values, else `false`. 29319 * 29320 * **Note:** The created function is equivalent to `_.isMatch` with `source` 29321 * partially applied. 29322 * 29323 * Partial comparisons will match empty array and empty object `source` 29324 * values against any array or object value, respectively. See `_.isEqual` 29325 * for a list of supported value comparisons. 29326 * 29327 * **Note:** Multiple values can be checked by combining several matchers 29328 * using `_.overSome` 29329 * 29330 * @static 29331 * @memberOf _ 29332 * @since 3.0.0 29333 * @category Util 29334 * @param {Object} source The object of property values to match. 29335 * @returns {Function} Returns the new spec function. 29336 * @example 29337 * 29338 * var objects = [ 29339 * { 'a': 1, 'b': 2, 'c': 3 }, 29340 * { 'a': 4, 'b': 5, 'c': 6 } 29341 * ]; 29342 * 29343 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); 29344 * // => [{ 'a': 4, 'b': 5, 'c': 6 }] 29345 * 29346 * // Checking for several possible values 29347 * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); 29348 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] 29349 */ 29350 function matches(source) { 29351 return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); 29352 } 29353 29354 /** 29355 * Creates a function that performs a partial deep comparison between the 29356 * value at `path` of a given object to `srcValue`, returning `true` if the 29357 * object value is equivalent, else `false`. 29358 * 29359 * **Note:** Partial comparisons will match empty array and empty object 29360 * `srcValue` values against any array or object value, respectively. See 29361 * `_.isEqual` for a list of supported value comparisons. 29362 * 29363 * **Note:** Multiple values can be checked by combining several matchers 29364 * using `_.overSome` 29365 * 29366 * @static 29367 * @memberOf _ 29368 * @since 3.2.0 29369 * @category Util 29370 * @param {Array|string} path The path of the property to get. 29371 * @param {*} srcValue The value to match. 29372 * @returns {Function} Returns the new spec function. 29373 * @example 29374 * 29375 * var objects = [ 29376 * { 'a': 1, 'b': 2, 'c': 3 }, 29377 * { 'a': 4, 'b': 5, 'c': 6 } 29378 * ]; 29379 * 29380 * _.find(objects, _.matchesProperty('a', 4)); 29381 * // => { 'a': 4, 'b': 5, 'c': 6 } 29382 * 29383 * // Checking for several possible values 29384 * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); 29385 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] 29386 */ 29387 function matchesProperty(path, srcValue) { 29388 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); 29389 } 29390 29391 /** 29392 * Creates a function that invokes the method at `path` of a given object. 29393 * Any additional arguments are provided to the invoked method. 29394 * 29395 * @static 29396 * @memberOf _ 29397 * @since 3.7.0 29398 * @category Util 29399 * @param {Array|string} path The path of the method to invoke. 29400 * @param {...*} [args] The arguments to invoke the method with. 29401 * @returns {Function} Returns the new invoker function. 29402 * @example 29403 * 29404 * var objects = [ 29405 * { 'a': { 'b': _.constant(2) } }, 29406 * { 'a': { 'b': _.constant(1) } } 29407 * ]; 29408 * 29409 * _.map(objects, _.method('a.b')); 29410 * // => [2, 1] 29411 * 29412 * _.map(objects, _.method(['a', 'b'])); 29413 * // => [2, 1] 29414 */ 29415 var method = baseRest(function(path, args) { 29416 return function(object) { 29417 return baseInvoke(object, path, args); 29418 }; 29419 }); 29420 29421 /** 29422 * The opposite of `_.method`; this method creates a function that invokes 29423 * the method at a given path of `object`. Any additional arguments are 29424 * provided to the invoked method. 29425 * 29426 * @static 29427 * @memberOf _ 29428 * @since 3.7.0 29429 * @category Util 29430 * @param {Object} object The object to query. 29431 * @param {...*} [args] The arguments to invoke the method with. 29432 * @returns {Function} Returns the new invoker function. 29433 * @example 29434 * 29435 * var array = _.times(3, _.constant), 29436 * object = { 'a': array, 'b': array, 'c': array }; 29437 * 29438 * _.map(['a[2]', 'c[0]'], _.methodOf(object)); 29439 * // => [2, 0] 29440 * 29441 * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); 29442 * // => [2, 0] 29443 */ 29444 var methodOf = baseRest(function(object, args) { 29445 return function(path) { 29446 return baseInvoke(object, path, args); 29447 }; 29448 }); 29449 29450 /** 29451 * Adds all own enumerable string keyed function properties of a source 29452 * object to the destination object. If `object` is a function, then methods 29453 * are added to its prototype as well. 29454 * 29455 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to 29456 * avoid conflicts caused by modifying the original. 29457 * 29458 * @static 29459 * @since 0.1.0 29460 * @memberOf _ 29461 * @category Util 29462 * @param {Function|Object} [object=lodash] The destination object. 29463 * @param {Object} source The object of functions to add. 29464 * @param {Object} [options={}] The options object. 29465 * @param {boolean} [options.chain=true] Specify whether mixins are chainable. 29466 * @returns {Function|Object} Returns `object`. 29467 * @example 29468 * 29469 * function vowels(string) { 29470 * return _.filter(string, function(v) { 29471 * return /[aeiou]/i.test(v); 29472 * }); 29473 * } 29474 * 29475 * _.mixin({ 'vowels': vowels }); 29476 * _.vowels('fred'); 29477 * // => ['e'] 29478 * 29479 * _('fred').vowels().value(); 29480 * // => ['e'] 29481 * 29482 * _.mixin({ 'vowels': vowels }, { 'chain': false }); 29483 * _('fred').vowels(); 29484 * // => ['e'] 29485 */ 29486 function mixin(object, source, options) { 29487 var props = keys(source), 29488 methodNames = baseFunctions(source, props); 29489 29490 if (options == null && 29491 !(isObject(source) && (methodNames.length || !props.length))) { 29492 options = source; 29493 source = object; 29494 object = this; 29495 methodNames = baseFunctions(source, keys(source)); 29496 } 29497 var chain = !(isObject(options) && 'chain' in options) || !!options.chain, 29498 isFunc = isFunction(object); 29499 29500 arrayEach(methodNames, function(methodName) { 29501 var func = source[methodName]; 29502 object[methodName] = func; 29503 if (isFunc) { 29504 object.prototype[methodName] = function() { 29505 var chainAll = this.__chain__; 29506 if (chain || chainAll) { 29507 var result = object(this.__wrapped__), 29508 actions = result.__actions__ = copyArray(this.__actions__); 29509 29510 actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); 29511 result.__chain__ = chainAll; 29512 return result; 29513 } 29514 return func.apply(object, arrayPush([this.value()], arguments)); 29515 }; 29516 } 29517 }); 29518 29519 return object; 29520 } 29521 29522 /** 29523 * Reverts the `_` variable to its previous value and returns a reference to 29524 * the `lodash` function. 29525 * 29526 * @static 29527 * @since 0.1.0 29528 * @memberOf _ 29529 * @category Util 29530 * @returns {Function} Returns the `lodash` function. 29531 * @example 29532 * 29533 * var lodash = _.noConflict(); 29534 */ 29535 function noConflict() { 29536 if (root._ === this) { 29537 root._ = oldDash; 29538 } 29539 return this; 29540 } 29541 29542 /** 29543 * This method returns `undefined`. 29544 * 29545 * @static 29546 * @memberOf _ 29547 * @since 2.3.0 29548 * @category Util 29549 * @example 29550 * 29551 * _.times(2, _.noop); 29552 * // => [undefined, undefined] 29553 */ 29554 function noop() { 29555 // No operation performed. 29556 } 29557 29558 /** 29559 * Creates a function that gets the argument at index `n`. If `n` is negative, 29560 * the nth argument from the end is returned. 29561 * 29562 * @static 29563 * @memberOf _ 29564 * @since 4.0.0 29565 * @category Util 29566 * @param {number} [n=0] The index of the argument to return. 29567 * @returns {Function} Returns the new pass-thru function. 29568 * @example 29569 * 29570 * var func = _.nthArg(1); 29571 * func('a', 'b', 'c', 'd'); 29572 * // => 'b' 29573 * 29574 * var func = _.nthArg(-2); 29575 * func('a', 'b', 'c', 'd'); 29576 * // => 'c' 29577 */ 29578 function nthArg(n) { 29579 n = toInteger(n); 29580 return baseRest(function(args) { 29581 return baseNth(args, n); 29582 }); 29583 } 29584 29585 /** 29586 * Creates a function that invokes `iteratees` with the arguments it receives 29587 * and returns their results. 29588 * 29589 * @static 29590 * @memberOf _ 29591 * @since 4.0.0 29592 * @category Util 29593 * @param {...(Function|Function[])} [iteratees=[_.identity]] 29594 * The iteratees to invoke. 29595 * @returns {Function} Returns the new function. 29596 * @example 29597 * 29598 * var func = _.over([Math.max, Math.min]); 29599 * 29600 * func(1, 2, 3, 4); 29601 * // => [4, 1] 29602 */ 29603 var over = createOver(arrayMap); 29604 29605 /** 29606 * Creates a function that checks if **all** of the `predicates` return 29607 * truthy when invoked with the arguments it receives. 29608 * 29609 * Following shorthands are possible for providing predicates. 29610 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. 29611 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. 29612 * 29613 * @static 29614 * @memberOf _ 29615 * @since 4.0.0 29616 * @category Util 29617 * @param {...(Function|Function[])} [predicates=[_.identity]] 29618 * The predicates to check. 29619 * @returns {Function} Returns the new function. 29620 * @example 29621 * 29622 * var func = _.overEvery([Boolean, isFinite]); 29623 * 29624 * func('1'); 29625 * // => true 29626 * 29627 * func(null); 29628 * // => false 29629 * 29630 * func(NaN); 29631 * // => false 29632 */ 29633 var overEvery = createOver(arrayEvery); 29634 29635 /** 29636 * Creates a function that checks if **any** of the `predicates` return 29637 * truthy when invoked with the arguments it receives. 29638 * 29639 * Following shorthands are possible for providing predicates. 29640 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. 29641 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. 29642 * 29643 * @static 29644 * @memberOf _ 29645 * @since 4.0.0 29646 * @category Util 29647 * @param {...(Function|Function[])} [predicates=[_.identity]] 29648 * The predicates to check. 29649 * @returns {Function} Returns the new function. 29650 * @example 29651 * 29652 * var func = _.overSome([Boolean, isFinite]); 29653 * 29654 * func('1'); 29655 * // => true 29656 * 29657 * func(null); 29658 * // => true 29659 * 29660 * func(NaN); 29661 * // => false 29662 * 29663 * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) 29664 * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) 29665 */ 29666 var overSome = createOver(arraySome); 29667 29668 /** 29669 * Creates a function that returns the value at `path` of a given object. 29670 * 29671 * @static 29672 * @memberOf _ 29673 * @since 2.4.0 29674 * @category Util 29675 * @param {Array|string} path The path of the property to get. 29676 * @returns {Function} Returns the new accessor function. 29677 * @example 29678 * 29679 * var objects = [ 29680 * { 'a': { 'b': 2 } }, 29681 * { 'a': { 'b': 1 } } 29682 * ]; 29683 * 29684 * _.map(objects, _.property('a.b')); 29685 * // => [2, 1] 29686 * 29687 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); 29688 * // => [1, 2] 29689 */ 29690 function property(path) { 29691 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 29692 } 29693 29694 /** 29695 * The opposite of `_.property`; this method creates a function that returns 29696 * the value at a given path of `object`. 29697 * 29698 * @static 29699 * @memberOf _ 29700 * @since 3.0.0 29701 * @category Util 29702 * @param {Object} object The object to query. 29703 * @returns {Function} Returns the new accessor function. 29704 * @example 29705 * 29706 * var array = [0, 1, 2], 29707 * object = { 'a': array, 'b': array, 'c': array }; 29708 * 29709 * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); 29710 * // => [2, 0] 29711 * 29712 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); 29713 * // => [2, 0] 29714 */ 29715 function propertyOf(object) { 29716 return function(path) { 29717 return object == null ? undefined : baseGet(object, path); 29718 }; 29719 } 29720 29721 /** 29722 * Creates an array of numbers (positive and/or negative) progressing from 29723 * `start` up to, but not including, `end`. A step of `-1` is used if a negative 29724 * `start` is specified without an `end` or `step`. If `end` is not specified, 29725 * it's set to `start` with `start` then set to `0`. 29726 * 29727 * **Note:** JavaScript follows the IEEE-754 standard for resolving 29728 * floating-point values which can produce unexpected results. 29729 * 29730 * @static 29731 * @since 0.1.0 29732 * @memberOf _ 29733 * @category Util 29734 * @param {number} [start=0] The start of the range. 29735 * @param {number} end The end of the range. 29736 * @param {number} [step=1] The value to increment or decrement by. 29737 * @returns {Array} Returns the range of numbers. 29738 * @see _.inRange, _.rangeRight 29739 * @example 29740 * 29741 * _.range(4); 29742 * // => [0, 1, 2, 3] 29743 * 29744 * _.range(-4); 29745 * // => [0, -1, -2, -3] 29746 * 29747 * _.range(1, 5); 29748 * // => [1, 2, 3, 4] 29749 * 29750 * _.range(0, 20, 5); 29751 * // => [0, 5, 10, 15] 29752 * 29753 * _.range(0, -4, -1); 29754 * // => [0, -1, -2, -3] 29755 * 29756 * _.range(1, 4, 0); 29757 * // => [1, 1, 1] 29758 * 29759 * _.range(0); 29760 * // => [] 29761 */ 29762 var range = createRange(); 29763 29764 /** 29765 * This method is like `_.range` except that it populates values in 29766 * descending order. 29767 * 29768 * @static 29769 * @memberOf _ 29770 * @since 4.0.0 29771 * @category Util 29772 * @param {number} [start=0] The start of the range. 29773 * @param {number} end The end of the range. 29774 * @param {number} [step=1] The value to increment or decrement by. 29775 * @returns {Array} Returns the range of numbers. 29776 * @see _.inRange, _.range 29777 * @example 29778 * 29779 * _.rangeRight(4); 29780 * // => [3, 2, 1, 0] 29781 * 29782 * _.rangeRight(-4); 29783 * // => [-3, -2, -1, 0] 29784 * 29785 * _.rangeRight(1, 5); 29786 * // => [4, 3, 2, 1] 29787 * 29788 * _.rangeRight(0, 20, 5); 29789 * // => [15, 10, 5, 0] 29790 * 29791 * _.rangeRight(0, -4, -1); 29792 * // => [-3, -2, -1, 0] 29793 * 29794 * _.rangeRight(1, 4, 0); 29795 * // => [1, 1, 1] 29796 * 29797 * _.rangeRight(0); 29798 * // => [] 29799 */ 29800 var rangeRight = createRange(true); 29801 29802 /** 29803 * This method returns a new empty array. 29804 * 29805 * @static 29806 * @memberOf _ 29807 * @since 4.13.0 29808 * @category Util 29809 * @returns {Array} Returns the new empty array. 29810 * @example 29811 * 29812 * var arrays = _.times(2, _.stubArray); 29813 * 29814 * console.log(arrays); 29815 * // => [[], []] 29816 * 29817 * console.log(arrays[0] === arrays[1]); 29818 * // => false 29819 */ 29820 function stubArray() { 29821 return []; 29822 } 29823 29824 /** 29825 * This method returns `false`. 29826 * 29827 * @static 29828 * @memberOf _ 29829 * @since 4.13.0 29830 * @category Util 29831 * @returns {boolean} Returns `false`. 29832 * @example 29833 * 29834 * _.times(2, _.stubFalse); 29835 * // => [false, false] 29836 */ 29837 function stubFalse() { 29838 return false; 29839 } 29840 29841 /** 29842 * This method returns a new empty object. 29843 * 29844 * @static 29845 * @memberOf _ 29846 * @since 4.13.0 29847 * @category Util 29848 * @returns {Object} Returns the new empty object. 29849 * @example 29850 * 29851 * var objects = _.times(2, _.stubObject); 29852 * 29853 * console.log(objects); 29854 * // => [{}, {}] 29855 * 29856 * console.log(objects[0] === objects[1]); 29857 * // => false 29858 */ 29859 function stubObject() { 29860 return {}; 29861 } 29862 29863 /** 29864 * This method returns an empty string. 29865 * 29866 * @static 29867 * @memberOf _ 29868 * @since 4.13.0 29869 * @category Util 29870 * @returns {string} Returns the empty string. 29871 * @example 29872 * 29873 * _.times(2, _.stubString); 29874 * // => ['', ''] 29875 */ 29876 function stubString() { 29877 return ''; 29878 } 29879 29880 /** 29881 * This method returns `true`. 29882 * 29883 * @static 29884 * @memberOf _ 29885 * @since 4.13.0 29886 * @category Util 29887 * @returns {boolean} Returns `true`. 29888 * @example 29889 * 29890 * _.times(2, _.stubTrue); 29891 * // => [true, true] 29892 */ 29893 function stubTrue() { 29894 return true; 29895 } 29896 29897 /** 29898 * Invokes the iteratee `n` times, returning an array of the results of 29899 * each invocation. The iteratee is invoked with one argument; (index). 29900 * 29901 * @static 29902 * @since 0.1.0 29903 * @memberOf _ 29904 * @category Util 29905 * @param {number} n The number of times to invoke `iteratee`. 29906 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 29907 * @returns {Array} Returns the array of results. 29908 * @example 29909 * 29910 * _.times(3, String); 29911 * // => ['0', '1', '2'] 29912 * 29913 * _.times(4, _.constant(0)); 29914 * // => [0, 0, 0, 0] 29915 */ 29916 function times(n, iteratee) { 29917 n = toInteger(n); 29918 if (n < 1 || n > MAX_SAFE_INTEGER) { 29919 return []; 29920 } 29921 var index = MAX_ARRAY_LENGTH, 29922 length = nativeMin(n, MAX_ARRAY_LENGTH); 29923 29924 iteratee = getIteratee(iteratee); 29925 n -= MAX_ARRAY_LENGTH; 29926 29927 var result = baseTimes(length, iteratee); 29928 while (++index < n) { 29929 iteratee(index); 29930 } 29931 return result; 29932 } 29933 29934 /** 29935 * Converts `value` to a property path array. 29936 * 29937 * @static 29938 * @memberOf _ 29939 * @since 4.0.0 29940 * @category Util 29941 * @param {*} value The value to convert. 29942 * @returns {Array} Returns the new property path array. 29943 * @example 29944 * 29945 * _.toPath('a.b.c'); 29946 * // => ['a', 'b', 'c'] 29947 * 29948 * _.toPath('a[0].b.c'); 29949 * // => ['a', '0', 'b', 'c'] 29950 */ 29951 function toPath(value) { 29952 if (isArray(value)) { 29953 return arrayMap(value, toKey); 29954 } 29955 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 29956 } 29957 29958 /** 29959 * Generates a unique ID. If `prefix` is given, the ID is appended to it. 29960 * 29961 * @static 29962 * @since 0.1.0 29963 * @memberOf _ 29964 * @category Util 29965 * @param {string} [prefix=''] The value to prefix the ID with. 29966 * @returns {string} Returns the unique ID. 29967 * @example 29968 * 29969 * _.uniqueId('contact_'); 29970 * // => 'contact_104' 29971 * 29972 * _.uniqueId(); 29973 * // => '105' 29974 */ 29975 function uniqueId(prefix) { 29976 var id = ++idCounter; 29977 return toString(prefix) + id; 29978 } 29979 29980 /*------------------------------------------------------------------------*/ 29981 29982 /** 29983 * Adds two numbers. 29984 * 29985 * @static 29986 * @memberOf _ 29987 * @since 3.4.0 29988 * @category Math 29989 * @param {number} augend The first number in an addition. 29990 * @param {number} addend The second number in an addition. 29991 * @returns {number} Returns the total. 29992 * @example 29993 * 29994 * _.add(6, 4); 29995 * // => 10 29996 */ 29997 var add = createMathOperation(function(augend, addend) { 29998 return augend + addend; 29999 }, 0); 30000 30001 /** 30002 * Computes `number` rounded up to `precision`. 30003 * 30004 * @static 30005 * @memberOf _ 30006 * @since 3.10.0 30007 * @category Math 30008 * @param {number} number The number to round up. 30009 * @param {number} [precision=0] The precision to round up to. 30010 * @returns {number} Returns the rounded up number. 30011 * @example 30012 * 30013 * _.ceil(4.006); 30014 * // => 5 30015 * 30016 * _.ceil(6.004, 2); 30017 * // => 6.01 30018 * 30019 * _.ceil(6040, -2); 30020 * // => 6100 30021 */ 30022 var ceil = createRound('ceil'); 30023 30024 /** 30025 * Divide two numbers. 30026 * 30027 * @static 30028 * @memberOf _ 30029 * @since 4.7.0 30030 * @category Math 30031 * @param {number} dividend The first number in a division. 30032 * @param {number} divisor The second number in a division. 30033 * @returns {number} Returns the quotient. 30034 * @example 30035 * 30036 * _.divide(6, 4); 30037 * // => 1.5 30038 */ 30039 var divide = createMathOperation(function(dividend, divisor) { 30040 return dividend / divisor; 30041 }, 1); 30042 30043 /** 30044 * Computes `number` rounded down to `precision`. 30045 * 30046 * @static 30047 * @memberOf _ 30048 * @since 3.10.0 30049 * @category Math 30050 * @param {number} number The number to round down. 30051 * @param {number} [precision=0] The precision to round down to. 30052 * @returns {number} Returns the rounded down number. 30053 * @example 30054 * 30055 * _.floor(4.006); 30056 * // => 4 30057 * 30058 * _.floor(0.046, 2); 30059 * // => 0.04 30060 * 30061 * _.floor(4060, -2); 30062 * // => 4000 30063 */ 30064 var floor = createRound('floor'); 30065 30066 /** 30067 * Computes the maximum value of `array`. If `array` is empty or falsey, 30068 * `undefined` is returned. 30069 * 30070 * @static 30071 * @since 0.1.0 30072 * @memberOf _ 30073 * @category Math 30074 * @param {Array} array The array to iterate over. 30075 * @returns {*} Returns the maximum value. 30076 * @example 30077 * 30078 * _.max([4, 2, 8, 6]); 30079 * // => 8 30080 * 30081 * _.max([]); 30082 * // => undefined 30083 */ 30084 function max(array) { 30085 return (array && array.length) 30086 ? baseExtremum(array, identity, baseGt) 30087 : undefined; 30088 } 30089 30090 /** 30091 * This method is like `_.max` except that it accepts `iteratee` which is 30092 * invoked for each element in `array` to generate the criterion by which 30093 * the value is ranked. The iteratee is invoked with one argument: (value). 30094 * 30095 * @static 30096 * @memberOf _ 30097 * @since 4.0.0 30098 * @category Math 30099 * @param {Array} array The array to iterate over. 30100 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 30101 * @returns {*} Returns the maximum value. 30102 * @example 30103 * 30104 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 30105 * 30106 * _.maxBy(objects, function(o) { return o.n; }); 30107 * // => { 'n': 2 } 30108 * 30109 * // The `_.property` iteratee shorthand. 30110 * _.maxBy(objects, 'n'); 30111 * // => { 'n': 2 } 30112 */ 30113 function maxBy(array, iteratee) { 30114 return (array && array.length) 30115 ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) 30116 : undefined; 30117 } 30118 30119 /** 30120 * Computes the mean of the values in `array`. 30121 * 30122 * @static 30123 * @memberOf _ 30124 * @since 4.0.0 30125 * @category Math 30126 * @param {Array} array The array to iterate over. 30127 * @returns {number} Returns the mean. 30128 * @example 30129 * 30130 * _.mean([4, 2, 8, 6]); 30131 * // => 5 30132 */ 30133 function mean(array) { 30134 return baseMean(array, identity); 30135 } 30136 30137 /** 30138 * This method is like `_.mean` except that it accepts `iteratee` which is 30139 * invoked for each element in `array` to generate the value to be averaged. 30140 * The iteratee is invoked with one argument: (value). 30141 * 30142 * @static 30143 * @memberOf _ 30144 * @since 4.7.0 30145 * @category Math 30146 * @param {Array} array The array to iterate over. 30147 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 30148 * @returns {number} Returns the mean. 30149 * @example 30150 * 30151 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 30152 * 30153 * _.meanBy(objects, function(o) { return o.n; }); 30154 * // => 5 30155 * 30156 * // The `_.property` iteratee shorthand. 30157 * _.meanBy(objects, 'n'); 30158 * // => 5 30159 */ 30160 function meanBy(array, iteratee) { 30161 return baseMean(array, getIteratee(iteratee, 2)); 30162 } 30163 30164 /** 30165 * Computes the minimum value of `array`. If `array` is empty or falsey, 30166 * `undefined` is returned. 30167 * 30168 * @static 30169 * @since 0.1.0 30170 * @memberOf _ 30171 * @category Math 30172 * @param {Array} array The array to iterate over. 30173 * @returns {*} Returns the minimum value. 30174 * @example 30175 * 30176 * _.min([4, 2, 8, 6]); 30177 * // => 2 30178 * 30179 * _.min([]); 30180 * // => undefined 30181 */ 30182 function min(array) { 30183 return (array && array.length) 30184 ? baseExtremum(array, identity, baseLt) 30185 : undefined; 30186 } 30187 30188 /** 30189 * This method is like `_.min` except that it accepts `iteratee` which is 30190 * invoked for each element in `array` to generate the criterion by which 30191 * the value is ranked. The iteratee is invoked with one argument: (value). 30192 * 30193 * @static 30194 * @memberOf _ 30195 * @since 4.0.0 30196 * @category Math 30197 * @param {Array} array The array to iterate over. 30198 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 30199 * @returns {*} Returns the minimum value. 30200 * @example 30201 * 30202 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 30203 * 30204 * _.minBy(objects, function(o) { return o.n; }); 30205 * // => { 'n': 1 } 30206 * 30207 * // The `_.property` iteratee shorthand. 30208 * _.minBy(objects, 'n'); 30209 * // => { 'n': 1 } 30210 */ 30211 function minBy(array, iteratee) { 30212 return (array && array.length) 30213 ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) 30214 : undefined; 30215 } 30216 30217 /** 30218 * Multiply two numbers. 30219 * 30220 * @static 30221 * @memberOf _ 30222 * @since 4.7.0 30223 * @category Math 30224 * @param {number} multiplier The first number in a multiplication. 30225 * @param {number} multiplicand The second number in a multiplication. 30226 * @returns {number} Returns the product. 30227 * @example 30228 * 30229 * _.multiply(6, 4); 30230 * // => 24 30231 */ 30232 var multiply = createMathOperation(function(multiplier, multiplicand) { 30233 return multiplier * multiplicand; 30234 }, 1); 30235 30236 /** 30237 * Computes `number` rounded to `precision`. 30238 * 30239 * @static 30240 * @memberOf _ 30241 * @since 3.10.0 30242 * @category Math 30243 * @param {number} number The number to round. 30244 * @param {number} [precision=0] The precision to round to. 30245 * @returns {number} Returns the rounded number. 30246 * @example 30247 * 30248 * _.round(4.006); 30249 * // => 4 30250 * 30251 * _.round(4.006, 2); 30252 * // => 4.01 30253 * 30254 * _.round(4060, -2); 30255 * // => 4100 30256 */ 30257 var round = createRound('round'); 30258 30259 /** 30260 * Subtract two numbers. 30261 * 30262 * @static 30263 * @memberOf _ 30264 * @since 4.0.0 30265 * @category Math 30266 * @param {number} minuend The first number in a subtraction. 30267 * @param {number} subtrahend The second number in a subtraction. 30268 * @returns {number} Returns the difference. 30269 * @example 30270 * 30271 * _.subtract(6, 4); 30272 * // => 2 30273 */ 30274 var subtract = createMathOperation(function(minuend, subtrahend) { 30275 return minuend - subtrahend; 30276 }, 0); 30277 30278 /** 30279 * Computes the sum of the values in `array`. 30280 * 30281 * @static 30282 * @memberOf _ 30283 * @since 3.4.0 30284 * @category Math 30285 * @param {Array} array The array to iterate over. 30286 * @returns {number} Returns the sum. 30287 * @example 30288 * 30289 * _.sum([4, 2, 8, 6]); 30290 * // => 20 30291 */ 30292 function sum(array) { 30293 return (array && array.length) 30294 ? baseSum(array, identity) 30295 : 0; 30296 } 30297 30298 /** 30299 * This method is like `_.sum` except that it accepts `iteratee` which is 30300 * invoked for each element in `array` to generate the value to be summed. 30301 * The iteratee is invoked with one argument: (value). 30302 * 30303 * @static 30304 * @memberOf _ 30305 * @since 4.0.0 30306 * @category Math 30307 * @param {Array} array The array to iterate over. 30308 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 30309 * @returns {number} Returns the sum. 30310 * @example 30311 * 30312 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 30313 * 30314 * _.sumBy(objects, function(o) { return o.n; }); 30315 * // => 20 30316 * 30317 * // The `_.property` iteratee shorthand. 30318 * _.sumBy(objects, 'n'); 30319 * // => 20 30320 */ 30321 function sumBy(array, iteratee) { 30322 return (array && array.length) 30323 ? baseSum(array, getIteratee(iteratee, 2)) 30324 : 0; 30325 } 30326 30327 /*------------------------------------------------------------------------*/ 30328 30329 // Add methods that return wrapped values in chain sequences. 30330 lodash.after = after; 30331 lodash.ary = ary; 30332 lodash.assign = assign; 30333 lodash.assignIn = assignIn; 30334 lodash.assignInWith = assignInWith; 30335 lodash.assignWith = assignWith; 30336 lodash.at = at; 30337 lodash.before = before; 30338 lodash.bind = bind; 30339 lodash.bindAll = bindAll; 30340 lodash.bindKey = bindKey; 30341 lodash.castArray = castArray; 30342 lodash.chain = chain; 30343 lodash.chunk = chunk; 30344 lodash.compact = compact; 30345 lodash.concat = concat; 30346 lodash.cond = cond; 30347 lodash.conforms = conforms; 30348 lodash.constant = constant; 30349 lodash.countBy = countBy; 30350 lodash.create = create; 30351 lodash.curry = curry; 30352 lodash.curryRight = curryRight; 30353 lodash.debounce = debounce; 30354 lodash.defaults = defaults; 30355 lodash.defaultsDeep = defaultsDeep; 30356 lodash.defer = defer; 30357 lodash.delay = delay; 30358 lodash.difference = difference; 30359 lodash.differenceBy = differenceBy; 30360 lodash.differenceWith = differenceWith; 30361 lodash.drop = drop; 30362 lodash.dropRight = dropRight; 30363 lodash.dropRightWhile = dropRightWhile; 30364 lodash.dropWhile = dropWhile; 30365 lodash.fill = fill; 30366 lodash.filter = filter; 30367 lodash.flatMap = flatMap; 30368 lodash.flatMapDeep = flatMapDeep; 30369 lodash.flatMapDepth = flatMapDepth; 30370 lodash.flatten = flatten; 30371 lodash.flattenDeep = flattenDeep; 30372 lodash.flattenDepth = flattenDepth; 30373 lodash.flip = flip; 30374 lodash.flow = flow; 30375 lodash.flowRight = flowRight; 30376 lodash.fromPairs = fromPairs; 30377 lodash.functions = functions; 30378 lodash.functionsIn = functionsIn; 30379 lodash.groupBy = groupBy; 30380 lodash.initial = initial; 30381 lodash.intersection = intersection; 30382 lodash.intersectionBy = intersectionBy; 30383 lodash.intersectionWith = intersectionWith; 30384 lodash.invert = invert; 30385 lodash.invertBy = invertBy; 30386 lodash.invokeMap = invokeMap; 30387 lodash.iteratee = iteratee; 30388 lodash.keyBy = keyBy; 30389 lodash.keys = keys; 30390 lodash.keysIn = keysIn; 30391 lodash.map = map; 30392 lodash.mapKeys = mapKeys; 30393 lodash.mapValues = mapValues; 30394 lodash.matches = matches; 30395 lodash.matchesProperty = matchesProperty; 30396 lodash.memoize = memoize; 30397 lodash.merge = merge; 30398 lodash.mergeWith = mergeWith; 30399 lodash.method = method; 30400 lodash.methodOf = methodOf; 30401 lodash.mixin = mixin; 30402 lodash.negate = negate; 30403 lodash.nthArg = nthArg; 30404 lodash.omit = omit; 30405 lodash.omitBy = omitBy; 30406 lodash.once = once; 30407 lodash.orderBy = orderBy; 30408 lodash.over = over; 30409 lodash.overArgs = overArgs; 30410 lodash.overEvery = overEvery; 30411 lodash.overSome = overSome; 30412 lodash.partial = partial; 30413 lodash.partialRight = partialRight; 30414 lodash.partition = partition; 30415 lodash.pick = pick; 30416 lodash.pickBy = pickBy; 30417 lodash.property = property; 30418 lodash.propertyOf = propertyOf; 30419 lodash.pull = pull; 30420 lodash.pullAll = pullAll; 30421 lodash.pullAllBy = pullAllBy; 30422 lodash.pullAllWith = pullAllWith; 30423 lodash.pullAt = pullAt; 30424 lodash.range = range; 30425 lodash.rangeRight = rangeRight; 30426 lodash.rearg = rearg; 30427 lodash.reject = reject; 30428 lodash.remove = remove; 30429 lodash.rest = rest; 30430 lodash.reverse = reverse; 30431 lodash.sampleSize = sampleSize; 30432 lodash.set = set; 30433 lodash.setWith = setWith; 30434 lodash.shuffle = shuffle; 30435 lodash.slice = slice; 30436 lodash.sortBy = sortBy; 30437 lodash.sortedUniq = sortedUniq; 30438 lodash.sortedUniqBy = sortedUniqBy; 30439 lodash.split = split; 30440 lodash.spread = spread; 30441 lodash.tail = tail; 30442 lodash.take = take; 30443 lodash.takeRight = takeRight; 30444 lodash.takeRightWhile = takeRightWhile; 30445 lodash.takeWhile = takeWhile; 30446 lodash.tap = tap; 30447 lodash.throttle = throttle; 30448 lodash.thru = thru; 30449 lodash.toArray = toArray; 30450 lodash.toPairs = toPairs; 30451 lodash.toPairsIn = toPairsIn; 30452 lodash.toPath = toPath; 30453 lodash.toPlainObject = toPlainObject; 30454 lodash.transform = transform; 30455 lodash.unary = unary; 30456 lodash.union = union; 30457 lodash.unionBy = unionBy; 30458 lodash.unionWith = unionWith; 30459 lodash.uniq = uniq; 30460 lodash.uniqBy = uniqBy; 30461 lodash.uniqWith = uniqWith; 30462 lodash.unset = unset; 30463 lodash.unzip = unzip; 30464 lodash.unzipWith = unzipWith; 30465 lodash.update = update; 30466 lodash.updateWith = updateWith; 30467 lodash.values = values; 30468 lodash.valuesIn = valuesIn; 30469 lodash.without = without; 30470 lodash.words = words; 30471 lodash.wrap = wrap; 30472 lodash.xor = xor; 30473 lodash.xorBy = xorBy; 30474 lodash.xorWith = xorWith; 30475 lodash.zip = zip; 30476 lodash.zipObject = zipObject; 30477 lodash.zipObjectDeep = zipObjectDeep; 30478 lodash.zipWith = zipWith; 30479 30480 // Add aliases. 30481 lodash.entries = toPairs; 30482 lodash.entriesIn = toPairsIn; 30483 lodash.extend = assignIn; 30484 lodash.extendWith = assignInWith; 30485 30486 // Add methods to `lodash.prototype`. 30487 mixin(lodash, lodash); 30488 30489 /*------------------------------------------------------------------------*/ 30490 30491 // Add methods that return unwrapped values in chain sequences. 30492 lodash.add = add; 30493 lodash.attempt = attempt; 30494 lodash.camelCase = camelCase; 30495 lodash.capitalize = capitalize; 30496 lodash.ceil = ceil; 30497 lodash.clamp = clamp; 30498 lodash.clone = clone; 30499 lodash.cloneDeep = cloneDeep; 30500 lodash.cloneDeepWith = cloneDeepWith; 30501 lodash.cloneWith = cloneWith; 30502 lodash.conformsTo = conformsTo; 30503 lodash.deburr = deburr; 30504 lodash.defaultTo = defaultTo; 30505 lodash.divide = divide; 30506 lodash.endsWith = endsWith; 30507 lodash.eq = eq; 30508 lodash.escape = escape; 30509 lodash.escapeRegExp = escapeRegExp; 30510 lodash.every = every; 30511 lodash.find = find; 30512 lodash.findIndex = findIndex; 30513 lodash.findKey = findKey; 30514 lodash.findLast = findLast; 30515 lodash.findLastIndex = findLastIndex; 30516 lodash.findLastKey = findLastKey; 30517 lodash.floor = floor; 30518 lodash.forEach = forEach; 30519 lodash.forEachRight = forEachRight; 30520 lodash.forIn = forIn; 30521 lodash.forInRight = forInRight; 30522 lodash.forOwn = forOwn; 30523 lodash.forOwnRight = forOwnRight; 30524 lodash.get = get; 30525 lodash.gt = gt; 30526 lodash.gte = gte; 30527 lodash.has = has; 30528 lodash.hasIn = hasIn; 30529 lodash.head = head; 30530 lodash.identity = identity; 30531 lodash.includes = includes; 30532 lodash.indexOf = indexOf; 30533 lodash.inRange = inRange; 30534 lodash.invoke = invoke; 30535 lodash.isArguments = isArguments; 30536 lodash.isArray = isArray; 30537 lodash.isArrayBuffer = isArrayBuffer; 30538 lodash.isArrayLike = isArrayLike; 30539 lodash.isArrayLikeObject = isArrayLikeObject; 30540 lodash.isBoolean = isBoolean; 30541 lodash.isBuffer = isBuffer; 30542 lodash.isDate = isDate; 30543 lodash.isElement = isElement; 30544 lodash.isEmpty = isEmpty; 30545 lodash.isEqual = isEqual; 30546 lodash.isEqualWith = isEqualWith; 30547 lodash.isError = isError; 30548 lodash.isFinite = isFinite; 30549 lodash.isFunction = isFunction; 30550 lodash.isInteger = isInteger; 30551 lodash.isLength = isLength; 30552 lodash.isMap = isMap; 30553 lodash.isMatch = isMatch; 30554 lodash.isMatchWith = isMatchWith; 30555 lodash.isNaN = isNaN; 30556 lodash.isNative = isNative; 30557 lodash.isNil = isNil; 30558 lodash.isNull = isNull; 30559 lodash.isNumber = isNumber; 30560 lodash.isObject = isObject; 30561 lodash.isObjectLike = isObjectLike; 30562 lodash.isPlainObject = isPlainObject; 30563 lodash.isRegExp = isRegExp; 30564 lodash.isSafeInteger = isSafeInteger; 30565 lodash.isSet = isSet; 30566 lodash.isString = isString; 30567 lodash.isSymbol = isSymbol; 30568 lodash.isTypedArray = isTypedArray; 30569 lodash.isUndefined = isUndefined; 30570 lodash.isWeakMap = isWeakMap; 30571 lodash.isWeakSet = isWeakSet; 30572 lodash.join = join; 30573 lodash.kebabCase = kebabCase; 30574 lodash.last = last; 30575 lodash.lastIndexOf = lastIndexOf; 30576 lodash.lowerCase = lowerCase; 30577 lodash.lowerFirst = lowerFirst; 30578 lodash.lt = lt; 30579 lodash.lte = lte; 30580 lodash.max = max; 30581 lodash.maxBy = maxBy; 30582 lodash.mean = mean; 30583 lodash.meanBy = meanBy; 30584 lodash.min = min; 30585 lodash.minBy = minBy; 30586 lodash.stubArray = stubArray; 30587 lodash.stubFalse = stubFalse; 30588 lodash.stubObject = stubObject; 30589 lodash.stubString = stubString; 30590 lodash.stubTrue = stubTrue; 30591 lodash.multiply = multiply; 30592 lodash.nth = nth; 30593 lodash.noConflict = noConflict; 30594 lodash.noop = noop; 30595 lodash.now = now; 30596 lodash.pad = pad; 30597 lodash.padEnd = padEnd; 30598 lodash.padStart = padStart; 30599 lodash.parseInt = parseInt; 30600 lodash.random = random; 30601 lodash.reduce = reduce; 30602 lodash.reduceRight = reduceRight; 30603 lodash.repeat = repeat; 30604 lodash.replace = replace; 30605 lodash.result = result; 30606 lodash.round = round; 30607 lodash.runInContext = runInContext; 30608 lodash.sample = sample; 30609 lodash.size = size; 30610 lodash.snakeCase = snakeCase; 30611 lodash.some = some; 30612 lodash.sortedIndex = sortedIndex; 30613 lodash.sortedIndexBy = sortedIndexBy; 30614 lodash.sortedIndexOf = sortedIndexOf; 30615 lodash.sortedLastIndex = sortedLastIndex; 30616 lodash.sortedLastIndexBy = sortedLastIndexBy; 30617 lodash.sortedLastIndexOf = sortedLastIndexOf; 30618 lodash.startCase = startCase; 30619 lodash.startsWith = startsWith; 30620 lodash.subtract = subtract; 30621 lodash.sum = sum; 30622 lodash.sumBy = sumBy; 30623 lodash.template = template; 30624 lodash.times = times; 30625 lodash.toFinite = toFinite; 30626 lodash.toInteger = toInteger; 30627 lodash.toLength = toLength; 30628 lodash.toLower = toLower; 30629 lodash.toNumber = toNumber; 30630 lodash.toSafeInteger = toSafeInteger; 30631 lodash.toString = toString; 30632 lodash.toUpper = toUpper; 30633 lodash.trim = trim; 30634 lodash.trimEnd = trimEnd; 30635 lodash.trimStart = trimStart; 30636 lodash.truncate = truncate; 30637 lodash.unescape = unescape; 30638 lodash.uniqueId = uniqueId; 30639 lodash.upperCase = upperCase; 30640 lodash.upperFirst = upperFirst; 30641 30642 // Add aliases. 30643 lodash.each = forEach; 30644 lodash.eachRight = forEachRight; 30645 lodash.first = head; 30646 30647 mixin(lodash, (function() { 30648 var source = {}; 30649 baseForOwn(lodash, function(func, methodName) { 30650 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 30651 source[methodName] = func; 30652 } 30653 }); 30654 return source; 30655 }()), { 'chain': false }); 30656 30657 /*------------------------------------------------------------------------*/ 30658 30659 /** 30660 * The semantic version number. 30661 * 30662 * @static 30663 * @memberOf _ 30664 * @type {string} 30665 */ 30666 lodash.VERSION = VERSION; 30667 30668 // Assign default placeholders. 30669 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { 30670 lodash[methodName].placeholder = lodash; 30671 }); 30672 30673 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. 30674 arrayEach(['drop', 'take'], function(methodName, index) { 30675 LazyWrapper.prototype[methodName] = function(n) { 30676 n = n === undefined ? 1 : nativeMax(toInteger(n), 0); 30677 30678 var result = (this.__filtered__ && !index) 30679 ? new LazyWrapper(this) 30680 : this.clone(); 30681 30682 if (result.__filtered__) { 30683 result.__takeCount__ = nativeMin(n, result.__takeCount__); 30684 } else { 30685 result.__views__.push({ 30686 'size': nativeMin(n, MAX_ARRAY_LENGTH), 30687 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') 30688 }); 30689 } 30690 return result; 30691 }; 30692 30693 LazyWrapper.prototype[methodName + 'Right'] = function(n) { 30694 return this.reverse()[methodName](n).reverse(); 30695 }; 30696 }); 30697 30698 // Add `LazyWrapper` methods that accept an `iteratee` value. 30699 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { 30700 var type = index + 1, 30701 isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 30702 30703 LazyWrapper.prototype[methodName] = function(iteratee) { 30704 var result = this.clone(); 30705 result.__iteratees__.push({ 30706 'iteratee': getIteratee(iteratee, 3), 30707 'type': type 30708 }); 30709 result.__filtered__ = result.__filtered__ || isFilter; 30710 return result; 30711 }; 30712 }); 30713 30714 // Add `LazyWrapper` methods for `_.head` and `_.last`. 30715 arrayEach(['head', 'last'], function(methodName, index) { 30716 var takeName = 'take' + (index ? 'Right' : ''); 30717 30718 LazyWrapper.prototype[methodName] = function() { 30719 return this[takeName](1).value()[0]; 30720 }; 30721 }); 30722 30723 // Add `LazyWrapper` methods for `_.initial` and `_.tail`. 30724 arrayEach(['initial', 'tail'], function(methodName, index) { 30725 var dropName = 'drop' + (index ? '' : 'Right'); 30726 30727 LazyWrapper.prototype[methodName] = function() { 30728 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 30729 }; 30730 }); 30731 30732 LazyWrapper.prototype.compact = function() { 30733 return this.filter(identity); 30734 }; 30735 30736 LazyWrapper.prototype.find = function(predicate) { 30737 return this.filter(predicate).head(); 30738 }; 30739 30740 LazyWrapper.prototype.findLast = function(predicate) { 30741 return this.reverse().find(predicate); 30742 }; 30743 30744 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 30745 if (typeof path == 'function') { 30746 return new LazyWrapper(this); 30747 } 30748 return this.map(function(value) { 30749 return baseInvoke(value, path, args); 30750 }); 30751 }); 30752 30753 LazyWrapper.prototype.reject = function(predicate) { 30754 return this.filter(negate(getIteratee(predicate))); 30755 }; 30756 30757 LazyWrapper.prototype.slice = function(start, end) { 30758 start = toInteger(start); 30759 30760 var result = this; 30761 if (result.__filtered__ && (start > 0 || end < 0)) { 30762 return new LazyWrapper(result); 30763 } 30764 if (start < 0) { 30765 result = result.takeRight(-start); 30766 } else if (start) { 30767 result = result.drop(start); 30768 } 30769 if (end !== undefined) { 30770 end = toInteger(end); 30771 result = end < 0 ? result.dropRight(-end) : result.take(end - start); 30772 } 30773 return result; 30774 }; 30775 30776 LazyWrapper.prototype.takeRightWhile = function(predicate) { 30777 return this.reverse().takeWhile(predicate).reverse(); 30778 }; 30779 30780 LazyWrapper.prototype.toArray = function() { 30781 return this.take(MAX_ARRAY_LENGTH); 30782 }; 30783 30784 // Add `LazyWrapper` methods to `lodash.prototype`. 30785 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 30786 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), 30787 isTaker = /^(?:head|last)$/.test(methodName), 30788 lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], 30789 retUnwrapped = isTaker || /^find/.test(methodName); 30790 30791 if (!lodashFunc) { 30792 return; 30793 } 30794 lodash.prototype[methodName] = function() { 30795 var value = this.__wrapped__, 30796 args = isTaker ? [1] : arguments, 30797 isLazy = value instanceof LazyWrapper, 30798 iteratee = args[0], 30799 useLazy = isLazy || isArray(value); 30800 30801 var interceptor = function(value) { 30802 var result = lodashFunc.apply(lodash, arrayPush([value], args)); 30803 return (isTaker && chainAll) ? result[0] : result; 30804 }; 30805 30806 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { 30807 // Avoid lazy use if the iteratee has a "length" value other than `1`. 30808 isLazy = useLazy = false; 30809 } 30810 var chainAll = this.__chain__, 30811 isHybrid = !!this.__actions__.length, 30812 isUnwrapped = retUnwrapped && !chainAll, 30813 onlyLazy = isLazy && !isHybrid; 30814 30815 if (!retUnwrapped && useLazy) { 30816 value = onlyLazy ? value : new LazyWrapper(this); 30817 var result = func.apply(value, args); 30818 result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); 30819 return new LodashWrapper(result, chainAll); 30820 } 30821 if (isUnwrapped && onlyLazy) { 30822 return func.apply(this, args); 30823 } 30824 result = this.thru(interceptor); 30825 return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; 30826 }; 30827 }); 30828 30829 // Add `Array` methods to `lodash.prototype`. 30830 arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { 30831 var func = arrayProto[methodName], 30832 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', 30833 retUnwrapped = /^(?:pop|shift)$/.test(methodName); 30834 30835 lodash.prototype[methodName] = function() { 30836 var args = arguments; 30837 if (retUnwrapped && !this.__chain__) { 30838 var value = this.value(); 30839 return func.apply(isArray(value) ? value : [], args); 30840 } 30841 return this[chainName](function(value) { 30842 return func.apply(isArray(value) ? value : [], args); 30843 }); 30844 }; 30845 }); 30846 30847 // Map minified method names to their real names. 30848 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 30849 var lodashFunc = lodash[methodName]; 30850 if (lodashFunc) { 30851 var key = lodashFunc.name + ''; 30852 if (!hasOwnProperty.call(realNames, key)) { 30853 realNames[key] = []; 30854 } 30855 realNames[key].push({ 'name': methodName, 'func': lodashFunc }); 30856 } 30857 }); 30858 30859 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{ 30860 'name': 'wrapper', 30861 'func': undefined 30862 }]; 30863 30864 // Add methods to `LazyWrapper`. 30865 LazyWrapper.prototype.clone = lazyClone; 30866 LazyWrapper.prototype.reverse = lazyReverse; 30867 LazyWrapper.prototype.value = lazyValue; 30868 30869 // Add chain sequence methods to the `lodash` wrapper. 30870 lodash.prototype.at = wrapperAt; 30871 lodash.prototype.chain = wrapperChain; 30872 lodash.prototype.commit = wrapperCommit; 30873 lodash.prototype.next = wrapperNext; 30874 lodash.prototype.plant = wrapperPlant; 30875 lodash.prototype.reverse = wrapperReverse; 30876 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 30877 30878 // Add lazy aliases. 30879 lodash.prototype.first = lodash.prototype.head; 30880 30881 if (symIterator) { 30882 lodash.prototype[symIterator] = wrapperToIterator; 30883 } 30884 return lodash; 30885 }); 30886 30887 /*--------------------------------------------------------------------------*/ 30888 30889 // Export lodash. 30890 var _ = runInContext(); 30891 30892 // Some AMD build optimizers, like r.js, check for condition patterns like: 30893 if (true) { 30894 // Expose Lodash on the global object to prevent errors when Lodash is 30895 // loaded by a script tag in the presence of an AMD loader. 30896 // See http://requirejs.org/docs/errors.html#mismatch for more details. 30897 // Use `_.noConflict` to remove Lodash from the global object. 30898 root._ = _; 30899 30900 // Define as an anonymous module so, through path mapping, it can be 30901 // referenced as the "underscore" module. 30902 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { 30903 return _; 30904 }).call(exports, __webpack_require__, exports, module), 30905 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 30906 } 30907 // Check for `exports` after `define` in case a build optimizer adds it. 30908 else {} 30909}.call(this)); 30910 30911 30912/***/ }), 30913
30914/***/ "./resources/sass/app.scss": 30915/*!*********************************!*\ 30916 !*** ./resources/sass/app.scss ***! 30917 \*********************************/ 30918/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 30919 30920"use strict"; 30921__webpack_require__.r(__webpack_exports__); 30922// extracted by mini-css-extract-plugin 30923 30924 30925/***/ }), 30926
vendor: 5,636 bytes, lines 30927-31120
30927/***/ "./node_modules/process/browser.js": 30928/*!*****************************************!*\ 30929 !*** ./node_modules/process/browser.js ***! 30930 \*****************************************/ 30931/***/ ((module) => { 30932 30933// shim for using process in browser 30934var process = module.exports = {}; 30935 30936// cached from whatever global is present so that test runners that stub it 30937// don't break things. But we need to wrap it in a try catch in case it is 30938// wrapped in strict mode code which doesn't define any globals. It's inside a 30939// function because try/catches deoptimize in certain engines. 30940 30941var cachedSetTimeout; 30942var cachedClearTimeout; 30943 30944function defaultSetTimout() { 30945 throw new Error('setTimeout has not been defined'); 30946} 30947function defaultClearTimeout () { 30948 throw new Error('clearTimeout has not been defined'); 30949} 30950(function () { 30951 try { 30952 if (typeof setTimeout === 'function') { 30953 cachedSetTimeout = setTimeout; 30954 } else { 30955 cachedSetTimeout = defaultSetTimout; 30956 } 30957 } catch (e) { 30958 cachedSetTimeout = defaultSetTimout; 30959 } 30960 try { 30961 if (typeof clearTimeout === 'function') { 30962 cachedClearTimeout = clearTimeout; 30963 } else { 30964 cachedClearTimeout = defaultClearTimeout; 30965 } 30966 } catch (e) { 30967 cachedClearTimeout = defaultClearTimeout; 30968 } 30969} ()) 30970function runTimeout(fun) { 30971 if (cachedSetTimeout === setTimeout) { 30972 //normal enviroments in sane situations 30973 return setTimeout(fun, 0); 30974 } 30975 // if setTimeout wasn't available but was latter defined 30976 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 30977 cachedSetTimeout = setTimeout; 30978 return setTimeout(fun, 0); 30979 } 30980 try { 30981 // when when somebody has screwed with setTimeout but no I.E. maddness 30982 return cachedSetTimeout(fun, 0); 30983 } catch(e){ 30984 try { 30985 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 30986 return cachedSetTimeout.call(null, fun, 0); 30987 } catch(e){ 30988 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 30989 return cachedSetTimeout.call(this, fun, 0); 30990 } 30991 } 30992 30993 30994} 30995function runClearTimeout(marker) { 30996 if (cachedClearTimeout === clearTimeout) { 30997 //normal enviroments in sane situations 30998 return clearTimeout(marker); 30999 } 31000 // if clearTimeout wasn't available but was latter defined 31001 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 31002 cachedClearTimeout = clearTimeout; 31003 return clearTimeout(marker); 31004 } 31005 try { 31006 // when when somebody has screwed with setTimeout but no I.E. maddness 31007 return cachedClearTimeout(marker); 31008 } catch (e){ 31009 try { 31010 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 31011 return cachedClearTimeout.call(null, marker); 31012 } catch (e){ 31013 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 31014 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 31015 return cachedClearTimeout.call(this, marker); 31016 } 31017 } 31018 31019 31020 31021} 31022var queue = []; 31023var draining = false; 31024var currentQueue; 31025var queueIndex = -1; 31026 31027function cleanUpNextTick() { 31028 if (!draining || !currentQueue) { 31029 return; 31030 } 31031 draining = false; 31032 if (currentQueue.length) { 31033 queue = currentQueue.concat(queue); 31034 } else { 31035 queueIndex = -1; 31036 } 31037 if (queue.length) { 31038 drainQueue(); 31039 } 31040} 31041 31042function drainQueue() { 31043 if (draining) { 31044 return; 31045 } 31046 var timeout = runTimeout(cleanUpNextTick); 31047 draining = true; 31048 31049 var len = queue.length; 31050 while(len) { 31051 currentQueue = queue; 31052 queue = []; 31053 while (++queueIndex < len) { 31054 if (currentQueue) { 31055 currentQueue[queueIndex].run(); 31056 } 31057 } 31058 queueIndex = -1; 31059 len = queue.length; 31060 } 31061 currentQueue = null; 31062 draining = false; 31063 runClearTimeout(timeout); 31064} 31065 31066process.nextTick = function (fun) { 31067 var args = new Array(arguments.length - 1); 31068 if (arguments.length > 1) { 31069 for (var i = 1; i < arguments.length; i++) { 31070 args[i - 1] = arguments[i]; 31071 } 31072 } 31073 queue.push(new Item(fun, args)); 31074 if (queue.length === 1 && !draining) { 31075 runTimeout(drainQueue); 31076 } 31077}; 31078 31079// v8 likes predictible objects 31080function Item(fun, array) { 31081 this.fun = fun; 31082 this.array = array; 31083} 31084Item.prototype.run = function () { 31085 this.fun.apply(null, this.array); 31086}; 31087process.title = 'browser'; 31088process.browser = true; 31089process.env = {}; 31090process.argv = []; 31091process.version = ''; // empty string to avoid regexp issues 31092process.versions = {}; 31093 31094function noop() {} 31095 31096process.on = noop; 31097process.addListener = noop; 31098process.once = noop; 31099process.off = noop; 31100process.removeListener = noop; 31101process.removeAllListeners = noop; 31102process.emit = noop; 31103process.prependListener = noop; 31104process.prependOnceListener = noop; 31105 31106process.listeners = function (name) { return [] } 31107 31108process.binding = function (name) { 31109 throw new Error('process.binding is not supported'); 31110}; 31111 31112process.cwd = function () { return '/' }; 31113process.chdir = function (dir) { 31114 throw new Error('process.chdir is not supported'); 31115}; 31116process.umask = function() { return 0; }; 31117 31118 31119/***/ }), 31120
vendor: 2,220 bytes, lines 31121-31130
31121/***/ "./node_modules/axios/package.json": 31122/*!*****************************************!*\ 31123 !*** ./node_modules/axios/package.json ***! 31124 \*****************************************/ 31125/***/ ((module) => { 31126 31127"use strict"; 31128module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}'); 31129 31130/***/ })
vendor: 6,674 bytes, lines 31130-31298
31130 31131 31132/******/ }); 31133/************************************************************************/ 31134/******/ // The module cache 31135/******/ var __webpack_module_cache__ = {}; 31136/******/ 31137/******/ // The require function 31138/******/ function __webpack_require__(moduleId) { 31139/******/ // Check if module is in cache 31140/******/ var cachedModule = __webpack_module_cache__[moduleId]; 31141/******/ if (cachedModule !== undefined) { 31142/******/ return cachedModule.exports; 31143/******/ } 31144/******/ // Create a new module (and put it into the cache) 31145/******/ var module = __webpack_module_cache__[moduleId] = { 31146/******/ id: moduleId, 31147/******/ loaded: false, 31148/******/ exports: {} 31149/******/ }; 31150/******/ 31151/******/ // Execute the module function 31152/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 31153/******/ 31154/******/ // Flag the module as loaded 31155/******/ module.loaded = true; 31156/******/ 31157/******/ // Return the exports of the module 31158/******/ return module.exports; 31159/******/ } 31160/******/ 31161/******/ // expose the modules object (__webpack_modules__) 31162/******/ __webpack_require__.m = __webpack_modules__; 31163/******/ 31164/************************************************************************/ 31165/******/ /* webpack/runtime/chunk loaded */ 31166/******/ (() => { 31167/******/ var deferred = []; 31168/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { 31169/******/ if(chunkIds) { 31170/******/ priority = priority || 0; 31171/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; 31172/******/ deferred[i] = [chunkIds, fn, priority]; 31173/******/ return; 31174/******/ } 31175/******/ var notFulfilled = Infinity; 31176/******/ for (var i = 0; i < deferred.length; i++) { 31177/******/ var [chunkIds, fn, priority] = deferred[i]; 31178/******/ var fulfilled = true; 31179/******/ for (var j = 0; j < chunkIds.length; j++) { 31180/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { 31181/******/ chunkIds.splice(j--, 1); 31182/******/ } else { 31183/******/ fulfilled = false; 31184/******/ if(priority < notFulfilled) notFulfilled = priority; 31185/******/ } 31186/******/ } 31187/******/ if(fulfilled) { 31188/******/ deferred.splice(i--, 1) 31189/******/ var r = fn(); 31190/******/ if (r !== undefined) result = r; 31191/******/ } 31192/******/ } 31193/******/ return result; 31194/******/ }; 31195/******/ })(); 31196/******/ 31197/******/ /* webpack/runtime/global */ 31198/******/ (() => { 31199/******/ __webpack_require__.g = (function() { 31200/******/ if (typeof globalThis === 'object') return globalThis; 31201/******/ try { 31202/******/ return this || new Function('return this')(); 31203/******/ } catch (e) { 31204/******/ if (typeof window === 'object') return window; 31205/******/ } 31206/******/ })(); 31207/******/ })(); 31208/******/ 31209/******/ /* webpack/runtime/hasOwnProperty shorthand */ 31210/******/ (() => { 31211/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 31212/******/ })(); 31213/******/ 31214/******/ /* webpack/runtime/make namespace object */ 31215/******/ (() => { 31216/******/ // define __esModule on exports 31217/******/ __webpack_require__.r = (exports) => { 31218/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 31219/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 31220/******/ } 31221/******/ Object.defineProperty(exports, '__esModule', { value: true }); 31222/******/ }; 31223/******/ })(); 31224/******/ 31225/******/ /* webpack/runtime/node module decorator */ 31226/******/ (() => { 31227/******/ __webpack_require__.nmd = (module) => { 31228/******/ module.paths = []; 31229/******/ if (!module.children) module.children = []; 31230/******/ return module; 31231/******/ }; 31232/******/ })(); 31233/******/ 31234/******/ /* webpack/runtime/jsonp chunk loading */ 31235/******/ (() => { 31236/******/ // no baseURI 31237/******/ 31238/******/ // object to store loaded and loading chunks 31239/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched 31240/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded 31241/******/ var installedChunks = { 31242/******/ "/js/app": 0, 31243/******/ "css/app": 0 31244/******/ }; 31245/******/ 31246/******/ // no chunk on demand loading 31247/******/ 31248/******/ // no prefetching 31249/******/ 31250/******/ // no preloaded 31251/******/ 31252/******/ // no HMR 31253/******/ 31254/******/ // no HMR manifest 31255/******/ 31256/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); 31257/******/ 31258/******/ // install a JSONP callback for chunk loading 31259/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { 31260/******/ var [chunkIds, moreModules, runtime] = data; 31261/******/ // add "moreModules" to the modules object, 31262/******/ // then flag all "chunkIds" as loaded and fire callback 31263/******/ var moduleId, chunkId, i = 0; 31264/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { 31265/******/ for(moduleId in moreModules) { 31266/******/ if(__webpack_require__.o(moreModules, moduleId)) { 31267/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; 31268/******/ } 31269/******/ } 31270/******/ if(runtime) var result = runtime(__webpack_require__); 31271/******/ } 31272/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); 31273/******/ for(;i < chunkIds.length; i++) { 31274/******/ chunkId = chunkIds[i]; 31275/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { 31276/******/ installedChunks[chunkId][0](); 31277/******/ } 31278/******/ installedChunks[chunkId] = 0; 31279/******/ } 31280/******/ return __webpack_require__.O(result); 31281/******/ } 31282/******/ 31283/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; 31284/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); 31285/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); 31286/******/ })(); 31287/******/ 31288/************************************************************************/ 31289/******/ 31290/******/ // startup 31291/******/ // Load entry module and return exports 31292/******/ // This entry module depends on other loaded chunks and execution need to be delayed 31293/******/ __webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./resources/js/app.js"))) 31294/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./resources/sass/app.scss"))) 31295/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); 31296/******/ 31297/******/ })() 31298;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.