stream-chat-react 11.9.0 → 11.10.0
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/dist/{Window-5e0717c0.js → Window-7d524c3b.js} +2092 -33
- package/dist/browser.full-bundle.js +2107 -53
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +4 -4
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/Channel/Channel.d.ts.map +1 -1
- package/dist/components/Channel/Channel.js +19 -10
- package/dist/components/ChannelList/hooks/usePaginatedChannels.d.ts.map +1 -1
- package/dist/components/ChannelList/hooks/usePaginatedChannels.js +11 -10
- package/dist/components/Emojis/index.cjs.js +1 -1
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.d.ts.map +1 -1
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.js +7 -12
- package/dist/components/Message/Message.d.ts.map +1 -1
- package/dist/components/Message/Message.js +2 -2
- package/dist/components/Message/types.d.ts +5 -0
- package/dist/components/Message/types.d.ts.map +1 -1
- package/dist/components/MessageList/MessageList.d.ts +1 -1
- package/dist/components/MessageList/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList/MessageList.js +2 -1
- package/dist/components/MessageList/VirtualizedMessageList.d.ts +2 -2
- package/dist/components/MessageList/VirtualizedMessageList.d.ts.map +1 -1
- package/dist/components/MessageList/VirtualizedMessageList.js +7 -3
- package/dist/components/MessageList/VirtualizedMessageListComponents.d.ts.map +1 -1
- package/dist/components/MessageList/VirtualizedMessageListComponents.js +2 -2
- package/dist/components/Reactions/ReactionsList.d.ts +5 -0
- package/dist/components/Reactions/ReactionsList.d.ts.map +1 -1
- package/dist/components/Reactions/ReactionsList.js +2 -2
- package/dist/components/Reactions/ReactionsListModal.d.ts +3 -2
- package/dist/components/Reactions/ReactionsListModal.d.ts.map +1 -1
- package/dist/components/Reactions/ReactionsListModal.js +16 -6
- package/dist/components/Reactions/hooks/useProcessReactions.d.ts +5 -2
- package/dist/components/Reactions/hooks/useProcessReactions.d.ts.map +1 -1
- package/dist/components/Reactions/hooks/useProcessReactions.js +10 -3
- package/dist/components/Reactions/types.d.ts +4 -1
- package/dist/components/Reactions/types.d.ts.map +1 -1
- package/dist/context/MessageContext.d.ts +5 -0
- package/dist/context/MessageContext.d.ts.map +1 -1
- package/dist/index.cjs.js +17 -19
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -1
|
@@ -1548,6 +1548,8 @@ function $6a7db85432448f7f$export$60278871457622de(event) {
|
|
|
1548
1548
|
return event.detail === 0 && !event.pointerType;
|
|
1549
1549
|
}
|
|
1550
1550
|
|
|
1551
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1552
|
+
|
|
1551
1553
|
function getDefaultExportFromCjs (x) {
|
|
1552
1554
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1553
1555
|
}
|
|
@@ -33595,6 +33597,2038 @@ ReactTextareaAutocomplete.propTypes = {
|
|
|
33595
33597
|
value: PropTypes__default["default"].string
|
|
33596
33598
|
};
|
|
33597
33599
|
|
|
33600
|
+
var lodash_defaultsdeep = {exports: {}};
|
|
33601
|
+
|
|
33602
|
+
/**
|
|
33603
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
33604
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
33605
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
33606
|
+
* Released under MIT license <https://lodash.com/license>
|
|
33607
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
33608
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
33609
|
+
*/
|
|
33610
|
+
|
|
33611
|
+
(function (module, exports) {
|
|
33612
|
+
/** Used as the size to enable large array optimizations. */
|
|
33613
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
33614
|
+
|
|
33615
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
33616
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
33617
|
+
|
|
33618
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
33619
|
+
var HOT_COUNT = 800,
|
|
33620
|
+
HOT_SPAN = 16;
|
|
33621
|
+
|
|
33622
|
+
/** Used as references for various `Number` constants. */
|
|
33623
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
33624
|
+
|
|
33625
|
+
/** `Object#toString` result references. */
|
|
33626
|
+
var argsTag = '[object Arguments]',
|
|
33627
|
+
arrayTag = '[object Array]',
|
|
33628
|
+
asyncTag = '[object AsyncFunction]',
|
|
33629
|
+
boolTag = '[object Boolean]',
|
|
33630
|
+
dateTag = '[object Date]',
|
|
33631
|
+
errorTag = '[object Error]',
|
|
33632
|
+
funcTag = '[object Function]',
|
|
33633
|
+
genTag = '[object GeneratorFunction]',
|
|
33634
|
+
mapTag = '[object Map]',
|
|
33635
|
+
numberTag = '[object Number]',
|
|
33636
|
+
nullTag = '[object Null]',
|
|
33637
|
+
objectTag = '[object Object]',
|
|
33638
|
+
proxyTag = '[object Proxy]',
|
|
33639
|
+
regexpTag = '[object RegExp]',
|
|
33640
|
+
setTag = '[object Set]',
|
|
33641
|
+
stringTag = '[object String]',
|
|
33642
|
+
undefinedTag = '[object Undefined]',
|
|
33643
|
+
weakMapTag = '[object WeakMap]';
|
|
33644
|
+
|
|
33645
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
33646
|
+
dataViewTag = '[object DataView]',
|
|
33647
|
+
float32Tag = '[object Float32Array]',
|
|
33648
|
+
float64Tag = '[object Float64Array]',
|
|
33649
|
+
int8Tag = '[object Int8Array]',
|
|
33650
|
+
int16Tag = '[object Int16Array]',
|
|
33651
|
+
int32Tag = '[object Int32Array]',
|
|
33652
|
+
uint8Tag = '[object Uint8Array]',
|
|
33653
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
33654
|
+
uint16Tag = '[object Uint16Array]',
|
|
33655
|
+
uint32Tag = '[object Uint32Array]';
|
|
33656
|
+
|
|
33657
|
+
/**
|
|
33658
|
+
* Used to match `RegExp`
|
|
33659
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
33660
|
+
*/
|
|
33661
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
33662
|
+
|
|
33663
|
+
/** Used to detect host constructors (Safari). */
|
|
33664
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
33665
|
+
|
|
33666
|
+
/** Used to detect unsigned integer values. */
|
|
33667
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
33668
|
+
|
|
33669
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
33670
|
+
var typedArrayTags = {};
|
|
33671
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
|
33672
|
+
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
|
33673
|
+
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
|
33674
|
+
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
|
33675
|
+
typedArrayTags[uint32Tag] = true;
|
|
33676
|
+
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
|
33677
|
+
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
|
33678
|
+
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
|
33679
|
+
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
|
33680
|
+
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
|
33681
|
+
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
|
33682
|
+
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
|
33683
|
+
typedArrayTags[weakMapTag] = false;
|
|
33684
|
+
|
|
33685
|
+
/** Detect free variable `global` from Node.js. */
|
|
33686
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
33687
|
+
|
|
33688
|
+
/** Detect free variable `self`. */
|
|
33689
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
33690
|
+
|
|
33691
|
+
/** Used as a reference to the global object. */
|
|
33692
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
33693
|
+
|
|
33694
|
+
/** Detect free variable `exports`. */
|
|
33695
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
33696
|
+
|
|
33697
|
+
/** Detect free variable `module`. */
|
|
33698
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
33699
|
+
|
|
33700
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
33701
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
33702
|
+
|
|
33703
|
+
/** Detect free variable `process` from Node.js. */
|
|
33704
|
+
var freeProcess = moduleExports && freeGlobal.process;
|
|
33705
|
+
|
|
33706
|
+
/** Used to access faster Node.js helpers. */
|
|
33707
|
+
var nodeUtil = (function() {
|
|
33708
|
+
try {
|
|
33709
|
+
// Use `util.types` for Node.js 10+.
|
|
33710
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
33711
|
+
|
|
33712
|
+
if (types) {
|
|
33713
|
+
return types;
|
|
33714
|
+
}
|
|
33715
|
+
|
|
33716
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
33717
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
33718
|
+
} catch (e) {}
|
|
33719
|
+
}());
|
|
33720
|
+
|
|
33721
|
+
/* Node.js helper references. */
|
|
33722
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
33723
|
+
|
|
33724
|
+
/**
|
|
33725
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
33726
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
33727
|
+
*
|
|
33728
|
+
* @private
|
|
33729
|
+
* @param {Function} func The function to invoke.
|
|
33730
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
33731
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
33732
|
+
* @returns {*} Returns the result of `func`.
|
|
33733
|
+
*/
|
|
33734
|
+
function apply(func, thisArg, args) {
|
|
33735
|
+
switch (args.length) {
|
|
33736
|
+
case 0: return func.call(thisArg);
|
|
33737
|
+
case 1: return func.call(thisArg, args[0]);
|
|
33738
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
33739
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
33740
|
+
}
|
|
33741
|
+
return func.apply(thisArg, args);
|
|
33742
|
+
}
|
|
33743
|
+
|
|
33744
|
+
/**
|
|
33745
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
33746
|
+
* or max array length checks.
|
|
33747
|
+
*
|
|
33748
|
+
* @private
|
|
33749
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
33750
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
33751
|
+
* @returns {Array} Returns the array of results.
|
|
33752
|
+
*/
|
|
33753
|
+
function baseTimes(n, iteratee) {
|
|
33754
|
+
var index = -1,
|
|
33755
|
+
result = Array(n);
|
|
33756
|
+
|
|
33757
|
+
while (++index < n) {
|
|
33758
|
+
result[index] = iteratee(index);
|
|
33759
|
+
}
|
|
33760
|
+
return result;
|
|
33761
|
+
}
|
|
33762
|
+
|
|
33763
|
+
/**
|
|
33764
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
33765
|
+
*
|
|
33766
|
+
* @private
|
|
33767
|
+
* @param {Function} func The function to cap arguments for.
|
|
33768
|
+
* @returns {Function} Returns the new capped function.
|
|
33769
|
+
*/
|
|
33770
|
+
function baseUnary(func) {
|
|
33771
|
+
return function(value) {
|
|
33772
|
+
return func(value);
|
|
33773
|
+
};
|
|
33774
|
+
}
|
|
33775
|
+
|
|
33776
|
+
/**
|
|
33777
|
+
* Gets the value at `key` of `object`.
|
|
33778
|
+
*
|
|
33779
|
+
* @private
|
|
33780
|
+
* @param {Object} [object] The object to query.
|
|
33781
|
+
* @param {string} key The key of the property to get.
|
|
33782
|
+
* @returns {*} Returns the property value.
|
|
33783
|
+
*/
|
|
33784
|
+
function getValue(object, key) {
|
|
33785
|
+
return object == null ? undefined : object[key];
|
|
33786
|
+
}
|
|
33787
|
+
|
|
33788
|
+
/**
|
|
33789
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
33790
|
+
*
|
|
33791
|
+
* @private
|
|
33792
|
+
* @param {Function} func The function to wrap.
|
|
33793
|
+
* @param {Function} transform The argument transform.
|
|
33794
|
+
* @returns {Function} Returns the new function.
|
|
33795
|
+
*/
|
|
33796
|
+
function overArg(func, transform) {
|
|
33797
|
+
return function(arg) {
|
|
33798
|
+
return func(transform(arg));
|
|
33799
|
+
};
|
|
33800
|
+
}
|
|
33801
|
+
|
|
33802
|
+
/** Used for built-in method references. */
|
|
33803
|
+
var arrayProto = Array.prototype,
|
|
33804
|
+
funcProto = Function.prototype,
|
|
33805
|
+
objectProto = Object.prototype;
|
|
33806
|
+
|
|
33807
|
+
/** Used to detect overreaching core-js shims. */
|
|
33808
|
+
var coreJsData = root['__core-js_shared__'];
|
|
33809
|
+
|
|
33810
|
+
/** Used to resolve the decompiled source of functions. */
|
|
33811
|
+
var funcToString = funcProto.toString;
|
|
33812
|
+
|
|
33813
|
+
/** Used to check objects for own properties. */
|
|
33814
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
33815
|
+
|
|
33816
|
+
/** Used to detect methods masquerading as native. */
|
|
33817
|
+
var maskSrcKey = (function() {
|
|
33818
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
33819
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
33820
|
+
}());
|
|
33821
|
+
|
|
33822
|
+
/**
|
|
33823
|
+
* Used to resolve the
|
|
33824
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
33825
|
+
* of values.
|
|
33826
|
+
*/
|
|
33827
|
+
var nativeObjectToString = objectProto.toString;
|
|
33828
|
+
|
|
33829
|
+
/** Used to infer the `Object` constructor. */
|
|
33830
|
+
var objectCtorString = funcToString.call(Object);
|
|
33831
|
+
|
|
33832
|
+
/** Used to detect if a method is native. */
|
|
33833
|
+
var reIsNative = RegExp('^' +
|
|
33834
|
+
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
|
33835
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
33836
|
+
);
|
|
33837
|
+
|
|
33838
|
+
/** Built-in value references. */
|
|
33839
|
+
var Buffer = moduleExports ? root.Buffer : undefined,
|
|
33840
|
+
Symbol = root.Symbol,
|
|
33841
|
+
Uint8Array = root.Uint8Array,
|
|
33842
|
+
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
|
|
33843
|
+
getPrototype = overArg(Object.getPrototypeOf, Object),
|
|
33844
|
+
objectCreate = Object.create,
|
|
33845
|
+
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
|
33846
|
+
splice = arrayProto.splice,
|
|
33847
|
+
symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
33848
|
+
|
|
33849
|
+
var defineProperty = (function() {
|
|
33850
|
+
try {
|
|
33851
|
+
var func = getNative(Object, 'defineProperty');
|
|
33852
|
+
func({}, '', {});
|
|
33853
|
+
return func;
|
|
33854
|
+
} catch (e) {}
|
|
33855
|
+
}());
|
|
33856
|
+
|
|
33857
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
33858
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
|
33859
|
+
nativeMax = Math.max,
|
|
33860
|
+
nativeNow = Date.now;
|
|
33861
|
+
|
|
33862
|
+
/* Built-in method references that are verified to be native. */
|
|
33863
|
+
var Map = getNative(root, 'Map'),
|
|
33864
|
+
nativeCreate = getNative(Object, 'create');
|
|
33865
|
+
|
|
33866
|
+
/**
|
|
33867
|
+
* The base implementation of `_.create` without support for assigning
|
|
33868
|
+
* properties to the created object.
|
|
33869
|
+
*
|
|
33870
|
+
* @private
|
|
33871
|
+
* @param {Object} proto The object to inherit from.
|
|
33872
|
+
* @returns {Object} Returns the new object.
|
|
33873
|
+
*/
|
|
33874
|
+
var baseCreate = (function() {
|
|
33875
|
+
function object() {}
|
|
33876
|
+
return function(proto) {
|
|
33877
|
+
if (!isObject(proto)) {
|
|
33878
|
+
return {};
|
|
33879
|
+
}
|
|
33880
|
+
if (objectCreate) {
|
|
33881
|
+
return objectCreate(proto);
|
|
33882
|
+
}
|
|
33883
|
+
object.prototype = proto;
|
|
33884
|
+
var result = new object;
|
|
33885
|
+
object.prototype = undefined;
|
|
33886
|
+
return result;
|
|
33887
|
+
};
|
|
33888
|
+
}());
|
|
33889
|
+
|
|
33890
|
+
/**
|
|
33891
|
+
* Creates a hash object.
|
|
33892
|
+
*
|
|
33893
|
+
* @private
|
|
33894
|
+
* @constructor
|
|
33895
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
33896
|
+
*/
|
|
33897
|
+
function Hash(entries) {
|
|
33898
|
+
var index = -1,
|
|
33899
|
+
length = entries == null ? 0 : entries.length;
|
|
33900
|
+
|
|
33901
|
+
this.clear();
|
|
33902
|
+
while (++index < length) {
|
|
33903
|
+
var entry = entries[index];
|
|
33904
|
+
this.set(entry[0], entry[1]);
|
|
33905
|
+
}
|
|
33906
|
+
}
|
|
33907
|
+
|
|
33908
|
+
/**
|
|
33909
|
+
* Removes all key-value entries from the hash.
|
|
33910
|
+
*
|
|
33911
|
+
* @private
|
|
33912
|
+
* @name clear
|
|
33913
|
+
* @memberOf Hash
|
|
33914
|
+
*/
|
|
33915
|
+
function hashClear() {
|
|
33916
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
33917
|
+
this.size = 0;
|
|
33918
|
+
}
|
|
33919
|
+
|
|
33920
|
+
/**
|
|
33921
|
+
* Removes `key` and its value from the hash.
|
|
33922
|
+
*
|
|
33923
|
+
* @private
|
|
33924
|
+
* @name delete
|
|
33925
|
+
* @memberOf Hash
|
|
33926
|
+
* @param {Object} hash The hash to modify.
|
|
33927
|
+
* @param {string} key The key of the value to remove.
|
|
33928
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
33929
|
+
*/
|
|
33930
|
+
function hashDelete(key) {
|
|
33931
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
33932
|
+
this.size -= result ? 1 : 0;
|
|
33933
|
+
return result;
|
|
33934
|
+
}
|
|
33935
|
+
|
|
33936
|
+
/**
|
|
33937
|
+
* Gets the hash value for `key`.
|
|
33938
|
+
*
|
|
33939
|
+
* @private
|
|
33940
|
+
* @name get
|
|
33941
|
+
* @memberOf Hash
|
|
33942
|
+
* @param {string} key The key of the value to get.
|
|
33943
|
+
* @returns {*} Returns the entry value.
|
|
33944
|
+
*/
|
|
33945
|
+
function hashGet(key) {
|
|
33946
|
+
var data = this.__data__;
|
|
33947
|
+
if (nativeCreate) {
|
|
33948
|
+
var result = data[key];
|
|
33949
|
+
return result === HASH_UNDEFINED ? undefined : result;
|
|
33950
|
+
}
|
|
33951
|
+
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
33952
|
+
}
|
|
33953
|
+
|
|
33954
|
+
/**
|
|
33955
|
+
* Checks if a hash value for `key` exists.
|
|
33956
|
+
*
|
|
33957
|
+
* @private
|
|
33958
|
+
* @name has
|
|
33959
|
+
* @memberOf Hash
|
|
33960
|
+
* @param {string} key The key of the entry to check.
|
|
33961
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
33962
|
+
*/
|
|
33963
|
+
function hashHas(key) {
|
|
33964
|
+
var data = this.__data__;
|
|
33965
|
+
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
|
33966
|
+
}
|
|
33967
|
+
|
|
33968
|
+
/**
|
|
33969
|
+
* Sets the hash `key` to `value`.
|
|
33970
|
+
*
|
|
33971
|
+
* @private
|
|
33972
|
+
* @name set
|
|
33973
|
+
* @memberOf Hash
|
|
33974
|
+
* @param {string} key The key of the value to set.
|
|
33975
|
+
* @param {*} value The value to set.
|
|
33976
|
+
* @returns {Object} Returns the hash instance.
|
|
33977
|
+
*/
|
|
33978
|
+
function hashSet(key, value) {
|
|
33979
|
+
var data = this.__data__;
|
|
33980
|
+
this.size += this.has(key) ? 0 : 1;
|
|
33981
|
+
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
33982
|
+
return this;
|
|
33983
|
+
}
|
|
33984
|
+
|
|
33985
|
+
// Add methods to `Hash`.
|
|
33986
|
+
Hash.prototype.clear = hashClear;
|
|
33987
|
+
Hash.prototype['delete'] = hashDelete;
|
|
33988
|
+
Hash.prototype.get = hashGet;
|
|
33989
|
+
Hash.prototype.has = hashHas;
|
|
33990
|
+
Hash.prototype.set = hashSet;
|
|
33991
|
+
|
|
33992
|
+
/**
|
|
33993
|
+
* Creates an list cache object.
|
|
33994
|
+
*
|
|
33995
|
+
* @private
|
|
33996
|
+
* @constructor
|
|
33997
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
33998
|
+
*/
|
|
33999
|
+
function ListCache(entries) {
|
|
34000
|
+
var index = -1,
|
|
34001
|
+
length = entries == null ? 0 : entries.length;
|
|
34002
|
+
|
|
34003
|
+
this.clear();
|
|
34004
|
+
while (++index < length) {
|
|
34005
|
+
var entry = entries[index];
|
|
34006
|
+
this.set(entry[0], entry[1]);
|
|
34007
|
+
}
|
|
34008
|
+
}
|
|
34009
|
+
|
|
34010
|
+
/**
|
|
34011
|
+
* Removes all key-value entries from the list cache.
|
|
34012
|
+
*
|
|
34013
|
+
* @private
|
|
34014
|
+
* @name clear
|
|
34015
|
+
* @memberOf ListCache
|
|
34016
|
+
*/
|
|
34017
|
+
function listCacheClear() {
|
|
34018
|
+
this.__data__ = [];
|
|
34019
|
+
this.size = 0;
|
|
34020
|
+
}
|
|
34021
|
+
|
|
34022
|
+
/**
|
|
34023
|
+
* Removes `key` and its value from the list cache.
|
|
34024
|
+
*
|
|
34025
|
+
* @private
|
|
34026
|
+
* @name delete
|
|
34027
|
+
* @memberOf ListCache
|
|
34028
|
+
* @param {string} key The key of the value to remove.
|
|
34029
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
34030
|
+
*/
|
|
34031
|
+
function listCacheDelete(key) {
|
|
34032
|
+
var data = this.__data__,
|
|
34033
|
+
index = assocIndexOf(data, key);
|
|
34034
|
+
|
|
34035
|
+
if (index < 0) {
|
|
34036
|
+
return false;
|
|
34037
|
+
}
|
|
34038
|
+
var lastIndex = data.length - 1;
|
|
34039
|
+
if (index == lastIndex) {
|
|
34040
|
+
data.pop();
|
|
34041
|
+
} else {
|
|
34042
|
+
splice.call(data, index, 1);
|
|
34043
|
+
}
|
|
34044
|
+
--this.size;
|
|
34045
|
+
return true;
|
|
34046
|
+
}
|
|
34047
|
+
|
|
34048
|
+
/**
|
|
34049
|
+
* Gets the list cache value for `key`.
|
|
34050
|
+
*
|
|
34051
|
+
* @private
|
|
34052
|
+
* @name get
|
|
34053
|
+
* @memberOf ListCache
|
|
34054
|
+
* @param {string} key The key of the value to get.
|
|
34055
|
+
* @returns {*} Returns the entry value.
|
|
34056
|
+
*/
|
|
34057
|
+
function listCacheGet(key) {
|
|
34058
|
+
var data = this.__data__,
|
|
34059
|
+
index = assocIndexOf(data, key);
|
|
34060
|
+
|
|
34061
|
+
return index < 0 ? undefined : data[index][1];
|
|
34062
|
+
}
|
|
34063
|
+
|
|
34064
|
+
/**
|
|
34065
|
+
* Checks if a list cache value for `key` exists.
|
|
34066
|
+
*
|
|
34067
|
+
* @private
|
|
34068
|
+
* @name has
|
|
34069
|
+
* @memberOf ListCache
|
|
34070
|
+
* @param {string} key The key of the entry to check.
|
|
34071
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
34072
|
+
*/
|
|
34073
|
+
function listCacheHas(key) {
|
|
34074
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
34075
|
+
}
|
|
34076
|
+
|
|
34077
|
+
/**
|
|
34078
|
+
* Sets the list cache `key` to `value`.
|
|
34079
|
+
*
|
|
34080
|
+
* @private
|
|
34081
|
+
* @name set
|
|
34082
|
+
* @memberOf ListCache
|
|
34083
|
+
* @param {string} key The key of the value to set.
|
|
34084
|
+
* @param {*} value The value to set.
|
|
34085
|
+
* @returns {Object} Returns the list cache instance.
|
|
34086
|
+
*/
|
|
34087
|
+
function listCacheSet(key, value) {
|
|
34088
|
+
var data = this.__data__,
|
|
34089
|
+
index = assocIndexOf(data, key);
|
|
34090
|
+
|
|
34091
|
+
if (index < 0) {
|
|
34092
|
+
++this.size;
|
|
34093
|
+
data.push([key, value]);
|
|
34094
|
+
} else {
|
|
34095
|
+
data[index][1] = value;
|
|
34096
|
+
}
|
|
34097
|
+
return this;
|
|
34098
|
+
}
|
|
34099
|
+
|
|
34100
|
+
// Add methods to `ListCache`.
|
|
34101
|
+
ListCache.prototype.clear = listCacheClear;
|
|
34102
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
34103
|
+
ListCache.prototype.get = listCacheGet;
|
|
34104
|
+
ListCache.prototype.has = listCacheHas;
|
|
34105
|
+
ListCache.prototype.set = listCacheSet;
|
|
34106
|
+
|
|
34107
|
+
/**
|
|
34108
|
+
* Creates a map cache object to store key-value pairs.
|
|
34109
|
+
*
|
|
34110
|
+
* @private
|
|
34111
|
+
* @constructor
|
|
34112
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
34113
|
+
*/
|
|
34114
|
+
function MapCache(entries) {
|
|
34115
|
+
var index = -1,
|
|
34116
|
+
length = entries == null ? 0 : entries.length;
|
|
34117
|
+
|
|
34118
|
+
this.clear();
|
|
34119
|
+
while (++index < length) {
|
|
34120
|
+
var entry = entries[index];
|
|
34121
|
+
this.set(entry[0], entry[1]);
|
|
34122
|
+
}
|
|
34123
|
+
}
|
|
34124
|
+
|
|
34125
|
+
/**
|
|
34126
|
+
* Removes all key-value entries from the map.
|
|
34127
|
+
*
|
|
34128
|
+
* @private
|
|
34129
|
+
* @name clear
|
|
34130
|
+
* @memberOf MapCache
|
|
34131
|
+
*/
|
|
34132
|
+
function mapCacheClear() {
|
|
34133
|
+
this.size = 0;
|
|
34134
|
+
this.__data__ = {
|
|
34135
|
+
'hash': new Hash,
|
|
34136
|
+
'map': new (Map || ListCache),
|
|
34137
|
+
'string': new Hash
|
|
34138
|
+
};
|
|
34139
|
+
}
|
|
34140
|
+
|
|
34141
|
+
/**
|
|
34142
|
+
* Removes `key` and its value from the map.
|
|
34143
|
+
*
|
|
34144
|
+
* @private
|
|
34145
|
+
* @name delete
|
|
34146
|
+
* @memberOf MapCache
|
|
34147
|
+
* @param {string} key The key of the value to remove.
|
|
34148
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
34149
|
+
*/
|
|
34150
|
+
function mapCacheDelete(key) {
|
|
34151
|
+
var result = getMapData(this, key)['delete'](key);
|
|
34152
|
+
this.size -= result ? 1 : 0;
|
|
34153
|
+
return result;
|
|
34154
|
+
}
|
|
34155
|
+
|
|
34156
|
+
/**
|
|
34157
|
+
* Gets the map value for `key`.
|
|
34158
|
+
*
|
|
34159
|
+
* @private
|
|
34160
|
+
* @name get
|
|
34161
|
+
* @memberOf MapCache
|
|
34162
|
+
* @param {string} key The key of the value to get.
|
|
34163
|
+
* @returns {*} Returns the entry value.
|
|
34164
|
+
*/
|
|
34165
|
+
function mapCacheGet(key) {
|
|
34166
|
+
return getMapData(this, key).get(key);
|
|
34167
|
+
}
|
|
34168
|
+
|
|
34169
|
+
/**
|
|
34170
|
+
* Checks if a map value for `key` exists.
|
|
34171
|
+
*
|
|
34172
|
+
* @private
|
|
34173
|
+
* @name has
|
|
34174
|
+
* @memberOf MapCache
|
|
34175
|
+
* @param {string} key The key of the entry to check.
|
|
34176
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
34177
|
+
*/
|
|
34178
|
+
function mapCacheHas(key) {
|
|
34179
|
+
return getMapData(this, key).has(key);
|
|
34180
|
+
}
|
|
34181
|
+
|
|
34182
|
+
/**
|
|
34183
|
+
* Sets the map `key` to `value`.
|
|
34184
|
+
*
|
|
34185
|
+
* @private
|
|
34186
|
+
* @name set
|
|
34187
|
+
* @memberOf MapCache
|
|
34188
|
+
* @param {string} key The key of the value to set.
|
|
34189
|
+
* @param {*} value The value to set.
|
|
34190
|
+
* @returns {Object} Returns the map cache instance.
|
|
34191
|
+
*/
|
|
34192
|
+
function mapCacheSet(key, value) {
|
|
34193
|
+
var data = getMapData(this, key),
|
|
34194
|
+
size = data.size;
|
|
34195
|
+
|
|
34196
|
+
data.set(key, value);
|
|
34197
|
+
this.size += data.size == size ? 0 : 1;
|
|
34198
|
+
return this;
|
|
34199
|
+
}
|
|
34200
|
+
|
|
34201
|
+
// Add methods to `MapCache`.
|
|
34202
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
34203
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
34204
|
+
MapCache.prototype.get = mapCacheGet;
|
|
34205
|
+
MapCache.prototype.has = mapCacheHas;
|
|
34206
|
+
MapCache.prototype.set = mapCacheSet;
|
|
34207
|
+
|
|
34208
|
+
/**
|
|
34209
|
+
* Creates a stack cache object to store key-value pairs.
|
|
34210
|
+
*
|
|
34211
|
+
* @private
|
|
34212
|
+
* @constructor
|
|
34213
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
34214
|
+
*/
|
|
34215
|
+
function Stack(entries) {
|
|
34216
|
+
var data = this.__data__ = new ListCache(entries);
|
|
34217
|
+
this.size = data.size;
|
|
34218
|
+
}
|
|
34219
|
+
|
|
34220
|
+
/**
|
|
34221
|
+
* Removes all key-value entries from the stack.
|
|
34222
|
+
*
|
|
34223
|
+
* @private
|
|
34224
|
+
* @name clear
|
|
34225
|
+
* @memberOf Stack
|
|
34226
|
+
*/
|
|
34227
|
+
function stackClear() {
|
|
34228
|
+
this.__data__ = new ListCache;
|
|
34229
|
+
this.size = 0;
|
|
34230
|
+
}
|
|
34231
|
+
|
|
34232
|
+
/**
|
|
34233
|
+
* Removes `key` and its value from the stack.
|
|
34234
|
+
*
|
|
34235
|
+
* @private
|
|
34236
|
+
* @name delete
|
|
34237
|
+
* @memberOf Stack
|
|
34238
|
+
* @param {string} key The key of the value to remove.
|
|
34239
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
34240
|
+
*/
|
|
34241
|
+
function stackDelete(key) {
|
|
34242
|
+
var data = this.__data__,
|
|
34243
|
+
result = data['delete'](key);
|
|
34244
|
+
|
|
34245
|
+
this.size = data.size;
|
|
34246
|
+
return result;
|
|
34247
|
+
}
|
|
34248
|
+
|
|
34249
|
+
/**
|
|
34250
|
+
* Gets the stack value for `key`.
|
|
34251
|
+
*
|
|
34252
|
+
* @private
|
|
34253
|
+
* @name get
|
|
34254
|
+
* @memberOf Stack
|
|
34255
|
+
* @param {string} key The key of the value to get.
|
|
34256
|
+
* @returns {*} Returns the entry value.
|
|
34257
|
+
*/
|
|
34258
|
+
function stackGet(key) {
|
|
34259
|
+
return this.__data__.get(key);
|
|
34260
|
+
}
|
|
34261
|
+
|
|
34262
|
+
/**
|
|
34263
|
+
* Checks if a stack value for `key` exists.
|
|
34264
|
+
*
|
|
34265
|
+
* @private
|
|
34266
|
+
* @name has
|
|
34267
|
+
* @memberOf Stack
|
|
34268
|
+
* @param {string} key The key of the entry to check.
|
|
34269
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
34270
|
+
*/
|
|
34271
|
+
function stackHas(key) {
|
|
34272
|
+
return this.__data__.has(key);
|
|
34273
|
+
}
|
|
34274
|
+
|
|
34275
|
+
/**
|
|
34276
|
+
* Sets the stack `key` to `value`.
|
|
34277
|
+
*
|
|
34278
|
+
* @private
|
|
34279
|
+
* @name set
|
|
34280
|
+
* @memberOf Stack
|
|
34281
|
+
* @param {string} key The key of the value to set.
|
|
34282
|
+
* @param {*} value The value to set.
|
|
34283
|
+
* @returns {Object} Returns the stack cache instance.
|
|
34284
|
+
*/
|
|
34285
|
+
function stackSet(key, value) {
|
|
34286
|
+
var data = this.__data__;
|
|
34287
|
+
if (data instanceof ListCache) {
|
|
34288
|
+
var pairs = data.__data__;
|
|
34289
|
+
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
34290
|
+
pairs.push([key, value]);
|
|
34291
|
+
this.size = ++data.size;
|
|
34292
|
+
return this;
|
|
34293
|
+
}
|
|
34294
|
+
data = this.__data__ = new MapCache(pairs);
|
|
34295
|
+
}
|
|
34296
|
+
data.set(key, value);
|
|
34297
|
+
this.size = data.size;
|
|
34298
|
+
return this;
|
|
34299
|
+
}
|
|
34300
|
+
|
|
34301
|
+
// Add methods to `Stack`.
|
|
34302
|
+
Stack.prototype.clear = stackClear;
|
|
34303
|
+
Stack.prototype['delete'] = stackDelete;
|
|
34304
|
+
Stack.prototype.get = stackGet;
|
|
34305
|
+
Stack.prototype.has = stackHas;
|
|
34306
|
+
Stack.prototype.set = stackSet;
|
|
34307
|
+
|
|
34308
|
+
/**
|
|
34309
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
34310
|
+
*
|
|
34311
|
+
* @private
|
|
34312
|
+
* @param {*} value The value to query.
|
|
34313
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
34314
|
+
* @returns {Array} Returns the array of property names.
|
|
34315
|
+
*/
|
|
34316
|
+
function arrayLikeKeys(value, inherited) {
|
|
34317
|
+
var isArr = isArray(value),
|
|
34318
|
+
isArg = !isArr && isArguments(value),
|
|
34319
|
+
isBuff = !isArr && !isArg && isBuffer(value),
|
|
34320
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
|
34321
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
34322
|
+
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
34323
|
+
length = result.length;
|
|
34324
|
+
|
|
34325
|
+
for (var key in value) {
|
|
34326
|
+
if ((inherited || hasOwnProperty.call(value, key)) &&
|
|
34327
|
+
!(skipIndexes && (
|
|
34328
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
34329
|
+
key == 'length' ||
|
|
34330
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
34331
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
34332
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
34333
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
34334
|
+
// Skip index properties.
|
|
34335
|
+
isIndex(key, length)
|
|
34336
|
+
))) {
|
|
34337
|
+
result.push(key);
|
|
34338
|
+
}
|
|
34339
|
+
}
|
|
34340
|
+
return result;
|
|
34341
|
+
}
|
|
34342
|
+
|
|
34343
|
+
/**
|
|
34344
|
+
* This function is like `assignValue` except that it doesn't assign
|
|
34345
|
+
* `undefined` values.
|
|
34346
|
+
*
|
|
34347
|
+
* @private
|
|
34348
|
+
* @param {Object} object The object to modify.
|
|
34349
|
+
* @param {string} key The key of the property to assign.
|
|
34350
|
+
* @param {*} value The value to assign.
|
|
34351
|
+
*/
|
|
34352
|
+
function assignMergeValue(object, key, value) {
|
|
34353
|
+
if ((value !== undefined && !eq(object[key], value)) ||
|
|
34354
|
+
(value === undefined && !(key in object))) {
|
|
34355
|
+
baseAssignValue(object, key, value);
|
|
34356
|
+
}
|
|
34357
|
+
}
|
|
34358
|
+
|
|
34359
|
+
/**
|
|
34360
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
34361
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
34362
|
+
* for equality comparisons.
|
|
34363
|
+
*
|
|
34364
|
+
* @private
|
|
34365
|
+
* @param {Object} object The object to modify.
|
|
34366
|
+
* @param {string} key The key of the property to assign.
|
|
34367
|
+
* @param {*} value The value to assign.
|
|
34368
|
+
*/
|
|
34369
|
+
function assignValue(object, key, value) {
|
|
34370
|
+
var objValue = object[key];
|
|
34371
|
+
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
|
34372
|
+
(value === undefined && !(key in object))) {
|
|
34373
|
+
baseAssignValue(object, key, value);
|
|
34374
|
+
}
|
|
34375
|
+
}
|
|
34376
|
+
|
|
34377
|
+
/**
|
|
34378
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
34379
|
+
*
|
|
34380
|
+
* @private
|
|
34381
|
+
* @param {Array} array The array to inspect.
|
|
34382
|
+
* @param {*} key The key to search for.
|
|
34383
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
34384
|
+
*/
|
|
34385
|
+
function assocIndexOf(array, key) {
|
|
34386
|
+
var length = array.length;
|
|
34387
|
+
while (length--) {
|
|
34388
|
+
if (eq(array[length][0], key)) {
|
|
34389
|
+
return length;
|
|
34390
|
+
}
|
|
34391
|
+
}
|
|
34392
|
+
return -1;
|
|
34393
|
+
}
|
|
34394
|
+
|
|
34395
|
+
/**
|
|
34396
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
34397
|
+
* value checks.
|
|
34398
|
+
*
|
|
34399
|
+
* @private
|
|
34400
|
+
* @param {Object} object The object to modify.
|
|
34401
|
+
* @param {string} key The key of the property to assign.
|
|
34402
|
+
* @param {*} value The value to assign.
|
|
34403
|
+
*/
|
|
34404
|
+
function baseAssignValue(object, key, value) {
|
|
34405
|
+
if (key == '__proto__' && defineProperty) {
|
|
34406
|
+
defineProperty(object, key, {
|
|
34407
|
+
'configurable': true,
|
|
34408
|
+
'enumerable': true,
|
|
34409
|
+
'value': value,
|
|
34410
|
+
'writable': true
|
|
34411
|
+
});
|
|
34412
|
+
} else {
|
|
34413
|
+
object[key] = value;
|
|
34414
|
+
}
|
|
34415
|
+
}
|
|
34416
|
+
|
|
34417
|
+
/**
|
|
34418
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
|
34419
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
34420
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
34421
|
+
*
|
|
34422
|
+
* @private
|
|
34423
|
+
* @param {Object} object The object to iterate over.
|
|
34424
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
34425
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
34426
|
+
* @returns {Object} Returns `object`.
|
|
34427
|
+
*/
|
|
34428
|
+
var baseFor = createBaseFor();
|
|
34429
|
+
|
|
34430
|
+
/**
|
|
34431
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
34432
|
+
*
|
|
34433
|
+
* @private
|
|
34434
|
+
* @param {*} value The value to query.
|
|
34435
|
+
* @returns {string} Returns the `toStringTag`.
|
|
34436
|
+
*/
|
|
34437
|
+
function baseGetTag(value) {
|
|
34438
|
+
if (value == null) {
|
|
34439
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
34440
|
+
}
|
|
34441
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
34442
|
+
? getRawTag(value)
|
|
34443
|
+
: objectToString(value);
|
|
34444
|
+
}
|
|
34445
|
+
|
|
34446
|
+
/**
|
|
34447
|
+
* The base implementation of `_.isArguments`.
|
|
34448
|
+
*
|
|
34449
|
+
* @private
|
|
34450
|
+
* @param {*} value The value to check.
|
|
34451
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
34452
|
+
*/
|
|
34453
|
+
function baseIsArguments(value) {
|
|
34454
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
|
34455
|
+
}
|
|
34456
|
+
|
|
34457
|
+
/**
|
|
34458
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
34459
|
+
*
|
|
34460
|
+
* @private
|
|
34461
|
+
* @param {*} value The value to check.
|
|
34462
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
34463
|
+
* else `false`.
|
|
34464
|
+
*/
|
|
34465
|
+
function baseIsNative(value) {
|
|
34466
|
+
if (!isObject(value) || isMasked(value)) {
|
|
34467
|
+
return false;
|
|
34468
|
+
}
|
|
34469
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
34470
|
+
return pattern.test(toSource(value));
|
|
34471
|
+
}
|
|
34472
|
+
|
|
34473
|
+
/**
|
|
34474
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
34475
|
+
*
|
|
34476
|
+
* @private
|
|
34477
|
+
* @param {*} value The value to check.
|
|
34478
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
34479
|
+
*/
|
|
34480
|
+
function baseIsTypedArray(value) {
|
|
34481
|
+
return isObjectLike(value) &&
|
|
34482
|
+
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
34483
|
+
}
|
|
34484
|
+
|
|
34485
|
+
/**
|
|
34486
|
+
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
34487
|
+
*
|
|
34488
|
+
* @private
|
|
34489
|
+
* @param {Object} object The object to query.
|
|
34490
|
+
* @returns {Array} Returns the array of property names.
|
|
34491
|
+
*/
|
|
34492
|
+
function baseKeysIn(object) {
|
|
34493
|
+
if (!isObject(object)) {
|
|
34494
|
+
return nativeKeysIn(object);
|
|
34495
|
+
}
|
|
34496
|
+
var isProto = isPrototype(object),
|
|
34497
|
+
result = [];
|
|
34498
|
+
|
|
34499
|
+
for (var key in object) {
|
|
34500
|
+
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
|
34501
|
+
result.push(key);
|
|
34502
|
+
}
|
|
34503
|
+
}
|
|
34504
|
+
return result;
|
|
34505
|
+
}
|
|
34506
|
+
|
|
34507
|
+
/**
|
|
34508
|
+
* The base implementation of `_.merge` without support for multiple sources.
|
|
34509
|
+
*
|
|
34510
|
+
* @private
|
|
34511
|
+
* @param {Object} object The destination object.
|
|
34512
|
+
* @param {Object} source The source object.
|
|
34513
|
+
* @param {number} srcIndex The index of `source`.
|
|
34514
|
+
* @param {Function} [customizer] The function to customize merged values.
|
|
34515
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
34516
|
+
* counterparts.
|
|
34517
|
+
*/
|
|
34518
|
+
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
34519
|
+
if (object === source) {
|
|
34520
|
+
return;
|
|
34521
|
+
}
|
|
34522
|
+
baseFor(source, function(srcValue, key) {
|
|
34523
|
+
stack || (stack = new Stack);
|
|
34524
|
+
if (isObject(srcValue)) {
|
|
34525
|
+
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
34526
|
+
}
|
|
34527
|
+
else {
|
|
34528
|
+
var newValue = customizer
|
|
34529
|
+
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
|
|
34530
|
+
: undefined;
|
|
34531
|
+
|
|
34532
|
+
if (newValue === undefined) {
|
|
34533
|
+
newValue = srcValue;
|
|
34534
|
+
}
|
|
34535
|
+
assignMergeValue(object, key, newValue);
|
|
34536
|
+
}
|
|
34537
|
+
}, keysIn);
|
|
34538
|
+
}
|
|
34539
|
+
|
|
34540
|
+
/**
|
|
34541
|
+
* A specialized version of `baseMerge` for arrays and objects which performs
|
|
34542
|
+
* deep merges and tracks traversed objects enabling objects with circular
|
|
34543
|
+
* references to be merged.
|
|
34544
|
+
*
|
|
34545
|
+
* @private
|
|
34546
|
+
* @param {Object} object The destination object.
|
|
34547
|
+
* @param {Object} source The source object.
|
|
34548
|
+
* @param {string} key The key of the value to merge.
|
|
34549
|
+
* @param {number} srcIndex The index of `source`.
|
|
34550
|
+
* @param {Function} mergeFunc The function to merge values.
|
|
34551
|
+
* @param {Function} [customizer] The function to customize assigned values.
|
|
34552
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
34553
|
+
* counterparts.
|
|
34554
|
+
*/
|
|
34555
|
+
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
34556
|
+
var objValue = safeGet(object, key),
|
|
34557
|
+
srcValue = safeGet(source, key),
|
|
34558
|
+
stacked = stack.get(srcValue);
|
|
34559
|
+
|
|
34560
|
+
if (stacked) {
|
|
34561
|
+
assignMergeValue(object, key, stacked);
|
|
34562
|
+
return;
|
|
34563
|
+
}
|
|
34564
|
+
var newValue = customizer
|
|
34565
|
+
? customizer(objValue, srcValue, (key + ''), object, source, stack)
|
|
34566
|
+
: undefined;
|
|
34567
|
+
|
|
34568
|
+
var isCommon = newValue === undefined;
|
|
34569
|
+
|
|
34570
|
+
if (isCommon) {
|
|
34571
|
+
var isArr = isArray(srcValue),
|
|
34572
|
+
isBuff = !isArr && isBuffer(srcValue),
|
|
34573
|
+
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
|
34574
|
+
|
|
34575
|
+
newValue = srcValue;
|
|
34576
|
+
if (isArr || isBuff || isTyped) {
|
|
34577
|
+
if (isArray(objValue)) {
|
|
34578
|
+
newValue = objValue;
|
|
34579
|
+
}
|
|
34580
|
+
else if (isArrayLikeObject(objValue)) {
|
|
34581
|
+
newValue = copyArray(objValue);
|
|
34582
|
+
}
|
|
34583
|
+
else if (isBuff) {
|
|
34584
|
+
isCommon = false;
|
|
34585
|
+
newValue = cloneBuffer(srcValue, true);
|
|
34586
|
+
}
|
|
34587
|
+
else if (isTyped) {
|
|
34588
|
+
isCommon = false;
|
|
34589
|
+
newValue = cloneTypedArray(srcValue, true);
|
|
34590
|
+
}
|
|
34591
|
+
else {
|
|
34592
|
+
newValue = [];
|
|
34593
|
+
}
|
|
34594
|
+
}
|
|
34595
|
+
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
|
34596
|
+
newValue = objValue;
|
|
34597
|
+
if (isArguments(objValue)) {
|
|
34598
|
+
newValue = toPlainObject(objValue);
|
|
34599
|
+
}
|
|
34600
|
+
else if (!isObject(objValue) || isFunction(objValue)) {
|
|
34601
|
+
newValue = initCloneObject(srcValue);
|
|
34602
|
+
}
|
|
34603
|
+
}
|
|
34604
|
+
else {
|
|
34605
|
+
isCommon = false;
|
|
34606
|
+
}
|
|
34607
|
+
}
|
|
34608
|
+
if (isCommon) {
|
|
34609
|
+
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
34610
|
+
stack.set(srcValue, newValue);
|
|
34611
|
+
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
|
34612
|
+
stack['delete'](srcValue);
|
|
34613
|
+
}
|
|
34614
|
+
assignMergeValue(object, key, newValue);
|
|
34615
|
+
}
|
|
34616
|
+
|
|
34617
|
+
/**
|
|
34618
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
34619
|
+
*
|
|
34620
|
+
* @private
|
|
34621
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
34622
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
34623
|
+
* @returns {Function} Returns the new function.
|
|
34624
|
+
*/
|
|
34625
|
+
function baseRest(func, start) {
|
|
34626
|
+
return setToString(overRest(func, start, identity), func + '');
|
|
34627
|
+
}
|
|
34628
|
+
|
|
34629
|
+
/**
|
|
34630
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
34631
|
+
*
|
|
34632
|
+
* @private
|
|
34633
|
+
* @param {Function} func The function to modify.
|
|
34634
|
+
* @param {Function} string The `toString` result.
|
|
34635
|
+
* @returns {Function} Returns `func`.
|
|
34636
|
+
*/
|
|
34637
|
+
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
|
34638
|
+
return defineProperty(func, 'toString', {
|
|
34639
|
+
'configurable': true,
|
|
34640
|
+
'enumerable': false,
|
|
34641
|
+
'value': constant(string),
|
|
34642
|
+
'writable': true
|
|
34643
|
+
});
|
|
34644
|
+
};
|
|
34645
|
+
|
|
34646
|
+
/**
|
|
34647
|
+
* Creates a clone of `buffer`.
|
|
34648
|
+
*
|
|
34649
|
+
* @private
|
|
34650
|
+
* @param {Buffer} buffer The buffer to clone.
|
|
34651
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
34652
|
+
* @returns {Buffer} Returns the cloned buffer.
|
|
34653
|
+
*/
|
|
34654
|
+
function cloneBuffer(buffer, isDeep) {
|
|
34655
|
+
if (isDeep) {
|
|
34656
|
+
return buffer.slice();
|
|
34657
|
+
}
|
|
34658
|
+
var length = buffer.length,
|
|
34659
|
+
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
34660
|
+
|
|
34661
|
+
buffer.copy(result);
|
|
34662
|
+
return result;
|
|
34663
|
+
}
|
|
34664
|
+
|
|
34665
|
+
/**
|
|
34666
|
+
* Creates a clone of `arrayBuffer`.
|
|
34667
|
+
*
|
|
34668
|
+
* @private
|
|
34669
|
+
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
34670
|
+
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
34671
|
+
*/
|
|
34672
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
34673
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
34674
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
34675
|
+
return result;
|
|
34676
|
+
}
|
|
34677
|
+
|
|
34678
|
+
/**
|
|
34679
|
+
* Creates a clone of `typedArray`.
|
|
34680
|
+
*
|
|
34681
|
+
* @private
|
|
34682
|
+
* @param {Object} typedArray The typed array to clone.
|
|
34683
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
34684
|
+
* @returns {Object} Returns the cloned typed array.
|
|
34685
|
+
*/
|
|
34686
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
34687
|
+
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
34688
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
34689
|
+
}
|
|
34690
|
+
|
|
34691
|
+
/**
|
|
34692
|
+
* Copies the values of `source` to `array`.
|
|
34693
|
+
*
|
|
34694
|
+
* @private
|
|
34695
|
+
* @param {Array} source The array to copy values from.
|
|
34696
|
+
* @param {Array} [array=[]] The array to copy values to.
|
|
34697
|
+
* @returns {Array} Returns `array`.
|
|
34698
|
+
*/
|
|
34699
|
+
function copyArray(source, array) {
|
|
34700
|
+
var index = -1,
|
|
34701
|
+
length = source.length;
|
|
34702
|
+
|
|
34703
|
+
array || (array = Array(length));
|
|
34704
|
+
while (++index < length) {
|
|
34705
|
+
array[index] = source[index];
|
|
34706
|
+
}
|
|
34707
|
+
return array;
|
|
34708
|
+
}
|
|
34709
|
+
|
|
34710
|
+
/**
|
|
34711
|
+
* Copies properties of `source` to `object`.
|
|
34712
|
+
*
|
|
34713
|
+
* @private
|
|
34714
|
+
* @param {Object} source The object to copy properties from.
|
|
34715
|
+
* @param {Array} props The property identifiers to copy.
|
|
34716
|
+
* @param {Object} [object={}] The object to copy properties to.
|
|
34717
|
+
* @param {Function} [customizer] The function to customize copied values.
|
|
34718
|
+
* @returns {Object} Returns `object`.
|
|
34719
|
+
*/
|
|
34720
|
+
function copyObject(source, props, object, customizer) {
|
|
34721
|
+
var isNew = !object;
|
|
34722
|
+
object || (object = {});
|
|
34723
|
+
|
|
34724
|
+
var index = -1,
|
|
34725
|
+
length = props.length;
|
|
34726
|
+
|
|
34727
|
+
while (++index < length) {
|
|
34728
|
+
var key = props[index];
|
|
34729
|
+
|
|
34730
|
+
var newValue = customizer
|
|
34731
|
+
? customizer(object[key], source[key], key, object, source)
|
|
34732
|
+
: undefined;
|
|
34733
|
+
|
|
34734
|
+
if (newValue === undefined) {
|
|
34735
|
+
newValue = source[key];
|
|
34736
|
+
}
|
|
34737
|
+
if (isNew) {
|
|
34738
|
+
baseAssignValue(object, key, newValue);
|
|
34739
|
+
} else {
|
|
34740
|
+
assignValue(object, key, newValue);
|
|
34741
|
+
}
|
|
34742
|
+
}
|
|
34743
|
+
return object;
|
|
34744
|
+
}
|
|
34745
|
+
|
|
34746
|
+
/**
|
|
34747
|
+
* Creates a function like `_.assign`.
|
|
34748
|
+
*
|
|
34749
|
+
* @private
|
|
34750
|
+
* @param {Function} assigner The function to assign values.
|
|
34751
|
+
* @returns {Function} Returns the new assigner function.
|
|
34752
|
+
*/
|
|
34753
|
+
function createAssigner(assigner) {
|
|
34754
|
+
return baseRest(function(object, sources) {
|
|
34755
|
+
var index = -1,
|
|
34756
|
+
length = sources.length,
|
|
34757
|
+
customizer = length > 1 ? sources[length - 1] : undefined,
|
|
34758
|
+
guard = length > 2 ? sources[2] : undefined;
|
|
34759
|
+
|
|
34760
|
+
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
|
34761
|
+
? (length--, customizer)
|
|
34762
|
+
: undefined;
|
|
34763
|
+
|
|
34764
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
34765
|
+
customizer = length < 3 ? undefined : customizer;
|
|
34766
|
+
length = 1;
|
|
34767
|
+
}
|
|
34768
|
+
object = Object(object);
|
|
34769
|
+
while (++index < length) {
|
|
34770
|
+
var source = sources[index];
|
|
34771
|
+
if (source) {
|
|
34772
|
+
assigner(object, source, index, customizer);
|
|
34773
|
+
}
|
|
34774
|
+
}
|
|
34775
|
+
return object;
|
|
34776
|
+
});
|
|
34777
|
+
}
|
|
34778
|
+
|
|
34779
|
+
/**
|
|
34780
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
34781
|
+
*
|
|
34782
|
+
* @private
|
|
34783
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
34784
|
+
* @returns {Function} Returns the new base function.
|
|
34785
|
+
*/
|
|
34786
|
+
function createBaseFor(fromRight) {
|
|
34787
|
+
return function(object, iteratee, keysFunc) {
|
|
34788
|
+
var index = -1,
|
|
34789
|
+
iterable = Object(object),
|
|
34790
|
+
props = keysFunc(object),
|
|
34791
|
+
length = props.length;
|
|
34792
|
+
|
|
34793
|
+
while (length--) {
|
|
34794
|
+
var key = props[fromRight ? length : ++index];
|
|
34795
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
34796
|
+
break;
|
|
34797
|
+
}
|
|
34798
|
+
}
|
|
34799
|
+
return object;
|
|
34800
|
+
};
|
|
34801
|
+
}
|
|
34802
|
+
|
|
34803
|
+
/**
|
|
34804
|
+
* Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
|
|
34805
|
+
* objects into destination objects that are passed thru.
|
|
34806
|
+
*
|
|
34807
|
+
* @private
|
|
34808
|
+
* @param {*} objValue The destination value.
|
|
34809
|
+
* @param {*} srcValue The source value.
|
|
34810
|
+
* @param {string} key The key of the property to merge.
|
|
34811
|
+
* @param {Object} object The parent object of `objValue`.
|
|
34812
|
+
* @param {Object} source The parent object of `srcValue`.
|
|
34813
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
34814
|
+
* counterparts.
|
|
34815
|
+
* @returns {*} Returns the value to assign.
|
|
34816
|
+
*/
|
|
34817
|
+
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
|
34818
|
+
if (isObject(objValue) && isObject(srcValue)) {
|
|
34819
|
+
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
34820
|
+
stack.set(srcValue, objValue);
|
|
34821
|
+
baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
|
|
34822
|
+
stack['delete'](srcValue);
|
|
34823
|
+
}
|
|
34824
|
+
return objValue;
|
|
34825
|
+
}
|
|
34826
|
+
|
|
34827
|
+
/**
|
|
34828
|
+
* Gets the data for `map`.
|
|
34829
|
+
*
|
|
34830
|
+
* @private
|
|
34831
|
+
* @param {Object} map The map to query.
|
|
34832
|
+
* @param {string} key The reference key.
|
|
34833
|
+
* @returns {*} Returns the map data.
|
|
34834
|
+
*/
|
|
34835
|
+
function getMapData(map, key) {
|
|
34836
|
+
var data = map.__data__;
|
|
34837
|
+
return isKeyable(key)
|
|
34838
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
34839
|
+
: data.map;
|
|
34840
|
+
}
|
|
34841
|
+
|
|
34842
|
+
/**
|
|
34843
|
+
* Gets the native function at `key` of `object`.
|
|
34844
|
+
*
|
|
34845
|
+
* @private
|
|
34846
|
+
* @param {Object} object The object to query.
|
|
34847
|
+
* @param {string} key The key of the method to get.
|
|
34848
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
34849
|
+
*/
|
|
34850
|
+
function getNative(object, key) {
|
|
34851
|
+
var value = getValue(object, key);
|
|
34852
|
+
return baseIsNative(value) ? value : undefined;
|
|
34853
|
+
}
|
|
34854
|
+
|
|
34855
|
+
/**
|
|
34856
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
34857
|
+
*
|
|
34858
|
+
* @private
|
|
34859
|
+
* @param {*} value The value to query.
|
|
34860
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
34861
|
+
*/
|
|
34862
|
+
function getRawTag(value) {
|
|
34863
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
34864
|
+
tag = value[symToStringTag];
|
|
34865
|
+
|
|
34866
|
+
try {
|
|
34867
|
+
value[symToStringTag] = undefined;
|
|
34868
|
+
var unmasked = true;
|
|
34869
|
+
} catch (e) {}
|
|
34870
|
+
|
|
34871
|
+
var result = nativeObjectToString.call(value);
|
|
34872
|
+
if (unmasked) {
|
|
34873
|
+
if (isOwn) {
|
|
34874
|
+
value[symToStringTag] = tag;
|
|
34875
|
+
} else {
|
|
34876
|
+
delete value[symToStringTag];
|
|
34877
|
+
}
|
|
34878
|
+
}
|
|
34879
|
+
return result;
|
|
34880
|
+
}
|
|
34881
|
+
|
|
34882
|
+
/**
|
|
34883
|
+
* Initializes an object clone.
|
|
34884
|
+
*
|
|
34885
|
+
* @private
|
|
34886
|
+
* @param {Object} object The object to clone.
|
|
34887
|
+
* @returns {Object} Returns the initialized clone.
|
|
34888
|
+
*/
|
|
34889
|
+
function initCloneObject(object) {
|
|
34890
|
+
return (typeof object.constructor == 'function' && !isPrototype(object))
|
|
34891
|
+
? baseCreate(getPrototype(object))
|
|
34892
|
+
: {};
|
|
34893
|
+
}
|
|
34894
|
+
|
|
34895
|
+
/**
|
|
34896
|
+
* Checks if `value` is a valid array-like index.
|
|
34897
|
+
*
|
|
34898
|
+
* @private
|
|
34899
|
+
* @param {*} value The value to check.
|
|
34900
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
34901
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
34902
|
+
*/
|
|
34903
|
+
function isIndex(value, length) {
|
|
34904
|
+
var type = typeof value;
|
|
34905
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
34906
|
+
|
|
34907
|
+
return !!length &&
|
|
34908
|
+
(type == 'number' ||
|
|
34909
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
|
34910
|
+
(value > -1 && value % 1 == 0 && value < length);
|
|
34911
|
+
}
|
|
34912
|
+
|
|
34913
|
+
/**
|
|
34914
|
+
* Checks if the given arguments are from an iteratee call.
|
|
34915
|
+
*
|
|
34916
|
+
* @private
|
|
34917
|
+
* @param {*} value The potential iteratee value argument.
|
|
34918
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
34919
|
+
* @param {*} object The potential iteratee object argument.
|
|
34920
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
34921
|
+
* else `false`.
|
|
34922
|
+
*/
|
|
34923
|
+
function isIterateeCall(value, index, object) {
|
|
34924
|
+
if (!isObject(object)) {
|
|
34925
|
+
return false;
|
|
34926
|
+
}
|
|
34927
|
+
var type = typeof index;
|
|
34928
|
+
if (type == 'number'
|
|
34929
|
+
? (isArrayLike(object) && isIndex(index, object.length))
|
|
34930
|
+
: (type == 'string' && index in object)
|
|
34931
|
+
) {
|
|
34932
|
+
return eq(object[index], value);
|
|
34933
|
+
}
|
|
34934
|
+
return false;
|
|
34935
|
+
}
|
|
34936
|
+
|
|
34937
|
+
/**
|
|
34938
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
34939
|
+
*
|
|
34940
|
+
* @private
|
|
34941
|
+
* @param {*} value The value to check.
|
|
34942
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
34943
|
+
*/
|
|
34944
|
+
function isKeyable(value) {
|
|
34945
|
+
var type = typeof value;
|
|
34946
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
34947
|
+
? (value !== '__proto__')
|
|
34948
|
+
: (value === null);
|
|
34949
|
+
}
|
|
34950
|
+
|
|
34951
|
+
/**
|
|
34952
|
+
* Checks if `func` has its source masked.
|
|
34953
|
+
*
|
|
34954
|
+
* @private
|
|
34955
|
+
* @param {Function} func The function to check.
|
|
34956
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
34957
|
+
*/
|
|
34958
|
+
function isMasked(func) {
|
|
34959
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
34960
|
+
}
|
|
34961
|
+
|
|
34962
|
+
/**
|
|
34963
|
+
* Checks if `value` is likely a prototype object.
|
|
34964
|
+
*
|
|
34965
|
+
* @private
|
|
34966
|
+
* @param {*} value The value to check.
|
|
34967
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
34968
|
+
*/
|
|
34969
|
+
function isPrototype(value) {
|
|
34970
|
+
var Ctor = value && value.constructor,
|
|
34971
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
|
34972
|
+
|
|
34973
|
+
return value === proto;
|
|
34974
|
+
}
|
|
34975
|
+
|
|
34976
|
+
/**
|
|
34977
|
+
* This function is like
|
|
34978
|
+
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
34979
|
+
* except that it includes inherited enumerable properties.
|
|
34980
|
+
*
|
|
34981
|
+
* @private
|
|
34982
|
+
* @param {Object} object The object to query.
|
|
34983
|
+
* @returns {Array} Returns the array of property names.
|
|
34984
|
+
*/
|
|
34985
|
+
function nativeKeysIn(object) {
|
|
34986
|
+
var result = [];
|
|
34987
|
+
if (object != null) {
|
|
34988
|
+
for (var key in Object(object)) {
|
|
34989
|
+
result.push(key);
|
|
34990
|
+
}
|
|
34991
|
+
}
|
|
34992
|
+
return result;
|
|
34993
|
+
}
|
|
34994
|
+
|
|
34995
|
+
/**
|
|
34996
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
34997
|
+
*
|
|
34998
|
+
* @private
|
|
34999
|
+
* @param {*} value The value to convert.
|
|
35000
|
+
* @returns {string} Returns the converted string.
|
|
35001
|
+
*/
|
|
35002
|
+
function objectToString(value) {
|
|
35003
|
+
return nativeObjectToString.call(value);
|
|
35004
|
+
}
|
|
35005
|
+
|
|
35006
|
+
/**
|
|
35007
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
35008
|
+
*
|
|
35009
|
+
* @private
|
|
35010
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
35011
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
35012
|
+
* @param {Function} transform The rest array transform.
|
|
35013
|
+
* @returns {Function} Returns the new function.
|
|
35014
|
+
*/
|
|
35015
|
+
function overRest(func, start, transform) {
|
|
35016
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
35017
|
+
return function() {
|
|
35018
|
+
var args = arguments,
|
|
35019
|
+
index = -1,
|
|
35020
|
+
length = nativeMax(args.length - start, 0),
|
|
35021
|
+
array = Array(length);
|
|
35022
|
+
|
|
35023
|
+
while (++index < length) {
|
|
35024
|
+
array[index] = args[start + index];
|
|
35025
|
+
}
|
|
35026
|
+
index = -1;
|
|
35027
|
+
var otherArgs = Array(start + 1);
|
|
35028
|
+
while (++index < start) {
|
|
35029
|
+
otherArgs[index] = args[index];
|
|
35030
|
+
}
|
|
35031
|
+
otherArgs[start] = transform(array);
|
|
35032
|
+
return apply(func, this, otherArgs);
|
|
35033
|
+
};
|
|
35034
|
+
}
|
|
35035
|
+
|
|
35036
|
+
/**
|
|
35037
|
+
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
|
|
35038
|
+
*
|
|
35039
|
+
* @private
|
|
35040
|
+
* @param {Object} object The object to query.
|
|
35041
|
+
* @param {string} key The key of the property to get.
|
|
35042
|
+
* @returns {*} Returns the property value.
|
|
35043
|
+
*/
|
|
35044
|
+
function safeGet(object, key) {
|
|
35045
|
+
if (key === 'constructor' && typeof object[key] === 'function') {
|
|
35046
|
+
return;
|
|
35047
|
+
}
|
|
35048
|
+
|
|
35049
|
+
if (key == '__proto__') {
|
|
35050
|
+
return;
|
|
35051
|
+
}
|
|
35052
|
+
|
|
35053
|
+
return object[key];
|
|
35054
|
+
}
|
|
35055
|
+
|
|
35056
|
+
/**
|
|
35057
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
35058
|
+
*
|
|
35059
|
+
* @private
|
|
35060
|
+
* @param {Function} func The function to modify.
|
|
35061
|
+
* @param {Function} string The `toString` result.
|
|
35062
|
+
* @returns {Function} Returns `func`.
|
|
35063
|
+
*/
|
|
35064
|
+
var setToString = shortOut(baseSetToString);
|
|
35065
|
+
|
|
35066
|
+
/**
|
|
35067
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
35068
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
35069
|
+
* milliseconds.
|
|
35070
|
+
*
|
|
35071
|
+
* @private
|
|
35072
|
+
* @param {Function} func The function to restrict.
|
|
35073
|
+
* @returns {Function} Returns the new shortable function.
|
|
35074
|
+
*/
|
|
35075
|
+
function shortOut(func) {
|
|
35076
|
+
var count = 0,
|
|
35077
|
+
lastCalled = 0;
|
|
35078
|
+
|
|
35079
|
+
return function() {
|
|
35080
|
+
var stamp = nativeNow(),
|
|
35081
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
35082
|
+
|
|
35083
|
+
lastCalled = stamp;
|
|
35084
|
+
if (remaining > 0) {
|
|
35085
|
+
if (++count >= HOT_COUNT) {
|
|
35086
|
+
return arguments[0];
|
|
35087
|
+
}
|
|
35088
|
+
} else {
|
|
35089
|
+
count = 0;
|
|
35090
|
+
}
|
|
35091
|
+
return func.apply(undefined, arguments);
|
|
35092
|
+
};
|
|
35093
|
+
}
|
|
35094
|
+
|
|
35095
|
+
/**
|
|
35096
|
+
* Converts `func` to its source code.
|
|
35097
|
+
*
|
|
35098
|
+
* @private
|
|
35099
|
+
* @param {Function} func The function to convert.
|
|
35100
|
+
* @returns {string} Returns the source code.
|
|
35101
|
+
*/
|
|
35102
|
+
function toSource(func) {
|
|
35103
|
+
if (func != null) {
|
|
35104
|
+
try {
|
|
35105
|
+
return funcToString.call(func);
|
|
35106
|
+
} catch (e) {}
|
|
35107
|
+
try {
|
|
35108
|
+
return (func + '');
|
|
35109
|
+
} catch (e) {}
|
|
35110
|
+
}
|
|
35111
|
+
return '';
|
|
35112
|
+
}
|
|
35113
|
+
|
|
35114
|
+
/**
|
|
35115
|
+
* Performs a
|
|
35116
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
35117
|
+
* comparison between two values to determine if they are equivalent.
|
|
35118
|
+
*
|
|
35119
|
+
* @static
|
|
35120
|
+
* @memberOf _
|
|
35121
|
+
* @since 4.0.0
|
|
35122
|
+
* @category Lang
|
|
35123
|
+
* @param {*} value The value to compare.
|
|
35124
|
+
* @param {*} other The other value to compare.
|
|
35125
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
35126
|
+
* @example
|
|
35127
|
+
*
|
|
35128
|
+
* var object = { 'a': 1 };
|
|
35129
|
+
* var other = { 'a': 1 };
|
|
35130
|
+
*
|
|
35131
|
+
* _.eq(object, object);
|
|
35132
|
+
* // => true
|
|
35133
|
+
*
|
|
35134
|
+
* _.eq(object, other);
|
|
35135
|
+
* // => false
|
|
35136
|
+
*
|
|
35137
|
+
* _.eq('a', 'a');
|
|
35138
|
+
* // => true
|
|
35139
|
+
*
|
|
35140
|
+
* _.eq('a', Object('a'));
|
|
35141
|
+
* // => false
|
|
35142
|
+
*
|
|
35143
|
+
* _.eq(NaN, NaN);
|
|
35144
|
+
* // => true
|
|
35145
|
+
*/
|
|
35146
|
+
function eq(value, other) {
|
|
35147
|
+
return value === other || (value !== value && other !== other);
|
|
35148
|
+
}
|
|
35149
|
+
|
|
35150
|
+
/**
|
|
35151
|
+
* Checks if `value` is likely an `arguments` object.
|
|
35152
|
+
*
|
|
35153
|
+
* @static
|
|
35154
|
+
* @memberOf _
|
|
35155
|
+
* @since 0.1.0
|
|
35156
|
+
* @category Lang
|
|
35157
|
+
* @param {*} value The value to check.
|
|
35158
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
35159
|
+
* else `false`.
|
|
35160
|
+
* @example
|
|
35161
|
+
*
|
|
35162
|
+
* _.isArguments(function() { return arguments; }());
|
|
35163
|
+
* // => true
|
|
35164
|
+
*
|
|
35165
|
+
* _.isArguments([1, 2, 3]);
|
|
35166
|
+
* // => false
|
|
35167
|
+
*/
|
|
35168
|
+
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
35169
|
+
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
|
35170
|
+
!propertyIsEnumerable.call(value, 'callee');
|
|
35171
|
+
};
|
|
35172
|
+
|
|
35173
|
+
/**
|
|
35174
|
+
* Checks if `value` is classified as an `Array` object.
|
|
35175
|
+
*
|
|
35176
|
+
* @static
|
|
35177
|
+
* @memberOf _
|
|
35178
|
+
* @since 0.1.0
|
|
35179
|
+
* @category Lang
|
|
35180
|
+
* @param {*} value The value to check.
|
|
35181
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
35182
|
+
* @example
|
|
35183
|
+
*
|
|
35184
|
+
* _.isArray([1, 2, 3]);
|
|
35185
|
+
* // => true
|
|
35186
|
+
*
|
|
35187
|
+
* _.isArray(document.body.children);
|
|
35188
|
+
* // => false
|
|
35189
|
+
*
|
|
35190
|
+
* _.isArray('abc');
|
|
35191
|
+
* // => false
|
|
35192
|
+
*
|
|
35193
|
+
* _.isArray(_.noop);
|
|
35194
|
+
* // => false
|
|
35195
|
+
*/
|
|
35196
|
+
var isArray = Array.isArray;
|
|
35197
|
+
|
|
35198
|
+
/**
|
|
35199
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
35200
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
35201
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
35202
|
+
*
|
|
35203
|
+
* @static
|
|
35204
|
+
* @memberOf _
|
|
35205
|
+
* @since 4.0.0
|
|
35206
|
+
* @category Lang
|
|
35207
|
+
* @param {*} value The value to check.
|
|
35208
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
35209
|
+
* @example
|
|
35210
|
+
*
|
|
35211
|
+
* _.isArrayLike([1, 2, 3]);
|
|
35212
|
+
* // => true
|
|
35213
|
+
*
|
|
35214
|
+
* _.isArrayLike(document.body.children);
|
|
35215
|
+
* // => true
|
|
35216
|
+
*
|
|
35217
|
+
* _.isArrayLike('abc');
|
|
35218
|
+
* // => true
|
|
35219
|
+
*
|
|
35220
|
+
* _.isArrayLike(_.noop);
|
|
35221
|
+
* // => false
|
|
35222
|
+
*/
|
|
35223
|
+
function isArrayLike(value) {
|
|
35224
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
35225
|
+
}
|
|
35226
|
+
|
|
35227
|
+
/**
|
|
35228
|
+
* This method is like `_.isArrayLike` except that it also checks if `value`
|
|
35229
|
+
* is an object.
|
|
35230
|
+
*
|
|
35231
|
+
* @static
|
|
35232
|
+
* @memberOf _
|
|
35233
|
+
* @since 4.0.0
|
|
35234
|
+
* @category Lang
|
|
35235
|
+
* @param {*} value The value to check.
|
|
35236
|
+
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
|
35237
|
+
* else `false`.
|
|
35238
|
+
* @example
|
|
35239
|
+
*
|
|
35240
|
+
* _.isArrayLikeObject([1, 2, 3]);
|
|
35241
|
+
* // => true
|
|
35242
|
+
*
|
|
35243
|
+
* _.isArrayLikeObject(document.body.children);
|
|
35244
|
+
* // => true
|
|
35245
|
+
*
|
|
35246
|
+
* _.isArrayLikeObject('abc');
|
|
35247
|
+
* // => false
|
|
35248
|
+
*
|
|
35249
|
+
* _.isArrayLikeObject(_.noop);
|
|
35250
|
+
* // => false
|
|
35251
|
+
*/
|
|
35252
|
+
function isArrayLikeObject(value) {
|
|
35253
|
+
return isObjectLike(value) && isArrayLike(value);
|
|
35254
|
+
}
|
|
35255
|
+
|
|
35256
|
+
/**
|
|
35257
|
+
* Checks if `value` is a buffer.
|
|
35258
|
+
*
|
|
35259
|
+
* @static
|
|
35260
|
+
* @memberOf _
|
|
35261
|
+
* @since 4.3.0
|
|
35262
|
+
* @category Lang
|
|
35263
|
+
* @param {*} value The value to check.
|
|
35264
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
35265
|
+
* @example
|
|
35266
|
+
*
|
|
35267
|
+
* _.isBuffer(new Buffer(2));
|
|
35268
|
+
* // => true
|
|
35269
|
+
*
|
|
35270
|
+
* _.isBuffer(new Uint8Array(2));
|
|
35271
|
+
* // => false
|
|
35272
|
+
*/
|
|
35273
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
35274
|
+
|
|
35275
|
+
/**
|
|
35276
|
+
* Checks if `value` is classified as a `Function` object.
|
|
35277
|
+
*
|
|
35278
|
+
* @static
|
|
35279
|
+
* @memberOf _
|
|
35280
|
+
* @since 0.1.0
|
|
35281
|
+
* @category Lang
|
|
35282
|
+
* @param {*} value The value to check.
|
|
35283
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
35284
|
+
* @example
|
|
35285
|
+
*
|
|
35286
|
+
* _.isFunction(_);
|
|
35287
|
+
* // => true
|
|
35288
|
+
*
|
|
35289
|
+
* _.isFunction(/abc/);
|
|
35290
|
+
* // => false
|
|
35291
|
+
*/
|
|
35292
|
+
function isFunction(value) {
|
|
35293
|
+
if (!isObject(value)) {
|
|
35294
|
+
return false;
|
|
35295
|
+
}
|
|
35296
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
35297
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
35298
|
+
var tag = baseGetTag(value);
|
|
35299
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
35300
|
+
}
|
|
35301
|
+
|
|
35302
|
+
/**
|
|
35303
|
+
* Checks if `value` is a valid array-like length.
|
|
35304
|
+
*
|
|
35305
|
+
* **Note:** This method is loosely based on
|
|
35306
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
35307
|
+
*
|
|
35308
|
+
* @static
|
|
35309
|
+
* @memberOf _
|
|
35310
|
+
* @since 4.0.0
|
|
35311
|
+
* @category Lang
|
|
35312
|
+
* @param {*} value The value to check.
|
|
35313
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
35314
|
+
* @example
|
|
35315
|
+
*
|
|
35316
|
+
* _.isLength(3);
|
|
35317
|
+
* // => true
|
|
35318
|
+
*
|
|
35319
|
+
* _.isLength(Number.MIN_VALUE);
|
|
35320
|
+
* // => false
|
|
35321
|
+
*
|
|
35322
|
+
* _.isLength(Infinity);
|
|
35323
|
+
* // => false
|
|
35324
|
+
*
|
|
35325
|
+
* _.isLength('3');
|
|
35326
|
+
* // => false
|
|
35327
|
+
*/
|
|
35328
|
+
function isLength(value) {
|
|
35329
|
+
return typeof value == 'number' &&
|
|
35330
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
35331
|
+
}
|
|
35332
|
+
|
|
35333
|
+
/**
|
|
35334
|
+
* Checks if `value` is the
|
|
35335
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
35336
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
35337
|
+
*
|
|
35338
|
+
* @static
|
|
35339
|
+
* @memberOf _
|
|
35340
|
+
* @since 0.1.0
|
|
35341
|
+
* @category Lang
|
|
35342
|
+
* @param {*} value The value to check.
|
|
35343
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
35344
|
+
* @example
|
|
35345
|
+
*
|
|
35346
|
+
* _.isObject({});
|
|
35347
|
+
* // => true
|
|
35348
|
+
*
|
|
35349
|
+
* _.isObject([1, 2, 3]);
|
|
35350
|
+
* // => true
|
|
35351
|
+
*
|
|
35352
|
+
* _.isObject(_.noop);
|
|
35353
|
+
* // => true
|
|
35354
|
+
*
|
|
35355
|
+
* _.isObject(null);
|
|
35356
|
+
* // => false
|
|
35357
|
+
*/
|
|
35358
|
+
function isObject(value) {
|
|
35359
|
+
var type = typeof value;
|
|
35360
|
+
return value != null && (type == 'object' || type == 'function');
|
|
35361
|
+
}
|
|
35362
|
+
|
|
35363
|
+
/**
|
|
35364
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
35365
|
+
* and has a `typeof` result of "object".
|
|
35366
|
+
*
|
|
35367
|
+
* @static
|
|
35368
|
+
* @memberOf _
|
|
35369
|
+
* @since 4.0.0
|
|
35370
|
+
* @category Lang
|
|
35371
|
+
* @param {*} value The value to check.
|
|
35372
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
35373
|
+
* @example
|
|
35374
|
+
*
|
|
35375
|
+
* _.isObjectLike({});
|
|
35376
|
+
* // => true
|
|
35377
|
+
*
|
|
35378
|
+
* _.isObjectLike([1, 2, 3]);
|
|
35379
|
+
* // => true
|
|
35380
|
+
*
|
|
35381
|
+
* _.isObjectLike(_.noop);
|
|
35382
|
+
* // => false
|
|
35383
|
+
*
|
|
35384
|
+
* _.isObjectLike(null);
|
|
35385
|
+
* // => false
|
|
35386
|
+
*/
|
|
35387
|
+
function isObjectLike(value) {
|
|
35388
|
+
return value != null && typeof value == 'object';
|
|
35389
|
+
}
|
|
35390
|
+
|
|
35391
|
+
/**
|
|
35392
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
35393
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
35394
|
+
*
|
|
35395
|
+
* @static
|
|
35396
|
+
* @memberOf _
|
|
35397
|
+
* @since 0.8.0
|
|
35398
|
+
* @category Lang
|
|
35399
|
+
* @param {*} value The value to check.
|
|
35400
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
35401
|
+
* @example
|
|
35402
|
+
*
|
|
35403
|
+
* function Foo() {
|
|
35404
|
+
* this.a = 1;
|
|
35405
|
+
* }
|
|
35406
|
+
*
|
|
35407
|
+
* _.isPlainObject(new Foo);
|
|
35408
|
+
* // => false
|
|
35409
|
+
*
|
|
35410
|
+
* _.isPlainObject([1, 2, 3]);
|
|
35411
|
+
* // => false
|
|
35412
|
+
*
|
|
35413
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
35414
|
+
* // => true
|
|
35415
|
+
*
|
|
35416
|
+
* _.isPlainObject(Object.create(null));
|
|
35417
|
+
* // => true
|
|
35418
|
+
*/
|
|
35419
|
+
function isPlainObject(value) {
|
|
35420
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
35421
|
+
return false;
|
|
35422
|
+
}
|
|
35423
|
+
var proto = getPrototype(value);
|
|
35424
|
+
if (proto === null) {
|
|
35425
|
+
return true;
|
|
35426
|
+
}
|
|
35427
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
35428
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
35429
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
35430
|
+
}
|
|
35431
|
+
|
|
35432
|
+
/**
|
|
35433
|
+
* Checks if `value` is classified as a typed array.
|
|
35434
|
+
*
|
|
35435
|
+
* @static
|
|
35436
|
+
* @memberOf _
|
|
35437
|
+
* @since 3.0.0
|
|
35438
|
+
* @category Lang
|
|
35439
|
+
* @param {*} value The value to check.
|
|
35440
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
35441
|
+
* @example
|
|
35442
|
+
*
|
|
35443
|
+
* _.isTypedArray(new Uint8Array);
|
|
35444
|
+
* // => true
|
|
35445
|
+
*
|
|
35446
|
+
* _.isTypedArray([]);
|
|
35447
|
+
* // => false
|
|
35448
|
+
*/
|
|
35449
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
35450
|
+
|
|
35451
|
+
/**
|
|
35452
|
+
* Converts `value` to a plain object flattening inherited enumerable string
|
|
35453
|
+
* keyed properties of `value` to own properties of the plain object.
|
|
35454
|
+
*
|
|
35455
|
+
* @static
|
|
35456
|
+
* @memberOf _
|
|
35457
|
+
* @since 3.0.0
|
|
35458
|
+
* @category Lang
|
|
35459
|
+
* @param {*} value The value to convert.
|
|
35460
|
+
* @returns {Object} Returns the converted plain object.
|
|
35461
|
+
* @example
|
|
35462
|
+
*
|
|
35463
|
+
* function Foo() {
|
|
35464
|
+
* this.b = 2;
|
|
35465
|
+
* }
|
|
35466
|
+
*
|
|
35467
|
+
* Foo.prototype.c = 3;
|
|
35468
|
+
*
|
|
35469
|
+
* _.assign({ 'a': 1 }, new Foo);
|
|
35470
|
+
* // => { 'a': 1, 'b': 2 }
|
|
35471
|
+
*
|
|
35472
|
+
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
|
|
35473
|
+
* // => { 'a': 1, 'b': 2, 'c': 3 }
|
|
35474
|
+
*/
|
|
35475
|
+
function toPlainObject(value) {
|
|
35476
|
+
return copyObject(value, keysIn(value));
|
|
35477
|
+
}
|
|
35478
|
+
|
|
35479
|
+
/**
|
|
35480
|
+
* This method is like `_.defaults` except that it recursively assigns
|
|
35481
|
+
* default properties.
|
|
35482
|
+
*
|
|
35483
|
+
* **Note:** This method mutates `object`.
|
|
35484
|
+
*
|
|
35485
|
+
* @static
|
|
35486
|
+
* @memberOf _
|
|
35487
|
+
* @since 3.10.0
|
|
35488
|
+
* @category Object
|
|
35489
|
+
* @param {Object} object The destination object.
|
|
35490
|
+
* @param {...Object} [sources] The source objects.
|
|
35491
|
+
* @returns {Object} Returns `object`.
|
|
35492
|
+
* @see _.defaults
|
|
35493
|
+
* @example
|
|
35494
|
+
*
|
|
35495
|
+
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
|
|
35496
|
+
* // => { 'a': { 'b': 2, 'c': 3 } }
|
|
35497
|
+
*/
|
|
35498
|
+
var defaultsDeep = baseRest(function(args) {
|
|
35499
|
+
args.push(undefined, customDefaultsMerge);
|
|
35500
|
+
return apply(mergeWith, undefined, args);
|
|
35501
|
+
});
|
|
35502
|
+
|
|
35503
|
+
/**
|
|
35504
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
35505
|
+
*
|
|
35506
|
+
* **Note:** Non-object values are coerced to objects.
|
|
35507
|
+
*
|
|
35508
|
+
* @static
|
|
35509
|
+
* @memberOf _
|
|
35510
|
+
* @since 3.0.0
|
|
35511
|
+
* @category Object
|
|
35512
|
+
* @param {Object} object The object to query.
|
|
35513
|
+
* @returns {Array} Returns the array of property names.
|
|
35514
|
+
* @example
|
|
35515
|
+
*
|
|
35516
|
+
* function Foo() {
|
|
35517
|
+
* this.a = 1;
|
|
35518
|
+
* this.b = 2;
|
|
35519
|
+
* }
|
|
35520
|
+
*
|
|
35521
|
+
* Foo.prototype.c = 3;
|
|
35522
|
+
*
|
|
35523
|
+
* _.keysIn(new Foo);
|
|
35524
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
35525
|
+
*/
|
|
35526
|
+
function keysIn(object) {
|
|
35527
|
+
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
35528
|
+
}
|
|
35529
|
+
|
|
35530
|
+
/**
|
|
35531
|
+
* This method is like `_.merge` except that it accepts `customizer` which
|
|
35532
|
+
* is invoked to produce the merged values of the destination and source
|
|
35533
|
+
* properties. If `customizer` returns `undefined`, merging is handled by the
|
|
35534
|
+
* method instead. The `customizer` is invoked with six arguments:
|
|
35535
|
+
* (objValue, srcValue, key, object, source, stack).
|
|
35536
|
+
*
|
|
35537
|
+
* **Note:** This method mutates `object`.
|
|
35538
|
+
*
|
|
35539
|
+
* @static
|
|
35540
|
+
* @memberOf _
|
|
35541
|
+
* @since 4.0.0
|
|
35542
|
+
* @category Object
|
|
35543
|
+
* @param {Object} object The destination object.
|
|
35544
|
+
* @param {...Object} sources The source objects.
|
|
35545
|
+
* @param {Function} customizer The function to customize assigned values.
|
|
35546
|
+
* @returns {Object} Returns `object`.
|
|
35547
|
+
* @example
|
|
35548
|
+
*
|
|
35549
|
+
* function customizer(objValue, srcValue) {
|
|
35550
|
+
* if (_.isArray(objValue)) {
|
|
35551
|
+
* return objValue.concat(srcValue);
|
|
35552
|
+
* }
|
|
35553
|
+
* }
|
|
35554
|
+
*
|
|
35555
|
+
* var object = { 'a': [1], 'b': [2] };
|
|
35556
|
+
* var other = { 'a': [3], 'b': [4] };
|
|
35557
|
+
*
|
|
35558
|
+
* _.mergeWith(object, other, customizer);
|
|
35559
|
+
* // => { 'a': [1, 3], 'b': [2, 4] }
|
|
35560
|
+
*/
|
|
35561
|
+
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
35562
|
+
baseMerge(object, source, srcIndex, customizer);
|
|
35563
|
+
});
|
|
35564
|
+
|
|
35565
|
+
/**
|
|
35566
|
+
* Creates a function that returns `value`.
|
|
35567
|
+
*
|
|
35568
|
+
* @static
|
|
35569
|
+
* @memberOf _
|
|
35570
|
+
* @since 2.4.0
|
|
35571
|
+
* @category Util
|
|
35572
|
+
* @param {*} value The value to return from the new function.
|
|
35573
|
+
* @returns {Function} Returns the new constant function.
|
|
35574
|
+
* @example
|
|
35575
|
+
*
|
|
35576
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
35577
|
+
*
|
|
35578
|
+
* console.log(objects);
|
|
35579
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
35580
|
+
*
|
|
35581
|
+
* console.log(objects[0] === objects[1]);
|
|
35582
|
+
* // => true
|
|
35583
|
+
*/
|
|
35584
|
+
function constant(value) {
|
|
35585
|
+
return function() {
|
|
35586
|
+
return value;
|
|
35587
|
+
};
|
|
35588
|
+
}
|
|
35589
|
+
|
|
35590
|
+
/**
|
|
35591
|
+
* This method returns the first argument it receives.
|
|
35592
|
+
*
|
|
35593
|
+
* @static
|
|
35594
|
+
* @since 0.1.0
|
|
35595
|
+
* @memberOf _
|
|
35596
|
+
* @category Util
|
|
35597
|
+
* @param {*} value Any value.
|
|
35598
|
+
* @returns {*} Returns `value`.
|
|
35599
|
+
* @example
|
|
35600
|
+
*
|
|
35601
|
+
* var object = { 'a': 1 };
|
|
35602
|
+
*
|
|
35603
|
+
* console.log(_.identity(object) === object);
|
|
35604
|
+
* // => true
|
|
35605
|
+
*/
|
|
35606
|
+
function identity(value) {
|
|
35607
|
+
return value;
|
|
35608
|
+
}
|
|
35609
|
+
|
|
35610
|
+
/**
|
|
35611
|
+
* This method returns `false`.
|
|
35612
|
+
*
|
|
35613
|
+
* @static
|
|
35614
|
+
* @memberOf _
|
|
35615
|
+
* @since 4.13.0
|
|
35616
|
+
* @category Util
|
|
35617
|
+
* @returns {boolean} Returns `false`.
|
|
35618
|
+
* @example
|
|
35619
|
+
*
|
|
35620
|
+
* _.times(2, _.stubFalse);
|
|
35621
|
+
* // => [false, false]
|
|
35622
|
+
*/
|
|
35623
|
+
function stubFalse() {
|
|
35624
|
+
return false;
|
|
35625
|
+
}
|
|
35626
|
+
|
|
35627
|
+
module.exports = defaultsDeep;
|
|
35628
|
+
} (lodash_defaultsdeep, lodash_defaultsdeep.exports));
|
|
35629
|
+
|
|
35630
|
+
var defaultsDeep = lodash_defaultsdeep.exports;
|
|
35631
|
+
|
|
33598
35632
|
let urlAlphabet =
|
|
33599
35633
|
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
33600
35634
|
|
|
@@ -38739,11 +40773,16 @@ var UnMemoizedReactionSelector = React__default["default"].forwardRef(function (
|
|
|
38739
40773
|
*/
|
|
38740
40774
|
var ReactionSelector = React__default["default"].memo(UnMemoizedReactionSelector);
|
|
38741
40775
|
|
|
40776
|
+
var defaultReactionsSort = function (a, b) {
|
|
40777
|
+
return a.reactionType.localeCompare(b.reactionType, 'en');
|
|
40778
|
+
};
|
|
38742
40779
|
var useProcessReactions = function (params) {
|
|
38743
|
-
var
|
|
38744
|
-
var
|
|
40780
|
+
var _a;
|
|
40781
|
+
var propOwnReactions = params.own_reactions, propReactionCounts = params.reaction_counts, propReactionOptions = params.reactionOptions, propReactions = params.reactions, propSortReactions = params.sortReactions;
|
|
40782
|
+
var _b = useMessageContext('useProcessReactions'), message = _b.message, contextSortReactions = _b.sortReactions;
|
|
38745
40783
|
var contextReactionOptions = useComponentContext('useProcessReactions').reactionOptions;
|
|
38746
40784
|
var reactionOptions = propReactionOptions !== null && propReactionOptions !== void 0 ? propReactionOptions : contextReactionOptions;
|
|
40785
|
+
var sortReactions = (_a = propSortReactions !== null && propSortReactions !== void 0 ? propSortReactions : contextSortReactions) !== null && _a !== void 0 ? _a : defaultReactionsSort;
|
|
38747
40786
|
var latestReactions = propReactions || message.latest_reactions;
|
|
38748
40787
|
var ownReactions = propOwnReactions || (message === null || message === void 0 ? void 0 : message.own_reactions);
|
|
38749
40788
|
var reactionCounts = propReactionCounts || message.reaction_counts;
|
|
@@ -38770,7 +40809,7 @@ var useProcessReactions = function (params) {
|
|
|
38770
40809
|
if (!reactionCounts) {
|
|
38771
40810
|
return [];
|
|
38772
40811
|
}
|
|
38773
|
-
|
|
40812
|
+
var unsortedReactions = Object.entries(reactionCounts).flatMap(function (_a) {
|
|
38774
40813
|
var reactionType = _a[0], reactionCount = _a[1];
|
|
38775
40814
|
if (reactionCount === 0 || !isSupportedReaction(reactionType)) {
|
|
38776
40815
|
return [];
|
|
@@ -38785,12 +40824,14 @@ var useProcessReactions = function (params) {
|
|
|
38785
40824
|
},
|
|
38786
40825
|
];
|
|
38787
40826
|
});
|
|
40827
|
+
return unsortedReactions.sort(sortReactions);
|
|
38788
40828
|
}, [
|
|
38789
40829
|
getEmojiByReactionType,
|
|
38790
40830
|
getLatestReactedUserNames,
|
|
38791
40831
|
isOwnReaction,
|
|
38792
40832
|
isSupportedReaction,
|
|
38793
40833
|
reactionCounts,
|
|
40834
|
+
sortReactions,
|
|
38794
40835
|
]);
|
|
38795
40836
|
var hasReactions = existingReactions.length > 0;
|
|
38796
40837
|
var totalReactionCount = React.useMemo(function () { return existingReactions.reduce(function (total, _a) {
|
|
@@ -38852,24 +40893,33 @@ function useFetchReactions(options) {
|
|
|
38852
40893
|
return { isLoading: isLoading, reactions: reactions };
|
|
38853
40894
|
}
|
|
38854
40895
|
|
|
40896
|
+
var defaultSortReactionDetails = function (a, b) {
|
|
40897
|
+
var _a, _b, _c, _d, _e, _f;
|
|
40898
|
+
var aName = (_b = (_a = a.user) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = a.user) === null || _c === void 0 ? void 0 : _c.id;
|
|
40899
|
+
var bName = (_e = (_d = b.user) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : (_f = b.user) === null || _f === void 0 ? void 0 : _f.id;
|
|
40900
|
+
return aName ? (bName ? aName.localeCompare(bName, 'en') : -1) : 1;
|
|
40901
|
+
};
|
|
38855
40902
|
function ReactionsListModal(_a) {
|
|
38856
|
-
var _b;
|
|
38857
|
-
var handleFetchReactions = _a.handleFetchReactions, onSelectedReactionTypeChange = _a.onSelectedReactionTypeChange, reactions = _a.reactions, selectedReactionType = _a.selectedReactionType, modalProps = __rest(_a, ["handleFetchReactions", "onSelectedReactionTypeChange", "reactions", "selectedReactionType"]);
|
|
40903
|
+
var _b, _c;
|
|
40904
|
+
var handleFetchReactions = _a.handleFetchReactions, onSelectedReactionTypeChange = _a.onSelectedReactionTypeChange, reactions = _a.reactions, selectedReactionType = _a.selectedReactionType, propSortReactionDetails = _a.sortReactionDetails, modalProps = __rest(_a, ["handleFetchReactions", "onSelectedReactionTypeChange", "reactions", "selectedReactionType", "sortReactionDetails"]);
|
|
38858
40905
|
var selectedReaction = reactions.find(function (_a) {
|
|
38859
40906
|
var reactionType = _a.reactionType;
|
|
38860
40907
|
return reactionType === selectedReactionType;
|
|
38861
40908
|
});
|
|
38862
40909
|
var SelectedEmojiComponent = (_b = selectedReaction === null || selectedReaction === void 0 ? void 0 : selectedReaction.EmojiComponent) !== null && _b !== void 0 ? _b : null;
|
|
38863
|
-
var
|
|
40910
|
+
var _d = useFetchReactions({
|
|
38864
40911
|
handleFetchReactions: handleFetchReactions,
|
|
38865
40912
|
shouldFetch: modalProps.open,
|
|
38866
|
-
}), areReactionsLoading =
|
|
40913
|
+
}), areReactionsLoading = _d.isLoading, allReactions = _d.reactions;
|
|
40914
|
+
var contextSortReactionDetails = useMessageContext('ReactionsListModal').sortReactionDetails;
|
|
40915
|
+
var sortReactionDetails = (_c = propSortReactionDetails !== null && propSortReactionDetails !== void 0 ? propSortReactionDetails : contextSortReactionDetails) !== null && _c !== void 0 ? _c : defaultSortReactionDetails;
|
|
38867
40916
|
var currentReactions = React.useMemo(function () {
|
|
38868
40917
|
if (!selectedReactionType) {
|
|
38869
40918
|
return [];
|
|
38870
40919
|
}
|
|
38871
|
-
|
|
38872
|
-
|
|
40920
|
+
var unsortedCurrentReactions = allReactions.filter(function (reaction) { return reaction.type === selectedReactionType && reaction.user; });
|
|
40921
|
+
return unsortedCurrentReactions.sort(sortReactionDetails);
|
|
40922
|
+
}, [allReactions, selectedReactionType, sortReactionDetails]);
|
|
38873
40923
|
return (React__default["default"].createElement(Modal, exports.__assign({}, modalProps),
|
|
38874
40924
|
React__default["default"].createElement("div", { className: 'str-chat__message-reactions-details', "data-testid": 'reactions-list-modal' },
|
|
38875
40925
|
React__default["default"].createElement("div", { className: 'str-chat__message-reactions-details-reaction-types' }, reactions.map(function (_a) {
|
|
@@ -39503,7 +41553,7 @@ function fetchMessageReactions(channel, messageId) {
|
|
|
39503
41553
|
}
|
|
39504
41554
|
|
|
39505
41555
|
var UnMemoizedReactionsList = function (props) {
|
|
39506
|
-
var handleFetchReactions = props.handleFetchReactions, _a = props.reverse, reverse = _a === void 0 ? false : _a, rest = __rest(props, ["handleFetchReactions", "reverse"]);
|
|
41556
|
+
var handleFetchReactions = props.handleFetchReactions, _a = props.reverse, reverse = _a === void 0 ? false : _a, sortReactionDetails = props.sortReactionDetails, rest = __rest(props, ["handleFetchReactions", "reverse", "sortReactionDetails"]);
|
|
39507
41557
|
var _b = useProcessReactions(rest), existingReactions = _b.existingReactions, hasReactions = _b.hasReactions, totalReactionCount = _b.totalReactionCount;
|
|
39508
41558
|
var _c = React.useState(null), selectedReactionType = _c[0], setSelectedReactionType = _c[1];
|
|
39509
41559
|
var t = useTranslationContext('ReactionsList').t;
|
|
@@ -39533,7 +41583,7 @@ var UnMemoizedReactionsList = function (props) {
|
|
|
39533
41583
|
}),
|
|
39534
41584
|
React__default["default"].createElement("li", null,
|
|
39535
41585
|
React__default["default"].createElement("span", { className: 'str-chat__reaction-list--counter' }, totalReactionCount)))),
|
|
39536
|
-
React__default["default"].createElement(ReactionsListModal, { handleFetchReactions: handleFetchReactions, onClose: function () { return setSelectedReactionType(null); }, onSelectedReactionTypeChange: setSelectedReactionType, open: selectedReactionType !== null, reactions: existingReactions, selectedReactionType: selectedReactionType })));
|
|
41586
|
+
React__default["default"].createElement(ReactionsListModal, { handleFetchReactions: handleFetchReactions, onClose: function () { return setSelectedReactionType(null); }, onSelectedReactionTypeChange: setSelectedReactionType, open: selectedReactionType !== null, reactions: existingReactions, selectedReactionType: selectedReactionType, sortReactionDetails: sortReactionDetails })));
|
|
39537
41587
|
};
|
|
39538
41588
|
/**
|
|
39539
41589
|
* Component that displays a list of reactions on a message.
|
|
@@ -39808,7 +41858,7 @@ var MemoizedMessage = React__default["default"].memo(MessageWithContext, areMess
|
|
|
39808
41858
|
* an individual message. The actual UI of the message is delegated via the Message prop on Channel.
|
|
39809
41859
|
*/
|
|
39810
41860
|
var Message = function (props) {
|
|
39811
|
-
var closeReactionSelectorOnClick = props.closeReactionSelectorOnClick, disableQuotedMessages = props.disableQuotedMessages, getDeleteMessageErrorNotification = props.getDeleteMessageErrorNotification, getFetchReactionsErrorNotification = props.getFetchReactionsErrorNotification, getFlagMessageErrorNotification = props.getFlagMessageErrorNotification, getFlagMessageSuccessNotification = props.getFlagMessageSuccessNotification, getMarkMessageUnreadErrorNotification = props.getMarkMessageUnreadErrorNotification, getMarkMessageUnreadSuccessNotification = props.getMarkMessageUnreadSuccessNotification, getMuteUserErrorNotification = props.getMuteUserErrorNotification, getMuteUserSuccessNotification = props.getMuteUserSuccessNotification, getPinMessageErrorNotification = props.getPinMessageErrorNotification, message = props.message, _a = props.onlySenderCanEdit, onlySenderCanEdit = _a === void 0 ? false : _a, propOnMentionsClick = props.onMentionsClick, propOnMentionsHover = props.onMentionsHover, propOpenThread = props.openThread, pinPermissions = props.pinPermissions, propRetrySendMessage = props.retrySendMessage;
|
|
41861
|
+
var closeReactionSelectorOnClick = props.closeReactionSelectorOnClick, disableQuotedMessages = props.disableQuotedMessages, getDeleteMessageErrorNotification = props.getDeleteMessageErrorNotification, getFetchReactionsErrorNotification = props.getFetchReactionsErrorNotification, getFlagMessageErrorNotification = props.getFlagMessageErrorNotification, getFlagMessageSuccessNotification = props.getFlagMessageSuccessNotification, getMarkMessageUnreadErrorNotification = props.getMarkMessageUnreadErrorNotification, getMarkMessageUnreadSuccessNotification = props.getMarkMessageUnreadSuccessNotification, getMuteUserErrorNotification = props.getMuteUserErrorNotification, getMuteUserSuccessNotification = props.getMuteUserSuccessNotification, getPinMessageErrorNotification = props.getPinMessageErrorNotification, message = props.message, _a = props.onlySenderCanEdit, onlySenderCanEdit = _a === void 0 ? false : _a, propOnMentionsClick = props.onMentionsClick, propOnMentionsHover = props.onMentionsHover, propOpenThread = props.openThread, pinPermissions = props.pinPermissions, propRetrySendMessage = props.retrySendMessage, sortReactionDetails = props.sortReactionDetails, sortReactions = props.sortReactions;
|
|
39812
41862
|
var addNotification = useChannelActionContext('Message').addNotification;
|
|
39813
41863
|
var _b = useChannelStateContext('Message'), highlightedMessageId = _b.highlightedMessageId, mutes = _b.mutes;
|
|
39814
41864
|
var reactionSelectorRef = React.useRef(null);
|
|
@@ -39850,7 +41900,7 @@ var Message = function (props) {
|
|
|
39850
41900
|
}), canPin = _d.canPin, handlePin = _d.handlePin;
|
|
39851
41901
|
var _e = useReactionClick(message, reactionSelectorRef, undefined, closeReactionSelectorOnClick), isReactionEnabled = _e.isReactionEnabled, onReactionListClick = _e.onReactionListClick, showDetailedReactions = _e.showDetailedReactions;
|
|
39852
41902
|
var highlighted = highlightedMessageId === message.id;
|
|
39853
|
-
return (React__default["default"].createElement(MemoizedMessage, { additionalMessageInputProps: props.additionalMessageInputProps, autoscrollToBottom: props.autoscrollToBottom, canPin: canPin, customMessageActions: props.customMessageActions, disableQuotedMessages: props.disableQuotedMessages, endOfGroup: props.endOfGroup, firstOfGroup: props.firstOfGroup, formatDate: props.formatDate, groupedByUser: props.groupedByUser, groupStyles: props.groupStyles, handleAction: handleAction, handleDelete: handleDelete, handleFetchReactions: handleFetchReactions, handleFlag: handleFlag, handleMarkUnread: handleMarkUnread, handleMute: handleMute, handleOpenThread: handleOpenThread, handlePin: handlePin, handleReaction: handleReaction, handleRetry: handleRetry, highlighted: highlighted, initialMessage: props.initialMessage, isReactionEnabled: isReactionEnabled, lastReceivedId: props.lastReceivedId, message: message, Message: props.Message, messageActions: props.messageActions, messageListRect: props.messageListRect, mutes: mutes, onMentionsClickMessage: onMentionsClick, onMentionsHoverMessage: onMentionsHover, onReactionListClick: onReactionListClick, onUserClick: props.onUserClick, onUserHover: props.onUserHover, pinPermissions: props.pinPermissions, reactionSelectorRef: reactionSelectorRef, readBy: props.readBy, renderText: props.renderText, showDetailedReactions: showDetailedReactions, threadList: props.threadList, unsafeHTML: props.unsafeHTML, userRoles: userRoles }));
|
|
41903
|
+
return (React__default["default"].createElement(MemoizedMessage, { additionalMessageInputProps: props.additionalMessageInputProps, autoscrollToBottom: props.autoscrollToBottom, canPin: canPin, customMessageActions: props.customMessageActions, disableQuotedMessages: props.disableQuotedMessages, endOfGroup: props.endOfGroup, firstOfGroup: props.firstOfGroup, formatDate: props.formatDate, groupedByUser: props.groupedByUser, groupStyles: props.groupStyles, handleAction: handleAction, handleDelete: handleDelete, handleFetchReactions: handleFetchReactions, handleFlag: handleFlag, handleMarkUnread: handleMarkUnread, handleMute: handleMute, handleOpenThread: handleOpenThread, handlePin: handlePin, handleReaction: handleReaction, handleRetry: handleRetry, highlighted: highlighted, initialMessage: props.initialMessage, isReactionEnabled: isReactionEnabled, lastReceivedId: props.lastReceivedId, message: message, Message: props.Message, messageActions: props.messageActions, messageListRect: props.messageListRect, mutes: mutes, onMentionsClickMessage: onMentionsClick, onMentionsHoverMessage: onMentionsHover, onReactionListClick: onReactionListClick, onUserClick: props.onUserClick, onUserHover: props.onUserHover, pinPermissions: props.pinPermissions, reactionSelectorRef: reactionSelectorRef, readBy: props.readBy, renderText: props.renderText, showDetailedReactions: showDetailedReactions, sortReactionDetails: sortReactionDetails, sortReactions: sortReactions, threadList: props.threadList, unsafeHTML: props.unsafeHTML, userRoles: userRoles }));
|
|
39854
41904
|
};
|
|
39855
41905
|
|
|
39856
41906
|
/* eslint-disable no-continue */
|
|
@@ -40584,7 +42634,12 @@ var UnMemoizedChannel = function (props) {
|
|
|
40584
42634
|
};
|
|
40585
42635
|
var ChannelInner = function (props) {
|
|
40586
42636
|
var _a;
|
|
40587
|
-
var acceptedFiles = props.acceptedFiles, activeUnreadHandler = props.activeUnreadHandler, channel = props.channel,
|
|
42637
|
+
var acceptedFiles = props.acceptedFiles, activeUnreadHandler = props.activeUnreadHandler, channel = props.channel, propChannelQueryOptions = props.channelQueryOptions, children = props.children, doDeleteMessageRequest = props.doDeleteMessageRequest, doMarkReadRequest = props.doMarkReadRequest, doSendMessageRequest = props.doSendMessageRequest, doUpdateMessageRequest = props.doUpdateMessageRequest, _b = props.dragAndDropWindow, dragAndDropWindow = _b === void 0 ? false : _b, enrichURLForPreviewConfig = props.enrichURLForPreviewConfig, _c = props.initializeOnMount, initializeOnMount = _c === void 0 ? true : _c, _d = props.LoadingErrorIndicator, LoadingErrorIndicator$1 = _d === void 0 ? LoadingErrorIndicator : _d, _e = props.LoadingIndicator, LoadingIndicator = _e === void 0 ? LoadingChannel : _e, _f = props.markReadOnMount, markReadOnMount = _f === void 0 ? true : _f, maxNumberOfFiles = props.maxNumberOfFiles, _g = props.multipleUploads, multipleUploads = _g === void 0 ? true : _g, onMentionsClick = props.onMentionsClick, onMentionsHover = props.onMentionsHover, _h = props.optionalMessageInputProps, optionalMessageInputProps = _h === void 0 ? {} : _h, skipMessageDataMemoization = props.skipMessageDataMemoization;
|
|
42638
|
+
var channelQueryOptions = React.useMemo(function () {
|
|
42639
|
+
return defaultsDeep(propChannelQueryOptions, {
|
|
42640
|
+
messages: { limit: DEFAULT_INITIAL_CHANNEL_PAGE_SIZE },
|
|
42641
|
+
});
|
|
42642
|
+
}, [propChannelQueryOptions]);
|
|
40588
42643
|
var _j = useChatContext('Channel'), client = _j.client, customClasses = _j.customClasses, latestMessageDatesByChannels = _j.latestMessageDatesByChannels, mutes = _j.mutes, theme = _j.theme;
|
|
40589
42644
|
var t = useTranslationContext('Channel').t;
|
|
40590
42645
|
var _k = useChannelContainerClasses({ customClasses: customClasses }), channelClass = _k.channelClass, chatClass = _k.chatClass, chatContainerClass = _k.chatContainerClass, windowsEmojiClass = _k.windowsEmojiClass;
|
|
@@ -40738,16 +42793,17 @@ var ChannelInner = function (props) {
|
|
|
40738
42793
|
React.useLayoutEffect(function () {
|
|
40739
42794
|
var errored = false;
|
|
40740
42795
|
var done = false;
|
|
42796
|
+
var channelInitializedExternally = true;
|
|
40741
42797
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
40742
42798
|
var members, _i, _a, member, userId, _b, user, user_id, config, e_2, _c, user, ownReadState;
|
|
40743
|
-
var _d, _e
|
|
40744
|
-
return __generator(this, function (
|
|
40745
|
-
switch (
|
|
42799
|
+
var _d, _e;
|
|
42800
|
+
return __generator(this, function (_f) {
|
|
42801
|
+
switch (_f.label) {
|
|
40746
42802
|
case 0:
|
|
40747
42803
|
if (!(!channel.initialized && initializeOnMount)) return [3 /*break*/, 4];
|
|
40748
|
-
|
|
42804
|
+
_f.label = 1;
|
|
40749
42805
|
case 1:
|
|
40750
|
-
|
|
42806
|
+
_f.trys.push([1, 3, , 4]);
|
|
40751
42807
|
members = [];
|
|
40752
42808
|
if (!channel.id && ((_d = channel.data) === null || _d === void 0 ? void 0 : _d.members)) {
|
|
40753
42809
|
for (_i = 0, _a = channel.data.members; _i < _a.length; _i++) {
|
|
@@ -40767,12 +42823,13 @@ var ChannelInner = function (props) {
|
|
|
40767
42823
|
}
|
|
40768
42824
|
return [4 /*yield*/, getChannel({ channel: channel, client: client, members: members, options: channelQueryOptions })];
|
|
40769
42825
|
case 2:
|
|
40770
|
-
|
|
42826
|
+
_f.sent();
|
|
40771
42827
|
config = channel.getConfig();
|
|
40772
42828
|
setChannelConfig(config);
|
|
42829
|
+
channelInitializedExternally = false;
|
|
40773
42830
|
return [3 /*break*/, 4];
|
|
40774
42831
|
case 3:
|
|
40775
|
-
e_2 =
|
|
42832
|
+
e_2 = _f.sent();
|
|
40776
42833
|
dispatch({ error: e_2, type: 'setError' });
|
|
40777
42834
|
errored = true;
|
|
40778
42835
|
return [3 /*break*/, 4];
|
|
@@ -40782,10 +42839,11 @@ var ChannelInner = function (props) {
|
|
|
40782
42839
|
if (!errored) {
|
|
40783
42840
|
dispatch({
|
|
40784
42841
|
channel: channel,
|
|
40785
|
-
hasMore:
|
|
42842
|
+
hasMore: channelInitializedExternally ||
|
|
42843
|
+
hasMoreMessagesProbably(channel.state.messages.length, channelQueryOptions.messages.limit),
|
|
40786
42844
|
type: 'initStateFromChannel',
|
|
40787
42845
|
});
|
|
40788
|
-
if (((
|
|
42846
|
+
if (((_e = client.user) === null || _e === void 0 ? void 0 : _e.id) && channel.state.read[client.user.id]) {
|
|
40789
42847
|
_c = channel.state.read[client.user.id], user = _c.user, ownReadState = __rest(_c, ["user"]);
|
|
40790
42848
|
_setChannelUnreadUiState(ownReadState);
|
|
40791
42849
|
}
|
|
@@ -41857,18 +43915,18 @@ var usePaginatedChannels = function (client, filters, sort, options, activeChann
|
|
|
41857
43915
|
if (queryType === void 0) { queryType = 'load-more'; }
|
|
41858
43916
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
41859
43917
|
var offset, newOptions, channelQueryResponse, newChannels, err_1;
|
|
41860
|
-
var _a;
|
|
41861
|
-
return __generator(this, function (
|
|
41862
|
-
switch (
|
|
43918
|
+
var _a, _b;
|
|
43919
|
+
return __generator(this, function (_c) {
|
|
43920
|
+
switch (_c.label) {
|
|
41863
43921
|
case 0:
|
|
41864
43922
|
setError(null);
|
|
41865
43923
|
if (queryType === 'reload') {
|
|
41866
43924
|
setChannels([]);
|
|
41867
43925
|
}
|
|
41868
43926
|
setQueryInProgress(queryType);
|
|
41869
|
-
|
|
43927
|
+
_c.label = 1;
|
|
41870
43928
|
case 1:
|
|
41871
|
-
|
|
43929
|
+
_c.trys.push([1, 6, , 7]);
|
|
41872
43930
|
if (!customQueryChannels) return [3 /*break*/, 3];
|
|
41873
43931
|
return [4 /*yield*/, customQueryChannels({
|
|
41874
43932
|
currentChannels: channels,
|
|
@@ -41877,14 +43935,14 @@ var usePaginatedChannels = function (client, filters, sort, options, activeChann
|
|
|
41877
43935
|
setHasNextPage: setHasNextPage,
|
|
41878
43936
|
})];
|
|
41879
43937
|
case 2:
|
|
41880
|
-
|
|
43938
|
+
_c.sent();
|
|
41881
43939
|
return [3 /*break*/, 5];
|
|
41882
43940
|
case 3:
|
|
41883
43941
|
offset = queryType === 'reload' ? 0 : channels.length;
|
|
41884
|
-
newOptions = exports.__assign({ limit: (_a = options === null || options === void 0 ? void 0 : options.limit) !== null && _a !== void 0 ? _a : MAX_QUERY_CHANNELS_LIMIT, offset: offset }, options);
|
|
43942
|
+
newOptions = exports.__assign({ limit: (_a = options === null || options === void 0 ? void 0 : options.limit) !== null && _a !== void 0 ? _a : MAX_QUERY_CHANNELS_LIMIT, message_limit: (_b = options === null || options === void 0 ? void 0 : options.message_limit) !== null && _b !== void 0 ? _b : DEFAULT_INITIAL_CHANNEL_PAGE_SIZE, offset: offset }, options);
|
|
41885
43943
|
return [4 /*yield*/, client.queryChannels(filters, sort || {}, newOptions)];
|
|
41886
43944
|
case 4:
|
|
41887
|
-
channelQueryResponse =
|
|
43945
|
+
channelQueryResponse = _c.sent();
|
|
41888
43946
|
newChannels = queryType === 'reload'
|
|
41889
43947
|
? channelQueryResponse
|
|
41890
43948
|
: uniqBy__default["default"](__spreadArray(__spreadArray([], channels, true), channelQueryResponse, true), 'cid');
|
|
@@ -41894,10 +43952,10 @@ var usePaginatedChannels = function (client, filters, sort, options, activeChann
|
|
|
41894
43952
|
if (!offset && activeChannelHandler) {
|
|
41895
43953
|
activeChannelHandler(newChannels, setChannels);
|
|
41896
43954
|
}
|
|
41897
|
-
|
|
43955
|
+
_c.label = 5;
|
|
41898
43956
|
case 5: return [3 /*break*/, 7];
|
|
41899
43957
|
case 6:
|
|
41900
|
-
err_1 =
|
|
43958
|
+
err_1 = _c.sent();
|
|
41901
43959
|
console.warn(err_1);
|
|
41902
43960
|
setError(err_1);
|
|
41903
43961
|
return [3 /*break*/, 7];
|
|
@@ -42740,6 +44798,7 @@ exports.ConnectionStatus = ConnectionStatus;
|
|
|
42740
44798
|
exports.CooldownTimer = CooldownTimer;
|
|
42741
44799
|
exports.CustomMessageActionsList = CustomMessageActionsList;
|
|
42742
44800
|
exports.CustomNotification = CustomNotification;
|
|
44801
|
+
exports.DEFAULT_NEXT_CHANNEL_PAGE_SIZE = DEFAULT_NEXT_CHANNEL_PAGE_SIZE;
|
|
42743
44802
|
exports.DateSeparator = DateSeparator;
|
|
42744
44803
|
exports.DefaultSuggestionListHeader = DefaultSuggestionListHeader;
|
|
42745
44804
|
exports.DefaultTriggerProvider = DefaultTriggerProvider;
|