@rpcbase/client 0.401.0 → 0.402.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -381
- package/dist/index.js.map +1 -1
- package/dist/spatial-nav/SpatialNavigation.d.ts +310 -0
- package/dist/spatial-nav/SpatialNavigation.d.ts.map +1 -0
- package/dist/spatial-nav/VisualDebugger.d.ts +34 -0
- package/dist/spatial-nav/VisualDebugger.d.ts.map +1 -0
- package/dist/spatial-nav/WritingDirection.d.ts +6 -0
- package/dist/spatial-nav/WritingDirection.d.ts.map +1 -0
- package/dist/spatial-nav/index.d.ts +4 -0
- package/dist/spatial-nav/index.d.ts.map +1 -0
- package/dist/spatial-nav/index.js +4342 -0
- package/dist/spatial-nav/index.js.map +1 -0
- package/dist/spatial-nav/measureLayout.d.ts +22 -0
- package/dist/spatial-nav/measureLayout.d.ts.map +1 -0
- package/dist/spatial-nav/useFocusContext.d.ts +4 -0
- package/dist/spatial-nav/useFocusContext.d.ts.map +1 -0
- package/dist/spatial-nav/useFocusable.d.ts +35 -0
- package/dist/spatial-nav/useFocusable.d.ts.map +1 -0
- package/dist/throttle-CXOc9Dto.js +396 -0
- package/dist/throttle-CXOc9Dto.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,4342 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { createContext, useContext, useRef, useState, useEffect } from "react";
|
|
3
|
+
import { g as getDefaultExportFromCjs, r as requireToString, a as requireDebounce, b as require_baseGetTag, c as requireIsObject, d as require_root, e as require_arrayMap, f as requireIsObjectLike, h as require_Symbol, i as requireIsArray, j as require_freeGlobal, k as requireIsSymbol, t as throttle } from "../throttle-CXOc9Dto.js";
|
|
4
|
+
var noop_1;
|
|
5
|
+
var hasRequiredNoop;
|
|
6
|
+
function requireNoop() {
|
|
7
|
+
if (hasRequiredNoop) return noop_1;
|
|
8
|
+
hasRequiredNoop = 1;
|
|
9
|
+
function noop2() {
|
|
10
|
+
}
|
|
11
|
+
noop_1 = noop2;
|
|
12
|
+
return noop_1;
|
|
13
|
+
}
|
|
14
|
+
var noopExports = requireNoop();
|
|
15
|
+
const noop = /* @__PURE__ */ getDefaultExportFromCjs(noopExports);
|
|
16
|
+
var uniqueId_1;
|
|
17
|
+
var hasRequiredUniqueId;
|
|
18
|
+
function requireUniqueId() {
|
|
19
|
+
if (hasRequiredUniqueId) return uniqueId_1;
|
|
20
|
+
hasRequiredUniqueId = 1;
|
|
21
|
+
var toString = requireToString();
|
|
22
|
+
var idCounter = 0;
|
|
23
|
+
function uniqueId2(prefix) {
|
|
24
|
+
var id = ++idCounter;
|
|
25
|
+
return toString(prefix) + id;
|
|
26
|
+
}
|
|
27
|
+
uniqueId_1 = uniqueId2;
|
|
28
|
+
return uniqueId_1;
|
|
29
|
+
}
|
|
30
|
+
var uniqueIdExports = requireUniqueId();
|
|
31
|
+
const uniqueId = /* @__PURE__ */ getDefaultExportFromCjs(uniqueIdExports);
|
|
32
|
+
var debounceExports = requireDebounce();
|
|
33
|
+
const debounce = /* @__PURE__ */ getDefaultExportFromCjs(debounceExports);
|
|
34
|
+
var isFunction_1;
|
|
35
|
+
var hasRequiredIsFunction;
|
|
36
|
+
function requireIsFunction() {
|
|
37
|
+
if (hasRequiredIsFunction) return isFunction_1;
|
|
38
|
+
hasRequiredIsFunction = 1;
|
|
39
|
+
var baseGetTag = require_baseGetTag(), isObject = requireIsObject();
|
|
40
|
+
var asyncTag = "[object AsyncFunction]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
41
|
+
function isFunction(value) {
|
|
42
|
+
if (!isObject(value)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
var tag = baseGetTag(value);
|
|
46
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
47
|
+
}
|
|
48
|
+
isFunction_1 = isFunction;
|
|
49
|
+
return isFunction_1;
|
|
50
|
+
}
|
|
51
|
+
var _coreJsData;
|
|
52
|
+
var hasRequired_coreJsData;
|
|
53
|
+
function require_coreJsData() {
|
|
54
|
+
if (hasRequired_coreJsData) return _coreJsData;
|
|
55
|
+
hasRequired_coreJsData = 1;
|
|
56
|
+
var root = require_root();
|
|
57
|
+
var coreJsData = root["__core-js_shared__"];
|
|
58
|
+
_coreJsData = coreJsData;
|
|
59
|
+
return _coreJsData;
|
|
60
|
+
}
|
|
61
|
+
var _isMasked;
|
|
62
|
+
var hasRequired_isMasked;
|
|
63
|
+
function require_isMasked() {
|
|
64
|
+
if (hasRequired_isMasked) return _isMasked;
|
|
65
|
+
hasRequired_isMasked = 1;
|
|
66
|
+
var coreJsData = require_coreJsData();
|
|
67
|
+
var maskSrcKey = (function() {
|
|
68
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
69
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
|
70
|
+
})();
|
|
71
|
+
function isMasked(func) {
|
|
72
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
73
|
+
}
|
|
74
|
+
_isMasked = isMasked;
|
|
75
|
+
return _isMasked;
|
|
76
|
+
}
|
|
77
|
+
var _toSource;
|
|
78
|
+
var hasRequired_toSource;
|
|
79
|
+
function require_toSource() {
|
|
80
|
+
if (hasRequired_toSource) return _toSource;
|
|
81
|
+
hasRequired_toSource = 1;
|
|
82
|
+
var funcProto = Function.prototype;
|
|
83
|
+
var funcToString = funcProto.toString;
|
|
84
|
+
function toSource(func) {
|
|
85
|
+
if (func != null) {
|
|
86
|
+
try {
|
|
87
|
+
return funcToString.call(func);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
return func + "";
|
|
92
|
+
} catch (e) {
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return "";
|
|
96
|
+
}
|
|
97
|
+
_toSource = toSource;
|
|
98
|
+
return _toSource;
|
|
99
|
+
}
|
|
100
|
+
var _baseIsNative;
|
|
101
|
+
var hasRequired_baseIsNative;
|
|
102
|
+
function require_baseIsNative() {
|
|
103
|
+
if (hasRequired_baseIsNative) return _baseIsNative;
|
|
104
|
+
hasRequired_baseIsNative = 1;
|
|
105
|
+
var isFunction = requireIsFunction(), isMasked = require_isMasked(), isObject = requireIsObject(), toSource = require_toSource();
|
|
106
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
107
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
108
|
+
var funcProto = Function.prototype, objectProto = Object.prototype;
|
|
109
|
+
var funcToString = funcProto.toString;
|
|
110
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
111
|
+
var reIsNative = RegExp(
|
|
112
|
+
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
113
|
+
);
|
|
114
|
+
function baseIsNative(value) {
|
|
115
|
+
if (!isObject(value) || isMasked(value)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
119
|
+
return pattern.test(toSource(value));
|
|
120
|
+
}
|
|
121
|
+
_baseIsNative = baseIsNative;
|
|
122
|
+
return _baseIsNative;
|
|
123
|
+
}
|
|
124
|
+
var _getValue;
|
|
125
|
+
var hasRequired_getValue;
|
|
126
|
+
function require_getValue() {
|
|
127
|
+
if (hasRequired_getValue) return _getValue;
|
|
128
|
+
hasRequired_getValue = 1;
|
|
129
|
+
function getValue(object, key) {
|
|
130
|
+
return object == null ? void 0 : object[key];
|
|
131
|
+
}
|
|
132
|
+
_getValue = getValue;
|
|
133
|
+
return _getValue;
|
|
134
|
+
}
|
|
135
|
+
var _getNative;
|
|
136
|
+
var hasRequired_getNative;
|
|
137
|
+
function require_getNative() {
|
|
138
|
+
if (hasRequired_getNative) return _getNative;
|
|
139
|
+
hasRequired_getNative = 1;
|
|
140
|
+
var baseIsNative = require_baseIsNative(), getValue = require_getValue();
|
|
141
|
+
function getNative(object, key) {
|
|
142
|
+
var value = getValue(object, key);
|
|
143
|
+
return baseIsNative(value) ? value : void 0;
|
|
144
|
+
}
|
|
145
|
+
_getNative = getNative;
|
|
146
|
+
return _getNative;
|
|
147
|
+
}
|
|
148
|
+
var _nativeCreate;
|
|
149
|
+
var hasRequired_nativeCreate;
|
|
150
|
+
function require_nativeCreate() {
|
|
151
|
+
if (hasRequired_nativeCreate) return _nativeCreate;
|
|
152
|
+
hasRequired_nativeCreate = 1;
|
|
153
|
+
var getNative = require_getNative();
|
|
154
|
+
var nativeCreate = getNative(Object, "create");
|
|
155
|
+
_nativeCreate = nativeCreate;
|
|
156
|
+
return _nativeCreate;
|
|
157
|
+
}
|
|
158
|
+
var _hashClear;
|
|
159
|
+
var hasRequired_hashClear;
|
|
160
|
+
function require_hashClear() {
|
|
161
|
+
if (hasRequired_hashClear) return _hashClear;
|
|
162
|
+
hasRequired_hashClear = 1;
|
|
163
|
+
var nativeCreate = require_nativeCreate();
|
|
164
|
+
function hashClear() {
|
|
165
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
166
|
+
this.size = 0;
|
|
167
|
+
}
|
|
168
|
+
_hashClear = hashClear;
|
|
169
|
+
return _hashClear;
|
|
170
|
+
}
|
|
171
|
+
var _hashDelete;
|
|
172
|
+
var hasRequired_hashDelete;
|
|
173
|
+
function require_hashDelete() {
|
|
174
|
+
if (hasRequired_hashDelete) return _hashDelete;
|
|
175
|
+
hasRequired_hashDelete = 1;
|
|
176
|
+
function hashDelete(key) {
|
|
177
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
178
|
+
this.size -= result ? 1 : 0;
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
181
|
+
_hashDelete = hashDelete;
|
|
182
|
+
return _hashDelete;
|
|
183
|
+
}
|
|
184
|
+
var _hashGet;
|
|
185
|
+
var hasRequired_hashGet;
|
|
186
|
+
function require_hashGet() {
|
|
187
|
+
if (hasRequired_hashGet) return _hashGet;
|
|
188
|
+
hasRequired_hashGet = 1;
|
|
189
|
+
var nativeCreate = require_nativeCreate();
|
|
190
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
191
|
+
var objectProto = Object.prototype;
|
|
192
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
193
|
+
function hashGet(key) {
|
|
194
|
+
var data = this.__data__;
|
|
195
|
+
if (nativeCreate) {
|
|
196
|
+
var result = data[key];
|
|
197
|
+
return result === HASH_UNDEFINED ? void 0 : result;
|
|
198
|
+
}
|
|
199
|
+
return hasOwnProperty.call(data, key) ? data[key] : void 0;
|
|
200
|
+
}
|
|
201
|
+
_hashGet = hashGet;
|
|
202
|
+
return _hashGet;
|
|
203
|
+
}
|
|
204
|
+
var _hashHas;
|
|
205
|
+
var hasRequired_hashHas;
|
|
206
|
+
function require_hashHas() {
|
|
207
|
+
if (hasRequired_hashHas) return _hashHas;
|
|
208
|
+
hasRequired_hashHas = 1;
|
|
209
|
+
var nativeCreate = require_nativeCreate();
|
|
210
|
+
var objectProto = Object.prototype;
|
|
211
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
212
|
+
function hashHas(key) {
|
|
213
|
+
var data = this.__data__;
|
|
214
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
|
|
215
|
+
}
|
|
216
|
+
_hashHas = hashHas;
|
|
217
|
+
return _hashHas;
|
|
218
|
+
}
|
|
219
|
+
var _hashSet;
|
|
220
|
+
var hasRequired_hashSet;
|
|
221
|
+
function require_hashSet() {
|
|
222
|
+
if (hasRequired_hashSet) return _hashSet;
|
|
223
|
+
hasRequired_hashSet = 1;
|
|
224
|
+
var nativeCreate = require_nativeCreate();
|
|
225
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
226
|
+
function hashSet(key, value) {
|
|
227
|
+
var data = this.__data__;
|
|
228
|
+
this.size += this.has(key) ? 0 : 1;
|
|
229
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
230
|
+
return this;
|
|
231
|
+
}
|
|
232
|
+
_hashSet = hashSet;
|
|
233
|
+
return _hashSet;
|
|
234
|
+
}
|
|
235
|
+
var _Hash;
|
|
236
|
+
var hasRequired_Hash;
|
|
237
|
+
function require_Hash() {
|
|
238
|
+
if (hasRequired_Hash) return _Hash;
|
|
239
|
+
hasRequired_Hash = 1;
|
|
240
|
+
var hashClear = require_hashClear(), hashDelete = require_hashDelete(), hashGet = require_hashGet(), hashHas = require_hashHas(), hashSet = require_hashSet();
|
|
241
|
+
function Hash(entries) {
|
|
242
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
243
|
+
this.clear();
|
|
244
|
+
while (++index < length) {
|
|
245
|
+
var entry = entries[index];
|
|
246
|
+
this.set(entry[0], entry[1]);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
Hash.prototype.clear = hashClear;
|
|
250
|
+
Hash.prototype["delete"] = hashDelete;
|
|
251
|
+
Hash.prototype.get = hashGet;
|
|
252
|
+
Hash.prototype.has = hashHas;
|
|
253
|
+
Hash.prototype.set = hashSet;
|
|
254
|
+
_Hash = Hash;
|
|
255
|
+
return _Hash;
|
|
256
|
+
}
|
|
257
|
+
var _listCacheClear;
|
|
258
|
+
var hasRequired_listCacheClear;
|
|
259
|
+
function require_listCacheClear() {
|
|
260
|
+
if (hasRequired_listCacheClear) return _listCacheClear;
|
|
261
|
+
hasRequired_listCacheClear = 1;
|
|
262
|
+
function listCacheClear() {
|
|
263
|
+
this.__data__ = [];
|
|
264
|
+
this.size = 0;
|
|
265
|
+
}
|
|
266
|
+
_listCacheClear = listCacheClear;
|
|
267
|
+
return _listCacheClear;
|
|
268
|
+
}
|
|
269
|
+
var eq_1;
|
|
270
|
+
var hasRequiredEq;
|
|
271
|
+
function requireEq() {
|
|
272
|
+
if (hasRequiredEq) return eq_1;
|
|
273
|
+
hasRequiredEq = 1;
|
|
274
|
+
function eq(value, other) {
|
|
275
|
+
return value === other || value !== value && other !== other;
|
|
276
|
+
}
|
|
277
|
+
eq_1 = eq;
|
|
278
|
+
return eq_1;
|
|
279
|
+
}
|
|
280
|
+
var _assocIndexOf;
|
|
281
|
+
var hasRequired_assocIndexOf;
|
|
282
|
+
function require_assocIndexOf() {
|
|
283
|
+
if (hasRequired_assocIndexOf) return _assocIndexOf;
|
|
284
|
+
hasRequired_assocIndexOf = 1;
|
|
285
|
+
var eq = requireEq();
|
|
286
|
+
function assocIndexOf(array, key) {
|
|
287
|
+
var length = array.length;
|
|
288
|
+
while (length--) {
|
|
289
|
+
if (eq(array[length][0], key)) {
|
|
290
|
+
return length;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return -1;
|
|
294
|
+
}
|
|
295
|
+
_assocIndexOf = assocIndexOf;
|
|
296
|
+
return _assocIndexOf;
|
|
297
|
+
}
|
|
298
|
+
var _listCacheDelete;
|
|
299
|
+
var hasRequired_listCacheDelete;
|
|
300
|
+
function require_listCacheDelete() {
|
|
301
|
+
if (hasRequired_listCacheDelete) return _listCacheDelete;
|
|
302
|
+
hasRequired_listCacheDelete = 1;
|
|
303
|
+
var assocIndexOf = require_assocIndexOf();
|
|
304
|
+
var arrayProto = Array.prototype;
|
|
305
|
+
var splice = arrayProto.splice;
|
|
306
|
+
function listCacheDelete(key) {
|
|
307
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
308
|
+
if (index < 0) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
var lastIndex = data.length - 1;
|
|
312
|
+
if (index == lastIndex) {
|
|
313
|
+
data.pop();
|
|
314
|
+
} else {
|
|
315
|
+
splice.call(data, index, 1);
|
|
316
|
+
}
|
|
317
|
+
--this.size;
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
_listCacheDelete = listCacheDelete;
|
|
321
|
+
return _listCacheDelete;
|
|
322
|
+
}
|
|
323
|
+
var _listCacheGet;
|
|
324
|
+
var hasRequired_listCacheGet;
|
|
325
|
+
function require_listCacheGet() {
|
|
326
|
+
if (hasRequired_listCacheGet) return _listCacheGet;
|
|
327
|
+
hasRequired_listCacheGet = 1;
|
|
328
|
+
var assocIndexOf = require_assocIndexOf();
|
|
329
|
+
function listCacheGet(key) {
|
|
330
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
331
|
+
return index < 0 ? void 0 : data[index][1];
|
|
332
|
+
}
|
|
333
|
+
_listCacheGet = listCacheGet;
|
|
334
|
+
return _listCacheGet;
|
|
335
|
+
}
|
|
336
|
+
var _listCacheHas;
|
|
337
|
+
var hasRequired_listCacheHas;
|
|
338
|
+
function require_listCacheHas() {
|
|
339
|
+
if (hasRequired_listCacheHas) return _listCacheHas;
|
|
340
|
+
hasRequired_listCacheHas = 1;
|
|
341
|
+
var assocIndexOf = require_assocIndexOf();
|
|
342
|
+
function listCacheHas(key) {
|
|
343
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
344
|
+
}
|
|
345
|
+
_listCacheHas = listCacheHas;
|
|
346
|
+
return _listCacheHas;
|
|
347
|
+
}
|
|
348
|
+
var _listCacheSet;
|
|
349
|
+
var hasRequired_listCacheSet;
|
|
350
|
+
function require_listCacheSet() {
|
|
351
|
+
if (hasRequired_listCacheSet) return _listCacheSet;
|
|
352
|
+
hasRequired_listCacheSet = 1;
|
|
353
|
+
var assocIndexOf = require_assocIndexOf();
|
|
354
|
+
function listCacheSet(key, value) {
|
|
355
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
356
|
+
if (index < 0) {
|
|
357
|
+
++this.size;
|
|
358
|
+
data.push([key, value]);
|
|
359
|
+
} else {
|
|
360
|
+
data[index][1] = value;
|
|
361
|
+
}
|
|
362
|
+
return this;
|
|
363
|
+
}
|
|
364
|
+
_listCacheSet = listCacheSet;
|
|
365
|
+
return _listCacheSet;
|
|
366
|
+
}
|
|
367
|
+
var _ListCache;
|
|
368
|
+
var hasRequired_ListCache;
|
|
369
|
+
function require_ListCache() {
|
|
370
|
+
if (hasRequired_ListCache) return _ListCache;
|
|
371
|
+
hasRequired_ListCache = 1;
|
|
372
|
+
var listCacheClear = require_listCacheClear(), listCacheDelete = require_listCacheDelete(), listCacheGet = require_listCacheGet(), listCacheHas = require_listCacheHas(), listCacheSet = require_listCacheSet();
|
|
373
|
+
function ListCache(entries) {
|
|
374
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
375
|
+
this.clear();
|
|
376
|
+
while (++index < length) {
|
|
377
|
+
var entry = entries[index];
|
|
378
|
+
this.set(entry[0], entry[1]);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
ListCache.prototype.clear = listCacheClear;
|
|
382
|
+
ListCache.prototype["delete"] = listCacheDelete;
|
|
383
|
+
ListCache.prototype.get = listCacheGet;
|
|
384
|
+
ListCache.prototype.has = listCacheHas;
|
|
385
|
+
ListCache.prototype.set = listCacheSet;
|
|
386
|
+
_ListCache = ListCache;
|
|
387
|
+
return _ListCache;
|
|
388
|
+
}
|
|
389
|
+
var _Map;
|
|
390
|
+
var hasRequired_Map;
|
|
391
|
+
function require_Map() {
|
|
392
|
+
if (hasRequired_Map) return _Map;
|
|
393
|
+
hasRequired_Map = 1;
|
|
394
|
+
var getNative = require_getNative(), root = require_root();
|
|
395
|
+
var Map = getNative(root, "Map");
|
|
396
|
+
_Map = Map;
|
|
397
|
+
return _Map;
|
|
398
|
+
}
|
|
399
|
+
var _mapCacheClear;
|
|
400
|
+
var hasRequired_mapCacheClear;
|
|
401
|
+
function require_mapCacheClear() {
|
|
402
|
+
if (hasRequired_mapCacheClear) return _mapCacheClear;
|
|
403
|
+
hasRequired_mapCacheClear = 1;
|
|
404
|
+
var Hash = require_Hash(), ListCache = require_ListCache(), Map = require_Map();
|
|
405
|
+
function mapCacheClear() {
|
|
406
|
+
this.size = 0;
|
|
407
|
+
this.__data__ = {
|
|
408
|
+
"hash": new Hash(),
|
|
409
|
+
"map": new (Map || ListCache)(),
|
|
410
|
+
"string": new Hash()
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
_mapCacheClear = mapCacheClear;
|
|
414
|
+
return _mapCacheClear;
|
|
415
|
+
}
|
|
416
|
+
var _isKeyable;
|
|
417
|
+
var hasRequired_isKeyable;
|
|
418
|
+
function require_isKeyable() {
|
|
419
|
+
if (hasRequired_isKeyable) return _isKeyable;
|
|
420
|
+
hasRequired_isKeyable = 1;
|
|
421
|
+
function isKeyable(value) {
|
|
422
|
+
var type = typeof value;
|
|
423
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
424
|
+
}
|
|
425
|
+
_isKeyable = isKeyable;
|
|
426
|
+
return _isKeyable;
|
|
427
|
+
}
|
|
428
|
+
var _getMapData;
|
|
429
|
+
var hasRequired_getMapData;
|
|
430
|
+
function require_getMapData() {
|
|
431
|
+
if (hasRequired_getMapData) return _getMapData;
|
|
432
|
+
hasRequired_getMapData = 1;
|
|
433
|
+
var isKeyable = require_isKeyable();
|
|
434
|
+
function getMapData(map, key) {
|
|
435
|
+
var data = map.__data__;
|
|
436
|
+
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
437
|
+
}
|
|
438
|
+
_getMapData = getMapData;
|
|
439
|
+
return _getMapData;
|
|
440
|
+
}
|
|
441
|
+
var _mapCacheDelete;
|
|
442
|
+
var hasRequired_mapCacheDelete;
|
|
443
|
+
function require_mapCacheDelete() {
|
|
444
|
+
if (hasRequired_mapCacheDelete) return _mapCacheDelete;
|
|
445
|
+
hasRequired_mapCacheDelete = 1;
|
|
446
|
+
var getMapData = require_getMapData();
|
|
447
|
+
function mapCacheDelete(key) {
|
|
448
|
+
var result = getMapData(this, key)["delete"](key);
|
|
449
|
+
this.size -= result ? 1 : 0;
|
|
450
|
+
return result;
|
|
451
|
+
}
|
|
452
|
+
_mapCacheDelete = mapCacheDelete;
|
|
453
|
+
return _mapCacheDelete;
|
|
454
|
+
}
|
|
455
|
+
var _mapCacheGet;
|
|
456
|
+
var hasRequired_mapCacheGet;
|
|
457
|
+
function require_mapCacheGet() {
|
|
458
|
+
if (hasRequired_mapCacheGet) return _mapCacheGet;
|
|
459
|
+
hasRequired_mapCacheGet = 1;
|
|
460
|
+
var getMapData = require_getMapData();
|
|
461
|
+
function mapCacheGet(key) {
|
|
462
|
+
return getMapData(this, key).get(key);
|
|
463
|
+
}
|
|
464
|
+
_mapCacheGet = mapCacheGet;
|
|
465
|
+
return _mapCacheGet;
|
|
466
|
+
}
|
|
467
|
+
var _mapCacheHas;
|
|
468
|
+
var hasRequired_mapCacheHas;
|
|
469
|
+
function require_mapCacheHas() {
|
|
470
|
+
if (hasRequired_mapCacheHas) return _mapCacheHas;
|
|
471
|
+
hasRequired_mapCacheHas = 1;
|
|
472
|
+
var getMapData = require_getMapData();
|
|
473
|
+
function mapCacheHas(key) {
|
|
474
|
+
return getMapData(this, key).has(key);
|
|
475
|
+
}
|
|
476
|
+
_mapCacheHas = mapCacheHas;
|
|
477
|
+
return _mapCacheHas;
|
|
478
|
+
}
|
|
479
|
+
var _mapCacheSet;
|
|
480
|
+
var hasRequired_mapCacheSet;
|
|
481
|
+
function require_mapCacheSet() {
|
|
482
|
+
if (hasRequired_mapCacheSet) return _mapCacheSet;
|
|
483
|
+
hasRequired_mapCacheSet = 1;
|
|
484
|
+
var getMapData = require_getMapData();
|
|
485
|
+
function mapCacheSet(key, value) {
|
|
486
|
+
var data = getMapData(this, key), size = data.size;
|
|
487
|
+
data.set(key, value);
|
|
488
|
+
this.size += data.size == size ? 0 : 1;
|
|
489
|
+
return this;
|
|
490
|
+
}
|
|
491
|
+
_mapCacheSet = mapCacheSet;
|
|
492
|
+
return _mapCacheSet;
|
|
493
|
+
}
|
|
494
|
+
var _MapCache;
|
|
495
|
+
var hasRequired_MapCache;
|
|
496
|
+
function require_MapCache() {
|
|
497
|
+
if (hasRequired_MapCache) return _MapCache;
|
|
498
|
+
hasRequired_MapCache = 1;
|
|
499
|
+
var mapCacheClear = require_mapCacheClear(), mapCacheDelete = require_mapCacheDelete(), mapCacheGet = require_mapCacheGet(), mapCacheHas = require_mapCacheHas(), mapCacheSet = require_mapCacheSet();
|
|
500
|
+
function MapCache(entries) {
|
|
501
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
502
|
+
this.clear();
|
|
503
|
+
while (++index < length) {
|
|
504
|
+
var entry = entries[index];
|
|
505
|
+
this.set(entry[0], entry[1]);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
509
|
+
MapCache.prototype["delete"] = mapCacheDelete;
|
|
510
|
+
MapCache.prototype.get = mapCacheGet;
|
|
511
|
+
MapCache.prototype.has = mapCacheHas;
|
|
512
|
+
MapCache.prototype.set = mapCacheSet;
|
|
513
|
+
_MapCache = MapCache;
|
|
514
|
+
return _MapCache;
|
|
515
|
+
}
|
|
516
|
+
var _setCacheAdd;
|
|
517
|
+
var hasRequired_setCacheAdd;
|
|
518
|
+
function require_setCacheAdd() {
|
|
519
|
+
if (hasRequired_setCacheAdd) return _setCacheAdd;
|
|
520
|
+
hasRequired_setCacheAdd = 1;
|
|
521
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
522
|
+
function setCacheAdd(value) {
|
|
523
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
524
|
+
return this;
|
|
525
|
+
}
|
|
526
|
+
_setCacheAdd = setCacheAdd;
|
|
527
|
+
return _setCacheAdd;
|
|
528
|
+
}
|
|
529
|
+
var _setCacheHas;
|
|
530
|
+
var hasRequired_setCacheHas;
|
|
531
|
+
function require_setCacheHas() {
|
|
532
|
+
if (hasRequired_setCacheHas) return _setCacheHas;
|
|
533
|
+
hasRequired_setCacheHas = 1;
|
|
534
|
+
function setCacheHas(value) {
|
|
535
|
+
return this.__data__.has(value);
|
|
536
|
+
}
|
|
537
|
+
_setCacheHas = setCacheHas;
|
|
538
|
+
return _setCacheHas;
|
|
539
|
+
}
|
|
540
|
+
var _SetCache;
|
|
541
|
+
var hasRequired_SetCache;
|
|
542
|
+
function require_SetCache() {
|
|
543
|
+
if (hasRequired_SetCache) return _SetCache;
|
|
544
|
+
hasRequired_SetCache = 1;
|
|
545
|
+
var MapCache = require_MapCache(), setCacheAdd = require_setCacheAdd(), setCacheHas = require_setCacheHas();
|
|
546
|
+
function SetCache(values) {
|
|
547
|
+
var index = -1, length = values == null ? 0 : values.length;
|
|
548
|
+
this.__data__ = new MapCache();
|
|
549
|
+
while (++index < length) {
|
|
550
|
+
this.add(values[index]);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
554
|
+
SetCache.prototype.has = setCacheHas;
|
|
555
|
+
_SetCache = SetCache;
|
|
556
|
+
return _SetCache;
|
|
557
|
+
}
|
|
558
|
+
var _baseFindIndex;
|
|
559
|
+
var hasRequired_baseFindIndex;
|
|
560
|
+
function require_baseFindIndex() {
|
|
561
|
+
if (hasRequired_baseFindIndex) return _baseFindIndex;
|
|
562
|
+
hasRequired_baseFindIndex = 1;
|
|
563
|
+
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
564
|
+
var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
|
|
565
|
+
while (fromRight ? index-- : ++index < length) {
|
|
566
|
+
if (predicate(array[index], index, array)) {
|
|
567
|
+
return index;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
return -1;
|
|
571
|
+
}
|
|
572
|
+
_baseFindIndex = baseFindIndex;
|
|
573
|
+
return _baseFindIndex;
|
|
574
|
+
}
|
|
575
|
+
var _baseIsNaN;
|
|
576
|
+
var hasRequired_baseIsNaN;
|
|
577
|
+
function require_baseIsNaN() {
|
|
578
|
+
if (hasRequired_baseIsNaN) return _baseIsNaN;
|
|
579
|
+
hasRequired_baseIsNaN = 1;
|
|
580
|
+
function baseIsNaN(value) {
|
|
581
|
+
return value !== value;
|
|
582
|
+
}
|
|
583
|
+
_baseIsNaN = baseIsNaN;
|
|
584
|
+
return _baseIsNaN;
|
|
585
|
+
}
|
|
586
|
+
var _strictIndexOf;
|
|
587
|
+
var hasRequired_strictIndexOf;
|
|
588
|
+
function require_strictIndexOf() {
|
|
589
|
+
if (hasRequired_strictIndexOf) return _strictIndexOf;
|
|
590
|
+
hasRequired_strictIndexOf = 1;
|
|
591
|
+
function strictIndexOf(array, value, fromIndex) {
|
|
592
|
+
var index = fromIndex - 1, length = array.length;
|
|
593
|
+
while (++index < length) {
|
|
594
|
+
if (array[index] === value) {
|
|
595
|
+
return index;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return -1;
|
|
599
|
+
}
|
|
600
|
+
_strictIndexOf = strictIndexOf;
|
|
601
|
+
return _strictIndexOf;
|
|
602
|
+
}
|
|
603
|
+
var _baseIndexOf;
|
|
604
|
+
var hasRequired_baseIndexOf;
|
|
605
|
+
function require_baseIndexOf() {
|
|
606
|
+
if (hasRequired_baseIndexOf) return _baseIndexOf;
|
|
607
|
+
hasRequired_baseIndexOf = 1;
|
|
608
|
+
var baseFindIndex = require_baseFindIndex(), baseIsNaN = require_baseIsNaN(), strictIndexOf = require_strictIndexOf();
|
|
609
|
+
function baseIndexOf(array, value, fromIndex) {
|
|
610
|
+
return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
|
|
611
|
+
}
|
|
612
|
+
_baseIndexOf = baseIndexOf;
|
|
613
|
+
return _baseIndexOf;
|
|
614
|
+
}
|
|
615
|
+
var _arrayIncludes;
|
|
616
|
+
var hasRequired_arrayIncludes;
|
|
617
|
+
function require_arrayIncludes() {
|
|
618
|
+
if (hasRequired_arrayIncludes) return _arrayIncludes;
|
|
619
|
+
hasRequired_arrayIncludes = 1;
|
|
620
|
+
var baseIndexOf = require_baseIndexOf();
|
|
621
|
+
function arrayIncludes(array, value) {
|
|
622
|
+
var length = array == null ? 0 : array.length;
|
|
623
|
+
return !!length && baseIndexOf(array, value, 0) > -1;
|
|
624
|
+
}
|
|
625
|
+
_arrayIncludes = arrayIncludes;
|
|
626
|
+
return _arrayIncludes;
|
|
627
|
+
}
|
|
628
|
+
var _arrayIncludesWith;
|
|
629
|
+
var hasRequired_arrayIncludesWith;
|
|
630
|
+
function require_arrayIncludesWith() {
|
|
631
|
+
if (hasRequired_arrayIncludesWith) return _arrayIncludesWith;
|
|
632
|
+
hasRequired_arrayIncludesWith = 1;
|
|
633
|
+
function arrayIncludesWith(array, value, comparator) {
|
|
634
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
635
|
+
while (++index < length) {
|
|
636
|
+
if (comparator(value, array[index])) {
|
|
637
|
+
return true;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
_arrayIncludesWith = arrayIncludesWith;
|
|
643
|
+
return _arrayIncludesWith;
|
|
644
|
+
}
|
|
645
|
+
var _baseUnary;
|
|
646
|
+
var hasRequired_baseUnary;
|
|
647
|
+
function require_baseUnary() {
|
|
648
|
+
if (hasRequired_baseUnary) return _baseUnary;
|
|
649
|
+
hasRequired_baseUnary = 1;
|
|
650
|
+
function baseUnary(func) {
|
|
651
|
+
return function(value) {
|
|
652
|
+
return func(value);
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
_baseUnary = baseUnary;
|
|
656
|
+
return _baseUnary;
|
|
657
|
+
}
|
|
658
|
+
var _cacheHas;
|
|
659
|
+
var hasRequired_cacheHas;
|
|
660
|
+
function require_cacheHas() {
|
|
661
|
+
if (hasRequired_cacheHas) return _cacheHas;
|
|
662
|
+
hasRequired_cacheHas = 1;
|
|
663
|
+
function cacheHas(cache, key) {
|
|
664
|
+
return cache.has(key);
|
|
665
|
+
}
|
|
666
|
+
_cacheHas = cacheHas;
|
|
667
|
+
return _cacheHas;
|
|
668
|
+
}
|
|
669
|
+
var _baseDifference;
|
|
670
|
+
var hasRequired_baseDifference;
|
|
671
|
+
function require_baseDifference() {
|
|
672
|
+
if (hasRequired_baseDifference) return _baseDifference;
|
|
673
|
+
hasRequired_baseDifference = 1;
|
|
674
|
+
var SetCache = require_SetCache(), arrayIncludes = require_arrayIncludes(), arrayIncludesWith = require_arrayIncludesWith(), arrayMap = require_arrayMap(), baseUnary = require_baseUnary(), cacheHas = require_cacheHas();
|
|
675
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
676
|
+
function baseDifference(array, values, iteratee, comparator) {
|
|
677
|
+
var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
|
|
678
|
+
if (!length) {
|
|
679
|
+
return result;
|
|
680
|
+
}
|
|
681
|
+
if (iteratee) {
|
|
682
|
+
values = arrayMap(values, baseUnary(iteratee));
|
|
683
|
+
}
|
|
684
|
+
if (comparator) {
|
|
685
|
+
includes = arrayIncludesWith;
|
|
686
|
+
isCommon = false;
|
|
687
|
+
} else if (values.length >= LARGE_ARRAY_SIZE) {
|
|
688
|
+
includes = cacheHas;
|
|
689
|
+
isCommon = false;
|
|
690
|
+
values = new SetCache(values);
|
|
691
|
+
}
|
|
692
|
+
outer:
|
|
693
|
+
while (++index < length) {
|
|
694
|
+
var value = array[index], computed = iteratee == null ? value : iteratee(value);
|
|
695
|
+
value = comparator || value !== 0 ? value : 0;
|
|
696
|
+
if (isCommon && computed === computed) {
|
|
697
|
+
var valuesIndex = valuesLength;
|
|
698
|
+
while (valuesIndex--) {
|
|
699
|
+
if (values[valuesIndex] === computed) {
|
|
700
|
+
continue outer;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
result.push(value);
|
|
704
|
+
} else if (!includes(values, computed, comparator)) {
|
|
705
|
+
result.push(value);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
return result;
|
|
709
|
+
}
|
|
710
|
+
_baseDifference = baseDifference;
|
|
711
|
+
return _baseDifference;
|
|
712
|
+
}
|
|
713
|
+
var _arrayPush;
|
|
714
|
+
var hasRequired_arrayPush;
|
|
715
|
+
function require_arrayPush() {
|
|
716
|
+
if (hasRequired_arrayPush) return _arrayPush;
|
|
717
|
+
hasRequired_arrayPush = 1;
|
|
718
|
+
function arrayPush(array, values) {
|
|
719
|
+
var index = -1, length = values.length, offset = array.length;
|
|
720
|
+
while (++index < length) {
|
|
721
|
+
array[offset + index] = values[index];
|
|
722
|
+
}
|
|
723
|
+
return array;
|
|
724
|
+
}
|
|
725
|
+
_arrayPush = arrayPush;
|
|
726
|
+
return _arrayPush;
|
|
727
|
+
}
|
|
728
|
+
var _baseIsArguments;
|
|
729
|
+
var hasRequired_baseIsArguments;
|
|
730
|
+
function require_baseIsArguments() {
|
|
731
|
+
if (hasRequired_baseIsArguments) return _baseIsArguments;
|
|
732
|
+
hasRequired_baseIsArguments = 1;
|
|
733
|
+
var baseGetTag = require_baseGetTag(), isObjectLike = requireIsObjectLike();
|
|
734
|
+
var argsTag = "[object Arguments]";
|
|
735
|
+
function baseIsArguments(value) {
|
|
736
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
|
737
|
+
}
|
|
738
|
+
_baseIsArguments = baseIsArguments;
|
|
739
|
+
return _baseIsArguments;
|
|
740
|
+
}
|
|
741
|
+
var isArguments_1;
|
|
742
|
+
var hasRequiredIsArguments;
|
|
743
|
+
function requireIsArguments() {
|
|
744
|
+
if (hasRequiredIsArguments) return isArguments_1;
|
|
745
|
+
hasRequiredIsArguments = 1;
|
|
746
|
+
var baseIsArguments = require_baseIsArguments(), isObjectLike = requireIsObjectLike();
|
|
747
|
+
var objectProto = Object.prototype;
|
|
748
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
749
|
+
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
750
|
+
var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
|
|
751
|
+
return arguments;
|
|
752
|
+
})()) ? baseIsArguments : function(value) {
|
|
753
|
+
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
754
|
+
};
|
|
755
|
+
isArguments_1 = isArguments;
|
|
756
|
+
return isArguments_1;
|
|
757
|
+
}
|
|
758
|
+
var _isFlattenable;
|
|
759
|
+
var hasRequired_isFlattenable;
|
|
760
|
+
function require_isFlattenable() {
|
|
761
|
+
if (hasRequired_isFlattenable) return _isFlattenable;
|
|
762
|
+
hasRequired_isFlattenable = 1;
|
|
763
|
+
var Symbol2 = require_Symbol(), isArguments = requireIsArguments(), isArray = requireIsArray();
|
|
764
|
+
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
|
|
765
|
+
function isFlattenable(value) {
|
|
766
|
+
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
767
|
+
}
|
|
768
|
+
_isFlattenable = isFlattenable;
|
|
769
|
+
return _isFlattenable;
|
|
770
|
+
}
|
|
771
|
+
var _baseFlatten;
|
|
772
|
+
var hasRequired_baseFlatten;
|
|
773
|
+
function require_baseFlatten() {
|
|
774
|
+
if (hasRequired_baseFlatten) return _baseFlatten;
|
|
775
|
+
hasRequired_baseFlatten = 1;
|
|
776
|
+
var arrayPush = require_arrayPush(), isFlattenable = require_isFlattenable();
|
|
777
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
778
|
+
var index = -1, length = array.length;
|
|
779
|
+
predicate || (predicate = isFlattenable);
|
|
780
|
+
result || (result = []);
|
|
781
|
+
while (++index < length) {
|
|
782
|
+
var value = array[index];
|
|
783
|
+
if (depth > 0 && predicate(value)) {
|
|
784
|
+
if (depth > 1) {
|
|
785
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
786
|
+
} else {
|
|
787
|
+
arrayPush(result, value);
|
|
788
|
+
}
|
|
789
|
+
} else if (!isStrict) {
|
|
790
|
+
result[result.length] = value;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
return result;
|
|
794
|
+
}
|
|
795
|
+
_baseFlatten = baseFlatten;
|
|
796
|
+
return _baseFlatten;
|
|
797
|
+
}
|
|
798
|
+
var identity_1;
|
|
799
|
+
var hasRequiredIdentity;
|
|
800
|
+
function requireIdentity() {
|
|
801
|
+
if (hasRequiredIdentity) return identity_1;
|
|
802
|
+
hasRequiredIdentity = 1;
|
|
803
|
+
function identity(value) {
|
|
804
|
+
return value;
|
|
805
|
+
}
|
|
806
|
+
identity_1 = identity;
|
|
807
|
+
return identity_1;
|
|
808
|
+
}
|
|
809
|
+
var _apply;
|
|
810
|
+
var hasRequired_apply;
|
|
811
|
+
function require_apply() {
|
|
812
|
+
if (hasRequired_apply) return _apply;
|
|
813
|
+
hasRequired_apply = 1;
|
|
814
|
+
function apply(func, thisArg, args) {
|
|
815
|
+
switch (args.length) {
|
|
816
|
+
case 0:
|
|
817
|
+
return func.call(thisArg);
|
|
818
|
+
case 1:
|
|
819
|
+
return func.call(thisArg, args[0]);
|
|
820
|
+
case 2:
|
|
821
|
+
return func.call(thisArg, args[0], args[1]);
|
|
822
|
+
case 3:
|
|
823
|
+
return func.call(thisArg, args[0], args[1], args[2]);
|
|
824
|
+
}
|
|
825
|
+
return func.apply(thisArg, args);
|
|
826
|
+
}
|
|
827
|
+
_apply = apply;
|
|
828
|
+
return _apply;
|
|
829
|
+
}
|
|
830
|
+
var _overRest;
|
|
831
|
+
var hasRequired_overRest;
|
|
832
|
+
function require_overRest() {
|
|
833
|
+
if (hasRequired_overRest) return _overRest;
|
|
834
|
+
hasRequired_overRest = 1;
|
|
835
|
+
var apply = require_apply();
|
|
836
|
+
var nativeMax = Math.max;
|
|
837
|
+
function overRest(func, start, transform) {
|
|
838
|
+
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
|
839
|
+
return function() {
|
|
840
|
+
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
|
|
841
|
+
while (++index < length) {
|
|
842
|
+
array[index] = args[start + index];
|
|
843
|
+
}
|
|
844
|
+
index = -1;
|
|
845
|
+
var otherArgs = Array(start + 1);
|
|
846
|
+
while (++index < start) {
|
|
847
|
+
otherArgs[index] = args[index];
|
|
848
|
+
}
|
|
849
|
+
otherArgs[start] = transform(array);
|
|
850
|
+
return apply(func, this, otherArgs);
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
_overRest = overRest;
|
|
854
|
+
return _overRest;
|
|
855
|
+
}
|
|
856
|
+
var constant_1;
|
|
857
|
+
var hasRequiredConstant;
|
|
858
|
+
function requireConstant() {
|
|
859
|
+
if (hasRequiredConstant) return constant_1;
|
|
860
|
+
hasRequiredConstant = 1;
|
|
861
|
+
function constant(value) {
|
|
862
|
+
return function() {
|
|
863
|
+
return value;
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
constant_1 = constant;
|
|
867
|
+
return constant_1;
|
|
868
|
+
}
|
|
869
|
+
var _defineProperty;
|
|
870
|
+
var hasRequired_defineProperty;
|
|
871
|
+
function require_defineProperty() {
|
|
872
|
+
if (hasRequired_defineProperty) return _defineProperty;
|
|
873
|
+
hasRequired_defineProperty = 1;
|
|
874
|
+
var getNative = require_getNative();
|
|
875
|
+
var defineProperty = (function() {
|
|
876
|
+
try {
|
|
877
|
+
var func = getNative(Object, "defineProperty");
|
|
878
|
+
func({}, "", {});
|
|
879
|
+
return func;
|
|
880
|
+
} catch (e) {
|
|
881
|
+
}
|
|
882
|
+
})();
|
|
883
|
+
_defineProperty = defineProperty;
|
|
884
|
+
return _defineProperty;
|
|
885
|
+
}
|
|
886
|
+
var _baseSetToString;
|
|
887
|
+
var hasRequired_baseSetToString;
|
|
888
|
+
function require_baseSetToString() {
|
|
889
|
+
if (hasRequired_baseSetToString) return _baseSetToString;
|
|
890
|
+
hasRequired_baseSetToString = 1;
|
|
891
|
+
var constant = requireConstant(), defineProperty = require_defineProperty(), identity = requireIdentity();
|
|
892
|
+
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
|
893
|
+
return defineProperty(func, "toString", {
|
|
894
|
+
"configurable": true,
|
|
895
|
+
"enumerable": false,
|
|
896
|
+
"value": constant(string),
|
|
897
|
+
"writable": true
|
|
898
|
+
});
|
|
899
|
+
};
|
|
900
|
+
_baseSetToString = baseSetToString;
|
|
901
|
+
return _baseSetToString;
|
|
902
|
+
}
|
|
903
|
+
var _shortOut;
|
|
904
|
+
var hasRequired_shortOut;
|
|
905
|
+
function require_shortOut() {
|
|
906
|
+
if (hasRequired_shortOut) return _shortOut;
|
|
907
|
+
hasRequired_shortOut = 1;
|
|
908
|
+
var HOT_COUNT = 800, HOT_SPAN = 16;
|
|
909
|
+
var nativeNow = Date.now;
|
|
910
|
+
function shortOut(func) {
|
|
911
|
+
var count = 0, lastCalled = 0;
|
|
912
|
+
return function() {
|
|
913
|
+
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
|
914
|
+
lastCalled = stamp;
|
|
915
|
+
if (remaining > 0) {
|
|
916
|
+
if (++count >= HOT_COUNT) {
|
|
917
|
+
return arguments[0];
|
|
918
|
+
}
|
|
919
|
+
} else {
|
|
920
|
+
count = 0;
|
|
921
|
+
}
|
|
922
|
+
return func.apply(void 0, arguments);
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
_shortOut = shortOut;
|
|
926
|
+
return _shortOut;
|
|
927
|
+
}
|
|
928
|
+
var _setToString;
|
|
929
|
+
var hasRequired_setToString;
|
|
930
|
+
function require_setToString() {
|
|
931
|
+
if (hasRequired_setToString) return _setToString;
|
|
932
|
+
hasRequired_setToString = 1;
|
|
933
|
+
var baseSetToString = require_baseSetToString(), shortOut = require_shortOut();
|
|
934
|
+
var setToString = shortOut(baseSetToString);
|
|
935
|
+
_setToString = setToString;
|
|
936
|
+
return _setToString;
|
|
937
|
+
}
|
|
938
|
+
var _baseRest;
|
|
939
|
+
var hasRequired_baseRest;
|
|
940
|
+
function require_baseRest() {
|
|
941
|
+
if (hasRequired_baseRest) return _baseRest;
|
|
942
|
+
hasRequired_baseRest = 1;
|
|
943
|
+
var identity = requireIdentity(), overRest = require_overRest(), setToString = require_setToString();
|
|
944
|
+
function baseRest(func, start) {
|
|
945
|
+
return setToString(overRest(func, start, identity), func + "");
|
|
946
|
+
}
|
|
947
|
+
_baseRest = baseRest;
|
|
948
|
+
return _baseRest;
|
|
949
|
+
}
|
|
950
|
+
var isLength_1;
|
|
951
|
+
var hasRequiredIsLength;
|
|
952
|
+
function requireIsLength() {
|
|
953
|
+
if (hasRequiredIsLength) return isLength_1;
|
|
954
|
+
hasRequiredIsLength = 1;
|
|
955
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
956
|
+
function isLength(value) {
|
|
957
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
958
|
+
}
|
|
959
|
+
isLength_1 = isLength;
|
|
960
|
+
return isLength_1;
|
|
961
|
+
}
|
|
962
|
+
var isArrayLike_1;
|
|
963
|
+
var hasRequiredIsArrayLike;
|
|
964
|
+
function requireIsArrayLike() {
|
|
965
|
+
if (hasRequiredIsArrayLike) return isArrayLike_1;
|
|
966
|
+
hasRequiredIsArrayLike = 1;
|
|
967
|
+
var isFunction = requireIsFunction(), isLength = requireIsLength();
|
|
968
|
+
function isArrayLike(value) {
|
|
969
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
970
|
+
}
|
|
971
|
+
isArrayLike_1 = isArrayLike;
|
|
972
|
+
return isArrayLike_1;
|
|
973
|
+
}
|
|
974
|
+
var isArrayLikeObject_1;
|
|
975
|
+
var hasRequiredIsArrayLikeObject;
|
|
976
|
+
function requireIsArrayLikeObject() {
|
|
977
|
+
if (hasRequiredIsArrayLikeObject) return isArrayLikeObject_1;
|
|
978
|
+
hasRequiredIsArrayLikeObject = 1;
|
|
979
|
+
var isArrayLike = requireIsArrayLike(), isObjectLike = requireIsObjectLike();
|
|
980
|
+
function isArrayLikeObject(value) {
|
|
981
|
+
return isObjectLike(value) && isArrayLike(value);
|
|
982
|
+
}
|
|
983
|
+
isArrayLikeObject_1 = isArrayLikeObject;
|
|
984
|
+
return isArrayLikeObject_1;
|
|
985
|
+
}
|
|
986
|
+
var difference_1;
|
|
987
|
+
var hasRequiredDifference;
|
|
988
|
+
function requireDifference() {
|
|
989
|
+
if (hasRequiredDifference) return difference_1;
|
|
990
|
+
hasRequiredDifference = 1;
|
|
991
|
+
var baseDifference = require_baseDifference(), baseFlatten = require_baseFlatten(), baseRest = require_baseRest(), isArrayLikeObject = requireIsArrayLikeObject();
|
|
992
|
+
var difference2 = baseRest(function(array, values) {
|
|
993
|
+
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
|
|
994
|
+
});
|
|
995
|
+
difference_1 = difference2;
|
|
996
|
+
return difference_1;
|
|
997
|
+
}
|
|
998
|
+
var differenceExports = requireDifference();
|
|
999
|
+
const difference = /* @__PURE__ */ getDefaultExportFromCjs(differenceExports);
|
|
1000
|
+
var _arrayFilter;
|
|
1001
|
+
var hasRequired_arrayFilter;
|
|
1002
|
+
function require_arrayFilter() {
|
|
1003
|
+
if (hasRequired_arrayFilter) return _arrayFilter;
|
|
1004
|
+
hasRequired_arrayFilter = 1;
|
|
1005
|
+
function arrayFilter(array, predicate) {
|
|
1006
|
+
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
1007
|
+
while (++index < length) {
|
|
1008
|
+
var value = array[index];
|
|
1009
|
+
if (predicate(value, index, array)) {
|
|
1010
|
+
result[resIndex++] = value;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
return result;
|
|
1014
|
+
}
|
|
1015
|
+
_arrayFilter = arrayFilter;
|
|
1016
|
+
return _arrayFilter;
|
|
1017
|
+
}
|
|
1018
|
+
var _createBaseFor;
|
|
1019
|
+
var hasRequired_createBaseFor;
|
|
1020
|
+
function require_createBaseFor() {
|
|
1021
|
+
if (hasRequired_createBaseFor) return _createBaseFor;
|
|
1022
|
+
hasRequired_createBaseFor = 1;
|
|
1023
|
+
function createBaseFor(fromRight) {
|
|
1024
|
+
return function(object, iteratee, keysFunc) {
|
|
1025
|
+
var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
|
|
1026
|
+
while (length--) {
|
|
1027
|
+
var key = props[fromRight ? length : ++index];
|
|
1028
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
1029
|
+
break;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
return object;
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
_createBaseFor = createBaseFor;
|
|
1036
|
+
return _createBaseFor;
|
|
1037
|
+
}
|
|
1038
|
+
var _baseFor;
|
|
1039
|
+
var hasRequired_baseFor;
|
|
1040
|
+
function require_baseFor() {
|
|
1041
|
+
if (hasRequired_baseFor) return _baseFor;
|
|
1042
|
+
hasRequired_baseFor = 1;
|
|
1043
|
+
var createBaseFor = require_createBaseFor();
|
|
1044
|
+
var baseFor = createBaseFor();
|
|
1045
|
+
_baseFor = baseFor;
|
|
1046
|
+
return _baseFor;
|
|
1047
|
+
}
|
|
1048
|
+
var _baseTimes;
|
|
1049
|
+
var hasRequired_baseTimes;
|
|
1050
|
+
function require_baseTimes() {
|
|
1051
|
+
if (hasRequired_baseTimes) return _baseTimes;
|
|
1052
|
+
hasRequired_baseTimes = 1;
|
|
1053
|
+
function baseTimes(n, iteratee) {
|
|
1054
|
+
var index = -1, result = Array(n);
|
|
1055
|
+
while (++index < n) {
|
|
1056
|
+
result[index] = iteratee(index);
|
|
1057
|
+
}
|
|
1058
|
+
return result;
|
|
1059
|
+
}
|
|
1060
|
+
_baseTimes = baseTimes;
|
|
1061
|
+
return _baseTimes;
|
|
1062
|
+
}
|
|
1063
|
+
var isBuffer = { exports: {} };
|
|
1064
|
+
var stubFalse_1;
|
|
1065
|
+
var hasRequiredStubFalse;
|
|
1066
|
+
function requireStubFalse() {
|
|
1067
|
+
if (hasRequiredStubFalse) return stubFalse_1;
|
|
1068
|
+
hasRequiredStubFalse = 1;
|
|
1069
|
+
function stubFalse() {
|
|
1070
|
+
return false;
|
|
1071
|
+
}
|
|
1072
|
+
stubFalse_1 = stubFalse;
|
|
1073
|
+
return stubFalse_1;
|
|
1074
|
+
}
|
|
1075
|
+
isBuffer.exports;
|
|
1076
|
+
var hasRequiredIsBuffer;
|
|
1077
|
+
function requireIsBuffer() {
|
|
1078
|
+
if (hasRequiredIsBuffer) return isBuffer.exports;
|
|
1079
|
+
hasRequiredIsBuffer = 1;
|
|
1080
|
+
(function(module, exports$1) {
|
|
1081
|
+
var root = require_root(), stubFalse = requireStubFalse();
|
|
1082
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
1083
|
+
var freeModule = freeExports && true && module && !module.nodeType && module;
|
|
1084
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1085
|
+
var Buffer = moduleExports ? root.Buffer : void 0;
|
|
1086
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
|
1087
|
+
var isBuffer2 = nativeIsBuffer || stubFalse;
|
|
1088
|
+
module.exports = isBuffer2;
|
|
1089
|
+
})(isBuffer, isBuffer.exports);
|
|
1090
|
+
return isBuffer.exports;
|
|
1091
|
+
}
|
|
1092
|
+
var _isIndex;
|
|
1093
|
+
var hasRequired_isIndex;
|
|
1094
|
+
function require_isIndex() {
|
|
1095
|
+
if (hasRequired_isIndex) return _isIndex;
|
|
1096
|
+
hasRequired_isIndex = 1;
|
|
1097
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
1098
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
1099
|
+
function isIndex(value, length) {
|
|
1100
|
+
var type = typeof value;
|
|
1101
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
1102
|
+
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
1103
|
+
}
|
|
1104
|
+
_isIndex = isIndex;
|
|
1105
|
+
return _isIndex;
|
|
1106
|
+
}
|
|
1107
|
+
var _baseIsTypedArray;
|
|
1108
|
+
var hasRequired_baseIsTypedArray;
|
|
1109
|
+
function require_baseIsTypedArray() {
|
|
1110
|
+
if (hasRequired_baseIsTypedArray) return _baseIsTypedArray;
|
|
1111
|
+
hasRequired_baseIsTypedArray = 1;
|
|
1112
|
+
var baseGetTag = require_baseGetTag(), isLength = requireIsLength(), isObjectLike = requireIsObjectLike();
|
|
1113
|
+
var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", weakMapTag = "[object WeakMap]";
|
|
1114
|
+
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
1115
|
+
var typedArrayTags = {};
|
|
1116
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
1117
|
+
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
|
1118
|
+
function baseIsTypedArray(value) {
|
|
1119
|
+
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
1120
|
+
}
|
|
1121
|
+
_baseIsTypedArray = baseIsTypedArray;
|
|
1122
|
+
return _baseIsTypedArray;
|
|
1123
|
+
}
|
|
1124
|
+
var _nodeUtil = { exports: {} };
|
|
1125
|
+
_nodeUtil.exports;
|
|
1126
|
+
var hasRequired_nodeUtil;
|
|
1127
|
+
function require_nodeUtil() {
|
|
1128
|
+
if (hasRequired_nodeUtil) return _nodeUtil.exports;
|
|
1129
|
+
hasRequired_nodeUtil = 1;
|
|
1130
|
+
(function(module, exports$1) {
|
|
1131
|
+
var freeGlobal = require_freeGlobal();
|
|
1132
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
1133
|
+
var freeModule = freeExports && true && module && !module.nodeType && module;
|
|
1134
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1135
|
+
var freeProcess = moduleExports && freeGlobal.process;
|
|
1136
|
+
var nodeUtil = (function() {
|
|
1137
|
+
try {
|
|
1138
|
+
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
|
1139
|
+
if (types) {
|
|
1140
|
+
return types;
|
|
1141
|
+
}
|
|
1142
|
+
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
1143
|
+
} catch (e) {
|
|
1144
|
+
}
|
|
1145
|
+
})();
|
|
1146
|
+
module.exports = nodeUtil;
|
|
1147
|
+
})(_nodeUtil, _nodeUtil.exports);
|
|
1148
|
+
return _nodeUtil.exports;
|
|
1149
|
+
}
|
|
1150
|
+
var isTypedArray_1;
|
|
1151
|
+
var hasRequiredIsTypedArray;
|
|
1152
|
+
function requireIsTypedArray() {
|
|
1153
|
+
if (hasRequiredIsTypedArray) return isTypedArray_1;
|
|
1154
|
+
hasRequiredIsTypedArray = 1;
|
|
1155
|
+
var baseIsTypedArray = require_baseIsTypedArray(), baseUnary = require_baseUnary(), nodeUtil = require_nodeUtil();
|
|
1156
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
1157
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
1158
|
+
isTypedArray_1 = isTypedArray;
|
|
1159
|
+
return isTypedArray_1;
|
|
1160
|
+
}
|
|
1161
|
+
var _arrayLikeKeys;
|
|
1162
|
+
var hasRequired_arrayLikeKeys;
|
|
1163
|
+
function require_arrayLikeKeys() {
|
|
1164
|
+
if (hasRequired_arrayLikeKeys) return _arrayLikeKeys;
|
|
1165
|
+
hasRequired_arrayLikeKeys = 1;
|
|
1166
|
+
var baseTimes = require_baseTimes(), isArguments = requireIsArguments(), isArray = requireIsArray(), isBuffer2 = requireIsBuffer(), isIndex = require_isIndex(), isTypedArray = requireIsTypedArray();
|
|
1167
|
+
var objectProto = Object.prototype;
|
|
1168
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1169
|
+
function arrayLikeKeys(value, inherited) {
|
|
1170
|
+
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
1171
|
+
for (var key in value) {
|
|
1172
|
+
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1173
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1174
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1175
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
1176
|
+
isIndex(key, length)))) {
|
|
1177
|
+
result.push(key);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
return result;
|
|
1181
|
+
}
|
|
1182
|
+
_arrayLikeKeys = arrayLikeKeys;
|
|
1183
|
+
return _arrayLikeKeys;
|
|
1184
|
+
}
|
|
1185
|
+
var _isPrototype;
|
|
1186
|
+
var hasRequired_isPrototype;
|
|
1187
|
+
function require_isPrototype() {
|
|
1188
|
+
if (hasRequired_isPrototype) return _isPrototype;
|
|
1189
|
+
hasRequired_isPrototype = 1;
|
|
1190
|
+
var objectProto = Object.prototype;
|
|
1191
|
+
function isPrototype(value) {
|
|
1192
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
1193
|
+
return value === proto;
|
|
1194
|
+
}
|
|
1195
|
+
_isPrototype = isPrototype;
|
|
1196
|
+
return _isPrototype;
|
|
1197
|
+
}
|
|
1198
|
+
var _overArg;
|
|
1199
|
+
var hasRequired_overArg;
|
|
1200
|
+
function require_overArg() {
|
|
1201
|
+
if (hasRequired_overArg) return _overArg;
|
|
1202
|
+
hasRequired_overArg = 1;
|
|
1203
|
+
function overArg(func, transform) {
|
|
1204
|
+
return function(arg) {
|
|
1205
|
+
return func(transform(arg));
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
_overArg = overArg;
|
|
1209
|
+
return _overArg;
|
|
1210
|
+
}
|
|
1211
|
+
var _nativeKeys;
|
|
1212
|
+
var hasRequired_nativeKeys;
|
|
1213
|
+
function require_nativeKeys() {
|
|
1214
|
+
if (hasRequired_nativeKeys) return _nativeKeys;
|
|
1215
|
+
hasRequired_nativeKeys = 1;
|
|
1216
|
+
var overArg = require_overArg();
|
|
1217
|
+
var nativeKeys = overArg(Object.keys, Object);
|
|
1218
|
+
_nativeKeys = nativeKeys;
|
|
1219
|
+
return _nativeKeys;
|
|
1220
|
+
}
|
|
1221
|
+
var _baseKeys;
|
|
1222
|
+
var hasRequired_baseKeys;
|
|
1223
|
+
function require_baseKeys() {
|
|
1224
|
+
if (hasRequired_baseKeys) return _baseKeys;
|
|
1225
|
+
hasRequired_baseKeys = 1;
|
|
1226
|
+
var isPrototype = require_isPrototype(), nativeKeys = require_nativeKeys();
|
|
1227
|
+
var objectProto = Object.prototype;
|
|
1228
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1229
|
+
function baseKeys(object) {
|
|
1230
|
+
if (!isPrototype(object)) {
|
|
1231
|
+
return nativeKeys(object);
|
|
1232
|
+
}
|
|
1233
|
+
var result = [];
|
|
1234
|
+
for (var key in Object(object)) {
|
|
1235
|
+
if (hasOwnProperty.call(object, key) && key != "constructor") {
|
|
1236
|
+
result.push(key);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
return result;
|
|
1240
|
+
}
|
|
1241
|
+
_baseKeys = baseKeys;
|
|
1242
|
+
return _baseKeys;
|
|
1243
|
+
}
|
|
1244
|
+
var keys_1;
|
|
1245
|
+
var hasRequiredKeys;
|
|
1246
|
+
function requireKeys() {
|
|
1247
|
+
if (hasRequiredKeys) return keys_1;
|
|
1248
|
+
hasRequiredKeys = 1;
|
|
1249
|
+
var arrayLikeKeys = require_arrayLikeKeys(), baseKeys = require_baseKeys(), isArrayLike = requireIsArrayLike();
|
|
1250
|
+
function keys(object) {
|
|
1251
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
1252
|
+
}
|
|
1253
|
+
keys_1 = keys;
|
|
1254
|
+
return keys_1;
|
|
1255
|
+
}
|
|
1256
|
+
var _baseForOwn;
|
|
1257
|
+
var hasRequired_baseForOwn;
|
|
1258
|
+
function require_baseForOwn() {
|
|
1259
|
+
if (hasRequired_baseForOwn) return _baseForOwn;
|
|
1260
|
+
hasRequired_baseForOwn = 1;
|
|
1261
|
+
var baseFor = require_baseFor(), keys = requireKeys();
|
|
1262
|
+
function baseForOwn(object, iteratee) {
|
|
1263
|
+
return object && baseFor(object, iteratee, keys);
|
|
1264
|
+
}
|
|
1265
|
+
_baseForOwn = baseForOwn;
|
|
1266
|
+
return _baseForOwn;
|
|
1267
|
+
}
|
|
1268
|
+
var _createBaseEach;
|
|
1269
|
+
var hasRequired_createBaseEach;
|
|
1270
|
+
function require_createBaseEach() {
|
|
1271
|
+
if (hasRequired_createBaseEach) return _createBaseEach;
|
|
1272
|
+
hasRequired_createBaseEach = 1;
|
|
1273
|
+
var isArrayLike = requireIsArrayLike();
|
|
1274
|
+
function createBaseEach(eachFunc, fromRight) {
|
|
1275
|
+
return function(collection, iteratee) {
|
|
1276
|
+
if (collection == null) {
|
|
1277
|
+
return collection;
|
|
1278
|
+
}
|
|
1279
|
+
if (!isArrayLike(collection)) {
|
|
1280
|
+
return eachFunc(collection, iteratee);
|
|
1281
|
+
}
|
|
1282
|
+
var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
|
|
1283
|
+
while (fromRight ? index-- : ++index < length) {
|
|
1284
|
+
if (iteratee(iterable[index], index, iterable) === false) {
|
|
1285
|
+
break;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
return collection;
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
_createBaseEach = createBaseEach;
|
|
1292
|
+
return _createBaseEach;
|
|
1293
|
+
}
|
|
1294
|
+
var _baseEach;
|
|
1295
|
+
var hasRequired_baseEach;
|
|
1296
|
+
function require_baseEach() {
|
|
1297
|
+
if (hasRequired_baseEach) return _baseEach;
|
|
1298
|
+
hasRequired_baseEach = 1;
|
|
1299
|
+
var baseForOwn = require_baseForOwn(), createBaseEach = require_createBaseEach();
|
|
1300
|
+
var baseEach = createBaseEach(baseForOwn);
|
|
1301
|
+
_baseEach = baseEach;
|
|
1302
|
+
return _baseEach;
|
|
1303
|
+
}
|
|
1304
|
+
var _baseFilter;
|
|
1305
|
+
var hasRequired_baseFilter;
|
|
1306
|
+
function require_baseFilter() {
|
|
1307
|
+
if (hasRequired_baseFilter) return _baseFilter;
|
|
1308
|
+
hasRequired_baseFilter = 1;
|
|
1309
|
+
var baseEach = require_baseEach();
|
|
1310
|
+
function baseFilter(collection, predicate) {
|
|
1311
|
+
var result = [];
|
|
1312
|
+
baseEach(collection, function(value, index, collection2) {
|
|
1313
|
+
if (predicate(value, index, collection2)) {
|
|
1314
|
+
result.push(value);
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
return result;
|
|
1318
|
+
}
|
|
1319
|
+
_baseFilter = baseFilter;
|
|
1320
|
+
return _baseFilter;
|
|
1321
|
+
}
|
|
1322
|
+
var _stackClear;
|
|
1323
|
+
var hasRequired_stackClear;
|
|
1324
|
+
function require_stackClear() {
|
|
1325
|
+
if (hasRequired_stackClear) return _stackClear;
|
|
1326
|
+
hasRequired_stackClear = 1;
|
|
1327
|
+
var ListCache = require_ListCache();
|
|
1328
|
+
function stackClear() {
|
|
1329
|
+
this.__data__ = new ListCache();
|
|
1330
|
+
this.size = 0;
|
|
1331
|
+
}
|
|
1332
|
+
_stackClear = stackClear;
|
|
1333
|
+
return _stackClear;
|
|
1334
|
+
}
|
|
1335
|
+
var _stackDelete;
|
|
1336
|
+
var hasRequired_stackDelete;
|
|
1337
|
+
function require_stackDelete() {
|
|
1338
|
+
if (hasRequired_stackDelete) return _stackDelete;
|
|
1339
|
+
hasRequired_stackDelete = 1;
|
|
1340
|
+
function stackDelete(key) {
|
|
1341
|
+
var data = this.__data__, result = data["delete"](key);
|
|
1342
|
+
this.size = data.size;
|
|
1343
|
+
return result;
|
|
1344
|
+
}
|
|
1345
|
+
_stackDelete = stackDelete;
|
|
1346
|
+
return _stackDelete;
|
|
1347
|
+
}
|
|
1348
|
+
var _stackGet;
|
|
1349
|
+
var hasRequired_stackGet;
|
|
1350
|
+
function require_stackGet() {
|
|
1351
|
+
if (hasRequired_stackGet) return _stackGet;
|
|
1352
|
+
hasRequired_stackGet = 1;
|
|
1353
|
+
function stackGet(key) {
|
|
1354
|
+
return this.__data__.get(key);
|
|
1355
|
+
}
|
|
1356
|
+
_stackGet = stackGet;
|
|
1357
|
+
return _stackGet;
|
|
1358
|
+
}
|
|
1359
|
+
var _stackHas;
|
|
1360
|
+
var hasRequired_stackHas;
|
|
1361
|
+
function require_stackHas() {
|
|
1362
|
+
if (hasRequired_stackHas) return _stackHas;
|
|
1363
|
+
hasRequired_stackHas = 1;
|
|
1364
|
+
function stackHas(key) {
|
|
1365
|
+
return this.__data__.has(key);
|
|
1366
|
+
}
|
|
1367
|
+
_stackHas = stackHas;
|
|
1368
|
+
return _stackHas;
|
|
1369
|
+
}
|
|
1370
|
+
var _stackSet;
|
|
1371
|
+
var hasRequired_stackSet;
|
|
1372
|
+
function require_stackSet() {
|
|
1373
|
+
if (hasRequired_stackSet) return _stackSet;
|
|
1374
|
+
hasRequired_stackSet = 1;
|
|
1375
|
+
var ListCache = require_ListCache(), Map = require_Map(), MapCache = require_MapCache();
|
|
1376
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1377
|
+
function stackSet(key, value) {
|
|
1378
|
+
var data = this.__data__;
|
|
1379
|
+
if (data instanceof ListCache) {
|
|
1380
|
+
var pairs = data.__data__;
|
|
1381
|
+
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
1382
|
+
pairs.push([key, value]);
|
|
1383
|
+
this.size = ++data.size;
|
|
1384
|
+
return this;
|
|
1385
|
+
}
|
|
1386
|
+
data = this.__data__ = new MapCache(pairs);
|
|
1387
|
+
}
|
|
1388
|
+
data.set(key, value);
|
|
1389
|
+
this.size = data.size;
|
|
1390
|
+
return this;
|
|
1391
|
+
}
|
|
1392
|
+
_stackSet = stackSet;
|
|
1393
|
+
return _stackSet;
|
|
1394
|
+
}
|
|
1395
|
+
var _Stack;
|
|
1396
|
+
var hasRequired_Stack;
|
|
1397
|
+
function require_Stack() {
|
|
1398
|
+
if (hasRequired_Stack) return _Stack;
|
|
1399
|
+
hasRequired_Stack = 1;
|
|
1400
|
+
var ListCache = require_ListCache(), stackClear = require_stackClear(), stackDelete = require_stackDelete(), stackGet = require_stackGet(), stackHas = require_stackHas(), stackSet = require_stackSet();
|
|
1401
|
+
function Stack(entries) {
|
|
1402
|
+
var data = this.__data__ = new ListCache(entries);
|
|
1403
|
+
this.size = data.size;
|
|
1404
|
+
}
|
|
1405
|
+
Stack.prototype.clear = stackClear;
|
|
1406
|
+
Stack.prototype["delete"] = stackDelete;
|
|
1407
|
+
Stack.prototype.get = stackGet;
|
|
1408
|
+
Stack.prototype.has = stackHas;
|
|
1409
|
+
Stack.prototype.set = stackSet;
|
|
1410
|
+
_Stack = Stack;
|
|
1411
|
+
return _Stack;
|
|
1412
|
+
}
|
|
1413
|
+
var _arraySome;
|
|
1414
|
+
var hasRequired_arraySome;
|
|
1415
|
+
function require_arraySome() {
|
|
1416
|
+
if (hasRequired_arraySome) return _arraySome;
|
|
1417
|
+
hasRequired_arraySome = 1;
|
|
1418
|
+
function arraySome(array, predicate) {
|
|
1419
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
1420
|
+
while (++index < length) {
|
|
1421
|
+
if (predicate(array[index], index, array)) {
|
|
1422
|
+
return true;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
return false;
|
|
1426
|
+
}
|
|
1427
|
+
_arraySome = arraySome;
|
|
1428
|
+
return _arraySome;
|
|
1429
|
+
}
|
|
1430
|
+
var _equalArrays;
|
|
1431
|
+
var hasRequired_equalArrays;
|
|
1432
|
+
function require_equalArrays() {
|
|
1433
|
+
if (hasRequired_equalArrays) return _equalArrays;
|
|
1434
|
+
hasRequired_equalArrays = 1;
|
|
1435
|
+
var SetCache = require_SetCache(), arraySome = require_arraySome(), cacheHas = require_cacheHas();
|
|
1436
|
+
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
1437
|
+
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
1438
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
|
|
1439
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
1440
|
+
return false;
|
|
1441
|
+
}
|
|
1442
|
+
var arrStacked = stack.get(array);
|
|
1443
|
+
var othStacked = stack.get(other);
|
|
1444
|
+
if (arrStacked && othStacked) {
|
|
1445
|
+
return arrStacked == other && othStacked == array;
|
|
1446
|
+
}
|
|
1447
|
+
var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0;
|
|
1448
|
+
stack.set(array, other);
|
|
1449
|
+
stack.set(other, array);
|
|
1450
|
+
while (++index < arrLength) {
|
|
1451
|
+
var arrValue = array[index], othValue = other[index];
|
|
1452
|
+
if (customizer) {
|
|
1453
|
+
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
|
1454
|
+
}
|
|
1455
|
+
if (compared !== void 0) {
|
|
1456
|
+
if (compared) {
|
|
1457
|
+
continue;
|
|
1458
|
+
}
|
|
1459
|
+
result = false;
|
|
1460
|
+
break;
|
|
1461
|
+
}
|
|
1462
|
+
if (seen) {
|
|
1463
|
+
if (!arraySome(other, function(othValue2, othIndex) {
|
|
1464
|
+
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
|
|
1465
|
+
return seen.push(othIndex);
|
|
1466
|
+
}
|
|
1467
|
+
})) {
|
|
1468
|
+
result = false;
|
|
1469
|
+
break;
|
|
1470
|
+
}
|
|
1471
|
+
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
1472
|
+
result = false;
|
|
1473
|
+
break;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
stack["delete"](array);
|
|
1477
|
+
stack["delete"](other);
|
|
1478
|
+
return result;
|
|
1479
|
+
}
|
|
1480
|
+
_equalArrays = equalArrays;
|
|
1481
|
+
return _equalArrays;
|
|
1482
|
+
}
|
|
1483
|
+
var _Uint8Array;
|
|
1484
|
+
var hasRequired_Uint8Array;
|
|
1485
|
+
function require_Uint8Array() {
|
|
1486
|
+
if (hasRequired_Uint8Array) return _Uint8Array;
|
|
1487
|
+
hasRequired_Uint8Array = 1;
|
|
1488
|
+
var root = require_root();
|
|
1489
|
+
var Uint8Array = root.Uint8Array;
|
|
1490
|
+
_Uint8Array = Uint8Array;
|
|
1491
|
+
return _Uint8Array;
|
|
1492
|
+
}
|
|
1493
|
+
var _mapToArray;
|
|
1494
|
+
var hasRequired_mapToArray;
|
|
1495
|
+
function require_mapToArray() {
|
|
1496
|
+
if (hasRequired_mapToArray) return _mapToArray;
|
|
1497
|
+
hasRequired_mapToArray = 1;
|
|
1498
|
+
function mapToArray(map) {
|
|
1499
|
+
var index = -1, result = Array(map.size);
|
|
1500
|
+
map.forEach(function(value, key) {
|
|
1501
|
+
result[++index] = [key, value];
|
|
1502
|
+
});
|
|
1503
|
+
return result;
|
|
1504
|
+
}
|
|
1505
|
+
_mapToArray = mapToArray;
|
|
1506
|
+
return _mapToArray;
|
|
1507
|
+
}
|
|
1508
|
+
var _setToArray;
|
|
1509
|
+
var hasRequired_setToArray;
|
|
1510
|
+
function require_setToArray() {
|
|
1511
|
+
if (hasRequired_setToArray) return _setToArray;
|
|
1512
|
+
hasRequired_setToArray = 1;
|
|
1513
|
+
function setToArray(set) {
|
|
1514
|
+
var index = -1, result = Array(set.size);
|
|
1515
|
+
set.forEach(function(value) {
|
|
1516
|
+
result[++index] = value;
|
|
1517
|
+
});
|
|
1518
|
+
return result;
|
|
1519
|
+
}
|
|
1520
|
+
_setToArray = setToArray;
|
|
1521
|
+
return _setToArray;
|
|
1522
|
+
}
|
|
1523
|
+
var _equalByTag;
|
|
1524
|
+
var hasRequired_equalByTag;
|
|
1525
|
+
function require_equalByTag() {
|
|
1526
|
+
if (hasRequired_equalByTag) return _equalByTag;
|
|
1527
|
+
hasRequired_equalByTag = 1;
|
|
1528
|
+
var Symbol2 = require_Symbol(), Uint8Array = require_Uint8Array(), eq = requireEq(), equalArrays = require_equalArrays(), mapToArray = require_mapToArray(), setToArray = require_setToArray();
|
|
1529
|
+
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
1530
|
+
var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
|
|
1531
|
+
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
|
|
1532
|
+
var symbolProto = Symbol2 ? Symbol2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
1533
|
+
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
1534
|
+
switch (tag) {
|
|
1535
|
+
case dataViewTag:
|
|
1536
|
+
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
1537
|
+
return false;
|
|
1538
|
+
}
|
|
1539
|
+
object = object.buffer;
|
|
1540
|
+
other = other.buffer;
|
|
1541
|
+
case arrayBufferTag:
|
|
1542
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
1543
|
+
return false;
|
|
1544
|
+
}
|
|
1545
|
+
return true;
|
|
1546
|
+
case boolTag:
|
|
1547
|
+
case dateTag:
|
|
1548
|
+
case numberTag:
|
|
1549
|
+
return eq(+object, +other);
|
|
1550
|
+
case errorTag:
|
|
1551
|
+
return object.name == other.name && object.message == other.message;
|
|
1552
|
+
case regexpTag:
|
|
1553
|
+
case stringTag:
|
|
1554
|
+
return object == other + "";
|
|
1555
|
+
case mapTag:
|
|
1556
|
+
var convert = mapToArray;
|
|
1557
|
+
case setTag:
|
|
1558
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
|
1559
|
+
convert || (convert = setToArray);
|
|
1560
|
+
if (object.size != other.size && !isPartial) {
|
|
1561
|
+
return false;
|
|
1562
|
+
}
|
|
1563
|
+
var stacked = stack.get(object);
|
|
1564
|
+
if (stacked) {
|
|
1565
|
+
return stacked == other;
|
|
1566
|
+
}
|
|
1567
|
+
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
1568
|
+
stack.set(object, other);
|
|
1569
|
+
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
1570
|
+
stack["delete"](object);
|
|
1571
|
+
return result;
|
|
1572
|
+
case symbolTag:
|
|
1573
|
+
if (symbolValueOf) {
|
|
1574
|
+
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
return false;
|
|
1578
|
+
}
|
|
1579
|
+
_equalByTag = equalByTag;
|
|
1580
|
+
return _equalByTag;
|
|
1581
|
+
}
|
|
1582
|
+
var _baseGetAllKeys;
|
|
1583
|
+
var hasRequired_baseGetAllKeys;
|
|
1584
|
+
function require_baseGetAllKeys() {
|
|
1585
|
+
if (hasRequired_baseGetAllKeys) return _baseGetAllKeys;
|
|
1586
|
+
hasRequired_baseGetAllKeys = 1;
|
|
1587
|
+
var arrayPush = require_arrayPush(), isArray = requireIsArray();
|
|
1588
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1589
|
+
var result = keysFunc(object);
|
|
1590
|
+
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
1591
|
+
}
|
|
1592
|
+
_baseGetAllKeys = baseGetAllKeys;
|
|
1593
|
+
return _baseGetAllKeys;
|
|
1594
|
+
}
|
|
1595
|
+
var stubArray_1;
|
|
1596
|
+
var hasRequiredStubArray;
|
|
1597
|
+
function requireStubArray() {
|
|
1598
|
+
if (hasRequiredStubArray) return stubArray_1;
|
|
1599
|
+
hasRequiredStubArray = 1;
|
|
1600
|
+
function stubArray() {
|
|
1601
|
+
return [];
|
|
1602
|
+
}
|
|
1603
|
+
stubArray_1 = stubArray;
|
|
1604
|
+
return stubArray_1;
|
|
1605
|
+
}
|
|
1606
|
+
var _getSymbols;
|
|
1607
|
+
var hasRequired_getSymbols;
|
|
1608
|
+
function require_getSymbols() {
|
|
1609
|
+
if (hasRequired_getSymbols) return _getSymbols;
|
|
1610
|
+
hasRequired_getSymbols = 1;
|
|
1611
|
+
var arrayFilter = require_arrayFilter(), stubArray = requireStubArray();
|
|
1612
|
+
var objectProto = Object.prototype;
|
|
1613
|
+
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
1614
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1615
|
+
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
1616
|
+
if (object == null) {
|
|
1617
|
+
return [];
|
|
1618
|
+
}
|
|
1619
|
+
object = Object(object);
|
|
1620
|
+
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
1621
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
1622
|
+
});
|
|
1623
|
+
};
|
|
1624
|
+
_getSymbols = getSymbols;
|
|
1625
|
+
return _getSymbols;
|
|
1626
|
+
}
|
|
1627
|
+
var _getAllKeys;
|
|
1628
|
+
var hasRequired_getAllKeys;
|
|
1629
|
+
function require_getAllKeys() {
|
|
1630
|
+
if (hasRequired_getAllKeys) return _getAllKeys;
|
|
1631
|
+
hasRequired_getAllKeys = 1;
|
|
1632
|
+
var baseGetAllKeys = require_baseGetAllKeys(), getSymbols = require_getSymbols(), keys = requireKeys();
|
|
1633
|
+
function getAllKeys(object) {
|
|
1634
|
+
return baseGetAllKeys(object, keys, getSymbols);
|
|
1635
|
+
}
|
|
1636
|
+
_getAllKeys = getAllKeys;
|
|
1637
|
+
return _getAllKeys;
|
|
1638
|
+
}
|
|
1639
|
+
var _equalObjects;
|
|
1640
|
+
var hasRequired_equalObjects;
|
|
1641
|
+
function require_equalObjects() {
|
|
1642
|
+
if (hasRequired_equalObjects) return _equalObjects;
|
|
1643
|
+
hasRequired_equalObjects = 1;
|
|
1644
|
+
var getAllKeys = require_getAllKeys();
|
|
1645
|
+
var COMPARE_PARTIAL_FLAG = 1;
|
|
1646
|
+
var objectProto = Object.prototype;
|
|
1647
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1648
|
+
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1649
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
1650
|
+
if (objLength != othLength && !isPartial) {
|
|
1651
|
+
return false;
|
|
1652
|
+
}
|
|
1653
|
+
var index = objLength;
|
|
1654
|
+
while (index--) {
|
|
1655
|
+
var key = objProps[index];
|
|
1656
|
+
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
|
1657
|
+
return false;
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
var objStacked = stack.get(object);
|
|
1661
|
+
var othStacked = stack.get(other);
|
|
1662
|
+
if (objStacked && othStacked) {
|
|
1663
|
+
return objStacked == other && othStacked == object;
|
|
1664
|
+
}
|
|
1665
|
+
var result = true;
|
|
1666
|
+
stack.set(object, other);
|
|
1667
|
+
stack.set(other, object);
|
|
1668
|
+
var skipCtor = isPartial;
|
|
1669
|
+
while (++index < objLength) {
|
|
1670
|
+
key = objProps[index];
|
|
1671
|
+
var objValue = object[key], othValue = other[key];
|
|
1672
|
+
if (customizer) {
|
|
1673
|
+
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
1674
|
+
}
|
|
1675
|
+
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
1676
|
+
result = false;
|
|
1677
|
+
break;
|
|
1678
|
+
}
|
|
1679
|
+
skipCtor || (skipCtor = key == "constructor");
|
|
1680
|
+
}
|
|
1681
|
+
if (result && !skipCtor) {
|
|
1682
|
+
var objCtor = object.constructor, othCtor = other.constructor;
|
|
1683
|
+
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
|
|
1684
|
+
result = false;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
stack["delete"](object);
|
|
1688
|
+
stack["delete"](other);
|
|
1689
|
+
return result;
|
|
1690
|
+
}
|
|
1691
|
+
_equalObjects = equalObjects;
|
|
1692
|
+
return _equalObjects;
|
|
1693
|
+
}
|
|
1694
|
+
var _DataView;
|
|
1695
|
+
var hasRequired_DataView;
|
|
1696
|
+
function require_DataView() {
|
|
1697
|
+
if (hasRequired_DataView) return _DataView;
|
|
1698
|
+
hasRequired_DataView = 1;
|
|
1699
|
+
var getNative = require_getNative(), root = require_root();
|
|
1700
|
+
var DataView = getNative(root, "DataView");
|
|
1701
|
+
_DataView = DataView;
|
|
1702
|
+
return _DataView;
|
|
1703
|
+
}
|
|
1704
|
+
var _Promise;
|
|
1705
|
+
var hasRequired_Promise;
|
|
1706
|
+
function require_Promise() {
|
|
1707
|
+
if (hasRequired_Promise) return _Promise;
|
|
1708
|
+
hasRequired_Promise = 1;
|
|
1709
|
+
var getNative = require_getNative(), root = require_root();
|
|
1710
|
+
var Promise2 = getNative(root, "Promise");
|
|
1711
|
+
_Promise = Promise2;
|
|
1712
|
+
return _Promise;
|
|
1713
|
+
}
|
|
1714
|
+
var _Set;
|
|
1715
|
+
var hasRequired_Set;
|
|
1716
|
+
function require_Set() {
|
|
1717
|
+
if (hasRequired_Set) return _Set;
|
|
1718
|
+
hasRequired_Set = 1;
|
|
1719
|
+
var getNative = require_getNative(), root = require_root();
|
|
1720
|
+
var Set = getNative(root, "Set");
|
|
1721
|
+
_Set = Set;
|
|
1722
|
+
return _Set;
|
|
1723
|
+
}
|
|
1724
|
+
var _WeakMap;
|
|
1725
|
+
var hasRequired_WeakMap;
|
|
1726
|
+
function require_WeakMap() {
|
|
1727
|
+
if (hasRequired_WeakMap) return _WeakMap;
|
|
1728
|
+
hasRequired_WeakMap = 1;
|
|
1729
|
+
var getNative = require_getNative(), root = require_root();
|
|
1730
|
+
var WeakMap = getNative(root, "WeakMap");
|
|
1731
|
+
_WeakMap = WeakMap;
|
|
1732
|
+
return _WeakMap;
|
|
1733
|
+
}
|
|
1734
|
+
var _getTag;
|
|
1735
|
+
var hasRequired_getTag;
|
|
1736
|
+
function require_getTag() {
|
|
1737
|
+
if (hasRequired_getTag) return _getTag;
|
|
1738
|
+
hasRequired_getTag = 1;
|
|
1739
|
+
var DataView = require_DataView(), Map = require_Map(), Promise2 = require_Promise(), Set = require_Set(), WeakMap = require_WeakMap(), baseGetTag = require_baseGetTag(), toSource = require_toSource();
|
|
1740
|
+
var mapTag = "[object Map]", objectTag = "[object Object]", promiseTag = "[object Promise]", setTag = "[object Set]", weakMapTag = "[object WeakMap]";
|
|
1741
|
+
var dataViewTag = "[object DataView]";
|
|
1742
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
|
|
1743
|
+
var getTag = baseGetTag;
|
|
1744
|
+
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
1745
|
+
getTag = function(value) {
|
|
1746
|
+
var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
1747
|
+
if (ctorString) {
|
|
1748
|
+
switch (ctorString) {
|
|
1749
|
+
case dataViewCtorString:
|
|
1750
|
+
return dataViewTag;
|
|
1751
|
+
case mapCtorString:
|
|
1752
|
+
return mapTag;
|
|
1753
|
+
case promiseCtorString:
|
|
1754
|
+
return promiseTag;
|
|
1755
|
+
case setCtorString:
|
|
1756
|
+
return setTag;
|
|
1757
|
+
case weakMapCtorString:
|
|
1758
|
+
return weakMapTag;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
return result;
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
_getTag = getTag;
|
|
1765
|
+
return _getTag;
|
|
1766
|
+
}
|
|
1767
|
+
var _baseIsEqualDeep;
|
|
1768
|
+
var hasRequired_baseIsEqualDeep;
|
|
1769
|
+
function require_baseIsEqualDeep() {
|
|
1770
|
+
if (hasRequired_baseIsEqualDeep) return _baseIsEqualDeep;
|
|
1771
|
+
hasRequired_baseIsEqualDeep = 1;
|
|
1772
|
+
var Stack = require_Stack(), equalArrays = require_equalArrays(), equalByTag = require_equalByTag(), equalObjects = require_equalObjects(), getTag = require_getTag(), isArray = requireIsArray(), isBuffer2 = requireIsBuffer(), isTypedArray = requireIsTypedArray();
|
|
1773
|
+
var COMPARE_PARTIAL_FLAG = 1;
|
|
1774
|
+
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
|
|
1775
|
+
var objectProto = Object.prototype;
|
|
1776
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1777
|
+
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1778
|
+
var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
1779
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
1780
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1781
|
+
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
1782
|
+
if (isSameTag && isBuffer2(object)) {
|
|
1783
|
+
if (!isBuffer2(other)) {
|
|
1784
|
+
return false;
|
|
1785
|
+
}
|
|
1786
|
+
objIsArr = true;
|
|
1787
|
+
objIsObj = false;
|
|
1788
|
+
}
|
|
1789
|
+
if (isSameTag && !objIsObj) {
|
|
1790
|
+
stack || (stack = new Stack());
|
|
1791
|
+
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
1792
|
+
}
|
|
1793
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
1794
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
|
|
1795
|
+
if (objIsWrapped || othIsWrapped) {
|
|
1796
|
+
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
1797
|
+
stack || (stack = new Stack());
|
|
1798
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
if (!isSameTag) {
|
|
1802
|
+
return false;
|
|
1803
|
+
}
|
|
1804
|
+
stack || (stack = new Stack());
|
|
1805
|
+
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
1806
|
+
}
|
|
1807
|
+
_baseIsEqualDeep = baseIsEqualDeep;
|
|
1808
|
+
return _baseIsEqualDeep;
|
|
1809
|
+
}
|
|
1810
|
+
var _baseIsEqual;
|
|
1811
|
+
var hasRequired_baseIsEqual;
|
|
1812
|
+
function require_baseIsEqual() {
|
|
1813
|
+
if (hasRequired_baseIsEqual) return _baseIsEqual;
|
|
1814
|
+
hasRequired_baseIsEqual = 1;
|
|
1815
|
+
var baseIsEqualDeep = require_baseIsEqualDeep(), isObjectLike = requireIsObjectLike();
|
|
1816
|
+
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
1817
|
+
if (value === other) {
|
|
1818
|
+
return true;
|
|
1819
|
+
}
|
|
1820
|
+
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
|
1821
|
+
return value !== value && other !== other;
|
|
1822
|
+
}
|
|
1823
|
+
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
1824
|
+
}
|
|
1825
|
+
_baseIsEqual = baseIsEqual;
|
|
1826
|
+
return _baseIsEqual;
|
|
1827
|
+
}
|
|
1828
|
+
var _baseIsMatch;
|
|
1829
|
+
var hasRequired_baseIsMatch;
|
|
1830
|
+
function require_baseIsMatch() {
|
|
1831
|
+
if (hasRequired_baseIsMatch) return _baseIsMatch;
|
|
1832
|
+
hasRequired_baseIsMatch = 1;
|
|
1833
|
+
var Stack = require_Stack(), baseIsEqual = require_baseIsEqual();
|
|
1834
|
+
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
1835
|
+
function baseIsMatch(object, source, matchData, customizer) {
|
|
1836
|
+
var index = matchData.length, length = index, noCustomizer = !customizer;
|
|
1837
|
+
if (object == null) {
|
|
1838
|
+
return !length;
|
|
1839
|
+
}
|
|
1840
|
+
object = Object(object);
|
|
1841
|
+
while (index--) {
|
|
1842
|
+
var data = matchData[index];
|
|
1843
|
+
if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
|
|
1844
|
+
return false;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
while (++index < length) {
|
|
1848
|
+
data = matchData[index];
|
|
1849
|
+
var key = data[0], objValue = object[key], srcValue = data[1];
|
|
1850
|
+
if (noCustomizer && data[2]) {
|
|
1851
|
+
if (objValue === void 0 && !(key in object)) {
|
|
1852
|
+
return false;
|
|
1853
|
+
}
|
|
1854
|
+
} else {
|
|
1855
|
+
var stack = new Stack();
|
|
1856
|
+
if (customizer) {
|
|
1857
|
+
var result = customizer(objValue, srcValue, key, object, source, stack);
|
|
1858
|
+
}
|
|
1859
|
+
if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result)) {
|
|
1860
|
+
return false;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
return true;
|
|
1865
|
+
}
|
|
1866
|
+
_baseIsMatch = baseIsMatch;
|
|
1867
|
+
return _baseIsMatch;
|
|
1868
|
+
}
|
|
1869
|
+
var _isStrictComparable;
|
|
1870
|
+
var hasRequired_isStrictComparable;
|
|
1871
|
+
function require_isStrictComparable() {
|
|
1872
|
+
if (hasRequired_isStrictComparable) return _isStrictComparable;
|
|
1873
|
+
hasRequired_isStrictComparable = 1;
|
|
1874
|
+
var isObject = requireIsObject();
|
|
1875
|
+
function isStrictComparable(value) {
|
|
1876
|
+
return value === value && !isObject(value);
|
|
1877
|
+
}
|
|
1878
|
+
_isStrictComparable = isStrictComparable;
|
|
1879
|
+
return _isStrictComparable;
|
|
1880
|
+
}
|
|
1881
|
+
var _getMatchData;
|
|
1882
|
+
var hasRequired_getMatchData;
|
|
1883
|
+
function require_getMatchData() {
|
|
1884
|
+
if (hasRequired_getMatchData) return _getMatchData;
|
|
1885
|
+
hasRequired_getMatchData = 1;
|
|
1886
|
+
var isStrictComparable = require_isStrictComparable(), keys = requireKeys();
|
|
1887
|
+
function getMatchData(object) {
|
|
1888
|
+
var result = keys(object), length = result.length;
|
|
1889
|
+
while (length--) {
|
|
1890
|
+
var key = result[length], value = object[key];
|
|
1891
|
+
result[length] = [key, value, isStrictComparable(value)];
|
|
1892
|
+
}
|
|
1893
|
+
return result;
|
|
1894
|
+
}
|
|
1895
|
+
_getMatchData = getMatchData;
|
|
1896
|
+
return _getMatchData;
|
|
1897
|
+
}
|
|
1898
|
+
var _matchesStrictComparable;
|
|
1899
|
+
var hasRequired_matchesStrictComparable;
|
|
1900
|
+
function require_matchesStrictComparable() {
|
|
1901
|
+
if (hasRequired_matchesStrictComparable) return _matchesStrictComparable;
|
|
1902
|
+
hasRequired_matchesStrictComparable = 1;
|
|
1903
|
+
function matchesStrictComparable(key, srcValue) {
|
|
1904
|
+
return function(object) {
|
|
1905
|
+
if (object == null) {
|
|
1906
|
+
return false;
|
|
1907
|
+
}
|
|
1908
|
+
return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1911
|
+
_matchesStrictComparable = matchesStrictComparable;
|
|
1912
|
+
return _matchesStrictComparable;
|
|
1913
|
+
}
|
|
1914
|
+
var _baseMatches;
|
|
1915
|
+
var hasRequired_baseMatches;
|
|
1916
|
+
function require_baseMatches() {
|
|
1917
|
+
if (hasRequired_baseMatches) return _baseMatches;
|
|
1918
|
+
hasRequired_baseMatches = 1;
|
|
1919
|
+
var baseIsMatch = require_baseIsMatch(), getMatchData = require_getMatchData(), matchesStrictComparable = require_matchesStrictComparable();
|
|
1920
|
+
function baseMatches(source) {
|
|
1921
|
+
var matchData = getMatchData(source);
|
|
1922
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
|
1923
|
+
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
1924
|
+
}
|
|
1925
|
+
return function(object) {
|
|
1926
|
+
return object === source || baseIsMatch(object, source, matchData);
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
_baseMatches = baseMatches;
|
|
1930
|
+
return _baseMatches;
|
|
1931
|
+
}
|
|
1932
|
+
var _isKey;
|
|
1933
|
+
var hasRequired_isKey;
|
|
1934
|
+
function require_isKey() {
|
|
1935
|
+
if (hasRequired_isKey) return _isKey;
|
|
1936
|
+
hasRequired_isKey = 1;
|
|
1937
|
+
var isArray = requireIsArray(), isSymbol = requireIsSymbol();
|
|
1938
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
|
|
1939
|
+
function isKey(value, object) {
|
|
1940
|
+
if (isArray(value)) {
|
|
1941
|
+
return false;
|
|
1942
|
+
}
|
|
1943
|
+
var type = typeof value;
|
|
1944
|
+
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
|
|
1945
|
+
return true;
|
|
1946
|
+
}
|
|
1947
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
|
|
1948
|
+
}
|
|
1949
|
+
_isKey = isKey;
|
|
1950
|
+
return _isKey;
|
|
1951
|
+
}
|
|
1952
|
+
var memoize_1;
|
|
1953
|
+
var hasRequiredMemoize;
|
|
1954
|
+
function requireMemoize() {
|
|
1955
|
+
if (hasRequiredMemoize) return memoize_1;
|
|
1956
|
+
hasRequiredMemoize = 1;
|
|
1957
|
+
var MapCache = require_MapCache();
|
|
1958
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
1959
|
+
function memoize(func, resolver) {
|
|
1960
|
+
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
1961
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1962
|
+
}
|
|
1963
|
+
var memoized = function() {
|
|
1964
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
1965
|
+
if (cache.has(key)) {
|
|
1966
|
+
return cache.get(key);
|
|
1967
|
+
}
|
|
1968
|
+
var result = func.apply(this, args);
|
|
1969
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
1970
|
+
return result;
|
|
1971
|
+
};
|
|
1972
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
|
1973
|
+
return memoized;
|
|
1974
|
+
}
|
|
1975
|
+
memoize.Cache = MapCache;
|
|
1976
|
+
memoize_1 = memoize;
|
|
1977
|
+
return memoize_1;
|
|
1978
|
+
}
|
|
1979
|
+
var _memoizeCapped;
|
|
1980
|
+
var hasRequired_memoizeCapped;
|
|
1981
|
+
function require_memoizeCapped() {
|
|
1982
|
+
if (hasRequired_memoizeCapped) return _memoizeCapped;
|
|
1983
|
+
hasRequired_memoizeCapped = 1;
|
|
1984
|
+
var memoize = requireMemoize();
|
|
1985
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
1986
|
+
function memoizeCapped(func) {
|
|
1987
|
+
var result = memoize(func, function(key) {
|
|
1988
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
1989
|
+
cache.clear();
|
|
1990
|
+
}
|
|
1991
|
+
return key;
|
|
1992
|
+
});
|
|
1993
|
+
var cache = result.cache;
|
|
1994
|
+
return result;
|
|
1995
|
+
}
|
|
1996
|
+
_memoizeCapped = memoizeCapped;
|
|
1997
|
+
return _memoizeCapped;
|
|
1998
|
+
}
|
|
1999
|
+
var _stringToPath;
|
|
2000
|
+
var hasRequired_stringToPath;
|
|
2001
|
+
function require_stringToPath() {
|
|
2002
|
+
if (hasRequired_stringToPath) return _stringToPath;
|
|
2003
|
+
hasRequired_stringToPath = 1;
|
|
2004
|
+
var memoizeCapped = require_memoizeCapped();
|
|
2005
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
2006
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
2007
|
+
var stringToPath = memoizeCapped(function(string) {
|
|
2008
|
+
var result = [];
|
|
2009
|
+
if (string.charCodeAt(0) === 46) {
|
|
2010
|
+
result.push("");
|
|
2011
|
+
}
|
|
2012
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
2013
|
+
result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
|
|
2014
|
+
});
|
|
2015
|
+
return result;
|
|
2016
|
+
});
|
|
2017
|
+
_stringToPath = stringToPath;
|
|
2018
|
+
return _stringToPath;
|
|
2019
|
+
}
|
|
2020
|
+
var _castPath;
|
|
2021
|
+
var hasRequired_castPath;
|
|
2022
|
+
function require_castPath() {
|
|
2023
|
+
if (hasRequired_castPath) return _castPath;
|
|
2024
|
+
hasRequired_castPath = 1;
|
|
2025
|
+
var isArray = requireIsArray(), isKey = require_isKey(), stringToPath = require_stringToPath(), toString = requireToString();
|
|
2026
|
+
function castPath(value, object) {
|
|
2027
|
+
if (isArray(value)) {
|
|
2028
|
+
return value;
|
|
2029
|
+
}
|
|
2030
|
+
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
2031
|
+
}
|
|
2032
|
+
_castPath = castPath;
|
|
2033
|
+
return _castPath;
|
|
2034
|
+
}
|
|
2035
|
+
var _toKey;
|
|
2036
|
+
var hasRequired_toKey;
|
|
2037
|
+
function require_toKey() {
|
|
2038
|
+
if (hasRequired_toKey) return _toKey;
|
|
2039
|
+
hasRequired_toKey = 1;
|
|
2040
|
+
var isSymbol = requireIsSymbol();
|
|
2041
|
+
function toKey(value) {
|
|
2042
|
+
if (typeof value == "string" || isSymbol(value)) {
|
|
2043
|
+
return value;
|
|
2044
|
+
}
|
|
2045
|
+
var result = value + "";
|
|
2046
|
+
return result == "0" && 1 / value == -Infinity ? "-0" : result;
|
|
2047
|
+
}
|
|
2048
|
+
_toKey = toKey;
|
|
2049
|
+
return _toKey;
|
|
2050
|
+
}
|
|
2051
|
+
var _baseGet;
|
|
2052
|
+
var hasRequired_baseGet;
|
|
2053
|
+
function require_baseGet() {
|
|
2054
|
+
if (hasRequired_baseGet) return _baseGet;
|
|
2055
|
+
hasRequired_baseGet = 1;
|
|
2056
|
+
var castPath = require_castPath(), toKey = require_toKey();
|
|
2057
|
+
function baseGet(object, path) {
|
|
2058
|
+
path = castPath(path, object);
|
|
2059
|
+
var index = 0, length = path.length;
|
|
2060
|
+
while (object != null && index < length) {
|
|
2061
|
+
object = object[toKey(path[index++])];
|
|
2062
|
+
}
|
|
2063
|
+
return index && index == length ? object : void 0;
|
|
2064
|
+
}
|
|
2065
|
+
_baseGet = baseGet;
|
|
2066
|
+
return _baseGet;
|
|
2067
|
+
}
|
|
2068
|
+
var get_1;
|
|
2069
|
+
var hasRequiredGet;
|
|
2070
|
+
function requireGet() {
|
|
2071
|
+
if (hasRequiredGet) return get_1;
|
|
2072
|
+
hasRequiredGet = 1;
|
|
2073
|
+
var baseGet = require_baseGet();
|
|
2074
|
+
function get(object, path, defaultValue) {
|
|
2075
|
+
var result = object == null ? void 0 : baseGet(object, path);
|
|
2076
|
+
return result === void 0 ? defaultValue : result;
|
|
2077
|
+
}
|
|
2078
|
+
get_1 = get;
|
|
2079
|
+
return get_1;
|
|
2080
|
+
}
|
|
2081
|
+
var _baseHasIn;
|
|
2082
|
+
var hasRequired_baseHasIn;
|
|
2083
|
+
function require_baseHasIn() {
|
|
2084
|
+
if (hasRequired_baseHasIn) return _baseHasIn;
|
|
2085
|
+
hasRequired_baseHasIn = 1;
|
|
2086
|
+
function baseHasIn(object, key) {
|
|
2087
|
+
return object != null && key in Object(object);
|
|
2088
|
+
}
|
|
2089
|
+
_baseHasIn = baseHasIn;
|
|
2090
|
+
return _baseHasIn;
|
|
2091
|
+
}
|
|
2092
|
+
var _hasPath;
|
|
2093
|
+
var hasRequired_hasPath;
|
|
2094
|
+
function require_hasPath() {
|
|
2095
|
+
if (hasRequired_hasPath) return _hasPath;
|
|
2096
|
+
hasRequired_hasPath = 1;
|
|
2097
|
+
var castPath = require_castPath(), isArguments = requireIsArguments(), isArray = requireIsArray(), isIndex = require_isIndex(), isLength = requireIsLength(), toKey = require_toKey();
|
|
2098
|
+
function hasPath(object, path, hasFunc) {
|
|
2099
|
+
path = castPath(path, object);
|
|
2100
|
+
var index = -1, length = path.length, result = false;
|
|
2101
|
+
while (++index < length) {
|
|
2102
|
+
var key = toKey(path[index]);
|
|
2103
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
2104
|
+
break;
|
|
2105
|
+
}
|
|
2106
|
+
object = object[key];
|
|
2107
|
+
}
|
|
2108
|
+
if (result || ++index != length) {
|
|
2109
|
+
return result;
|
|
2110
|
+
}
|
|
2111
|
+
length = object == null ? 0 : object.length;
|
|
2112
|
+
return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
|
|
2113
|
+
}
|
|
2114
|
+
_hasPath = hasPath;
|
|
2115
|
+
return _hasPath;
|
|
2116
|
+
}
|
|
2117
|
+
var hasIn_1;
|
|
2118
|
+
var hasRequiredHasIn;
|
|
2119
|
+
function requireHasIn() {
|
|
2120
|
+
if (hasRequiredHasIn) return hasIn_1;
|
|
2121
|
+
hasRequiredHasIn = 1;
|
|
2122
|
+
var baseHasIn = require_baseHasIn(), hasPath = require_hasPath();
|
|
2123
|
+
function hasIn(object, path) {
|
|
2124
|
+
return object != null && hasPath(object, path, baseHasIn);
|
|
2125
|
+
}
|
|
2126
|
+
hasIn_1 = hasIn;
|
|
2127
|
+
return hasIn_1;
|
|
2128
|
+
}
|
|
2129
|
+
var _baseMatchesProperty;
|
|
2130
|
+
var hasRequired_baseMatchesProperty;
|
|
2131
|
+
function require_baseMatchesProperty() {
|
|
2132
|
+
if (hasRequired_baseMatchesProperty) return _baseMatchesProperty;
|
|
2133
|
+
hasRequired_baseMatchesProperty = 1;
|
|
2134
|
+
var baseIsEqual = require_baseIsEqual(), get = requireGet(), hasIn = requireHasIn(), isKey = require_isKey(), isStrictComparable = require_isStrictComparable(), matchesStrictComparable = require_matchesStrictComparable(), toKey = require_toKey();
|
|
2135
|
+
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
2136
|
+
function baseMatchesProperty(path, srcValue) {
|
|
2137
|
+
if (isKey(path) && isStrictComparable(srcValue)) {
|
|
2138
|
+
return matchesStrictComparable(toKey(path), srcValue);
|
|
2139
|
+
}
|
|
2140
|
+
return function(object) {
|
|
2141
|
+
var objValue = get(object, path);
|
|
2142
|
+
return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
_baseMatchesProperty = baseMatchesProperty;
|
|
2146
|
+
return _baseMatchesProperty;
|
|
2147
|
+
}
|
|
2148
|
+
var _baseProperty;
|
|
2149
|
+
var hasRequired_baseProperty;
|
|
2150
|
+
function require_baseProperty() {
|
|
2151
|
+
if (hasRequired_baseProperty) return _baseProperty;
|
|
2152
|
+
hasRequired_baseProperty = 1;
|
|
2153
|
+
function baseProperty(key) {
|
|
2154
|
+
return function(object) {
|
|
2155
|
+
return object == null ? void 0 : object[key];
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
_baseProperty = baseProperty;
|
|
2159
|
+
return _baseProperty;
|
|
2160
|
+
}
|
|
2161
|
+
var _basePropertyDeep;
|
|
2162
|
+
var hasRequired_basePropertyDeep;
|
|
2163
|
+
function require_basePropertyDeep() {
|
|
2164
|
+
if (hasRequired_basePropertyDeep) return _basePropertyDeep;
|
|
2165
|
+
hasRequired_basePropertyDeep = 1;
|
|
2166
|
+
var baseGet = require_baseGet();
|
|
2167
|
+
function basePropertyDeep(path) {
|
|
2168
|
+
return function(object) {
|
|
2169
|
+
return baseGet(object, path);
|
|
2170
|
+
};
|
|
2171
|
+
}
|
|
2172
|
+
_basePropertyDeep = basePropertyDeep;
|
|
2173
|
+
return _basePropertyDeep;
|
|
2174
|
+
}
|
|
2175
|
+
var property_1;
|
|
2176
|
+
var hasRequiredProperty;
|
|
2177
|
+
function requireProperty() {
|
|
2178
|
+
if (hasRequiredProperty) return property_1;
|
|
2179
|
+
hasRequiredProperty = 1;
|
|
2180
|
+
var baseProperty = require_baseProperty(), basePropertyDeep = require_basePropertyDeep(), isKey = require_isKey(), toKey = require_toKey();
|
|
2181
|
+
function property(path) {
|
|
2182
|
+
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
|
2183
|
+
}
|
|
2184
|
+
property_1 = property;
|
|
2185
|
+
return property_1;
|
|
2186
|
+
}
|
|
2187
|
+
var _baseIteratee;
|
|
2188
|
+
var hasRequired_baseIteratee;
|
|
2189
|
+
function require_baseIteratee() {
|
|
2190
|
+
if (hasRequired_baseIteratee) return _baseIteratee;
|
|
2191
|
+
hasRequired_baseIteratee = 1;
|
|
2192
|
+
var baseMatches = require_baseMatches(), baseMatchesProperty = require_baseMatchesProperty(), identity = requireIdentity(), isArray = requireIsArray(), property = requireProperty();
|
|
2193
|
+
function baseIteratee(value) {
|
|
2194
|
+
if (typeof value == "function") {
|
|
2195
|
+
return value;
|
|
2196
|
+
}
|
|
2197
|
+
if (value == null) {
|
|
2198
|
+
return identity;
|
|
2199
|
+
}
|
|
2200
|
+
if (typeof value == "object") {
|
|
2201
|
+
return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
|
|
2202
|
+
}
|
|
2203
|
+
return property(value);
|
|
2204
|
+
}
|
|
2205
|
+
_baseIteratee = baseIteratee;
|
|
2206
|
+
return _baseIteratee;
|
|
2207
|
+
}
|
|
2208
|
+
var filter_1;
|
|
2209
|
+
var hasRequiredFilter;
|
|
2210
|
+
function requireFilter() {
|
|
2211
|
+
if (hasRequiredFilter) return filter_1;
|
|
2212
|
+
hasRequiredFilter = 1;
|
|
2213
|
+
var arrayFilter = require_arrayFilter(), baseFilter = require_baseFilter(), baseIteratee = require_baseIteratee(), isArray = requireIsArray();
|
|
2214
|
+
function filter2(collection, predicate) {
|
|
2215
|
+
var func = isArray(collection) ? arrayFilter : baseFilter;
|
|
2216
|
+
return func(collection, baseIteratee(predicate, 3));
|
|
2217
|
+
}
|
|
2218
|
+
filter_1 = filter2;
|
|
2219
|
+
return filter_1;
|
|
2220
|
+
}
|
|
2221
|
+
var filterExports = requireFilter();
|
|
2222
|
+
const filter = /* @__PURE__ */ getDefaultExportFromCjs(filterExports);
|
|
2223
|
+
var _baseFindKey;
|
|
2224
|
+
var hasRequired_baseFindKey;
|
|
2225
|
+
function require_baseFindKey() {
|
|
2226
|
+
if (hasRequired_baseFindKey) return _baseFindKey;
|
|
2227
|
+
hasRequired_baseFindKey = 1;
|
|
2228
|
+
function baseFindKey(collection, predicate, eachFunc) {
|
|
2229
|
+
var result;
|
|
2230
|
+
eachFunc(collection, function(value, key, collection2) {
|
|
2231
|
+
if (predicate(value, key, collection2)) {
|
|
2232
|
+
result = key;
|
|
2233
|
+
return false;
|
|
2234
|
+
}
|
|
2235
|
+
});
|
|
2236
|
+
return result;
|
|
2237
|
+
}
|
|
2238
|
+
_baseFindKey = baseFindKey;
|
|
2239
|
+
return _baseFindKey;
|
|
2240
|
+
}
|
|
2241
|
+
var findKey_1;
|
|
2242
|
+
var hasRequiredFindKey;
|
|
2243
|
+
function requireFindKey() {
|
|
2244
|
+
if (hasRequiredFindKey) return findKey_1;
|
|
2245
|
+
hasRequiredFindKey = 1;
|
|
2246
|
+
var baseFindKey = require_baseFindKey(), baseForOwn = require_baseForOwn(), baseIteratee = require_baseIteratee();
|
|
2247
|
+
function findKey2(object, predicate) {
|
|
2248
|
+
return baseFindKey(object, baseIteratee(predicate, 3), baseForOwn);
|
|
2249
|
+
}
|
|
2250
|
+
findKey_1 = findKey2;
|
|
2251
|
+
return findKey_1;
|
|
2252
|
+
}
|
|
2253
|
+
var findKeyExports = requireFindKey();
|
|
2254
|
+
const findKey = /* @__PURE__ */ getDefaultExportFromCjs(findKeyExports);
|
|
2255
|
+
var head_1;
|
|
2256
|
+
var hasRequiredHead;
|
|
2257
|
+
function requireHead() {
|
|
2258
|
+
if (hasRequiredHead) return head_1;
|
|
2259
|
+
hasRequiredHead = 1;
|
|
2260
|
+
function head(array) {
|
|
2261
|
+
return array && array.length ? array[0] : void 0;
|
|
2262
|
+
}
|
|
2263
|
+
head_1 = head;
|
|
2264
|
+
return head_1;
|
|
2265
|
+
}
|
|
2266
|
+
var first$1;
|
|
2267
|
+
var hasRequiredFirst;
|
|
2268
|
+
function requireFirst() {
|
|
2269
|
+
if (hasRequiredFirst) return first$1;
|
|
2270
|
+
hasRequiredFirst = 1;
|
|
2271
|
+
first$1 = requireHead();
|
|
2272
|
+
return first$1;
|
|
2273
|
+
}
|
|
2274
|
+
var firstExports = requireFirst();
|
|
2275
|
+
const first = /* @__PURE__ */ getDefaultExportFromCjs(firstExports);
|
|
2276
|
+
var _arrayEach;
|
|
2277
|
+
var hasRequired_arrayEach;
|
|
2278
|
+
function require_arrayEach() {
|
|
2279
|
+
if (hasRequired_arrayEach) return _arrayEach;
|
|
2280
|
+
hasRequired_arrayEach = 1;
|
|
2281
|
+
function arrayEach(array, iteratee) {
|
|
2282
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
2283
|
+
while (++index < length) {
|
|
2284
|
+
if (iteratee(array[index], index, array) === false) {
|
|
2285
|
+
break;
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
return array;
|
|
2289
|
+
}
|
|
2290
|
+
_arrayEach = arrayEach;
|
|
2291
|
+
return _arrayEach;
|
|
2292
|
+
}
|
|
2293
|
+
var _castFunction;
|
|
2294
|
+
var hasRequired_castFunction;
|
|
2295
|
+
function require_castFunction() {
|
|
2296
|
+
if (hasRequired_castFunction) return _castFunction;
|
|
2297
|
+
hasRequired_castFunction = 1;
|
|
2298
|
+
var identity = requireIdentity();
|
|
2299
|
+
function castFunction(value) {
|
|
2300
|
+
return typeof value == "function" ? value : identity;
|
|
2301
|
+
}
|
|
2302
|
+
_castFunction = castFunction;
|
|
2303
|
+
return _castFunction;
|
|
2304
|
+
}
|
|
2305
|
+
var forEach_1;
|
|
2306
|
+
var hasRequiredForEach;
|
|
2307
|
+
function requireForEach() {
|
|
2308
|
+
if (hasRequiredForEach) return forEach_1;
|
|
2309
|
+
hasRequiredForEach = 1;
|
|
2310
|
+
var arrayEach = require_arrayEach(), baseEach = require_baseEach(), castFunction = require_castFunction(), isArray = requireIsArray();
|
|
2311
|
+
function forEach2(collection, iteratee) {
|
|
2312
|
+
var func = isArray(collection) ? arrayEach : baseEach;
|
|
2313
|
+
return func(collection, castFunction(iteratee));
|
|
2314
|
+
}
|
|
2315
|
+
forEach_1 = forEach2;
|
|
2316
|
+
return forEach_1;
|
|
2317
|
+
}
|
|
2318
|
+
var forEachExports = requireForEach();
|
|
2319
|
+
const forEach = /* @__PURE__ */ getDefaultExportFromCjs(forEachExports);
|
|
2320
|
+
var forOwn_1;
|
|
2321
|
+
var hasRequiredForOwn;
|
|
2322
|
+
function requireForOwn() {
|
|
2323
|
+
if (hasRequiredForOwn) return forOwn_1;
|
|
2324
|
+
hasRequiredForOwn = 1;
|
|
2325
|
+
var baseForOwn = require_baseForOwn(), castFunction = require_castFunction();
|
|
2326
|
+
function forOwn2(object, iteratee) {
|
|
2327
|
+
return object && baseForOwn(object, castFunction(iteratee));
|
|
2328
|
+
}
|
|
2329
|
+
forOwn_1 = forOwn2;
|
|
2330
|
+
return forOwn_1;
|
|
2331
|
+
}
|
|
2332
|
+
var forOwnExports = requireForOwn();
|
|
2333
|
+
const forOwn = /* @__PURE__ */ getDefaultExportFromCjs(forOwnExports);
|
|
2334
|
+
var _baseMap;
|
|
2335
|
+
var hasRequired_baseMap;
|
|
2336
|
+
function require_baseMap() {
|
|
2337
|
+
if (hasRequired_baseMap) return _baseMap;
|
|
2338
|
+
hasRequired_baseMap = 1;
|
|
2339
|
+
var baseEach = require_baseEach(), isArrayLike = requireIsArrayLike();
|
|
2340
|
+
function baseMap(collection, iteratee) {
|
|
2341
|
+
var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
|
|
2342
|
+
baseEach(collection, function(value, key, collection2) {
|
|
2343
|
+
result[++index] = iteratee(value, key, collection2);
|
|
2344
|
+
});
|
|
2345
|
+
return result;
|
|
2346
|
+
}
|
|
2347
|
+
_baseMap = baseMap;
|
|
2348
|
+
return _baseMap;
|
|
2349
|
+
}
|
|
2350
|
+
var _baseSortBy;
|
|
2351
|
+
var hasRequired_baseSortBy;
|
|
2352
|
+
function require_baseSortBy() {
|
|
2353
|
+
if (hasRequired_baseSortBy) return _baseSortBy;
|
|
2354
|
+
hasRequired_baseSortBy = 1;
|
|
2355
|
+
function baseSortBy(array, comparer) {
|
|
2356
|
+
var length = array.length;
|
|
2357
|
+
array.sort(comparer);
|
|
2358
|
+
while (length--) {
|
|
2359
|
+
array[length] = array[length].value;
|
|
2360
|
+
}
|
|
2361
|
+
return array;
|
|
2362
|
+
}
|
|
2363
|
+
_baseSortBy = baseSortBy;
|
|
2364
|
+
return _baseSortBy;
|
|
2365
|
+
}
|
|
2366
|
+
var _compareAscending;
|
|
2367
|
+
var hasRequired_compareAscending;
|
|
2368
|
+
function require_compareAscending() {
|
|
2369
|
+
if (hasRequired_compareAscending) return _compareAscending;
|
|
2370
|
+
hasRequired_compareAscending = 1;
|
|
2371
|
+
var isSymbol = requireIsSymbol();
|
|
2372
|
+
function compareAscending(value, other) {
|
|
2373
|
+
if (value !== other) {
|
|
2374
|
+
var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
|
|
2375
|
+
var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
|
|
2376
|
+
if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
|
|
2377
|
+
return 1;
|
|
2378
|
+
}
|
|
2379
|
+
if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
|
|
2380
|
+
return -1;
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
return 0;
|
|
2384
|
+
}
|
|
2385
|
+
_compareAscending = compareAscending;
|
|
2386
|
+
return _compareAscending;
|
|
2387
|
+
}
|
|
2388
|
+
var _compareMultiple;
|
|
2389
|
+
var hasRequired_compareMultiple;
|
|
2390
|
+
function require_compareMultiple() {
|
|
2391
|
+
if (hasRequired_compareMultiple) return _compareMultiple;
|
|
2392
|
+
hasRequired_compareMultiple = 1;
|
|
2393
|
+
var compareAscending = require_compareAscending();
|
|
2394
|
+
function compareMultiple(object, other, orders) {
|
|
2395
|
+
var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
|
|
2396
|
+
while (++index < length) {
|
|
2397
|
+
var result = compareAscending(objCriteria[index], othCriteria[index]);
|
|
2398
|
+
if (result) {
|
|
2399
|
+
if (index >= ordersLength) {
|
|
2400
|
+
return result;
|
|
2401
|
+
}
|
|
2402
|
+
var order = orders[index];
|
|
2403
|
+
return result * (order == "desc" ? -1 : 1);
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
return object.index - other.index;
|
|
2407
|
+
}
|
|
2408
|
+
_compareMultiple = compareMultiple;
|
|
2409
|
+
return _compareMultiple;
|
|
2410
|
+
}
|
|
2411
|
+
var _baseOrderBy;
|
|
2412
|
+
var hasRequired_baseOrderBy;
|
|
2413
|
+
function require_baseOrderBy() {
|
|
2414
|
+
if (hasRequired_baseOrderBy) return _baseOrderBy;
|
|
2415
|
+
hasRequired_baseOrderBy = 1;
|
|
2416
|
+
var arrayMap = require_arrayMap(), baseGet = require_baseGet(), baseIteratee = require_baseIteratee(), baseMap = require_baseMap(), baseSortBy = require_baseSortBy(), baseUnary = require_baseUnary(), compareMultiple = require_compareMultiple(), identity = requireIdentity(), isArray = requireIsArray();
|
|
2417
|
+
function baseOrderBy(collection, iteratees, orders) {
|
|
2418
|
+
if (iteratees.length) {
|
|
2419
|
+
iteratees = arrayMap(iteratees, function(iteratee) {
|
|
2420
|
+
if (isArray(iteratee)) {
|
|
2421
|
+
return function(value) {
|
|
2422
|
+
return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
2423
|
+
};
|
|
2424
|
+
}
|
|
2425
|
+
return iteratee;
|
|
2426
|
+
});
|
|
2427
|
+
} else {
|
|
2428
|
+
iteratees = [identity];
|
|
2429
|
+
}
|
|
2430
|
+
var index = -1;
|
|
2431
|
+
iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
|
|
2432
|
+
var result = baseMap(collection, function(value, key, collection2) {
|
|
2433
|
+
var criteria = arrayMap(iteratees, function(iteratee) {
|
|
2434
|
+
return iteratee(value);
|
|
2435
|
+
});
|
|
2436
|
+
return { "criteria": criteria, "index": ++index, "value": value };
|
|
2437
|
+
});
|
|
2438
|
+
return baseSortBy(result, function(object, other) {
|
|
2439
|
+
return compareMultiple(object, other, orders);
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2442
|
+
_baseOrderBy = baseOrderBy;
|
|
2443
|
+
return _baseOrderBy;
|
|
2444
|
+
}
|
|
2445
|
+
var _isIterateeCall;
|
|
2446
|
+
var hasRequired_isIterateeCall;
|
|
2447
|
+
function require_isIterateeCall() {
|
|
2448
|
+
if (hasRequired_isIterateeCall) return _isIterateeCall;
|
|
2449
|
+
hasRequired_isIterateeCall = 1;
|
|
2450
|
+
var eq = requireEq(), isArrayLike = requireIsArrayLike(), isIndex = require_isIndex(), isObject = requireIsObject();
|
|
2451
|
+
function isIterateeCall(value, index, object) {
|
|
2452
|
+
if (!isObject(object)) {
|
|
2453
|
+
return false;
|
|
2454
|
+
}
|
|
2455
|
+
var type = typeof index;
|
|
2456
|
+
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
|
|
2457
|
+
return eq(object[index], value);
|
|
2458
|
+
}
|
|
2459
|
+
return false;
|
|
2460
|
+
}
|
|
2461
|
+
_isIterateeCall = isIterateeCall;
|
|
2462
|
+
return _isIterateeCall;
|
|
2463
|
+
}
|
|
2464
|
+
var sortBy_1;
|
|
2465
|
+
var hasRequiredSortBy;
|
|
2466
|
+
function requireSortBy() {
|
|
2467
|
+
if (hasRequiredSortBy) return sortBy_1;
|
|
2468
|
+
hasRequiredSortBy = 1;
|
|
2469
|
+
var baseFlatten = require_baseFlatten(), baseOrderBy = require_baseOrderBy(), baseRest = require_baseRest(), isIterateeCall = require_isIterateeCall();
|
|
2470
|
+
var sortBy2 = baseRest(function(collection, iteratees) {
|
|
2471
|
+
if (collection == null) {
|
|
2472
|
+
return [];
|
|
2473
|
+
}
|
|
2474
|
+
var length = iteratees.length;
|
|
2475
|
+
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
2476
|
+
iteratees = [];
|
|
2477
|
+
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
2478
|
+
iteratees = [iteratees[0]];
|
|
2479
|
+
}
|
|
2480
|
+
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
|
|
2481
|
+
});
|
|
2482
|
+
sortBy_1 = sortBy2;
|
|
2483
|
+
return sortBy_1;
|
|
2484
|
+
}
|
|
2485
|
+
var sortByExports = requireSortBy();
|
|
2486
|
+
const sortBy = /* @__PURE__ */ getDefaultExportFromCjs(sortByExports);
|
|
2487
|
+
var WritingDirection = /* @__PURE__ */ ((WritingDirection2) => {
|
|
2488
|
+
WritingDirection2[WritingDirection2["LTR"] = 0] = "LTR";
|
|
2489
|
+
WritingDirection2[WritingDirection2["RTL"] = 1] = "RTL";
|
|
2490
|
+
return WritingDirection2;
|
|
2491
|
+
})(WritingDirection || {});
|
|
2492
|
+
const hasDOM = typeof window !== "undefined" && window.document;
|
|
2493
|
+
const MIN_PIXEL_RATIO = 2;
|
|
2494
|
+
class VisualDebugger {
|
|
2495
|
+
debugCtx;
|
|
2496
|
+
layoutsCtx;
|
|
2497
|
+
writingDirection;
|
|
2498
|
+
useViewportCoordinates;
|
|
2499
|
+
constructor(writingDirection, useViewportCoordinates = false) {
|
|
2500
|
+
this.debugCtx = null;
|
|
2501
|
+
this.layoutsCtx = null;
|
|
2502
|
+
this.writingDirection = writingDirection;
|
|
2503
|
+
this.useViewportCoordinates = useViewportCoordinates;
|
|
2504
|
+
if (!hasDOM) {
|
|
2505
|
+
return;
|
|
2506
|
+
}
|
|
2507
|
+
this.debugCtx = VisualDebugger.createCanvas("sn-debug", "1010", writingDirection);
|
|
2508
|
+
this.layoutsCtx = VisualDebugger.createCanvas("sn-layouts", "1000", writingDirection);
|
|
2509
|
+
}
|
|
2510
|
+
static getViewportSize() {
|
|
2511
|
+
return {
|
|
2512
|
+
width: window.innerWidth,
|
|
2513
|
+
height: window.innerHeight
|
|
2514
|
+
};
|
|
2515
|
+
}
|
|
2516
|
+
static getPixelRatio() {
|
|
2517
|
+
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
2518
|
+
return Math.max(devicePixelRatio, MIN_PIXEL_RATIO);
|
|
2519
|
+
}
|
|
2520
|
+
static configureCanvas(canvas, ctx) {
|
|
2521
|
+
const {
|
|
2522
|
+
width,
|
|
2523
|
+
height
|
|
2524
|
+
} = VisualDebugger.getViewportSize();
|
|
2525
|
+
const pixelRatio = VisualDebugger.getPixelRatio();
|
|
2526
|
+
canvas.style.width = `${width}px`;
|
|
2527
|
+
canvas.style.height = `${height}px`;
|
|
2528
|
+
const scaledWidth = Math.round(width * pixelRatio);
|
|
2529
|
+
const scaledHeight = Math.round(height * pixelRatio);
|
|
2530
|
+
if (canvas.width !== scaledWidth) {
|
|
2531
|
+
canvas.width = scaledWidth;
|
|
2532
|
+
}
|
|
2533
|
+
if (canvas.height !== scaledHeight) {
|
|
2534
|
+
canvas.height = scaledHeight;
|
|
2535
|
+
}
|
|
2536
|
+
ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
|
2537
|
+
}
|
|
2538
|
+
syncCanvasSizes() {
|
|
2539
|
+
if (!hasDOM || !this.debugCtx || !this.layoutsCtx) {
|
|
2540
|
+
return;
|
|
2541
|
+
}
|
|
2542
|
+
VisualDebugger.configureCanvas(this.debugCtx.canvas, this.debugCtx);
|
|
2543
|
+
VisualDebugger.configureCanvas(this.layoutsCtx.canvas, this.layoutsCtx);
|
|
2544
|
+
}
|
|
2545
|
+
getViewportOffset() {
|
|
2546
|
+
if (this.useViewportCoordinates) {
|
|
2547
|
+
return {
|
|
2548
|
+
x: 0,
|
|
2549
|
+
y: 0
|
|
2550
|
+
};
|
|
2551
|
+
}
|
|
2552
|
+
return {
|
|
2553
|
+
x: window.scrollX,
|
|
2554
|
+
y: window.scrollY
|
|
2555
|
+
};
|
|
2556
|
+
}
|
|
2557
|
+
static createCanvas(id, zIndex, writingDirection) {
|
|
2558
|
+
const existingCanvas = document.querySelector(`#${id}`);
|
|
2559
|
+
const canvas = existingCanvas || document.createElement("canvas");
|
|
2560
|
+
canvas.setAttribute("id", id);
|
|
2561
|
+
canvas.setAttribute("dir", writingDirection === WritingDirection.LTR ? "ltr" : "rtl");
|
|
2562
|
+
const ctx = canvas.getContext("2d");
|
|
2563
|
+
if (!ctx) {
|
|
2564
|
+
return null;
|
|
2565
|
+
}
|
|
2566
|
+
canvas.style.zIndex = zIndex;
|
|
2567
|
+
canvas.style.position = "fixed";
|
|
2568
|
+
canvas.style.top = "0";
|
|
2569
|
+
canvas.style.left = "0";
|
|
2570
|
+
canvas.style.pointerEvents = "none";
|
|
2571
|
+
if (!canvas.isConnected) {
|
|
2572
|
+
document.body.appendChild(canvas);
|
|
2573
|
+
}
|
|
2574
|
+
VisualDebugger.configureCanvas(canvas, ctx);
|
|
2575
|
+
return ctx;
|
|
2576
|
+
}
|
|
2577
|
+
clear() {
|
|
2578
|
+
if (!hasDOM || !this.debugCtx) {
|
|
2579
|
+
return;
|
|
2580
|
+
}
|
|
2581
|
+
this.syncCanvasSizes();
|
|
2582
|
+
const {
|
|
2583
|
+
width,
|
|
2584
|
+
height
|
|
2585
|
+
} = VisualDebugger.getViewportSize();
|
|
2586
|
+
this.debugCtx.clearRect(0, 0, width, height);
|
|
2587
|
+
}
|
|
2588
|
+
clearLayouts() {
|
|
2589
|
+
if (!hasDOM || !this.layoutsCtx) {
|
|
2590
|
+
return;
|
|
2591
|
+
}
|
|
2592
|
+
this.syncCanvasSizes();
|
|
2593
|
+
const {
|
|
2594
|
+
width,
|
|
2595
|
+
height
|
|
2596
|
+
} = VisualDebugger.getViewportSize();
|
|
2597
|
+
this.layoutsCtx.clearRect(0, 0, width, height);
|
|
2598
|
+
}
|
|
2599
|
+
drawLayout(layout, focusKey, parentFocusKey) {
|
|
2600
|
+
if (!hasDOM || !this.layoutsCtx) {
|
|
2601
|
+
return;
|
|
2602
|
+
}
|
|
2603
|
+
this.syncCanvasSizes();
|
|
2604
|
+
const offset = this.getViewportOffset();
|
|
2605
|
+
const left = layout.left - offset.x;
|
|
2606
|
+
const top = layout.top - offset.y;
|
|
2607
|
+
this.layoutsCtx.strokeStyle = "green";
|
|
2608
|
+
this.layoutsCtx.strokeRect(left, top, layout.width, layout.height);
|
|
2609
|
+
this.layoutsCtx.font = "11px monospace";
|
|
2610
|
+
this.layoutsCtx.fillStyle = "red";
|
|
2611
|
+
const horizontalStartDirection = this.writingDirection === WritingDirection.LTR ? "left" : "right";
|
|
2612
|
+
const horizontalStartCoordinate = layout[horizontalStartDirection] - offset.x;
|
|
2613
|
+
this.layoutsCtx.fillText(focusKey, horizontalStartCoordinate, top + 12);
|
|
2614
|
+
this.layoutsCtx.fillText(parentFocusKey ?? "", horizontalStartCoordinate, top + 28);
|
|
2615
|
+
this.layoutsCtx.fillText(`${horizontalStartDirection}: ${horizontalStartCoordinate}`, horizontalStartCoordinate, top + 44);
|
|
2616
|
+
this.layoutsCtx.fillText(`top: ${top}`, horizontalStartCoordinate, top + 60);
|
|
2617
|
+
}
|
|
2618
|
+
drawPoint(x, y, color = "blue", size = 10) {
|
|
2619
|
+
if (!hasDOM || !this.debugCtx) {
|
|
2620
|
+
return;
|
|
2621
|
+
}
|
|
2622
|
+
this.syncCanvasSizes();
|
|
2623
|
+
const offset = this.getViewportOffset();
|
|
2624
|
+
const pointX = x - offset.x;
|
|
2625
|
+
const pointY = y - offset.y;
|
|
2626
|
+
this.debugCtx.strokeStyle = color;
|
|
2627
|
+
this.debugCtx.lineWidth = 3;
|
|
2628
|
+
this.debugCtx.strokeRect(pointX - size / 2, pointY - size / 2, size, size);
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
const ELEMENT_NODE = 1;
|
|
2632
|
+
const getRect = (node) => {
|
|
2633
|
+
let offsetParent = node.offsetParent;
|
|
2634
|
+
const height = node.offsetHeight;
|
|
2635
|
+
const width = node.offsetWidth;
|
|
2636
|
+
let left = node.offsetLeft;
|
|
2637
|
+
let top = node.offsetTop;
|
|
2638
|
+
while (offsetParent && offsetParent.nodeType === ELEMENT_NODE) {
|
|
2639
|
+
left += offsetParent.offsetLeft - offsetParent.scrollLeft;
|
|
2640
|
+
top += offsetParent.offsetTop - offsetParent.scrollTop;
|
|
2641
|
+
offsetParent = offsetParent.offsetParent;
|
|
2642
|
+
}
|
|
2643
|
+
return {
|
|
2644
|
+
height,
|
|
2645
|
+
left,
|
|
2646
|
+
top,
|
|
2647
|
+
width
|
|
2648
|
+
};
|
|
2649
|
+
};
|
|
2650
|
+
const measureLayout = (node) => {
|
|
2651
|
+
const relativeNode = node && node.parentElement;
|
|
2652
|
+
if (node && relativeNode) {
|
|
2653
|
+
const relativeRect = getRect(relativeNode);
|
|
2654
|
+
const {
|
|
2655
|
+
height,
|
|
2656
|
+
left,
|
|
2657
|
+
top,
|
|
2658
|
+
width
|
|
2659
|
+
} = getRect(node);
|
|
2660
|
+
const x = left - relativeRect.left;
|
|
2661
|
+
const y = top - relativeRect.top;
|
|
2662
|
+
return {
|
|
2663
|
+
x,
|
|
2664
|
+
y,
|
|
2665
|
+
width,
|
|
2666
|
+
height,
|
|
2667
|
+
left,
|
|
2668
|
+
top,
|
|
2669
|
+
get right() {
|
|
2670
|
+
return this.left + this.width;
|
|
2671
|
+
},
|
|
2672
|
+
get bottom() {
|
|
2673
|
+
return this.top + this.height;
|
|
2674
|
+
}
|
|
2675
|
+
};
|
|
2676
|
+
}
|
|
2677
|
+
return {
|
|
2678
|
+
x: 0,
|
|
2679
|
+
y: 0,
|
|
2680
|
+
width: 0,
|
|
2681
|
+
height: 0,
|
|
2682
|
+
left: 0,
|
|
2683
|
+
top: 0,
|
|
2684
|
+
right: 0,
|
|
2685
|
+
bottom: 0
|
|
2686
|
+
};
|
|
2687
|
+
};
|
|
2688
|
+
const getBoundingClientRect = (node) => {
|
|
2689
|
+
if (node && node.getBoundingClientRect) {
|
|
2690
|
+
const rect = node.getBoundingClientRect();
|
|
2691
|
+
return {
|
|
2692
|
+
x: rect.x,
|
|
2693
|
+
y: rect.y,
|
|
2694
|
+
width: rect.width,
|
|
2695
|
+
height: rect.height,
|
|
2696
|
+
left: rect.left,
|
|
2697
|
+
top: rect.top,
|
|
2698
|
+
get right() {
|
|
2699
|
+
return this.left + this.width;
|
|
2700
|
+
},
|
|
2701
|
+
get bottom() {
|
|
2702
|
+
return this.top + this.height;
|
|
2703
|
+
}
|
|
2704
|
+
};
|
|
2705
|
+
}
|
|
2706
|
+
return {
|
|
2707
|
+
x: 0,
|
|
2708
|
+
y: 0,
|
|
2709
|
+
width: 0,
|
|
2710
|
+
height: 0,
|
|
2711
|
+
left: 0,
|
|
2712
|
+
top: 0,
|
|
2713
|
+
right: 0,
|
|
2714
|
+
bottom: 0
|
|
2715
|
+
};
|
|
2716
|
+
};
|
|
2717
|
+
const DIRECTION_LEFT = "left";
|
|
2718
|
+
const DIRECTION_RIGHT = "right";
|
|
2719
|
+
const DIRECTION_UP = "up";
|
|
2720
|
+
const DIRECTION_DOWN = "down";
|
|
2721
|
+
const KEY_ENTER = "enter";
|
|
2722
|
+
const DEFAULT_KEY_MAP = {
|
|
2723
|
+
[DIRECTION_LEFT]: [37, "ArrowLeft"],
|
|
2724
|
+
[DIRECTION_UP]: [38, "ArrowUp"],
|
|
2725
|
+
[DIRECTION_RIGHT]: [39, "ArrowRight"],
|
|
2726
|
+
[DIRECTION_DOWN]: [40, "ArrowDown"],
|
|
2727
|
+
[KEY_ENTER]: [13, "Enter"]
|
|
2728
|
+
};
|
|
2729
|
+
const ROOT_FOCUS_KEY = "SN:ROOT";
|
|
2730
|
+
const FOCUSABLE_SELECTOR = ["a[href]", "button", "input", "select", "textarea", "summary", "iframe", "[contenteditable]", "[tabindex]"].join(",");
|
|
2731
|
+
const FORM_FIELD_SELECTOR = ["input", "select", "textarea", "[contenteditable]"].join(",");
|
|
2732
|
+
const CHECKBOX_LIKE_SELECTOR = 'input[type="checkbox"], input[type="radio"]';
|
|
2733
|
+
const ADJACENT_SLICE_THRESHOLD = 0.2;
|
|
2734
|
+
const ADJACENT_SLICE_WEIGHT = 5;
|
|
2735
|
+
const DIAGONAL_SLICE_WEIGHT = 1;
|
|
2736
|
+
const MAIN_COORDINATE_WEIGHT = 5;
|
|
2737
|
+
const CUT_OFF_COORDINATE_TOLERANCE_PX = 1;
|
|
2738
|
+
const PRIMARY_AXIS_PROXIMITY_TOLERANCE_PX = 24;
|
|
2739
|
+
const AUTO_RESTORE_FOCUS_DELAY = 300;
|
|
2740
|
+
const DEBUG_FN_COLORS = ["#0FF", "#FF0", "#F0F"];
|
|
2741
|
+
const THROTTLE_OPTIONS = {
|
|
2742
|
+
leading: true,
|
|
2743
|
+
trailing: false
|
|
2744
|
+
};
|
|
2745
|
+
const getChildClosestToOrigin = (children, writingDirection) => {
|
|
2746
|
+
const comparator = writingDirection === WritingDirection.LTR ? ({
|
|
2747
|
+
layout
|
|
2748
|
+
}) => Math.abs(layout.left) + Math.abs(layout.top) : ({
|
|
2749
|
+
layout
|
|
2750
|
+
}) => Math.abs(window.innerWidth - layout.right) + Math.abs(layout.top);
|
|
2751
|
+
const childrenClosestToOrigin = sortBy(children, comparator);
|
|
2752
|
+
return first(childrenClosestToOrigin);
|
|
2753
|
+
};
|
|
2754
|
+
const normalizeKeyMap = (keyMap) => {
|
|
2755
|
+
const newKeyMap = {};
|
|
2756
|
+
Object.entries(keyMap).forEach(([key, value]) => {
|
|
2757
|
+
newKeyMap[key] = Array.isArray(value) ? value : [value];
|
|
2758
|
+
});
|
|
2759
|
+
return newKeyMap;
|
|
2760
|
+
};
|
|
2761
|
+
const isFocusableByDefault = (node) => {
|
|
2762
|
+
if (!node?.matches) {
|
|
2763
|
+
return false;
|
|
2764
|
+
}
|
|
2765
|
+
return node.matches(FOCUSABLE_SELECTOR);
|
|
2766
|
+
};
|
|
2767
|
+
const isFormFieldElement = (target) => {
|
|
2768
|
+
const element = target;
|
|
2769
|
+
if (!element?.matches) {
|
|
2770
|
+
return false;
|
|
2771
|
+
}
|
|
2772
|
+
return element.matches(FORM_FIELD_SELECTOR);
|
|
2773
|
+
};
|
|
2774
|
+
class SpatialNavigationService {
|
|
2775
|
+
focusableComponents;
|
|
2776
|
+
visualDebugger;
|
|
2777
|
+
visualDebugAnimationFrame;
|
|
2778
|
+
visualDebugEnabled;
|
|
2779
|
+
/**
|
|
2780
|
+
* Focus key of the currently focused element
|
|
2781
|
+
*/
|
|
2782
|
+
focusKey;
|
|
2783
|
+
shouldFocusDOMNode;
|
|
2784
|
+
shouldUseNativeEvents;
|
|
2785
|
+
trackNativeFocus;
|
|
2786
|
+
blockNavigationOutOfFormFields;
|
|
2787
|
+
/**
|
|
2788
|
+
* This collection contains focus keys of the elements that are having a child focused
|
|
2789
|
+
* Might be handy for styling of certain parent components if their child is focused.
|
|
2790
|
+
*/
|
|
2791
|
+
parentsHavingFocusedChild;
|
|
2792
|
+
/**
|
|
2793
|
+
* When shouldFocusDOMNode is true, this prop specifies the focus options that should be passed to the element being focused.
|
|
2794
|
+
*/
|
|
2795
|
+
domNodeFocusOptions;
|
|
2796
|
+
enabled;
|
|
2797
|
+
/**
|
|
2798
|
+
* Used in the React Native environment
|
|
2799
|
+
* In this mode, the library works as a "read-only" helper to sync focused
|
|
2800
|
+
* states for the components when they are focused by the native focus engine
|
|
2801
|
+
*/
|
|
2802
|
+
nativeMode;
|
|
2803
|
+
/**
|
|
2804
|
+
* Throttling delay for key presses in milliseconds
|
|
2805
|
+
*/
|
|
2806
|
+
throttle;
|
|
2807
|
+
/**
|
|
2808
|
+
* Enables/disables throttling feature
|
|
2809
|
+
*/
|
|
2810
|
+
throttleKeypresses;
|
|
2811
|
+
/**
|
|
2812
|
+
* Storing pressed keys counter by the eventType
|
|
2813
|
+
*/
|
|
2814
|
+
pressedKeys;
|
|
2815
|
+
/**
|
|
2816
|
+
* Flag used to block key events from this service
|
|
2817
|
+
*/
|
|
2818
|
+
paused;
|
|
2819
|
+
/**
|
|
2820
|
+
* Enables/disables getBoundingClientRect
|
|
2821
|
+
*/
|
|
2822
|
+
useGetBoundingClientRect;
|
|
2823
|
+
keyDownEventListener;
|
|
2824
|
+
keyDownEventListenerThrottled;
|
|
2825
|
+
keyUpEventListener;
|
|
2826
|
+
focusInEventListener;
|
|
2827
|
+
keyMap;
|
|
2828
|
+
debug;
|
|
2829
|
+
logIndex;
|
|
2830
|
+
setFocusDebounced;
|
|
2831
|
+
writingDirection;
|
|
2832
|
+
distanceCalculationMethod;
|
|
2833
|
+
customDistanceCalculationFunction;
|
|
2834
|
+
/**
|
|
2835
|
+
* Used to determine the coordinate that will be used to filter items that are over the "edge"
|
|
2836
|
+
*/
|
|
2837
|
+
static getCutoffCoordinate(isVertical, isIncremental, isSibling, layout, writingDirection) {
|
|
2838
|
+
const itemStart = isVertical ? layout.top : writingDirection === WritingDirection.LTR ? layout.left : layout.right;
|
|
2839
|
+
const itemEnd = isVertical ? layout.bottom : writingDirection === WritingDirection.LTR ? layout.right : layout.left;
|
|
2840
|
+
return isIncremental ? isSibling ? itemStart : itemEnd : isSibling ? itemEnd : itemStart;
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* Returns two corners (a and b) coordinates that are used as a reference points
|
|
2844
|
+
* Where "a" is always leftmost and topmost corner, and "b" is rightmost bottommost corner
|
|
2845
|
+
*/
|
|
2846
|
+
static getRefCorners(direction, isSibling, layout) {
|
|
2847
|
+
const result = {
|
|
2848
|
+
a: {
|
|
2849
|
+
x: 0,
|
|
2850
|
+
y: 0
|
|
2851
|
+
},
|
|
2852
|
+
b: {
|
|
2853
|
+
x: 0,
|
|
2854
|
+
y: 0
|
|
2855
|
+
}
|
|
2856
|
+
};
|
|
2857
|
+
switch (direction) {
|
|
2858
|
+
case DIRECTION_UP: {
|
|
2859
|
+
const y = isSibling ? layout.bottom : layout.top;
|
|
2860
|
+
result.a = {
|
|
2861
|
+
x: layout.left,
|
|
2862
|
+
y
|
|
2863
|
+
};
|
|
2864
|
+
result.b = {
|
|
2865
|
+
x: layout.right,
|
|
2866
|
+
y
|
|
2867
|
+
};
|
|
2868
|
+
break;
|
|
2869
|
+
}
|
|
2870
|
+
case DIRECTION_DOWN: {
|
|
2871
|
+
const y = isSibling ? layout.top : layout.bottom;
|
|
2872
|
+
result.a = {
|
|
2873
|
+
x: layout.left,
|
|
2874
|
+
y
|
|
2875
|
+
};
|
|
2876
|
+
result.b = {
|
|
2877
|
+
x: layout.right,
|
|
2878
|
+
y
|
|
2879
|
+
};
|
|
2880
|
+
break;
|
|
2881
|
+
}
|
|
2882
|
+
case DIRECTION_LEFT: {
|
|
2883
|
+
const x = isSibling ? layout.right : layout.left;
|
|
2884
|
+
result.a = {
|
|
2885
|
+
x,
|
|
2886
|
+
y: layout.top
|
|
2887
|
+
};
|
|
2888
|
+
result.b = {
|
|
2889
|
+
x,
|
|
2890
|
+
y: layout.bottom
|
|
2891
|
+
};
|
|
2892
|
+
break;
|
|
2893
|
+
}
|
|
2894
|
+
case DIRECTION_RIGHT: {
|
|
2895
|
+
const x = isSibling ? layout.left : layout.right;
|
|
2896
|
+
result.a = {
|
|
2897
|
+
x,
|
|
2898
|
+
y: layout.top
|
|
2899
|
+
};
|
|
2900
|
+
result.b = {
|
|
2901
|
+
x,
|
|
2902
|
+
y: layout.bottom
|
|
2903
|
+
};
|
|
2904
|
+
break;
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
return result;
|
|
2908
|
+
}
|
|
2909
|
+
/**
|
|
2910
|
+
* Calculates if the sibling node is intersecting enough with the ref node by the secondary coordinate
|
|
2911
|
+
*/
|
|
2912
|
+
static getAdjacentSliceMetrics(refCorners, siblingCorners, isVerticalDirection) {
|
|
2913
|
+
const {
|
|
2914
|
+
a: refA,
|
|
2915
|
+
b: refB
|
|
2916
|
+
} = refCorners;
|
|
2917
|
+
const {
|
|
2918
|
+
a: siblingA,
|
|
2919
|
+
b: siblingB
|
|
2920
|
+
} = siblingCorners;
|
|
2921
|
+
const coordinate = isVerticalDirection ? "x" : "y";
|
|
2922
|
+
const refCoordinateA = refA[coordinate];
|
|
2923
|
+
const refCoordinateB = refB[coordinate];
|
|
2924
|
+
const siblingCoordinateA = siblingA[coordinate];
|
|
2925
|
+
const siblingCoordinateB = siblingB[coordinate];
|
|
2926
|
+
const refLength = Math.abs(refCoordinateB - refCoordinateA);
|
|
2927
|
+
const siblingLength = Math.abs(siblingCoordinateB - siblingCoordinateA);
|
|
2928
|
+
const intersectionLength = Math.max(0, Math.min(refCoordinateB, siblingCoordinateB) - Math.max(refCoordinateA, siblingCoordinateA));
|
|
2929
|
+
return {
|
|
2930
|
+
refLength,
|
|
2931
|
+
siblingLength,
|
|
2932
|
+
intersectionLength
|
|
2933
|
+
};
|
|
2934
|
+
}
|
|
2935
|
+
static isAdjacentSlice(refCorners, siblingCorners, isVerticalDirection) {
|
|
2936
|
+
const {
|
|
2937
|
+
refLength,
|
|
2938
|
+
siblingLength,
|
|
2939
|
+
intersectionLength
|
|
2940
|
+
} = SpatialNavigationService.getAdjacentSliceMetrics(refCorners, siblingCorners, isVerticalDirection);
|
|
2941
|
+
const thresholdDistance = Math.min(refLength, siblingLength) * ADJACENT_SLICE_THRESHOLD;
|
|
2942
|
+
return intersectionLength >= thresholdDistance;
|
|
2943
|
+
}
|
|
2944
|
+
static getAdjacentSliceWeight(refCorners, siblingCorners, isVerticalDirection) {
|
|
2945
|
+
const {
|
|
2946
|
+
siblingLength,
|
|
2947
|
+
intersectionLength
|
|
2948
|
+
} = SpatialNavigationService.getAdjacentSliceMetrics(refCorners, siblingCorners, isVerticalDirection);
|
|
2949
|
+
if (!siblingLength) {
|
|
2950
|
+
return DIAGONAL_SLICE_WEIGHT;
|
|
2951
|
+
}
|
|
2952
|
+
const overlapRatioOnSibling = Math.min(1, Math.max(0, intersectionLength / siblingLength));
|
|
2953
|
+
return DIAGONAL_SLICE_WEIGHT + (ADJACENT_SLICE_WEIGHT - DIAGONAL_SLICE_WEIGHT) * overlapRatioOnSibling;
|
|
2954
|
+
}
|
|
2955
|
+
static getPrimaryAxisDistance(refCorners, siblingCorners, isVerticalDirection) {
|
|
2956
|
+
const {
|
|
2957
|
+
a: refA
|
|
2958
|
+
} = refCorners;
|
|
2959
|
+
const {
|
|
2960
|
+
a: siblingA
|
|
2961
|
+
} = siblingCorners;
|
|
2962
|
+
const coordinate = isVerticalDirection ? "y" : "x";
|
|
2963
|
+
return Math.abs(siblingA[coordinate] - refA[coordinate]);
|
|
2964
|
+
}
|
|
2965
|
+
static getSecondaryAxisDistance(refCorners, siblingCorners, isVerticalDirection, distanceCalculationMethod, customDistanceCalculationFunction) {
|
|
2966
|
+
if (customDistanceCalculationFunction) {
|
|
2967
|
+
return customDistanceCalculationFunction(refCorners, siblingCorners, isVerticalDirection, distanceCalculationMethod);
|
|
2968
|
+
}
|
|
2969
|
+
const {
|
|
2970
|
+
a: refA,
|
|
2971
|
+
b: refB
|
|
2972
|
+
} = refCorners;
|
|
2973
|
+
const {
|
|
2974
|
+
a: siblingA,
|
|
2975
|
+
b: siblingB
|
|
2976
|
+
} = siblingCorners;
|
|
2977
|
+
const coordinate = isVerticalDirection ? "x" : "y";
|
|
2978
|
+
const refCoordinateA = refA[coordinate];
|
|
2979
|
+
const refCoordinateB = refB[coordinate];
|
|
2980
|
+
const siblingCoordinateA = siblingA[coordinate];
|
|
2981
|
+
const siblingCoordinateB = siblingB[coordinate];
|
|
2982
|
+
if (distanceCalculationMethod === "center") {
|
|
2983
|
+
const refCoordinateCenter = (refCoordinateA + refCoordinateB) / 2;
|
|
2984
|
+
const siblingCoordinateCenter = (siblingCoordinateA + siblingCoordinateB) / 2;
|
|
2985
|
+
return Math.abs(refCoordinateCenter - siblingCoordinateCenter);
|
|
2986
|
+
}
|
|
2987
|
+
if (distanceCalculationMethod === "edges") {
|
|
2988
|
+
const refCoordinateEdgeMin = Math.min(refCoordinateA, refCoordinateB);
|
|
2989
|
+
const siblingCoordinateEdgeMin = Math.min(siblingCoordinateA, siblingCoordinateB);
|
|
2990
|
+
const refCoordinateEdgeMax = Math.max(refCoordinateA, refCoordinateB);
|
|
2991
|
+
const siblingCoordinateEdgeMax = Math.max(siblingCoordinateA, siblingCoordinateB);
|
|
2992
|
+
const minEdgeDistance = Math.abs(refCoordinateEdgeMin - siblingCoordinateEdgeMin);
|
|
2993
|
+
const maxEdgeDistance = Math.abs(refCoordinateEdgeMax - siblingCoordinateEdgeMax);
|
|
2994
|
+
return Math.min(minEdgeDistance, maxEdgeDistance);
|
|
2995
|
+
}
|
|
2996
|
+
const distancesToCompare = [Math.abs(siblingCoordinateA - refCoordinateA), Math.abs(siblingCoordinateA - refCoordinateB), Math.abs(siblingCoordinateB - refCoordinateA), Math.abs(siblingCoordinateB - refCoordinateB)];
|
|
2997
|
+
return Math.min(...distancesToCompare);
|
|
2998
|
+
}
|
|
2999
|
+
/**
|
|
3000
|
+
* Inspired by: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS_for_TV/TV_remote_control_navigation#Algorithm_design
|
|
3001
|
+
* Ref Corners are the 2 corners of the current component in the direction of navigation
|
|
3002
|
+
* They are used as a base to measure adjacent slices
|
|
3003
|
+
*/
|
|
3004
|
+
sortSiblingsByPriority(siblings, currentLayout, direction, focusKey) {
|
|
3005
|
+
const isVerticalDirection = direction === DIRECTION_DOWN || direction === DIRECTION_UP;
|
|
3006
|
+
const refCorners = SpatialNavigationService.getRefCorners(direction, false, currentLayout);
|
|
3007
|
+
return sortBy(siblings, (sibling) => {
|
|
3008
|
+
const siblingCorners = SpatialNavigationService.getRefCorners(direction, true, sibling.layout);
|
|
3009
|
+
const isAdjacentSlice = SpatialNavigationService.isAdjacentSlice(refCorners, siblingCorners, isVerticalDirection);
|
|
3010
|
+
const adjacentSliceWeight = isAdjacentSlice ? SpatialNavigationService.getAdjacentSliceWeight(refCorners, siblingCorners, isVerticalDirection) : DIAGONAL_SLICE_WEIGHT;
|
|
3011
|
+
const primaryAxisFunction = isAdjacentSlice ? SpatialNavigationService.getPrimaryAxisDistance : SpatialNavigationService.getSecondaryAxisDistance;
|
|
3012
|
+
const secondaryAxisFunction = isAdjacentSlice ? SpatialNavigationService.getSecondaryAxisDistance : SpatialNavigationService.getPrimaryAxisDistance;
|
|
3013
|
+
const primaryAxisDistance = primaryAxisFunction(refCorners, siblingCorners, isVerticalDirection, this.distanceCalculationMethod, this.customDistanceCalculationFunction);
|
|
3014
|
+
const secondaryAxisDistance = secondaryAxisFunction(refCorners, siblingCorners, isVerticalDirection, this.distanceCalculationMethod, this.customDistanceCalculationFunction);
|
|
3015
|
+
const totalDistancePoints = primaryAxisDistance * MAIN_COORDINATE_WEIGHT + secondaryAxisDistance;
|
|
3016
|
+
const priority = (totalDistancePoints + 1) / adjacentSliceWeight;
|
|
3017
|
+
this.log("smartNavigate", `distance (primary, secondary, total weighted) for ${sibling.focusKey} relative to ${focusKey} is`, primaryAxisDistance, secondaryAxisDistance, totalDistancePoints);
|
|
3018
|
+
this.log("smartNavigate", `priority for ${sibling.focusKey} relative to ${focusKey} is`, priority, `(adjacentWeight: ${adjacentSliceWeight})`);
|
|
3019
|
+
if (this.visualDebugger) {
|
|
3020
|
+
this.visualDebugger.drawPoint(siblingCorners.a.x, siblingCorners.a.y, "yellow", 6);
|
|
3021
|
+
this.visualDebugger.drawPoint(siblingCorners.b.x, siblingCorners.b.y, "yellow", 6);
|
|
3022
|
+
}
|
|
3023
|
+
return priority;
|
|
3024
|
+
});
|
|
3025
|
+
}
|
|
3026
|
+
constructor() {
|
|
3027
|
+
this.focusableComponents = {};
|
|
3028
|
+
this.focusKey = null;
|
|
3029
|
+
this.parentsHavingFocusedChild = [];
|
|
3030
|
+
this.domNodeFocusOptions = {};
|
|
3031
|
+
this.enabled = false;
|
|
3032
|
+
this.nativeMode = false;
|
|
3033
|
+
this.throttle = 0;
|
|
3034
|
+
this.throttleKeypresses = false;
|
|
3035
|
+
this.useGetBoundingClientRect = false;
|
|
3036
|
+
this.shouldFocusDOMNode = true;
|
|
3037
|
+
this.shouldUseNativeEvents = false;
|
|
3038
|
+
this.trackNativeFocus = true;
|
|
3039
|
+
this.blockNavigationOutOfFormFields = false;
|
|
3040
|
+
this.writingDirection = WritingDirection.LTR;
|
|
3041
|
+
this.pressedKeys = {};
|
|
3042
|
+
this.paused = false;
|
|
3043
|
+
this.keyDownEventListener = null;
|
|
3044
|
+
this.keyDownEventListenerThrottled = null;
|
|
3045
|
+
this.keyUpEventListener = null;
|
|
3046
|
+
this.focusInEventListener = null;
|
|
3047
|
+
this.keyMap = DEFAULT_KEY_MAP;
|
|
3048
|
+
this.pause = this.pause.bind(this);
|
|
3049
|
+
this.resume = this.resume.bind(this);
|
|
3050
|
+
this.setFocus = this.setFocus.bind(this);
|
|
3051
|
+
this.updateAllLayouts = this.updateAllLayouts.bind(this);
|
|
3052
|
+
this.navigateByDirection = this.navigateByDirection.bind(this);
|
|
3053
|
+
this.init = this.init.bind(this);
|
|
3054
|
+
this.setThrottle = this.setThrottle.bind(this);
|
|
3055
|
+
this.setVisualDebug = this.setVisualDebug.bind(this);
|
|
3056
|
+
this.destroy = this.destroy.bind(this);
|
|
3057
|
+
this.setKeyMap = this.setKeyMap.bind(this);
|
|
3058
|
+
this.getCurrentFocusKey = this.getCurrentFocusKey.bind(this);
|
|
3059
|
+
this.doesFocusableExist = this.doesFocusableExist.bind(this);
|
|
3060
|
+
this.updateRtl = this.updateRtl.bind(this);
|
|
3061
|
+
this.setFocusDebounced = debounce(this.setFocus, AUTO_RESTORE_FOCUS_DELAY, {
|
|
3062
|
+
leading: false,
|
|
3063
|
+
trailing: true
|
|
3064
|
+
});
|
|
3065
|
+
this.debug = false;
|
|
3066
|
+
this.visualDebugger = null;
|
|
3067
|
+
this.visualDebugAnimationFrame = null;
|
|
3068
|
+
this.visualDebugEnabled = false;
|
|
3069
|
+
this.logIndex = 0;
|
|
3070
|
+
this.distanceCalculationMethod = "corners";
|
|
3071
|
+
}
|
|
3072
|
+
init({
|
|
3073
|
+
debug = false,
|
|
3074
|
+
visualDebug = false,
|
|
3075
|
+
nativeMode = false,
|
|
3076
|
+
throttle: throttleParam = 0,
|
|
3077
|
+
throttleKeypresses = false,
|
|
3078
|
+
useGetBoundingClientRect = false,
|
|
3079
|
+
shouldFocusDOMNode,
|
|
3080
|
+
nativeFocus = true,
|
|
3081
|
+
domNodeFocusOptions = {},
|
|
3082
|
+
shouldUseNativeEvents = false,
|
|
3083
|
+
trackNativeFocus = true,
|
|
3084
|
+
blockNavigationOutOfFormFields = false,
|
|
3085
|
+
rtl = false,
|
|
3086
|
+
distanceCalculationMethod = "corners",
|
|
3087
|
+
customDistanceCalculationFunction
|
|
3088
|
+
} = {}) {
|
|
3089
|
+
if (!this.enabled) {
|
|
3090
|
+
const resolvedShouldFocusDOMNode = typeof shouldFocusDOMNode === "boolean" ? shouldFocusDOMNode : nativeFocus;
|
|
3091
|
+
this.domNodeFocusOptions = domNodeFocusOptions;
|
|
3092
|
+
this.enabled = true;
|
|
3093
|
+
this.nativeMode = nativeMode;
|
|
3094
|
+
this.throttleKeypresses = throttleKeypresses;
|
|
3095
|
+
this.useGetBoundingClientRect = useGetBoundingClientRect;
|
|
3096
|
+
this.shouldFocusDOMNode = resolvedShouldFocusDOMNode && !nativeMode;
|
|
3097
|
+
this.shouldUseNativeEvents = shouldUseNativeEvents;
|
|
3098
|
+
this.trackNativeFocus = trackNativeFocus;
|
|
3099
|
+
this.blockNavigationOutOfFormFields = blockNavigationOutOfFormFields;
|
|
3100
|
+
this.writingDirection = rtl ? WritingDirection.RTL : WritingDirection.LTR;
|
|
3101
|
+
this.distanceCalculationMethod = distanceCalculationMethod;
|
|
3102
|
+
this.customDistanceCalculationFunction = customDistanceCalculationFunction;
|
|
3103
|
+
this.debug = debug;
|
|
3104
|
+
if (!this.nativeMode) {
|
|
3105
|
+
if (Number.isInteger(throttleParam) && throttleParam > 0) {
|
|
3106
|
+
this.throttle = throttleParam;
|
|
3107
|
+
}
|
|
3108
|
+
this.bindEventHandlers();
|
|
3109
|
+
this.setVisualDebug(visualDebug);
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
startVisualDebugLoop() {
|
|
3114
|
+
if (typeof window === "undefined" || !window.requestAnimationFrame || typeof document === "undefined") {
|
|
3115
|
+
return;
|
|
3116
|
+
}
|
|
3117
|
+
if (!this.visualDebugger) {
|
|
3118
|
+
this.visualDebugger = new VisualDebugger(this.writingDirection, this.useGetBoundingClientRect);
|
|
3119
|
+
}
|
|
3120
|
+
const draw = () => {
|
|
3121
|
+
const visualDebugger = this.visualDebugger;
|
|
3122
|
+
if (!this.visualDebugEnabled || !visualDebugger) {
|
|
3123
|
+
return;
|
|
3124
|
+
}
|
|
3125
|
+
visualDebugger.clearLayouts();
|
|
3126
|
+
forOwn(this.focusableComponents, (component, focusKey) => {
|
|
3127
|
+
visualDebugger.drawLayout(component.layout, focusKey, component.parentFocusKey);
|
|
3128
|
+
});
|
|
3129
|
+
this.visualDebugAnimationFrame = window.requestAnimationFrame(draw);
|
|
3130
|
+
};
|
|
3131
|
+
if (this.visualDebugAnimationFrame === null) {
|
|
3132
|
+
draw();
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
stopVisualDebugLoop() {
|
|
3136
|
+
if (this.visualDebugAnimationFrame !== null && typeof window !== "undefined" && window.cancelAnimationFrame) {
|
|
3137
|
+
window.cancelAnimationFrame(this.visualDebugAnimationFrame);
|
|
3138
|
+
}
|
|
3139
|
+
this.visualDebugAnimationFrame = null;
|
|
3140
|
+
if (this.visualDebugger) {
|
|
3141
|
+
this.visualDebugger.clear();
|
|
3142
|
+
this.visualDebugger.clearLayouts();
|
|
3143
|
+
}
|
|
3144
|
+
if (typeof document !== "undefined") {
|
|
3145
|
+
document.querySelector("#sn-debug")?.remove();
|
|
3146
|
+
document.querySelector("#sn-layouts")?.remove();
|
|
3147
|
+
}
|
|
3148
|
+
this.visualDebugger = null;
|
|
3149
|
+
}
|
|
3150
|
+
setVisualDebug(visualDebug) {
|
|
3151
|
+
this.visualDebugEnabled = visualDebug;
|
|
3152
|
+
if (!this.enabled || this.nativeMode) {
|
|
3153
|
+
return;
|
|
3154
|
+
}
|
|
3155
|
+
if (visualDebug) {
|
|
3156
|
+
this.startVisualDebugLoop();
|
|
3157
|
+
} else {
|
|
3158
|
+
this.stopVisualDebugLoop();
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
setThrottle({
|
|
3162
|
+
throttle: throttleParam = 0,
|
|
3163
|
+
throttleKeypresses = false
|
|
3164
|
+
} = {}) {
|
|
3165
|
+
this.throttleKeypresses = throttleKeypresses;
|
|
3166
|
+
if (!this.nativeMode) {
|
|
3167
|
+
this.unbindEventHandlers();
|
|
3168
|
+
if (Number.isInteger(throttleParam)) {
|
|
3169
|
+
this.throttle = throttleParam;
|
|
3170
|
+
}
|
|
3171
|
+
this.bindEventHandlers();
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
destroy() {
|
|
3175
|
+
if (this.enabled) {
|
|
3176
|
+
this.setFocusDebounced.cancel();
|
|
3177
|
+
this.enabled = false;
|
|
3178
|
+
this.nativeMode = false;
|
|
3179
|
+
this.throttle = 0;
|
|
3180
|
+
this.throttleKeypresses = false;
|
|
3181
|
+
this.focusKey = null;
|
|
3182
|
+
this.parentsHavingFocusedChild = [];
|
|
3183
|
+
this.focusableComponents = {};
|
|
3184
|
+
this.paused = false;
|
|
3185
|
+
this.keyMap = DEFAULT_KEY_MAP;
|
|
3186
|
+
this.trackNativeFocus = true;
|
|
3187
|
+
this.blockNavigationOutOfFormFields = false;
|
|
3188
|
+
this.shouldFocusDOMNode = true;
|
|
3189
|
+
this.shouldUseNativeEvents = false;
|
|
3190
|
+
this.visualDebugEnabled = false;
|
|
3191
|
+
this.stopVisualDebugLoop();
|
|
3192
|
+
this.unbindEventHandlers();
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
getEventType(keyCode) {
|
|
3196
|
+
return findKey(this.getKeyMap(), (codeList) => codeList.includes(keyCode));
|
|
3197
|
+
}
|
|
3198
|
+
static getKeyCode(event) {
|
|
3199
|
+
return event.keyCode || event.code || event.key;
|
|
3200
|
+
}
|
|
3201
|
+
static isDirectionalEventType(eventType) {
|
|
3202
|
+
return eventType === DIRECTION_LEFT || eventType === DIRECTION_RIGHT || eventType === DIRECTION_UP || eventType === DIRECTION_DOWN;
|
|
3203
|
+
}
|
|
3204
|
+
shouldBypassSpatialNavigationForTarget(target, eventType) {
|
|
3205
|
+
return this.blockNavigationOutOfFormFields && (eventType === KEY_ENTER || SpatialNavigationService.isDirectionalEventType(eventType)) && isFormFieldElement(target);
|
|
3206
|
+
}
|
|
3207
|
+
makeNodeProgrammaticallyFocusable(component) {
|
|
3208
|
+
if (!component?.node || !this.shouldFocusDOMNode) {
|
|
3209
|
+
return;
|
|
3210
|
+
}
|
|
3211
|
+
const {
|
|
3212
|
+
node,
|
|
3213
|
+
focusable
|
|
3214
|
+
} = component;
|
|
3215
|
+
const hasAutoTabIndex = node.getAttribute?.("data-sn-auto-tabindex");
|
|
3216
|
+
if (!focusable) {
|
|
3217
|
+
if (hasAutoTabIndex) {
|
|
3218
|
+
node.removeAttribute?.("tabindex");
|
|
3219
|
+
node.removeAttribute?.("data-sn-auto-tabindex");
|
|
3220
|
+
}
|
|
3221
|
+
return;
|
|
3222
|
+
}
|
|
3223
|
+
if (isFocusableByDefault(node) || node.getAttribute?.("tabindex") !== null) {
|
|
3224
|
+
return;
|
|
3225
|
+
}
|
|
3226
|
+
node.setAttribute?.("tabindex", "-1");
|
|
3227
|
+
node.setAttribute?.("data-sn-auto-tabindex", "true");
|
|
3228
|
+
}
|
|
3229
|
+
getLayoutReferenceNode(node) {
|
|
3230
|
+
if (!node) {
|
|
3231
|
+
return null;
|
|
3232
|
+
}
|
|
3233
|
+
if (node.matches?.(CHECKBOX_LIKE_SELECTOR) && node.parentElement?.tagName === "LABEL") {
|
|
3234
|
+
return node.parentElement;
|
|
3235
|
+
}
|
|
3236
|
+
return node;
|
|
3237
|
+
}
|
|
3238
|
+
findNativeFocusedComponent(target) {
|
|
3239
|
+
const targetNode = target;
|
|
3240
|
+
if (!targetNode) {
|
|
3241
|
+
return null;
|
|
3242
|
+
}
|
|
3243
|
+
const matchingComponents = filter(this.focusableComponents, ({
|
|
3244
|
+
node,
|
|
3245
|
+
focusable
|
|
3246
|
+
}) => focusable && !!node && (node === targetNode || Boolean(node.contains?.(targetNode))));
|
|
3247
|
+
if (!matchingComponents.length) {
|
|
3248
|
+
return null;
|
|
3249
|
+
}
|
|
3250
|
+
const sortedByDepth = sortBy(matchingComponents, ({
|
|
3251
|
+
node
|
|
3252
|
+
}) => {
|
|
3253
|
+
let depth = 0;
|
|
3254
|
+
let currentNode = node;
|
|
3255
|
+
while (currentNode?.parentElement) {
|
|
3256
|
+
depth += 1;
|
|
3257
|
+
currentNode = currentNode.parentElement;
|
|
3258
|
+
}
|
|
3259
|
+
return depth * -1;
|
|
3260
|
+
});
|
|
3261
|
+
return first(sortedByDepth);
|
|
3262
|
+
}
|
|
3263
|
+
syncNativeFocus(event) {
|
|
3264
|
+
if (this.paused || !this.enabled || this.nativeMode || !this.trackNativeFocus) {
|
|
3265
|
+
return;
|
|
3266
|
+
}
|
|
3267
|
+
const component = this.findNativeFocusedComponent(event.target);
|
|
3268
|
+
if (!component || component.focusKey === this.focusKey) {
|
|
3269
|
+
return;
|
|
3270
|
+
}
|
|
3271
|
+
const focusDetails = {
|
|
3272
|
+
event,
|
|
3273
|
+
nativeEvent: event
|
|
3274
|
+
};
|
|
3275
|
+
this.setCurrentFocusedKey(component.focusKey, focusDetails);
|
|
3276
|
+
this.updateParentsHasFocusedChild(component.focusKey, focusDetails);
|
|
3277
|
+
this.updateParentsLastFocusedChild(component.focusKey);
|
|
3278
|
+
}
|
|
3279
|
+
bindEventHandlers() {
|
|
3280
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
3281
|
+
const keyDownEventListener = (event) => {
|
|
3282
|
+
if (this.paused === true) {
|
|
3283
|
+
return;
|
|
3284
|
+
}
|
|
3285
|
+
if (this.debug) {
|
|
3286
|
+
this.logIndex += 1;
|
|
3287
|
+
}
|
|
3288
|
+
const keyCode = SpatialNavigationService.getKeyCode(event);
|
|
3289
|
+
const eventType = this.getEventType(keyCode);
|
|
3290
|
+
if (!eventType) {
|
|
3291
|
+
return;
|
|
3292
|
+
}
|
|
3293
|
+
if (this.shouldBypassSpatialNavigationForTarget(event.target, eventType)) {
|
|
3294
|
+
return;
|
|
3295
|
+
}
|
|
3296
|
+
this.pressedKeys[eventType] = this.pressedKeys[eventType] ? this.pressedKeys[eventType] + 1 : 1;
|
|
3297
|
+
if (!this.shouldUseNativeEvents) {
|
|
3298
|
+
event.preventDefault();
|
|
3299
|
+
event.stopPropagation();
|
|
3300
|
+
}
|
|
3301
|
+
const keysDetails = {
|
|
3302
|
+
pressedKeys: this.pressedKeys
|
|
3303
|
+
};
|
|
3304
|
+
if (eventType === KEY_ENTER && this.focusKey) {
|
|
3305
|
+
this.onEnterPress(keysDetails);
|
|
3306
|
+
return;
|
|
3307
|
+
}
|
|
3308
|
+
const preventDefaultNavigation = this.onArrowPress(eventType, keysDetails) === false;
|
|
3309
|
+
this.visualDebugger?.clear();
|
|
3310
|
+
if (preventDefaultNavigation) {
|
|
3311
|
+
this.log("keyDownEventListener", "default navigation prevented");
|
|
3312
|
+
} else {
|
|
3313
|
+
this.smartNavigate(eventType, null, {
|
|
3314
|
+
event,
|
|
3315
|
+
nativeEvent: event
|
|
3316
|
+
});
|
|
3317
|
+
}
|
|
3318
|
+
};
|
|
3319
|
+
this.keyDownEventListener = keyDownEventListener;
|
|
3320
|
+
let keyDownListener = keyDownEventListener;
|
|
3321
|
+
if (this.throttle) {
|
|
3322
|
+
const throttledListener = throttle(keyDownEventListener, this.throttle, THROTTLE_OPTIONS);
|
|
3323
|
+
this.keyDownEventListenerThrottled = throttledListener;
|
|
3324
|
+
keyDownListener = throttledListener;
|
|
3325
|
+
} else {
|
|
3326
|
+
this.keyDownEventListenerThrottled = null;
|
|
3327
|
+
}
|
|
3328
|
+
const keyUpEventListener = (event) => {
|
|
3329
|
+
const keyCode = SpatialNavigationService.getKeyCode(event);
|
|
3330
|
+
const eventType = this.getEventType(keyCode);
|
|
3331
|
+
if (!eventType) {
|
|
3332
|
+
return;
|
|
3333
|
+
}
|
|
3334
|
+
delete this.pressedKeys[eventType];
|
|
3335
|
+
if (this.shouldBypassSpatialNavigationForTarget(event.target, eventType)) {
|
|
3336
|
+
return;
|
|
3337
|
+
}
|
|
3338
|
+
if (this.throttle && !this.throttleKeypresses) {
|
|
3339
|
+
this.keyDownEventListenerThrottled?.cancel();
|
|
3340
|
+
}
|
|
3341
|
+
if (eventType === KEY_ENTER && this.focusKey) {
|
|
3342
|
+
this.onEnterRelease();
|
|
3343
|
+
}
|
|
3344
|
+
if (this.focusKey && (eventType === DIRECTION_LEFT || eventType === DIRECTION_RIGHT || eventType === DIRECTION_UP || eventType === DIRECTION_DOWN)) {
|
|
3345
|
+
this.onArrowRelease(eventType);
|
|
3346
|
+
}
|
|
3347
|
+
};
|
|
3348
|
+
this.keyUpEventListener = keyUpEventListener;
|
|
3349
|
+
window.addEventListener("keyup", keyUpEventListener);
|
|
3350
|
+
window.addEventListener("keydown", keyDownListener);
|
|
3351
|
+
}
|
|
3352
|
+
if (this.trackNativeFocus && typeof document !== "undefined" && document.addEventListener) {
|
|
3353
|
+
this.focusInEventListener = (event) => this.syncNativeFocus(event);
|
|
3354
|
+
document.addEventListener("focusin", this.focusInEventListener);
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
unbindEventHandlers() {
|
|
3358
|
+
if (typeof window !== "undefined" && window.removeEventListener) {
|
|
3359
|
+
if (this.keyUpEventListener) {
|
|
3360
|
+
window.removeEventListener("keyup", this.keyUpEventListener);
|
|
3361
|
+
this.keyUpEventListener = null;
|
|
3362
|
+
}
|
|
3363
|
+
const listener = this.throttle ? this.keyDownEventListenerThrottled : this.keyDownEventListener;
|
|
3364
|
+
if (listener) {
|
|
3365
|
+
window.removeEventListener("keydown", listener);
|
|
3366
|
+
}
|
|
3367
|
+
this.keyDownEventListener = null;
|
|
3368
|
+
this.keyDownEventListenerThrottled = null;
|
|
3369
|
+
}
|
|
3370
|
+
if (typeof document !== "undefined" && document.removeEventListener) {
|
|
3371
|
+
if (this.focusInEventListener) {
|
|
3372
|
+
document.removeEventListener("focusin", this.focusInEventListener);
|
|
3373
|
+
}
|
|
3374
|
+
this.focusInEventListener = null;
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
3377
|
+
onEnterPress(keysDetails) {
|
|
3378
|
+
if (!this.focusKey) {
|
|
3379
|
+
return;
|
|
3380
|
+
}
|
|
3381
|
+
const component = this.focusableComponents[this.focusKey];
|
|
3382
|
+
if (!component) {
|
|
3383
|
+
this.log("onEnterPress", "noComponent");
|
|
3384
|
+
return;
|
|
3385
|
+
}
|
|
3386
|
+
if (!component.focusable) {
|
|
3387
|
+
this.log("onEnterPress", "componentNotFocusable");
|
|
3388
|
+
return;
|
|
3389
|
+
}
|
|
3390
|
+
if (component.onEnterPress) {
|
|
3391
|
+
component.onEnterPress(keysDetails);
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
onEnterRelease() {
|
|
3395
|
+
if (!this.focusKey) {
|
|
3396
|
+
return;
|
|
3397
|
+
}
|
|
3398
|
+
const component = this.focusableComponents[this.focusKey];
|
|
3399
|
+
if (!component) {
|
|
3400
|
+
this.log("onEnterRelease", "noComponent");
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
if (!component.focusable) {
|
|
3404
|
+
this.log("onEnterRelease", "componentNotFocusable");
|
|
3405
|
+
return;
|
|
3406
|
+
}
|
|
3407
|
+
if (component.onEnterRelease) {
|
|
3408
|
+
component.onEnterRelease();
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
onArrowPress(direction, keysDetails) {
|
|
3412
|
+
if (!this.focusKey) {
|
|
3413
|
+
return void 0;
|
|
3414
|
+
}
|
|
3415
|
+
const component = this.focusableComponents[this.focusKey];
|
|
3416
|
+
if (!component) {
|
|
3417
|
+
this.log("onArrowPress", "noComponent");
|
|
3418
|
+
return void 0;
|
|
3419
|
+
}
|
|
3420
|
+
return component && component.onArrowPress && component.onArrowPress(direction, keysDetails);
|
|
3421
|
+
}
|
|
3422
|
+
onArrowRelease(direction) {
|
|
3423
|
+
if (!this.focusKey) {
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3426
|
+
const component = this.focusableComponents[this.focusKey];
|
|
3427
|
+
if (!component) {
|
|
3428
|
+
this.log("onArrowRelease", "noComponent");
|
|
3429
|
+
return;
|
|
3430
|
+
}
|
|
3431
|
+
if (!component.focusable) {
|
|
3432
|
+
this.log("onArrowRelease", "componentNotFocusable");
|
|
3433
|
+
return;
|
|
3434
|
+
}
|
|
3435
|
+
if (component.onArrowRelease) {
|
|
3436
|
+
component.onArrowRelease(direction);
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
/**
|
|
3440
|
+
* Move focus by direction, if you can't use buttons or focusing by key.
|
|
3441
|
+
*
|
|
3442
|
+
* @example
|
|
3443
|
+
* navigateByDirection('right') // The focus is moved to right
|
|
3444
|
+
*/
|
|
3445
|
+
navigateByDirection(direction, focusDetails) {
|
|
3446
|
+
if (this.paused === true || !this.enabled || this.nativeMode) {
|
|
3447
|
+
return;
|
|
3448
|
+
}
|
|
3449
|
+
const validDirections = [DIRECTION_DOWN, DIRECTION_UP, DIRECTION_LEFT, DIRECTION_RIGHT];
|
|
3450
|
+
if (validDirections.includes(direction)) {
|
|
3451
|
+
this.log("navigateByDirection", "direction", direction);
|
|
3452
|
+
this.smartNavigate(direction, null, focusDetails);
|
|
3453
|
+
} else {
|
|
3454
|
+
this.log("navigateByDirection", `Invalid direction. You passed: \`${direction}\`, but you can use only these: `, validDirections);
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
/**
|
|
3458
|
+
* This function navigates between siblings OR goes up by the Tree
|
|
3459
|
+
* Based on the Direction
|
|
3460
|
+
*/
|
|
3461
|
+
smartNavigate(direction, fromParentFocusKey, focusDetails) {
|
|
3462
|
+
if (this.nativeMode) {
|
|
3463
|
+
return;
|
|
3464
|
+
}
|
|
3465
|
+
const isVerticalDirection = direction === DIRECTION_DOWN || direction === DIRECTION_UP;
|
|
3466
|
+
const isIncrementalDirection = direction === DIRECTION_DOWN || (this.writingDirection === WritingDirection.LTR ? direction === DIRECTION_RIGHT : direction === DIRECTION_LEFT);
|
|
3467
|
+
this.log("smartNavigate", "direction", direction);
|
|
3468
|
+
this.log("smartNavigate", "fromParentFocusKey", fromParentFocusKey);
|
|
3469
|
+
this.log("smartNavigate", "this.focusKey", this.focusKey);
|
|
3470
|
+
if (!fromParentFocusKey) {
|
|
3471
|
+
forOwn(this.focusableComponents, (component) => {
|
|
3472
|
+
component.layoutUpdated = false;
|
|
3473
|
+
});
|
|
3474
|
+
}
|
|
3475
|
+
const currentFocusKey = fromParentFocusKey || this.focusKey;
|
|
3476
|
+
const currentComponent = currentFocusKey ? this.focusableComponents[currentFocusKey] : void 0;
|
|
3477
|
+
if (!fromParentFocusKey && !currentComponent) {
|
|
3478
|
+
const forcedFocusKey = this.getForcedFocusKey();
|
|
3479
|
+
if (forcedFocusKey) {
|
|
3480
|
+
this.setFocus(forcedFocusKey);
|
|
3481
|
+
}
|
|
3482
|
+
return;
|
|
3483
|
+
}
|
|
3484
|
+
this.log("smartNavigate", "currentComponent", currentComponent ? currentComponent.focusKey : void 0, currentComponent ? currentComponent.node : void 0, currentComponent);
|
|
3485
|
+
if (currentComponent) {
|
|
3486
|
+
this.updateLayout(currentComponent.focusKey);
|
|
3487
|
+
const {
|
|
3488
|
+
parentFocusKey,
|
|
3489
|
+
focusKey,
|
|
3490
|
+
layout
|
|
3491
|
+
} = currentComponent;
|
|
3492
|
+
const currentCutoffCoordinate = SpatialNavigationService.getCutoffCoordinate(isVerticalDirection, isIncrementalDirection, false, layout, this.writingDirection);
|
|
3493
|
+
const siblings = filter(this.focusableComponents, (component) => {
|
|
3494
|
+
if (component.parentFocusKey === parentFocusKey && component.focusable) {
|
|
3495
|
+
this.updateLayout(component.focusKey);
|
|
3496
|
+
const siblingCutoffCoordinate = SpatialNavigationService.getCutoffCoordinate(isVerticalDirection, isIncrementalDirection, true, component.layout, this.writingDirection);
|
|
3497
|
+
return isVerticalDirection ? isIncrementalDirection ? siblingCutoffCoordinate >= currentCutoffCoordinate - CUT_OFF_COORDINATE_TOLERANCE_PX : siblingCutoffCoordinate <= currentCutoffCoordinate + CUT_OFF_COORDINATE_TOLERANCE_PX : this.writingDirection === WritingDirection.LTR ? isIncrementalDirection ? siblingCutoffCoordinate >= currentCutoffCoordinate - CUT_OFF_COORDINATE_TOLERANCE_PX : siblingCutoffCoordinate <= currentCutoffCoordinate + CUT_OFF_COORDINATE_TOLERANCE_PX : isIncrementalDirection ? siblingCutoffCoordinate <= currentCutoffCoordinate + CUT_OFF_COORDINATE_TOLERANCE_PX : siblingCutoffCoordinate >= currentCutoffCoordinate - CUT_OFF_COORDINATE_TOLERANCE_PX;
|
|
3498
|
+
}
|
|
3499
|
+
return false;
|
|
3500
|
+
});
|
|
3501
|
+
if (this.debug) {
|
|
3502
|
+
this.log("smartNavigate", "currentCutoffCoordinate", currentCutoffCoordinate);
|
|
3503
|
+
this.log("smartNavigate", "siblings", `${siblings.length} elements:`, siblings.map((sibling) => sibling.focusKey).join(", "), siblings.map((sibling) => sibling.node), siblings.map((sibling) => sibling));
|
|
3504
|
+
}
|
|
3505
|
+
const refCorners = SpatialNavigationService.getRefCorners(direction, false, layout);
|
|
3506
|
+
const primaryAxisDistanceThreshold = Math.max(isVerticalDirection ? layout.height : layout.width, PRIMARY_AXIS_PROXIMITY_TOLERANCE_PX);
|
|
3507
|
+
const siblingsWithPrimaryAxisDistance = siblings.map((sibling) => {
|
|
3508
|
+
const siblingCorners = SpatialNavigationService.getRefCorners(direction, true, sibling.layout);
|
|
3509
|
+
return {
|
|
3510
|
+
sibling,
|
|
3511
|
+
primaryAxisDistance: SpatialNavigationService.getPrimaryAxisDistance(refCorners, siblingCorners, isVerticalDirection)
|
|
3512
|
+
};
|
|
3513
|
+
});
|
|
3514
|
+
const minimumPrimaryAxisDistance = siblingsWithPrimaryAxisDistance.length ? Math.min(...siblingsWithPrimaryAxisDistance.map(({
|
|
3515
|
+
primaryAxisDistance
|
|
3516
|
+
}) => primaryAxisDistance)) : null;
|
|
3517
|
+
const nearbySiblings = minimumPrimaryAxisDistance === null ? siblings : siblingsWithPrimaryAxisDistance.filter(({
|
|
3518
|
+
primaryAxisDistance
|
|
3519
|
+
}) => primaryAxisDistance <= minimumPrimaryAxisDistance + primaryAxisDistanceThreshold).map(({
|
|
3520
|
+
sibling
|
|
3521
|
+
}) => sibling);
|
|
3522
|
+
if (this.debug) {
|
|
3523
|
+
this.log("smartNavigate", "nearbySiblings", `${nearbySiblings.length} elements:`, nearbySiblings.map((sibling) => sibling.focusKey).join(", "), `minimumPrimaryAxisDistance: ${minimumPrimaryAxisDistance}`, `primaryAxisDistanceThreshold: ${primaryAxisDistanceThreshold}`);
|
|
3524
|
+
}
|
|
3525
|
+
if (this.visualDebugger) {
|
|
3526
|
+
this.visualDebugger.drawPoint(refCorners.a.x, refCorners.a.y);
|
|
3527
|
+
this.visualDebugger.drawPoint(refCorners.b.x, refCorners.b.y);
|
|
3528
|
+
}
|
|
3529
|
+
const sortedSiblings = this.sortSiblingsByPriority(nearbySiblings, layout, direction, focusKey);
|
|
3530
|
+
const nextComponent = first(sortedSiblings);
|
|
3531
|
+
this.log("smartNavigate", "nextComponent", nextComponent ? nextComponent.focusKey : void 0, nextComponent ? nextComponent.node : void 0, nextComponent);
|
|
3532
|
+
if (nextComponent) {
|
|
3533
|
+
this.setFocus(nextComponent.focusKey, focusDetails);
|
|
3534
|
+
} else {
|
|
3535
|
+
if (!parentFocusKey) {
|
|
3536
|
+
return;
|
|
3537
|
+
}
|
|
3538
|
+
const parentComponent = this.focusableComponents[parentFocusKey];
|
|
3539
|
+
const focusBoundaryDirections = parentComponent?.isFocusBoundary ? parentComponent.focusBoundaryDirections || [direction] : [];
|
|
3540
|
+
if (!parentComponent || !focusBoundaryDirections.includes(direction)) {
|
|
3541
|
+
this.smartNavigate(direction, parentFocusKey, focusDetails);
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
saveLastFocusedChildKey(component, focusKey) {
|
|
3547
|
+
if (component) {
|
|
3548
|
+
this.log("saveLastFocusedChildKey", `${component.focusKey} lastFocusedChildKey set`, focusKey);
|
|
3549
|
+
component.lastFocusedChildKey = focusKey;
|
|
3550
|
+
}
|
|
3551
|
+
}
|
|
3552
|
+
log(functionName, debugString, ...rest) {
|
|
3553
|
+
if (this.debug) {
|
|
3554
|
+
console.log(`%c${functionName}%c${debugString}`, `background: ${DEBUG_FN_COLORS[this.logIndex % DEBUG_FN_COLORS.length]}; color: black; padding: 1px 5px;`, "background: #333; color: #BADA55; padding: 1px 5px;", ...rest);
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
/**
|
|
3558
|
+
* Returns the current focus key
|
|
3559
|
+
*/
|
|
3560
|
+
getCurrentFocusKey() {
|
|
3561
|
+
return this.focusKey;
|
|
3562
|
+
}
|
|
3563
|
+
/**
|
|
3564
|
+
* Returns the focus key to which focus can be forced if there are force-focusable components.
|
|
3565
|
+
* A component closest to the top left viewport corner (0,0) is returned.
|
|
3566
|
+
*/
|
|
3567
|
+
getForcedFocusKey() {
|
|
3568
|
+
const forceFocusableComponents = filter(this.focusableComponents, (component) => component.focusable && component.forceFocus);
|
|
3569
|
+
const sortedForceFocusableComponents = this.sortSiblingsByPriority(forceFocusableComponents, {
|
|
3570
|
+
x: 0,
|
|
3571
|
+
y: 0,
|
|
3572
|
+
width: 0,
|
|
3573
|
+
height: 0,
|
|
3574
|
+
left: 0,
|
|
3575
|
+
top: 0,
|
|
3576
|
+
right: 0,
|
|
3577
|
+
bottom: 0,
|
|
3578
|
+
node: null
|
|
3579
|
+
}, "down", ROOT_FOCUS_KEY);
|
|
3580
|
+
return first(sortedForceFocusableComponents)?.focusKey;
|
|
3581
|
+
}
|
|
3582
|
+
/**
|
|
3583
|
+
* This function tries to determine the next component to Focus
|
|
3584
|
+
* It's either the target node OR the one down by the Tree if node has children components
|
|
3585
|
+
* Based on "targetFocusKey" which means the "intended component to focus"
|
|
3586
|
+
*/
|
|
3587
|
+
getNextFocusKey(targetFocusKey) {
|
|
3588
|
+
const targetComponent = this.focusableComponents[targetFocusKey];
|
|
3589
|
+
if (!targetComponent || this.nativeMode) {
|
|
3590
|
+
return targetFocusKey;
|
|
3591
|
+
}
|
|
3592
|
+
const children = filter(this.focusableComponents, (component) => component.parentFocusKey === targetFocusKey && component.focusable);
|
|
3593
|
+
if (children.length > 0) {
|
|
3594
|
+
const {
|
|
3595
|
+
lastFocusedChildKey,
|
|
3596
|
+
preferredChildFocusKey
|
|
3597
|
+
} = targetComponent;
|
|
3598
|
+
this.log("getNextFocusKey", "lastFocusedChildKey is", lastFocusedChildKey);
|
|
3599
|
+
this.log("getNextFocusKey", "preferredChildFocusKey is", preferredChildFocusKey);
|
|
3600
|
+
if (lastFocusedChildKey && targetComponent.saveLastFocusedChild && this.isParticipatingFocusableComponent(lastFocusedChildKey)) {
|
|
3601
|
+
this.log("getNextFocusKey", "lastFocusedChildKey will be focused", lastFocusedChildKey);
|
|
3602
|
+
return this.getNextFocusKey(lastFocusedChildKey);
|
|
3603
|
+
}
|
|
3604
|
+
if (preferredChildFocusKey && this.isParticipatingFocusableComponent(preferredChildFocusKey)) {
|
|
3605
|
+
this.log("getNextFocusKey", "preferredChildFocusKey will be focused", preferredChildFocusKey);
|
|
3606
|
+
return this.getNextFocusKey(preferredChildFocusKey);
|
|
3607
|
+
}
|
|
3608
|
+
children.forEach((component) => this.updateLayout(component.focusKey));
|
|
3609
|
+
const closestChild = getChildClosestToOrigin(children, this.writingDirection);
|
|
3610
|
+
if (!closestChild) {
|
|
3611
|
+
return targetFocusKey;
|
|
3612
|
+
}
|
|
3613
|
+
const {
|
|
3614
|
+
focusKey: childKey
|
|
3615
|
+
} = closestChild;
|
|
3616
|
+
this.log("getNextFocusKey", "childKey will be focused", childKey);
|
|
3617
|
+
return this.getNextFocusKey(childKey);
|
|
3618
|
+
}
|
|
3619
|
+
this.log("getNextFocusKey", "targetFocusKey", targetFocusKey);
|
|
3620
|
+
return targetFocusKey;
|
|
3621
|
+
}
|
|
3622
|
+
addFocusable({
|
|
3623
|
+
focusKey,
|
|
3624
|
+
node,
|
|
3625
|
+
parentFocusKey,
|
|
3626
|
+
onEnterPress,
|
|
3627
|
+
onEnterRelease,
|
|
3628
|
+
onArrowPress,
|
|
3629
|
+
onArrowRelease,
|
|
3630
|
+
onFocus,
|
|
3631
|
+
onBlur,
|
|
3632
|
+
saveLastFocusedChild,
|
|
3633
|
+
trackChildren,
|
|
3634
|
+
onUpdateFocus,
|
|
3635
|
+
onUpdateHasFocusedChild,
|
|
3636
|
+
preferredChildFocusKey,
|
|
3637
|
+
autoRestoreFocus,
|
|
3638
|
+
forceFocus,
|
|
3639
|
+
focusable,
|
|
3640
|
+
isFocusBoundary,
|
|
3641
|
+
focusBoundaryDirections
|
|
3642
|
+
}) {
|
|
3643
|
+
this.focusableComponents[focusKey] = {
|
|
3644
|
+
focusKey,
|
|
3645
|
+
node,
|
|
3646
|
+
parentFocusKey,
|
|
3647
|
+
onEnterPress,
|
|
3648
|
+
onEnterRelease,
|
|
3649
|
+
onArrowPress,
|
|
3650
|
+
onArrowRelease,
|
|
3651
|
+
onFocus,
|
|
3652
|
+
onBlur,
|
|
3653
|
+
onUpdateFocus,
|
|
3654
|
+
onUpdateHasFocusedChild,
|
|
3655
|
+
saveLastFocusedChild,
|
|
3656
|
+
trackChildren,
|
|
3657
|
+
preferredChildFocusKey,
|
|
3658
|
+
focusable,
|
|
3659
|
+
isFocusBoundary,
|
|
3660
|
+
focusBoundaryDirections,
|
|
3661
|
+
autoRestoreFocus,
|
|
3662
|
+
forceFocus,
|
|
3663
|
+
lastFocusedChildKey: null,
|
|
3664
|
+
layout: {
|
|
3665
|
+
x: 0,
|
|
3666
|
+
y: 0,
|
|
3667
|
+
width: 0,
|
|
3668
|
+
height: 0,
|
|
3669
|
+
left: 0,
|
|
3670
|
+
top: 0,
|
|
3671
|
+
right: 0,
|
|
3672
|
+
bottom: 0,
|
|
3673
|
+
/**
|
|
3674
|
+
* Node ref is also duplicated in layout to be reported in onFocus callback
|
|
3675
|
+
*/
|
|
3676
|
+
node
|
|
3677
|
+
},
|
|
3678
|
+
layoutUpdated: false
|
|
3679
|
+
};
|
|
3680
|
+
if (!node) {
|
|
3681
|
+
console.warn('Component added without a node reference. This will result in its coordinates being empty and may cause lost focus. Check the "ref" passed to "useFocusable": ', this.focusableComponents[focusKey]);
|
|
3682
|
+
}
|
|
3683
|
+
if (this.nativeMode) {
|
|
3684
|
+
return;
|
|
3685
|
+
}
|
|
3686
|
+
this.makeNodeProgrammaticallyFocusable(this.focusableComponents[focusKey]);
|
|
3687
|
+
this.updateLayout(focusKey);
|
|
3688
|
+
this.log("addFocusable", "Component added: ", this.focusableComponents[focusKey]);
|
|
3689
|
+
if (focusKey === this.focusKey) {
|
|
3690
|
+
this.setFocus(preferredChildFocusKey || focusKey);
|
|
3691
|
+
}
|
|
3692
|
+
const currentFocusKey = this.focusKey;
|
|
3693
|
+
if (!currentFocusKey) {
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3696
|
+
let currentComponent = this.focusableComponents[currentFocusKey];
|
|
3697
|
+
while (currentComponent) {
|
|
3698
|
+
if (currentComponent.parentFocusKey === focusKey) {
|
|
3699
|
+
this.updateParentsHasFocusedChild(currentFocusKey, {});
|
|
3700
|
+
this.updateParentsLastFocusedChild(currentFocusKey);
|
|
3701
|
+
break;
|
|
3702
|
+
}
|
|
3703
|
+
if (!currentComponent.parentFocusKey) {
|
|
3704
|
+
break;
|
|
3705
|
+
}
|
|
3706
|
+
currentComponent = this.focusableComponents[currentComponent.parentFocusKey];
|
|
3707
|
+
}
|
|
3708
|
+
}
|
|
3709
|
+
removeFocusable({
|
|
3710
|
+
focusKey,
|
|
3711
|
+
skipFocusRestoration = false
|
|
3712
|
+
}) {
|
|
3713
|
+
const componentToRemove = this.focusableComponents[focusKey];
|
|
3714
|
+
if (componentToRemove) {
|
|
3715
|
+
const {
|
|
3716
|
+
parentFocusKey,
|
|
3717
|
+
onUpdateFocus
|
|
3718
|
+
} = componentToRemove;
|
|
3719
|
+
onUpdateFocus(false);
|
|
3720
|
+
this.log("removeFocusable", "Component removed: ", componentToRemove);
|
|
3721
|
+
delete this.focusableComponents[focusKey];
|
|
3722
|
+
const hadFocusedChild = this.parentsHavingFocusedChild.includes(focusKey);
|
|
3723
|
+
this.parentsHavingFocusedChild = this.parentsHavingFocusedChild.filter((parentWithFocusedChild) => parentWithFocusedChild !== focusKey);
|
|
3724
|
+
const parentComponent = parentFocusKey ? this.focusableComponents[parentFocusKey] : void 0;
|
|
3725
|
+
const isFocused = focusKey === this.focusKey;
|
|
3726
|
+
if (parentComponent && parentComponent.lastFocusedChildKey === focusKey) {
|
|
3727
|
+
parentComponent.lastFocusedChildKey = null;
|
|
3728
|
+
}
|
|
3729
|
+
if (this.nativeMode) {
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
if (!skipFocusRestoration && (isFocused || hadFocusedChild) && parentComponent && parentComponent.autoRestoreFocus) {
|
|
3733
|
+
this.log("removeFocusable", "Component removed: ", isFocused ? "Leaf component" : "Container component", "Auto restoring focus to: ", parentFocusKey);
|
|
3734
|
+
this.setFocusDebounced(parentComponent.focusKey);
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
getNodeLayoutByFocusKey(focusKey) {
|
|
3739
|
+
const component = this.focusableComponents[focusKey];
|
|
3740
|
+
if (component) {
|
|
3741
|
+
this.updateLayout(component.focusKey);
|
|
3742
|
+
return component.layout;
|
|
3743
|
+
}
|
|
3744
|
+
return null;
|
|
3745
|
+
}
|
|
3746
|
+
setCurrentFocusedKey(newFocusKey, focusDetails) {
|
|
3747
|
+
const oldFocusKey = this.focusKey;
|
|
3748
|
+
if (oldFocusKey && this.isFocusableComponent(oldFocusKey) && newFocusKey !== oldFocusKey) {
|
|
3749
|
+
const oldComponent = this.focusableComponents[oldFocusKey];
|
|
3750
|
+
oldComponent.onUpdateFocus(false);
|
|
3751
|
+
oldComponent.onBlur(this.getNodeLayoutByFocusKey(oldFocusKey), focusDetails);
|
|
3752
|
+
oldComponent.node?.removeAttribute?.("data-focused");
|
|
3753
|
+
this.log("setCurrentFocusedKey", "onBlur", oldComponent);
|
|
3754
|
+
}
|
|
3755
|
+
this.focusKey = newFocusKey;
|
|
3756
|
+
if (this.isFocusableComponent(newFocusKey)) {
|
|
3757
|
+
const newComponent = this.focusableComponents[newFocusKey];
|
|
3758
|
+
this.makeNodeProgrammaticallyFocusable(newComponent);
|
|
3759
|
+
if (this.shouldFocusDOMNode && newComponent.node && typeof newComponent.node.focus === "function" && (typeof document === "undefined" || newComponent.node !== document.activeElement)) {
|
|
3760
|
+
newComponent.node.focus(this.domNodeFocusOptions);
|
|
3761
|
+
}
|
|
3762
|
+
newComponent.node?.setAttribute?.("data-focused", "true");
|
|
3763
|
+
newComponent.onUpdateFocus(true);
|
|
3764
|
+
newComponent.onFocus(this.getNodeLayoutByFocusKey(newFocusKey), focusDetails);
|
|
3765
|
+
this.log("setCurrentFocusedKey", "onFocus", newComponent);
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
updateParentsHasFocusedChild(focusKey, focusDetails) {
|
|
3769
|
+
const parents = [];
|
|
3770
|
+
let currentComponent = this.focusableComponents[focusKey];
|
|
3771
|
+
while (currentComponent) {
|
|
3772
|
+
const parentFocusKey = currentComponent.parentFocusKey;
|
|
3773
|
+
const parentComponent = parentFocusKey ? this.focusableComponents[parentFocusKey] : void 0;
|
|
3774
|
+
if (parentComponent) {
|
|
3775
|
+
parents.push(parentComponent.focusKey);
|
|
3776
|
+
}
|
|
3777
|
+
currentComponent = parentComponent;
|
|
3778
|
+
}
|
|
3779
|
+
const parentsToRemoveFlag = difference(this.parentsHavingFocusedChild, parents);
|
|
3780
|
+
const parentsToAddFlag = difference(parents, this.parentsHavingFocusedChild);
|
|
3781
|
+
forEach(parentsToRemoveFlag, (parentFocusKey) => {
|
|
3782
|
+
const parentComponent = this.focusableComponents[parentFocusKey];
|
|
3783
|
+
if (parentComponent && parentComponent.trackChildren) {
|
|
3784
|
+
parentComponent.onUpdateHasFocusedChild(false);
|
|
3785
|
+
}
|
|
3786
|
+
this.onIntermediateNodeBecameBlurred(parentFocusKey, focusDetails);
|
|
3787
|
+
});
|
|
3788
|
+
forEach(parentsToAddFlag, (parentFocusKey) => {
|
|
3789
|
+
const parentComponent = this.focusableComponents[parentFocusKey];
|
|
3790
|
+
if (parentComponent && parentComponent.trackChildren) {
|
|
3791
|
+
parentComponent.onUpdateHasFocusedChild(true);
|
|
3792
|
+
}
|
|
3793
|
+
this.onIntermediateNodeBecameFocused(parentFocusKey, focusDetails);
|
|
3794
|
+
});
|
|
3795
|
+
this.parentsHavingFocusedChild = parents;
|
|
3796
|
+
}
|
|
3797
|
+
updateParentsLastFocusedChild(focusKey) {
|
|
3798
|
+
let currentComponent = this.focusableComponents[focusKey];
|
|
3799
|
+
while (currentComponent) {
|
|
3800
|
+
const parentFocusKey = currentComponent.parentFocusKey;
|
|
3801
|
+
const parentComponent = parentFocusKey ? this.focusableComponents[parentFocusKey] : void 0;
|
|
3802
|
+
if (parentComponent) {
|
|
3803
|
+
this.saveLastFocusedChildKey(parentComponent, currentComponent.focusKey);
|
|
3804
|
+
}
|
|
3805
|
+
currentComponent = parentComponent;
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
getKeyMap() {
|
|
3809
|
+
return this.keyMap;
|
|
3810
|
+
}
|
|
3811
|
+
setKeyMap(keyMap) {
|
|
3812
|
+
this.keyMap = {
|
|
3813
|
+
...this.getKeyMap(),
|
|
3814
|
+
...normalizeKeyMap(keyMap)
|
|
3815
|
+
};
|
|
3816
|
+
}
|
|
3817
|
+
isFocusableComponent(focusKey) {
|
|
3818
|
+
return !!this.focusableComponents[focusKey];
|
|
3819
|
+
}
|
|
3820
|
+
/**
|
|
3821
|
+
* Checks whether the focusableComponent is actually participating in spatial navigation (in other words, is a
|
|
3822
|
+
* 'focusable' focusableComponent). Seems less confusing than calling it isFocusableFocusableComponent()
|
|
3823
|
+
*/
|
|
3824
|
+
isParticipatingFocusableComponent(focusKey) {
|
|
3825
|
+
return this.isFocusableComponent(focusKey) && this.focusableComponents[focusKey].focusable;
|
|
3826
|
+
}
|
|
3827
|
+
onIntermediateNodeBecameFocused(focusKey, focusDetails) {
|
|
3828
|
+
if (this.isParticipatingFocusableComponent(focusKey)) {
|
|
3829
|
+
const layout = this.getNodeLayoutByFocusKey(focusKey);
|
|
3830
|
+
if (!layout) {
|
|
3831
|
+
return;
|
|
3832
|
+
}
|
|
3833
|
+
this.focusableComponents[focusKey].onFocus(layout, focusDetails);
|
|
3834
|
+
}
|
|
3835
|
+
}
|
|
3836
|
+
onIntermediateNodeBecameBlurred(focusKey, focusDetails) {
|
|
3837
|
+
if (this.isParticipatingFocusableComponent(focusKey)) {
|
|
3838
|
+
const layout = this.getNodeLayoutByFocusKey(focusKey);
|
|
3839
|
+
if (!layout) {
|
|
3840
|
+
return;
|
|
3841
|
+
}
|
|
3842
|
+
this.focusableComponents[focusKey].onBlur(layout, focusDetails);
|
|
3843
|
+
}
|
|
3844
|
+
}
|
|
3845
|
+
pause() {
|
|
3846
|
+
this.paused = true;
|
|
3847
|
+
}
|
|
3848
|
+
resume() {
|
|
3849
|
+
this.paused = false;
|
|
3850
|
+
}
|
|
3851
|
+
setFocus(focusKey, focusDetails = {}) {
|
|
3852
|
+
this.setFocusDebounced.cancel();
|
|
3853
|
+
if (!this.enabled) {
|
|
3854
|
+
return;
|
|
3855
|
+
}
|
|
3856
|
+
this.log("setFocus", "focusKey", focusKey);
|
|
3857
|
+
const focusKeyToSet = !focusKey || focusKey === ROOT_FOCUS_KEY ? this.getForcedFocusKey() : focusKey;
|
|
3858
|
+
if (!focusKeyToSet) {
|
|
3859
|
+
return;
|
|
3860
|
+
}
|
|
3861
|
+
const newFocusKey = this.getNextFocusKey(focusKeyToSet);
|
|
3862
|
+
this.log("setFocus", "newFocusKey", newFocusKey);
|
|
3863
|
+
this.setCurrentFocusedKey(newFocusKey, focusDetails);
|
|
3864
|
+
this.updateParentsHasFocusedChild(newFocusKey, focusDetails);
|
|
3865
|
+
this.updateParentsLastFocusedChild(newFocusKey);
|
|
3866
|
+
}
|
|
3867
|
+
updateAllLayouts() {
|
|
3868
|
+
if (!this.enabled || this.nativeMode) {
|
|
3869
|
+
return;
|
|
3870
|
+
}
|
|
3871
|
+
forOwn(this.focusableComponents, (component, focusKey) => {
|
|
3872
|
+
this.updateLayout(focusKey);
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
3875
|
+
updateLayout(focusKey) {
|
|
3876
|
+
const component = this.focusableComponents[focusKey];
|
|
3877
|
+
if (!component || this.nativeMode || component.layoutUpdated) {
|
|
3878
|
+
return;
|
|
3879
|
+
}
|
|
3880
|
+
const {
|
|
3881
|
+
node
|
|
3882
|
+
} = component;
|
|
3883
|
+
const layoutReferenceNode = this.getLayoutReferenceNode(node);
|
|
3884
|
+
const layout = this.useGetBoundingClientRect ? getBoundingClientRect(layoutReferenceNode) : measureLayout(layoutReferenceNode);
|
|
3885
|
+
component.layout = {
|
|
3886
|
+
...layout,
|
|
3887
|
+
node
|
|
3888
|
+
};
|
|
3889
|
+
component.layoutUpdated = true;
|
|
3890
|
+
}
|
|
3891
|
+
updateFocusable(focusKey, {
|
|
3892
|
+
node,
|
|
3893
|
+
parentFocusKey,
|
|
3894
|
+
preferredChildFocusKey,
|
|
3895
|
+
saveLastFocusedChild,
|
|
3896
|
+
trackChildren,
|
|
3897
|
+
focusable,
|
|
3898
|
+
isFocusBoundary,
|
|
3899
|
+
focusBoundaryDirections,
|
|
3900
|
+
autoRestoreFocus,
|
|
3901
|
+
forceFocus,
|
|
3902
|
+
onEnterPress,
|
|
3903
|
+
onEnterRelease,
|
|
3904
|
+
onArrowPress,
|
|
3905
|
+
onArrowRelease,
|
|
3906
|
+
onFocus,
|
|
3907
|
+
onBlur
|
|
3908
|
+
}) {
|
|
3909
|
+
if (this.nativeMode) {
|
|
3910
|
+
return;
|
|
3911
|
+
}
|
|
3912
|
+
const component = this.focusableComponents[focusKey];
|
|
3913
|
+
if (component) {
|
|
3914
|
+
const previousParentFocusKey = component.parentFocusKey;
|
|
3915
|
+
component.parentFocusKey = parentFocusKey;
|
|
3916
|
+
component.preferredChildFocusKey = preferredChildFocusKey;
|
|
3917
|
+
component.saveLastFocusedChild = saveLastFocusedChild;
|
|
3918
|
+
component.trackChildren = trackChildren;
|
|
3919
|
+
component.focusable = focusable;
|
|
3920
|
+
component.isFocusBoundary = isFocusBoundary;
|
|
3921
|
+
component.focusBoundaryDirections = focusBoundaryDirections;
|
|
3922
|
+
component.autoRestoreFocus = autoRestoreFocus;
|
|
3923
|
+
component.forceFocus = forceFocus;
|
|
3924
|
+
component.onEnterPress = onEnterPress;
|
|
3925
|
+
component.onEnterRelease = onEnterRelease;
|
|
3926
|
+
component.onArrowPress = onArrowPress;
|
|
3927
|
+
component.onArrowRelease = onArrowRelease;
|
|
3928
|
+
component.onFocus = onFocus;
|
|
3929
|
+
component.onBlur = onBlur;
|
|
3930
|
+
if (node) {
|
|
3931
|
+
component.node = node;
|
|
3932
|
+
}
|
|
3933
|
+
if (previousParentFocusKey !== parentFocusKey) {
|
|
3934
|
+
if (previousParentFocusKey) {
|
|
3935
|
+
const previousParentComponent = this.focusableComponents[previousParentFocusKey];
|
|
3936
|
+
if (previousParentComponent?.lastFocusedChildKey === focusKey) {
|
|
3937
|
+
previousParentComponent.lastFocusedChildKey = null;
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
const currentFocusKey = this.focusKey;
|
|
3941
|
+
let currentFocusedComponent = currentFocusKey ? this.focusableComponents[currentFocusKey] : void 0;
|
|
3942
|
+
while (currentFocusKey && currentFocusedComponent) {
|
|
3943
|
+
if (currentFocusedComponent.focusKey === focusKey) {
|
|
3944
|
+
this.updateParentsHasFocusedChild(currentFocusKey, {});
|
|
3945
|
+
this.updateParentsLastFocusedChild(currentFocusKey);
|
|
3946
|
+
break;
|
|
3947
|
+
}
|
|
3948
|
+
if (!currentFocusedComponent.parentFocusKey) {
|
|
3949
|
+
break;
|
|
3950
|
+
}
|
|
3951
|
+
currentFocusedComponent = this.focusableComponents[currentFocusedComponent.parentFocusKey];
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
component.layoutUpdated = false;
|
|
3955
|
+
this.makeNodeProgrammaticallyFocusable(component);
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
isNativeMode() {
|
|
3959
|
+
return this.nativeMode;
|
|
3960
|
+
}
|
|
3961
|
+
doesFocusableExist(focusKey) {
|
|
3962
|
+
return !!this.focusableComponents[focusKey];
|
|
3963
|
+
}
|
|
3964
|
+
/**
|
|
3965
|
+
* This function updates the writing direction
|
|
3966
|
+
* @param rtl whether the writing direction is right-to-left
|
|
3967
|
+
*/
|
|
3968
|
+
updateRtl(rtl) {
|
|
3969
|
+
this.writingDirection = rtl ? WritingDirection.RTL : WritingDirection.LTR;
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
const SpatialNavigation = new SpatialNavigationService();
|
|
3973
|
+
const {
|
|
3974
|
+
init,
|
|
3975
|
+
setThrottle,
|
|
3976
|
+
setVisualDebug,
|
|
3977
|
+
destroy,
|
|
3978
|
+
setKeyMap,
|
|
3979
|
+
setFocus,
|
|
3980
|
+
navigateByDirection,
|
|
3981
|
+
pause,
|
|
3982
|
+
resume,
|
|
3983
|
+
updateAllLayouts,
|
|
3984
|
+
getCurrentFocusKey,
|
|
3985
|
+
doesFocusableExist,
|
|
3986
|
+
updateRtl
|
|
3987
|
+
} = SpatialNavigation;
|
|
3988
|
+
const FocusContext = createContext(ROOT_FOCUS_KEY);
|
|
3989
|
+
FocusContext.displayName = "FocusContext";
|
|
3990
|
+
const useFocusContext = () => {
|
|
3991
|
+
return useContext(FocusContext);
|
|
3992
|
+
};
|
|
3993
|
+
const useFocusableHook = (t0) => {
|
|
3994
|
+
const $ = c(72);
|
|
3995
|
+
let t1;
|
|
3996
|
+
if ($[0] !== t0) {
|
|
3997
|
+
t1 = t0 === void 0 ? {} : t0;
|
|
3998
|
+
$[0] = t0;
|
|
3999
|
+
$[1] = t1;
|
|
4000
|
+
} else {
|
|
4001
|
+
t1 = $[1];
|
|
4002
|
+
}
|
|
4003
|
+
const {
|
|
4004
|
+
focusable: t2,
|
|
4005
|
+
saveLastFocusedChild: t3,
|
|
4006
|
+
trackChildren: t4,
|
|
4007
|
+
autoRestoreFocus: t5,
|
|
4008
|
+
forceFocus: t6,
|
|
4009
|
+
isFocusBoundary: t7,
|
|
4010
|
+
focusBoundaryDirections,
|
|
4011
|
+
focusKey: propFocusKey,
|
|
4012
|
+
preferredChildFocusKey,
|
|
4013
|
+
onEnterPress: t8,
|
|
4014
|
+
onEnterRelease: t9,
|
|
4015
|
+
onArrowPress: t10,
|
|
4016
|
+
onArrowRelease: t11,
|
|
4017
|
+
onFocus: t12,
|
|
4018
|
+
onBlur: t13,
|
|
4019
|
+
extraProps
|
|
4020
|
+
} = t1;
|
|
4021
|
+
const focusable = t2 === void 0 ? true : t2;
|
|
4022
|
+
const saveLastFocusedChild = t3 === void 0 ? true : t3;
|
|
4023
|
+
const trackChildren = t4 === void 0 ? false : t4;
|
|
4024
|
+
const autoRestoreFocus = t5 === void 0 ? true : t5;
|
|
4025
|
+
const forceFocus = t6 === void 0 ? false : t6;
|
|
4026
|
+
const isFocusBoundary = t7 === void 0 ? false : t7;
|
|
4027
|
+
const onEnterPress = t8 === void 0 ? noop : t8;
|
|
4028
|
+
const onEnterRelease = t9 === void 0 ? noop : t9;
|
|
4029
|
+
let t14;
|
|
4030
|
+
if ($[2] !== t10) {
|
|
4031
|
+
t14 = t10 === void 0 ? _temp : t10;
|
|
4032
|
+
$[2] = t10;
|
|
4033
|
+
$[3] = t14;
|
|
4034
|
+
} else {
|
|
4035
|
+
t14 = $[3];
|
|
4036
|
+
}
|
|
4037
|
+
const onArrowPress = t14;
|
|
4038
|
+
const onArrowRelease = t11 === void 0 ? noop : t11;
|
|
4039
|
+
const onFocus = t12 === void 0 ? noop : t12;
|
|
4040
|
+
const onBlur = t13 === void 0 ? noop : t13;
|
|
4041
|
+
let t15;
|
|
4042
|
+
if ($[4] !== extraProps || $[5] !== onEnterPress) {
|
|
4043
|
+
t15 = (details) => {
|
|
4044
|
+
if (!details) {
|
|
4045
|
+
return;
|
|
4046
|
+
}
|
|
4047
|
+
onEnterPress(extraProps, details);
|
|
4048
|
+
};
|
|
4049
|
+
$[4] = extraProps;
|
|
4050
|
+
$[5] = onEnterPress;
|
|
4051
|
+
$[6] = t15;
|
|
4052
|
+
} else {
|
|
4053
|
+
t15 = $[6];
|
|
4054
|
+
}
|
|
4055
|
+
const onEnterPressHandler = t15;
|
|
4056
|
+
let t16;
|
|
4057
|
+
if ($[7] !== extraProps || $[8] !== onEnterRelease) {
|
|
4058
|
+
t16 = () => {
|
|
4059
|
+
onEnterRelease(extraProps);
|
|
4060
|
+
};
|
|
4061
|
+
$[7] = extraProps;
|
|
4062
|
+
$[8] = onEnterRelease;
|
|
4063
|
+
$[9] = t16;
|
|
4064
|
+
} else {
|
|
4065
|
+
t16 = $[9];
|
|
4066
|
+
}
|
|
4067
|
+
const onEnterReleaseHandler = t16;
|
|
4068
|
+
let t17;
|
|
4069
|
+
if ($[10] !== extraProps || $[11] !== onArrowPress) {
|
|
4070
|
+
t17 = (direction, details_0) => onArrowPress(direction, extraProps, details_0);
|
|
4071
|
+
$[10] = extraProps;
|
|
4072
|
+
$[11] = onArrowPress;
|
|
4073
|
+
$[12] = t17;
|
|
4074
|
+
} else {
|
|
4075
|
+
t17 = $[12];
|
|
4076
|
+
}
|
|
4077
|
+
const onArrowPressHandler = t17;
|
|
4078
|
+
let t18;
|
|
4079
|
+
if ($[13] !== extraProps || $[14] !== onArrowRelease) {
|
|
4080
|
+
t18 = (direction_0) => {
|
|
4081
|
+
onArrowRelease(direction_0, extraProps);
|
|
4082
|
+
};
|
|
4083
|
+
$[13] = extraProps;
|
|
4084
|
+
$[14] = onArrowRelease;
|
|
4085
|
+
$[15] = t18;
|
|
4086
|
+
} else {
|
|
4087
|
+
t18 = $[15];
|
|
4088
|
+
}
|
|
4089
|
+
const onArrowReleaseHandler = t18;
|
|
4090
|
+
let t19;
|
|
4091
|
+
if ($[16] !== extraProps || $[17] !== onFocus) {
|
|
4092
|
+
t19 = (layout, details_1) => {
|
|
4093
|
+
onFocus(layout, extraProps, details_1);
|
|
4094
|
+
};
|
|
4095
|
+
$[16] = extraProps;
|
|
4096
|
+
$[17] = onFocus;
|
|
4097
|
+
$[18] = t19;
|
|
4098
|
+
} else {
|
|
4099
|
+
t19 = $[18];
|
|
4100
|
+
}
|
|
4101
|
+
const onFocusHandler = t19;
|
|
4102
|
+
let t20;
|
|
4103
|
+
if ($[19] !== extraProps || $[20] !== onBlur) {
|
|
4104
|
+
t20 = (layout_0, details_2) => {
|
|
4105
|
+
onBlur(layout_0, extraProps, details_2);
|
|
4106
|
+
};
|
|
4107
|
+
$[19] = extraProps;
|
|
4108
|
+
$[20] = onBlur;
|
|
4109
|
+
$[21] = t20;
|
|
4110
|
+
} else {
|
|
4111
|
+
t20 = $[21];
|
|
4112
|
+
}
|
|
4113
|
+
const onBlurHandler = t20;
|
|
4114
|
+
const ref = useRef(null);
|
|
4115
|
+
const registeredFocusKeyRef = useRef(null);
|
|
4116
|
+
const [focused, setFocused] = useState(false);
|
|
4117
|
+
const [hasFocusedChild, setHasFocusedChild] = useState(false);
|
|
4118
|
+
const parentFocusKey = useFocusContext();
|
|
4119
|
+
let t21;
|
|
4120
|
+
if ($[22] !== propFocusKey) {
|
|
4121
|
+
t21 = propFocusKey || uniqueId("sn:focusable-item-");
|
|
4122
|
+
$[22] = propFocusKey;
|
|
4123
|
+
$[23] = t21;
|
|
4124
|
+
} else {
|
|
4125
|
+
t21 = $[23];
|
|
4126
|
+
}
|
|
4127
|
+
const focusKey = t21;
|
|
4128
|
+
let t22;
|
|
4129
|
+
if ($[24] !== focusKey) {
|
|
4130
|
+
t22 = (t232) => {
|
|
4131
|
+
const focusDetails = t232 === void 0 ? {} : t232;
|
|
4132
|
+
SpatialNavigation.setFocus(focusKey, focusDetails);
|
|
4133
|
+
};
|
|
4134
|
+
$[24] = focusKey;
|
|
4135
|
+
$[25] = t22;
|
|
4136
|
+
} else {
|
|
4137
|
+
t22 = $[25];
|
|
4138
|
+
}
|
|
4139
|
+
const focusSelf = t22;
|
|
4140
|
+
let t23;
|
|
4141
|
+
if ($[26] !== autoRestoreFocus || $[27] !== focusBoundaryDirections || $[28] !== focusable || $[29] !== forceFocus || $[30] !== isFocusBoundary || $[31] !== onArrowPressHandler || $[32] !== onArrowReleaseHandler || $[33] !== onBlurHandler || $[34] !== onEnterPressHandler || $[35] !== onEnterReleaseHandler || $[36] !== onFocusHandler || $[37] !== parentFocusKey || $[38] !== preferredChildFocusKey || $[39] !== saveLastFocusedChild || $[40] !== trackChildren) {
|
|
4142
|
+
t23 = (registrationFocusKey) => {
|
|
4143
|
+
const node = ref.current;
|
|
4144
|
+
SpatialNavigation.addFocusable({
|
|
4145
|
+
focusKey: registrationFocusKey,
|
|
4146
|
+
node,
|
|
4147
|
+
parentFocusKey,
|
|
4148
|
+
preferredChildFocusKey,
|
|
4149
|
+
onEnterPress: onEnterPressHandler,
|
|
4150
|
+
onEnterRelease: onEnterReleaseHandler,
|
|
4151
|
+
onArrowPress: onArrowPressHandler,
|
|
4152
|
+
onArrowRelease: onArrowReleaseHandler,
|
|
4153
|
+
onFocus: onFocusHandler,
|
|
4154
|
+
onBlur: onBlurHandler,
|
|
4155
|
+
onUpdateFocus: (t242) => {
|
|
4156
|
+
const isFocused = t242 === void 0 ? false : t242;
|
|
4157
|
+
return setFocused(isFocused);
|
|
4158
|
+
},
|
|
4159
|
+
onUpdateHasFocusedChild: (t252) => {
|
|
4160
|
+
const isFocused_0 = t252 === void 0 ? false : t252;
|
|
4161
|
+
return setHasFocusedChild(isFocused_0);
|
|
4162
|
+
},
|
|
4163
|
+
saveLastFocusedChild,
|
|
4164
|
+
trackChildren,
|
|
4165
|
+
isFocusBoundary,
|
|
4166
|
+
focusBoundaryDirections,
|
|
4167
|
+
autoRestoreFocus,
|
|
4168
|
+
forceFocus,
|
|
4169
|
+
focusable
|
|
4170
|
+
});
|
|
4171
|
+
};
|
|
4172
|
+
$[26] = autoRestoreFocus;
|
|
4173
|
+
$[27] = focusBoundaryDirections;
|
|
4174
|
+
$[28] = focusable;
|
|
4175
|
+
$[29] = forceFocus;
|
|
4176
|
+
$[30] = isFocusBoundary;
|
|
4177
|
+
$[31] = onArrowPressHandler;
|
|
4178
|
+
$[32] = onArrowReleaseHandler;
|
|
4179
|
+
$[33] = onBlurHandler;
|
|
4180
|
+
$[34] = onEnterPressHandler;
|
|
4181
|
+
$[35] = onEnterReleaseHandler;
|
|
4182
|
+
$[36] = onFocusHandler;
|
|
4183
|
+
$[37] = parentFocusKey;
|
|
4184
|
+
$[38] = preferredChildFocusKey;
|
|
4185
|
+
$[39] = saveLastFocusedChild;
|
|
4186
|
+
$[40] = trackChildren;
|
|
4187
|
+
$[41] = t23;
|
|
4188
|
+
} else {
|
|
4189
|
+
t23 = $[41];
|
|
4190
|
+
}
|
|
4191
|
+
const registerFocusable = t23;
|
|
4192
|
+
let t24;
|
|
4193
|
+
if ($[42] !== focusKey || $[43] !== registerFocusable) {
|
|
4194
|
+
t24 = () => {
|
|
4195
|
+
const registeredFocusKey = registeredFocusKeyRef.current;
|
|
4196
|
+
if (!registeredFocusKey) {
|
|
4197
|
+
registerFocusable(focusKey);
|
|
4198
|
+
registeredFocusKeyRef.current = focusKey;
|
|
4199
|
+
return;
|
|
4200
|
+
}
|
|
4201
|
+
if (registeredFocusKey === focusKey) {
|
|
4202
|
+
return;
|
|
4203
|
+
}
|
|
4204
|
+
const wasFocused = SpatialNavigation.getCurrentFocusKey() === registeredFocusKey;
|
|
4205
|
+
SpatialNavigation.removeFocusable({
|
|
4206
|
+
focusKey: registeredFocusKey,
|
|
4207
|
+
skipFocusRestoration: true
|
|
4208
|
+
});
|
|
4209
|
+
registerFocusable(focusKey);
|
|
4210
|
+
registeredFocusKeyRef.current = focusKey;
|
|
4211
|
+
if (wasFocused) {
|
|
4212
|
+
SpatialNavigation.setFocus(focusKey);
|
|
4213
|
+
}
|
|
4214
|
+
};
|
|
4215
|
+
$[42] = focusKey;
|
|
4216
|
+
$[43] = registerFocusable;
|
|
4217
|
+
$[44] = t24;
|
|
4218
|
+
} else {
|
|
4219
|
+
t24 = $[44];
|
|
4220
|
+
}
|
|
4221
|
+
let t25;
|
|
4222
|
+
if ($[45] !== focusKey) {
|
|
4223
|
+
t25 = [focusKey];
|
|
4224
|
+
$[45] = focusKey;
|
|
4225
|
+
$[46] = t25;
|
|
4226
|
+
} else {
|
|
4227
|
+
t25 = $[46];
|
|
4228
|
+
}
|
|
4229
|
+
useEffect(t24, t25);
|
|
4230
|
+
let t26;
|
|
4231
|
+
let t27;
|
|
4232
|
+
if ($[47] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
4233
|
+
t26 = () => () => {
|
|
4234
|
+
const registeredFocusKey_0 = registeredFocusKeyRef.current;
|
|
4235
|
+
if (!registeredFocusKey_0) {
|
|
4236
|
+
return;
|
|
4237
|
+
}
|
|
4238
|
+
SpatialNavigation.removeFocusable({
|
|
4239
|
+
focusKey: registeredFocusKey_0
|
|
4240
|
+
});
|
|
4241
|
+
registeredFocusKeyRef.current = null;
|
|
4242
|
+
};
|
|
4243
|
+
t27 = [];
|
|
4244
|
+
$[47] = t26;
|
|
4245
|
+
$[48] = t27;
|
|
4246
|
+
} else {
|
|
4247
|
+
t26 = $[47];
|
|
4248
|
+
t27 = $[48];
|
|
4249
|
+
}
|
|
4250
|
+
useEffect(t26, t27);
|
|
4251
|
+
let t28;
|
|
4252
|
+
let t29;
|
|
4253
|
+
if ($[49] !== autoRestoreFocus || $[50] !== focusBoundaryDirections || $[51] !== focusKey || $[52] !== focusable || $[53] !== forceFocus || $[54] !== isFocusBoundary || $[55] !== onArrowPressHandler || $[56] !== onArrowReleaseHandler || $[57] !== onBlurHandler || $[58] !== onEnterPressHandler || $[59] !== onEnterReleaseHandler || $[60] !== onFocusHandler || $[61] !== parentFocusKey || $[62] !== preferredChildFocusKey || $[63] !== saveLastFocusedChild || $[64] !== trackChildren) {
|
|
4254
|
+
t28 = () => {
|
|
4255
|
+
const node_0 = ref.current;
|
|
4256
|
+
SpatialNavigation.updateFocusable(focusKey, {
|
|
4257
|
+
node: node_0,
|
|
4258
|
+
parentFocusKey,
|
|
4259
|
+
preferredChildFocusKey,
|
|
4260
|
+
saveLastFocusedChild,
|
|
4261
|
+
trackChildren,
|
|
4262
|
+
focusable,
|
|
4263
|
+
isFocusBoundary,
|
|
4264
|
+
focusBoundaryDirections,
|
|
4265
|
+
autoRestoreFocus,
|
|
4266
|
+
forceFocus,
|
|
4267
|
+
onEnterPress: onEnterPressHandler,
|
|
4268
|
+
onEnterRelease: onEnterReleaseHandler,
|
|
4269
|
+
onArrowPress: onArrowPressHandler,
|
|
4270
|
+
onArrowRelease: onArrowReleaseHandler,
|
|
4271
|
+
onFocus: onFocusHandler,
|
|
4272
|
+
onBlur: onBlurHandler
|
|
4273
|
+
});
|
|
4274
|
+
};
|
|
4275
|
+
t29 = [focusKey, parentFocusKey, preferredChildFocusKey, saveLastFocusedChild, trackChildren, focusable, isFocusBoundary, focusBoundaryDirections, autoRestoreFocus, forceFocus, onEnterPressHandler, onEnterReleaseHandler, onArrowPressHandler, onArrowReleaseHandler, onFocusHandler, onBlurHandler];
|
|
4276
|
+
$[49] = autoRestoreFocus;
|
|
4277
|
+
$[50] = focusBoundaryDirections;
|
|
4278
|
+
$[51] = focusKey;
|
|
4279
|
+
$[52] = focusable;
|
|
4280
|
+
$[53] = forceFocus;
|
|
4281
|
+
$[54] = isFocusBoundary;
|
|
4282
|
+
$[55] = onArrowPressHandler;
|
|
4283
|
+
$[56] = onArrowReleaseHandler;
|
|
4284
|
+
$[57] = onBlurHandler;
|
|
4285
|
+
$[58] = onEnterPressHandler;
|
|
4286
|
+
$[59] = onEnterReleaseHandler;
|
|
4287
|
+
$[60] = onFocusHandler;
|
|
4288
|
+
$[61] = parentFocusKey;
|
|
4289
|
+
$[62] = preferredChildFocusKey;
|
|
4290
|
+
$[63] = saveLastFocusedChild;
|
|
4291
|
+
$[64] = trackChildren;
|
|
4292
|
+
$[65] = t28;
|
|
4293
|
+
$[66] = t29;
|
|
4294
|
+
} else {
|
|
4295
|
+
t28 = $[65];
|
|
4296
|
+
t29 = $[66];
|
|
4297
|
+
}
|
|
4298
|
+
useEffect(t28, t29);
|
|
4299
|
+
let t30;
|
|
4300
|
+
if ($[67] !== focusKey || $[68] !== focusSelf || $[69] !== focused || $[70] !== hasFocusedChild) {
|
|
4301
|
+
t30 = {
|
|
4302
|
+
ref,
|
|
4303
|
+
focusSelf,
|
|
4304
|
+
focused,
|
|
4305
|
+
hasFocusedChild,
|
|
4306
|
+
focusKey
|
|
4307
|
+
};
|
|
4308
|
+
$[67] = focusKey;
|
|
4309
|
+
$[68] = focusSelf;
|
|
4310
|
+
$[69] = focused;
|
|
4311
|
+
$[70] = hasFocusedChild;
|
|
4312
|
+
$[71] = t30;
|
|
4313
|
+
} else {
|
|
4314
|
+
t30 = $[71];
|
|
4315
|
+
}
|
|
4316
|
+
return t30;
|
|
4317
|
+
};
|
|
4318
|
+
const useFocusable = useFocusableHook;
|
|
4319
|
+
function _temp() {
|
|
4320
|
+
return true;
|
|
4321
|
+
}
|
|
4322
|
+
export {
|
|
4323
|
+
FocusContext,
|
|
4324
|
+
ROOT_FOCUS_KEY,
|
|
4325
|
+
SpatialNavigation,
|
|
4326
|
+
destroy,
|
|
4327
|
+
doesFocusableExist,
|
|
4328
|
+
getCurrentFocusKey,
|
|
4329
|
+
init,
|
|
4330
|
+
navigateByDirection,
|
|
4331
|
+
pause,
|
|
4332
|
+
resume,
|
|
4333
|
+
setFocus,
|
|
4334
|
+
setKeyMap,
|
|
4335
|
+
setThrottle,
|
|
4336
|
+
setVisualDebug,
|
|
4337
|
+
updateAllLayouts,
|
|
4338
|
+
updateRtl,
|
|
4339
|
+
useFocusContext,
|
|
4340
|
+
useFocusable
|
|
4341
|
+
};
|
|
4342
|
+
//# sourceMappingURL=index.js.map
|