@eva/plugin-renderer 1.1.1-alpha.0 → 1.1.1-fix.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.
Files changed (51) hide show
  1. package/README.md +1 -2
  2. package/dist/plugin-renderer.cjs.js +19 -14
  3. package/dist/plugin-renderer.cjs.prod.js +1 -1
  4. package/dist/plugin-renderer.esm.js +15 -10
  5. package/index.js +3 -3
  6. package/package.json +3 -3
  7. package/dist/EVA.plugin.renderer.js +0 -2925
  8. package/dist/EVA.plugin.renderer.min.js +0 -1
  9. package/dist/examples/index.d.ts +0 -2
  10. package/dist/examples/index.d.ts.map +0 -1
  11. package/dist/examples/src/a11y.d.ts +0 -3
  12. package/dist/examples/src/a11y.d.ts.map +0 -1
  13. package/dist/examples/src/component.d.ts +0 -3
  14. package/dist/examples/src/component.d.ts.map +0 -1
  15. package/dist/examples/src/compressed-texture.d.ts +0 -1
  16. package/dist/examples/src/compressed-texture.d.ts.map +0 -1
  17. package/dist/examples/src/dragonbone.d.ts +0 -3
  18. package/dist/examples/src/dragonbone.d.ts.map +0 -1
  19. package/dist/examples/src/event.d.ts +0 -3
  20. package/dist/examples/src/event.d.ts.map +0 -1
  21. package/dist/examples/src/graphics.d.ts +0 -3
  22. package/dist/examples/src/graphics.d.ts.map +0 -1
  23. package/dist/examples/src/image.d.ts +0 -3
  24. package/dist/examples/src/image.d.ts.map +0 -1
  25. package/dist/examples/src/loader.d.ts +0 -3
  26. package/dist/examples/src/loader.d.ts.map +0 -1
  27. package/dist/examples/src/lottie.d.ts +0 -3
  28. package/dist/examples/src/lottie.d.ts.map +0 -1
  29. package/dist/examples/src/mask.d.ts +0 -4
  30. package/dist/examples/src/mask.d.ts.map +0 -1
  31. package/dist/examples/src/matter.d.ts +0 -3
  32. package/dist/examples/src/matter.d.ts.map +0 -1
  33. package/dist/examples/src/multi-canvas.d.ts +0 -3
  34. package/dist/examples/src/multi-canvas.d.ts.map +0 -1
  35. package/dist/examples/src/ninePatch.d.ts +0 -3
  36. package/dist/examples/src/ninePatch.d.ts.map +0 -1
  37. package/dist/examples/src/sound.d.ts +0 -3
  38. package/dist/examples/src/sound.d.ts.map +0 -1
  39. package/dist/examples/src/spine.d.ts +0 -3
  40. package/dist/examples/src/spine.d.ts.map +0 -1
  41. package/dist/examples/src/sprite.d.ts +0 -3
  42. package/dist/examples/src/sprite.d.ts.map +0 -1
  43. package/dist/examples/src/spriteAnimation.d.ts +0 -3
  44. package/dist/examples/src/spriteAnimation.d.ts.map +0 -1
  45. package/dist/examples/src/text.d.ts +0 -3
  46. package/dist/examples/src/text.d.ts.map +0 -1
  47. package/dist/examples/src/tilingSprite.d.ts +0 -3
  48. package/dist/examples/src/tilingSprite.d.ts.map +0 -1
  49. package/dist/examples/src/transition.d.ts +0 -3
  50. package/dist/examples/src/transition.d.ts.map +0 -1
  51. package/dist/plugin-renderer.d.ts +0 -105
