pollination-react-io 0.0.1

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/build/index.js ADDED
@@ -0,0 +1,2256 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+
7
+ function styleInject(css, ref) {
8
+ if ( ref === void 0 ) ref = {};
9
+ var insertAt = ref.insertAt;
10
+
11
+ if (!css || typeof document === 'undefined') { return; }
12
+
13
+ var head = document.head || document.getElementsByTagName('head')[0];
14
+ var style = document.createElement('style');
15
+ style.type = 'text/css';
16
+
17
+ if (insertAt === 'top') {
18
+ if (head.firstChild) {
19
+ head.insertBefore(style, head.firstChild);
20
+ } else {
21
+ head.appendChild(style);
22
+ }
23
+ } else {
24
+ head.appendChild(style);
25
+ }
26
+
27
+ if (style.styleSheet) {
28
+ style.styleSheet.cssText = css;
29
+ } else {
30
+ style.appendChild(document.createTextNode(css));
31
+ }
32
+ }
33
+
34
+ var css_248z = ":root {\n --background: #fff;\n --font-color: #494949;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --background: #3c3c3c;\n --font-color: #fafafa;\n }\n}\n.test-component {\n background-color: var(--background);\n color: var(--font-color);\n border: 1px solid #131111;\n padding: 16px;\n width: 360px;\n text-align: center;\n}\n.test-component .heading {\n font-family: \"Avenir Next\", Helvetica, Arial, sans-serif;\n font-size: 40px;\n font-weight: bold;\n}";
35
+ styleInject(css_248z);
36
+
37
+ /*! *****************************************************************************
38
+ Copyright (c) Microsoft Corporation.
39
+
40
+ Permission to use, copy, modify, and/or distribute this software for any
41
+ purpose with or without fee is hereby granted.
42
+
43
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
44
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
45
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
46
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
47
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
48
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
49
+ PERFORMANCE OF THIS SOFTWARE.
50
+ ***************************************************************************** */
51
+
52
+ var __assign = function() {
53
+ __assign = Object.assign || function __assign(t) {
54
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
55
+ s = arguments[i];
56
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
57
+ }
58
+ return t;
59
+ };
60
+ return __assign.apply(this, arguments);
61
+ };
62
+
63
+ function __awaiter(thisArg, _arguments, P, generator) {
64
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
65
+ return new (P || (P = Promise))(function (resolve, reject) {
66
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
67
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
68
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
69
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
70
+ });
71
+ }
72
+
73
+ function __generator(thisArg, body) {
74
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
75
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
76
+ function verb(n) { return function (v) { return step([n, v]); }; }
77
+ function step(op) {
78
+ if (f) throw new TypeError("Generator is already executing.");
79
+ while (_) try {
80
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
81
+ if (y = 0, t) op = [op[0] & 2, t.value];
82
+ switch (op[0]) {
83
+ case 0: case 1: t = op; break;
84
+ case 4: _.label++; return { value: op[1], done: false };
85
+ case 5: _.label++; y = op[1]; op = [0]; continue;
86
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
87
+ default:
88
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
89
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
90
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
91
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
92
+ if (t[2]) _.ops.pop();
93
+ _.trys.pop(); continue;
94
+ }
95
+ op = body.call(thisArg, _);
96
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
97
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
98
+ }
99
+ }
100
+
101
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
102
+
103
+ function createCommonjsModule(fn) {
104
+ var module = { exports: {} };
105
+ return fn(module, module.exports), module.exports;
106
+ }
107
+
108
+ /**
109
+ * Lodash (Custom Build) <https://lodash.com/>
110
+ * Build: `lodash modularize exports="npm" -o ./`
111
+ * Copyright JS Foundation and other contributors <https://js.foundation/>
112
+ * Released under MIT license <https://lodash.com/license>
113
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
114
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
115
+ */
116
+
117
+ var lodash_isequal = createCommonjsModule(function (module, exports) {
118
+ /** Used as the size to enable large array optimizations. */
119
+ var LARGE_ARRAY_SIZE = 200;
120
+
121
+ /** Used to stand-in for `undefined` hash values. */
122
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
123
+
124
+ /** Used to compose bitmasks for value comparisons. */
125
+ var COMPARE_PARTIAL_FLAG = 1,
126
+ COMPARE_UNORDERED_FLAG = 2;
127
+
128
+ /** Used as references for various `Number` constants. */
129
+ var MAX_SAFE_INTEGER = 9007199254740991;
130
+
131
+ /** `Object#toString` result references. */
132
+ var argsTag = '[object Arguments]',
133
+ arrayTag = '[object Array]',
134
+ asyncTag = '[object AsyncFunction]',
135
+ boolTag = '[object Boolean]',
136
+ dateTag = '[object Date]',
137
+ errorTag = '[object Error]',
138
+ funcTag = '[object Function]',
139
+ genTag = '[object GeneratorFunction]',
140
+ mapTag = '[object Map]',
141
+ numberTag = '[object Number]',
142
+ nullTag = '[object Null]',
143
+ objectTag = '[object Object]',
144
+ promiseTag = '[object Promise]',
145
+ proxyTag = '[object Proxy]',
146
+ regexpTag = '[object RegExp]',
147
+ setTag = '[object Set]',
148
+ stringTag = '[object String]',
149
+ symbolTag = '[object Symbol]',
150
+ undefinedTag = '[object Undefined]',
151
+ weakMapTag = '[object WeakMap]';
152
+
153
+ var arrayBufferTag = '[object ArrayBuffer]',
154
+ dataViewTag = '[object DataView]',
155
+ float32Tag = '[object Float32Array]',
156
+ float64Tag = '[object Float64Array]',
157
+ int8Tag = '[object Int8Array]',
158
+ int16Tag = '[object Int16Array]',
159
+ int32Tag = '[object Int32Array]',
160
+ uint8Tag = '[object Uint8Array]',
161
+ uint8ClampedTag = '[object Uint8ClampedArray]',
162
+ uint16Tag = '[object Uint16Array]',
163
+ uint32Tag = '[object Uint32Array]';
164
+
165
+ /**
166
+ * Used to match `RegExp`
167
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
168
+ */
169
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
170
+
171
+ /** Used to detect host constructors (Safari). */
172
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
173
+
174
+ /** Used to detect unsigned integer values. */
175
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
176
+
177
+ /** Used to identify `toStringTag` values of typed arrays. */
178
+ var typedArrayTags = {};
179
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
180
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
181
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
182
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
183
+ typedArrayTags[uint32Tag] = true;
184
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
185
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
186
+ typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
187
+ typedArrayTags[errorTag] = typedArrayTags[funcTag] =
188
+ typedArrayTags[mapTag] = typedArrayTags[numberTag] =
189
+ typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
190
+ typedArrayTags[setTag] = typedArrayTags[stringTag] =
191
+ typedArrayTags[weakMapTag] = false;
192
+
193
+ /** Detect free variable `global` from Node.js. */
194
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
195
+
196
+ /** Detect free variable `self`. */
197
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
198
+
199
+ /** Used as a reference to the global object. */
200
+ var root = freeGlobal || freeSelf || Function('return this')();
201
+
202
+ /** Detect free variable `exports`. */
203
+ var freeExports = exports && !exports.nodeType && exports;
204
+
205
+ /** Detect free variable `module`. */
206
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
207
+
208
+ /** Detect the popular CommonJS extension `module.exports`. */
209
+ var moduleExports = freeModule && freeModule.exports === freeExports;
210
+
211
+ /** Detect free variable `process` from Node.js. */
212
+ var freeProcess = moduleExports && freeGlobal.process;
213
+
214
+ /** Used to access faster Node.js helpers. */
215
+ var nodeUtil = (function() {
216
+ try {
217
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
218
+ } catch (e) {}
219
+ }());
220
+
221
+ /* Node.js helper references. */
222
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
223
+
224
+ /**
225
+ * A specialized version of `_.filter` for arrays without support for
226
+ * iteratee shorthands.
227
+ *
228
+ * @private
229
+ * @param {Array} [array] The array to iterate over.
230
+ * @param {Function} predicate The function invoked per iteration.
231
+ * @returns {Array} Returns the new filtered array.
232
+ */
233
+ function arrayFilter(array, predicate) {
234
+ var index = -1,
235
+ length = array == null ? 0 : array.length,
236
+ resIndex = 0,
237
+ result = [];
238
+
239
+ while (++index < length) {
240
+ var value = array[index];
241
+ if (predicate(value, index, array)) {
242
+ result[resIndex++] = value;
243
+ }
244
+ }
245
+ return result;
246
+ }
247
+
248
+ /**
249
+ * Appends the elements of `values` to `array`.
250
+ *
251
+ * @private
252
+ * @param {Array} array The array to modify.
253
+ * @param {Array} values The values to append.
254
+ * @returns {Array} Returns `array`.
255
+ */
256
+ function arrayPush(array, values) {
257
+ var index = -1,
258
+ length = values.length,
259
+ offset = array.length;
260
+
261
+ while (++index < length) {
262
+ array[offset + index] = values[index];
263
+ }
264
+ return array;
265
+ }
266
+
267
+ /**
268
+ * A specialized version of `_.some` for arrays without support for iteratee
269
+ * shorthands.
270
+ *
271
+ * @private
272
+ * @param {Array} [array] The array to iterate over.
273
+ * @param {Function} predicate The function invoked per iteration.
274
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
275
+ * else `false`.
276
+ */
277
+ function arraySome(array, predicate) {
278
+ var index = -1,
279
+ length = array == null ? 0 : array.length;
280
+
281
+ while (++index < length) {
282
+ if (predicate(array[index], index, array)) {
283
+ return true;
284
+ }
285
+ }
286
+ return false;
287
+ }
288
+
289
+ /**
290
+ * The base implementation of `_.times` without support for iteratee shorthands
291
+ * or max array length checks.
292
+ *
293
+ * @private
294
+ * @param {number} n The number of times to invoke `iteratee`.
295
+ * @param {Function} iteratee The function invoked per iteration.
296
+ * @returns {Array} Returns the array of results.
297
+ */
298
+ function baseTimes(n, iteratee) {
299
+ var index = -1,
300
+ result = Array(n);
301
+
302
+ while (++index < n) {
303
+ result[index] = iteratee(index);
304
+ }
305
+ return result;
306
+ }
307
+
308
+ /**
309
+ * The base implementation of `_.unary` without support for storing metadata.
310
+ *
311
+ * @private
312
+ * @param {Function} func The function to cap arguments for.
313
+ * @returns {Function} Returns the new capped function.
314
+ */
315
+ function baseUnary(func) {
316
+ return function(value) {
317
+ return func(value);
318
+ };
319
+ }
320
+
321
+ /**
322
+ * Checks if a `cache` value for `key` exists.
323
+ *
324
+ * @private
325
+ * @param {Object} cache The cache to query.
326
+ * @param {string} key The key of the entry to check.
327
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
328
+ */
329
+ function cacheHas(cache, key) {
330
+ return cache.has(key);
331
+ }
332
+
333
+ /**
334
+ * Gets the value at `key` of `object`.
335
+ *
336
+ * @private
337
+ * @param {Object} [object] The object to query.
338
+ * @param {string} key The key of the property to get.
339
+ * @returns {*} Returns the property value.
340
+ */
341
+ function getValue(object, key) {
342
+ return object == null ? undefined : object[key];
343
+ }
344
+
345
+ /**
346
+ * Converts `map` to its key-value pairs.
347
+ *
348
+ * @private
349
+ * @param {Object} map The map to convert.
350
+ * @returns {Array} Returns the key-value pairs.
351
+ */
352
+ function mapToArray(map) {
353
+ var index = -1,
354
+ result = Array(map.size);
355
+
356
+ map.forEach(function(value, key) {
357
+ result[++index] = [key, value];
358
+ });
359
+ return result;
360
+ }
361
+
362
+ /**
363
+ * Creates a unary function that invokes `func` with its argument transformed.
364
+ *
365
+ * @private
366
+ * @param {Function} func The function to wrap.
367
+ * @param {Function} transform The argument transform.
368
+ * @returns {Function} Returns the new function.
369
+ */
370
+ function overArg(func, transform) {
371
+ return function(arg) {
372
+ return func(transform(arg));
373
+ };
374
+ }
375
+
376
+ /**
377
+ * Converts `set` to an array of its values.
378
+ *
379
+ * @private
380
+ * @param {Object} set The set to convert.
381
+ * @returns {Array} Returns the values.
382
+ */
383
+ function setToArray(set) {
384
+ var index = -1,
385
+ result = Array(set.size);
386
+
387
+ set.forEach(function(value) {
388
+ result[++index] = value;
389
+ });
390
+ return result;
391
+ }
392
+
393
+ /** Used for built-in method references. */
394
+ var arrayProto = Array.prototype,
395
+ funcProto = Function.prototype,
396
+ objectProto = Object.prototype;
397
+
398
+ /** Used to detect overreaching core-js shims. */
399
+ var coreJsData = root['__core-js_shared__'];
400
+
401
+ /** Used to resolve the decompiled source of functions. */
402
+ var funcToString = funcProto.toString;
403
+
404
+ /** Used to check objects for own properties. */
405
+ var hasOwnProperty = objectProto.hasOwnProperty;
406
+
407
+ /** Used to detect methods masquerading as native. */
408
+ var maskSrcKey = (function() {
409
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
410
+ return uid ? ('Symbol(src)_1.' + uid) : '';
411
+ }());
412
+
413
+ /**
414
+ * Used to resolve the
415
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
416
+ * of values.
417
+ */
418
+ var nativeObjectToString = objectProto.toString;
419
+
420
+ /** Used to detect if a method is native. */
421
+ var reIsNative = RegExp('^' +
422
+ funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
423
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
424
+ );
425
+
426
+ /** Built-in value references. */
427
+ var Buffer = moduleExports ? root.Buffer : undefined,
428
+ Symbol = root.Symbol,
429
+ Uint8Array = root.Uint8Array,
430
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
431
+ splice = arrayProto.splice,
432
+ symToStringTag = Symbol ? Symbol.toStringTag : undefined;
433
+
434
+ /* Built-in method references for those with the same name as other `lodash` methods. */
435
+ var nativeGetSymbols = Object.getOwnPropertySymbols,
436
+ nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
437
+ nativeKeys = overArg(Object.keys, Object);
438
+
439
+ /* Built-in method references that are verified to be native. */
440
+ var DataView = getNative(root, 'DataView'),
441
+ Map = getNative(root, 'Map'),
442
+ Promise = getNative(root, 'Promise'),
443
+ Set = getNative(root, 'Set'),
444
+ WeakMap = getNative(root, 'WeakMap'),
445
+ nativeCreate = getNative(Object, 'create');
446
+
447
+ /** Used to detect maps, sets, and weakmaps. */
448
+ var dataViewCtorString = toSource(DataView),
449
+ mapCtorString = toSource(Map),
450
+ promiseCtorString = toSource(Promise),
451
+ setCtorString = toSource(Set),
452
+ weakMapCtorString = toSource(WeakMap);
453
+
454
+ /** Used to convert symbols to primitives and strings. */
455
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
456
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
457
+
458
+ /**
459
+ * Creates a hash object.
460
+ *
461
+ * @private
462
+ * @constructor
463
+ * @param {Array} [entries] The key-value pairs to cache.
464
+ */
465
+ function Hash(entries) {
466
+ var index = -1,
467
+ length = entries == null ? 0 : entries.length;
468
+
469
+ this.clear();
470
+ while (++index < length) {
471
+ var entry = entries[index];
472
+ this.set(entry[0], entry[1]);
473
+ }
474
+ }
475
+
476
+ /**
477
+ * Removes all key-value entries from the hash.
478
+ *
479
+ * @private
480
+ * @name clear
481
+ * @memberOf Hash
482
+ */
483
+ function hashClear() {
484
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
485
+ this.size = 0;
486
+ }
487
+
488
+ /**
489
+ * Removes `key` and its value from the hash.
490
+ *
491
+ * @private
492
+ * @name delete
493
+ * @memberOf Hash
494
+ * @param {Object} hash The hash to modify.
495
+ * @param {string} key The key of the value to remove.
496
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
497
+ */
498
+ function hashDelete(key) {
499
+ var result = this.has(key) && delete this.__data__[key];
500
+ this.size -= result ? 1 : 0;
501
+ return result;
502
+ }
503
+
504
+ /**
505
+ * Gets the hash value for `key`.
506
+ *
507
+ * @private
508
+ * @name get
509
+ * @memberOf Hash
510
+ * @param {string} key The key of the value to get.
511
+ * @returns {*} Returns the entry value.
512
+ */
513
+ function hashGet(key) {
514
+ var data = this.__data__;
515
+ if (nativeCreate) {
516
+ var result = data[key];
517
+ return result === HASH_UNDEFINED ? undefined : result;
518
+ }
519
+ return hasOwnProperty.call(data, key) ? data[key] : undefined;
520
+ }
521
+
522
+ /**
523
+ * Checks if a hash value for `key` exists.
524
+ *
525
+ * @private
526
+ * @name has
527
+ * @memberOf Hash
528
+ * @param {string} key The key of the entry to check.
529
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
530
+ */
531
+ function hashHas(key) {
532
+ var data = this.__data__;
533
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
534
+ }
535
+
536
+ /**
537
+ * Sets the hash `key` to `value`.
538
+ *
539
+ * @private
540
+ * @name set
541
+ * @memberOf Hash
542
+ * @param {string} key The key of the value to set.
543
+ * @param {*} value The value to set.
544
+ * @returns {Object} Returns the hash instance.
545
+ */
546
+ function hashSet(key, value) {
547
+ var data = this.__data__;
548
+ this.size += this.has(key) ? 0 : 1;
549
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
550
+ return this;
551
+ }
552
+
553
+ // Add methods to `Hash`.
554
+ Hash.prototype.clear = hashClear;
555
+ Hash.prototype['delete'] = hashDelete;
556
+ Hash.prototype.get = hashGet;
557
+ Hash.prototype.has = hashHas;
558
+ Hash.prototype.set = hashSet;
559
+
560
+ /**
561
+ * Creates an list cache object.
562
+ *
563
+ * @private
564
+ * @constructor
565
+ * @param {Array} [entries] The key-value pairs to cache.
566
+ */
567
+ function ListCache(entries) {
568
+ var index = -1,
569
+ length = entries == null ? 0 : entries.length;
570
+
571
+ this.clear();
572
+ while (++index < length) {
573
+ var entry = entries[index];
574
+ this.set(entry[0], entry[1]);
575
+ }
576
+ }
577
+
578
+ /**
579
+ * Removes all key-value entries from the list cache.
580
+ *
581
+ * @private
582
+ * @name clear
583
+ * @memberOf ListCache
584
+ */
585
+ function listCacheClear() {
586
+ this.__data__ = [];
587
+ this.size = 0;
588
+ }
589
+
590
+ /**
591
+ * Removes `key` and its value from the list cache.
592
+ *
593
+ * @private
594
+ * @name delete
595
+ * @memberOf ListCache
596
+ * @param {string} key The key of the value to remove.
597
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
598
+ */
599
+ function listCacheDelete(key) {
600
+ var data = this.__data__,
601
+ index = assocIndexOf(data, key);
602
+
603
+ if (index < 0) {
604
+ return false;
605
+ }
606
+ var lastIndex = data.length - 1;
607
+ if (index == lastIndex) {
608
+ data.pop();
609
+ } else {
610
+ splice.call(data, index, 1);
611
+ }
612
+ --this.size;
613
+ return true;
614
+ }
615
+
616
+ /**
617
+ * Gets the list cache value for `key`.
618
+ *
619
+ * @private
620
+ * @name get
621
+ * @memberOf ListCache
622
+ * @param {string} key The key of the value to get.
623
+ * @returns {*} Returns the entry value.
624
+ */
625
+ function listCacheGet(key) {
626
+ var data = this.__data__,
627
+ index = assocIndexOf(data, key);
628
+
629
+ return index < 0 ? undefined : data[index][1];
630
+ }
631
+
632
+ /**
633
+ * Checks if a list cache value for `key` exists.
634
+ *
635
+ * @private
636
+ * @name has
637
+ * @memberOf ListCache
638
+ * @param {string} key The key of the entry to check.
639
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
640
+ */
641
+ function listCacheHas(key) {
642
+ return assocIndexOf(this.__data__, key) > -1;
643
+ }
644
+
645
+ /**
646
+ * Sets the list cache `key` to `value`.
647
+ *
648
+ * @private
649
+ * @name set
650
+ * @memberOf ListCache
651
+ * @param {string} key The key of the value to set.
652
+ * @param {*} value The value to set.
653
+ * @returns {Object} Returns the list cache instance.
654
+ */
655
+ function listCacheSet(key, value) {
656
+ var data = this.__data__,
657
+ index = assocIndexOf(data, key);
658
+
659
+ if (index < 0) {
660
+ ++this.size;
661
+ data.push([key, value]);
662
+ } else {
663
+ data[index][1] = value;
664
+ }
665
+ return this;
666
+ }
667
+
668
+ // Add methods to `ListCache`.
669
+ ListCache.prototype.clear = listCacheClear;
670
+ ListCache.prototype['delete'] = listCacheDelete;
671
+ ListCache.prototype.get = listCacheGet;
672
+ ListCache.prototype.has = listCacheHas;
673
+ ListCache.prototype.set = listCacheSet;
674
+
675
+ /**
676
+ * Creates a map cache object to store key-value pairs.
677
+ *
678
+ * @private
679
+ * @constructor
680
+ * @param {Array} [entries] The key-value pairs to cache.
681
+ */
682
+ function MapCache(entries) {
683
+ var index = -1,
684
+ length = entries == null ? 0 : entries.length;
685
+
686
+ this.clear();
687
+ while (++index < length) {
688
+ var entry = entries[index];
689
+ this.set(entry[0], entry[1]);
690
+ }
691
+ }
692
+
693
+ /**
694
+ * Removes all key-value entries from the map.
695
+ *
696
+ * @private
697
+ * @name clear
698
+ * @memberOf MapCache
699
+ */
700
+ function mapCacheClear() {
701
+ this.size = 0;
702
+ this.__data__ = {
703
+ 'hash': new Hash,
704
+ 'map': new (Map || ListCache),
705
+ 'string': new Hash
706
+ };
707
+ }
708
+
709
+ /**
710
+ * Removes `key` and its value from the map.
711
+ *
712
+ * @private
713
+ * @name delete
714
+ * @memberOf MapCache
715
+ * @param {string} key The key of the value to remove.
716
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
717
+ */
718
+ function mapCacheDelete(key) {
719
+ var result = getMapData(this, key)['delete'](key);
720
+ this.size -= result ? 1 : 0;
721
+ return result;
722
+ }
723
+
724
+ /**
725
+ * Gets the map value for `key`.
726
+ *
727
+ * @private
728
+ * @name get
729
+ * @memberOf MapCache
730
+ * @param {string} key The key of the value to get.
731
+ * @returns {*} Returns the entry value.
732
+ */
733
+ function mapCacheGet(key) {
734
+ return getMapData(this, key).get(key);
735
+ }
736
+
737
+ /**
738
+ * Checks if a map value for `key` exists.
739
+ *
740
+ * @private
741
+ * @name has
742
+ * @memberOf MapCache
743
+ * @param {string} key The key of the entry to check.
744
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
745
+ */
746
+ function mapCacheHas(key) {
747
+ return getMapData(this, key).has(key);
748
+ }
749
+
750
+ /**
751
+ * Sets the map `key` to `value`.
752
+ *
753
+ * @private
754
+ * @name set
755
+ * @memberOf MapCache
756
+ * @param {string} key The key of the value to set.
757
+ * @param {*} value The value to set.
758
+ * @returns {Object} Returns the map cache instance.
759
+ */
760
+ function mapCacheSet(key, value) {
761
+ var data = getMapData(this, key),
762
+ size = data.size;
763
+
764
+ data.set(key, value);
765
+ this.size += data.size == size ? 0 : 1;
766
+ return this;
767
+ }
768
+
769
+ // Add methods to `MapCache`.
770
+ MapCache.prototype.clear = mapCacheClear;
771
+ MapCache.prototype['delete'] = mapCacheDelete;
772
+ MapCache.prototype.get = mapCacheGet;
773
+ MapCache.prototype.has = mapCacheHas;
774
+ MapCache.prototype.set = mapCacheSet;
775
+
776
+ /**
777
+ *
778
+ * Creates an array cache object to store unique values.
779
+ *
780
+ * @private
781
+ * @constructor
782
+ * @param {Array} [values] The values to cache.
783
+ */
784
+ function SetCache(values) {
785
+ var index = -1,
786
+ length = values == null ? 0 : values.length;
787
+
788
+ this.__data__ = new MapCache;
789
+ while (++index < length) {
790
+ this.add(values[index]);
791
+ }
792
+ }
793
+
794
+ /**
795
+ * Adds `value` to the array cache.
796
+ *
797
+ * @private
798
+ * @name add
799
+ * @memberOf SetCache
800
+ * @alias push
801
+ * @param {*} value The value to cache.
802
+ * @returns {Object} Returns the cache instance.
803
+ */
804
+ function setCacheAdd(value) {
805
+ this.__data__.set(value, HASH_UNDEFINED);
806
+ return this;
807
+ }
808
+
809
+ /**
810
+ * Checks if `value` is in the array cache.
811
+ *
812
+ * @private
813
+ * @name has
814
+ * @memberOf SetCache
815
+ * @param {*} value The value to search for.
816
+ * @returns {number} Returns `true` if `value` is found, else `false`.
817
+ */
818
+ function setCacheHas(value) {
819
+ return this.__data__.has(value);
820
+ }
821
+
822
+ // Add methods to `SetCache`.
823
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
824
+ SetCache.prototype.has = setCacheHas;
825
+
826
+ /**
827
+ * Creates a stack cache object to store key-value pairs.
828
+ *
829
+ * @private
830
+ * @constructor
831
+ * @param {Array} [entries] The key-value pairs to cache.
832
+ */
833
+ function Stack(entries) {
834
+ var data = this.__data__ = new ListCache(entries);
835
+ this.size = data.size;
836
+ }
837
+
838
+ /**
839
+ * Removes all key-value entries from the stack.
840
+ *
841
+ * @private
842
+ * @name clear
843
+ * @memberOf Stack
844
+ */
845
+ function stackClear() {
846
+ this.__data__ = new ListCache;
847
+ this.size = 0;
848
+ }
849
+
850
+ /**
851
+ * Removes `key` and its value from the stack.
852
+ *
853
+ * @private
854
+ * @name delete
855
+ * @memberOf Stack
856
+ * @param {string} key The key of the value to remove.
857
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
858
+ */
859
+ function stackDelete(key) {
860
+ var data = this.__data__,
861
+ result = data['delete'](key);
862
+
863
+ this.size = data.size;
864
+ return result;
865
+ }
866
+
867
+ /**
868
+ * Gets the stack value for `key`.
869
+ *
870
+ * @private
871
+ * @name get
872
+ * @memberOf Stack
873
+ * @param {string} key The key of the value to get.
874
+ * @returns {*} Returns the entry value.
875
+ */
876
+ function stackGet(key) {
877
+ return this.__data__.get(key);
878
+ }
879
+
880
+ /**
881
+ * Checks if a stack value for `key` exists.
882
+ *
883
+ * @private
884
+ * @name has
885
+ * @memberOf Stack
886
+ * @param {string} key The key of the entry to check.
887
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
888
+ */
889
+ function stackHas(key) {
890
+ return this.__data__.has(key);
891
+ }
892
+
893
+ /**
894
+ * Sets the stack `key` to `value`.
895
+ *
896
+ * @private
897
+ * @name set
898
+ * @memberOf Stack
899
+ * @param {string} key The key of the value to set.
900
+ * @param {*} value The value to set.
901
+ * @returns {Object} Returns the stack cache instance.
902
+ */
903
+ function stackSet(key, value) {
904
+ var data = this.__data__;
905
+ if (data instanceof ListCache) {
906
+ var pairs = data.__data__;
907
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
908
+ pairs.push([key, value]);
909
+ this.size = ++data.size;
910
+ return this;
911
+ }
912
+ data = this.__data__ = new MapCache(pairs);
913
+ }
914
+ data.set(key, value);
915
+ this.size = data.size;
916
+ return this;
917
+ }
918
+
919
+ // Add methods to `Stack`.
920
+ Stack.prototype.clear = stackClear;
921
+ Stack.prototype['delete'] = stackDelete;
922
+ Stack.prototype.get = stackGet;
923
+ Stack.prototype.has = stackHas;
924
+ Stack.prototype.set = stackSet;
925
+
926
+ /**
927
+ * Creates an array of the enumerable property names of the array-like `value`.
928
+ *
929
+ * @private
930
+ * @param {*} value The value to query.
931
+ * @param {boolean} inherited Specify returning inherited property names.
932
+ * @returns {Array} Returns the array of property names.
933
+ */
934
+ function arrayLikeKeys(value, inherited) {
935
+ var isArr = isArray(value),
936
+ isArg = !isArr && isArguments(value),
937
+ isBuff = !isArr && !isArg && isBuffer(value),
938
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
939
+ skipIndexes = isArr || isArg || isBuff || isType,
940
+ result = skipIndexes ? baseTimes(value.length, String) : [],
941
+ length = result.length;
942
+
943
+ for (var key in value) {
944
+ if ((inherited || hasOwnProperty.call(value, key)) &&
945
+ !(skipIndexes && (
946
+ // Safari 9 has enumerable `arguments.length` in strict mode.
947
+ key == 'length' ||
948
+ // Node.js 0.10 has enumerable non-index properties on buffers.
949
+ (isBuff && (key == 'offset' || key == 'parent')) ||
950
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
951
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
952
+ // Skip index properties.
953
+ isIndex(key, length)
954
+ ))) {
955
+ result.push(key);
956
+ }
957
+ }
958
+ return result;
959
+ }
960
+
961
+ /**
962
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
963
+ *
964
+ * @private
965
+ * @param {Array} array The array to inspect.
966
+ * @param {*} key The key to search for.
967
+ * @returns {number} Returns the index of the matched value, else `-1`.
968
+ */
969
+ function assocIndexOf(array, key) {
970
+ var length = array.length;
971
+ while (length--) {
972
+ if (eq(array[length][0], key)) {
973
+ return length;
974
+ }
975
+ }
976
+ return -1;
977
+ }
978
+
979
+ /**
980
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
981
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
982
+ * symbols of `object`.
983
+ *
984
+ * @private
985
+ * @param {Object} object The object to query.
986
+ * @param {Function} keysFunc The function to get the keys of `object`.
987
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
988
+ * @returns {Array} Returns the array of property names and symbols.
989
+ */
990
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
991
+ var result = keysFunc(object);
992
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
993
+ }
994
+
995
+ /**
996
+ * The base implementation of `getTag` without fallbacks for buggy environments.
997
+ *
998
+ * @private
999
+ * @param {*} value The value to query.
1000
+ * @returns {string} Returns the `toStringTag`.
1001
+ */
1002
+ function baseGetTag(value) {
1003
+ if (value == null) {
1004
+ return value === undefined ? undefinedTag : nullTag;
1005
+ }
1006
+ return (symToStringTag && symToStringTag in Object(value))
1007
+ ? getRawTag(value)
1008
+ : objectToString(value);
1009
+ }
1010
+
1011
+ /**
1012
+ * The base implementation of `_.isArguments`.
1013
+ *
1014
+ * @private
1015
+ * @param {*} value The value to check.
1016
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1017
+ */
1018
+ function baseIsArguments(value) {
1019
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
1020
+ }
1021
+
1022
+ /**
1023
+ * The base implementation of `_.isEqual` which supports partial comparisons
1024
+ * and tracks traversed objects.
1025
+ *
1026
+ * @private
1027
+ * @param {*} value The value to compare.
1028
+ * @param {*} other The other value to compare.
1029
+ * @param {boolean} bitmask The bitmask flags.
1030
+ * 1 - Unordered comparison
1031
+ * 2 - Partial comparison
1032
+ * @param {Function} [customizer] The function to customize comparisons.
1033
+ * @param {Object} [stack] Tracks traversed `value` and `other` objects.
1034
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1035
+ */
1036
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
1037
+ if (value === other) {
1038
+ return true;
1039
+ }
1040
+ if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
1041
+ return value !== value && other !== other;
1042
+ }
1043
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
1044
+ }
1045
+
1046
+ /**
1047
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
1048
+ * deep comparisons and tracks traversed objects enabling objects with circular
1049
+ * references to be compared.
1050
+ *
1051
+ * @private
1052
+ * @param {Object} object The object to compare.
1053
+ * @param {Object} other The other object to compare.
1054
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1055
+ * @param {Function} customizer The function to customize comparisons.
1056
+ * @param {Function} equalFunc The function to determine equivalents of values.
1057
+ * @param {Object} [stack] Tracks traversed `object` and `other` objects.
1058
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1059
+ */
1060
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
1061
+ var objIsArr = isArray(object),
1062
+ othIsArr = isArray(other),
1063
+ objTag = objIsArr ? arrayTag : getTag(object),
1064
+ othTag = othIsArr ? arrayTag : getTag(other);
1065
+
1066
+ objTag = objTag == argsTag ? objectTag : objTag;
1067
+ othTag = othTag == argsTag ? objectTag : othTag;
1068
+
1069
+ var objIsObj = objTag == objectTag,
1070
+ othIsObj = othTag == objectTag,
1071
+ isSameTag = objTag == othTag;
1072
+
1073
+ if (isSameTag && isBuffer(object)) {
1074
+ if (!isBuffer(other)) {
1075
+ return false;
1076
+ }
1077
+ objIsArr = true;
1078
+ objIsObj = false;
1079
+ }
1080
+ if (isSameTag && !objIsObj) {
1081
+ stack || (stack = new Stack);
1082
+ return (objIsArr || isTypedArray(object))
1083
+ ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
1084
+ : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1085
+ }
1086
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1087
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
1088
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
1089
+
1090
+ if (objIsWrapped || othIsWrapped) {
1091
+ var objUnwrapped = objIsWrapped ? object.value() : object,
1092
+ othUnwrapped = othIsWrapped ? other.value() : other;
1093
+
1094
+ stack || (stack = new Stack);
1095
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1096
+ }
1097
+ }
1098
+ if (!isSameTag) {
1099
+ return false;
1100
+ }
1101
+ stack || (stack = new Stack);
1102
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1103
+ }
1104
+
1105
+ /**
1106
+ * The base implementation of `_.isNative` without bad shim checks.
1107
+ *
1108
+ * @private
1109
+ * @param {*} value The value to check.
1110
+ * @returns {boolean} Returns `true` if `value` is a native function,
1111
+ * else `false`.
1112
+ */
1113
+ function baseIsNative(value) {
1114
+ if (!isObject(value) || isMasked(value)) {
1115
+ return false;
1116
+ }
1117
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1118
+ return pattern.test(toSource(value));
1119
+ }
1120
+
1121
+ /**
1122
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
1123
+ *
1124
+ * @private
1125
+ * @param {*} value The value to check.
1126
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1127
+ */
1128
+ function baseIsTypedArray(value) {
1129
+ return isObjectLike(value) &&
1130
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1131
+ }
1132
+
1133
+ /**
1134
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1135
+ *
1136
+ * @private
1137
+ * @param {Object} object The object to query.
1138
+ * @returns {Array} Returns the array of property names.
1139
+ */
1140
+ function baseKeys(object) {
1141
+ if (!isPrototype(object)) {
1142
+ return nativeKeys(object);
1143
+ }
1144
+ var result = [];
1145
+ for (var key in Object(object)) {
1146
+ if (hasOwnProperty.call(object, key) && key != 'constructor') {
1147
+ result.push(key);
1148
+ }
1149
+ }
1150
+ return result;
1151
+ }
1152
+
1153
+ /**
1154
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
1155
+ * partial deep comparisons.
1156
+ *
1157
+ * @private
1158
+ * @param {Array} array The array to compare.
1159
+ * @param {Array} other The other array to compare.
1160
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1161
+ * @param {Function} customizer The function to customize comparisons.
1162
+ * @param {Function} equalFunc The function to determine equivalents of values.
1163
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
1164
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1165
+ */
1166
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1167
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1168
+ arrLength = array.length,
1169
+ othLength = other.length;
1170
+
1171
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1172
+ return false;
1173
+ }
1174
+ // Assume cyclic values are equal.
1175
+ var stacked = stack.get(array);
1176
+ if (stacked && stack.get(other)) {
1177
+ return stacked == other;
1178
+ }
1179
+ var index = -1,
1180
+ result = true,
1181
+ seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
1182
+
1183
+ stack.set(array, other);
1184
+ stack.set(other, array);
1185
+
1186
+ // Ignore non-index properties.
1187
+ while (++index < arrLength) {
1188
+ var arrValue = array[index],
1189
+ othValue = other[index];
1190
+
1191
+ if (customizer) {
1192
+ var compared = isPartial
1193
+ ? customizer(othValue, arrValue, index, other, array, stack)
1194
+ : customizer(arrValue, othValue, index, array, other, stack);
1195
+ }
1196
+ if (compared !== undefined) {
1197
+ if (compared) {
1198
+ continue;
1199
+ }
1200
+ result = false;
1201
+ break;
1202
+ }
1203
+ // Recursively compare arrays (susceptible to call stack limits).
1204
+ if (seen) {
1205
+ if (!arraySome(other, function(othValue, othIndex) {
1206
+ if (!cacheHas(seen, othIndex) &&
1207
+ (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1208
+ return seen.push(othIndex);
1209
+ }
1210
+ })) {
1211
+ result = false;
1212
+ break;
1213
+ }
1214
+ } else if (!(
1215
+ arrValue === othValue ||
1216
+ equalFunc(arrValue, othValue, bitmask, customizer, stack)
1217
+ )) {
1218
+ result = false;
1219
+ break;
1220
+ }
1221
+ }
1222
+ stack['delete'](array);
1223
+ stack['delete'](other);
1224
+ return result;
1225
+ }
1226
+
1227
+ /**
1228
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
1229
+ * the same `toStringTag`.
1230
+ *
1231
+ * **Note:** This function only supports comparing values with tags of
1232
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1233
+ *
1234
+ * @private
1235
+ * @param {Object} object The object to compare.
1236
+ * @param {Object} other The other object to compare.
1237
+ * @param {string} tag The `toStringTag` of the objects to compare.
1238
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1239
+ * @param {Function} customizer The function to customize comparisons.
1240
+ * @param {Function} equalFunc The function to determine equivalents of values.
1241
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
1242
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1243
+ */
1244
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1245
+ switch (tag) {
1246
+ case dataViewTag:
1247
+ if ((object.byteLength != other.byteLength) ||
1248
+ (object.byteOffset != other.byteOffset)) {
1249
+ return false;
1250
+ }
1251
+ object = object.buffer;
1252
+ other = other.buffer;
1253
+
1254
+ case arrayBufferTag:
1255
+ if ((object.byteLength != other.byteLength) ||
1256
+ !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1257
+ return false;
1258
+ }
1259
+ return true;
1260
+
1261
+ case boolTag:
1262
+ case dateTag:
1263
+ case numberTag:
1264
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
1265
+ // Invalid dates are coerced to `NaN`.
1266
+ return eq(+object, +other);
1267
+
1268
+ case errorTag:
1269
+ return object.name == other.name && object.message == other.message;
1270
+
1271
+ case regexpTag:
1272
+ case stringTag:
1273
+ // Coerce regexes to strings and treat strings, primitives and objects,
1274
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1275
+ // for more details.
1276
+ return object == (other + '');
1277
+
1278
+ case mapTag:
1279
+ var convert = mapToArray;
1280
+
1281
+ case setTag:
1282
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
1283
+ convert || (convert = setToArray);
1284
+
1285
+ if (object.size != other.size && !isPartial) {
1286
+ return false;
1287
+ }
1288
+ // Assume cyclic values are equal.
1289
+ var stacked = stack.get(object);
1290
+ if (stacked) {
1291
+ return stacked == other;
1292
+ }
1293
+ bitmask |= COMPARE_UNORDERED_FLAG;
1294
+
1295
+ // Recursively compare objects (susceptible to call stack limits).
1296
+ stack.set(object, other);
1297
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1298
+ stack['delete'](object);
1299
+ return result;
1300
+
1301
+ case symbolTag:
1302
+ if (symbolValueOf) {
1303
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
1304
+ }
1305
+ }
1306
+ return false;
1307
+ }
1308
+
1309
+ /**
1310
+ * A specialized version of `baseIsEqualDeep` for objects with support for
1311
+ * partial deep comparisons.
1312
+ *
1313
+ * @private
1314
+ * @param {Object} object The object to compare.
1315
+ * @param {Object} other The other object to compare.
1316
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1317
+ * @param {Function} customizer The function to customize comparisons.
1318
+ * @param {Function} equalFunc The function to determine equivalents of values.
1319
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
1320
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1321
+ */
1322
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1323
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1324
+ objProps = getAllKeys(object),
1325
+ objLength = objProps.length,
1326
+ othProps = getAllKeys(other),
1327
+ othLength = othProps.length;
1328
+
1329
+ if (objLength != othLength && !isPartial) {
1330
+ return false;
1331
+ }
1332
+ var index = objLength;
1333
+ while (index--) {
1334
+ var key = objProps[index];
1335
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1336
+ return false;
1337
+ }
1338
+ }
1339
+ // Assume cyclic values are equal.
1340
+ var stacked = stack.get(object);
1341
+ if (stacked && stack.get(other)) {
1342
+ return stacked == other;
1343
+ }
1344
+ var result = true;
1345
+ stack.set(object, other);
1346
+ stack.set(other, object);
1347
+
1348
+ var skipCtor = isPartial;
1349
+ while (++index < objLength) {
1350
+ key = objProps[index];
1351
+ var objValue = object[key],
1352
+ othValue = other[key];
1353
+
1354
+ if (customizer) {
1355
+ var compared = isPartial
1356
+ ? customizer(othValue, objValue, key, other, object, stack)
1357
+ : customizer(objValue, othValue, key, object, other, stack);
1358
+ }
1359
+ // Recursively compare objects (susceptible to call stack limits).
1360
+ if (!(compared === undefined
1361
+ ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1362
+ : compared
1363
+ )) {
1364
+ result = false;
1365
+ break;
1366
+ }
1367
+ skipCtor || (skipCtor = key == 'constructor');
1368
+ }
1369
+ if (result && !skipCtor) {
1370
+ var objCtor = object.constructor,
1371
+ othCtor = other.constructor;
1372
+
1373
+ // Non `Object` object instances with different constructors are not equal.
1374
+ if (objCtor != othCtor &&
1375
+ ('constructor' in object && 'constructor' in other) &&
1376
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1377
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1378
+ result = false;
1379
+ }
1380
+ }
1381
+ stack['delete'](object);
1382
+ stack['delete'](other);
1383
+ return result;
1384
+ }
1385
+
1386
+ /**
1387
+ * Creates an array of own enumerable property names and symbols of `object`.
1388
+ *
1389
+ * @private
1390
+ * @param {Object} object The object to query.
1391
+ * @returns {Array} Returns the array of property names and symbols.
1392
+ */
1393
+ function getAllKeys(object) {
1394
+ return baseGetAllKeys(object, keys, getSymbols);
1395
+ }
1396
+
1397
+ /**
1398
+ * Gets the data for `map`.
1399
+ *
1400
+ * @private
1401
+ * @param {Object} map The map to query.
1402
+ * @param {string} key The reference key.
1403
+ * @returns {*} Returns the map data.
1404
+ */
1405
+ function getMapData(map, key) {
1406
+ var data = map.__data__;
1407
+ return isKeyable(key)
1408
+ ? data[typeof key == 'string' ? 'string' : 'hash']
1409
+ : data.map;
1410
+ }
1411
+
1412
+ /**
1413
+ * Gets the native function at `key` of `object`.
1414
+ *
1415
+ * @private
1416
+ * @param {Object} object The object to query.
1417
+ * @param {string} key The key of the method to get.
1418
+ * @returns {*} Returns the function if it's native, else `undefined`.
1419
+ */
1420
+ function getNative(object, key) {
1421
+ var value = getValue(object, key);
1422
+ return baseIsNative(value) ? value : undefined;
1423
+ }
1424
+
1425
+ /**
1426
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1427
+ *
1428
+ * @private
1429
+ * @param {*} value The value to query.
1430
+ * @returns {string} Returns the raw `toStringTag`.
1431
+ */
1432
+ function getRawTag(value) {
1433
+ var isOwn = hasOwnProperty.call(value, symToStringTag),
1434
+ tag = value[symToStringTag];
1435
+
1436
+ try {
1437
+ value[symToStringTag] = undefined;
1438
+ var unmasked = true;
1439
+ } catch (e) {}
1440
+
1441
+ var result = nativeObjectToString.call(value);
1442
+ if (unmasked) {
1443
+ if (isOwn) {
1444
+ value[symToStringTag] = tag;
1445
+ } else {
1446
+ delete value[symToStringTag];
1447
+ }
1448
+ }
1449
+ return result;
1450
+ }
1451
+
1452
+ /**
1453
+ * Creates an array of the own enumerable symbols of `object`.
1454
+ *
1455
+ * @private
1456
+ * @param {Object} object The object to query.
1457
+ * @returns {Array} Returns the array of symbols.
1458
+ */
1459
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1460
+ if (object == null) {
1461
+ return [];
1462
+ }
1463
+ object = Object(object);
1464
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
1465
+ return propertyIsEnumerable.call(object, symbol);
1466
+ });
1467
+ };
1468
+
1469
+ /**
1470
+ * Gets the `toStringTag` of `value`.
1471
+ *
1472
+ * @private
1473
+ * @param {*} value The value to query.
1474
+ * @returns {string} Returns the `toStringTag`.
1475
+ */
1476
+ var getTag = baseGetTag;
1477
+
1478
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1479
+ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
1480
+ (Map && getTag(new Map) != mapTag) ||
1481
+ (Promise && getTag(Promise.resolve()) != promiseTag) ||
1482
+ (Set && getTag(new Set) != setTag) ||
1483
+ (WeakMap && getTag(new WeakMap) != weakMapTag)) {
1484
+ getTag = function(value) {
1485
+ var result = baseGetTag(value),
1486
+ Ctor = result == objectTag ? value.constructor : undefined,
1487
+ ctorString = Ctor ? toSource(Ctor) : '';
1488
+
1489
+ if (ctorString) {
1490
+ switch (ctorString) {
1491
+ case dataViewCtorString: return dataViewTag;
1492
+ case mapCtorString: return mapTag;
1493
+ case promiseCtorString: return promiseTag;
1494
+ case setCtorString: return setTag;
1495
+ case weakMapCtorString: return weakMapTag;
1496
+ }
1497
+ }
1498
+ return result;
1499
+ };
1500
+ }
1501
+
1502
+ /**
1503
+ * Checks if `value` is a valid array-like index.
1504
+ *
1505
+ * @private
1506
+ * @param {*} value The value to check.
1507
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1508
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1509
+ */
1510
+ function isIndex(value, length) {
1511
+ length = length == null ? MAX_SAFE_INTEGER : length;
1512
+ return !!length &&
1513
+ (typeof value == 'number' || reIsUint.test(value)) &&
1514
+ (value > -1 && value % 1 == 0 && value < length);
1515
+ }
1516
+
1517
+ /**
1518
+ * Checks if `value` is suitable for use as unique object key.
1519
+ *
1520
+ * @private
1521
+ * @param {*} value The value to check.
1522
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1523
+ */
1524
+ function isKeyable(value) {
1525
+ var type = typeof value;
1526
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1527
+ ? (value !== '__proto__')
1528
+ : (value === null);
1529
+ }
1530
+
1531
+ /**
1532
+ * Checks if `func` has its source masked.
1533
+ *
1534
+ * @private
1535
+ * @param {Function} func The function to check.
1536
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1537
+ */
1538
+ function isMasked(func) {
1539
+ return !!maskSrcKey && (maskSrcKey in func);
1540
+ }
1541
+
1542
+ /**
1543
+ * Checks if `value` is likely a prototype object.
1544
+ *
1545
+ * @private
1546
+ * @param {*} value The value to check.
1547
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1548
+ */
1549
+ function isPrototype(value) {
1550
+ var Ctor = value && value.constructor,
1551
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
1552
+
1553
+ return value === proto;
1554
+ }
1555
+
1556
+ /**
1557
+ * Converts `value` to a string using `Object.prototype.toString`.
1558
+ *
1559
+ * @private
1560
+ * @param {*} value The value to convert.
1561
+ * @returns {string} Returns the converted string.
1562
+ */
1563
+ function objectToString(value) {
1564
+ return nativeObjectToString.call(value);
1565
+ }
1566
+
1567
+ /**
1568
+ * Converts `func` to its source code.
1569
+ *
1570
+ * @private
1571
+ * @param {Function} func The function to convert.
1572
+ * @returns {string} Returns the source code.
1573
+ */
1574
+ function toSource(func) {
1575
+ if (func != null) {
1576
+ try {
1577
+ return funcToString.call(func);
1578
+ } catch (e) {}
1579
+ try {
1580
+ return (func + '');
1581
+ } catch (e) {}
1582
+ }
1583
+ return '';
1584
+ }
1585
+
1586
+ /**
1587
+ * Performs a
1588
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1589
+ * comparison between two values to determine if they are equivalent.
1590
+ *
1591
+ * @static
1592
+ * @memberOf _
1593
+ * @since 4.0.0
1594
+ * @category Lang
1595
+ * @param {*} value The value to compare.
1596
+ * @param {*} other The other value to compare.
1597
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1598
+ * @example
1599
+ *
1600
+ * var object = { 'a': 1 };
1601
+ * var other = { 'a': 1 };
1602
+ *
1603
+ * _.eq(object, object);
1604
+ * // => true
1605
+ *
1606
+ * _.eq(object, other);
1607
+ * // => false
1608
+ *
1609
+ * _.eq('a', 'a');
1610
+ * // => true
1611
+ *
1612
+ * _.eq('a', Object('a'));
1613
+ * // => false
1614
+ *
1615
+ * _.eq(NaN, NaN);
1616
+ * // => true
1617
+ */
1618
+ function eq(value, other) {
1619
+ return value === other || (value !== value && other !== other);
1620
+ }
1621
+
1622
+ /**
1623
+ * Checks if `value` is likely an `arguments` object.
1624
+ *
1625
+ * @static
1626
+ * @memberOf _
1627
+ * @since 0.1.0
1628
+ * @category Lang
1629
+ * @param {*} value The value to check.
1630
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1631
+ * else `false`.
1632
+ * @example
1633
+ *
1634
+ * _.isArguments(function() { return arguments; }());
1635
+ * // => true
1636
+ *
1637
+ * _.isArguments([1, 2, 3]);
1638
+ * // => false
1639
+ */
1640
+ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1641
+ return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
1642
+ !propertyIsEnumerable.call(value, 'callee');
1643
+ };
1644
+
1645
+ /**
1646
+ * Checks if `value` is classified as an `Array` object.
1647
+ *
1648
+ * @static
1649
+ * @memberOf _
1650
+ * @since 0.1.0
1651
+ * @category Lang
1652
+ * @param {*} value The value to check.
1653
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1654
+ * @example
1655
+ *
1656
+ * _.isArray([1, 2, 3]);
1657
+ * // => true
1658
+ *
1659
+ * _.isArray(document.body.children);
1660
+ * // => false
1661
+ *
1662
+ * _.isArray('abc');
1663
+ * // => false
1664
+ *
1665
+ * _.isArray(_.noop);
1666
+ * // => false
1667
+ */
1668
+ var isArray = Array.isArray;
1669
+
1670
+ /**
1671
+ * Checks if `value` is array-like. A value is considered array-like if it's
1672
+ * not a function and has a `value.length` that's an integer greater than or
1673
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1674
+ *
1675
+ * @static
1676
+ * @memberOf _
1677
+ * @since 4.0.0
1678
+ * @category Lang
1679
+ * @param {*} value The value to check.
1680
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1681
+ * @example
1682
+ *
1683
+ * _.isArrayLike([1, 2, 3]);
1684
+ * // => true
1685
+ *
1686
+ * _.isArrayLike(document.body.children);
1687
+ * // => true
1688
+ *
1689
+ * _.isArrayLike('abc');
1690
+ * // => true
1691
+ *
1692
+ * _.isArrayLike(_.noop);
1693
+ * // => false
1694
+ */
1695
+ function isArrayLike(value) {
1696
+ return value != null && isLength(value.length) && !isFunction(value);
1697
+ }
1698
+
1699
+ /**
1700
+ * Checks if `value` is a buffer.
1701
+ *
1702
+ * @static
1703
+ * @memberOf _
1704
+ * @since 4.3.0
1705
+ * @category Lang
1706
+ * @param {*} value The value to check.
1707
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1708
+ * @example
1709
+ *
1710
+ * _.isBuffer(new Buffer(2));
1711
+ * // => true
1712
+ *
1713
+ * _.isBuffer(new Uint8Array(2));
1714
+ * // => false
1715
+ */
1716
+ var isBuffer = nativeIsBuffer || stubFalse;
1717
+
1718
+ /**
1719
+ * Performs a deep comparison between two values to determine if they are
1720
+ * equivalent.
1721
+ *
1722
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
1723
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
1724
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
1725
+ * by their own, not inherited, enumerable properties. Functions and DOM
1726
+ * nodes are compared by strict equality, i.e. `===`.
1727
+ *
1728
+ * @static
1729
+ * @memberOf _
1730
+ * @since 0.1.0
1731
+ * @category Lang
1732
+ * @param {*} value The value to compare.
1733
+ * @param {*} other The other value to compare.
1734
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1735
+ * @example
1736
+ *
1737
+ * var object = { 'a': 1 };
1738
+ * var other = { 'a': 1 };
1739
+ *
1740
+ * _.isEqual(object, other);
1741
+ * // => true
1742
+ *
1743
+ * object === other;
1744
+ * // => false
1745
+ */
1746
+ function isEqual(value, other) {
1747
+ return baseIsEqual(value, other);
1748
+ }
1749
+
1750
+ /**
1751
+ * Checks if `value` is classified as a `Function` object.
1752
+ *
1753
+ * @static
1754
+ * @memberOf _
1755
+ * @since 0.1.0
1756
+ * @category Lang
1757
+ * @param {*} value The value to check.
1758
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1759
+ * @example
1760
+ *
1761
+ * _.isFunction(_);
1762
+ * // => true
1763
+ *
1764
+ * _.isFunction(/abc/);
1765
+ * // => false
1766
+ */
1767
+ function isFunction(value) {
1768
+ if (!isObject(value)) {
1769
+ return false;
1770
+ }
1771
+ // The use of `Object#toString` avoids issues with the `typeof` operator
1772
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
1773
+ var tag = baseGetTag(value);
1774
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1775
+ }
1776
+
1777
+ /**
1778
+ * Checks if `value` is a valid array-like length.
1779
+ *
1780
+ * **Note:** This method is loosely based on
1781
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1782
+ *
1783
+ * @static
1784
+ * @memberOf _
1785
+ * @since 4.0.0
1786
+ * @category Lang
1787
+ * @param {*} value The value to check.
1788
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1789
+ * @example
1790
+ *
1791
+ * _.isLength(3);
1792
+ * // => true
1793
+ *
1794
+ * _.isLength(Number.MIN_VALUE);
1795
+ * // => false
1796
+ *
1797
+ * _.isLength(Infinity);
1798
+ * // => false
1799
+ *
1800
+ * _.isLength('3');
1801
+ * // => false
1802
+ */
1803
+ function isLength(value) {
1804
+ return typeof value == 'number' &&
1805
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1806
+ }
1807
+
1808
+ /**
1809
+ * Checks if `value` is the
1810
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1811
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1812
+ *
1813
+ * @static
1814
+ * @memberOf _
1815
+ * @since 0.1.0
1816
+ * @category Lang
1817
+ * @param {*} value The value to check.
1818
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1819
+ * @example
1820
+ *
1821
+ * _.isObject({});
1822
+ * // => true
1823
+ *
1824
+ * _.isObject([1, 2, 3]);
1825
+ * // => true
1826
+ *
1827
+ * _.isObject(_.noop);
1828
+ * // => true
1829
+ *
1830
+ * _.isObject(null);
1831
+ * // => false
1832
+ */
1833
+ function isObject(value) {
1834
+ var type = typeof value;
1835
+ return value != null && (type == 'object' || type == 'function');
1836
+ }
1837
+
1838
+ /**
1839
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1840
+ * and has a `typeof` result of "object".
1841
+ *
1842
+ * @static
1843
+ * @memberOf _
1844
+ * @since 4.0.0
1845
+ * @category Lang
1846
+ * @param {*} value The value to check.
1847
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1848
+ * @example
1849
+ *
1850
+ * _.isObjectLike({});
1851
+ * // => true
1852
+ *
1853
+ * _.isObjectLike([1, 2, 3]);
1854
+ * // => true
1855
+ *
1856
+ * _.isObjectLike(_.noop);
1857
+ * // => false
1858
+ *
1859
+ * _.isObjectLike(null);
1860
+ * // => false
1861
+ */
1862
+ function isObjectLike(value) {
1863
+ return value != null && typeof value == 'object';
1864
+ }
1865
+
1866
+ /**
1867
+ * Checks if `value` is classified as a typed array.
1868
+ *
1869
+ * @static
1870
+ * @memberOf _
1871
+ * @since 3.0.0
1872
+ * @category Lang
1873
+ * @param {*} value The value to check.
1874
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1875
+ * @example
1876
+ *
1877
+ * _.isTypedArray(new Uint8Array);
1878
+ * // => true
1879
+ *
1880
+ * _.isTypedArray([]);
1881
+ * // => false
1882
+ */
1883
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1884
+
1885
+ /**
1886
+ * Creates an array of the own enumerable property names of `object`.
1887
+ *
1888
+ * **Note:** Non-object values are coerced to objects. See the
1889
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1890
+ * for more details.
1891
+ *
1892
+ * @static
1893
+ * @since 0.1.0
1894
+ * @memberOf _
1895
+ * @category Object
1896
+ * @param {Object} object The object to query.
1897
+ * @returns {Array} Returns the array of property names.
1898
+ * @example
1899
+ *
1900
+ * function Foo() {
1901
+ * this.a = 1;
1902
+ * this.b = 2;
1903
+ * }
1904
+ *
1905
+ * Foo.prototype.c = 3;
1906
+ *
1907
+ * _.keys(new Foo);
1908
+ * // => ['a', 'b'] (iteration order is not guaranteed)
1909
+ *
1910
+ * _.keys('hi');
1911
+ * // => ['0', '1']
1912
+ */
1913
+ function keys(object) {
1914
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1915
+ }
1916
+
1917
+ /**
1918
+ * This method returns a new empty array.
1919
+ *
1920
+ * @static
1921
+ * @memberOf _
1922
+ * @since 4.13.0
1923
+ * @category Util
1924
+ * @returns {Array} Returns the new empty array.
1925
+ * @example
1926
+ *
1927
+ * var arrays = _.times(2, _.stubArray);
1928
+ *
1929
+ * console.log(arrays);
1930
+ * // => [[], []]
1931
+ *
1932
+ * console.log(arrays[0] === arrays[1]);
1933
+ * // => false
1934
+ */
1935
+ function stubArray() {
1936
+ return [];
1937
+ }
1938
+
1939
+ /**
1940
+ * This method returns `false`.
1941
+ *
1942
+ * @static
1943
+ * @memberOf _
1944
+ * @since 4.13.0
1945
+ * @category Util
1946
+ * @returns {boolean} Returns `false`.
1947
+ * @example
1948
+ *
1949
+ * _.times(2, _.stubFalse);
1950
+ * // => [false, false]
1951
+ */
1952
+ function stubFalse() {
1953
+ return false;
1954
+ }
1955
+
1956
+ module.exports = isEqual;
1957
+ });
1958
+
1959
+ function checkDotNet() {
1960
+ if (typeof window.parent.chrome === 'undefined') {
1961
+ console.error('[POLLINATION-DEBUG]: chrome not found.');
1962
+ return false;
1963
+ }
1964
+ if (typeof window.parent.chrome.webview === 'undefined') {
1965
+ console.error('[POLLINATION-DEBUG]: webview not found.');
1966
+ return false;
1967
+ }
1968
+ return true;
1969
+ }
1970
+ function checkRuby() {
1971
+ if (typeof window.sketchup === 'undefined') {
1972
+ console.error('[POLLINATION-DEBUG]: sketchup not found.');
1973
+ return false;
1974
+ }
1975
+ return true;
1976
+ }
1977
+ function sendMessageDotNet(message) {
1978
+ if (!checkDotNet())
1979
+ return undefined;
1980
+ var json = JSON.stringify(message);
1981
+ window.parent.chrome.webview.postMessage(json)
1982
+ .catch(function (e) {
1983
+ throw new Error(e);
1984
+ });
1985
+ return message;
1986
+ }
1987
+ function sendMessageRuby(message) {
1988
+ if (!checkRuby())
1989
+ return undefined;
1990
+ // const json = JSON.stringify(message)
1991
+ console.error('[POLLINATION-DEBUG]: sendMesssageRuby not yet implemented');
1992
+ return message;
1993
+ }
1994
+ function subscribeDotNet(interval) {
1995
+ if (interval === void 0) { interval = 1000; }
1996
+ if (!checkDotNet)
1997
+ return undefined;
1998
+ if (!window.parent.chrome.webview.hostObjects ||
1999
+ !window.parent.chrome.webview.hostObjects.sync ||
2000
+ !window.parent.chrome.webview.hostObjects.PassHBJSON) {
2001
+ console.error('[POLLINATION-DEBUG]: hostObjects.sync.PassHBJSON not configured correctly');
2002
+ return;
2003
+ }
2004
+ var subscribe = function (setState) { return setInterval(function () {
2005
+ var token = window.parent.chrome.webview.hostObjects.sync.hbjson.PassHBJSON();
2006
+ setState(token);
2007
+ }, interval); };
2008
+ return subscribe;
2009
+ }
2010
+ // not sure if this will work from Streamlit?
2011
+ function getHost(key, defaultValue) {
2012
+ if (key === void 0) { key = '__host__'; }
2013
+ if (defaultValue === void 0) { defaultValue = 'web'; }
2014
+ // getting stored value
2015
+ var retrieved = localStorage.getItem(key);
2016
+ if (!retrieved)
2017
+ return defaultValue;
2018
+ return typeof retrieved === 'string' ? retrieved.toLocaleLowerCase() : JSON.parse(retrieved).toLocaleLowerCase();
2019
+ }
2020
+
2021
+ var useGetHBJSON = function () {
2022
+ var host = getHost();
2023
+ var _a = React.useState(), messageResponse = _a[0], setMessageResponse = _a[1];
2024
+ var _b = React.useState(undefined), hbjson = _b[0], setHbjson = _b[1];
2025
+ var rubyGetHBJSON = React.useCallback(function (key, selection, isPollinationModel) {
2026
+ if (key === void 0) { key = ''; }
2027
+ if (selection === void 0) { selection = false; }
2028
+ if (isPollinationModel === void 0) { isPollinationModel = false; }
2029
+ if (!checkRuby())
2030
+ return;
2031
+ // ruby invoke
2032
+ if (isPollinationModel) {
2033
+ window.parent.sketchup.get_model(selection, {
2034
+ onCompleted: function (res) {
2035
+ var message = JSON.parse(res);
2036
+ setMessageResponse(function (state) { return (__assign(__assign({}, state), { geometry: message.Geometry, identifier: message.Identifier })); });
2037
+ }
2038
+ });
2039
+ }
2040
+ else {
2041
+ window.parent.sketchup.get_geometry(key, selection, {
2042
+ onCompleted: function (res) {
2043
+ var message = JSON.parse(res);
2044
+ setMessageResponse(function (state) { return (__assign(__assign({}, state), { geometry: message.Geometry, identifier: message.Identifier })); });
2045
+ }
2046
+ });
2047
+ }
2048
+ }, []);
2049
+ var dotNetGetHBJSON = React.useCallback(function (key, selection, isPollinationModel) {
2050
+ if (key === void 0) { key = ''; }
2051
+ if (selection === void 0) { selection = false; }
2052
+ if (isPollinationModel === void 0) { isPollinationModel = false; }
2053
+ if (!checkDotNet())
2054
+ return;
2055
+ var res = {
2056
+ Geometry: null,
2057
+ Identifier: null
2058
+ };
2059
+ if (isPollinationModel) {
2060
+ // @ts-ignore
2061
+ res = window.parent.chrome.webview
2062
+ .hostObjects.sync.hbjson.PassPollinationModel(selection);
2063
+ setMessageResponse(function (state) { return (__assign(__assign({}, state), { geometry: res.Geometry, identifier: res.Identifier })); });
2064
+ }
2065
+ else {
2066
+ // @ts-ignore
2067
+ res = window.parent.chrome.webview.hostObjects.sync.geometry.PassJsonGeometry(key, selection);
2068
+ setMessageResponse(function (state) { return (__assign(__assign({}, state), { geometry: res.Geometry, identifier: res.Identifier })); });
2069
+ }
2070
+ }, []);
2071
+ React.useEffect(function () {
2072
+ if (!messageResponse)
2073
+ return;
2074
+ // @ts-ignore
2075
+ var bytes = new TextEncoder().encode(messageResponse.geometry);
2076
+ if (hbjson) {
2077
+ hbjson.arrayBuffer().then(function (data) {
2078
+ if (!lodash_isequal(bytes, new Uint8Array(data))) {
2079
+ setHbjson(new Blob([bytes], {
2080
+ type: 'application/json;charset=utf-8',
2081
+ }));
2082
+ }
2083
+ });
2084
+ }
2085
+ else {
2086
+ setHbjson(new Blob([bytes], {
2087
+ type: 'application/json;charset=utf-8',
2088
+ }));
2089
+ }
2090
+ }, [messageResponse]);
2091
+ var handler = React.useMemo(function () {
2092
+ switch (host) {
2093
+ case 'sketchup':
2094
+ return rubyGetHBJSON;
2095
+ case 'rhino':
2096
+ return dotNetGetHBJSON;
2097
+ default:
2098
+ return undefined;
2099
+ }
2100
+ }, [host, dotNetGetHBJSON, rubyGetHBJSON]);
2101
+ return {
2102
+ host: host,
2103
+ hbjson: hbjson,
2104
+ handler: handler,
2105
+ };
2106
+ };
2107
+
2108
+ var useRunCommand = function () {
2109
+ var host = getHost();
2110
+ var rhinoRunCommand = React.useCallback(function (commandString, commandOptions) {
2111
+ var msgObject = {
2112
+ action: 'RunCommand',
2113
+ commandString: commandString,
2114
+ };
2115
+ sendMessageDotNet(msgObject);
2116
+ }, []);
2117
+ var runCommand = React.useMemo(function () {
2118
+ switch (host) {
2119
+ case 'rhino':
2120
+ return rhinoRunCommand;
2121
+ default:
2122
+ return undefined;
2123
+ }
2124
+ }, [host, rhinoRunCommand]);
2125
+ return {
2126
+ host: host,
2127
+ runCommand: runCommand
2128
+ };
2129
+ };
2130
+
2131
+ var useSendCheckbox = function (_a) {
2132
+ _a.action; _a.data; _a.uniqueId; _a.options; _a.platform; _a.isFocused;
2133
+ var host = getHost();
2134
+ var _b = React.useState({}); _b[0]; _b[1];
2135
+ return ({
2136
+ host: host
2137
+ });
2138
+ };
2139
+
2140
+ var useSendGeometry = function () {
2141
+ var host = getHost();
2142
+ var _a = React.useState({}), state = _a[0], setState = _a[1];
2143
+ var rubySendGeometry = React.useCallback(function (message) {
2144
+ var response = sendMessageRuby(message);
2145
+ setState(function (state) { return (__assign(__assign({}, state), { response: response })); });
2146
+ return response;
2147
+ }, []);
2148
+ var dotNetSendGeometry = React.useCallback(function (message) {
2149
+ var response = sendMessageDotNet(message);
2150
+ setState(function (state) { return (__assign(__assign({}, state), { response: response })); });
2151
+ return response;
2152
+ }, []);
2153
+ var sendGeometry = React.useMemo(function () {
2154
+ switch (host) {
2155
+ case 'sketchup':
2156
+ return rubySendGeometry;
2157
+ case 'rhino':
2158
+ return dotNetSendGeometry;
2159
+ case 'revit':
2160
+ return dotNetSendGeometry;
2161
+ default:
2162
+ return undefined;
2163
+ }
2164
+ }, [dotNetSendGeometry, host, rubySendGeometry]);
2165
+ return ({
2166
+ host: host,
2167
+ state: state,
2168
+ sendGeometry: sendGeometry
2169
+ });
2170
+ };
2171
+
2172
+ var useSendSettings = function () {
2173
+ var host = getHost();
2174
+ var rhinoSendSettings = React.useCallback(function (settings) {
2175
+ var message = {
2176
+ action: 'SetModelSettings',
2177
+ data: settings
2178
+ };
2179
+ return sendMessageDotNet(message);
2180
+ }, []);
2181
+ var sendSettings = React.useMemo(function () {
2182
+ switch (host) {
2183
+ case 'rhino':
2184
+ return rhinoSendSettings;
2185
+ default:
2186
+ return undefined;
2187
+ }
2188
+ }, [host, rhinoSendSettings]);
2189
+ return ({
2190
+ host: host,
2191
+ sendSettings: sendSettings,
2192
+ });
2193
+ };
2194
+
2195
+ var UTILSENDPOINT = process.env.REACT_APP_UTILS_ENDPOINT || 'https://utilities.staging.pollination.cloud';
2196
+ var useHBJSONtoVTK = function () {
2197
+ var _a = React.useState(false), loading = _a[0], setLoading = _a[1];
2198
+ var _b = React.useState(), vtk = _b[0], setVTK = _b[1];
2199
+ var fetchVTK = function (hbjson) {
2200
+ if (!hbjson || hbjson.size < 1)
2201
+ return undefined;
2202
+ setLoading(true);
2203
+ return hbjson.text().then(function (fileString) {
2204
+ fetch(UTILSENDPOINT + "/hbjson-to-vtk", {
2205
+ method: 'POST',
2206
+ headers: {
2207
+ 'Content-Type': 'application/json',
2208
+ 'Accept': '*/*',
2209
+ },
2210
+ body: "{\n \"output_format\": \"vtkjs\",\n \"hbjson\": " + fileString + "\n }"
2211
+ })
2212
+ .catch(function (e) {
2213
+ throw new Error(e);
2214
+ })
2215
+ .then(function (res) { return __awaiter(void 0, void 0, void 0, function () {
2216
+ var translatedFile;
2217
+ return __generator(this, function (_a) {
2218
+ switch (_a.label) {
2219
+ case 0:
2220
+ if (!res.ok) return [3 /*break*/, 2];
2221
+ return [4 /*yield*/, res.blob()];
2222
+ case 1:
2223
+ translatedFile = _a.sent();
2224
+ setVTK(translatedFile);
2225
+ return [2 /*return*/, translatedFile
2226
+ // viewerRef.current.loadFile(translatedFile, 'vtkjs')
2227
+ ];
2228
+ case 2: throw new Error('Failed to retrieve .vtkjs from .hbjson file.Error translating hbjson to vtkjs');
2229
+ }
2230
+ });
2231
+ }); })
2232
+ .finally(function () {
2233
+ setLoading(false);
2234
+ });
2235
+ });
2236
+ };
2237
+ return {
2238
+ loading: loading,
2239
+ vtk: vtk,
2240
+ fetchVTK: fetchVTK
2241
+ };
2242
+ };
2243
+
2244
+ exports.checkDotNet = checkDotNet;
2245
+ exports.checkRuby = checkRuby;
2246
+ exports.getHost = getHost;
2247
+ exports.sendMessageDotNet = sendMessageDotNet;
2248
+ exports.sendMessageRuby = sendMessageRuby;
2249
+ exports.subscribeDotNet = subscribeDotNet;
2250
+ exports.useGetHBJSON = useGetHBJSON;
2251
+ exports.useHBJSONtoVTK = useHBJSONtoVTK;
2252
+ exports.useRunCommand = useRunCommand;
2253
+ exports.useSendCheckbox = useSendCheckbox;
2254
+ exports.useSendGeometry = useSendGeometry;
2255
+ exports.useSendSettings = useSendSettings;
2256
+ //# sourceMappingURL=index.js.map