rx-compo 1.0.52 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/entry/types/index.d.ts +0 -1
- package/es/components/RxButton/index.js +16 -25
- package/es/components/RxCheckbox/index.js +3712 -0
- package/es/components/RxCheckboxGroup/index.js +6430 -0
- package/es/components/RxDatePicker/index.js +13042 -0
- package/es/components/RxInput/index.js +1560 -0
- package/es/components/RxOption/index.js +8859 -0
- package/es/components/RxRadio/index.js +646 -0
- package/es/components/RxRadioButton/index.js +646 -0
- package/es/components/RxRadioGroup/index.js +1117 -0
- package/es/components/RxScrollbar/index.js +867 -0
- package/es/components/RxSelect/index.js +9022 -0
- package/es/components/RxSelectPlus/index.js +17471 -0
- package/es/components/RxSuperCondition/index.js +8690 -0
- package/es/components/RxTooltip/index.js +2470 -0
- package/es/components/index.js +13 -0
- package/es/index.d.ts +0 -1
- package/es/index.js +0 -1
- package/es/utils/useContext.d.ts +10 -0
- package/es/utils/useContext.js +13 -0
- package/es/utils/useTextOverflow.d.ts +4 -0
- package/es/utils/useTextOverflow.js +13 -0
- package/es/utils/with-install.d.ts +3 -0
- package/es/utils/with-install.js +7 -0
- package/index.esm.js +43171 -1577
- package/index.js +43192 -1585
- package/lib/components/RxButton/index.js +15 -24
- package/lib/components/RxCheckbox/index.js +3717 -0
- package/lib/components/RxCheckboxGroup/index.js +6435 -0
- package/lib/components/RxDatePicker/index.js +13047 -0
- package/lib/components/RxInput/index.js +1565 -0
- package/lib/components/RxOption/index.js +8864 -0
- package/lib/components/RxRadio/index.js +651 -0
- package/lib/components/RxRadioButton/index.js +651 -0
- package/lib/components/RxRadioGroup/index.js +1122 -0
- package/lib/components/RxScrollbar/index.js +872 -0
- package/lib/components/RxSelect/index.js +9027 -0
- package/lib/components/RxSelectPlus/index.js +17476 -0
- package/lib/components/RxSuperCondition/index.js +8695 -0
- package/lib/components/RxTooltip/index.js +2475 -0
- package/lib/components/index.js +91 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/utils/useContext.d.ts +10 -0
- package/lib/utils/useContext.js +18 -0
- package/lib/utils/useTextOverflow.d.ts +4 -0
- package/lib/utils/useTextOverflow.js +17 -0
- package/lib/utils/with-install.d.ts +3 -0
- package/lib/utils/with-install.js +11 -0
- package/package.json +4 -2
- package/theme-chalk/css/index.css +1 -1
- package/theme-chalk/css/rx-button.css +1 -0
- package/theme-chalk/css/rx-checkbox-group.css +1 -0
- package/theme-chalk/css/rx-checkbox.css +1 -0
- package/theme-chalk/css/rx-date-picker.css +0 -0
- package/theme-chalk/css/rx-input.css +1 -0
- package/theme-chalk/css/rx-option.css +1 -0
- package/theme-chalk/css/rx-radio-button.css +0 -0
- package/theme-chalk/css/rx-radio-group.css +1 -0
- package/theme-chalk/css/rx-radio.css +1 -0
- package/theme-chalk/css/rx-scrollbar.css +0 -0
- package/theme-chalk/css/rx-select.css +1 -0
- package/theme-chalk/css/rx-super-condition.css +0 -0
- package/theme-chalk/css/rx-tooltip.css +0 -0
- package/es/components/RxButton/index.d.ts +0 -3
- package/es/components/RxButton/src/index.d.ts +0 -3
- package/es/components/RxButton/src/index.vue.d.ts +0 -10
- package/es/components/index.d.ts +0 -2
- package/lib/components/RxButton/index.d.ts +0 -3
- package/lib/components/RxButton/src/index.d.ts +0 -3
- package/lib/components/RxButton/src/index.vue.d.ts +0 -10
- package/lib/components/index.d.ts +0 -2
- package/types/components/RxButton/index.d.ts +0 -3
- package/types/components/RxButton/src/index.d.ts +0 -3
- package/types/components/RxButton/src/index.vue.d.ts +0 -10
- package/types/components/index.d.ts +0 -2
- package/types/utils/with-install.d.ts +0 -3
|
@@ -0,0 +1,3712 @@
|
|
|
1
|
+
import { withInstall as withInstall$1 } from 'rx-compo/es/utils/with-install';
|
|
2
|
+
import { warn, inject, ref, computed, unref, getCurrentInstance, onMounted, watch, toRef, onUnmounted, nextTick, toRaw, defineComponent, useSlots, openBlock, createBlock, resolveDynamicComponent, normalizeClass, withCtx, createElementVNode, withDirectives, createElementBlock, isRef, vModelCheckbox, renderSlot, Fragment, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle, provide, toRefs, resolveComponent, mergeProps, createSlots } from 'vue';
|
|
3
|
+
import 'vue-demi';
|
|
4
|
+
|
|
5
|
+
const RxCheckboxProps = {};
|
|
6
|
+
|
|
7
|
+
var _a;
|
|
8
|
+
const isClient = typeof window !== "undefined";
|
|
9
|
+
isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
10
|
+
|
|
11
|
+
!!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
12
|
+
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
13
|
+
const NOOP = () => {
|
|
14
|
+
};
|
|
15
|
+
const hasOwnProperty$a = Object.prototype.hasOwnProperty;
|
|
16
|
+
const hasOwn = (val, key) => hasOwnProperty$a.call(val, key);
|
|
17
|
+
const isArray$2 = Array.isArray;
|
|
18
|
+
const isString = (val) => typeof val === "string";
|
|
19
|
+
const isObject$1 = (val) => val !== null && typeof val === "object";
|
|
20
|
+
|
|
21
|
+
/** Detect free variable `global` from Node.js. */
|
|
22
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
23
|
+
|
|
24
|
+
var freeGlobal$1 = freeGlobal;
|
|
25
|
+
|
|
26
|
+
/** Detect free variable `self`. */
|
|
27
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
28
|
+
|
|
29
|
+
/** Used as a reference to the global object. */
|
|
30
|
+
var root = freeGlobal$1 || freeSelf || Function('return this')();
|
|
31
|
+
|
|
32
|
+
var root$1 = root;
|
|
33
|
+
|
|
34
|
+
/** Built-in value references. */
|
|
35
|
+
var Symbol$1 = root$1.Symbol;
|
|
36
|
+
|
|
37
|
+
var Symbol$2 = Symbol$1;
|
|
38
|
+
|
|
39
|
+
/** Used for built-in method references. */
|
|
40
|
+
var objectProto$c = Object.prototype;
|
|
41
|
+
|
|
42
|
+
/** Used to check objects for own properties. */
|
|
43
|
+
var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Used to resolve the
|
|
47
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
48
|
+
* of values.
|
|
49
|
+
*/
|
|
50
|
+
var nativeObjectToString$1 = objectProto$c.toString;
|
|
51
|
+
|
|
52
|
+
/** Built-in value references. */
|
|
53
|
+
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
* @param {*} value The value to query.
|
|
60
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
61
|
+
*/
|
|
62
|
+
function getRawTag(value) {
|
|
63
|
+
var isOwn = hasOwnProperty$9.call(value, symToStringTag$1),
|
|
64
|
+
tag = value[symToStringTag$1];
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
value[symToStringTag$1] = undefined;
|
|
68
|
+
var unmasked = true;
|
|
69
|
+
} catch (e) {}
|
|
70
|
+
|
|
71
|
+
var result = nativeObjectToString$1.call(value);
|
|
72
|
+
if (unmasked) {
|
|
73
|
+
if (isOwn) {
|
|
74
|
+
value[symToStringTag$1] = tag;
|
|
75
|
+
} else {
|
|
76
|
+
delete value[symToStringTag$1];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Used for built-in method references. */
|
|
83
|
+
var objectProto$b = Object.prototype;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Used to resolve the
|
|
87
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
88
|
+
* of values.
|
|
89
|
+
*/
|
|
90
|
+
var nativeObjectToString = objectProto$b.toString;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
94
|
+
*
|
|
95
|
+
* @private
|
|
96
|
+
* @param {*} value The value to convert.
|
|
97
|
+
* @returns {string} Returns the converted string.
|
|
98
|
+
*/
|
|
99
|
+
function objectToString(value) {
|
|
100
|
+
return nativeObjectToString.call(value);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** `Object#toString` result references. */
|
|
104
|
+
var nullTag = '[object Null]',
|
|
105
|
+
undefinedTag = '[object Undefined]';
|
|
106
|
+
|
|
107
|
+
/** Built-in value references. */
|
|
108
|
+
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
112
|
+
*
|
|
113
|
+
* @private
|
|
114
|
+
* @param {*} value The value to query.
|
|
115
|
+
* @returns {string} Returns the `toStringTag`.
|
|
116
|
+
*/
|
|
117
|
+
function baseGetTag(value) {
|
|
118
|
+
if (value == null) {
|
|
119
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
120
|
+
}
|
|
121
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
122
|
+
? getRawTag(value)
|
|
123
|
+
: objectToString(value);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
128
|
+
* and has a `typeof` result of "object".
|
|
129
|
+
*
|
|
130
|
+
* @static
|
|
131
|
+
* @memberOf _
|
|
132
|
+
* @since 4.0.0
|
|
133
|
+
* @category Lang
|
|
134
|
+
* @param {*} value The value to check.
|
|
135
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
136
|
+
* @example
|
|
137
|
+
*
|
|
138
|
+
* _.isObjectLike({});
|
|
139
|
+
* // => true
|
|
140
|
+
*
|
|
141
|
+
* _.isObjectLike([1, 2, 3]);
|
|
142
|
+
* // => true
|
|
143
|
+
*
|
|
144
|
+
* _.isObjectLike(_.noop);
|
|
145
|
+
* // => false
|
|
146
|
+
*
|
|
147
|
+
* _.isObjectLike(null);
|
|
148
|
+
* // => false
|
|
149
|
+
*/
|
|
150
|
+
function isObjectLike(value) {
|
|
151
|
+
return value != null && typeof value == 'object';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** `Object#toString` result references. */
|
|
155
|
+
var symbolTag$1 = '[object Symbol]';
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
159
|
+
*
|
|
160
|
+
* @static
|
|
161
|
+
* @memberOf _
|
|
162
|
+
* @since 4.0.0
|
|
163
|
+
* @category Lang
|
|
164
|
+
* @param {*} value The value to check.
|
|
165
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
166
|
+
* @example
|
|
167
|
+
*
|
|
168
|
+
* _.isSymbol(Symbol.iterator);
|
|
169
|
+
* // => true
|
|
170
|
+
*
|
|
171
|
+
* _.isSymbol('abc');
|
|
172
|
+
* // => false
|
|
173
|
+
*/
|
|
174
|
+
function isSymbol(value) {
|
|
175
|
+
return typeof value == 'symbol' ||
|
|
176
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag$1);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
181
|
+
* shorthands.
|
|
182
|
+
*
|
|
183
|
+
* @private
|
|
184
|
+
* @param {Array} [array] The array to iterate over.
|
|
185
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
186
|
+
* @returns {Array} Returns the new mapped array.
|
|
187
|
+
*/
|
|
188
|
+
function arrayMap(array, iteratee) {
|
|
189
|
+
var index = -1,
|
|
190
|
+
length = array == null ? 0 : array.length,
|
|
191
|
+
result = Array(length);
|
|
192
|
+
|
|
193
|
+
while (++index < length) {
|
|
194
|
+
result[index] = iteratee(array[index], index, array);
|
|
195
|
+
}
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Checks if `value` is classified as an `Array` object.
|
|
201
|
+
*
|
|
202
|
+
* @static
|
|
203
|
+
* @memberOf _
|
|
204
|
+
* @since 0.1.0
|
|
205
|
+
* @category Lang
|
|
206
|
+
* @param {*} value The value to check.
|
|
207
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
208
|
+
* @example
|
|
209
|
+
*
|
|
210
|
+
* _.isArray([1, 2, 3]);
|
|
211
|
+
* // => true
|
|
212
|
+
*
|
|
213
|
+
* _.isArray(document.body.children);
|
|
214
|
+
* // => false
|
|
215
|
+
*
|
|
216
|
+
* _.isArray('abc');
|
|
217
|
+
* // => false
|
|
218
|
+
*
|
|
219
|
+
* _.isArray(_.noop);
|
|
220
|
+
* // => false
|
|
221
|
+
*/
|
|
222
|
+
var isArray = Array.isArray;
|
|
223
|
+
|
|
224
|
+
var isArray$1 = isArray;
|
|
225
|
+
|
|
226
|
+
/** Used as references for various `Number` constants. */
|
|
227
|
+
var INFINITY$1 = 1 / 0;
|
|
228
|
+
|
|
229
|
+
/** Used to convert symbols to primitives and strings. */
|
|
230
|
+
var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : undefined,
|
|
231
|
+
symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
235
|
+
* values to empty strings.
|
|
236
|
+
*
|
|
237
|
+
* @private
|
|
238
|
+
* @param {*} value The value to process.
|
|
239
|
+
* @returns {string} Returns the string.
|
|
240
|
+
*/
|
|
241
|
+
function baseToString(value) {
|
|
242
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
243
|
+
if (typeof value == 'string') {
|
|
244
|
+
return value;
|
|
245
|
+
}
|
|
246
|
+
if (isArray$1(value)) {
|
|
247
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
248
|
+
return arrayMap(value, baseToString) + '';
|
|
249
|
+
}
|
|
250
|
+
if (isSymbol(value)) {
|
|
251
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
252
|
+
}
|
|
253
|
+
var result = (value + '');
|
|
254
|
+
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Checks if `value` is the
|
|
259
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
260
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
261
|
+
*
|
|
262
|
+
* @static
|
|
263
|
+
* @memberOf _
|
|
264
|
+
* @since 0.1.0
|
|
265
|
+
* @category Lang
|
|
266
|
+
* @param {*} value The value to check.
|
|
267
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
268
|
+
* @example
|
|
269
|
+
*
|
|
270
|
+
* _.isObject({});
|
|
271
|
+
* // => true
|
|
272
|
+
*
|
|
273
|
+
* _.isObject([1, 2, 3]);
|
|
274
|
+
* // => true
|
|
275
|
+
*
|
|
276
|
+
* _.isObject(_.noop);
|
|
277
|
+
* // => true
|
|
278
|
+
*
|
|
279
|
+
* _.isObject(null);
|
|
280
|
+
* // => false
|
|
281
|
+
*/
|
|
282
|
+
function isObject(value) {
|
|
283
|
+
var type = typeof value;
|
|
284
|
+
return value != null && (type == 'object' || type == 'function');
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* This method returns the first argument it receives.
|
|
289
|
+
*
|
|
290
|
+
* @static
|
|
291
|
+
* @since 0.1.0
|
|
292
|
+
* @memberOf _
|
|
293
|
+
* @category Util
|
|
294
|
+
* @param {*} value Any value.
|
|
295
|
+
* @returns {*} Returns `value`.
|
|
296
|
+
* @example
|
|
297
|
+
*
|
|
298
|
+
* var object = { 'a': 1 };
|
|
299
|
+
*
|
|
300
|
+
* console.log(_.identity(object) === object);
|
|
301
|
+
* // => true
|
|
302
|
+
*/
|
|
303
|
+
function identity(value) {
|
|
304
|
+
return value;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** `Object#toString` result references. */
|
|
308
|
+
var asyncTag = '[object AsyncFunction]',
|
|
309
|
+
funcTag$1 = '[object Function]',
|
|
310
|
+
genTag = '[object GeneratorFunction]',
|
|
311
|
+
proxyTag = '[object Proxy]';
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Checks if `value` is classified as a `Function` object.
|
|
315
|
+
*
|
|
316
|
+
* @static
|
|
317
|
+
* @memberOf _
|
|
318
|
+
* @since 0.1.0
|
|
319
|
+
* @category Lang
|
|
320
|
+
* @param {*} value The value to check.
|
|
321
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
322
|
+
* @example
|
|
323
|
+
*
|
|
324
|
+
* _.isFunction(_);
|
|
325
|
+
* // => true
|
|
326
|
+
*
|
|
327
|
+
* _.isFunction(/abc/);
|
|
328
|
+
* // => false
|
|
329
|
+
*/
|
|
330
|
+
function isFunction(value) {
|
|
331
|
+
if (!isObject(value)) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
335
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
336
|
+
var tag = baseGetTag(value);
|
|
337
|
+
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Used to detect overreaching core-js shims. */
|
|
341
|
+
var coreJsData = root$1['__core-js_shared__'];
|
|
342
|
+
|
|
343
|
+
var coreJsData$1 = coreJsData;
|
|
344
|
+
|
|
345
|
+
/** Used to detect methods masquerading as native. */
|
|
346
|
+
var maskSrcKey = (function() {
|
|
347
|
+
var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || '');
|
|
348
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
349
|
+
}());
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Checks if `func` has its source masked.
|
|
353
|
+
*
|
|
354
|
+
* @private
|
|
355
|
+
* @param {Function} func The function to check.
|
|
356
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
357
|
+
*/
|
|
358
|
+
function isMasked(func) {
|
|
359
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/** Used for built-in method references. */
|
|
363
|
+
var funcProto$1 = Function.prototype;
|
|
364
|
+
|
|
365
|
+
/** Used to resolve the decompiled source of functions. */
|
|
366
|
+
var funcToString$1 = funcProto$1.toString;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Converts `func` to its source code.
|
|
370
|
+
*
|
|
371
|
+
* @private
|
|
372
|
+
* @param {Function} func The function to convert.
|
|
373
|
+
* @returns {string} Returns the source code.
|
|
374
|
+
*/
|
|
375
|
+
function toSource(func) {
|
|
376
|
+
if (func != null) {
|
|
377
|
+
try {
|
|
378
|
+
return funcToString$1.call(func);
|
|
379
|
+
} catch (e) {}
|
|
380
|
+
try {
|
|
381
|
+
return (func + '');
|
|
382
|
+
} catch (e) {}
|
|
383
|
+
}
|
|
384
|
+
return '';
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Used to match `RegExp`
|
|
389
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
390
|
+
*/
|
|
391
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
392
|
+
|
|
393
|
+
/** Used to detect host constructors (Safari). */
|
|
394
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
395
|
+
|
|
396
|
+
/** Used for built-in method references. */
|
|
397
|
+
var funcProto = Function.prototype,
|
|
398
|
+
objectProto$a = Object.prototype;
|
|
399
|
+
|
|
400
|
+
/** Used to resolve the decompiled source of functions. */
|
|
401
|
+
var funcToString = funcProto.toString;
|
|
402
|
+
|
|
403
|
+
/** Used to check objects for own properties. */
|
|
404
|
+
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
405
|
+
|
|
406
|
+
/** Used to detect if a method is native. */
|
|
407
|
+
var reIsNative = RegExp('^' +
|
|
408
|
+
funcToString.call(hasOwnProperty$8).replace(reRegExpChar, '\\$&')
|
|
409
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
414
|
+
*
|
|
415
|
+
* @private
|
|
416
|
+
* @param {*} value The value to check.
|
|
417
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
418
|
+
* else `false`.
|
|
419
|
+
*/
|
|
420
|
+
function baseIsNative(value) {
|
|
421
|
+
if (!isObject(value) || isMasked(value)) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
425
|
+
return pattern.test(toSource(value));
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Gets the value at `key` of `object`.
|
|
430
|
+
*
|
|
431
|
+
* @private
|
|
432
|
+
* @param {Object} [object] The object to query.
|
|
433
|
+
* @param {string} key The key of the property to get.
|
|
434
|
+
* @returns {*} Returns the property value.
|
|
435
|
+
*/
|
|
436
|
+
function getValue(object, key) {
|
|
437
|
+
return object == null ? undefined : object[key];
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Gets the native function at `key` of `object`.
|
|
442
|
+
*
|
|
443
|
+
* @private
|
|
444
|
+
* @param {Object} object The object to query.
|
|
445
|
+
* @param {string} key The key of the method to get.
|
|
446
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
447
|
+
*/
|
|
448
|
+
function getNative(object, key) {
|
|
449
|
+
var value = getValue(object, key);
|
|
450
|
+
return baseIsNative(value) ? value : undefined;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/* Built-in method references that are verified to be native. */
|
|
454
|
+
var WeakMap = getNative(root$1, 'WeakMap');
|
|
455
|
+
|
|
456
|
+
var WeakMap$1 = WeakMap;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
460
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
461
|
+
*
|
|
462
|
+
* @private
|
|
463
|
+
* @param {Function} func The function to invoke.
|
|
464
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
465
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
466
|
+
* @returns {*} Returns the result of `func`.
|
|
467
|
+
*/
|
|
468
|
+
function apply(func, thisArg, args) {
|
|
469
|
+
switch (args.length) {
|
|
470
|
+
case 0: return func.call(thisArg);
|
|
471
|
+
case 1: return func.call(thisArg, args[0]);
|
|
472
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
473
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
474
|
+
}
|
|
475
|
+
return func.apply(thisArg, args);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
479
|
+
var HOT_COUNT = 800,
|
|
480
|
+
HOT_SPAN = 16;
|
|
481
|
+
|
|
482
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
483
|
+
var nativeNow = Date.now;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
487
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
488
|
+
* milliseconds.
|
|
489
|
+
*
|
|
490
|
+
* @private
|
|
491
|
+
* @param {Function} func The function to restrict.
|
|
492
|
+
* @returns {Function} Returns the new shortable function.
|
|
493
|
+
*/
|
|
494
|
+
function shortOut(func) {
|
|
495
|
+
var count = 0,
|
|
496
|
+
lastCalled = 0;
|
|
497
|
+
|
|
498
|
+
return function() {
|
|
499
|
+
var stamp = nativeNow(),
|
|
500
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
501
|
+
|
|
502
|
+
lastCalled = stamp;
|
|
503
|
+
if (remaining > 0) {
|
|
504
|
+
if (++count >= HOT_COUNT) {
|
|
505
|
+
return arguments[0];
|
|
506
|
+
}
|
|
507
|
+
} else {
|
|
508
|
+
count = 0;
|
|
509
|
+
}
|
|
510
|
+
return func.apply(undefined, arguments);
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Creates a function that returns `value`.
|
|
516
|
+
*
|
|
517
|
+
* @static
|
|
518
|
+
* @memberOf _
|
|
519
|
+
* @since 2.4.0
|
|
520
|
+
* @category Util
|
|
521
|
+
* @param {*} value The value to return from the new function.
|
|
522
|
+
* @returns {Function} Returns the new constant function.
|
|
523
|
+
* @example
|
|
524
|
+
*
|
|
525
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
526
|
+
*
|
|
527
|
+
* console.log(objects);
|
|
528
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
529
|
+
*
|
|
530
|
+
* console.log(objects[0] === objects[1]);
|
|
531
|
+
* // => true
|
|
532
|
+
*/
|
|
533
|
+
function constant(value) {
|
|
534
|
+
return function() {
|
|
535
|
+
return value;
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
var defineProperty = (function() {
|
|
540
|
+
try {
|
|
541
|
+
var func = getNative(Object, 'defineProperty');
|
|
542
|
+
func({}, '', {});
|
|
543
|
+
return func;
|
|
544
|
+
} catch (e) {}
|
|
545
|
+
}());
|
|
546
|
+
|
|
547
|
+
var defineProperty$1 = defineProperty;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
551
|
+
*
|
|
552
|
+
* @private
|
|
553
|
+
* @param {Function} func The function to modify.
|
|
554
|
+
* @param {Function} string The `toString` result.
|
|
555
|
+
* @returns {Function} Returns `func`.
|
|
556
|
+
*/
|
|
557
|
+
var baseSetToString = !defineProperty$1 ? identity : function(func, string) {
|
|
558
|
+
return defineProperty$1(func, 'toString', {
|
|
559
|
+
'configurable': true,
|
|
560
|
+
'enumerable': false,
|
|
561
|
+
'value': constant(string),
|
|
562
|
+
'writable': true
|
|
563
|
+
});
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
var baseSetToString$1 = baseSetToString;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
570
|
+
*
|
|
571
|
+
* @private
|
|
572
|
+
* @param {Function} func The function to modify.
|
|
573
|
+
* @param {Function} string The `toString` result.
|
|
574
|
+
* @returns {Function} Returns `func`.
|
|
575
|
+
*/
|
|
576
|
+
var setToString = shortOut(baseSetToString$1);
|
|
577
|
+
|
|
578
|
+
var setToString$1 = setToString;
|
|
579
|
+
|
|
580
|
+
/** Used as references for various `Number` constants. */
|
|
581
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
582
|
+
|
|
583
|
+
/** Used to detect unsigned integer values. */
|
|
584
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Checks if `value` is a valid array-like index.
|
|
588
|
+
*
|
|
589
|
+
* @private
|
|
590
|
+
* @param {*} value The value to check.
|
|
591
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
592
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
593
|
+
*/
|
|
594
|
+
function isIndex(value, length) {
|
|
595
|
+
var type = typeof value;
|
|
596
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
597
|
+
|
|
598
|
+
return !!length &&
|
|
599
|
+
(type == 'number' ||
|
|
600
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
|
601
|
+
(value > -1 && value % 1 == 0 && value < length);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
606
|
+
* value checks.
|
|
607
|
+
*
|
|
608
|
+
* @private
|
|
609
|
+
* @param {Object} object The object to modify.
|
|
610
|
+
* @param {string} key The key of the property to assign.
|
|
611
|
+
* @param {*} value The value to assign.
|
|
612
|
+
*/
|
|
613
|
+
function baseAssignValue(object, key, value) {
|
|
614
|
+
if (key == '__proto__' && defineProperty$1) {
|
|
615
|
+
defineProperty$1(object, key, {
|
|
616
|
+
'configurable': true,
|
|
617
|
+
'enumerable': true,
|
|
618
|
+
'value': value,
|
|
619
|
+
'writable': true
|
|
620
|
+
});
|
|
621
|
+
} else {
|
|
622
|
+
object[key] = value;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Performs a
|
|
628
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
629
|
+
* comparison between two values to determine if they are equivalent.
|
|
630
|
+
*
|
|
631
|
+
* @static
|
|
632
|
+
* @memberOf _
|
|
633
|
+
* @since 4.0.0
|
|
634
|
+
* @category Lang
|
|
635
|
+
* @param {*} value The value to compare.
|
|
636
|
+
* @param {*} other The other value to compare.
|
|
637
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
638
|
+
* @example
|
|
639
|
+
*
|
|
640
|
+
* var object = { 'a': 1 };
|
|
641
|
+
* var other = { 'a': 1 };
|
|
642
|
+
*
|
|
643
|
+
* _.eq(object, object);
|
|
644
|
+
* // => true
|
|
645
|
+
*
|
|
646
|
+
* _.eq(object, other);
|
|
647
|
+
* // => false
|
|
648
|
+
*
|
|
649
|
+
* _.eq('a', 'a');
|
|
650
|
+
* // => true
|
|
651
|
+
*
|
|
652
|
+
* _.eq('a', Object('a'));
|
|
653
|
+
* // => false
|
|
654
|
+
*
|
|
655
|
+
* _.eq(NaN, NaN);
|
|
656
|
+
* // => true
|
|
657
|
+
*/
|
|
658
|
+
function eq(value, other) {
|
|
659
|
+
return value === other || (value !== value && other !== other);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/** Used for built-in method references. */
|
|
663
|
+
var objectProto$9 = Object.prototype;
|
|
664
|
+
|
|
665
|
+
/** Used to check objects for own properties. */
|
|
666
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
670
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
671
|
+
* for equality comparisons.
|
|
672
|
+
*
|
|
673
|
+
* @private
|
|
674
|
+
* @param {Object} object The object to modify.
|
|
675
|
+
* @param {string} key The key of the property to assign.
|
|
676
|
+
* @param {*} value The value to assign.
|
|
677
|
+
*/
|
|
678
|
+
function assignValue(object, key, value) {
|
|
679
|
+
var objValue = object[key];
|
|
680
|
+
if (!(hasOwnProperty$7.call(object, key) && eq(objValue, value)) ||
|
|
681
|
+
(value === undefined && !(key in object))) {
|
|
682
|
+
baseAssignValue(object, key, value);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
687
|
+
var nativeMax = Math.max;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
691
|
+
*
|
|
692
|
+
* @private
|
|
693
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
694
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
695
|
+
* @param {Function} transform The rest array transform.
|
|
696
|
+
* @returns {Function} Returns the new function.
|
|
697
|
+
*/
|
|
698
|
+
function overRest(func, start, transform) {
|
|
699
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
700
|
+
return function() {
|
|
701
|
+
var args = arguments,
|
|
702
|
+
index = -1,
|
|
703
|
+
length = nativeMax(args.length - start, 0),
|
|
704
|
+
array = Array(length);
|
|
705
|
+
|
|
706
|
+
while (++index < length) {
|
|
707
|
+
array[index] = args[start + index];
|
|
708
|
+
}
|
|
709
|
+
index = -1;
|
|
710
|
+
var otherArgs = Array(start + 1);
|
|
711
|
+
while (++index < start) {
|
|
712
|
+
otherArgs[index] = args[index];
|
|
713
|
+
}
|
|
714
|
+
otherArgs[start] = transform(array);
|
|
715
|
+
return apply(func, this, otherArgs);
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/** Used as references for various `Number` constants. */
|
|
720
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Checks if `value` is a valid array-like length.
|
|
724
|
+
*
|
|
725
|
+
* **Note:** This method is loosely based on
|
|
726
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
727
|
+
*
|
|
728
|
+
* @static
|
|
729
|
+
* @memberOf _
|
|
730
|
+
* @since 4.0.0
|
|
731
|
+
* @category Lang
|
|
732
|
+
* @param {*} value The value to check.
|
|
733
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
734
|
+
* @example
|
|
735
|
+
*
|
|
736
|
+
* _.isLength(3);
|
|
737
|
+
* // => true
|
|
738
|
+
*
|
|
739
|
+
* _.isLength(Number.MIN_VALUE);
|
|
740
|
+
* // => false
|
|
741
|
+
*
|
|
742
|
+
* _.isLength(Infinity);
|
|
743
|
+
* // => false
|
|
744
|
+
*
|
|
745
|
+
* _.isLength('3');
|
|
746
|
+
* // => false
|
|
747
|
+
*/
|
|
748
|
+
function isLength(value) {
|
|
749
|
+
return typeof value == 'number' &&
|
|
750
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
755
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
756
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
757
|
+
*
|
|
758
|
+
* @static
|
|
759
|
+
* @memberOf _
|
|
760
|
+
* @since 4.0.0
|
|
761
|
+
* @category Lang
|
|
762
|
+
* @param {*} value The value to check.
|
|
763
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
764
|
+
* @example
|
|
765
|
+
*
|
|
766
|
+
* _.isArrayLike([1, 2, 3]);
|
|
767
|
+
* // => true
|
|
768
|
+
*
|
|
769
|
+
* _.isArrayLike(document.body.children);
|
|
770
|
+
* // => true
|
|
771
|
+
*
|
|
772
|
+
* _.isArrayLike('abc');
|
|
773
|
+
* // => true
|
|
774
|
+
*
|
|
775
|
+
* _.isArrayLike(_.noop);
|
|
776
|
+
* // => false
|
|
777
|
+
*/
|
|
778
|
+
function isArrayLike(value) {
|
|
779
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/** Used for built-in method references. */
|
|
783
|
+
var objectProto$8 = Object.prototype;
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Checks if `value` is likely a prototype object.
|
|
787
|
+
*
|
|
788
|
+
* @private
|
|
789
|
+
* @param {*} value The value to check.
|
|
790
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
791
|
+
*/
|
|
792
|
+
function isPrototype(value) {
|
|
793
|
+
var Ctor = value && value.constructor,
|
|
794
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
|
|
795
|
+
|
|
796
|
+
return value === proto;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
801
|
+
* or max array length checks.
|
|
802
|
+
*
|
|
803
|
+
* @private
|
|
804
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
805
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
806
|
+
* @returns {Array} Returns the array of results.
|
|
807
|
+
*/
|
|
808
|
+
function baseTimes(n, iteratee) {
|
|
809
|
+
var index = -1,
|
|
810
|
+
result = Array(n);
|
|
811
|
+
|
|
812
|
+
while (++index < n) {
|
|
813
|
+
result[index] = iteratee(index);
|
|
814
|
+
}
|
|
815
|
+
return result;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/** `Object#toString` result references. */
|
|
819
|
+
var argsTag$2 = '[object Arguments]';
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* The base implementation of `_.isArguments`.
|
|
823
|
+
*
|
|
824
|
+
* @private
|
|
825
|
+
* @param {*} value The value to check.
|
|
826
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
827
|
+
*/
|
|
828
|
+
function baseIsArguments(value) {
|
|
829
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
/** Used for built-in method references. */
|
|
833
|
+
var objectProto$7 = Object.prototype;
|
|
834
|
+
|
|
835
|
+
/** Used to check objects for own properties. */
|
|
836
|
+
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
837
|
+
|
|
838
|
+
/** Built-in value references. */
|
|
839
|
+
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Checks if `value` is likely an `arguments` object.
|
|
843
|
+
*
|
|
844
|
+
* @static
|
|
845
|
+
* @memberOf _
|
|
846
|
+
* @since 0.1.0
|
|
847
|
+
* @category Lang
|
|
848
|
+
* @param {*} value The value to check.
|
|
849
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
850
|
+
* else `false`.
|
|
851
|
+
* @example
|
|
852
|
+
*
|
|
853
|
+
* _.isArguments(function() { return arguments; }());
|
|
854
|
+
* // => true
|
|
855
|
+
*
|
|
856
|
+
* _.isArguments([1, 2, 3]);
|
|
857
|
+
* // => false
|
|
858
|
+
*/
|
|
859
|
+
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
860
|
+
return isObjectLike(value) && hasOwnProperty$6.call(value, 'callee') &&
|
|
861
|
+
!propertyIsEnumerable$1.call(value, 'callee');
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
var isArguments$1 = isArguments;
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* This method returns `false`.
|
|
868
|
+
*
|
|
869
|
+
* @static
|
|
870
|
+
* @memberOf _
|
|
871
|
+
* @since 4.13.0
|
|
872
|
+
* @category Util
|
|
873
|
+
* @returns {boolean} Returns `false`.
|
|
874
|
+
* @example
|
|
875
|
+
*
|
|
876
|
+
* _.times(2, _.stubFalse);
|
|
877
|
+
* // => [false, false]
|
|
878
|
+
*/
|
|
879
|
+
function stubFalse() {
|
|
880
|
+
return false;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/** Detect free variable `exports`. */
|
|
884
|
+
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
885
|
+
|
|
886
|
+
/** Detect free variable `module`. */
|
|
887
|
+
var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
|
|
888
|
+
|
|
889
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
890
|
+
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
891
|
+
|
|
892
|
+
/** Built-in value references. */
|
|
893
|
+
var Buffer = moduleExports$1 ? root$1.Buffer : undefined;
|
|
894
|
+
|
|
895
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
896
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Checks if `value` is a buffer.
|
|
900
|
+
*
|
|
901
|
+
* @static
|
|
902
|
+
* @memberOf _
|
|
903
|
+
* @since 4.3.0
|
|
904
|
+
* @category Lang
|
|
905
|
+
* @param {*} value The value to check.
|
|
906
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
907
|
+
* @example
|
|
908
|
+
*
|
|
909
|
+
* _.isBuffer(new Buffer(2));
|
|
910
|
+
* // => true
|
|
911
|
+
*
|
|
912
|
+
* _.isBuffer(new Uint8Array(2));
|
|
913
|
+
* // => false
|
|
914
|
+
*/
|
|
915
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
916
|
+
|
|
917
|
+
var isBuffer$1 = isBuffer;
|
|
918
|
+
|
|
919
|
+
/** `Object#toString` result references. */
|
|
920
|
+
var argsTag$1 = '[object Arguments]',
|
|
921
|
+
arrayTag$1 = '[object Array]',
|
|
922
|
+
boolTag$1 = '[object Boolean]',
|
|
923
|
+
dateTag$1 = '[object Date]',
|
|
924
|
+
errorTag$1 = '[object Error]',
|
|
925
|
+
funcTag = '[object Function]',
|
|
926
|
+
mapTag$2 = '[object Map]',
|
|
927
|
+
numberTag$1 = '[object Number]',
|
|
928
|
+
objectTag$2 = '[object Object]',
|
|
929
|
+
regexpTag$1 = '[object RegExp]',
|
|
930
|
+
setTag$2 = '[object Set]',
|
|
931
|
+
stringTag$1 = '[object String]',
|
|
932
|
+
weakMapTag$1 = '[object WeakMap]';
|
|
933
|
+
|
|
934
|
+
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
935
|
+
dataViewTag$2 = '[object DataView]',
|
|
936
|
+
float32Tag = '[object Float32Array]',
|
|
937
|
+
float64Tag = '[object Float64Array]',
|
|
938
|
+
int8Tag = '[object Int8Array]',
|
|
939
|
+
int16Tag = '[object Int16Array]',
|
|
940
|
+
int32Tag = '[object Int32Array]',
|
|
941
|
+
uint8Tag = '[object Uint8Array]',
|
|
942
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
943
|
+
uint16Tag = '[object Uint16Array]',
|
|
944
|
+
uint32Tag = '[object Uint32Array]';
|
|
945
|
+
|
|
946
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
947
|
+
var typedArrayTags = {};
|
|
948
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
|
949
|
+
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
|
950
|
+
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
|
951
|
+
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
|
952
|
+
typedArrayTags[uint32Tag] = true;
|
|
953
|
+
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
954
|
+
typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] =
|
|
955
|
+
typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] =
|
|
956
|
+
typedArrayTags[errorTag$1] = typedArrayTags[funcTag] =
|
|
957
|
+
typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] =
|
|
958
|
+
typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] =
|
|
959
|
+
typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] =
|
|
960
|
+
typedArrayTags[weakMapTag$1] = false;
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
964
|
+
*
|
|
965
|
+
* @private
|
|
966
|
+
* @param {*} value The value to check.
|
|
967
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
968
|
+
*/
|
|
969
|
+
function baseIsTypedArray(value) {
|
|
970
|
+
return isObjectLike(value) &&
|
|
971
|
+
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
976
|
+
*
|
|
977
|
+
* @private
|
|
978
|
+
* @param {Function} func The function to cap arguments for.
|
|
979
|
+
* @returns {Function} Returns the new capped function.
|
|
980
|
+
*/
|
|
981
|
+
function baseUnary(func) {
|
|
982
|
+
return function(value) {
|
|
983
|
+
return func(value);
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/** Detect free variable `exports`. */
|
|
988
|
+
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
989
|
+
|
|
990
|
+
/** Detect free variable `module`. */
|
|
991
|
+
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
|
992
|
+
|
|
993
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
994
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
995
|
+
|
|
996
|
+
/** Detect free variable `process` from Node.js. */
|
|
997
|
+
var freeProcess = moduleExports && freeGlobal$1.process;
|
|
998
|
+
|
|
999
|
+
/** Used to access faster Node.js helpers. */
|
|
1000
|
+
var nodeUtil = (function() {
|
|
1001
|
+
try {
|
|
1002
|
+
// Use `util.types` for Node.js 10+.
|
|
1003
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
1004
|
+
|
|
1005
|
+
if (types) {
|
|
1006
|
+
return types;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1010
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1011
|
+
} catch (e) {}
|
|
1012
|
+
}());
|
|
1013
|
+
|
|
1014
|
+
var nodeUtil$1 = nodeUtil;
|
|
1015
|
+
|
|
1016
|
+
/* Node.js helper references. */
|
|
1017
|
+
var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Checks if `value` is classified as a typed array.
|
|
1021
|
+
*
|
|
1022
|
+
* @static
|
|
1023
|
+
* @memberOf _
|
|
1024
|
+
* @since 3.0.0
|
|
1025
|
+
* @category Lang
|
|
1026
|
+
* @param {*} value The value to check.
|
|
1027
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1028
|
+
* @example
|
|
1029
|
+
*
|
|
1030
|
+
* _.isTypedArray(new Uint8Array);
|
|
1031
|
+
* // => true
|
|
1032
|
+
*
|
|
1033
|
+
* _.isTypedArray([]);
|
|
1034
|
+
* // => false
|
|
1035
|
+
*/
|
|
1036
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
1037
|
+
|
|
1038
|
+
var isTypedArray$1 = isTypedArray;
|
|
1039
|
+
|
|
1040
|
+
/** Used for built-in method references. */
|
|
1041
|
+
var objectProto$6 = Object.prototype;
|
|
1042
|
+
|
|
1043
|
+
/** Used to check objects for own properties. */
|
|
1044
|
+
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
1048
|
+
*
|
|
1049
|
+
* @private
|
|
1050
|
+
* @param {*} value The value to query.
|
|
1051
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
1052
|
+
* @returns {Array} Returns the array of property names.
|
|
1053
|
+
*/
|
|
1054
|
+
function arrayLikeKeys(value, inherited) {
|
|
1055
|
+
var isArr = isArray$1(value),
|
|
1056
|
+
isArg = !isArr && isArguments$1(value),
|
|
1057
|
+
isBuff = !isArr && !isArg && isBuffer$1(value),
|
|
1058
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
|
|
1059
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
1060
|
+
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
1061
|
+
length = result.length;
|
|
1062
|
+
|
|
1063
|
+
for (var key in value) {
|
|
1064
|
+
if ((inherited || hasOwnProperty$5.call(value, key)) &&
|
|
1065
|
+
!(skipIndexes && (
|
|
1066
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1067
|
+
key == 'length' ||
|
|
1068
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1069
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
1070
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1071
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
1072
|
+
// Skip index properties.
|
|
1073
|
+
isIndex(key, length)
|
|
1074
|
+
))) {
|
|
1075
|
+
result.push(key);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
return result;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
1083
|
+
*
|
|
1084
|
+
* @private
|
|
1085
|
+
* @param {Function} func The function to wrap.
|
|
1086
|
+
* @param {Function} transform The argument transform.
|
|
1087
|
+
* @returns {Function} Returns the new function.
|
|
1088
|
+
*/
|
|
1089
|
+
function overArg(func, transform) {
|
|
1090
|
+
return function(arg) {
|
|
1091
|
+
return func(transform(arg));
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1096
|
+
var nativeKeys = overArg(Object.keys, Object);
|
|
1097
|
+
|
|
1098
|
+
var nativeKeys$1 = nativeKeys;
|
|
1099
|
+
|
|
1100
|
+
/** Used for built-in method references. */
|
|
1101
|
+
var objectProto$5 = Object.prototype;
|
|
1102
|
+
|
|
1103
|
+
/** Used to check objects for own properties. */
|
|
1104
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
1108
|
+
*
|
|
1109
|
+
* @private
|
|
1110
|
+
* @param {Object} object The object to query.
|
|
1111
|
+
* @returns {Array} Returns the array of property names.
|
|
1112
|
+
*/
|
|
1113
|
+
function baseKeys(object) {
|
|
1114
|
+
if (!isPrototype(object)) {
|
|
1115
|
+
return nativeKeys$1(object);
|
|
1116
|
+
}
|
|
1117
|
+
var result = [];
|
|
1118
|
+
for (var key in Object(object)) {
|
|
1119
|
+
if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
|
|
1120
|
+
result.push(key);
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
return result;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Creates an array of the own enumerable property names of `object`.
|
|
1128
|
+
*
|
|
1129
|
+
* **Note:** Non-object values are coerced to objects. See the
|
|
1130
|
+
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1131
|
+
* for more details.
|
|
1132
|
+
*
|
|
1133
|
+
* @static
|
|
1134
|
+
* @since 0.1.0
|
|
1135
|
+
* @memberOf _
|
|
1136
|
+
* @category Object
|
|
1137
|
+
* @param {Object} object The object to query.
|
|
1138
|
+
* @returns {Array} Returns the array of property names.
|
|
1139
|
+
* @example
|
|
1140
|
+
*
|
|
1141
|
+
* function Foo() {
|
|
1142
|
+
* this.a = 1;
|
|
1143
|
+
* this.b = 2;
|
|
1144
|
+
* }
|
|
1145
|
+
*
|
|
1146
|
+
* Foo.prototype.c = 3;
|
|
1147
|
+
*
|
|
1148
|
+
* _.keys(new Foo);
|
|
1149
|
+
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
1150
|
+
*
|
|
1151
|
+
* _.keys('hi');
|
|
1152
|
+
* // => ['0', '1']
|
|
1153
|
+
*/
|
|
1154
|
+
function keys(object) {
|
|
1155
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/** Used to match property names within property paths. */
|
|
1159
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
1160
|
+
reIsPlainProp = /^\w*$/;
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* Checks if `value` is a property name and not a property path.
|
|
1164
|
+
*
|
|
1165
|
+
* @private
|
|
1166
|
+
* @param {*} value The value to check.
|
|
1167
|
+
* @param {Object} [object] The object to query keys on.
|
|
1168
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
1169
|
+
*/
|
|
1170
|
+
function isKey(value, object) {
|
|
1171
|
+
if (isArray$1(value)) {
|
|
1172
|
+
return false;
|
|
1173
|
+
}
|
|
1174
|
+
var type = typeof value;
|
|
1175
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
1176
|
+
value == null || isSymbol(value)) {
|
|
1177
|
+
return true;
|
|
1178
|
+
}
|
|
1179
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
1180
|
+
(object != null && value in Object(object));
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/* Built-in method references that are verified to be native. */
|
|
1184
|
+
var nativeCreate = getNative(Object, 'create');
|
|
1185
|
+
|
|
1186
|
+
var nativeCreate$1 = nativeCreate;
|
|
1187
|
+
|
|
1188
|
+
/**
|
|
1189
|
+
* Removes all key-value entries from the hash.
|
|
1190
|
+
*
|
|
1191
|
+
* @private
|
|
1192
|
+
* @name clear
|
|
1193
|
+
* @memberOf Hash
|
|
1194
|
+
*/
|
|
1195
|
+
function hashClear() {
|
|
1196
|
+
this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
|
|
1197
|
+
this.size = 0;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
/**
|
|
1201
|
+
* Removes `key` and its value from the hash.
|
|
1202
|
+
*
|
|
1203
|
+
* @private
|
|
1204
|
+
* @name delete
|
|
1205
|
+
* @memberOf Hash
|
|
1206
|
+
* @param {Object} hash The hash to modify.
|
|
1207
|
+
* @param {string} key The key of the value to remove.
|
|
1208
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1209
|
+
*/
|
|
1210
|
+
function hashDelete(key) {
|
|
1211
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
1212
|
+
this.size -= result ? 1 : 0;
|
|
1213
|
+
return result;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1217
|
+
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
|
|
1218
|
+
|
|
1219
|
+
/** Used for built-in method references. */
|
|
1220
|
+
var objectProto$4 = Object.prototype;
|
|
1221
|
+
|
|
1222
|
+
/** Used to check objects for own properties. */
|
|
1223
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* Gets the hash value for `key`.
|
|
1227
|
+
*
|
|
1228
|
+
* @private
|
|
1229
|
+
* @name get
|
|
1230
|
+
* @memberOf Hash
|
|
1231
|
+
* @param {string} key The key of the value to get.
|
|
1232
|
+
* @returns {*} Returns the entry value.
|
|
1233
|
+
*/
|
|
1234
|
+
function hashGet(key) {
|
|
1235
|
+
var data = this.__data__;
|
|
1236
|
+
if (nativeCreate$1) {
|
|
1237
|
+
var result = data[key];
|
|
1238
|
+
return result === HASH_UNDEFINED$2 ? undefined : result;
|
|
1239
|
+
}
|
|
1240
|
+
return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
/** Used for built-in method references. */
|
|
1244
|
+
var objectProto$3 = Object.prototype;
|
|
1245
|
+
|
|
1246
|
+
/** Used to check objects for own properties. */
|
|
1247
|
+
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* Checks if a hash value for `key` exists.
|
|
1251
|
+
*
|
|
1252
|
+
* @private
|
|
1253
|
+
* @name has
|
|
1254
|
+
* @memberOf Hash
|
|
1255
|
+
* @param {string} key The key of the entry to check.
|
|
1256
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1257
|
+
*/
|
|
1258
|
+
function hashHas(key) {
|
|
1259
|
+
var data = this.__data__;
|
|
1260
|
+
return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$2.call(data, key);
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1264
|
+
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Sets the hash `key` to `value`.
|
|
1268
|
+
*
|
|
1269
|
+
* @private
|
|
1270
|
+
* @name set
|
|
1271
|
+
* @memberOf Hash
|
|
1272
|
+
* @param {string} key The key of the value to set.
|
|
1273
|
+
* @param {*} value The value to set.
|
|
1274
|
+
* @returns {Object} Returns the hash instance.
|
|
1275
|
+
*/
|
|
1276
|
+
function hashSet(key, value) {
|
|
1277
|
+
var data = this.__data__;
|
|
1278
|
+
this.size += this.has(key) ? 0 : 1;
|
|
1279
|
+
data[key] = (nativeCreate$1 && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
1280
|
+
return this;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Creates a hash object.
|
|
1285
|
+
*
|
|
1286
|
+
* @private
|
|
1287
|
+
* @constructor
|
|
1288
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1289
|
+
*/
|
|
1290
|
+
function Hash(entries) {
|
|
1291
|
+
var index = -1,
|
|
1292
|
+
length = entries == null ? 0 : entries.length;
|
|
1293
|
+
|
|
1294
|
+
this.clear();
|
|
1295
|
+
while (++index < length) {
|
|
1296
|
+
var entry = entries[index];
|
|
1297
|
+
this.set(entry[0], entry[1]);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// Add methods to `Hash`.
|
|
1302
|
+
Hash.prototype.clear = hashClear;
|
|
1303
|
+
Hash.prototype['delete'] = hashDelete;
|
|
1304
|
+
Hash.prototype.get = hashGet;
|
|
1305
|
+
Hash.prototype.has = hashHas;
|
|
1306
|
+
Hash.prototype.set = hashSet;
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* Removes all key-value entries from the list cache.
|
|
1310
|
+
*
|
|
1311
|
+
* @private
|
|
1312
|
+
* @name clear
|
|
1313
|
+
* @memberOf ListCache
|
|
1314
|
+
*/
|
|
1315
|
+
function listCacheClear() {
|
|
1316
|
+
this.__data__ = [];
|
|
1317
|
+
this.size = 0;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1322
|
+
*
|
|
1323
|
+
* @private
|
|
1324
|
+
* @param {Array} array The array to inspect.
|
|
1325
|
+
* @param {*} key The key to search for.
|
|
1326
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1327
|
+
*/
|
|
1328
|
+
function assocIndexOf(array, key) {
|
|
1329
|
+
var length = array.length;
|
|
1330
|
+
while (length--) {
|
|
1331
|
+
if (eq(array[length][0], key)) {
|
|
1332
|
+
return length;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
return -1;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
/** Used for built-in method references. */
|
|
1339
|
+
var arrayProto = Array.prototype;
|
|
1340
|
+
|
|
1341
|
+
/** Built-in value references. */
|
|
1342
|
+
var splice = arrayProto.splice;
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* Removes `key` and its value from the list cache.
|
|
1346
|
+
*
|
|
1347
|
+
* @private
|
|
1348
|
+
* @name delete
|
|
1349
|
+
* @memberOf ListCache
|
|
1350
|
+
* @param {string} key The key of the value to remove.
|
|
1351
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1352
|
+
*/
|
|
1353
|
+
function listCacheDelete(key) {
|
|
1354
|
+
var data = this.__data__,
|
|
1355
|
+
index = assocIndexOf(data, key);
|
|
1356
|
+
|
|
1357
|
+
if (index < 0) {
|
|
1358
|
+
return false;
|
|
1359
|
+
}
|
|
1360
|
+
var lastIndex = data.length - 1;
|
|
1361
|
+
if (index == lastIndex) {
|
|
1362
|
+
data.pop();
|
|
1363
|
+
} else {
|
|
1364
|
+
splice.call(data, index, 1);
|
|
1365
|
+
}
|
|
1366
|
+
--this.size;
|
|
1367
|
+
return true;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* Gets the list cache value for `key`.
|
|
1372
|
+
*
|
|
1373
|
+
* @private
|
|
1374
|
+
* @name get
|
|
1375
|
+
* @memberOf ListCache
|
|
1376
|
+
* @param {string} key The key of the value to get.
|
|
1377
|
+
* @returns {*} Returns the entry value.
|
|
1378
|
+
*/
|
|
1379
|
+
function listCacheGet(key) {
|
|
1380
|
+
var data = this.__data__,
|
|
1381
|
+
index = assocIndexOf(data, key);
|
|
1382
|
+
|
|
1383
|
+
return index < 0 ? undefined : data[index][1];
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Checks if a list cache value for `key` exists.
|
|
1388
|
+
*
|
|
1389
|
+
* @private
|
|
1390
|
+
* @name has
|
|
1391
|
+
* @memberOf ListCache
|
|
1392
|
+
* @param {string} key The key of the entry to check.
|
|
1393
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1394
|
+
*/
|
|
1395
|
+
function listCacheHas(key) {
|
|
1396
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* Sets the list cache `key` to `value`.
|
|
1401
|
+
*
|
|
1402
|
+
* @private
|
|
1403
|
+
* @name set
|
|
1404
|
+
* @memberOf ListCache
|
|
1405
|
+
* @param {string} key The key of the value to set.
|
|
1406
|
+
* @param {*} value The value to set.
|
|
1407
|
+
* @returns {Object} Returns the list cache instance.
|
|
1408
|
+
*/
|
|
1409
|
+
function listCacheSet(key, value) {
|
|
1410
|
+
var data = this.__data__,
|
|
1411
|
+
index = assocIndexOf(data, key);
|
|
1412
|
+
|
|
1413
|
+
if (index < 0) {
|
|
1414
|
+
++this.size;
|
|
1415
|
+
data.push([key, value]);
|
|
1416
|
+
} else {
|
|
1417
|
+
data[index][1] = value;
|
|
1418
|
+
}
|
|
1419
|
+
return this;
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Creates an list cache object.
|
|
1424
|
+
*
|
|
1425
|
+
* @private
|
|
1426
|
+
* @constructor
|
|
1427
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1428
|
+
*/
|
|
1429
|
+
function ListCache(entries) {
|
|
1430
|
+
var index = -1,
|
|
1431
|
+
length = entries == null ? 0 : entries.length;
|
|
1432
|
+
|
|
1433
|
+
this.clear();
|
|
1434
|
+
while (++index < length) {
|
|
1435
|
+
var entry = entries[index];
|
|
1436
|
+
this.set(entry[0], entry[1]);
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
// Add methods to `ListCache`.
|
|
1441
|
+
ListCache.prototype.clear = listCacheClear;
|
|
1442
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
1443
|
+
ListCache.prototype.get = listCacheGet;
|
|
1444
|
+
ListCache.prototype.has = listCacheHas;
|
|
1445
|
+
ListCache.prototype.set = listCacheSet;
|
|
1446
|
+
|
|
1447
|
+
/* Built-in method references that are verified to be native. */
|
|
1448
|
+
var Map = getNative(root$1, 'Map');
|
|
1449
|
+
|
|
1450
|
+
var Map$1 = Map;
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* Removes all key-value entries from the map.
|
|
1454
|
+
*
|
|
1455
|
+
* @private
|
|
1456
|
+
* @name clear
|
|
1457
|
+
* @memberOf MapCache
|
|
1458
|
+
*/
|
|
1459
|
+
function mapCacheClear() {
|
|
1460
|
+
this.size = 0;
|
|
1461
|
+
this.__data__ = {
|
|
1462
|
+
'hash': new Hash,
|
|
1463
|
+
'map': new (Map$1 || ListCache),
|
|
1464
|
+
'string': new Hash
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
/**
|
|
1469
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1470
|
+
*
|
|
1471
|
+
* @private
|
|
1472
|
+
* @param {*} value The value to check.
|
|
1473
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1474
|
+
*/
|
|
1475
|
+
function isKeyable(value) {
|
|
1476
|
+
var type = typeof value;
|
|
1477
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1478
|
+
? (value !== '__proto__')
|
|
1479
|
+
: (value === null);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* Gets the data for `map`.
|
|
1484
|
+
*
|
|
1485
|
+
* @private
|
|
1486
|
+
* @param {Object} map The map to query.
|
|
1487
|
+
* @param {string} key The reference key.
|
|
1488
|
+
* @returns {*} Returns the map data.
|
|
1489
|
+
*/
|
|
1490
|
+
function getMapData(map, key) {
|
|
1491
|
+
var data = map.__data__;
|
|
1492
|
+
return isKeyable(key)
|
|
1493
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1494
|
+
: data.map;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* Removes `key` and its value from the map.
|
|
1499
|
+
*
|
|
1500
|
+
* @private
|
|
1501
|
+
* @name delete
|
|
1502
|
+
* @memberOf MapCache
|
|
1503
|
+
* @param {string} key The key of the value to remove.
|
|
1504
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1505
|
+
*/
|
|
1506
|
+
function mapCacheDelete(key) {
|
|
1507
|
+
var result = getMapData(this, key)['delete'](key);
|
|
1508
|
+
this.size -= result ? 1 : 0;
|
|
1509
|
+
return result;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
/**
|
|
1513
|
+
* Gets the map value for `key`.
|
|
1514
|
+
*
|
|
1515
|
+
* @private
|
|
1516
|
+
* @name get
|
|
1517
|
+
* @memberOf MapCache
|
|
1518
|
+
* @param {string} key The key of the value to get.
|
|
1519
|
+
* @returns {*} Returns the entry value.
|
|
1520
|
+
*/
|
|
1521
|
+
function mapCacheGet(key) {
|
|
1522
|
+
return getMapData(this, key).get(key);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
/**
|
|
1526
|
+
* Checks if a map value for `key` exists.
|
|
1527
|
+
*
|
|
1528
|
+
* @private
|
|
1529
|
+
* @name has
|
|
1530
|
+
* @memberOf MapCache
|
|
1531
|
+
* @param {string} key The key of the entry to check.
|
|
1532
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1533
|
+
*/
|
|
1534
|
+
function mapCacheHas(key) {
|
|
1535
|
+
return getMapData(this, key).has(key);
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* Sets the map `key` to `value`.
|
|
1540
|
+
*
|
|
1541
|
+
* @private
|
|
1542
|
+
* @name set
|
|
1543
|
+
* @memberOf MapCache
|
|
1544
|
+
* @param {string} key The key of the value to set.
|
|
1545
|
+
* @param {*} value The value to set.
|
|
1546
|
+
* @returns {Object} Returns the map cache instance.
|
|
1547
|
+
*/
|
|
1548
|
+
function mapCacheSet(key, value) {
|
|
1549
|
+
var data = getMapData(this, key),
|
|
1550
|
+
size = data.size;
|
|
1551
|
+
|
|
1552
|
+
data.set(key, value);
|
|
1553
|
+
this.size += data.size == size ? 0 : 1;
|
|
1554
|
+
return this;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
/**
|
|
1558
|
+
* Creates a map cache object to store key-value pairs.
|
|
1559
|
+
*
|
|
1560
|
+
* @private
|
|
1561
|
+
* @constructor
|
|
1562
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1563
|
+
*/
|
|
1564
|
+
function MapCache(entries) {
|
|
1565
|
+
var index = -1,
|
|
1566
|
+
length = entries == null ? 0 : entries.length;
|
|
1567
|
+
|
|
1568
|
+
this.clear();
|
|
1569
|
+
while (++index < length) {
|
|
1570
|
+
var entry = entries[index];
|
|
1571
|
+
this.set(entry[0], entry[1]);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
// Add methods to `MapCache`.
|
|
1576
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
1577
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
1578
|
+
MapCache.prototype.get = mapCacheGet;
|
|
1579
|
+
MapCache.prototype.has = mapCacheHas;
|
|
1580
|
+
MapCache.prototype.set = mapCacheSet;
|
|
1581
|
+
|
|
1582
|
+
/** Error message constants. */
|
|
1583
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
1587
|
+
* provided, it determines the cache key for storing the result based on the
|
|
1588
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
1589
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
1590
|
+
* is invoked with the `this` binding of the memoized function.
|
|
1591
|
+
*
|
|
1592
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
1593
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
1594
|
+
* constructor with one whose instances implement the
|
|
1595
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
1596
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
1597
|
+
*
|
|
1598
|
+
* @static
|
|
1599
|
+
* @memberOf _
|
|
1600
|
+
* @since 0.1.0
|
|
1601
|
+
* @category Function
|
|
1602
|
+
* @param {Function} func The function to have its output memoized.
|
|
1603
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
1604
|
+
* @returns {Function} Returns the new memoized function.
|
|
1605
|
+
* @example
|
|
1606
|
+
*
|
|
1607
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
1608
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
1609
|
+
*
|
|
1610
|
+
* var values = _.memoize(_.values);
|
|
1611
|
+
* values(object);
|
|
1612
|
+
* // => [1, 2]
|
|
1613
|
+
*
|
|
1614
|
+
* values(other);
|
|
1615
|
+
* // => [3, 4]
|
|
1616
|
+
*
|
|
1617
|
+
* object.a = 2;
|
|
1618
|
+
* values(object);
|
|
1619
|
+
* // => [1, 2]
|
|
1620
|
+
*
|
|
1621
|
+
* // Modify the result cache.
|
|
1622
|
+
* values.cache.set(object, ['a', 'b']);
|
|
1623
|
+
* values(object);
|
|
1624
|
+
* // => ['a', 'b']
|
|
1625
|
+
*
|
|
1626
|
+
* // Replace `_.memoize.Cache`.
|
|
1627
|
+
* _.memoize.Cache = WeakMap;
|
|
1628
|
+
*/
|
|
1629
|
+
function memoize(func, resolver) {
|
|
1630
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
1631
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1632
|
+
}
|
|
1633
|
+
var memoized = function() {
|
|
1634
|
+
var args = arguments,
|
|
1635
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
1636
|
+
cache = memoized.cache;
|
|
1637
|
+
|
|
1638
|
+
if (cache.has(key)) {
|
|
1639
|
+
return cache.get(key);
|
|
1640
|
+
}
|
|
1641
|
+
var result = func.apply(this, args);
|
|
1642
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
1643
|
+
return result;
|
|
1644
|
+
};
|
|
1645
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
1646
|
+
return memoized;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
// Expose `MapCache`.
|
|
1650
|
+
memoize.Cache = MapCache;
|
|
1651
|
+
|
|
1652
|
+
/** Used as the maximum memoize cache size. */
|
|
1653
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
1654
|
+
|
|
1655
|
+
/**
|
|
1656
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
1657
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
1658
|
+
*
|
|
1659
|
+
* @private
|
|
1660
|
+
* @param {Function} func The function to have its output memoized.
|
|
1661
|
+
* @returns {Function} Returns the new memoized function.
|
|
1662
|
+
*/
|
|
1663
|
+
function memoizeCapped(func) {
|
|
1664
|
+
var result = memoize(func, function(key) {
|
|
1665
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
1666
|
+
cache.clear();
|
|
1667
|
+
}
|
|
1668
|
+
return key;
|
|
1669
|
+
});
|
|
1670
|
+
|
|
1671
|
+
var cache = result.cache;
|
|
1672
|
+
return result;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
/** Used to match property names within property paths. */
|
|
1676
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
1677
|
+
|
|
1678
|
+
/** Used to match backslashes in property paths. */
|
|
1679
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
1680
|
+
|
|
1681
|
+
/**
|
|
1682
|
+
* Converts `string` to a property path array.
|
|
1683
|
+
*
|
|
1684
|
+
* @private
|
|
1685
|
+
* @param {string} string The string to convert.
|
|
1686
|
+
* @returns {Array} Returns the property path array.
|
|
1687
|
+
*/
|
|
1688
|
+
var stringToPath = memoizeCapped(function(string) {
|
|
1689
|
+
var result = [];
|
|
1690
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
1691
|
+
result.push('');
|
|
1692
|
+
}
|
|
1693
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
1694
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
1695
|
+
});
|
|
1696
|
+
return result;
|
|
1697
|
+
});
|
|
1698
|
+
|
|
1699
|
+
var stringToPath$1 = stringToPath;
|
|
1700
|
+
|
|
1701
|
+
/**
|
|
1702
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
1703
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
1704
|
+
*
|
|
1705
|
+
* @static
|
|
1706
|
+
* @memberOf _
|
|
1707
|
+
* @since 4.0.0
|
|
1708
|
+
* @category Lang
|
|
1709
|
+
* @param {*} value The value to convert.
|
|
1710
|
+
* @returns {string} Returns the converted string.
|
|
1711
|
+
* @example
|
|
1712
|
+
*
|
|
1713
|
+
* _.toString(null);
|
|
1714
|
+
* // => ''
|
|
1715
|
+
*
|
|
1716
|
+
* _.toString(-0);
|
|
1717
|
+
* // => '-0'
|
|
1718
|
+
*
|
|
1719
|
+
* _.toString([1, 2, 3]);
|
|
1720
|
+
* // => '1,2,3'
|
|
1721
|
+
*/
|
|
1722
|
+
function toString(value) {
|
|
1723
|
+
return value == null ? '' : baseToString(value);
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
/**
|
|
1727
|
+
* Casts `value` to a path array if it's not one.
|
|
1728
|
+
*
|
|
1729
|
+
* @private
|
|
1730
|
+
* @param {*} value The value to inspect.
|
|
1731
|
+
* @param {Object} [object] The object to query keys on.
|
|
1732
|
+
* @returns {Array} Returns the cast property path array.
|
|
1733
|
+
*/
|
|
1734
|
+
function castPath(value, object) {
|
|
1735
|
+
if (isArray$1(value)) {
|
|
1736
|
+
return value;
|
|
1737
|
+
}
|
|
1738
|
+
return isKey(value, object) ? [value] : stringToPath$1(toString(value));
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
/** Used as references for various `Number` constants. */
|
|
1742
|
+
var INFINITY = 1 / 0;
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
1746
|
+
*
|
|
1747
|
+
* @private
|
|
1748
|
+
* @param {*} value The value to inspect.
|
|
1749
|
+
* @returns {string|symbol} Returns the key.
|
|
1750
|
+
*/
|
|
1751
|
+
function toKey(value) {
|
|
1752
|
+
if (typeof value == 'string' || isSymbol(value)) {
|
|
1753
|
+
return value;
|
|
1754
|
+
}
|
|
1755
|
+
var result = (value + '');
|
|
1756
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
/**
|
|
1760
|
+
* The base implementation of `_.get` without support for default values.
|
|
1761
|
+
*
|
|
1762
|
+
* @private
|
|
1763
|
+
* @param {Object} object The object to query.
|
|
1764
|
+
* @param {Array|string} path The path of the property to get.
|
|
1765
|
+
* @returns {*} Returns the resolved value.
|
|
1766
|
+
*/
|
|
1767
|
+
function baseGet(object, path) {
|
|
1768
|
+
path = castPath(path, object);
|
|
1769
|
+
|
|
1770
|
+
var index = 0,
|
|
1771
|
+
length = path.length;
|
|
1772
|
+
|
|
1773
|
+
while (object != null && index < length) {
|
|
1774
|
+
object = object[toKey(path[index++])];
|
|
1775
|
+
}
|
|
1776
|
+
return (index && index == length) ? object : undefined;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
/**
|
|
1780
|
+
* Appends the elements of `values` to `array`.
|
|
1781
|
+
*
|
|
1782
|
+
* @private
|
|
1783
|
+
* @param {Array} array The array to modify.
|
|
1784
|
+
* @param {Array} values The values to append.
|
|
1785
|
+
* @returns {Array} Returns `array`.
|
|
1786
|
+
*/
|
|
1787
|
+
function arrayPush(array, values) {
|
|
1788
|
+
var index = -1,
|
|
1789
|
+
length = values.length,
|
|
1790
|
+
offset = array.length;
|
|
1791
|
+
|
|
1792
|
+
while (++index < length) {
|
|
1793
|
+
array[offset + index] = values[index];
|
|
1794
|
+
}
|
|
1795
|
+
return array;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
/** Built-in value references. */
|
|
1799
|
+
var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : undefined;
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
|
1803
|
+
*
|
|
1804
|
+
* @private
|
|
1805
|
+
* @param {*} value The value to check.
|
|
1806
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
1807
|
+
*/
|
|
1808
|
+
function isFlattenable(value) {
|
|
1809
|
+
return isArray$1(value) || isArguments$1(value) ||
|
|
1810
|
+
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
/**
|
|
1814
|
+
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
1815
|
+
*
|
|
1816
|
+
* @private
|
|
1817
|
+
* @param {Array} array The array to flatten.
|
|
1818
|
+
* @param {number} depth The maximum recursion depth.
|
|
1819
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
1820
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
1821
|
+
* @param {Array} [result=[]] The initial result value.
|
|
1822
|
+
* @returns {Array} Returns the new flattened array.
|
|
1823
|
+
*/
|
|
1824
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
1825
|
+
var index = -1,
|
|
1826
|
+
length = array.length;
|
|
1827
|
+
|
|
1828
|
+
predicate || (predicate = isFlattenable);
|
|
1829
|
+
result || (result = []);
|
|
1830
|
+
|
|
1831
|
+
while (++index < length) {
|
|
1832
|
+
var value = array[index];
|
|
1833
|
+
if (depth > 0 && predicate(value)) {
|
|
1834
|
+
if (depth > 1) {
|
|
1835
|
+
// Recursively flatten arrays (susceptible to call stack limits).
|
|
1836
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
1837
|
+
} else {
|
|
1838
|
+
arrayPush(result, value);
|
|
1839
|
+
}
|
|
1840
|
+
} else if (!isStrict) {
|
|
1841
|
+
result[result.length] = value;
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
return result;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* Flattens `array` a single level deep.
|
|
1849
|
+
*
|
|
1850
|
+
* @static
|
|
1851
|
+
* @memberOf _
|
|
1852
|
+
* @since 0.1.0
|
|
1853
|
+
* @category Array
|
|
1854
|
+
* @param {Array} array The array to flatten.
|
|
1855
|
+
* @returns {Array} Returns the new flattened array.
|
|
1856
|
+
* @example
|
|
1857
|
+
*
|
|
1858
|
+
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
1859
|
+
* // => [1, 2, [3, [4]], 5]
|
|
1860
|
+
*/
|
|
1861
|
+
function flatten(array) {
|
|
1862
|
+
var length = array == null ? 0 : array.length;
|
|
1863
|
+
return length ? baseFlatten(array, 1) : [];
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
/**
|
|
1867
|
+
* A specialized version of `baseRest` which flattens the rest array.
|
|
1868
|
+
*
|
|
1869
|
+
* @private
|
|
1870
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
1871
|
+
* @returns {Function} Returns the new function.
|
|
1872
|
+
*/
|
|
1873
|
+
function flatRest(func) {
|
|
1874
|
+
return setToString$1(overRest(func, undefined, flatten), func + '');
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
/**
|
|
1878
|
+
* Removes all key-value entries from the stack.
|
|
1879
|
+
*
|
|
1880
|
+
* @private
|
|
1881
|
+
* @name clear
|
|
1882
|
+
* @memberOf Stack
|
|
1883
|
+
*/
|
|
1884
|
+
function stackClear() {
|
|
1885
|
+
this.__data__ = new ListCache;
|
|
1886
|
+
this.size = 0;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Removes `key` and its value from the stack.
|
|
1891
|
+
*
|
|
1892
|
+
* @private
|
|
1893
|
+
* @name delete
|
|
1894
|
+
* @memberOf Stack
|
|
1895
|
+
* @param {string} key The key of the value to remove.
|
|
1896
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1897
|
+
*/
|
|
1898
|
+
function stackDelete(key) {
|
|
1899
|
+
var data = this.__data__,
|
|
1900
|
+
result = data['delete'](key);
|
|
1901
|
+
|
|
1902
|
+
this.size = data.size;
|
|
1903
|
+
return result;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
/**
|
|
1907
|
+
* Gets the stack value for `key`.
|
|
1908
|
+
*
|
|
1909
|
+
* @private
|
|
1910
|
+
* @name get
|
|
1911
|
+
* @memberOf Stack
|
|
1912
|
+
* @param {string} key The key of the value to get.
|
|
1913
|
+
* @returns {*} Returns the entry value.
|
|
1914
|
+
*/
|
|
1915
|
+
function stackGet(key) {
|
|
1916
|
+
return this.__data__.get(key);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
/**
|
|
1920
|
+
* Checks if a stack value for `key` exists.
|
|
1921
|
+
*
|
|
1922
|
+
* @private
|
|
1923
|
+
* @name has
|
|
1924
|
+
* @memberOf Stack
|
|
1925
|
+
* @param {string} key The key of the entry to check.
|
|
1926
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1927
|
+
*/
|
|
1928
|
+
function stackHas(key) {
|
|
1929
|
+
return this.__data__.has(key);
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
/** Used as the size to enable large array optimizations. */
|
|
1933
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1934
|
+
|
|
1935
|
+
/**
|
|
1936
|
+
* Sets the stack `key` to `value`.
|
|
1937
|
+
*
|
|
1938
|
+
* @private
|
|
1939
|
+
* @name set
|
|
1940
|
+
* @memberOf Stack
|
|
1941
|
+
* @param {string} key The key of the value to set.
|
|
1942
|
+
* @param {*} value The value to set.
|
|
1943
|
+
* @returns {Object} Returns the stack cache instance.
|
|
1944
|
+
*/
|
|
1945
|
+
function stackSet(key, value) {
|
|
1946
|
+
var data = this.__data__;
|
|
1947
|
+
if (data instanceof ListCache) {
|
|
1948
|
+
var pairs = data.__data__;
|
|
1949
|
+
if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1950
|
+
pairs.push([key, value]);
|
|
1951
|
+
this.size = ++data.size;
|
|
1952
|
+
return this;
|
|
1953
|
+
}
|
|
1954
|
+
data = this.__data__ = new MapCache(pairs);
|
|
1955
|
+
}
|
|
1956
|
+
data.set(key, value);
|
|
1957
|
+
this.size = data.size;
|
|
1958
|
+
return this;
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
/**
|
|
1962
|
+
* Creates a stack cache object to store key-value pairs.
|
|
1963
|
+
*
|
|
1964
|
+
* @private
|
|
1965
|
+
* @constructor
|
|
1966
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1967
|
+
*/
|
|
1968
|
+
function Stack(entries) {
|
|
1969
|
+
var data = this.__data__ = new ListCache(entries);
|
|
1970
|
+
this.size = data.size;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
// Add methods to `Stack`.
|
|
1974
|
+
Stack.prototype.clear = stackClear;
|
|
1975
|
+
Stack.prototype['delete'] = stackDelete;
|
|
1976
|
+
Stack.prototype.get = stackGet;
|
|
1977
|
+
Stack.prototype.has = stackHas;
|
|
1978
|
+
Stack.prototype.set = stackSet;
|
|
1979
|
+
|
|
1980
|
+
/**
|
|
1981
|
+
* A specialized version of `_.filter` for arrays without support for
|
|
1982
|
+
* iteratee shorthands.
|
|
1983
|
+
*
|
|
1984
|
+
* @private
|
|
1985
|
+
* @param {Array} [array] The array to iterate over.
|
|
1986
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
1987
|
+
* @returns {Array} Returns the new filtered array.
|
|
1988
|
+
*/
|
|
1989
|
+
function arrayFilter(array, predicate) {
|
|
1990
|
+
var index = -1,
|
|
1991
|
+
length = array == null ? 0 : array.length,
|
|
1992
|
+
resIndex = 0,
|
|
1993
|
+
result = [];
|
|
1994
|
+
|
|
1995
|
+
while (++index < length) {
|
|
1996
|
+
var value = array[index];
|
|
1997
|
+
if (predicate(value, index, array)) {
|
|
1998
|
+
result[resIndex++] = value;
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
return result;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
/**
|
|
2005
|
+
* This method returns a new empty array.
|
|
2006
|
+
*
|
|
2007
|
+
* @static
|
|
2008
|
+
* @memberOf _
|
|
2009
|
+
* @since 4.13.0
|
|
2010
|
+
* @category Util
|
|
2011
|
+
* @returns {Array} Returns the new empty array.
|
|
2012
|
+
* @example
|
|
2013
|
+
*
|
|
2014
|
+
* var arrays = _.times(2, _.stubArray);
|
|
2015
|
+
*
|
|
2016
|
+
* console.log(arrays);
|
|
2017
|
+
* // => [[], []]
|
|
2018
|
+
*
|
|
2019
|
+
* console.log(arrays[0] === arrays[1]);
|
|
2020
|
+
* // => false
|
|
2021
|
+
*/
|
|
2022
|
+
function stubArray() {
|
|
2023
|
+
return [];
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
/** Used for built-in method references. */
|
|
2027
|
+
var objectProto$2 = Object.prototype;
|
|
2028
|
+
|
|
2029
|
+
/** Built-in value references. */
|
|
2030
|
+
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
2031
|
+
|
|
2032
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2033
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
2034
|
+
|
|
2035
|
+
/**
|
|
2036
|
+
* Creates an array of the own enumerable symbols of `object`.
|
|
2037
|
+
*
|
|
2038
|
+
* @private
|
|
2039
|
+
* @param {Object} object The object to query.
|
|
2040
|
+
* @returns {Array} Returns the array of symbols.
|
|
2041
|
+
*/
|
|
2042
|
+
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
2043
|
+
if (object == null) {
|
|
2044
|
+
return [];
|
|
2045
|
+
}
|
|
2046
|
+
object = Object(object);
|
|
2047
|
+
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
2048
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
2049
|
+
});
|
|
2050
|
+
};
|
|
2051
|
+
|
|
2052
|
+
var getSymbols$1 = getSymbols;
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
2056
|
+
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
2057
|
+
* symbols of `object`.
|
|
2058
|
+
*
|
|
2059
|
+
* @private
|
|
2060
|
+
* @param {Object} object The object to query.
|
|
2061
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
2062
|
+
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
2063
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2064
|
+
*/
|
|
2065
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
2066
|
+
var result = keysFunc(object);
|
|
2067
|
+
return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
/**
|
|
2071
|
+
* Creates an array of own enumerable property names and symbols of `object`.
|
|
2072
|
+
*
|
|
2073
|
+
* @private
|
|
2074
|
+
* @param {Object} object The object to query.
|
|
2075
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2076
|
+
*/
|
|
2077
|
+
function getAllKeys(object) {
|
|
2078
|
+
return baseGetAllKeys(object, keys, getSymbols$1);
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/* Built-in method references that are verified to be native. */
|
|
2082
|
+
var DataView = getNative(root$1, 'DataView');
|
|
2083
|
+
|
|
2084
|
+
var DataView$1 = DataView;
|
|
2085
|
+
|
|
2086
|
+
/* Built-in method references that are verified to be native. */
|
|
2087
|
+
var Promise$1 = getNative(root$1, 'Promise');
|
|
2088
|
+
|
|
2089
|
+
var Promise$2 = Promise$1;
|
|
2090
|
+
|
|
2091
|
+
/* Built-in method references that are verified to be native. */
|
|
2092
|
+
var Set$1 = getNative(root$1, 'Set');
|
|
2093
|
+
|
|
2094
|
+
var Set$2 = Set$1;
|
|
2095
|
+
|
|
2096
|
+
/** `Object#toString` result references. */
|
|
2097
|
+
var mapTag$1 = '[object Map]',
|
|
2098
|
+
objectTag$1 = '[object Object]',
|
|
2099
|
+
promiseTag = '[object Promise]',
|
|
2100
|
+
setTag$1 = '[object Set]',
|
|
2101
|
+
weakMapTag = '[object WeakMap]';
|
|
2102
|
+
|
|
2103
|
+
var dataViewTag$1 = '[object DataView]';
|
|
2104
|
+
|
|
2105
|
+
/** Used to detect maps, sets, and weakmaps. */
|
|
2106
|
+
var dataViewCtorString = toSource(DataView$1),
|
|
2107
|
+
mapCtorString = toSource(Map$1),
|
|
2108
|
+
promiseCtorString = toSource(Promise$2),
|
|
2109
|
+
setCtorString = toSource(Set$2),
|
|
2110
|
+
weakMapCtorString = toSource(WeakMap$1);
|
|
2111
|
+
|
|
2112
|
+
/**
|
|
2113
|
+
* Gets the `toStringTag` of `value`.
|
|
2114
|
+
*
|
|
2115
|
+
* @private
|
|
2116
|
+
* @param {*} value The value to query.
|
|
2117
|
+
* @returns {string} Returns the `toStringTag`.
|
|
2118
|
+
*/
|
|
2119
|
+
var getTag = baseGetTag;
|
|
2120
|
+
|
|
2121
|
+
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
2122
|
+
if ((DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$1) ||
|
|
2123
|
+
(Map$1 && getTag(new Map$1) != mapTag$1) ||
|
|
2124
|
+
(Promise$2 && getTag(Promise$2.resolve()) != promiseTag) ||
|
|
2125
|
+
(Set$2 && getTag(new Set$2) != setTag$1) ||
|
|
2126
|
+
(WeakMap$1 && getTag(new WeakMap$1) != weakMapTag)) {
|
|
2127
|
+
getTag = function(value) {
|
|
2128
|
+
var result = baseGetTag(value),
|
|
2129
|
+
Ctor = result == objectTag$1 ? value.constructor : undefined,
|
|
2130
|
+
ctorString = Ctor ? toSource(Ctor) : '';
|
|
2131
|
+
|
|
2132
|
+
if (ctorString) {
|
|
2133
|
+
switch (ctorString) {
|
|
2134
|
+
case dataViewCtorString: return dataViewTag$1;
|
|
2135
|
+
case mapCtorString: return mapTag$1;
|
|
2136
|
+
case promiseCtorString: return promiseTag;
|
|
2137
|
+
case setCtorString: return setTag$1;
|
|
2138
|
+
case weakMapCtorString: return weakMapTag;
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
return result;
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
var getTag$1 = getTag;
|
|
2146
|
+
|
|
2147
|
+
/** Built-in value references. */
|
|
2148
|
+
var Uint8Array = root$1.Uint8Array;
|
|
2149
|
+
|
|
2150
|
+
var Uint8Array$1 = Uint8Array;
|
|
2151
|
+
|
|
2152
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
2153
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
2154
|
+
|
|
2155
|
+
/**
|
|
2156
|
+
* Adds `value` to the array cache.
|
|
2157
|
+
*
|
|
2158
|
+
* @private
|
|
2159
|
+
* @name add
|
|
2160
|
+
* @memberOf SetCache
|
|
2161
|
+
* @alias push
|
|
2162
|
+
* @param {*} value The value to cache.
|
|
2163
|
+
* @returns {Object} Returns the cache instance.
|
|
2164
|
+
*/
|
|
2165
|
+
function setCacheAdd(value) {
|
|
2166
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
2167
|
+
return this;
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
/**
|
|
2171
|
+
* Checks if `value` is in the array cache.
|
|
2172
|
+
*
|
|
2173
|
+
* @private
|
|
2174
|
+
* @name has
|
|
2175
|
+
* @memberOf SetCache
|
|
2176
|
+
* @param {*} value The value to search for.
|
|
2177
|
+
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
2178
|
+
*/
|
|
2179
|
+
function setCacheHas(value) {
|
|
2180
|
+
return this.__data__.has(value);
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
/**
|
|
2184
|
+
*
|
|
2185
|
+
* Creates an array cache object to store unique values.
|
|
2186
|
+
*
|
|
2187
|
+
* @private
|
|
2188
|
+
* @constructor
|
|
2189
|
+
* @param {Array} [values] The values to cache.
|
|
2190
|
+
*/
|
|
2191
|
+
function SetCache(values) {
|
|
2192
|
+
var index = -1,
|
|
2193
|
+
length = values == null ? 0 : values.length;
|
|
2194
|
+
|
|
2195
|
+
this.__data__ = new MapCache;
|
|
2196
|
+
while (++index < length) {
|
|
2197
|
+
this.add(values[index]);
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
// Add methods to `SetCache`.
|
|
2202
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
2203
|
+
SetCache.prototype.has = setCacheHas;
|
|
2204
|
+
|
|
2205
|
+
/**
|
|
2206
|
+
* A specialized version of `_.some` for arrays without support for iteratee
|
|
2207
|
+
* shorthands.
|
|
2208
|
+
*
|
|
2209
|
+
* @private
|
|
2210
|
+
* @param {Array} [array] The array to iterate over.
|
|
2211
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
2212
|
+
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
2213
|
+
* else `false`.
|
|
2214
|
+
*/
|
|
2215
|
+
function arraySome(array, predicate) {
|
|
2216
|
+
var index = -1,
|
|
2217
|
+
length = array == null ? 0 : array.length;
|
|
2218
|
+
|
|
2219
|
+
while (++index < length) {
|
|
2220
|
+
if (predicate(array[index], index, array)) {
|
|
2221
|
+
return true;
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
return false;
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* Checks if a `cache` value for `key` exists.
|
|
2229
|
+
*
|
|
2230
|
+
* @private
|
|
2231
|
+
* @param {Object} cache The cache to query.
|
|
2232
|
+
* @param {string} key The key of the entry to check.
|
|
2233
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
2234
|
+
*/
|
|
2235
|
+
function cacheHas(cache, key) {
|
|
2236
|
+
return cache.has(key);
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2240
|
+
var COMPARE_PARTIAL_FLAG$3 = 1,
|
|
2241
|
+
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
2242
|
+
|
|
2243
|
+
/**
|
|
2244
|
+
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
2245
|
+
* partial deep comparisons.
|
|
2246
|
+
*
|
|
2247
|
+
* @private
|
|
2248
|
+
* @param {Array} array The array to compare.
|
|
2249
|
+
* @param {Array} other The other array to compare.
|
|
2250
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2251
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2252
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2253
|
+
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
2254
|
+
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
2255
|
+
*/
|
|
2256
|
+
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
2257
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
2258
|
+
arrLength = array.length,
|
|
2259
|
+
othLength = other.length;
|
|
2260
|
+
|
|
2261
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
2262
|
+
return false;
|
|
2263
|
+
}
|
|
2264
|
+
// Check that cyclic values are equal.
|
|
2265
|
+
var arrStacked = stack.get(array);
|
|
2266
|
+
var othStacked = stack.get(other);
|
|
2267
|
+
if (arrStacked && othStacked) {
|
|
2268
|
+
return arrStacked == other && othStacked == array;
|
|
2269
|
+
}
|
|
2270
|
+
var index = -1,
|
|
2271
|
+
result = true,
|
|
2272
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined;
|
|
2273
|
+
|
|
2274
|
+
stack.set(array, other);
|
|
2275
|
+
stack.set(other, array);
|
|
2276
|
+
|
|
2277
|
+
// Ignore non-index properties.
|
|
2278
|
+
while (++index < arrLength) {
|
|
2279
|
+
var arrValue = array[index],
|
|
2280
|
+
othValue = other[index];
|
|
2281
|
+
|
|
2282
|
+
if (customizer) {
|
|
2283
|
+
var compared = isPartial
|
|
2284
|
+
? customizer(othValue, arrValue, index, other, array, stack)
|
|
2285
|
+
: customizer(arrValue, othValue, index, array, other, stack);
|
|
2286
|
+
}
|
|
2287
|
+
if (compared !== undefined) {
|
|
2288
|
+
if (compared) {
|
|
2289
|
+
continue;
|
|
2290
|
+
}
|
|
2291
|
+
result = false;
|
|
2292
|
+
break;
|
|
2293
|
+
}
|
|
2294
|
+
// Recursively compare arrays (susceptible to call stack limits).
|
|
2295
|
+
if (seen) {
|
|
2296
|
+
if (!arraySome(other, function(othValue, othIndex) {
|
|
2297
|
+
if (!cacheHas(seen, othIndex) &&
|
|
2298
|
+
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
2299
|
+
return seen.push(othIndex);
|
|
2300
|
+
}
|
|
2301
|
+
})) {
|
|
2302
|
+
result = false;
|
|
2303
|
+
break;
|
|
2304
|
+
}
|
|
2305
|
+
} else if (!(
|
|
2306
|
+
arrValue === othValue ||
|
|
2307
|
+
equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
|
2308
|
+
)) {
|
|
2309
|
+
result = false;
|
|
2310
|
+
break;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
stack['delete'](array);
|
|
2314
|
+
stack['delete'](other);
|
|
2315
|
+
return result;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* Converts `map` to its key-value pairs.
|
|
2320
|
+
*
|
|
2321
|
+
* @private
|
|
2322
|
+
* @param {Object} map The map to convert.
|
|
2323
|
+
* @returns {Array} Returns the key-value pairs.
|
|
2324
|
+
*/
|
|
2325
|
+
function mapToArray(map) {
|
|
2326
|
+
var index = -1,
|
|
2327
|
+
result = Array(map.size);
|
|
2328
|
+
|
|
2329
|
+
map.forEach(function(value, key) {
|
|
2330
|
+
result[++index] = [key, value];
|
|
2331
|
+
});
|
|
2332
|
+
return result;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
/**
|
|
2336
|
+
* Converts `set` to an array of its values.
|
|
2337
|
+
*
|
|
2338
|
+
* @private
|
|
2339
|
+
* @param {Object} set The set to convert.
|
|
2340
|
+
* @returns {Array} Returns the values.
|
|
2341
|
+
*/
|
|
2342
|
+
function setToArray(set) {
|
|
2343
|
+
var index = -1,
|
|
2344
|
+
result = Array(set.size);
|
|
2345
|
+
|
|
2346
|
+
set.forEach(function(value) {
|
|
2347
|
+
result[++index] = value;
|
|
2348
|
+
});
|
|
2349
|
+
return result;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2353
|
+
var COMPARE_PARTIAL_FLAG$2 = 1,
|
|
2354
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
2355
|
+
|
|
2356
|
+
/** `Object#toString` result references. */
|
|
2357
|
+
var boolTag = '[object Boolean]',
|
|
2358
|
+
dateTag = '[object Date]',
|
|
2359
|
+
errorTag = '[object Error]',
|
|
2360
|
+
mapTag = '[object Map]',
|
|
2361
|
+
numberTag = '[object Number]',
|
|
2362
|
+
regexpTag = '[object RegExp]',
|
|
2363
|
+
setTag = '[object Set]',
|
|
2364
|
+
stringTag = '[object String]',
|
|
2365
|
+
symbolTag = '[object Symbol]';
|
|
2366
|
+
|
|
2367
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
2368
|
+
dataViewTag = '[object DataView]';
|
|
2369
|
+
|
|
2370
|
+
/** Used to convert symbols to primitives and strings. */
|
|
2371
|
+
var symbolProto = Symbol$2 ? Symbol$2.prototype : undefined,
|
|
2372
|
+
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
2373
|
+
|
|
2374
|
+
/**
|
|
2375
|
+
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
2376
|
+
* the same `toStringTag`.
|
|
2377
|
+
*
|
|
2378
|
+
* **Note:** This function only supports comparing values with tags of
|
|
2379
|
+
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
|
2380
|
+
*
|
|
2381
|
+
* @private
|
|
2382
|
+
* @param {Object} object The object to compare.
|
|
2383
|
+
* @param {Object} other The other object to compare.
|
|
2384
|
+
* @param {string} tag The `toStringTag` of the objects to compare.
|
|
2385
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2386
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2387
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2388
|
+
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
2389
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2390
|
+
*/
|
|
2391
|
+
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
2392
|
+
switch (tag) {
|
|
2393
|
+
case dataViewTag:
|
|
2394
|
+
if ((object.byteLength != other.byteLength) ||
|
|
2395
|
+
(object.byteOffset != other.byteOffset)) {
|
|
2396
|
+
return false;
|
|
2397
|
+
}
|
|
2398
|
+
object = object.buffer;
|
|
2399
|
+
other = other.buffer;
|
|
2400
|
+
|
|
2401
|
+
case arrayBufferTag:
|
|
2402
|
+
if ((object.byteLength != other.byteLength) ||
|
|
2403
|
+
!equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
|
|
2404
|
+
return false;
|
|
2405
|
+
}
|
|
2406
|
+
return true;
|
|
2407
|
+
|
|
2408
|
+
case boolTag:
|
|
2409
|
+
case dateTag:
|
|
2410
|
+
case numberTag:
|
|
2411
|
+
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
|
2412
|
+
// Invalid dates are coerced to `NaN`.
|
|
2413
|
+
return eq(+object, +other);
|
|
2414
|
+
|
|
2415
|
+
case errorTag:
|
|
2416
|
+
return object.name == other.name && object.message == other.message;
|
|
2417
|
+
|
|
2418
|
+
case regexpTag:
|
|
2419
|
+
case stringTag:
|
|
2420
|
+
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
2421
|
+
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
2422
|
+
// for more details.
|
|
2423
|
+
return object == (other + '');
|
|
2424
|
+
|
|
2425
|
+
case mapTag:
|
|
2426
|
+
var convert = mapToArray;
|
|
2427
|
+
|
|
2428
|
+
case setTag:
|
|
2429
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
|
|
2430
|
+
convert || (convert = setToArray);
|
|
2431
|
+
|
|
2432
|
+
if (object.size != other.size && !isPartial) {
|
|
2433
|
+
return false;
|
|
2434
|
+
}
|
|
2435
|
+
// Assume cyclic values are equal.
|
|
2436
|
+
var stacked = stack.get(object);
|
|
2437
|
+
if (stacked) {
|
|
2438
|
+
return stacked == other;
|
|
2439
|
+
}
|
|
2440
|
+
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
2441
|
+
|
|
2442
|
+
// Recursively compare objects (susceptible to call stack limits).
|
|
2443
|
+
stack.set(object, other);
|
|
2444
|
+
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
2445
|
+
stack['delete'](object);
|
|
2446
|
+
return result;
|
|
2447
|
+
|
|
2448
|
+
case symbolTag:
|
|
2449
|
+
if (symbolValueOf) {
|
|
2450
|
+
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
return false;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2457
|
+
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
2458
|
+
|
|
2459
|
+
/** Used for built-in method references. */
|
|
2460
|
+
var objectProto$1 = Object.prototype;
|
|
2461
|
+
|
|
2462
|
+
/** Used to check objects for own properties. */
|
|
2463
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
2464
|
+
|
|
2465
|
+
/**
|
|
2466
|
+
* A specialized version of `baseIsEqualDeep` for objects with support for
|
|
2467
|
+
* partial deep comparisons.
|
|
2468
|
+
*
|
|
2469
|
+
* @private
|
|
2470
|
+
* @param {Object} object The object to compare.
|
|
2471
|
+
* @param {Object} other The other object to compare.
|
|
2472
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2473
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2474
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2475
|
+
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
2476
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2477
|
+
*/
|
|
2478
|
+
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
2479
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
|
|
2480
|
+
objProps = getAllKeys(object),
|
|
2481
|
+
objLength = objProps.length,
|
|
2482
|
+
othProps = getAllKeys(other),
|
|
2483
|
+
othLength = othProps.length;
|
|
2484
|
+
|
|
2485
|
+
if (objLength != othLength && !isPartial) {
|
|
2486
|
+
return false;
|
|
2487
|
+
}
|
|
2488
|
+
var index = objLength;
|
|
2489
|
+
while (index--) {
|
|
2490
|
+
var key = objProps[index];
|
|
2491
|
+
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
2492
|
+
return false;
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
// Check that cyclic values are equal.
|
|
2496
|
+
var objStacked = stack.get(object);
|
|
2497
|
+
var othStacked = stack.get(other);
|
|
2498
|
+
if (objStacked && othStacked) {
|
|
2499
|
+
return objStacked == other && othStacked == object;
|
|
2500
|
+
}
|
|
2501
|
+
var result = true;
|
|
2502
|
+
stack.set(object, other);
|
|
2503
|
+
stack.set(other, object);
|
|
2504
|
+
|
|
2505
|
+
var skipCtor = isPartial;
|
|
2506
|
+
while (++index < objLength) {
|
|
2507
|
+
key = objProps[index];
|
|
2508
|
+
var objValue = object[key],
|
|
2509
|
+
othValue = other[key];
|
|
2510
|
+
|
|
2511
|
+
if (customizer) {
|
|
2512
|
+
var compared = isPartial
|
|
2513
|
+
? customizer(othValue, objValue, key, other, object, stack)
|
|
2514
|
+
: customizer(objValue, othValue, key, object, other, stack);
|
|
2515
|
+
}
|
|
2516
|
+
// Recursively compare objects (susceptible to call stack limits).
|
|
2517
|
+
if (!(compared === undefined
|
|
2518
|
+
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
|
2519
|
+
: compared
|
|
2520
|
+
)) {
|
|
2521
|
+
result = false;
|
|
2522
|
+
break;
|
|
2523
|
+
}
|
|
2524
|
+
skipCtor || (skipCtor = key == 'constructor');
|
|
2525
|
+
}
|
|
2526
|
+
if (result && !skipCtor) {
|
|
2527
|
+
var objCtor = object.constructor,
|
|
2528
|
+
othCtor = other.constructor;
|
|
2529
|
+
|
|
2530
|
+
// Non `Object` object instances with different constructors are not equal.
|
|
2531
|
+
if (objCtor != othCtor &&
|
|
2532
|
+
('constructor' in object && 'constructor' in other) &&
|
|
2533
|
+
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
|
2534
|
+
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
|
2535
|
+
result = false;
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
stack['delete'](object);
|
|
2539
|
+
stack['delete'](other);
|
|
2540
|
+
return result;
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2544
|
+
var COMPARE_PARTIAL_FLAG = 1;
|
|
2545
|
+
|
|
2546
|
+
/** `Object#toString` result references. */
|
|
2547
|
+
var argsTag = '[object Arguments]',
|
|
2548
|
+
arrayTag = '[object Array]',
|
|
2549
|
+
objectTag = '[object Object]';
|
|
2550
|
+
|
|
2551
|
+
/** Used for built-in method references. */
|
|
2552
|
+
var objectProto = Object.prototype;
|
|
2553
|
+
|
|
2554
|
+
/** Used to check objects for own properties. */
|
|
2555
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
2556
|
+
|
|
2557
|
+
/**
|
|
2558
|
+
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
|
2559
|
+
* deep comparisons and tracks traversed objects enabling objects with circular
|
|
2560
|
+
* references to be compared.
|
|
2561
|
+
*
|
|
2562
|
+
* @private
|
|
2563
|
+
* @param {Object} object The object to compare.
|
|
2564
|
+
* @param {Object} other The other object to compare.
|
|
2565
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2566
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2567
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2568
|
+
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
2569
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2570
|
+
*/
|
|
2571
|
+
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
2572
|
+
var objIsArr = isArray$1(object),
|
|
2573
|
+
othIsArr = isArray$1(other),
|
|
2574
|
+
objTag = objIsArr ? arrayTag : getTag$1(object),
|
|
2575
|
+
othTag = othIsArr ? arrayTag : getTag$1(other);
|
|
2576
|
+
|
|
2577
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
2578
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
2579
|
+
|
|
2580
|
+
var objIsObj = objTag == objectTag,
|
|
2581
|
+
othIsObj = othTag == objectTag,
|
|
2582
|
+
isSameTag = objTag == othTag;
|
|
2583
|
+
|
|
2584
|
+
if (isSameTag && isBuffer$1(object)) {
|
|
2585
|
+
if (!isBuffer$1(other)) {
|
|
2586
|
+
return false;
|
|
2587
|
+
}
|
|
2588
|
+
objIsArr = true;
|
|
2589
|
+
objIsObj = false;
|
|
2590
|
+
}
|
|
2591
|
+
if (isSameTag && !objIsObj) {
|
|
2592
|
+
stack || (stack = new Stack);
|
|
2593
|
+
return (objIsArr || isTypedArray$1(object))
|
|
2594
|
+
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
2595
|
+
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
2596
|
+
}
|
|
2597
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
2598
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
|
2599
|
+
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
2600
|
+
|
|
2601
|
+
if (objIsWrapped || othIsWrapped) {
|
|
2602
|
+
var objUnwrapped = objIsWrapped ? object.value() : object,
|
|
2603
|
+
othUnwrapped = othIsWrapped ? other.value() : other;
|
|
2604
|
+
|
|
2605
|
+
stack || (stack = new Stack);
|
|
2606
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
if (!isSameTag) {
|
|
2610
|
+
return false;
|
|
2611
|
+
}
|
|
2612
|
+
stack || (stack = new Stack);
|
|
2613
|
+
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
/**
|
|
2617
|
+
* The base implementation of `_.isEqual` which supports partial comparisons
|
|
2618
|
+
* and tracks traversed objects.
|
|
2619
|
+
*
|
|
2620
|
+
* @private
|
|
2621
|
+
* @param {*} value The value to compare.
|
|
2622
|
+
* @param {*} other The other value to compare.
|
|
2623
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
2624
|
+
* 1 - Unordered comparison
|
|
2625
|
+
* 2 - Partial comparison
|
|
2626
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
2627
|
+
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
2628
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
2629
|
+
*/
|
|
2630
|
+
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
2631
|
+
if (value === other) {
|
|
2632
|
+
return true;
|
|
2633
|
+
}
|
|
2634
|
+
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
|
2635
|
+
return value !== value && other !== other;
|
|
2636
|
+
}
|
|
2637
|
+
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* The base implementation of `_.hasIn` without support for deep paths.
|
|
2642
|
+
*
|
|
2643
|
+
* @private
|
|
2644
|
+
* @param {Object} [object] The object to query.
|
|
2645
|
+
* @param {Array|string} key The key to check.
|
|
2646
|
+
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
2647
|
+
*/
|
|
2648
|
+
function baseHasIn(object, key) {
|
|
2649
|
+
return object != null && key in Object(object);
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2652
|
+
/**
|
|
2653
|
+
* Checks if `path` exists on `object`.
|
|
2654
|
+
*
|
|
2655
|
+
* @private
|
|
2656
|
+
* @param {Object} object The object to query.
|
|
2657
|
+
* @param {Array|string} path The path to check.
|
|
2658
|
+
* @param {Function} hasFunc The function to check properties.
|
|
2659
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
2660
|
+
*/
|
|
2661
|
+
function hasPath(object, path, hasFunc) {
|
|
2662
|
+
path = castPath(path, object);
|
|
2663
|
+
|
|
2664
|
+
var index = -1,
|
|
2665
|
+
length = path.length,
|
|
2666
|
+
result = false;
|
|
2667
|
+
|
|
2668
|
+
while (++index < length) {
|
|
2669
|
+
var key = toKey(path[index]);
|
|
2670
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
2671
|
+
break;
|
|
2672
|
+
}
|
|
2673
|
+
object = object[key];
|
|
2674
|
+
}
|
|
2675
|
+
if (result || ++index != length) {
|
|
2676
|
+
return result;
|
|
2677
|
+
}
|
|
2678
|
+
length = object == null ? 0 : object.length;
|
|
2679
|
+
return !!length && isLength(length) && isIndex(key, length) &&
|
|
2680
|
+
(isArray$1(object) || isArguments$1(object));
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
/**
|
|
2684
|
+
* Checks if `path` is a direct or inherited property of `object`.
|
|
2685
|
+
*
|
|
2686
|
+
* @static
|
|
2687
|
+
* @memberOf _
|
|
2688
|
+
* @since 4.0.0
|
|
2689
|
+
* @category Object
|
|
2690
|
+
* @param {Object} object The object to query.
|
|
2691
|
+
* @param {Array|string} path The path to check.
|
|
2692
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
2693
|
+
* @example
|
|
2694
|
+
*
|
|
2695
|
+
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
2696
|
+
*
|
|
2697
|
+
* _.hasIn(object, 'a');
|
|
2698
|
+
* // => true
|
|
2699
|
+
*
|
|
2700
|
+
* _.hasIn(object, 'a.b');
|
|
2701
|
+
* // => true
|
|
2702
|
+
*
|
|
2703
|
+
* _.hasIn(object, ['a', 'b']);
|
|
2704
|
+
* // => true
|
|
2705
|
+
*
|
|
2706
|
+
* _.hasIn(object, 'b');
|
|
2707
|
+
* // => false
|
|
2708
|
+
*/
|
|
2709
|
+
function hasIn(object, path) {
|
|
2710
|
+
return object != null && hasPath(object, path, baseHasIn);
|
|
2711
|
+
}
|
|
2712
|
+
|
|
2713
|
+
/**
|
|
2714
|
+
* The inverse of `_.toPairs`; this method returns an object composed
|
|
2715
|
+
* from key-value `pairs`.
|
|
2716
|
+
*
|
|
2717
|
+
* @static
|
|
2718
|
+
* @memberOf _
|
|
2719
|
+
* @since 4.0.0
|
|
2720
|
+
* @category Array
|
|
2721
|
+
* @param {Array} pairs The key-value pairs.
|
|
2722
|
+
* @returns {Object} Returns the new object.
|
|
2723
|
+
* @example
|
|
2724
|
+
*
|
|
2725
|
+
* _.fromPairs([['a', 1], ['b', 2]]);
|
|
2726
|
+
* // => { 'a': 1, 'b': 2 }
|
|
2727
|
+
*/
|
|
2728
|
+
function fromPairs(pairs) {
|
|
2729
|
+
var index = -1,
|
|
2730
|
+
length = pairs == null ? 0 : pairs.length,
|
|
2731
|
+
result = {};
|
|
2732
|
+
|
|
2733
|
+
while (++index < length) {
|
|
2734
|
+
var pair = pairs[index];
|
|
2735
|
+
result[pair[0]] = pair[1];
|
|
2736
|
+
}
|
|
2737
|
+
return result;
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
/**
|
|
2741
|
+
* Performs a deep comparison between two values to determine if they are
|
|
2742
|
+
* equivalent.
|
|
2743
|
+
*
|
|
2744
|
+
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
2745
|
+
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
2746
|
+
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
2747
|
+
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
2748
|
+
* nodes are compared by strict equality, i.e. `===`.
|
|
2749
|
+
*
|
|
2750
|
+
* @static
|
|
2751
|
+
* @memberOf _
|
|
2752
|
+
* @since 0.1.0
|
|
2753
|
+
* @category Lang
|
|
2754
|
+
* @param {*} value The value to compare.
|
|
2755
|
+
* @param {*} other The other value to compare.
|
|
2756
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
2757
|
+
* @example
|
|
2758
|
+
*
|
|
2759
|
+
* var object = { 'a': 1 };
|
|
2760
|
+
* var other = { 'a': 1 };
|
|
2761
|
+
*
|
|
2762
|
+
* _.isEqual(object, other);
|
|
2763
|
+
* // => true
|
|
2764
|
+
*
|
|
2765
|
+
* object === other;
|
|
2766
|
+
* // => false
|
|
2767
|
+
*/
|
|
2768
|
+
function isEqual(value, other) {
|
|
2769
|
+
return baseIsEqual(value, other);
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
/**
|
|
2773
|
+
* The base implementation of `_.set`.
|
|
2774
|
+
*
|
|
2775
|
+
* @private
|
|
2776
|
+
* @param {Object} object The object to modify.
|
|
2777
|
+
* @param {Array|string} path The path of the property to set.
|
|
2778
|
+
* @param {*} value The value to set.
|
|
2779
|
+
* @param {Function} [customizer] The function to customize path creation.
|
|
2780
|
+
* @returns {Object} Returns `object`.
|
|
2781
|
+
*/
|
|
2782
|
+
function baseSet(object, path, value, customizer) {
|
|
2783
|
+
if (!isObject(object)) {
|
|
2784
|
+
return object;
|
|
2785
|
+
}
|
|
2786
|
+
path = castPath(path, object);
|
|
2787
|
+
|
|
2788
|
+
var index = -1,
|
|
2789
|
+
length = path.length,
|
|
2790
|
+
lastIndex = length - 1,
|
|
2791
|
+
nested = object;
|
|
2792
|
+
|
|
2793
|
+
while (nested != null && ++index < length) {
|
|
2794
|
+
var key = toKey(path[index]),
|
|
2795
|
+
newValue = value;
|
|
2796
|
+
|
|
2797
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
2798
|
+
return object;
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
if (index != lastIndex) {
|
|
2802
|
+
var objValue = nested[key];
|
|
2803
|
+
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
2804
|
+
if (newValue === undefined) {
|
|
2805
|
+
newValue = isObject(objValue)
|
|
2806
|
+
? objValue
|
|
2807
|
+
: (isIndex(path[index + 1]) ? [] : {});
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
assignValue(nested, key, newValue);
|
|
2811
|
+
nested = nested[key];
|
|
2812
|
+
}
|
|
2813
|
+
return object;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
/**
|
|
2817
|
+
* The base implementation of `_.pickBy` without support for iteratee shorthands.
|
|
2818
|
+
*
|
|
2819
|
+
* @private
|
|
2820
|
+
* @param {Object} object The source object.
|
|
2821
|
+
* @param {string[]} paths The property paths to pick.
|
|
2822
|
+
* @param {Function} predicate The function invoked per property.
|
|
2823
|
+
* @returns {Object} Returns the new object.
|
|
2824
|
+
*/
|
|
2825
|
+
function basePickBy(object, paths, predicate) {
|
|
2826
|
+
var index = -1,
|
|
2827
|
+
length = paths.length,
|
|
2828
|
+
result = {};
|
|
2829
|
+
|
|
2830
|
+
while (++index < length) {
|
|
2831
|
+
var path = paths[index],
|
|
2832
|
+
value = baseGet(object, path);
|
|
2833
|
+
|
|
2834
|
+
if (predicate(value, path)) {
|
|
2835
|
+
baseSet(result, castPath(path, object), value);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return result;
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* The base implementation of `_.pick` without support for individual
|
|
2843
|
+
* property identifiers.
|
|
2844
|
+
*
|
|
2845
|
+
* @private
|
|
2846
|
+
* @param {Object} object The source object.
|
|
2847
|
+
* @param {string[]} paths The property paths to pick.
|
|
2848
|
+
* @returns {Object} Returns the new object.
|
|
2849
|
+
*/
|
|
2850
|
+
function basePick(object, paths) {
|
|
2851
|
+
return basePickBy(object, paths, function(value, path) {
|
|
2852
|
+
return hasIn(object, path);
|
|
2853
|
+
});
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
/**
|
|
2857
|
+
* Creates an object composed of the picked `object` properties.
|
|
2858
|
+
*
|
|
2859
|
+
* @static
|
|
2860
|
+
* @since 0.1.0
|
|
2861
|
+
* @memberOf _
|
|
2862
|
+
* @category Object
|
|
2863
|
+
* @param {Object} object The source object.
|
|
2864
|
+
* @param {...(string|string[])} [paths] The property paths to pick.
|
|
2865
|
+
* @returns {Object} Returns the new object.
|
|
2866
|
+
* @example
|
|
2867
|
+
*
|
|
2868
|
+
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
2869
|
+
*
|
|
2870
|
+
* _.pick(object, ['a', 'c']);
|
|
2871
|
+
* // => { 'a': 1, 'c': 3 }
|
|
2872
|
+
*/
|
|
2873
|
+
var pick = flatRest(function(object, paths) {
|
|
2874
|
+
return object == null ? {} : basePick(object, paths);
|
|
2875
|
+
});
|
|
2876
|
+
|
|
2877
|
+
var pick$1 = pick;
|
|
2878
|
+
|
|
2879
|
+
const isUndefined = (val) => val === void 0;
|
|
2880
|
+
const isBoolean = (val) => typeof val === "boolean";
|
|
2881
|
+
const isNumber = (val) => typeof val === "number";
|
|
2882
|
+
|
|
2883
|
+
class ElementPlusError extends Error {
|
|
2884
|
+
constructor(m) {
|
|
2885
|
+
super(m);
|
|
2886
|
+
this.name = "ElementPlusError";
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
function debugWarn(scope, message) {
|
|
2890
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2891
|
+
const error = isString(scope) ? new ElementPlusError(`[${scope}] ${message}`) : scope;
|
|
2892
|
+
console.warn(error);
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
const epPropKey = "__epPropKey";
|
|
2897
|
+
const definePropType = (val) => val;
|
|
2898
|
+
const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
|
|
2899
|
+
const buildProp = (prop, key) => {
|
|
2900
|
+
if (!isObject$1(prop) || isEpProp(prop))
|
|
2901
|
+
return prop;
|
|
2902
|
+
const { values, required, default: defaultValue, type, validator } = prop;
|
|
2903
|
+
const _validator = values || validator ? (val) => {
|
|
2904
|
+
let valid = false;
|
|
2905
|
+
let allowedValues = [];
|
|
2906
|
+
if (values) {
|
|
2907
|
+
allowedValues = Array.from(values);
|
|
2908
|
+
if (hasOwn(prop, "default")) {
|
|
2909
|
+
allowedValues.push(defaultValue);
|
|
2910
|
+
}
|
|
2911
|
+
valid || (valid = allowedValues.includes(val));
|
|
2912
|
+
}
|
|
2913
|
+
if (validator)
|
|
2914
|
+
valid || (valid = validator(val));
|
|
2915
|
+
if (!valid && allowedValues.length > 0) {
|
|
2916
|
+
const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
|
|
2917
|
+
warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
|
|
2918
|
+
}
|
|
2919
|
+
return valid;
|
|
2920
|
+
} : void 0;
|
|
2921
|
+
const epProp = {
|
|
2922
|
+
type,
|
|
2923
|
+
required: !!required,
|
|
2924
|
+
validator: _validator,
|
|
2925
|
+
[epPropKey]: true
|
|
2926
|
+
};
|
|
2927
|
+
if (hasOwn(prop, "default"))
|
|
2928
|
+
epProp.default = defaultValue;
|
|
2929
|
+
return epProp;
|
|
2930
|
+
};
|
|
2931
|
+
const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
|
|
2932
|
+
key,
|
|
2933
|
+
buildProp(option, key)
|
|
2934
|
+
]));
|
|
2935
|
+
|
|
2936
|
+
const withInstall = (main, extra) => {
|
|
2937
|
+
main.install = (app) => {
|
|
2938
|
+
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
2939
|
+
app.component(comp.name, comp);
|
|
2940
|
+
}
|
|
2941
|
+
};
|
|
2942
|
+
if (extra) {
|
|
2943
|
+
for (const [key, comp] of Object.entries(extra)) {
|
|
2944
|
+
main[key] = comp;
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
return main;
|
|
2948
|
+
};
|
|
2949
|
+
const withNoopInstall = (component) => {
|
|
2950
|
+
component.install = NOOP;
|
|
2951
|
+
return component;
|
|
2952
|
+
};
|
|
2953
|
+
|
|
2954
|
+
const UPDATE_MODEL_EVENT = "update:modelValue";
|
|
2955
|
+
|
|
2956
|
+
const componentSizes = ["", "default", "small", "large"];
|
|
2957
|
+
|
|
2958
|
+
const defaultNamespace = "el";
|
|
2959
|
+
const statePrefix = "is-";
|
|
2960
|
+
const _bem = (namespace, block, blockSuffix, element, modifier) => {
|
|
2961
|
+
let cls = `${namespace}-${block}`;
|
|
2962
|
+
if (blockSuffix) {
|
|
2963
|
+
cls += `-${blockSuffix}`;
|
|
2964
|
+
}
|
|
2965
|
+
if (element) {
|
|
2966
|
+
cls += `__${element}`;
|
|
2967
|
+
}
|
|
2968
|
+
if (modifier) {
|
|
2969
|
+
cls += `--${modifier}`;
|
|
2970
|
+
}
|
|
2971
|
+
return cls;
|
|
2972
|
+
};
|
|
2973
|
+
const namespaceContextKey = Symbol("namespaceContextKey");
|
|
2974
|
+
const useGetDerivedNamespace = (namespaceOverrides) => {
|
|
2975
|
+
const derivedNamespace = namespaceOverrides || inject(namespaceContextKey, ref(defaultNamespace));
|
|
2976
|
+
const namespace = computed(() => {
|
|
2977
|
+
return unref(derivedNamespace) || defaultNamespace;
|
|
2978
|
+
});
|
|
2979
|
+
return namespace;
|
|
2980
|
+
};
|
|
2981
|
+
const useNamespace = (block, namespaceOverrides) => {
|
|
2982
|
+
const namespace = useGetDerivedNamespace(namespaceOverrides);
|
|
2983
|
+
const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
|
|
2984
|
+
const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
|
|
2985
|
+
const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
|
|
2986
|
+
const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
|
|
2987
|
+
const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
|
|
2988
|
+
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
|
|
2989
|
+
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
|
|
2990
|
+
const is = (name, ...args) => {
|
|
2991
|
+
const state = args.length >= 1 ? args[0] : true;
|
|
2992
|
+
return name && state ? `${statePrefix}${name}` : "";
|
|
2993
|
+
};
|
|
2994
|
+
const cssVar = (object) => {
|
|
2995
|
+
const styles = {};
|
|
2996
|
+
for (const key in object) {
|
|
2997
|
+
if (object[key]) {
|
|
2998
|
+
styles[`--${namespace.value}-${key}`] = object[key];
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
return styles;
|
|
3002
|
+
};
|
|
3003
|
+
const cssVarBlock = (object) => {
|
|
3004
|
+
const styles = {};
|
|
3005
|
+
for (const key in object) {
|
|
3006
|
+
if (object[key]) {
|
|
3007
|
+
styles[`--${namespace.value}-${block}-${key}`] = object[key];
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
return styles;
|
|
3011
|
+
};
|
|
3012
|
+
const cssVarName = (name) => `--${namespace.value}-${name}`;
|
|
3013
|
+
const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
|
|
3014
|
+
return {
|
|
3015
|
+
namespace,
|
|
3016
|
+
b,
|
|
3017
|
+
e,
|
|
3018
|
+
m,
|
|
3019
|
+
be,
|
|
3020
|
+
em,
|
|
3021
|
+
bm,
|
|
3022
|
+
bem,
|
|
3023
|
+
is,
|
|
3024
|
+
cssVar,
|
|
3025
|
+
cssVarName,
|
|
3026
|
+
cssVarBlock,
|
|
3027
|
+
cssVarBlockName
|
|
3028
|
+
};
|
|
3029
|
+
};
|
|
3030
|
+
|
|
3031
|
+
const useProp = (name) => {
|
|
3032
|
+
const vm = getCurrentInstance();
|
|
3033
|
+
return computed(() => {
|
|
3034
|
+
var _a, _b;
|
|
3035
|
+
return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
|
|
3036
|
+
});
|
|
3037
|
+
};
|
|
3038
|
+
|
|
3039
|
+
const defaultIdInjection = {
|
|
3040
|
+
prefix: Math.floor(Math.random() * 1e4),
|
|
3041
|
+
current: 0
|
|
3042
|
+
};
|
|
3043
|
+
const ID_INJECTION_KEY = Symbol("elIdInjection");
|
|
3044
|
+
const useIdInjection = () => {
|
|
3045
|
+
return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
|
|
3046
|
+
};
|
|
3047
|
+
const useId = (deterministicId) => {
|
|
3048
|
+
const idInjection = useIdInjection();
|
|
3049
|
+
if (!isClient && idInjection === defaultIdInjection) {
|
|
3050
|
+
debugWarn("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
|
|
3051
|
+
usage: app.provide(ID_INJECTION_KEY, {
|
|
3052
|
+
prefix: number,
|
|
3053
|
+
current: number,
|
|
3054
|
+
})`);
|
|
3055
|
+
}
|
|
3056
|
+
const namespace = useGetDerivedNamespace();
|
|
3057
|
+
const idRef = computed(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
|
|
3058
|
+
return idRef;
|
|
3059
|
+
};
|
|
3060
|
+
|
|
3061
|
+
const useSizeProp = buildProp({
|
|
3062
|
+
type: String,
|
|
3063
|
+
values: componentSizes,
|
|
3064
|
+
required: false
|
|
3065
|
+
});
|
|
3066
|
+
const SIZE_INJECTION_KEY = Symbol("size");
|
|
3067
|
+
const useGlobalSize = () => {
|
|
3068
|
+
const injectedSize = inject(SIZE_INJECTION_KEY, {});
|
|
3069
|
+
return computed(() => {
|
|
3070
|
+
return unref(injectedSize.size) || "";
|
|
3071
|
+
});
|
|
3072
|
+
};
|
|
3073
|
+
|
|
3074
|
+
var _export_sfc = (sfc, props) => {
|
|
3075
|
+
const target = sfc.__vccOpts || sfc;
|
|
3076
|
+
for (const [key, val] of props) {
|
|
3077
|
+
target[key] = val;
|
|
3078
|
+
}
|
|
3079
|
+
return target;
|
|
3080
|
+
};
|
|
3081
|
+
|
|
3082
|
+
const formContextKey = Symbol("formContextKey");
|
|
3083
|
+
const formItemContextKey = Symbol("formItemContextKey");
|
|
3084
|
+
|
|
3085
|
+
const useFormSize = (fallback, ignore = {}) => {
|
|
3086
|
+
const emptyRef = ref(void 0);
|
|
3087
|
+
const size = ignore.prop ? emptyRef : useProp("size");
|
|
3088
|
+
const globalConfig = ignore.global ? emptyRef : useGlobalSize();
|
|
3089
|
+
const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
|
|
3090
|
+
const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
|
|
3091
|
+
return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
|
|
3092
|
+
};
|
|
3093
|
+
const useFormDisabled = (fallback) => {
|
|
3094
|
+
const disabled = useProp("disabled");
|
|
3095
|
+
const form = inject(formContextKey, void 0);
|
|
3096
|
+
return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
|
|
3097
|
+
};
|
|
3098
|
+
|
|
3099
|
+
const useFormItem = () => {
|
|
3100
|
+
const form = inject(formContextKey, void 0);
|
|
3101
|
+
const formItem = inject(formItemContextKey, void 0);
|
|
3102
|
+
return {
|
|
3103
|
+
form,
|
|
3104
|
+
formItem
|
|
3105
|
+
};
|
|
3106
|
+
};
|
|
3107
|
+
const useFormItemInputId = (props, {
|
|
3108
|
+
formItemContext,
|
|
3109
|
+
disableIdGeneration,
|
|
3110
|
+
disableIdManagement
|
|
3111
|
+
}) => {
|
|
3112
|
+
if (!disableIdGeneration) {
|
|
3113
|
+
disableIdGeneration = ref(false);
|
|
3114
|
+
}
|
|
3115
|
+
if (!disableIdManagement) {
|
|
3116
|
+
disableIdManagement = ref(false);
|
|
3117
|
+
}
|
|
3118
|
+
const inputId = ref();
|
|
3119
|
+
let idUnwatch = void 0;
|
|
3120
|
+
const isLabeledByFormItem = computed(() => {
|
|
3121
|
+
var _a;
|
|
3122
|
+
return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
|
|
3123
|
+
});
|
|
3124
|
+
onMounted(() => {
|
|
3125
|
+
idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
|
|
3126
|
+
const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
|
|
3127
|
+
if (newId !== inputId.value) {
|
|
3128
|
+
if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
|
|
3129
|
+
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
3130
|
+
if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
|
|
3131
|
+
formItemContext.addInputId(newId);
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
inputId.value = newId;
|
|
3135
|
+
}
|
|
3136
|
+
}, { immediate: true });
|
|
3137
|
+
});
|
|
3138
|
+
onUnmounted(() => {
|
|
3139
|
+
idUnwatch && idUnwatch();
|
|
3140
|
+
if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
|
|
3141
|
+
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
3142
|
+
}
|
|
3143
|
+
});
|
|
3144
|
+
return {
|
|
3145
|
+
isLabeledByFormItem,
|
|
3146
|
+
inputId
|
|
3147
|
+
};
|
|
3148
|
+
};
|
|
3149
|
+
|
|
3150
|
+
const checkboxProps = {
|
|
3151
|
+
modelValue: {
|
|
3152
|
+
type: [Number, String, Boolean],
|
|
3153
|
+
default: void 0
|
|
3154
|
+
},
|
|
3155
|
+
label: {
|
|
3156
|
+
type: [String, Boolean, Number, Object]
|
|
3157
|
+
},
|
|
3158
|
+
indeterminate: Boolean,
|
|
3159
|
+
disabled: Boolean,
|
|
3160
|
+
checked: Boolean,
|
|
3161
|
+
name: {
|
|
3162
|
+
type: String,
|
|
3163
|
+
default: void 0
|
|
3164
|
+
},
|
|
3165
|
+
trueLabel: {
|
|
3166
|
+
type: [String, Number],
|
|
3167
|
+
default: void 0
|
|
3168
|
+
},
|
|
3169
|
+
falseLabel: {
|
|
3170
|
+
type: [String, Number],
|
|
3171
|
+
default: void 0
|
|
3172
|
+
},
|
|
3173
|
+
id: {
|
|
3174
|
+
type: String,
|
|
3175
|
+
default: void 0
|
|
3176
|
+
},
|
|
3177
|
+
controls: {
|
|
3178
|
+
type: String,
|
|
3179
|
+
default: void 0
|
|
3180
|
+
},
|
|
3181
|
+
border: Boolean,
|
|
3182
|
+
size: useSizeProp,
|
|
3183
|
+
tabindex: [String, Number],
|
|
3184
|
+
validateEvent: {
|
|
3185
|
+
type: Boolean,
|
|
3186
|
+
default: true
|
|
3187
|
+
}
|
|
3188
|
+
};
|
|
3189
|
+
const checkboxEmits = {
|
|
3190
|
+
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
|
|
3191
|
+
change: (val) => isString(val) || isNumber(val) || isBoolean(val)
|
|
3192
|
+
};
|
|
3193
|
+
|
|
3194
|
+
const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
|
|
3195
|
+
|
|
3196
|
+
const useCheckboxDisabled = ({
|
|
3197
|
+
model,
|
|
3198
|
+
isChecked
|
|
3199
|
+
}) => {
|
|
3200
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3201
|
+
const isLimitDisabled = computed(() => {
|
|
3202
|
+
var _a, _b;
|
|
3203
|
+
const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
|
|
3204
|
+
const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
|
|
3205
|
+
return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
|
|
3206
|
+
});
|
|
3207
|
+
const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
|
|
3208
|
+
return {
|
|
3209
|
+
isDisabled,
|
|
3210
|
+
isLimitDisabled
|
|
3211
|
+
};
|
|
3212
|
+
};
|
|
3213
|
+
|
|
3214
|
+
const useCheckboxEvent = (props, {
|
|
3215
|
+
model,
|
|
3216
|
+
isLimitExceeded,
|
|
3217
|
+
hasOwnLabel,
|
|
3218
|
+
isDisabled,
|
|
3219
|
+
isLabeledByFormItem
|
|
3220
|
+
}) => {
|
|
3221
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3222
|
+
const { formItem } = useFormItem();
|
|
3223
|
+
const { emit } = getCurrentInstance();
|
|
3224
|
+
function getLabeledValue(value) {
|
|
3225
|
+
var _a, _b;
|
|
3226
|
+
return value === props.trueLabel || value === true ? (_a = props.trueLabel) != null ? _a : true : (_b = props.falseLabel) != null ? _b : false;
|
|
3227
|
+
}
|
|
3228
|
+
function emitChangeEvent(checked, e) {
|
|
3229
|
+
emit("change", getLabeledValue(checked), e);
|
|
3230
|
+
}
|
|
3231
|
+
function handleChange(e) {
|
|
3232
|
+
if (isLimitExceeded.value)
|
|
3233
|
+
return;
|
|
3234
|
+
const target = e.target;
|
|
3235
|
+
emit("change", getLabeledValue(target.checked), e);
|
|
3236
|
+
}
|
|
3237
|
+
async function onClickRoot(e) {
|
|
3238
|
+
if (isLimitExceeded.value)
|
|
3239
|
+
return;
|
|
3240
|
+
if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
|
|
3241
|
+
const eventTargets = e.composedPath();
|
|
3242
|
+
const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
|
|
3243
|
+
if (!hasLabel) {
|
|
3244
|
+
model.value = getLabeledValue([false, props.falseLabel].includes(model.value));
|
|
3245
|
+
await nextTick();
|
|
3246
|
+
emitChangeEvent(model.value, e);
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
|
|
3251
|
+
watch(() => props.modelValue, () => {
|
|
3252
|
+
if (validateEvent.value) {
|
|
3253
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
3254
|
+
}
|
|
3255
|
+
});
|
|
3256
|
+
return {
|
|
3257
|
+
handleChange,
|
|
3258
|
+
onClickRoot
|
|
3259
|
+
};
|
|
3260
|
+
};
|
|
3261
|
+
|
|
3262
|
+
const useCheckboxModel = (props) => {
|
|
3263
|
+
const selfModel = ref(false);
|
|
3264
|
+
const { emit } = getCurrentInstance();
|
|
3265
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3266
|
+
const isGroup = computed(() => isUndefined(checkboxGroup) === false);
|
|
3267
|
+
const isLimitExceeded = ref(false);
|
|
3268
|
+
const model = computed({
|
|
3269
|
+
get() {
|
|
3270
|
+
var _a, _b;
|
|
3271
|
+
return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
|
|
3272
|
+
},
|
|
3273
|
+
set(val) {
|
|
3274
|
+
var _a, _b;
|
|
3275
|
+
if (isGroup.value && isArray$2(val)) {
|
|
3276
|
+
isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value);
|
|
3277
|
+
isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
|
|
3278
|
+
} else {
|
|
3279
|
+
emit(UPDATE_MODEL_EVENT, val);
|
|
3280
|
+
selfModel.value = val;
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
});
|
|
3284
|
+
return {
|
|
3285
|
+
model,
|
|
3286
|
+
isGroup,
|
|
3287
|
+
isLimitExceeded
|
|
3288
|
+
};
|
|
3289
|
+
};
|
|
3290
|
+
|
|
3291
|
+
const useCheckboxStatus = (props, slots, { model }) => {
|
|
3292
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3293
|
+
const isFocused = ref(false);
|
|
3294
|
+
const isChecked = computed(() => {
|
|
3295
|
+
const value = model.value;
|
|
3296
|
+
if (isBoolean(value)) {
|
|
3297
|
+
return value;
|
|
3298
|
+
} else if (isArray$2(value)) {
|
|
3299
|
+
if (isObject$1(props.label)) {
|
|
3300
|
+
return value.map(toRaw).some((o) => isEqual(o, props.label));
|
|
3301
|
+
} else {
|
|
3302
|
+
return value.map(toRaw).includes(props.label);
|
|
3303
|
+
}
|
|
3304
|
+
} else if (value !== null && value !== void 0) {
|
|
3305
|
+
return value === props.trueLabel;
|
|
3306
|
+
} else {
|
|
3307
|
+
return !!value;
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3310
|
+
const checkboxButtonSize = useFormSize(computed(() => {
|
|
3311
|
+
var _a;
|
|
3312
|
+
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
|
|
3313
|
+
}), {
|
|
3314
|
+
prop: true
|
|
3315
|
+
});
|
|
3316
|
+
const checkboxSize = useFormSize(computed(() => {
|
|
3317
|
+
var _a;
|
|
3318
|
+
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
|
|
3319
|
+
}));
|
|
3320
|
+
const hasOwnLabel = computed(() => {
|
|
3321
|
+
return !!(slots.default || props.label);
|
|
3322
|
+
});
|
|
3323
|
+
return {
|
|
3324
|
+
checkboxButtonSize,
|
|
3325
|
+
isChecked,
|
|
3326
|
+
isFocused,
|
|
3327
|
+
checkboxSize,
|
|
3328
|
+
hasOwnLabel
|
|
3329
|
+
};
|
|
3330
|
+
};
|
|
3331
|
+
|
|
3332
|
+
const setStoreValue = (props, { model }) => {
|
|
3333
|
+
function addToStore() {
|
|
3334
|
+
if (isArray$2(model.value) && !model.value.includes(props.label)) {
|
|
3335
|
+
model.value.push(props.label);
|
|
3336
|
+
} else {
|
|
3337
|
+
model.value = props.trueLabel || true;
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
props.checked && addToStore();
|
|
3341
|
+
};
|
|
3342
|
+
const useCheckbox = (props, slots) => {
|
|
3343
|
+
const { formItem: elFormItem } = useFormItem();
|
|
3344
|
+
const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
|
|
3345
|
+
const {
|
|
3346
|
+
isFocused,
|
|
3347
|
+
isChecked,
|
|
3348
|
+
checkboxButtonSize,
|
|
3349
|
+
checkboxSize,
|
|
3350
|
+
hasOwnLabel
|
|
3351
|
+
} = useCheckboxStatus(props, slots, { model });
|
|
3352
|
+
const { isDisabled } = useCheckboxDisabled({ model, isChecked });
|
|
3353
|
+
const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
3354
|
+
formItemContext: elFormItem,
|
|
3355
|
+
disableIdGeneration: hasOwnLabel,
|
|
3356
|
+
disableIdManagement: isGroup
|
|
3357
|
+
});
|
|
3358
|
+
const { handleChange, onClickRoot } = useCheckboxEvent(props, {
|
|
3359
|
+
model,
|
|
3360
|
+
isLimitExceeded,
|
|
3361
|
+
hasOwnLabel,
|
|
3362
|
+
isDisabled,
|
|
3363
|
+
isLabeledByFormItem
|
|
3364
|
+
});
|
|
3365
|
+
setStoreValue(props, { model });
|
|
3366
|
+
return {
|
|
3367
|
+
inputId,
|
|
3368
|
+
isLabeledByFormItem,
|
|
3369
|
+
isChecked,
|
|
3370
|
+
isDisabled,
|
|
3371
|
+
isFocused,
|
|
3372
|
+
checkboxButtonSize,
|
|
3373
|
+
checkboxSize,
|
|
3374
|
+
hasOwnLabel,
|
|
3375
|
+
model,
|
|
3376
|
+
handleChange,
|
|
3377
|
+
onClickRoot
|
|
3378
|
+
};
|
|
3379
|
+
};
|
|
3380
|
+
|
|
3381
|
+
const _hoisted_1$1 = ["tabindex", "role", "aria-checked"];
|
|
3382
|
+
const _hoisted_2$1 = ["id", "aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
|
|
3383
|
+
const _hoisted_3 = ["id", "aria-hidden", "disabled", "value", "name", "tabindex"];
|
|
3384
|
+
const __default__$2 = defineComponent({
|
|
3385
|
+
name: "ElCheckbox"
|
|
3386
|
+
});
|
|
3387
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3388
|
+
...__default__$2,
|
|
3389
|
+
props: checkboxProps,
|
|
3390
|
+
emits: checkboxEmits,
|
|
3391
|
+
setup(__props) {
|
|
3392
|
+
const props = __props;
|
|
3393
|
+
const slots = useSlots();
|
|
3394
|
+
const {
|
|
3395
|
+
inputId,
|
|
3396
|
+
isLabeledByFormItem,
|
|
3397
|
+
isChecked,
|
|
3398
|
+
isDisabled,
|
|
3399
|
+
isFocused,
|
|
3400
|
+
checkboxSize,
|
|
3401
|
+
hasOwnLabel,
|
|
3402
|
+
model,
|
|
3403
|
+
handleChange,
|
|
3404
|
+
onClickRoot
|
|
3405
|
+
} = useCheckbox(props, slots);
|
|
3406
|
+
const ns = useNamespace("checkbox");
|
|
3407
|
+
const compKls = computed(() => {
|
|
3408
|
+
return [
|
|
3409
|
+
ns.b(),
|
|
3410
|
+
ns.m(checkboxSize.value),
|
|
3411
|
+
ns.is("disabled", isDisabled.value),
|
|
3412
|
+
ns.is("bordered", props.border),
|
|
3413
|
+
ns.is("checked", isChecked.value)
|
|
3414
|
+
];
|
|
3415
|
+
});
|
|
3416
|
+
const spanKls = computed(() => {
|
|
3417
|
+
return [
|
|
3418
|
+
ns.e("input"),
|
|
3419
|
+
ns.is("disabled", isDisabled.value),
|
|
3420
|
+
ns.is("checked", isChecked.value),
|
|
3421
|
+
ns.is("indeterminate", props.indeterminate),
|
|
3422
|
+
ns.is("focus", isFocused.value)
|
|
3423
|
+
];
|
|
3424
|
+
});
|
|
3425
|
+
return (_ctx, _cache) => {
|
|
3426
|
+
return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
|
|
3427
|
+
class: normalizeClass(unref(compKls)),
|
|
3428
|
+
"aria-controls": _ctx.indeterminate ? _ctx.controls : null,
|
|
3429
|
+
onClick: unref(onClickRoot)
|
|
3430
|
+
}, {
|
|
3431
|
+
default: withCtx(() => [
|
|
3432
|
+
createElementVNode("span", {
|
|
3433
|
+
class: normalizeClass(unref(spanKls)),
|
|
3434
|
+
tabindex: _ctx.indeterminate ? 0 : void 0,
|
|
3435
|
+
role: _ctx.indeterminate ? "checkbox" : void 0,
|
|
3436
|
+
"aria-checked": _ctx.indeterminate ? "mixed" : void 0
|
|
3437
|
+
}, [
|
|
3438
|
+
_ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
3439
|
+
key: 0,
|
|
3440
|
+
id: unref(inputId),
|
|
3441
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
3442
|
+
class: normalizeClass(unref(ns).e("original")),
|
|
3443
|
+
type: "checkbox",
|
|
3444
|
+
"aria-hidden": _ctx.indeterminate ? "true" : "false",
|
|
3445
|
+
name: _ctx.name,
|
|
3446
|
+
tabindex: _ctx.tabindex,
|
|
3447
|
+
disabled: unref(isDisabled),
|
|
3448
|
+
"true-value": _ctx.trueLabel,
|
|
3449
|
+
"false-value": _ctx.falseLabel,
|
|
3450
|
+
onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
|
|
3451
|
+
onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
|
|
3452
|
+
onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false)
|
|
3453
|
+
}, null, 42, _hoisted_2$1)), [
|
|
3454
|
+
[vModelCheckbox, unref(model)]
|
|
3455
|
+
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
3456
|
+
key: 1,
|
|
3457
|
+
id: unref(inputId),
|
|
3458
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(model) ? model.value = $event : null),
|
|
3459
|
+
class: normalizeClass(unref(ns).e("original")),
|
|
3460
|
+
type: "checkbox",
|
|
3461
|
+
"aria-hidden": _ctx.indeterminate ? "true" : "false",
|
|
3462
|
+
disabled: unref(isDisabled),
|
|
3463
|
+
value: _ctx.label,
|
|
3464
|
+
name: _ctx.name,
|
|
3465
|
+
tabindex: _ctx.tabindex,
|
|
3466
|
+
onChange: _cache[5] || (_cache[5] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
|
|
3467
|
+
onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true),
|
|
3468
|
+
onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false)
|
|
3469
|
+
}, null, 42, _hoisted_3)), [
|
|
3470
|
+
[vModelCheckbox, unref(model)]
|
|
3471
|
+
]),
|
|
3472
|
+
createElementVNode("span", {
|
|
3473
|
+
class: normalizeClass(unref(ns).e("inner"))
|
|
3474
|
+
}, null, 2)
|
|
3475
|
+
], 10, _hoisted_1$1),
|
|
3476
|
+
unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
|
|
3477
|
+
key: 0,
|
|
3478
|
+
class: normalizeClass(unref(ns).e("label"))
|
|
3479
|
+
}, [
|
|
3480
|
+
renderSlot(_ctx.$slots, "default"),
|
|
3481
|
+
!_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3482
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
3483
|
+
], 64)) : createCommentVNode("v-if", true)
|
|
3484
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
3485
|
+
]),
|
|
3486
|
+
_: 3
|
|
3487
|
+
}, 8, ["class", "aria-controls", "onClick"]);
|
|
3488
|
+
};
|
|
3489
|
+
}
|
|
3490
|
+
});
|
|
3491
|
+
var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);
|
|
3492
|
+
|
|
3493
|
+
const _hoisted_1 = ["name", "tabindex", "disabled", "true-value", "false-value"];
|
|
3494
|
+
const _hoisted_2 = ["name", "tabindex", "disabled", "value"];
|
|
3495
|
+
const __default__$1 = defineComponent({
|
|
3496
|
+
name: "ElCheckboxButton"
|
|
3497
|
+
});
|
|
3498
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3499
|
+
...__default__$1,
|
|
3500
|
+
props: checkboxProps,
|
|
3501
|
+
emits: checkboxEmits,
|
|
3502
|
+
setup(__props) {
|
|
3503
|
+
const props = __props;
|
|
3504
|
+
const slots = useSlots();
|
|
3505
|
+
const {
|
|
3506
|
+
isFocused,
|
|
3507
|
+
isChecked,
|
|
3508
|
+
isDisabled,
|
|
3509
|
+
checkboxButtonSize,
|
|
3510
|
+
model,
|
|
3511
|
+
handleChange
|
|
3512
|
+
} = useCheckbox(props, slots);
|
|
3513
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
3514
|
+
const ns = useNamespace("checkbox");
|
|
3515
|
+
const activeStyle = computed(() => {
|
|
3516
|
+
var _a, _b, _c, _d;
|
|
3517
|
+
const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
|
|
3518
|
+
return {
|
|
3519
|
+
backgroundColor: fillValue,
|
|
3520
|
+
borderColor: fillValue,
|
|
3521
|
+
color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
|
|
3522
|
+
boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
|
|
3523
|
+
};
|
|
3524
|
+
});
|
|
3525
|
+
const labelKls = computed(() => {
|
|
3526
|
+
return [
|
|
3527
|
+
ns.b("button"),
|
|
3528
|
+
ns.bm("button", checkboxButtonSize.value),
|
|
3529
|
+
ns.is("disabled", isDisabled.value),
|
|
3530
|
+
ns.is("checked", isChecked.value),
|
|
3531
|
+
ns.is("focus", isFocused.value)
|
|
3532
|
+
];
|
|
3533
|
+
});
|
|
3534
|
+
return (_ctx, _cache) => {
|
|
3535
|
+
return openBlock(), createElementBlock("label", {
|
|
3536
|
+
class: normalizeClass(unref(labelKls))
|
|
3537
|
+
}, [
|
|
3538
|
+
_ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
3539
|
+
key: 0,
|
|
3540
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
3541
|
+
class: normalizeClass(unref(ns).be("button", "original")),
|
|
3542
|
+
type: "checkbox",
|
|
3543
|
+
name: _ctx.name,
|
|
3544
|
+
tabindex: _ctx.tabindex,
|
|
3545
|
+
disabled: unref(isDisabled),
|
|
3546
|
+
"true-value": _ctx.trueLabel,
|
|
3547
|
+
"false-value": _ctx.falseLabel,
|
|
3548
|
+
onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
|
|
3549
|
+
onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
|
|
3550
|
+
onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false)
|
|
3551
|
+
}, null, 42, _hoisted_1)), [
|
|
3552
|
+
[vModelCheckbox, unref(model)]
|
|
3553
|
+
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
3554
|
+
key: 1,
|
|
3555
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(model) ? model.value = $event : null),
|
|
3556
|
+
class: normalizeClass(unref(ns).be("button", "original")),
|
|
3557
|
+
type: "checkbox",
|
|
3558
|
+
name: _ctx.name,
|
|
3559
|
+
tabindex: _ctx.tabindex,
|
|
3560
|
+
disabled: unref(isDisabled),
|
|
3561
|
+
value: _ctx.label,
|
|
3562
|
+
onChange: _cache[5] || (_cache[5] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
|
|
3563
|
+
onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true),
|
|
3564
|
+
onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false)
|
|
3565
|
+
}, null, 42, _hoisted_2)), [
|
|
3566
|
+
[vModelCheckbox, unref(model)]
|
|
3567
|
+
]),
|
|
3568
|
+
_ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
|
|
3569
|
+
key: 2,
|
|
3570
|
+
class: normalizeClass(unref(ns).be("button", "inner")),
|
|
3571
|
+
style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
|
|
3572
|
+
}, [
|
|
3573
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
3574
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
3575
|
+
])
|
|
3576
|
+
], 6)) : createCommentVNode("v-if", true)
|
|
3577
|
+
], 2);
|
|
3578
|
+
};
|
|
3579
|
+
}
|
|
3580
|
+
});
|
|
3581
|
+
var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);
|
|
3582
|
+
|
|
3583
|
+
const checkboxGroupProps = buildProps({
|
|
3584
|
+
modelValue: {
|
|
3585
|
+
type: definePropType(Array),
|
|
3586
|
+
default: () => []
|
|
3587
|
+
},
|
|
3588
|
+
disabled: Boolean,
|
|
3589
|
+
min: Number,
|
|
3590
|
+
max: Number,
|
|
3591
|
+
size: useSizeProp,
|
|
3592
|
+
label: String,
|
|
3593
|
+
fill: String,
|
|
3594
|
+
textColor: String,
|
|
3595
|
+
tag: {
|
|
3596
|
+
type: String,
|
|
3597
|
+
default: "div"
|
|
3598
|
+
},
|
|
3599
|
+
validateEvent: {
|
|
3600
|
+
type: Boolean,
|
|
3601
|
+
default: true
|
|
3602
|
+
}
|
|
3603
|
+
});
|
|
3604
|
+
const checkboxGroupEmits = {
|
|
3605
|
+
[UPDATE_MODEL_EVENT]: (val) => isArray$2(val),
|
|
3606
|
+
change: (val) => isArray$2(val)
|
|
3607
|
+
};
|
|
3608
|
+
|
|
3609
|
+
const __default__ = defineComponent({
|
|
3610
|
+
name: "ElCheckboxGroup"
|
|
3611
|
+
});
|
|
3612
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3613
|
+
...__default__,
|
|
3614
|
+
props: checkboxGroupProps,
|
|
3615
|
+
emits: checkboxGroupEmits,
|
|
3616
|
+
setup(__props, { emit }) {
|
|
3617
|
+
const props = __props;
|
|
3618
|
+
const ns = useNamespace("checkbox");
|
|
3619
|
+
const { formItem } = useFormItem();
|
|
3620
|
+
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
3621
|
+
formItemContext: formItem
|
|
3622
|
+
});
|
|
3623
|
+
const changeEvent = async (value) => {
|
|
3624
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
3625
|
+
await nextTick();
|
|
3626
|
+
emit("change", value);
|
|
3627
|
+
};
|
|
3628
|
+
const modelValue = computed({
|
|
3629
|
+
get() {
|
|
3630
|
+
return props.modelValue;
|
|
3631
|
+
},
|
|
3632
|
+
set(val) {
|
|
3633
|
+
changeEvent(val);
|
|
3634
|
+
}
|
|
3635
|
+
});
|
|
3636
|
+
provide(checkboxGroupContextKey, {
|
|
3637
|
+
...pick$1(toRefs(props), [
|
|
3638
|
+
"size",
|
|
3639
|
+
"min",
|
|
3640
|
+
"max",
|
|
3641
|
+
"disabled",
|
|
3642
|
+
"validateEvent",
|
|
3643
|
+
"fill",
|
|
3644
|
+
"textColor"
|
|
3645
|
+
]),
|
|
3646
|
+
modelValue,
|
|
3647
|
+
changeEvent
|
|
3648
|
+
});
|
|
3649
|
+
watch(() => props.modelValue, () => {
|
|
3650
|
+
if (props.validateEvent) {
|
|
3651
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
3652
|
+
}
|
|
3653
|
+
});
|
|
3654
|
+
return (_ctx, _cache) => {
|
|
3655
|
+
var _a;
|
|
3656
|
+
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
3657
|
+
id: unref(groupId),
|
|
3658
|
+
class: normalizeClass(unref(ns).b("group")),
|
|
3659
|
+
role: "group",
|
|
3660
|
+
"aria-label": !unref(isLabeledByFormItem) ? _ctx.label || "checkbox-group" : void 0,
|
|
3661
|
+
"aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItem)) == null ? void 0 : _a.labelId : void 0
|
|
3662
|
+
}, {
|
|
3663
|
+
default: withCtx(() => [
|
|
3664
|
+
renderSlot(_ctx.$slots, "default")
|
|
3665
|
+
]),
|
|
3666
|
+
_: 3
|
|
3667
|
+
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
|
|
3668
|
+
};
|
|
3669
|
+
}
|
|
3670
|
+
});
|
|
3671
|
+
var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
|
|
3672
|
+
|
|
3673
|
+
const ElCheckbox = withInstall(Checkbox, {
|
|
3674
|
+
CheckboxButton,
|
|
3675
|
+
CheckboxGroup
|
|
3676
|
+
});
|
|
3677
|
+
withNoopInstall(CheckboxButton);
|
|
3678
|
+
withNoopInstall(CheckboxGroup);
|
|
3679
|
+
|
|
3680
|
+
var script = defineComponent({
|
|
3681
|
+
name: 'RxCheckbox',
|
|
3682
|
+
components: {
|
|
3683
|
+
ElCheckbox
|
|
3684
|
+
},
|
|
3685
|
+
props: RxCheckboxProps,
|
|
3686
|
+
setup() {
|
|
3687
|
+
return {};
|
|
3688
|
+
}
|
|
3689
|
+
});
|
|
3690
|
+
|
|
3691
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3692
|
+
const _component_el_checkbox = resolveComponent("el-checkbox");
|
|
3693
|
+
|
|
3694
|
+
return (openBlock(), createBlock(_component_el_checkbox, mergeProps(_ctx.$props, { class: "rx-checkbox" }), createSlots({ _: 2 /* DYNAMIC */ }, [
|
|
3695
|
+
(_ctx.$slots.default)
|
|
3696
|
+
? {
|
|
3697
|
+
name: "default",
|
|
3698
|
+
fn: withCtx(() => [
|
|
3699
|
+
renderSlot(_ctx.$slots, "default")
|
|
3700
|
+
]),
|
|
3701
|
+
key: "0"
|
|
3702
|
+
}
|
|
3703
|
+
: undefined
|
|
3704
|
+
]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */))
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
script.render = render;
|
|
3708
|
+
script.__file = "packages/components/RxCheckbox/src/index.vue";
|
|
3709
|
+
|
|
3710
|
+
const RxCheckbox = withInstall$1(script);
|
|
3711
|
+
|
|
3712
|
+
export { RxCheckbox, RxCheckbox as default };
|