@@ -1,2925 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/renderer-adapter'), require('pixi.js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/renderer-adapter', 'pixi.js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = {}), global.EVA, global.EVA.rendererAdapter, global.PIXI));
5
- }(this, (function (exports, eva_js, rendererAdapter, pixi_js) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics = function(d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
-
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- var __assign = function() {
37
- __assign = Object.assign || function __assign(t) {
38
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39
- s = arguments[i];
40
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
- }
42
- return t;
43
- };
44
- return __assign.apply(this, arguments);
45
- };
46
-
47
- function __decorate(decorators, target, key, desc) {
48
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
49
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
50
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
51
- return c > 3 && r && Object.defineProperty(target, key, r), r;
52
- }
53
-
54
- function __values(o) {
55
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
56
- if (m) return m.call(o);
57
- if (o && typeof o.length === "number") return {
58
- next: function () {
59
- if (o && i >= o.length) o = void 0;
60
- return { value: o && o[i++], done: !o };
61
- }
62
- };
63
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
64
- }
65
-
66
- function __read(o, n) {
67
- var m = typeof Symbol === "function" && o[Symbol.iterator];
68
- if (!m) return o;
69
- var i = m.call(o), r, ar = [], e;
70
- try {
71
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
72
- }
73
- catch (error) { e = { error: error }; }
74
- finally {
75
- try {
76
- if (r && !r.done && (m = i["return"])) m.call(i);
77
- }
78
- finally { if (e) throw e.error; }
79
- }
80
- return ar;
81
- }
82
-
83
- function __spread() {
84
- for (var ar = [], i = 0; i < arguments.length; i++)
85
- ar = ar.concat(__read(arguments[i]));
86
- return ar;
87
- }
88
-
89
- /**
90
- * Removes all key-value entries from the list cache.
91
- *
92
- * @private
93
- * @name clear
94
- * @memberOf ListCache
95
- */
96
- function listCacheClear() {
97
- this.__data__ = [];
98
- this.size = 0;
99
- }
100
-
101
- /**
102
- * Performs a
103
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
104
- * comparison between two values to determine if they are equivalent.
105
- *
106
- * @static
107
- * @memberOf _
108
- * @since 4.0.0
109
- * @category Lang
110
- * @param {*} value The value to compare.
111
- * @param {*} other The other value to compare.
112
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
113
- * @example
114
- *
115
- * var object = { 'a': 1 };
116
- * var other = { 'a': 1 };
117
- *
118
- * _.eq(object, object);
119
- * // => true
120
- *
121
- * _.eq(object, other);
122
- * // => false
123
- *
124
- * _.eq('a', 'a');
125
- * // => true
126
- *
127
- * _.eq('a', Object('a'));
128
- * // => false
129
- *
130
- * _.eq(NaN, NaN);
131
- * // => true
132
- */
133
- function eq(value, other) {
134
- return value === other || (value !== value && other !== other);
135
- }
136
-
137
- /**
138
- * Gets the index at which the `key` is found in `array` of key-value pairs.
139
- *
140
- * @private
141
- * @param {Array} array The array to inspect.
142
- * @param {*} key The key to search for.
143
- * @returns {number} Returns the index of the matched value, else `-1`.
144
- */
145
- function assocIndexOf(array, key) {
146
- var length = array.length;
147
- while (length--) {
148
- if (eq(array[length][0], key)) {
149
- return length;
150
- }
151
- }
152
- return -1;
153
- }
154
-
155
- /** Used for built-in method references. */
156
- var arrayProto = Array.prototype;
157
-
158
- /** Built-in value references. */
159
- var splice = arrayProto.splice;
160
-
161
- /**
162
- * Removes `key` and its value from the list cache.
163
- *
164
- * @private
165
- * @name delete
166
- * @memberOf ListCache
167
- * @param {string} key The key of the value to remove.
168
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
169
- */
170
- function listCacheDelete(key) {
171
- var data = this.__data__,
172
- index = assocIndexOf(data, key);
173
-
174
- if (index < 0) {
175
- return false;
176
- }
177
- var lastIndex = data.length - 1;
178
- if (index == lastIndex) {
179
- data.pop();
180
- } else {
181
- splice.call(data, index, 1);
182
- }
183
- --this.size;
184
- return true;
185
- }
186
-
187
- /**
188
- * Gets the list cache value for `key`.
189
- *
190
- * @private
191
- * @name get
192
- * @memberOf ListCache
193
- * @param {string} key The key of the value to get.
194
- * @returns {*} Returns the entry value.
195
- */
196
- function listCacheGet(key) {
197
- var data = this.__data__,
198
- index = assocIndexOf(data, key);
199
-
200
- return index < 0 ? undefined : data[index][1];
201
- }
202
-
203
- /**
204
- * Checks if a list cache value for `key` exists.
205
- *
206
- * @private
207
- * @name has
208
- * @memberOf ListCache
209
- * @param {string} key The key of the entry to check.
210
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
211
- */
212
- function listCacheHas(key) {
213
- return assocIndexOf(this.__data__, key) > -1;
214
- }
215
-
216
- /**
217
- * Sets the list cache `key` to `value`.
218
- *
219
- * @private
220
- * @name set
221
- * @memberOf ListCache
222
- * @param {string} key The key of the value to set.
223
- * @param {*} value The value to set.
224
- * @returns {Object} Returns the list cache instance.
225
- */
226
- function listCacheSet(key, value) {
227
- var data = this.__data__,
228
- index = assocIndexOf(data, key);
229
-
230
- if (index < 0) {
231
- ++this.size;
232
- data.push([key, value]);
233
- } else {
234
- data[index][1] = value;
235
- }
236
- return this;
237
- }
238
-
239
- /**
240
- * Creates an list cache object.
241
- *
242
- * @private
243
- * @constructor
244
- * @param {Array} [entries] The key-value pairs to cache.
245
- */
246
- function ListCache(entries) {
247
- var index = -1,
248
- length = entries == null ? 0 : entries.length;
249
-
250
- this.clear();
251
- while (++index < length) {
252
- var entry = entries[index];
253
- this.set(entry[0], entry[1]);
254
- }
255
- }
256
-
257
- // Add methods to `ListCache`.
258
- ListCache.prototype.clear = listCacheClear;
259
- ListCache.prototype['delete'] = listCacheDelete;
260
- ListCache.prototype.get = listCacheGet;
261
- ListCache.prototype.has = listCacheHas;
262
- ListCache.prototype.set = listCacheSet;
263
-
264
- /**
265
- * Removes all key-value entries from the stack.
266
- *
267
- * @private
268
- * @name clear
269
- * @memberOf Stack
270
- */
271
- function stackClear() {
272
- this.__data__ = new ListCache;
273
- this.size = 0;
274
- }
275
-
276
- /**
277
- * Removes `key` and its value from the stack.
278
- *
279
- * @private
280
- * @name delete
281
- * @memberOf Stack
282
- * @param {string} key The key of the value to remove.
283
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
284
- */
285
- function stackDelete(key) {
286
- var data = this.__data__,
287
- result = data['delete'](key);
288
-
289
- this.size = data.size;
290
- return result;
291
- }
292
-
293
- /**
294
- * Gets the stack value for `key`.
295
- *
296
- * @private
297
- * @name get
298
- * @memberOf Stack
299
- * @param {string} key The key of the value to get.
300
- * @returns {*} Returns the entry value.
301
- */
302
- function stackGet(key) {
303
- return this.__data__.get(key);
304
- }
305
-
306
- /**
307
- * Checks if a stack value for `key` exists.
308
- *
309
- * @private
310
- * @name has
311
- * @memberOf Stack
312
- * @param {string} key The key of the entry to check.
313
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
314
- */
315
- function stackHas(key) {
316
- return this.__data__.has(key);
317
- }
318
-
319
- /** Detect free variable `global` from Node.js. */
320
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
321
-
322
- /** Detect free variable `self`. */
323
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
324
-
325
- /** Used as a reference to the global object. */
326
- var root = freeGlobal || freeSelf || Function('return this')();
327
-
328
- /** Built-in value references. */
329
- var Symbol$1 = root.Symbol;
330
-
331
- /** Used for built-in method references. */
332
- var objectProto$b = Object.prototype;
333
-
334
- /** Used to check objects for own properties. */
335
- var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
336
-
337
- /**
338
- * Used to resolve the
339
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
340
- * of values.
341
- */
342
- var nativeObjectToString$1 = objectProto$b.toString;
343
-
344
- /** Built-in value references. */
345
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
346
-
347
- /**
348
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
349
- *
350
- * @private
351
- * @param {*} value The value to query.
352
- * @returns {string} Returns the raw `toStringTag`.
353
- */
354
- function getRawTag(value) {
355
- var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
356
- tag = value[symToStringTag$1];
357
-
358
- try {
359
- value[symToStringTag$1] = undefined;
360
- var unmasked = true;
361
- } catch (e) {}
362
-
363
- var result = nativeObjectToString$1.call(value);
364
- if (unmasked) {
365
- if (isOwn) {
366
- value[symToStringTag$1] = tag;
367
- } else {
368
- delete value[symToStringTag$1];
369
- }
370
- }
371
- return result;
372
- }
373
-
374
- /** Used for built-in method references. */
375
- var objectProto$a = Object.prototype;
376
-
377
- /**
378
- * Used to resolve the
379
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
380
- * of values.
381
- */
382
- var nativeObjectToString = objectProto$a.toString;
383
-
384
- /**
385
- * Converts `value` to a string using `Object.prototype.toString`.
386
- *
387
- * @private
388
- * @param {*} value The value to convert.
389
- * @returns {string} Returns the converted string.
390
- */
391
- function objectToString(value) {
392
- return nativeObjectToString.call(value);
393
- }
394
-
395
- /** `Object#toString` result references. */
396
- var nullTag = '[object Null]',
397
- undefinedTag = '[object Undefined]';
398
-
399
- /** Built-in value references. */
400
- var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
401
-
402
- /**
403
- * The base implementation of `getTag` without fallbacks for buggy environments.
404
- *
405
- * @private
406
- * @param {*} value The value to query.
407
- * @returns {string} Returns the `toStringTag`.
408
- */
409
- function baseGetTag(value) {
410
- if (value == null) {
411
- return value === undefined ? undefinedTag : nullTag;
412
- }
413
- return (symToStringTag && symToStringTag in Object(value))
414
- ? getRawTag(value)
415
- : objectToString(value);
416
- }
417
-
418
- /**
419
- * Checks if `value` is the
420
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
421
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
422
- *
423
- * @static
424
- * @memberOf _
425
- * @since 0.1.0
426
- * @category Lang
427
- * @param {*} value The value to check.
428
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
429
- * @example
430
- *
431
- * _.isObject({});
432
- * // => true
433
- *
434
- * _.isObject([1, 2, 3]);
435
- * // => true
436
- *
437
- * _.isObject(_.noop);
438
- * // => true
439
- *
440
- * _.isObject(null);
441
- * // => false
442
- */
443
- function isObject(value) {
444
- var type = typeof value;
445
- return value != null && (type == 'object' || type == 'function');
446
- }
447
-
448
- /** `Object#toString` result references. */
449
- var asyncTag = '[object AsyncFunction]',
450
- funcTag$1 = '[object Function]',
451
- genTag = '[object GeneratorFunction]',
452
- proxyTag = '[object Proxy]';
453
-
454
- /**
455
- * Checks if `value` is classified as a `Function` object.
456
- *
457
- * @static
458
- * @memberOf _
459
- * @since 0.1.0
460
- * @category Lang
461
- * @param {*} value The value to check.
462
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
463
- * @example
464
- *
465
- * _.isFunction(_);
466
- * // => true
467
- *
468
- * _.isFunction(/abc/);
469
- * // => false
470
- */
471
- function isFunction(value) {
472
- if (!isObject(value)) {
473
- return false;
474
- }
475
- // The use of `Object#toString` avoids issues with the `typeof` operator
476
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
477
- var tag = baseGetTag(value);
478
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
479
- }
480
-
481
- /** Used to detect overreaching core-js shims. */
482
- var coreJsData = root['__core-js_shared__'];
483
-
484
- /** Used to detect methods masquerading as native. */
485
- var maskSrcKey = (function() {
486
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
487
- return uid ? ('Symbol(src)_1.' + uid) : '';
488
- }());
489
-
490
- /**
491
- * Checks if `func` has its source masked.
492
- *
493
- * @private
494
- * @param {Function} func The function to check.
495
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
496
- */
497
- function isMasked(func) {
498
- return !!maskSrcKey && (maskSrcKey in func);
499
- }
500
-
501
- /** Used for built-in method references. */
502
- var funcProto$1 = Function.prototype;
503
-
504
- /** Used to resolve the decompiled source of functions. */
505
- var funcToString$1 = funcProto$1.toString;
506
-
507
- /**
508
- * Converts `func` to its source code.
509
- *
510
- * @private
511
- * @param {Function} func The function to convert.
512
- * @returns {string} Returns the source code.
513
- */
514
- function toSource(func) {
515
- if (func != null) {
516
- try {
517
- return funcToString$1.call(func);
518
- } catch (e) {}
519
- try {
520
- return (func + '');
521
- } catch (e) {}
522
- }
523
- return '';
524
- }
525
-
526
- /**
527
- * Used to match `RegExp`
528
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
529
- */
530
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
531
-
532
- /** Used to detect host constructors (Safari). */
533
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
534
-
535
- /** Used for built-in method references. */
536
- var funcProto = Function.prototype,
537
- objectProto$9 = Object.prototype;
538
-
539
- /** Used to resolve the decompiled source of functions. */
540
- var funcToString = funcProto.toString;
541
-
542
- /** Used to check objects for own properties. */
543
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
544
-
545
- /** Used to detect if a method is native. */
546
- var reIsNative = RegExp('^' +
547
- funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
548
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
549
- );
550
-
551
- /**
552
- * The base implementation of `_.isNative` without bad shim checks.
553
- *
554
- * @private
555
- * @param {*} value The value to check.
556
- * @returns {boolean} Returns `true` if `value` is a native function,
557
- * else `false`.
558
- */
559
- function baseIsNative(value) {
560
- if (!isObject(value) || isMasked(value)) {
561
- return false;
562
- }
563
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
564
- return pattern.test(toSource(value));
565
- }
566
-
567
- /**
568
- * Gets the value at `key` of `object`.
569
- *
570
- * @private
571
- * @param {Object} [object] The object to query.
572
- * @param {string} key The key of the property to get.
573
- * @returns {*} Returns the property value.
574
- */
575
- function getValue(object, key) {
576
- return object == null ? undefined : object[key];
577
- }
578
-
579
- /**
580
- * Gets the native function at `key` of `object`.
581
- *
582
- * @private
583
- * @param {Object} object The object to query.
584
- * @param {string} key The key of the method to get.
585
- * @returns {*} Returns the function if it's native, else `undefined`.
586
- */
587
- function getNative(object, key) {
588
- var value = getValue(object, key);
589
- return baseIsNative(value) ? value : undefined;
590
- }
591
-
592
- /* Built-in method references that are verified to be native. */
593
- var Map = getNative(root, 'Map');
594
-
595
- /* Built-in method references that are verified to be native. */
596
- var nativeCreate = getNative(Object, 'create');
597
-
598
- /**
599
- * Removes all key-value entries from the hash.
600
- *
601
- * @private
602
- * @name clear
603
- * @memberOf Hash
604
- */
605
- function hashClear() {
606
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
607
- this.size = 0;
608
- }
609
-
610
- /**
611
- * Removes `key` and its value from the hash.
612
- *
613
- * @private
614
- * @name delete
615
- * @memberOf Hash
616
- * @param {Object} hash The hash to modify.
617
- * @param {string} key The key of the value to remove.
618
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
619
- */
620
- function hashDelete(key) {
621
- var result = this.has(key) && delete this.__data__[key];
622
- this.size -= result ? 1 : 0;
623
- return result;
624
- }
625
-
626
- /** Used to stand-in for `undefined` hash values. */
627
- var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
628
-
629
- /** Used for built-in method references. */
630
- var objectProto$8 = Object.prototype;
631
-
632
- /** Used to check objects for own properties. */
633
- var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
634
-
635
- /**
636
- * Gets the hash value for `key`.
637
- *
638
- * @private
639
- * @name get
640
- * @memberOf Hash
641
- * @param {string} key The key of the value to get.
642
- * @returns {*} Returns the entry value.
643
- */
644
- function hashGet(key) {
645
- var data = this.__data__;
646
- if (nativeCreate) {
647
- var result = data[key];
648
- return result === HASH_UNDEFINED$2 ? undefined : result;
649
- }
650
- return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
651
- }
652
-
653
- /** Used for built-in method references. */
654
- var objectProto$7 = Object.prototype;
655
-
656
- /** Used to check objects for own properties. */
657
- var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
658
-
659
- /**
660
- * Checks if a hash value for `key` exists.
661
- *
662
- * @private
663
- * @name has
664
- * @memberOf Hash
665
- * @param {string} key The key of the entry to check.
666
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
667
- */
668
- function hashHas(key) {
669
- var data = this.__data__;
670
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
671
- }
672
-
673
- /** Used to stand-in for `undefined` hash values. */
674
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
675
-
676
- /**
677
- * Sets the hash `key` to `value`.
678
- *
679
- * @private
680
- * @name set
681
- * @memberOf Hash
682
- * @param {string} key The key of the value to set.
683
- * @param {*} value The value to set.
684
- * @returns {Object} Returns the hash instance.
685
- */
686
- function hashSet(key, value) {
687
- var data = this.__data__;
688
- this.size += this.has(key) ? 0 : 1;
689
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
690
- return this;
691
- }
692
-
693
- /**
694
- * Creates a hash object.
695
- *
696
- * @private
697
- * @constructor
698
- * @param {Array} [entries] The key-value pairs to cache.
699
- */
700
- function Hash(entries) {
701
- var index = -1,
702
- length = entries == null ? 0 : entries.length;
703
-
704
- this.clear();
705
- while (++index < length) {
706
- var entry = entries[index];
707
- this.set(entry[0], entry[1]);
708
- }
709
- }
710
-
711
- // Add methods to `Hash`.
712
- Hash.prototype.clear = hashClear;
713
- Hash.prototype['delete'] = hashDelete;
714
- Hash.prototype.get = hashGet;
715
- Hash.prototype.has = hashHas;
716
- Hash.prototype.set = hashSet;
717
-
718
- /**
719
- * Removes all key-value entries from the map.
720
- *
721
- * @private
722
- * @name clear
723
- * @memberOf MapCache
724
- */
725
- function mapCacheClear() {
726
- this.size = 0;
727
- this.__data__ = {
728
- 'hash': new Hash,
729
- 'map': new (Map || ListCache),
730
- 'string': new Hash
731
- };
732
- }
733
-
734
- /**
735
- * Checks if `value` is suitable for use as unique object key.
736
- *
737
- * @private
738
- * @param {*} value The value to check.
739
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
740
- */
741
- function isKeyable(value) {
742
- var type = typeof value;
743
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
744
- ? (value !== '__proto__')
745
- : (value === null);
746
- }
747
-
748
- /**
749
- * Gets the data for `map`.
750
- *
751
- * @private
752
- * @param {Object} map The map to query.
753
- * @param {string} key The reference key.
754
- * @returns {*} Returns the map data.
755
- */
756
- function getMapData(map, key) {
757
- var data = map.__data__;
758
- return isKeyable(key)
759
- ? data[typeof key == 'string' ? 'string' : 'hash']
760
- : data.map;
761
- }
762
-
763
- /**
764
- * Removes `key` and its value from the map.
765
- *
766
- * @private
767
- * @name delete
768
- * @memberOf MapCache
769
- * @param {string} key The key of the value to remove.
770
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
771
- */
772
- function mapCacheDelete(key) {
773
- var result = getMapData(this, key)['delete'](key);
774
- this.size -= result ? 1 : 0;
775
- return result;
776
- }
777
-
778
- /**
779
- * Gets the map value for `key`.
780
- *
781
- * @private
782
- * @name get
783
- * @memberOf MapCache
784
- * @param {string} key The key of the value to get.
785
- * @returns {*} Returns the entry value.
786
- */
787
- function mapCacheGet(key) {
788
- return getMapData(this, key).get(key);
789
- }
790
-
791
- /**
792
- * Checks if a map value for `key` exists.
793
- *
794
- * @private
795
- * @name has
796
- * @memberOf MapCache
797
- * @param {string} key The key of the entry to check.
798
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
799
- */
800
- function mapCacheHas(key) {
801
- return getMapData(this, key).has(key);
802
- }
803
-
804
- /**
805
- * Sets the map `key` to `value`.
806
- *
807
- * @private
808
- * @name set
809
- * @memberOf MapCache
810
- * @param {string} key The key of the value to set.
811
- * @param {*} value The value to set.
812
- * @returns {Object} Returns the map cache instance.
813
- */
814
- function mapCacheSet(key, value) {
815
- var data = getMapData(this, key),
816
- size = data.size;
817
-
818
- data.set(key, value);
819
- this.size += data.size == size ? 0 : 1;
820
- return this;
821
- }
822
-
823
- /**
824
- * Creates a map cache object to store key-value pairs.
825
- *
826
- * @private
827
- * @constructor
828
- * @param {Array} [entries] The key-value pairs to cache.
829
- */
830
- function MapCache(entries) {
831
- var index = -1,
832
- length = entries == null ? 0 : entries.length;
833
-
834
- this.clear();
835
- while (++index < length) {
836
- var entry = entries[index];
837
- this.set(entry[0], entry[1]);
838
- }
839
- }
840
-
841
- // Add methods to `MapCache`.
842
- MapCache.prototype.clear = mapCacheClear;
843
- MapCache.prototype['delete'] = mapCacheDelete;
844
- MapCache.prototype.get = mapCacheGet;
845
- MapCache.prototype.has = mapCacheHas;
846
- MapCache.prototype.set = mapCacheSet;
847
-
848
- /** Used as the size to enable large array optimizations. */
849
- var LARGE_ARRAY_SIZE = 200;
850
-
851
- /**
852
- * Sets the stack `key` to `value`.
853
- *
854
- * @private
855
- * @name set
856
- * @memberOf Stack
857
- * @param {string} key The key of the value to set.
858
- * @param {*} value The value to set.
859
- * @returns {Object} Returns the stack cache instance.
860
- */
861
- function stackSet(key, value) {
862
- var data = this.__data__;
863
- if (data instanceof ListCache) {
864
- var pairs = data.__data__;
865
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
866
- pairs.push([key, value]);
867
- this.size = ++data.size;
868
- return this;
869
- }
870
- data = this.__data__ = new MapCache(pairs);
871
- }
872
- data.set(key, value);
873
- this.size = data.size;
874
- return this;
875
- }
876
-
877
- /**
878
- * Creates a stack cache object to store key-value pairs.
879
- *
880
- * @private
881
- * @constructor
882
- * @param {Array} [entries] The key-value pairs to cache.
883
- */
884
- function Stack(entries) {
885
- var data = this.__data__ = new ListCache(entries);
886
- this.size = data.size;
887
- }
888
-
889
- // Add methods to `Stack`.
890
- Stack.prototype.clear = stackClear;
891
- Stack.prototype['delete'] = stackDelete;
892
- Stack.prototype.get = stackGet;
893
- Stack.prototype.has = stackHas;
894
- Stack.prototype.set = stackSet;
895
-
896
- /** Used to stand-in for `undefined` hash values. */
897
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
898
-
899
- /**
900
- * Adds `value` to the array cache.
901
- *
902
- * @private
903
- * @name add
904
- * @memberOf SetCache
905
- * @alias push
906
- * @param {*} value The value to cache.
907
- * @returns {Object} Returns the cache instance.
908
- */
909
- function setCacheAdd(value) {
910
- this.__data__.set(value, HASH_UNDEFINED);
911
- return this;
912
- }
913
-
914
- /**
915
- * Checks if `value` is in the array cache.
916
- *
917
- * @private
918
- * @name has
919
- * @memberOf SetCache
920
- * @param {*} value The value to search for.
921
- * @returns {number} Returns `true` if `value` is found, else `false`.
922
- */
923
- function setCacheHas(value) {
924
- return this.__data__.has(value);
925
- }
926
-
927
- /**
928
- *
929
- * Creates an array cache object to store unique values.
930
- *
931
- * @private
932
- * @constructor
933
- * @param {Array} [values] The values to cache.
934
- */
935
- function SetCache(values) {
936
- var index = -1,
937
- length = values == null ? 0 : values.length;
938
-
939
- this.__data__ = new MapCache;
940
- while (++index < length) {
941
- this.add(values[index]);
942
- }
943
- }
944
-
945
- // Add methods to `SetCache`.
946
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
947
- SetCache.prototype.has = setCacheHas;
948
-
949
- /**
950
- * A specialized version of `_.some` for arrays without support for iteratee
951
- * shorthands.
952
- *
953
- * @private
954
- * @param {Array} [array] The array to iterate over.
955
- * @param {Function} predicate The function invoked per iteration.
956
- * @returns {boolean} Returns `true` if any element passes the predicate check,
957
- * else `false`.
958
- */
959
- function arraySome(array, predicate) {
960
- var index = -1,
961
- length = array == null ? 0 : array.length;
962
-
963
- while (++index < length) {
964
- if (predicate(array[index], index, array)) {
965
- return true;
966
- }
967
- }
968
- return false;
969
- }
970
-
971
- /**
972
- * Checks if a `cache` value for `key` exists.
973
- *
974
- * @private
975
- * @param {Object} cache The cache to query.
976
- * @param {string} key The key of the entry to check.
977
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
978
- */
979
- function cacheHas(cache, key) {
980
- return cache.has(key);
981
- }
982
-
983
- /** Used to compose bitmasks for value comparisons. */
984
- var COMPARE_PARTIAL_FLAG$3 = 1,
985
- COMPARE_UNORDERED_FLAG$1 = 2;
986
-
987
- /**
988
- * A specialized version of `baseIsEqualDeep` for arrays with support for
989
- * partial deep comparisons.
990
- *
991
- * @private
992
- * @param {Array} array The array to compare.
993
- * @param {Array} other The other array to compare.
994
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
995
- * @param {Function} customizer The function to customize comparisons.
996
- * @param {Function} equalFunc The function to determine equivalents of values.
997
- * @param {Object} stack Tracks traversed `array` and `other` objects.
998
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
999
- */
1000
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1001
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
1002
- arrLength = array.length,
1003
- othLength = other.length;
1004
-
1005
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1006
- return false;
1007
- }
1008
- // Check that cyclic values are equal.
1009
- var arrStacked = stack.get(array);
1010
- var othStacked = stack.get(other);
1011
- if (arrStacked && othStacked) {
1012
- return arrStacked == other && othStacked == array;
1013
- }
1014
- var index = -1,
1015
- result = true,
1016
- seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined;
1017
-
1018
- stack.set(array, other);
1019
- stack.set(other, array);
1020
-
1021
- // Ignore non-index properties.
1022
- while (++index < arrLength) {
1023
- var arrValue = array[index],
1024
- othValue = other[index];
1025
-
1026
- if (customizer) {
1027
- var compared = isPartial
1028
- ? customizer(othValue, arrValue, index, other, array, stack)
1029
- : customizer(arrValue, othValue, index, array, other, stack);
1030
- }
1031
- if (compared !== undefined) {
1032
- if (compared) {
1033
- continue;
1034
- }
1035
- result = false;
1036
- break;
1037
- }
1038
- // Recursively compare arrays (susceptible to call stack limits).
1039
- if (seen) {
1040
- if (!arraySome(other, function(othValue, othIndex) {
1041
- if (!cacheHas(seen, othIndex) &&
1042
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1043
- return seen.push(othIndex);
1044
- }
1045
- })) {
1046
- result = false;
1047
- break;
1048
- }
1049
- } else if (!(
1050
- arrValue === othValue ||
1051
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
1052
- )) {
1053
- result = false;
1054
- break;
1055
- }
1056
- }
1057
- stack['delete'](array);
1058
- stack['delete'](other);
1059
- return result;
1060
- }
1061
-
1062
- /** Built-in value references. */
1063
- var Uint8Array = root.Uint8Array;
1064
-
1065
- /**
1066
- * Converts `map` to its key-value pairs.
1067
- *
1068
- * @private
1069
- * @param {Object} map The map to convert.
1070
- * @returns {Array} Returns the key-value pairs.
1071
- */
1072
- function mapToArray(map) {
1073
- var index = -1,
1074
- result = Array(map.size);
1075
-
1076
- map.forEach(function(value, key) {
1077
- result[++index] = [key, value];
1078
- });
1079
- return result;
1080
- }
1081
-
1082
- /**
1083
- * Converts `set` to an array of its values.
1084
- *
1085
- * @private
1086
- * @param {Object} set The set to convert.
1087
- * @returns {Array} Returns the values.
1088
- */
1089
- function setToArray(set) {
1090
- var index = -1,
1091
- result = Array(set.size);
1092
-
1093
- set.forEach(function(value) {
1094
- result[++index] = value;
1095
- });
1096
- return result;
1097
- }
1098
-
1099
- /** Used to compose bitmasks for value comparisons. */
1100
- var COMPARE_PARTIAL_FLAG$2 = 1,
1101
- COMPARE_UNORDERED_FLAG = 2;
1102
-
1103
- /** `Object#toString` result references. */
1104
- var boolTag$1 = '[object Boolean]',
1105
- dateTag$1 = '[object Date]',
1106
- errorTag$1 = '[object Error]',
1107
- mapTag$2 = '[object Map]',
1108
- numberTag$1 = '[object Number]',
1109
- regexpTag$1 = '[object RegExp]',
1110
- setTag$2 = '[object Set]',
1111
- stringTag$1 = '[object String]',
1112
- symbolTag = '[object Symbol]';
1113
-
1114
- var arrayBufferTag$1 = '[object ArrayBuffer]',
1115
- dataViewTag$2 = '[object DataView]';
1116
-
1117
- /** Used to convert symbols to primitives and strings. */
1118
- var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
1119
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
1120
-
1121
- /**
1122
- * A specialized version of `baseIsEqualDeep` for comparing objects of
1123
- * the same `toStringTag`.
1124
- *
1125
- * **Note:** This function only supports comparing values with tags of
1126
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1127
- *
1128
- * @private
1129
- * @param {Object} object The object to compare.
1130
- * @param {Object} other The other object to compare.
1131
- * @param {string} tag The `toStringTag` of the objects to compare.
1132
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1133
- * @param {Function} customizer The function to customize comparisons.
1134
- * @param {Function} equalFunc The function to determine equivalents of values.
1135
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1136
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1137
- */
1138
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1139
- switch (tag) {
1140
- case dataViewTag$2:
1141
- if ((object.byteLength != other.byteLength) ||
1142
- (object.byteOffset != other.byteOffset)) {
1143
- return false;
1144
- }
1145
- object = object.buffer;
1146
- other = other.buffer;
1147
-
1148
- case arrayBufferTag$1:
1149
- if ((object.byteLength != other.byteLength) ||
1150
- !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1151
- return false;
1152
- }
1153
- return true;
1154
-
1155
- case boolTag$1:
1156
- case dateTag$1:
1157
- case numberTag$1:
1158
- // Coerce booleans to `1` or `0` and dates to milliseconds.
1159
- // Invalid dates are coerced to `NaN`.
1160
- return eq(+object, +other);
1161
-
1162
- case errorTag$1:
1163
- return object.name == other.name && object.message == other.message;
1164
-
1165
- case regexpTag$1:
1166
- case stringTag$1:
1167
- // Coerce regexes to strings and treat strings, primitives and objects,
1168
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1169
- // for more details.
1170
- return object == (other + '');
1171
-
1172
- case mapTag$2:
1173
- var convert = mapToArray;
1174
-
1175
- case setTag$2:
1176
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
1177
- convert || (convert = setToArray);
1178
-
1179
- if (object.size != other.size && !isPartial) {
1180
- return false;
1181
- }
1182
- // Assume cyclic values are equal.
1183
- var stacked = stack.get(object);
1184
- if (stacked) {
1185
- return stacked == other;
1186
- }
1187
- bitmask |= COMPARE_UNORDERED_FLAG;
1188
-
1189
- // Recursively compare objects (susceptible to call stack limits).
1190
- stack.set(object, other);
1191
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1192
- stack['delete'](object);
1193
- return result;
1194
-
1195
- case symbolTag:
1196
- if (symbolValueOf) {
1197
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1198
- }
1199
- }
1200
- return false;
1201
- }
1202
-
1203
- /**
1204
- * Appends the elements of `values` to `array`.
1205
- *
1206
- * @private
1207
- * @param {Array} array The array to modify.
1208
- * @param {Array} values The values to append.
1209
- * @returns {Array} Returns `array`.
1210
- */
1211
- function arrayPush(array, values) {
1212
- var index = -1,
1213
- length = values.length,
1214
- offset = array.length;
1215
-
1216
- while (++index < length) {
1217
- array[offset + index] = values[index];
1218
- }
1219
- return array;
1220
- }
1221
-
1222
- /**
1223
- * Checks if `value` is classified as an `Array` object.
1224
- *
1225
- * @static
1226
- * @memberOf _
1227
- * @since 0.1.0
1228
- * @category Lang
1229
- * @param {*} value The value to check.
1230
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1231
- * @example
1232
- *
1233
- * _.isArray([1, 2, 3]);
1234
- * // => true
1235
- *
1236
- * _.isArray(document.body.children);
1237
- * // => false
1238
- *
1239
- * _.isArray('abc');
1240
- * // => false
1241
- *
1242
- * _.isArray(_.noop);
1243
- * // => false
1244
- */
1245
- var isArray = Array.isArray;
1246
-
1247
- /**
1248
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1249
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1250
- * symbols of `object`.
1251
- *
1252
- * @private
1253
- * @param {Object} object The object to query.
1254
- * @param {Function} keysFunc The function to get the keys of `object`.
1255
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
1256
- * @returns {Array} Returns the array of property names and symbols.
1257
- */
1258
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1259
- var result = keysFunc(object);
1260
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
1261
- }
1262
-
1263
- /**
1264
- * A specialized version of `_.filter` for arrays without support for
1265
- * iteratee shorthands.
1266
- *
1267
- * @private
1268
- * @param {Array} [array] The array to iterate over.
1269
- * @param {Function} predicate The function invoked per iteration.
1270
- * @returns {Array} Returns the new filtered array.
1271
- */
1272
- function arrayFilter(array, predicate) {
1273
- var index = -1,
1274
- length = array == null ? 0 : array.length,
1275
- resIndex = 0,
1276
- result = [];
1277
-
1278
- while (++index < length) {
1279
- var value = array[index];
1280
- if (predicate(value, index, array)) {
1281
- result[resIndex++] = value;
1282
- }
1283
- }
1284
- return result;
1285
- }
1286
-
1287
- /**
1288
- * This method returns a new empty array.
1289
- *
1290
- * @static
1291
- * @memberOf _
1292
- * @since 4.13.0
1293
- * @category Util
1294
- * @returns {Array} Returns the new empty array.
1295
- * @example
1296
- *
1297
- * var arrays = _.times(2, _.stubArray);
1298
- *
1299
- * console.log(arrays);
1300
- * // => [[], []]
1301
- *
1302
- * console.log(arrays[0] === arrays[1]);
1303
- * // => false
1304
- */
1305
- function stubArray() {
1306
- return [];
1307
- }
1308
-
1309
- /** Used for built-in method references. */
1310
- var objectProto$6 = Object.prototype;
1311
-
1312
- /** Built-in value references. */
1313
- var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
1314
-
1315
- /* Built-in method references for those with the same name as other `lodash` methods. */
1316
- var nativeGetSymbols = Object.getOwnPropertySymbols;
1317
-
1318
- /**
1319
- * Creates an array of the own enumerable symbols of `object`.
1320
- *
1321
- * @private
1322
- * @param {Object} object The object to query.
1323
- * @returns {Array} Returns the array of symbols.
1324
- */
1325
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1326
- if (object == null) {
1327
- return [];
1328
- }
1329
- object = Object(object);
1330
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
1331
- return propertyIsEnumerable$1.call(object, symbol);
1332
- });
1333
- };
1334
-
1335
- /**
1336
- * The base implementation of `_.times` without support for iteratee shorthands
1337
- * or max array length checks.
1338
- *
1339
- * @private
1340
- * @param {number} n The number of times to invoke `iteratee`.
1341
- * @param {Function} iteratee The function invoked per iteration.
1342
- * @returns {Array} Returns the array of results.
1343
- */
1344
- function baseTimes(n, iteratee) {
1345
- var index = -1,
1346
- result = Array(n);
1347
-
1348
- while (++index < n) {
1349
- result[index] = iteratee(index);
1350
- }
1351
- return result;
1352
- }
1353
-
1354
- /**
1355
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1356
- * and has a `typeof` result of "object".
1357
- *
1358
- * @static
1359
- * @memberOf _
1360
- * @since 4.0.0
1361
- * @category Lang
1362
- * @param {*} value The value to check.
1363
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1364
- * @example
1365
- *
1366
- * _.isObjectLike({});
1367
- * // => true
1368
- *
1369
- * _.isObjectLike([1, 2, 3]);
1370
- * // => true
1371
- *
1372
- * _.isObjectLike(_.noop);
1373
- * // => false
1374
- *
1375
- * _.isObjectLike(null);
1376
- * // => false
1377
- */
1378
- function isObjectLike(value) {
1379
- return value != null && typeof value == 'object';
1380
- }
1381
-
1382
- /** `Object#toString` result references. */
1383
- var argsTag$2 = '[object Arguments]';
1384
-
1385
- /**
1386
- * The base implementation of `_.isArguments`.
1387
- *
1388
- * @private
1389
- * @param {*} value The value to check.
1390
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1391
- */
1392
- function baseIsArguments(value) {
1393
- return isObjectLike(value) && baseGetTag(value) == argsTag$2;
1394
- }
1395
-
1396
- /** Used for built-in method references. */
1397
- var objectProto$5 = Object.prototype;
1398
-
1399
- /** Used to check objects for own properties. */
1400
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
1401
-
1402
- /** Built-in value references. */
1403
- var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
1404
-
1405
- /**
1406
- * Checks if `value` is likely an `arguments` object.
1407
- *
1408
- * @static
1409
- * @memberOf _
1410
- * @since 0.1.0
1411
- * @category Lang
1412
- * @param {*} value The value to check.
1413
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1414
- * else `false`.
1415
- * @example
1416
- *
1417
- * _.isArguments(function() { return arguments; }());
1418
- * // => true
1419
- *
1420
- * _.isArguments([1, 2, 3]);
1421
- * // => false
1422
- */
1423
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1424
- return isObjectLike(value) && hasOwnProperty$4.call(value, 'callee') &&
1425
- !propertyIsEnumerable.call(value, 'callee');
1426
- };
1427
-
1428
- /**
1429
- * This method returns `false`.
1430
- *
1431
- * @static
1432
- * @memberOf _
1433
- * @since 4.13.0
1434
- * @category Util
1435
- * @returns {boolean} Returns `false`.
1436
- * @example
1437
- *
1438
- * _.times(2, _.stubFalse);
1439
- * // => [false, false]
1440
- */
1441
- function stubFalse() {
1442
- return false;
1443
- }
1444
-
1445
- /** Detect free variable `exports`. */
1446
- var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
1447
-
1448
- /** Detect free variable `module`. */
1449
- var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
1450
-
1451
- /** Detect the popular CommonJS extension `module.exports`. */
1452
- var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
1453
-
1454
- /** Built-in value references. */
1455
- var Buffer = moduleExports$1 ? root.Buffer : undefined;
1456
-
1457
- /* Built-in method references for those with the same name as other `lodash` methods. */
1458
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1459
-
1460
- /**
1461
- * Checks if `value` is a buffer.
1462
- *
1463
- * @static
1464
- * @memberOf _
1465
- * @since 4.3.0
1466
- * @category Lang
1467
- * @param {*} value The value to check.
1468
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1469
- * @example
1470
- *
1471
- * _.isBuffer(new Buffer(2));
1472
- * // => true
1473
- *
1474
- * _.isBuffer(new Uint8Array(2));
1475
- * // => false
1476
- */
1477
- var isBuffer = nativeIsBuffer || stubFalse;
1478
-
1479
- /** Used as references for various `Number` constants. */
1480
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
1481
-
1482
- /** Used to detect unsigned integer values. */
1483
- var reIsUint = /^(?:0|[1-9]\d*)$/;
1484
-
1485
- /**
1486
- * Checks if `value` is a valid array-like index.
1487
- *
1488
- * @private
1489
- * @param {*} value The value to check.
1490
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1491
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1492
- */
1493
- function isIndex(value, length) {
1494
- var type = typeof value;
1495
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
1496
-
1497
- return !!length &&
1498
- (type == 'number' ||
1499
- (type != 'symbol' && reIsUint.test(value))) &&
1500
- (value > -1 && value % 1 == 0 && value < length);
1501
- }
1502
-
1503
- /** Used as references for various `Number` constants. */
1504
- var MAX_SAFE_INTEGER = 9007199254740991;
1505
-
1506
- /**
1507
- * Checks if `value` is a valid array-like length.
1508
- *
1509
- * **Note:** This method is loosely based on
1510
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1511
- *
1512
- * @static
1513
- * @memberOf _
1514
- * @since 4.0.0
1515
- * @category Lang
1516
- * @param {*} value The value to check.
1517
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1518
- * @example
1519
- *
1520
- * _.isLength(3);
1521
- * // => true
1522
- *
1523
- * _.isLength(Number.MIN_VALUE);
1524
- * // => false
1525
- *
1526
- * _.isLength(Infinity);
1527
- * // => false
1528
- *
1529
- * _.isLength('3');
1530
- * // => false
1531
- */
1532
- function isLength(value) {
1533
- return typeof value == 'number' &&
1534
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1535
- }
1536
-
1537
- /** `Object#toString` result references. */
1538
- var argsTag$1 = '[object Arguments]',
1539
- arrayTag$1 = '[object Array]',
1540
- boolTag = '[object Boolean]',
1541
- dateTag = '[object Date]',
1542
- errorTag = '[object Error]',
1543
- funcTag = '[object Function]',
1544
- mapTag$1 = '[object Map]',
1545
- numberTag = '[object Number]',
1546
- objectTag$2 = '[object Object]',
1547
- regexpTag = '[object RegExp]',
1548
- setTag$1 = '[object Set]',
1549
- stringTag = '[object String]',
1550
- weakMapTag$1 = '[object WeakMap]';
1551
-
1552
- var arrayBufferTag = '[object ArrayBuffer]',
1553
- dataViewTag$1 = '[object DataView]',
1554
- float32Tag = '[object Float32Array]',
1555
- float64Tag = '[object Float64Array]',
1556
- int8Tag = '[object Int8Array]',
1557
- int16Tag = '[object Int16Array]',
1558
- int32Tag = '[object Int32Array]',
1559
- uint8Tag = '[object Uint8Array]',
1560
- uint8ClampedTag = '[object Uint8ClampedArray]',
1561
- uint16Tag = '[object Uint16Array]',
1562
- uint32Tag = '[object Uint32Array]';
1563
-
1564
- /** Used to identify `toStringTag` values of typed arrays. */
1565
- var typedArrayTags = {};
1566
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1567
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1568
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1569
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1570
- typedArrayTags[uint32Tag] = true;
1571
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
1572
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
1573
- typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
1574
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
1575
- typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
1576
- typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
1577
- typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
1578
- typedArrayTags[weakMapTag$1] = false;
1579
-
1580
- /**
1581
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1582
- *
1583
- * @private
1584
- * @param {*} value The value to check.
1585
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1586
- */
1587
- function baseIsTypedArray(value) {
1588
- return isObjectLike(value) &&
1589
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1590
- }
1591
-
1592
- /**
1593
- * The base implementation of `_.unary` without support for storing metadata.
1594
- *
1595
- * @private
1596
- * @param {Function} func The function to cap arguments for.
1597
- * @returns {Function} Returns the new capped function.
1598
- */
1599
- function baseUnary(func) {
1600
- return function(value) {
1601
- return func(value);
1602
- };
1603
- }
1604
-
1605
- /** Detect free variable `exports`. */
1606
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
1607
-
1608
- /** Detect free variable `module`. */
1609
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
1610
-
1611
- /** Detect the popular CommonJS extension `module.exports`. */
1612
- var moduleExports = freeModule && freeModule.exports === freeExports;
1613
-
1614
- /** Detect free variable `process` from Node.js. */
1615
- var freeProcess = moduleExports && freeGlobal.process;
1616
-
1617
- /** Used to access faster Node.js helpers. */
1618
- var nodeUtil = (function() {
1619
- try {
1620
- // Use `util.types` for Node.js 10+.
1621
- var types = freeModule && freeModule.require && freeModule.require('util').types;
1622
-
1623
- if (types) {
1624
- return types;
1625
- }
1626
-
1627
- // Legacy `process.binding('util')` for Node.js < 10.
1628
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
1629
- } catch (e) {}
1630
- }());
1631
-
1632
- /* Node.js helper references. */
1633
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1634
-
1635
- /**
1636
- * Checks if `value` is classified as a typed array.
1637
- *
1638
- * @static
1639
- * @memberOf _
1640
- * @since 3.0.0
1641
- * @category Lang
1642
- * @param {*} value The value to check.
1643
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1644
- * @example
1645
- *
1646
- * _.isTypedArray(new Uint8Array);
1647
- * // => true
1648
- *
1649
- * _.isTypedArray([]);
1650
- * // => false
1651
- */
1652
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1653
-
1654
- /** Used for built-in method references. */
1655
- var objectProto$4 = Object.prototype;
1656
-
1657
- /** Used to check objects for own properties. */
1658
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1659
-
1660
- /**
1661
- * Creates an array of the enumerable property names of the array-like `value`.
1662
- *
1663
- * @private
1664
- * @param {*} value The value to query.
1665
- * @param {boolean} inherited Specify returning inherited property names.
1666
- * @returns {Array} Returns the array of property names.
1667
- */
1668
- function arrayLikeKeys(value, inherited) {
1669
- var isArr = isArray(value),
1670
- isArg = !isArr && isArguments(value),
1671
- isBuff = !isArr && !isArg && isBuffer(value),
1672
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
1673
- skipIndexes = isArr || isArg || isBuff || isType,
1674
- result = skipIndexes ? baseTimes(value.length, String) : [],
1675
- length = result.length;
1676
-
1677
- for (var key in value) {
1678
- if ((inherited || hasOwnProperty$3.call(value, key)) &&
1679
- !(skipIndexes && (
1680
- // Safari 9 has enumerable `arguments.length` in strict mode.
1681
- key == 'length' ||
1682
- // Node.js 0.10 has enumerable non-index properties on buffers.
1683
- (isBuff && (key == 'offset' || key == 'parent')) ||
1684
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
1685
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1686
- // Skip index properties.
1687
- isIndex(key, length)
1688
- ))) {
1689
- result.push(key);
1690
- }
1691
- }
1692
- return result;
1693
- }
1694
-
1695
- /** Used for built-in method references. */
1696
- var objectProto$3 = Object.prototype;
1697
-
1698
- /**
1699
- * Checks if `value` is likely a prototype object.
1700
- *
1701
- * @private
1702
- * @param {*} value The value to check.
1703
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1704
- */
1705
- function isPrototype(value) {
1706
- var Ctor = value && value.constructor,
1707
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
1708
-
1709
- return value === proto;
1710
- }
1711
-
1712
- /**
1713
- * Creates a unary function that invokes `func` with its argument transformed.
1714
- *
1715
- * @private
1716
- * @param {Function} func The function to wrap.
1717
- * @param {Function} transform The argument transform.
1718
- * @returns {Function} Returns the new function.
1719
- */
1720
- function overArg(func, transform) {
1721
- return function(arg) {
1722
- return func(transform(arg));
1723
- };
1724
- }
1725
-
1726
- /* Built-in method references for those with the same name as other `lodash` methods. */
1727
- var nativeKeys = overArg(Object.keys, Object);
1728
-
1729
- /** Used for built-in method references. */
1730
- var objectProto$2 = Object.prototype;
1731
-
1732
- /** Used to check objects for own properties. */
1733
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
1734
-
1735
- /**
1736
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1737
- *
1738
- * @private
1739
- * @param {Object} object The object to query.
1740
- * @returns {Array} Returns the array of property names.
1741
- */
1742
- function baseKeys(object) {
1743
- if (!isPrototype(object)) {
1744
- return nativeKeys(object);
1745
- }
1746
- var result = [];
1747
- for (var key in Object(object)) {
1748
- if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
1749
- result.push(key);
1750
- }
1751
- }
1752
- return result;
1753
- }
1754
-
1755
- /**
1756
- * Checks if `value` is array-like. A value is considered array-like if it's
1757
- * not a function and has a `value.length` that's an integer greater than or
1758
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1759
- *
1760
- * @static
1761
- * @memberOf _
1762
- * @since 4.0.0
1763
- * @category Lang
1764
- * @param {*} value The value to check.
1765
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1766
- * @example
1767
- *
1768
- * _.isArrayLike([1, 2, 3]);
1769
- * // => true
1770
- *
1771
- * _.isArrayLike(document.body.children);
1772
- * // => true
1773
- *
1774
- * _.isArrayLike('abc');
1775
- * // => true
1776
- *
1777
- * _.isArrayLike(_.noop);
1778
- * // => false
1779
- */
1780
- function isArrayLike(value) {
1781
- return value != null && isLength(value.length) && !isFunction(value);
1782
- }
1783
-
1784
- /**
1785
- * Creates an array of the own enumerable property names of `object`.
1786
- *
1787
- * **Note:** Non-object values are coerced to objects. See the
1788
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1789
- * for more details.
1790
- *
1791
- * @static
1792
- * @since 0.1.0
1793
- * @memberOf _
1794
- * @category Object
1795
- * @param {Object} object The object to query.
1796
- * @returns {Array} Returns the array of property names.
1797
- * @example
1798
- *
1799
- * function Foo() {
1800
- * this.a = 1;
1801
- * this.b = 2;
1802
- * }
1803
- *
1804
- * Foo.prototype.c = 3;
1805
- *
1806
- * _.keys(new Foo);
1807
- * // => ['a', 'b'] (iteration order is not guaranteed)
1808
- *
1809
- * _.keys('hi');
1810
- * // => ['0', '1']
1811
- */
1812
- function keys(object) {
1813
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1814
- }
1815
-
1816
- /**
1817
- * Creates an array of own enumerable property names and symbols of `object`.
1818
- *
1819
- * @private
1820
- * @param {Object} object The object to query.
1821
- * @returns {Array} Returns the array of property names and symbols.
1822
- */
1823
- function getAllKeys(object) {
1824
- return baseGetAllKeys(object, keys, getSymbols);
1825
- }
1826
-
1827
- /** Used to compose bitmasks for value comparisons. */
1828
- var COMPARE_PARTIAL_FLAG$1 = 1;
1829
-
1830
- /** Used for built-in method references. */
1831
- var objectProto$1 = Object.prototype;
1832
-
1833
- /** Used to check objects for own properties. */
1834
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
1835
-
1836
- /**
1837
- * A specialized version of `baseIsEqualDeep` for objects with support for
1838
- * partial deep comparisons.
1839
- *
1840
- * @private
1841
- * @param {Object} object The object to compare.
1842
- * @param {Object} other The other object to compare.
1843
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1844
- * @param {Function} customizer The function to customize comparisons.
1845
- * @param {Function} equalFunc The function to determine equivalents of values.
1846
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1847
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1848
- */
1849
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1850
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
1851
- objProps = getAllKeys(object),
1852
- objLength = objProps.length,
1853
- othProps = getAllKeys(other),
1854
- othLength = othProps.length;
1855
-
1856
- if (objLength != othLength && !isPartial) {
1857
- return false;
1858
- }
1859
- var index = objLength;
1860
- while (index--) {
1861
- var key = objProps[index];
1862
- if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
1863
- return false;
1864
- }
1865
- }
1866
- // Check that cyclic values are equal.
1867
- var objStacked = stack.get(object);
1868
- var othStacked = stack.get(other);
1869
- if (objStacked && othStacked) {
1870
- return objStacked == other && othStacked == object;
1871
- }
1872
- var result = true;
1873
- stack.set(object, other);
1874
- stack.set(other, object);
1875
-
1876
- var skipCtor = isPartial;
1877
- while (++index < objLength) {
1878
- key = objProps[index];
1879
- var objValue = object[key],
1880
- othValue = other[key];
1881
-
1882
- if (customizer) {
1883
- var compared = isPartial
1884
- ? customizer(othValue, objValue, key, other, object, stack)
1885
- : customizer(objValue, othValue, key, object, other, stack);
1886
- }
1887
- // Recursively compare objects (susceptible to call stack limits).
1888
- if (!(compared === undefined
1889
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1890
- : compared
1891
- )) {
1892
- result = false;
1893
- break;
1894
- }
1895
- skipCtor || (skipCtor = key == 'constructor');
1896
- }
1897
- if (result && !skipCtor) {
1898
- var objCtor = object.constructor,
1899
- othCtor = other.constructor;
1900
-
1901
- // Non `Object` object instances with different constructors are not equal.
1902
- if (objCtor != othCtor &&
1903
- ('constructor' in object && 'constructor' in other) &&
1904
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1905
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1906
- result = false;
1907
- }
1908
- }
1909
- stack['delete'](object);
1910
- stack['delete'](other);
1911
- return result;
1912
- }
1913
-
1914
- /* Built-in method references that are verified to be native. */
1915
- var DataView = getNative(root, 'DataView');
1916
-
1917
- /* Built-in method references that are verified to be native. */
1918
- var Promise$1 = getNative(root, 'Promise');
1919
-
1920
- /* Built-in method references that are verified to be native. */
1921
- var Set = getNative(root, 'Set');
1922
-
1923
- /* Built-in method references that are verified to be native. */
1924
- var WeakMap = getNative(root, 'WeakMap');
1925
-
1926
- /** `Object#toString` result references. */
1927
- var mapTag = '[object Map]',
1928
- objectTag$1 = '[object Object]',
1929
- promiseTag = '[object Promise]',
1930
- setTag = '[object Set]',
1931
- weakMapTag = '[object WeakMap]';
1932
-
1933
- var dataViewTag = '[object DataView]';
1934
-
1935
- /** Used to detect maps, sets, and weakmaps. */
1936
- var dataViewCtorString = toSource(DataView),
1937
- mapCtorString = toSource(Map),
1938
- promiseCtorString = toSource(Promise$1),
1939
- setCtorString = toSource(Set),
1940
- weakMapCtorString = toSource(WeakMap);
1941
-
1942
- /**
1943
- * Gets the `toStringTag` of `value`.
1944
- *
1945
- * @private
1946
- * @param {*} value The value to query.
1947
- * @returns {string} Returns the `toStringTag`.
1948
- */
1949
- var getTag = baseGetTag;
1950
-
1951
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1952
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
1953
- (Map && getTag(new Map) != mapTag) ||
1954
- (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
1955
- (Set && getTag(new Set) != setTag) ||
1956
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
1957
- getTag = function(value) {
1958
- var result = baseGetTag(value),
1959
- Ctor = result == objectTag$1 ? value.constructor : undefined,
1960
- ctorString = Ctor ? toSource(Ctor) : '';
1961
-
1962
- if (ctorString) {
1963
- switch (ctorString) {
1964
- case dataViewCtorString: return dataViewTag;
1965
- case mapCtorString: return mapTag;
1966
- case promiseCtorString: return promiseTag;
1967
- case setCtorString: return setTag;
1968
- case weakMapCtorString: return weakMapTag;
1969
- }
1970
- }
1971
- return result;
1972
- };
1973
- }
1974
-
1975
- var getTag$1 = getTag;
1976
-
1977
- /** Used to compose bitmasks for value comparisons. */
1978
- var COMPARE_PARTIAL_FLAG = 1;
1979
-
1980
- /** `Object#toString` result references. */
1981
- var argsTag = '[object Arguments]',
1982
- arrayTag = '[object Array]',
1983
- objectTag = '[object Object]';
1984
-
1985
- /** Used for built-in method references. */
1986
- var objectProto = Object.prototype;
1987
-
1988
- /** Used to check objects for own properties. */
1989
- var hasOwnProperty = objectProto.hasOwnProperty;
1990
-
1991
- /**
1992
- * A specialized version of `baseIsEqual` for arrays and objects which performs
1993
- * deep comparisons and tracks traversed objects enabling objects with circular
1994
- * references to be compared.
1995
- *
1996
- * @private
1997
- * @param {Object} object The object to compare.
1998
- * @param {Object} other The other object to compare.
1999
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2000
- * @param {Function} customizer The function to customize comparisons.
2001
- * @param {Function} equalFunc The function to determine equivalents of values.
2002
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
2003
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2004
- */
2005
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
2006
- var objIsArr = isArray(object),
2007
- othIsArr = isArray(other),
2008
- objTag = objIsArr ? arrayTag : getTag$1(object),
2009
- othTag = othIsArr ? arrayTag : getTag$1(other);
2010
-
2011
- objTag = objTag == argsTag ? objectTag : objTag;
2012
- othTag = othTag == argsTag ? objectTag : othTag;
2013
-
2014
- var objIsObj = objTag == objectTag,
2015
- othIsObj = othTag == objectTag,
2016
- isSameTag = objTag == othTag;
2017
-
2018
- if (isSameTag && isBuffer(object)) {
2019
- if (!isBuffer(other)) {
2020
- return false;
2021
- }
2022
- objIsArr = true;
2023
- objIsObj = false;
2024
- }
2025
- if (isSameTag && !objIsObj) {
2026
- stack || (stack = new Stack);
2027
- return (objIsArr || isTypedArray(object))
2028
- ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
2029
- : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
2030
- }
2031
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
2032
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
2033
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
2034
-
2035
- if (objIsWrapped || othIsWrapped) {
2036
- var objUnwrapped = objIsWrapped ? object.value() : object,
2037
- othUnwrapped = othIsWrapped ? other.value() : other;
2038
-
2039
- stack || (stack = new Stack);
2040
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
2041
- }
2042
- }
2043
- if (!isSameTag) {
2044
- return false;
2045
- }
2046
- stack || (stack = new Stack);
2047
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
2048
- }
2049
-
2050
- /**
2051
- * The base implementation of `_.isEqual` which supports partial comparisons
2052
- * and tracks traversed objects.
2053
- *
2054
- * @private
2055
- * @param {*} value The value to compare.
2056
- * @param {*} other The other value to compare.
2057
- * @param {boolean} bitmask The bitmask flags.
2058
- * 1 - Unordered comparison
2059
- * 2 - Partial comparison
2060
- * @param {Function} [customizer] The function to customize comparisons.
2061
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
2062
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2063
- */
2064
- function baseIsEqual(value, other, bitmask, customizer, stack) {
2065
- if (value === other) {
2066
- return true;
2067
- }
2068
- if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
2069
- return value !== value && other !== other;
2070
- }
2071
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
2072
- }
2073
-
2074
- /**
2075
- * Performs a deep comparison between two values to determine if they are
2076
- * equivalent.
2077
- *
2078
- * **Note:** This method supports comparing arrays, array buffers, booleans,
2079
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
2080
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
2081
- * by their own, not inherited, enumerable properties. Functions and DOM
2082
- * nodes are compared by strict equality, i.e. `===`.
2083
- *
2084
- * @static
2085
- * @memberOf _
2086
- * @since 0.1.0
2087
- * @category Lang
2088
- * @param {*} value The value to compare.
2089
- * @param {*} other The other value to compare.
2090
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2091
- * @example
2092
- *
2093
- * var object = { 'a': 1 };
2094
- * var other = { 'a': 1 };
2095
- *
2096
- * _.isEqual(object, other);
2097
- * // => true
2098
- *
2099
- * object === other;
2100
- * // => false
2101
- */
2102
- function isEqual(value, other) {
2103
- return baseIsEqual(value, other);
2104
- }
2105
-
2106
- var RendererManager = (function () {
2107
- function RendererManager(_a) {
2108
- var game = _a.game, rendererSystem = _a.rendererSystem;
2109
- this.renderers = [];
2110
- this.game = game;
2111
- this.rendererSystem = rendererSystem;
2112
- }
2113
- RendererManager.prototype.register = function () {
2114
- var e_1, _a;
2115
- var renderers = [];
2116
- for (var _i = 0; _i < arguments.length; _i++) {
2117
- renderers[_i] = arguments[_i];
2118
- }
2119
- try {
2120
- for (var renderers_1 = __values(renderers), renderers_1_1 = renderers_1.next(); !renderers_1_1.done; renderers_1_1 = renderers_1.next()) {
2121
- var renderer = renderers_1_1.value;
2122
- renderer.game = this.game;
2123
- renderer.rendererManager = this.rendererSystem.rendererManager;
2124
- renderer.containerManager = this.rendererSystem.containerManager;
2125
- this.renderers.push(renderer);
2126
- }
2127
- }
2128
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2129
- finally {
2130
- try {
2131
- if (renderers_1_1 && !renderers_1_1.done && (_a = renderers_1.return)) _a.call(renderers_1);
2132
- }
2133
- finally { if (e_1) throw e_1.error; }
2134
- }
2135
- };
2136
- RendererManager.prototype.componentChanged = function (changes) {
2137
- var e_2, _a;
2138
- var _loop_1 = function (changed) {
2139
- var e_3, _a;
2140
- try {
2141
- for (var _b = (e_3 = void 0, __values(this_1.renderers)), _c = _b.next(); !_c.done; _c = _b.next()) {
2142
- var renderer = _c.value;
2143
- var props = renderer.observerInfo[changed.componentName];
2144
- if (props) {
2145
- if ([eva_js.OBSERVER_TYPE.ADD, eva_js.OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) {
2146
- try {
2147
- renderer.componentChanged && renderer.componentChanged(changed);
2148
- }
2149
- catch (e) {
2150
- console.error("gameObject: " + changed.gameObject.name + ", " + changed.componentName + " is error.", changed, e);
2151
- }
2152
- continue;
2153
- }
2154
- var index = props.findIndex(function (prop) {
2155
- return isEqual(prop, changed.prop);
2156
- });
2157
- if (index > -1) {
2158
- try {
2159
- renderer.componentChanged && renderer.componentChanged(changed);
2160
- }
2161
- catch (e) {
2162
- console.error("gameObject: " + (changed.gameObject && changed.gameObject.name) + ", " + changed.componentName + " is componentChanged error.", changed, e);
2163
- }
2164
- }
2165
- }
2166
- }
2167
- }
2168
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2169
- finally {
2170
- try {
2171
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2172
- }
2173
- finally { if (e_3) throw e_3.error; }
2174
- }
2175
- };
2176
- var this_1 = this;
2177
- try {
2178
- for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
2179
- var changed = changes_1_1.value;
2180
- _loop_1(changed);
2181
- }
2182
- }
2183
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2184
- finally {
2185
- try {
2186
- if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
2187
- }
2188
- finally { if (e_2) throw e_2.error; }
2189
- }
2190
- };
2191
- RendererManager.prototype.update = function (gameObject) {
2192
- var e_4, _a, e_5, _b;
2193
- try {
2194
- for (var _c = __values(gameObject.components), _d = _c.next(); !_d.done; _d = _c.next()) {
2195
- var component = _d.value;
2196
- try {
2197
- for (var _e = (e_5 = void 0, __values(this.renderers)), _f = _e.next(); !_f.done; _f = _e.next()) {
2198
- var renderer = _f.value;
2199
- var cache = [];
2200
- var props = renderer.observerInfo[component.name];
2201
- if (props && cache.indexOf(gameObject) === -1) {
2202
- cache.push(gameObject);
2203
- try {
2204
- renderer.rendererUpdate && renderer.rendererUpdate(gameObject);
2205
- }
2206
- catch (e) {
2207
- console.info("gameObject: " + gameObject.name + ", " + component.name + " is update error", e);
2208
- }
2209
- }
2210
- }
2211
- }
2212
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
2213
- finally {
2214
- try {
2215
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
2216
- }
2217
- finally { if (e_5) throw e_5.error; }
2218
- }
2219
- }
2220
- }
2221
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
2222
- finally {
2223
- try {
2224
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
2225
- }
2226
- finally { if (e_4) throw e_4.error; }
2227
- }
2228
- };
2229
- return RendererManager;
2230
- }());
2231
-
2232
- var ContainerManager = (function () {
2233
- function ContainerManager() {
2234
- this.containerMap = {};
2235
- }
2236
- ContainerManager.prototype.addContainer = function (_a) {
2237
- var name = _a.name, container = _a.container;
2238
- this.containerMap[name] = container;
2239
- };
2240
- ContainerManager.prototype.getContainer = function (name) {
2241
- return this.containerMap[name];
2242
- };
2243
- ContainerManager.prototype.removeContainer = function (name) {
2244
- var _a;
2245
- (_a = this.containerMap[name]) === null || _a === void 0 ? void 0 : _a.destroy({ children: true });
2246
- delete this.containerMap[name];
2247
- };
2248
- ContainerManager.prototype.updateTransform = function (_a) {
2249
- var name = _a.name, transform = _a.transform;
2250
- var container = this.containerMap[name];
2251
- if (!container)
2252
- return;
2253
- var anchor = transform.anchor, origin = transform.origin, position = transform.position, rotation = transform.rotation, scale = transform.scale, size = transform.size, skew = transform.skew;
2254
- container.rotation = rotation;
2255
- container.scale = scale;
2256
- container.pivot.x = size.width * origin.x;
2257
- container.pivot.y = size.height * origin.y;
2258
- container.skew = skew;
2259
- var x = position.x;
2260
- var y = position.y;
2261
- if (transform.parent) {
2262
- var parent_1 = transform.parent;
2263
- x = x + parent_1.size.width * anchor.x;
2264
- y = y + parent_1.size.height * anchor.y;
2265
- }
2266
- container.position = { x: x, y: y };
2267
- };
2268
- return ContainerManager;
2269
- }());
2270
-
2271
- function createCommonjsModule(fn) {
2272
- var module = { exports: {} };
2273
- return fn(module, module.exports), module.exports;
2274
- }
2275
-
2276
- var eventemitter3 = createCommonjsModule(function (module) {
2277
-
2278
- var has = Object.prototype.hasOwnProperty
2279
- , prefix = '~';
2280
-
2281
- /**
2282
- * Constructor to create a storage for our `EE` objects.
2283
- * An `Events` instance is a plain object whose properties are event names.
2284
- *
2285
- * @constructor
2286
- * @private
2287
- */
2288
- function Events() {}
2289
-
2290
- //
2291
- // We try to not inherit from `Object.prototype`. In some engines creating an
2292
- // instance in this way is faster than calling `Object.create(null)` directly.
2293
- // If `Object.create(null)` is not supported we prefix the event names with a
2294
- // character to make sure that the built-in object properties are not
2295
- // overridden or used as an attack vector.
2296
- //
2297
- if (Object.create) {
2298
- Events.prototype = Object.create(null);
2299
-
2300
- //
2301
- // This hack is needed because the `__proto__` property is still inherited in
2302
- // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
2303
- //
2304
- if (!new Events().__proto__) prefix = false;
2305
- }
2306
-
2307
- /**
2308
- * Representation of a single event listener.
2309
- *
2310
- * @param {Function} fn The listener function.
2311
- * @param {*} context The context to invoke the listener with.
2312
- * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
2313
- * @constructor
2314
- * @private
2315
- */
2316
- function EE(fn, context, once) {
2317
- this.fn = fn;
2318
- this.context = context;
2319
- this.once = once || false;
2320
- }
2321
-
2322
- /**
2323
- * Add a listener for a given event.
2324
- *
2325
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
2326
- * @param {(String|Symbol)} event The event name.
2327
- * @param {Function} fn The listener function.
2328
- * @param {*} context The context to invoke the listener with.
2329
- * @param {Boolean} once Specify if the listener is a one-time listener.
2330
- * @returns {EventEmitter}
2331
- * @private
2332
- */
2333
- function addListener(emitter, event, fn, context, once) {
2334
- if (typeof fn !== 'function') {
2335
- throw new TypeError('The listener must be a function');
2336
- }
2337
-
2338
- var listener = new EE(fn, context || emitter, once)
2339
- , evt = prefix ? prefix + event : event;
2340
-
2341
- if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
2342
- else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
2343
- else emitter._events[evt] = [emitter._events[evt], listener];
2344
-
2345
- return emitter;
2346
- }
2347
-
2348
- /**
2349
- * Clear event by name.
2350
- *
2351
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
2352
- * @param {(String|Symbol)} evt The Event name.
2353
- * @private
2354
- */
2355
- function clearEvent(emitter, evt) {
2356
- if (--emitter._eventsCount === 0) emitter._events = new Events();
2357
- else delete emitter._events[evt];
2358
- }
2359
-
2360
- /**
2361
- * Minimal `EventEmitter` interface that is molded against the Node.js
2362
- * `EventEmitter` interface.
2363
- *
2364
- * @constructor
2365
- * @public
2366
- */
2367
- function EventEmitter() {
2368
- this._events = new Events();
2369
- this._eventsCount = 0;
2370
- }
2371
-
2372
- /**
2373
- * Return an array listing the events for which the emitter has registered
2374
- * listeners.
2375
- *
2376
- * @returns {Array}
2377
- * @public
2378
- */
2379
- EventEmitter.prototype.eventNames = function eventNames() {
2380
- var names = []
2381
- , events
2382
- , name;
2383
-
2384
- if (this._eventsCount === 0) return names;
2385
-
2386
- for (name in (events = this._events)) {
2387
- if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
2388
- }
2389
-
2390
- if (Object.getOwnPropertySymbols) {
2391
- return names.concat(Object.getOwnPropertySymbols(events));
2392
- }
2393
-
2394
- return names;
2395
- };
2396
-
2397
- /**
2398
- * Return the listeners registered for a given event.
2399
- *
2400
- * @param {(String|Symbol)} event The event name.
2401
- * @returns {Array} The registered listeners.
2402
- * @public
2403
- */
2404
- EventEmitter.prototype.listeners = function listeners(event) {
2405
- var evt = prefix ? prefix + event : event
2406
- , handlers = this._events[evt];
2407
-
2408
- if (!handlers) return [];
2409
- if (handlers.fn) return [handlers.fn];
2410
-
2411
- for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
2412
- ee[i] = handlers[i].fn;
2413
- }
2414
-
2415
- return ee;
2416
- };
2417
-
2418
- /**
2419
- * Return the number of listeners listening to a given event.
2420
- *
2421
- * @param {(String|Symbol)} event The event name.
2422
- * @returns {Number} The number of listeners.
2423
- * @public
2424
- */
2425
- EventEmitter.prototype.listenerCount = function listenerCount(event) {
2426
- var evt = prefix ? prefix + event : event
2427
- , listeners = this._events[evt];
2428
-
2429
- if (!listeners) return 0;
2430
- if (listeners.fn) return 1;
2431
- return listeners.length;
2432
- };
2433
-
2434
- /**
2435
- * Calls each of the listeners registered for a given event.
2436
- *
2437
- * @param {(String|Symbol)} event The event name.
2438
- * @returns {Boolean} `true` if the event had listeners, else `false`.
2439
- * @public
2440
- */
2441
- EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
2442
- var evt = prefix ? prefix + event : event;
2443
-
2444
- if (!this._events[evt]) return false;
2445
-
2446
- var listeners = this._events[evt]
2447
- , len = arguments.length
2448
- , args
2449
- , i;
2450
-
2451
- if (listeners.fn) {
2452
- if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
2453
-
2454
- switch (len) {
2455
- case 1: return listeners.fn.call(listeners.context), true;
2456
- case 2: return listeners.fn.call(listeners.context, a1), true;
2457
- case 3: return listeners.fn.call(listeners.context, a1, a2), true;
2458
- case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
2459
- case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
2460
- case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
2461
- }
2462
-
2463
- for (i = 1, args = new Array(len -1); i < len; i++) {
2464
- args[i - 1] = arguments[i];
2465
- }
2466
-
2467
- listeners.fn.apply(listeners.context, args);
2468
- } else {
2469
- var length = listeners.length
2470
- , j;
2471
-
2472
- for (i = 0; i < length; i++) {
2473
- if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
2474
-
2475
- switch (len) {
2476
- case 1: listeners[i].fn.call(listeners[i].context); break;
2477
- case 2: listeners[i].fn.call(listeners[i].context, a1); break;
2478
- case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
2479
- case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
2480
- default:
2481
- if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
2482
- args[j - 1] = arguments[j];
2483
- }
2484
-
2485
- listeners[i].fn.apply(listeners[i].context, args);
2486
- }
2487
- }
2488
- }
2489
-
2490
- return true;
2491
- };
2492
-
2493
- /**
2494
- * Add a listener for a given event.
2495
- *
2496
- * @param {(String|Symbol)} event The event name.
2497
- * @param {Function} fn The listener function.
2498
- * @param {*} [context=this] The context to invoke the listener with.
2499
- * @returns {EventEmitter} `this`.
2500
- * @public
2501
- */
2502
- EventEmitter.prototype.on = function on(event, fn, context) {
2503
- return addListener(this, event, fn, context, false);
2504
- };
2505
-
2506
- /**
2507
- * Add a one-time listener for a given event.
2508
- *
2509
- * @param {(String|Symbol)} event The event name.
2510
- * @param {Function} fn The listener function.
2511
- * @param {*} [context=this] The context to invoke the listener with.
2512
- * @returns {EventEmitter} `this`.
2513
- * @public
2514
- */
2515
- EventEmitter.prototype.once = function once(event, fn, context) {
2516
- return addListener(this, event, fn, context, true);
2517
- };
2518
-
2519
- /**
2520
- * Remove the listeners of a given event.
2521
- *
2522
- * @param {(String|Symbol)} event The event name.
2523
- * @param {Function} fn Only remove the listeners that match this function.
2524
- * @param {*} context Only remove the listeners that have this context.
2525
- * @param {Boolean} once Only remove one-time listeners.
2526
- * @returns {EventEmitter} `this`.
2527
- * @public
2528
- */
2529
- EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
2530
- var evt = prefix ? prefix + event : event;
2531
-
2532
- if (!this._events[evt]) return this;
2533
- if (!fn) {
2534
- clearEvent(this, evt);
2535
- return this;
2536
- }
2537
-
2538
- var listeners = this._events[evt];
2539
-
2540
- if (listeners.fn) {
2541
- if (
2542
- listeners.fn === fn &&
2543
- (!once || listeners.once) &&
2544
- (!context || listeners.context === context)
2545
- ) {
2546
- clearEvent(this, evt);
2547
- }
2548
- } else {
2549
- for (var i = 0, events = [], length = listeners.length; i < length; i++) {
2550
- if (
2551
- listeners[i].fn !== fn ||
2552
- (once && !listeners[i].once) ||
2553
- (context && listeners[i].context !== context)
2554
- ) {
2555
- events.push(listeners[i]);
2556
- }
2557
- }
2558
-
2559
- //
2560
- // Reset the array, or remove it completely if we have no more listeners.
2561
- //
2562
- if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
2563
- else clearEvent(this, evt);
2564
- }
2565
-
2566
- return this;
2567
- };
2568
-
2569
- /**
2570
- * Remove all listeners, or those of the specified event.
2571
- *
2572
- * @param {(String|Symbol)} [event] The event name.
2573
- * @returns {EventEmitter} `this`.
2574
- * @public
2575
- */
2576
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
2577
- var evt;
2578
-
2579
- if (event) {
2580
- evt = prefix ? prefix + event : event;
2581
- if (this._events[evt]) clearEvent(this, evt);
2582
- } else {
2583
- this._events = new Events();
2584
- this._eventsCount = 0;
2585
- }
2586
-
2587
- return this;
2588
- };
2589
-
2590
- //
2591
- // Alias methods names because people roll like that.
2592
- //
2593
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
2594
- EventEmitter.prototype.addListener = EventEmitter.prototype.on;
2595
-
2596
- //
2597
- // Expose the prefix.
2598
- //
2599
- EventEmitter.prefixed = prefix;
2600
-
2601
- //
2602
- // Allow `EventEmitter` to be imported as module namespace.
2603
- //
2604
- EventEmitter.EventEmitter = EventEmitter;
2605
-
2606
- //
2607
- // Expose the module.
2608
- //
2609
- {
2610
- module.exports = EventEmitter;
2611
- }
2612
- });
2613
-
2614
- var Transform = (function (_super) {
2615
- __extends(Transform, _super);
2616
- function Transform(_a) {
2617
- var system = _a.system, containerManager = _a.containerManager;
2618
- var _this = _super.call(this) || this;
2619
- _this.name = 'Transform';
2620
- _this.waitRemoveIds = [];
2621
- _this.waitChangeScenes = [];
2622
- _this.containerManager = containerManager;
2623
- _this.init(system);
2624
- return _this;
2625
- }
2626
- Transform.prototype.init = function (system) {
2627
- var _this = this;
2628
- this.system = system;
2629
- this.on('changeScene', function (_a) {
2630
- var scene = _a.scene, mode = _a.mode, application = _a.application;
2631
- _this.waitChangeScenes.push({ scene: scene, mode: mode, application: application });
2632
- });
2633
- };
2634
- Transform.prototype.update = function () {
2635
- var e_1, _a, e_2, _b;
2636
- try {
2637
- for (var _c = __values(this.waitRemoveIds), _d = _c.next(); !_d.done; _d = _c.next()) {
2638
- var id = _d.value;
2639
- this.containerManager.removeContainer(id);
2640
- }
2641
- }
2642
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2643
- finally {
2644
- try {
2645
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
2646
- }
2647
- finally { if (e_1) throw e_1.error; }
2648
- }
2649
- this.waitRemoveIds = [];
2650
- try {
2651
- for (var _e = __values(this.waitChangeScenes), _f = _e.next(); !_f.done; _f = _e.next()) {
2652
- var sceneInfo = _f.value;
2653
- var container = this.containerManager.getContainer(sceneInfo.scene.id);
2654
- if (container) {
2655
- sceneInfo.application.stage.removeChildren();
2656
- sceneInfo.application.stage.addChild(container);
2657
- }
2658
- }
2659
- }
2660
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2661
- finally {
2662
- try {
2663
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
2664
- }
2665
- finally { if (e_2) throw e_2.error; }
2666
- }
2667
- this.waitChangeScenes = [];
2668
- };
2669
- Transform.prototype.componentChanged = function (changed) {
2670
- if (changed.type === eva_js.OBSERVER_TYPE.ADD) {
2671
- this.addContainer(changed);
2672
- }
2673
- else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) {
2674
- this.change(changed);
2675
- }
2676
- else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
2677
- this.waitRemoveIds.push(changed.gameObject.id);
2678
- }
2679
- };
2680
- Transform.prototype.addContainer = function (changed) {
2681
- var container = new rendererAdapter.Container();
2682
- container.name = changed.gameObject.name;
2683
- this.containerManager.addContainer({
2684
- name: changed.gameObject.id,
2685
- container: container,
2686
- });
2687
- var transform = changed.component;
2688
- transform.worldTransform = container.transform.worldTransform;
2689
- };
2690
- Transform.prototype.change = function (changed) {
2691
- var transform = changed.component;
2692
- if (transform.parent) {
2693
- var parentContainer = this.containerManager.getContainer(transform.parent.gameObject.id);
2694
- parentContainer.addChild(this.containerManager.getContainer(changed.gameObject.id));
2695
- var render = changed.gameObject.transform.parent &&
2696
- changed.gameObject.transform.parent.gameObject.getComponent('Render');
2697
- if (render) {
2698
- render.sortDirty = true;
2699
- }
2700
- }
2701
- else {
2702
- var container = this.containerManager.getContainer(changed.gameObject.id);
2703
- delete transform.worldTransform;
2704
- container.parent && container.parent.removeChild(container);
2705
- }
2706
- };
2707
- Transform.prototype.destroy = function () {
2708
- this.removeAllListeners();
2709
- this.waitRemoveIds = null;
2710
- this.waitChangeScenes = null;
2711
- this.system = null;
2712
- this.containerManager = null;
2713
- };
2714
- Transform = __decorate([
2715
- eva_js.decorators.componentObserver({
2716
- Transform: ['_parent'],
2717
- })
2718
- ], Transform);
2719
- return Transform;
2720
- }(eventemitter3));
2721
-
2722
- exports.RENDERER_TYPE = void 0;
2723
- (function (RENDERER_TYPE) {
2724
- RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN";
2725
- RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL";
2726
- RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS";
2727
- })(exports.RENDERER_TYPE || (exports.RENDERER_TYPE = {}));
2728
- var disableScroll = function (renderer) {
2729
- renderer.plugins.interaction.autoPreventDefault = true;
2730
- renderer.view.style.touchAction = 'none';
2731
- };
2732
- var enableScroll = function (renderer) {
2733
- renderer.plugins.interaction.autoPreventDefault = false;
2734
- renderer.view.style.touchAction = 'auto';
2735
- };
2736
- var Renderer$1 = (function (_super) {
2737
- __extends(Renderer, _super);
2738
- function Renderer() {
2739
- var _this = _super !== null && _super.apply(this, arguments) || this;
2740
- _this.multiApps = [];
2741
- return _this;
2742
- }
2743
- Renderer.prototype.init = function (params) {
2744
- var _this = this;
2745
- this.params = params;
2746
- this.application = this.createApplication(params);
2747
- this.containerManager = new ContainerManager();
2748
- this.rendererManager = new RendererManager({
2749
- game: this.game,
2750
- rendererSystem: this,
2751
- });
2752
- this.game.canvas = this.application.view;
2753
- this.transform = new Transform({
2754
- system: this,
2755
- containerManager: this.containerManager,
2756
- });
2757
- this.game.on('sceneChanged', function (_a) {
2758
- var scene = _a.scene, mode = _a.mode, params = _a.params;
2759
- var application;
2760
- switch (mode) {
2761
- case eva_js.LOAD_SCENE_MODE.SINGLE:
2762
- application = _this.application;
2763
- break;
2764
- case eva_js.LOAD_SCENE_MODE.MULTI_CANVAS:
2765
- application = _this.createMultiApplication({ params: params });
2766
- break;
2767
- }
2768
- scene.canvas = application.view;
2769
- _this.transform.emit('changeScene', {
2770
- scene: scene,
2771
- mode: mode,
2772
- application: application,
2773
- });
2774
- });
2775
- };
2776
- Renderer.prototype.registerObserver = function (observerInfo) {
2777
- var _a;
2778
- var thisObserverInfo = this.constructor.observerInfo;
2779
- for (var key in observerInfo) {
2780
- if (!thisObserverInfo[key]) {
2781
- thisObserverInfo[key] = [];
2782
- }
2783
- (_a = thisObserverInfo[key]).push.apply(_a, __spread(observerInfo[key]));
2784
- }
2785
- };
2786
- Renderer.prototype.createMultiApplication = function (_a) {
2787
- var params = _a.params;
2788
- var app = this.createApplication(params);
2789
- this.multiApps.push(app);
2790
- return app;
2791
- };
2792
- Renderer.prototype.createApplication = function (params) {
2793
- params.view = params.canvas;
2794
- if (params.renderType === exports.RENDERER_TYPE.CANVAS) {
2795
- params.forceCanvas = true;
2796
- }
2797
- pixi_js.ticker.shared.autoStart = false;
2798
- pixi_js.ticker.shared.stop();
2799
- var app = new rendererAdapter.Application(__assign({ sharedTicker: true }, params));
2800
- if (params.preventScroll !== undefined) {
2801
- console.warn('PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game');
2802
- params.preventScroll ? enableScroll(app.renderer) : disableScroll(app.renderer);
2803
- }
2804
- if (params.enableScroll !== undefined) {
2805
- params.enableScroll ? enableScroll(app.renderer) : disableScroll(app.renderer);
2806
- }
2807
- if (params.preventScroll === undefined && params.enableScroll === undefined) {
2808
- enableScroll(app.renderer);
2809
- }
2810
- return app;
2811
- };
2812
- Renderer.prototype.update = function () {
2813
- var e_1, _a, e_2, _b;
2814
- var changes = this.componentObserver.clear();
2815
- try {
2816
- for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
2817
- var changed = changes_1_1.value;
2818
- this.transform.componentChanged(changed);
2819
- }
2820
- }
2821
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2822
- finally {
2823
- try {
2824
- if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
2825
- }
2826
- finally { if (e_1) throw e_1.error; }
2827
- }
2828
- try {
2829
- for (var _c = __values(this.game.gameObjects), _d = _c.next(); !_d.done; _d = _c.next()) {
2830
- var gameObject = _d.value;
2831
- this.containerManager.updateTransform({
2832
- name: gameObject.id,
2833
- transform: gameObject.transform,
2834
- });
2835
- this.rendererManager.update(gameObject);
2836
- }
2837
- }
2838
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2839
- finally {
2840
- try {
2841
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2842
- }
2843
- finally { if (e_2) throw e_2.error; }
2844
- }
2845
- };
2846
- Renderer.prototype.lateUpdate = function (e) {
2847
- this.transform.update();
2848
- this.application.ticker.update(e.time);
2849
- };
2850
- Renderer.prototype.onDestroy = function () {
2851
- var e_3, _a;
2852
- this.application.destroy();
2853
- try {
2854
- for (var _b = __values(this.multiApps), _c = _b.next(); !_c.done; _c = _b.next()) {
2855
- var app = _c.value;
2856
- app && app.destroy();
2857
- }
2858
- }
2859
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2860
- finally {
2861
- try {
2862
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2863
- }
2864
- finally { if (e_3) throw e_3.error; }
2865
- }
2866
- this.transform.destroy();
2867
- this.transform = null;
2868
- this.params = null;
2869
- this.rendererManager = null;
2870
- this.containerManager = null;
2871
- this.application = null;
2872
- this.game = null;
2873
- this.multiApps = null;
2874
- };
2875
- Renderer.prototype.resize = function (width, height) {
2876
- this.params.width = width;
2877
- this.params.height = height;
2878
- this.application.renderer.resize(width, height);
2879
- };
2880
- Renderer.systemName = 'Renderer';
2881
- Renderer = __decorate([
2882
- eva_js.decorators.componentObserver({
2883
- Transform: ['_parent'],
2884
- })
2885
- ], Renderer);
2886
- return Renderer;
2887
- }(eva_js.System));
2888
-
2889
- var Renderer = (function (_super) {
2890
- __extends(Renderer, _super);
2891
- function Renderer(params) {
2892
- var _this = _super.call(this, params) || this;
2893
- _this.observerInfo = _this.constructor.observerInfo;
2894
- return _this;
2895
- }
2896
- Renderer.prototype.componentChanged = function (_changed) { };
2897
- Renderer.prototype.rendererUpdate = function (_gameObject) { };
2898
- Renderer.prototype.update = function () {
2899
- var e_1, _a;
2900
- var changes = this.componentObserver.clear();
2901
- try {
2902
- for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
2903
- var changed = changes_1_1.value;
2904
- this.componentChanged(changed);
2905
- }
2906
- }
2907
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2908
- finally {
2909
- try {
2910
- if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
2911
- }
2912
- finally { if (e_1) throw e_1.error; }
2913
- }
2914
- };
2915
- return Renderer;
2916
- }(eva_js.System));
2917
-
2918
- exports.ContainerManager = ContainerManager;
2919
- exports.Renderer = Renderer;
2920
- exports.RendererManager = RendererManager;
2921
- exports.RendererSystem = Renderer$1;
2922
-
2923
- Object.defineProperty(exports, '__esModule', { value: true });
2924
-
2925
- })));