1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
28 |
|
29 | var check = function (it) {
|
30 | return it && it.Math == Math && it;
|
31 | };
|
32 |
|
33 |
|
34 | var global$i =
|
35 | check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) ||
|
36 | check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
37 | function () {
|
38 | return this;
|
39 | }() || Function('return this')();
|
40 |
|
41 | var objectGetOwnPropertyDescriptor = {};
|
42 |
|
43 | var fails$l = function (exec) {
|
44 | try {
|
45 | return !!exec();
|
46 | } catch (error) {
|
47 | return true;
|
48 | }
|
49 | };
|
50 |
|
51 | var fails$k = fails$l;
|
52 |
|
53 | var descriptors = !fails$k(function () {
|
54 |
|
55 | return Object.defineProperty({}, 1, {
|
56 | get: function () {
|
57 | return 7;
|
58 | }
|
59 | })[1] != 7;
|
60 | });
|
61 |
|
62 | var objectPropertyIsEnumerable = {};
|
63 |
|
64 | var $propertyIsEnumerable$1 = {}.propertyIsEnumerable;
|
65 |
|
66 | var getOwnPropertyDescriptor$5 = Object.getOwnPropertyDescriptor;
|
67 |
|
68 | var NASHORN_BUG = getOwnPropertyDescriptor$5 && !$propertyIsEnumerable$1.call({
|
69 | 1: 2
|
70 | }, 1);
|
71 |
|
72 |
|
73 | objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
74 | var descriptor = getOwnPropertyDescriptor$5(this, V);
|
75 | return !!descriptor && descriptor.enumerable;
|
76 | } : $propertyIsEnumerable$1;
|
77 |
|
78 | var createPropertyDescriptor$5 = function (bitmap, value) {
|
79 | return {
|
80 | enumerable: !(bitmap & 1),
|
81 | configurable: !(bitmap & 2),
|
82 | writable: !(bitmap & 4),
|
83 | value: value
|
84 | };
|
85 | };
|
86 |
|
87 | var toString$a = {}.toString;
|
88 |
|
89 | var classofRaw$1 = function (it) {
|
90 | return toString$a.call(it).slice(8, -1);
|
91 | };
|
92 |
|
93 | var fails$j = fails$l;
|
94 | var classof$b = classofRaw$1;
|
95 | var split = ''.split;
|
96 |
|
97 | var indexedObject = fails$j(function () {
|
98 |
|
99 |
|
100 | return !Object('z').propertyIsEnumerable(0);
|
101 | }) ? function (it) {
|
102 | return classof$b(it) == 'String' ? split.call(it, '') : Object(it);
|
103 | } : Object;
|
104 |
|
105 |
|
106 |
|
107 | var requireObjectCoercible$5 = function (it) {
|
108 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
109 | return it;
|
110 | };
|
111 |
|
112 | var IndexedObject$3 = indexedObject;
|
113 | var requireObjectCoercible$4 = requireObjectCoercible$5;
|
114 |
|
115 | var toIndexedObject$a = function (it) {
|
116 | return IndexedObject$3(requireObjectCoercible$4(it));
|
117 | };
|
118 |
|
119 | var isObject$f = function (it) {
|
120 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
121 | };
|
122 |
|
123 | var path$s = {};
|
124 |
|
125 | var path$r = path$s;
|
126 | var global$h = global$i;
|
127 |
|
128 | var aFunction$7 = function (variable) {
|
129 | return typeof variable == 'function' ? variable : undefined;
|
130 | };
|
131 |
|
132 | var getBuiltIn$8 = function (namespace, method) {
|
133 | return arguments.length < 2 ? aFunction$7(path$r[namespace]) || aFunction$7(global$h[namespace]) : path$r[namespace] && path$r[namespace][method] || global$h[namespace] && global$h[namespace][method];
|
134 | };
|
135 |
|
136 | var getBuiltIn$7 = getBuiltIn$8;
|
137 | var engineUserAgent = getBuiltIn$7('navigator', 'userAgent') || '';
|
138 |
|
139 | var global$g = global$i;
|
140 | var userAgent$3 = engineUserAgent;
|
141 | var process = global$g.process;
|
142 | var Deno = global$g.Deno;
|
143 | var versions = process && process.versions || Deno && Deno.version;
|
144 | var v8 = versions && versions.v8;
|
145 | var match, version;
|
146 |
|
147 | if (v8) {
|
148 | match = v8.split('.');
|
149 | version = match[0] < 4 ? 1 : match[0] + match[1];
|
150 | } else if (userAgent$3) {
|
151 | match = userAgent$3.match(/Edge\/(\d+)/);
|
152 |
|
153 | if (!match || match[1] >= 74) {
|
154 | match = userAgent$3.match(/Chrome\/(\d+)/);
|
155 | if (match) version = match[1];
|
156 | }
|
157 | }
|
158 |
|
159 | var engineV8Version = version && +version;
|
160 |
|
161 |
|
162 | var V8_VERSION$2 = engineV8Version;
|
163 | var fails$i = fails$l;
|
164 |
|
165 | var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$i(function () {
|
166 | var symbol = Symbol();
|
167 |
|
168 |
|
169 | return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
170 | !Symbol.sham && V8_VERSION$2 && V8_VERSION$2 < 41;
|
171 | });
|
172 |
|
173 |
|
174 | var NATIVE_SYMBOL$2 = nativeSymbol;
|
175 | var useSymbolAsUid = NATIVE_SYMBOL$2 && !Symbol.sham && typeof Symbol.iterator == 'symbol';
|
176 |
|
177 | var getBuiltIn$6 = getBuiltIn$8;
|
178 | var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
|
179 | var isSymbol$4 = USE_SYMBOL_AS_UID$1 ? function (it) {
|
180 | return typeof it == 'symbol';
|
181 | } : function (it) {
|
182 | var $Symbol = getBuiltIn$6('Symbol');
|
183 | return typeof $Symbol == 'function' && Object(it) instanceof $Symbol;
|
184 | };
|
185 |
|
186 | var isObject$e = isObject$f;
|
187 |
|
188 |
|
189 | var ordinaryToPrimitive$1 = function (input, pref) {
|
190 | var fn, val;
|
191 | if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject$e(val = fn.call(input))) return val;
|
192 | if (typeof (fn = input.valueOf) == 'function' && !isObject$e(val = fn.call(input))) return val;
|
193 | if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject$e(val = fn.call(input))) return val;
|
194 | throw TypeError("Can't convert object to primitive value");
|
195 | };
|
196 |
|
197 | var shared$4 = {exports: {}};
|
198 |
|
199 | var global$f = global$i;
|
200 |
|
201 | var setGlobal$1 = function (key, value) {
|
202 | try {
|
203 |
|
204 | Object.defineProperty(global$f, key, {
|
205 | value: value,
|
206 | configurable: true,
|
207 | writable: true
|
208 | });
|
209 | } catch (error) {
|
210 | global$f[key] = value;
|
211 | }
|
212 |
|
213 | return value;
|
214 | };
|
215 |
|
216 | var global$e = global$i;
|
217 | var setGlobal = setGlobal$1;
|
218 | var SHARED = '__core-js_shared__';
|
219 | var store$3 = global$e[SHARED] || setGlobal(SHARED, {});
|
220 | var sharedStore = store$3;
|
221 |
|
222 | var store$2 = sharedStore;
|
223 | (shared$4.exports = function (key, value) {
|
224 | return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
225 | })('versions', []).push({
|
226 | version: '3.16.1',
|
227 | mode: 'pure' ,
|
228 | copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
|
229 | });
|
230 |
|
231 | var requireObjectCoercible$3 = requireObjectCoercible$5;
|
232 |
|
233 |
|
234 | var toObject$e = function (argument) {
|
235 | return Object(requireObjectCoercible$3(argument));
|
236 | };
|
237 |
|
238 | var toObject$d = toObject$e;
|
239 | var hasOwnProperty = {}.hasOwnProperty;
|
240 |
|
241 | var has$b = Object.hasOwn || function hasOwn(it, key) {
|
242 | return hasOwnProperty.call(toObject$d(it), key);
|
243 | };
|
244 |
|
245 | var id$1 = 0;
|
246 | var postfix = Math.random();
|
247 |
|
248 | var uid$4 = function (key) {
|
249 | return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id$1 + postfix).toString(36);
|
250 | };
|
251 |
|
252 | var global$d = global$i;
|
253 | var shared$3 = shared$4.exports;
|
254 | var has$a = has$b;
|
255 | var uid$3 = uid$4;
|
256 | var NATIVE_SYMBOL$1 = nativeSymbol;
|
257 | var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
258 | var WellKnownSymbolsStore$1 = shared$3('wks');
|
259 | var Symbol$1 = global$d.Symbol;
|
260 | var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$3;
|
261 |
|
262 | var wellKnownSymbol$j = function (name) {
|
263 | if (!has$a(WellKnownSymbolsStore$1, name) || !(NATIVE_SYMBOL$1 || typeof WellKnownSymbolsStore$1[name] == 'string')) {
|
264 | if (NATIVE_SYMBOL$1 && has$a(Symbol$1, name)) {
|
265 | WellKnownSymbolsStore$1[name] = Symbol$1[name];
|
266 | } else {
|
267 | WellKnownSymbolsStore$1[name] = createWellKnownSymbol('Symbol.' + name);
|
268 | }
|
269 | }
|
270 |
|
271 | return WellKnownSymbolsStore$1[name];
|
272 | };
|
273 |
|
274 | var isObject$d = isObject$f;
|
275 | var isSymbol$3 = isSymbol$4;
|
276 | var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
277 | var wellKnownSymbol$i = wellKnownSymbol$j;
|
278 | var TO_PRIMITIVE$1 = wellKnownSymbol$i('toPrimitive');
|
279 |
|
280 |
|
281 | var toPrimitive$1 = function (input, pref) {
|
282 | if (!isObject$d(input) || isSymbol$3(input)) return input;
|
283 | var exoticToPrim = input[TO_PRIMITIVE$1];
|
284 | var result;
|
285 |
|
286 | if (exoticToPrim !== undefined) {
|
287 | if (pref === undefined) pref = 'default';
|
288 | result = exoticToPrim.call(input, pref);
|
289 | if (!isObject$d(result) || isSymbol$3(result)) return result;
|
290 | throw TypeError("Can't convert object to primitive value");
|
291 | }
|
292 |
|
293 | if (pref === undefined) pref = 'number';
|
294 | return ordinaryToPrimitive(input, pref);
|
295 | };
|
296 |
|
297 | var toPrimitive = toPrimitive$1;
|
298 | var isSymbol$2 = isSymbol$4;
|
299 |
|
300 |
|
301 | var toPropertyKey$4 = function (argument) {
|
302 | var key = toPrimitive(argument, 'string');
|
303 | return isSymbol$2(key) ? key : String(key);
|
304 | };
|
305 |
|
306 | var global$c = global$i;
|
307 | var isObject$c = isObject$f;
|
308 | var document$1 = global$c.document;
|
309 |
|
310 | var EXISTS = isObject$c(document$1) && isObject$c(document$1.createElement);
|
311 |
|
312 | var documentCreateElement$1 = function (it) {
|
313 | return EXISTS ? document$1.createElement(it) : {};
|
314 | };
|
315 |
|
316 | var DESCRIPTORS$f = descriptors;
|
317 | var fails$h = fails$l;
|
318 | var createElement = documentCreateElement$1;
|
319 |
|
320 | var ie8DomDefine = !DESCRIPTORS$f && !fails$h(function () {
|
321 |
|
322 | return Object.defineProperty(createElement('div'), 'a', {
|
323 | get: function () {
|
324 | return 7;
|
325 | }
|
326 | }).a != 7;
|
327 | });
|
328 |
|
329 | var DESCRIPTORS$e = descriptors;
|
330 | var propertyIsEnumerableModule$2 = objectPropertyIsEnumerable;
|
331 | var createPropertyDescriptor$4 = createPropertyDescriptor$5;
|
332 | var toIndexedObject$9 = toIndexedObject$a;
|
333 | var toPropertyKey$3 = toPropertyKey$4;
|
334 | var has$9 = has$b;
|
335 | var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
336 |
|
337 | var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
338 |
|
339 |
|
340 | objectGetOwnPropertyDescriptor.f = DESCRIPTORS$e ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
341 | O = toIndexedObject$9(O);
|
342 | P = toPropertyKey$3(P);
|
343 | if (IE8_DOM_DEFINE$1) try {
|
344 | return $getOwnPropertyDescriptor$1(O, P);
|
345 | } catch (error) {
|
346 |
|
347 | }
|
348 | if (has$9(O, P)) return createPropertyDescriptor$4(!propertyIsEnumerableModule$2.f.call(O, P), O[P]);
|
349 | };
|
350 |
|
351 | var fails$g = fails$l;
|
352 | var replacement = /#|\.prototype\./;
|
353 |
|
354 | var isForced$1 = function (feature, detection) {
|
355 | var value = data[normalize(feature)];
|
356 | return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails$g(detection) : !!detection;
|
357 | };
|
358 |
|
359 | var normalize = isForced$1.normalize = function (string) {
|
360 | return String(string).replace(replacement, '.').toLowerCase();
|
361 | };
|
362 |
|
363 | var data = isForced$1.data = {};
|
364 | var NATIVE = isForced$1.NATIVE = 'N';
|
365 | var POLYFILL = isForced$1.POLYFILL = 'P';
|
366 | var isForced_1 = isForced$1;
|
367 |
|
368 | var aFunction$6 = function (it) {
|
369 | if (typeof it != 'function') {
|
370 | throw TypeError(String(it) + ' is not a function');
|
371 | }
|
372 |
|
373 | return it;
|
374 | };
|
375 |
|
376 | var aFunction$5 = aFunction$6;
|
377 |
|
378 | var functionBindContext = function (fn, that, length) {
|
379 | aFunction$5(fn);
|
380 | if (that === undefined) return fn;
|
381 |
|
382 | switch (length) {
|
383 | case 0:
|
384 | return function () {
|
385 | return fn.call(that);
|
386 | };
|
387 |
|
388 | case 1:
|
389 | return function (a) {
|
390 | return fn.call(that, a);
|
391 | };
|
392 |
|
393 | case 2:
|
394 | return function (a, b) {
|
395 | return fn.call(that, a, b);
|
396 | };
|
397 |
|
398 | case 3:
|
399 | return function (a, b, c) {
|
400 | return fn.call(that, a, b, c);
|
401 | };
|
402 | }
|
403 |
|
404 | return function () {
|
405 | return fn.apply(that, arguments);
|
406 | };
|
407 | };
|
408 |
|
409 | var objectDefineProperty = {};
|
410 |
|
411 | var isObject$b = isObject$f;
|
412 |
|
413 | var anObject$b = function (it) {
|
414 | if (!isObject$b(it)) {
|
415 | throw TypeError(String(it) + ' is not an object');
|
416 | }
|
417 |
|
418 | return it;
|
419 | };
|
420 |
|
421 | var DESCRIPTORS$d = descriptors;
|
422 | var IE8_DOM_DEFINE = ie8DomDefine;
|
423 | var anObject$a = anObject$b;
|
424 | var toPropertyKey$2 = toPropertyKey$4;
|
425 |
|
426 | var $defineProperty$1 = Object.defineProperty;
|
427 |
|
428 |
|
429 | objectDefineProperty.f = DESCRIPTORS$d ? $defineProperty$1 : function defineProperty(O, P, Attributes) {
|
430 | anObject$a(O);
|
431 | P = toPropertyKey$2(P);
|
432 | anObject$a(Attributes);
|
433 | if (IE8_DOM_DEFINE) try {
|
434 | return $defineProperty$1(O, P, Attributes);
|
435 | } catch (error) {
|
436 |
|
437 | }
|
438 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
439 | if ('value' in Attributes) O[P] = Attributes.value;
|
440 | return O;
|
441 | };
|
442 |
|
443 | var DESCRIPTORS$c = descriptors;
|
444 | var definePropertyModule$4 = objectDefineProperty;
|
445 | var createPropertyDescriptor$3 = createPropertyDescriptor$5;
|
446 | var createNonEnumerableProperty$9 = DESCRIPTORS$c ? function (object, key, value) {
|
447 | return definePropertyModule$4.f(object, key, createPropertyDescriptor$3(1, value));
|
448 | } : function (object, key, value) {
|
449 | object[key] = value;
|
450 | return object;
|
451 | };
|
452 |
|
453 | var global$b = global$i;
|
454 | var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f;
|
455 | var isForced = isForced_1;
|
456 | var path$q = path$s;
|
457 | var bind$b = functionBindContext;
|
458 | var createNonEnumerableProperty$8 = createNonEnumerableProperty$9;
|
459 | var has$8 = has$b;
|
460 |
|
461 | var wrapConstructor = function (NativeConstructor) {
|
462 | var Wrapper = function (a, b, c) {
|
463 | if (this instanceof NativeConstructor) {
|
464 | switch (arguments.length) {
|
465 | case 0:
|
466 | return new NativeConstructor();
|
467 |
|
468 | case 1:
|
469 | return new NativeConstructor(a);
|
470 |
|
471 | case 2:
|
472 | return new NativeConstructor(a, b);
|
473 | }
|
474 |
|
475 | return new NativeConstructor(a, b, c);
|
476 | }
|
477 |
|
478 | return NativeConstructor.apply(this, arguments);
|
479 | };
|
480 |
|
481 | Wrapper.prototype = NativeConstructor.prototype;
|
482 | return Wrapper;
|
483 | };
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 | var _export = function (options, source) {
|
501 | var TARGET = options.target;
|
502 | var GLOBAL = options.global;
|
503 | var STATIC = options.stat;
|
504 | var PROTO = options.proto;
|
505 | var nativeSource = GLOBAL ? global$b : STATIC ? global$b[TARGET] : (global$b[TARGET] || {}).prototype;
|
506 | var target = GLOBAL ? path$q : path$q[TARGET] || (path$q[TARGET] = {});
|
507 | var targetPrototype = target.prototype;
|
508 | var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
|
509 | var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
|
510 |
|
511 | for (key in source) {
|
512 | FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
513 |
|
514 | USE_NATIVE = !FORCED && nativeSource && has$8(nativeSource, key);
|
515 | targetProperty = target[key];
|
516 | if (USE_NATIVE) if (options.noTargetGet) {
|
517 | descriptor = getOwnPropertyDescriptor$4(nativeSource, key);
|
518 | nativeProperty = descriptor && descriptor.value;
|
519 | } else nativeProperty = nativeSource[key];
|
520 |
|
521 | sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key];
|
522 | if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue;
|
523 |
|
524 | if (options.bind && USE_NATIVE) resultProperty = bind$b(sourceProperty, global$b);
|
525 | else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
|
526 | else if (PROTO && typeof sourceProperty == 'function') resultProperty = bind$b(Function.call, sourceProperty);
|
527 | else resultProperty = sourceProperty;
|
528 |
|
529 | if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) {
|
530 | createNonEnumerableProperty$8(resultProperty, 'sham', true);
|
531 | }
|
532 |
|
533 | target[key] = resultProperty;
|
534 |
|
535 | if (PROTO) {
|
536 | VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
|
537 |
|
538 | if (!has$8(path$q, VIRTUAL_PROTOTYPE)) {
|
539 | createNonEnumerableProperty$8(path$q, VIRTUAL_PROTOTYPE, {});
|
540 | }
|
541 |
|
542 |
|
543 | path$q[VIRTUAL_PROTOTYPE][key] = sourceProperty;
|
544 |
|
545 | if (options.real && targetPrototype && !targetPrototype[key]) {
|
546 | createNonEnumerableProperty$8(targetPrototype, key, sourceProperty);
|
547 | }
|
548 | }
|
549 | }
|
550 | };
|
551 |
|
552 | var classof$a = classofRaw$1;
|
553 |
|
554 |
|
555 |
|
556 | var isArray$c = Array.isArray || function isArray(arg) {
|
557 | return classof$a(arg) == 'Array';
|
558 | };
|
559 |
|
560 | var ceil = Math.ceil;
|
561 | var floor$1 = Math.floor;
|
562 |
|
563 |
|
564 | var toInteger$4 = function (argument) {
|
565 | return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument);
|
566 | };
|
567 |
|
568 | var toInteger$3 = toInteger$4;
|
569 | var min$2 = Math.min;
|
570 |
|
571 |
|
572 | var toLength$c = function (argument) {
|
573 | return argument > 0 ? min$2(toInteger$3(argument), 0x1FFFFFFFFFFFFF) : 0;
|
574 | };
|
575 |
|
576 | var toPropertyKey$1 = toPropertyKey$4;
|
577 | var definePropertyModule$3 = objectDefineProperty;
|
578 | var createPropertyDescriptor$2 = createPropertyDescriptor$5;
|
579 |
|
580 | var createProperty$5 = function (object, key, value) {
|
581 | var propertyKey = toPropertyKey$1(key);
|
582 | if (propertyKey in object) definePropertyModule$3.f(object, propertyKey, createPropertyDescriptor$2(0, value));else object[propertyKey] = value;
|
583 | };
|
584 |
|
585 | var isObject$a = isObject$f;
|
586 | var isArray$b = isArray$c;
|
587 | var wellKnownSymbol$h = wellKnownSymbol$j;
|
588 | var SPECIES$3 = wellKnownSymbol$h('species');
|
589 |
|
590 |
|
591 | var arraySpeciesConstructor$1 = function (originalArray) {
|
592 | var C;
|
593 |
|
594 | if (isArray$b(originalArray)) {
|
595 | C = originalArray.constructor;
|
596 |
|
597 | if (typeof C == 'function' && (C === Array || isArray$b(C.prototype))) C = undefined;else if (isObject$a(C)) {
|
598 | C = C[SPECIES$3];
|
599 | if (C === null) C = undefined;
|
600 | }
|
601 | }
|
602 |
|
603 | return C === undefined ? Array : C;
|
604 | };
|
605 |
|
606 | var arraySpeciesConstructor = arraySpeciesConstructor$1;
|
607 |
|
608 |
|
609 | var arraySpeciesCreate$4 = function (originalArray, length) {
|
610 | return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
611 | };
|
612 |
|
613 | var fails$f = fails$l;
|
614 | var wellKnownSymbol$g = wellKnownSymbol$j;
|
615 | var V8_VERSION$1 = engineV8Version;
|
616 | var SPECIES$2 = wellKnownSymbol$g('species');
|
617 |
|
618 | var arrayMethodHasSpeciesSupport$5 = function (METHOD_NAME) {
|
619 |
|
620 |
|
621 |
|
622 | return V8_VERSION$1 >= 51 || !fails$f(function () {
|
623 | var array = [];
|
624 | var constructor = array.constructor = {};
|
625 |
|
626 | constructor[SPECIES$2] = function () {
|
627 | return {
|
628 | foo: 1
|
629 | };
|
630 | };
|
631 |
|
632 | return array[METHOD_NAME](Boolean).foo !== 1;
|
633 | });
|
634 | };
|
635 |
|
636 | var $$F = _export;
|
637 | var fails$e = fails$l;
|
638 | var isArray$a = isArray$c;
|
639 | var isObject$9 = isObject$f;
|
640 | var toObject$c = toObject$e;
|
641 | var toLength$b = toLength$c;
|
642 | var createProperty$4 = createProperty$5;
|
643 | var arraySpeciesCreate$3 = arraySpeciesCreate$4;
|
644 | var arrayMethodHasSpeciesSupport$4 = arrayMethodHasSpeciesSupport$5;
|
645 | var wellKnownSymbol$f = wellKnownSymbol$j;
|
646 | var V8_VERSION = engineV8Version;
|
647 | var IS_CONCAT_SPREADABLE = wellKnownSymbol$f('isConcatSpreadable');
|
648 | var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
|
649 | var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
650 |
|
651 |
|
652 |
|
653 | var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails$e(function () {
|
654 | var array = [];
|
655 | array[IS_CONCAT_SPREADABLE] = false;
|
656 | return array.concat()[0] !== array;
|
657 | });
|
658 | var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$4('concat');
|
659 |
|
660 | var isConcatSpreadable = function (O) {
|
661 | if (!isObject$9(O)) return false;
|
662 | var spreadable = O[IS_CONCAT_SPREADABLE];
|
663 | return spreadable !== undefined ? !!spreadable : isArray$a(O);
|
664 | };
|
665 |
|
666 | var FORCED$6 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
667 |
|
668 |
|
669 |
|
670 | $$F({
|
671 | target: 'Array',
|
672 | proto: true,
|
673 | forced: FORCED$6
|
674 | }, {
|
675 |
|
676 | concat: function concat(arg) {
|
677 | var O = toObject$c(this);
|
678 | var A = arraySpeciesCreate$3(O, 0);
|
679 | var n = 0;
|
680 | var i, k, length, len, E;
|
681 |
|
682 | for (i = -1, length = arguments.length; i < length; i++) {
|
683 | E = i === -1 ? O : arguments[i];
|
684 |
|
685 | if (isConcatSpreadable(E)) {
|
686 | len = toLength$b(E.length);
|
687 | if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
688 |
|
689 | for (k = 0; k < len; k++, n++) if (k in E) createProperty$4(A, n, E[k]);
|
690 | } else {
|
691 | if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
692 | createProperty$4(A, n++, E);
|
693 | }
|
694 | }
|
695 |
|
696 | A.length = n;
|
697 | return A;
|
698 | }
|
699 | });
|
700 |
|
701 | var isSymbol$1 = isSymbol$4;
|
702 |
|
703 | var toString$9 = function (argument) {
|
704 | if (isSymbol$1(argument)) throw TypeError('Cannot convert a Symbol value to a string');
|
705 | return String(argument);
|
706 | };
|
707 |
|
708 | var toInteger$2 = toInteger$4;
|
709 | var max$2 = Math.max;
|
710 | var min$1 = Math.min;
|
711 |
|
712 |
|
713 |
|
714 | var toAbsoluteIndex$4 = function (index, length) {
|
715 | var integer = toInteger$2(index);
|
716 | return integer < 0 ? max$2(integer + length, 0) : min$1(integer, length);
|
717 | };
|
718 |
|
719 | var toIndexedObject$8 = toIndexedObject$a;
|
720 | var toLength$a = toLength$c;
|
721 | var toAbsoluteIndex$3 = toAbsoluteIndex$4;
|
722 |
|
723 | var createMethod$5 = function (IS_INCLUDES) {
|
724 | return function ($this, el, fromIndex) {
|
725 | var O = toIndexedObject$8($this);
|
726 | var length = toLength$a(O.length);
|
727 | var index = toAbsoluteIndex$3(fromIndex, length);
|
728 | var value;
|
729 |
|
730 |
|
731 | if (IS_INCLUDES && el != el) while (length > index) {
|
732 | value = O[index++];
|
733 |
|
734 | if (value != value) return true;
|
735 | } else for (; length > index; index++) {
|
736 | if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
737 | }
|
738 | return !IS_INCLUDES && -1;
|
739 | };
|
740 | };
|
741 |
|
742 | var arrayIncludes$1 = {
|
743 |
|
744 |
|
745 | includes: createMethod$5(true),
|
746 |
|
747 |
|
748 | indexOf: createMethod$5(false)
|
749 | };
|
750 |
|
751 | var hiddenKeys$6 = {};
|
752 |
|
753 | var has$7 = has$b;
|
754 | var toIndexedObject$7 = toIndexedObject$a;
|
755 | var indexOf$4 = arrayIncludes$1.indexOf;
|
756 | var hiddenKeys$5 = hiddenKeys$6;
|
757 |
|
758 | var objectKeysInternal = function (object, names) {
|
759 | var O = toIndexedObject$7(object);
|
760 | var i = 0;
|
761 | var result = [];
|
762 | var key;
|
763 |
|
764 | for (key in O) !has$7(hiddenKeys$5, key) && has$7(O, key) && result.push(key);
|
765 |
|
766 |
|
767 | while (names.length > i) if (has$7(O, key = names[i++])) {
|
768 | ~indexOf$4(result, key) || result.push(key);
|
769 | }
|
770 |
|
771 | return result;
|
772 | };
|
773 |
|
774 | var enumBugKeys$3 = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'];
|
775 |
|
776 | var internalObjectKeys$1 = objectKeysInternal;
|
777 | var enumBugKeys$2 = enumBugKeys$3;
|
778 |
|
779 |
|
780 |
|
781 | var objectKeys$4 = Object.keys || function keys(O) {
|
782 | return internalObjectKeys$1(O, enumBugKeys$2);
|
783 | };
|
784 |
|
785 | var DESCRIPTORS$b = descriptors;
|
786 | var definePropertyModule$2 = objectDefineProperty;
|
787 | var anObject$9 = anObject$b;
|
788 | var objectKeys$3 = objectKeys$4;
|
789 |
|
790 |
|
791 |
|
792 | var objectDefineProperties = DESCRIPTORS$b ? Object.defineProperties : function defineProperties(O, Properties) {
|
793 | anObject$9(O);
|
794 | var keys = objectKeys$3(Properties);
|
795 | var length = keys.length;
|
796 | var index = 0;
|
797 | var key;
|
798 |
|
799 | while (length > index) definePropertyModule$2.f(O, key = keys[index++], Properties[key]);
|
800 |
|
801 | return O;
|
802 | };
|
803 |
|
804 | var getBuiltIn$5 = getBuiltIn$8;
|
805 | var html$1 = getBuiltIn$5('document', 'documentElement');
|
806 |
|
807 | var shared$2 = shared$4.exports;
|
808 | var uid$2 = uid$4;
|
809 | var keys$7 = shared$2('keys');
|
810 |
|
811 | var sharedKey$4 = function (key) {
|
812 | return keys$7[key] || (keys$7[key] = uid$2(key));
|
813 | };
|
814 |
|
815 |
|
816 | var anObject$8 = anObject$b;
|
817 | var defineProperties$5 = objectDefineProperties;
|
818 | var enumBugKeys$1 = enumBugKeys$3;
|
819 | var hiddenKeys$4 = hiddenKeys$6;
|
820 | var html = html$1;
|
821 | var documentCreateElement = documentCreateElement$1;
|
822 | var sharedKey$3 = sharedKey$4;
|
823 | var GT = '>';
|
824 | var LT = '<';
|
825 | var PROTOTYPE$1 = 'prototype';
|
826 | var SCRIPT = 'script';
|
827 | var IE_PROTO$1 = sharedKey$3('IE_PROTO');
|
828 |
|
829 | var EmptyConstructor = function () {
|
830 |
|
831 | };
|
832 |
|
833 | var scriptTag = function (content) {
|
834 | return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
835 | };
|
836 |
|
837 |
|
838 | var NullProtoObjectViaActiveX = function (activeXDocument) {
|
839 | activeXDocument.write(scriptTag(''));
|
840 | activeXDocument.close();
|
841 | var temp = activeXDocument.parentWindow.Object;
|
842 | activeXDocument = null;
|
843 |
|
844 | return temp;
|
845 | };
|
846 |
|
847 |
|
848 | var NullProtoObjectViaIFrame = function () {
|
849 |
|
850 | var iframe = documentCreateElement('iframe');
|
851 | var JS = 'java' + SCRIPT + ':';
|
852 | var iframeDocument;
|
853 |
|
854 | if (iframe.style) {
|
855 | iframe.style.display = 'none';
|
856 | html.appendChild(iframe);
|
857 |
|
858 | iframe.src = String(JS);
|
859 | iframeDocument = iframe.contentWindow.document;
|
860 | iframeDocument.open();
|
861 | iframeDocument.write(scriptTag('document.F=Object'));
|
862 | iframeDocument.close();
|
863 | return iframeDocument.F;
|
864 | }
|
865 | };
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 | var activeXDocument;
|
873 |
|
874 | var NullProtoObject = function () {
|
875 | try {
|
876 | activeXDocument = new ActiveXObject('htmlfile');
|
877 | } catch (error) {
|
878 |
|
879 | }
|
880 |
|
881 | NullProtoObject = document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) :
|
882 | NullProtoObjectViaIFrame() || NullProtoObjectViaActiveX(activeXDocument);
|
883 |
|
884 | var length = enumBugKeys$1.length;
|
885 |
|
886 | while (length--) delete NullProtoObject[PROTOTYPE$1][enumBugKeys$1[length]];
|
887 |
|
888 | return NullProtoObject();
|
889 | };
|
890 |
|
891 | hiddenKeys$4[IE_PROTO$1] = true;
|
892 |
|
893 |
|
894 | var objectCreate = Object.create || function create(O, Properties) {
|
895 | var result;
|
896 |
|
897 | if (O !== null) {
|
898 | EmptyConstructor[PROTOTYPE$1] = anObject$8(O);
|
899 | result = new EmptyConstructor();
|
900 | EmptyConstructor[PROTOTYPE$1] = null;
|
901 |
|
902 | result[IE_PROTO$1] = O;
|
903 | } else result = NullProtoObject();
|
904 |
|
905 | return Properties === undefined ? result : defineProperties$5(result, Properties);
|
906 | };
|
907 |
|
908 | var objectGetOwnPropertyNames = {};
|
909 |
|
910 | var internalObjectKeys = objectKeysInternal;
|
911 | var enumBugKeys = enumBugKeys$3;
|
912 | var hiddenKeys$3 = enumBugKeys.concat('length', 'prototype');
|
913 |
|
914 |
|
915 |
|
916 | objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
917 | return internalObjectKeys(O, hiddenKeys$3);
|
918 | };
|
919 |
|
920 | var objectGetOwnPropertyNamesExternal = {};
|
921 |
|
922 |
|
923 | var toIndexedObject$6 = toIndexedObject$a;
|
924 | var $getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
|
925 | var toString$8 = {}.toString;
|
926 | var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
|
927 |
|
928 | var getWindowNames = function (it) {
|
929 | try {
|
930 | return $getOwnPropertyNames$1(it);
|
931 | } catch (error) {
|
932 | return windowNames.slice();
|
933 | }
|
934 | };
|
935 |
|
936 |
|
937 | objectGetOwnPropertyNamesExternal.f = function getOwnPropertyNames(it) {
|
938 | return windowNames && toString$8.call(it) == '[object Window]' ? getWindowNames(it) : $getOwnPropertyNames$1(toIndexedObject$6(it));
|
939 | };
|
940 |
|
941 | var objectGetOwnPropertySymbols = {};
|
942 |
|
943 | objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
944 |
|
945 | var createNonEnumerableProperty$7 = createNonEnumerableProperty$9;
|
946 |
|
947 | var redefine$3 = function (target, key, value, options) {
|
948 | if (options && options.enumerable) target[key] = value;else createNonEnumerableProperty$7(target, key, value);
|
949 | };
|
950 |
|
951 | var wellKnownSymbolWrapped = {};
|
952 |
|
953 | var wellKnownSymbol$e = wellKnownSymbol$j;
|
954 | wellKnownSymbolWrapped.f = wellKnownSymbol$e;
|
955 |
|
956 | var path$p = path$s;
|
957 | var has$6 = has$b;
|
958 | var wrappedWellKnownSymbolModule$1 = wellKnownSymbolWrapped;
|
959 | var defineProperty$b = objectDefineProperty.f;
|
960 |
|
961 | var defineWellKnownSymbol$l = function (NAME) {
|
962 | var Symbol = path$p.Symbol || (path$p.Symbol = {});
|
963 | if (!has$6(Symbol, NAME)) defineProperty$b(Symbol, NAME, {
|
964 | value: wrappedWellKnownSymbolModule$1.f(NAME)
|
965 | });
|
966 | };
|
967 |
|
968 | var wellKnownSymbol$d = wellKnownSymbol$j;
|
969 | var TO_STRING_TAG$3 = wellKnownSymbol$d('toStringTag');
|
970 | var test$2 = {};
|
971 | test$2[TO_STRING_TAG$3] = 'z';
|
972 | var toStringTagSupport = String(test$2) === '[object z]';
|
973 |
|
974 | var TO_STRING_TAG_SUPPORT$2 = toStringTagSupport;
|
975 | var classofRaw = classofRaw$1;
|
976 | var wellKnownSymbol$c = wellKnownSymbol$j;
|
977 | var TO_STRING_TAG$2 = wellKnownSymbol$c('toStringTag');
|
978 |
|
979 | var CORRECT_ARGUMENTS = classofRaw(function () {
|
980 | return arguments;
|
981 | }()) == 'Arguments';
|
982 |
|
983 | var tryGet = function (it, key) {
|
984 | try {
|
985 | return it[key];
|
986 | } catch (error) {
|
987 |
|
988 | }
|
989 | };
|
990 |
|
991 |
|
992 | var classof$9 = TO_STRING_TAG_SUPPORT$2 ? classofRaw : function (it) {
|
993 | var O, tag, result;
|
994 | return it === undefined ? 'Undefined' : it === null ? 'Null'
|
995 | : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag
|
996 | : CORRECT_ARGUMENTS ? classofRaw(O)
|
997 | : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
|
998 | };
|
999 |
|
1000 | var TO_STRING_TAG_SUPPORT$1 = toStringTagSupport;
|
1001 | var classof$8 = classof$9;
|
1002 |
|
1003 |
|
1004 | var objectToString = TO_STRING_TAG_SUPPORT$1 ? {}.toString : function toString() {
|
1005 | return '[object ' + classof$8(this) + ']';
|
1006 | };
|
1007 |
|
1008 | var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
1009 | var defineProperty$a = objectDefineProperty.f;
|
1010 | var createNonEnumerableProperty$6 = createNonEnumerableProperty$9;
|
1011 | var has$5 = has$b;
|
1012 | var toString$7 = objectToString;
|
1013 | var wellKnownSymbol$b = wellKnownSymbol$j;
|
1014 | var TO_STRING_TAG$1 = wellKnownSymbol$b('toStringTag');
|
1015 |
|
1016 | var setToStringTag$5 = function (it, TAG, STATIC, SET_METHOD) {
|
1017 | if (it) {
|
1018 | var target = STATIC ? it : it.prototype;
|
1019 |
|
1020 | if (!has$5(target, TO_STRING_TAG$1)) {
|
1021 | defineProperty$a(target, TO_STRING_TAG$1, {
|
1022 | configurable: true,
|
1023 | value: TAG
|
1024 | });
|
1025 | }
|
1026 |
|
1027 | if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
|
1028 | createNonEnumerableProperty$6(target, 'toString', toString$7);
|
1029 | }
|
1030 | }
|
1031 | };
|
1032 |
|
1033 | var store$1 = sharedStore;
|
1034 | var functionToString = Function.toString;
|
1035 |
|
1036 | if (typeof store$1.inspectSource != 'function') {
|
1037 | store$1.inspectSource = function (it) {
|
1038 | return functionToString.call(it);
|
1039 | };
|
1040 | }
|
1041 |
|
1042 | var inspectSource$1 = store$1.inspectSource;
|
1043 |
|
1044 | var global$a = global$i;
|
1045 | var inspectSource = inspectSource$1;
|
1046 | var WeakMap$1 = global$a.WeakMap;
|
1047 | var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
|
1048 |
|
1049 | var NATIVE_WEAK_MAP = nativeWeakMap;
|
1050 | var global$9 = global$i;
|
1051 | var isObject$8 = isObject$f;
|
1052 | var createNonEnumerableProperty$5 = createNonEnumerableProperty$9;
|
1053 | var objectHas = has$b;
|
1054 | var shared$1 = sharedStore;
|
1055 | var sharedKey$2 = sharedKey$4;
|
1056 | var hiddenKeys$2 = hiddenKeys$6;
|
1057 | var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
1058 | var WeakMap = global$9.WeakMap;
|
1059 | var set$3, get, has$4;
|
1060 |
|
1061 | var enforce = function (it) {
|
1062 | return has$4(it) ? get(it) : set$3(it, {});
|
1063 | };
|
1064 |
|
1065 | var getterFor = function (TYPE) {
|
1066 | return function (it) {
|
1067 | var state;
|
1068 |
|
1069 | if (!isObject$8(it) || (state = get(it)).type !== TYPE) {
|
1070 | throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
1071 | }
|
1072 |
|
1073 | return state;
|
1074 | };
|
1075 | };
|
1076 |
|
1077 | if (NATIVE_WEAK_MAP || shared$1.state) {
|
1078 | var store = shared$1.state || (shared$1.state = new WeakMap());
|
1079 | var wmget = store.get;
|
1080 | var wmhas = store.has;
|
1081 | var wmset = store.set;
|
1082 |
|
1083 | set$3 = function (it, metadata) {
|
1084 | if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
1085 | metadata.facade = it;
|
1086 | wmset.call(store, it, metadata);
|
1087 | return metadata;
|
1088 | };
|
1089 |
|
1090 | get = function (it) {
|
1091 | return wmget.call(store, it) || {};
|
1092 | };
|
1093 |
|
1094 | has$4 = function (it) {
|
1095 | return wmhas.call(store, it);
|
1096 | };
|
1097 | } else {
|
1098 | var STATE = sharedKey$2('state');
|
1099 | hiddenKeys$2[STATE] = true;
|
1100 |
|
1101 | set$3 = function (it, metadata) {
|
1102 | if (objectHas(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
1103 | metadata.facade = it;
|
1104 | createNonEnumerableProperty$5(it, STATE, metadata);
|
1105 | return metadata;
|
1106 | };
|
1107 |
|
1108 | get = function (it) {
|
1109 | return objectHas(it, STATE) ? it[STATE] : {};
|
1110 | };
|
1111 |
|
1112 | has$4 = function (it) {
|
1113 | return objectHas(it, STATE);
|
1114 | };
|
1115 | }
|
1116 |
|
1117 | var internalState = {
|
1118 | set: set$3,
|
1119 | get: get,
|
1120 | has: has$4,
|
1121 | enforce: enforce,
|
1122 | getterFor: getterFor
|
1123 | };
|
1124 |
|
1125 | var bind$a = functionBindContext;
|
1126 | var IndexedObject$2 = indexedObject;
|
1127 | var toObject$b = toObject$e;
|
1128 | var toLength$9 = toLength$c;
|
1129 | var arraySpeciesCreate$2 = arraySpeciesCreate$4;
|
1130 | var push = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
|
1131 |
|
1132 | var createMethod$4 = function (TYPE) {
|
1133 | var IS_MAP = TYPE == 1;
|
1134 | var IS_FILTER = TYPE == 2;
|
1135 | var IS_SOME = TYPE == 3;
|
1136 | var IS_EVERY = TYPE == 4;
|
1137 | var IS_FIND_INDEX = TYPE == 6;
|
1138 | var IS_FILTER_REJECT = TYPE == 7;
|
1139 | var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
1140 | return function ($this, callbackfn, that, specificCreate) {
|
1141 | var O = toObject$b($this);
|
1142 | var self = IndexedObject$2(O);
|
1143 | var boundFunction = bind$a(callbackfn, that, 3);
|
1144 | var length = toLength$9(self.length);
|
1145 | var index = 0;
|
1146 | var create = specificCreate || arraySpeciesCreate$2;
|
1147 | var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
|
1148 | var value, result;
|
1149 |
|
1150 | for (; length > index; index++) if (NO_HOLES || index in self) {
|
1151 | value = self[index];
|
1152 | result = boundFunction(value, index, O);
|
1153 |
|
1154 | if (TYPE) {
|
1155 | if (IS_MAP) target[index] = result; // map
|
1156 | else if (result) switch (TYPE) {
|
1157 | case 3:
|
1158 | return true;
|
1159 | // some
|
1160 |
|
1161 | case 5:
|
1162 | return value;
|
1163 | // find
|
1164 |
|
1165 | case 6:
|
1166 | return index;
|
1167 | // findIndex
|
1168 |
|
1169 | case 2:
|
1170 | push.call(target, value);
|
1171 | // filter
|
1172 | } else switch (TYPE) {
|
1173 | case 4:
|
1174 | return false;
|
1175 | // every
|
1176 |
|
1177 | case 7:
|
1178 | push.call(target, value);
|
1179 | // filterReject
|
1180 | }
|
1181 | }
|
1182 | }
|
1183 |
|
1184 | return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
1185 | };
|
1186 | };
|
1187 |
|
1188 | var arrayIteration = {
|
1189 | // `Array.prototype.forEach` method
|
1190 | // https://tc39.es/ecma262/#sec-array.prototype.foreach
|
1191 | forEach: createMethod$4(0),
|
1192 | // `Array.prototype.map` method
|
1193 | // https://tc39.es/ecma262/#sec-array.prototype.map
|
1194 | map: createMethod$4(1),
|
1195 | // `Array.prototype.filter` method
|
1196 | // https://tc39.es/ecma262/#sec-array.prototype.filter
|
1197 | filter: createMethod$4(2),
|
1198 | // `Array.prototype.some` method
|
1199 | // https://tc39.es/ecma262/#sec-array.prototype.some
|
1200 | some: createMethod$4(3),
|
1201 | // `Array.prototype.every` method
|
1202 | // https://tc39.es/ecma262/#sec-array.prototype.every
|
1203 | every: createMethod$4(4),
|
1204 | // `Array.prototype.find` method
|
1205 | // https://tc39.es/ecma262/#sec-array.prototype.find
|
1206 | find: createMethod$4(5),
|
1207 | // `Array.prototype.findIndex` method
|
1208 | // https://tc39.es/ecma262/#sec-array.prototype.findIndex
|
1209 | findIndex: createMethod$4(6),
|
1210 | // `Array.prototype.filterReject` method
|
1211 | // https://github.com/tc39/proposal-array-filtering
|
1212 | filterReject: createMethod$4(7)
|
1213 | };
|
1214 |
|
1215 | var $$E = _export;
|
1216 | var global$8 = global$i;
|
1217 | var getBuiltIn$4 = getBuiltIn$8;
|
1218 | var DESCRIPTORS$a = descriptors;
|
1219 | var NATIVE_SYMBOL = nativeSymbol;
|
1220 | var fails$d = fails$l;
|
1221 | var has$3 = has$b;
|
1222 | var isArray$9 = isArray$c;
|
1223 | var isObject$7 = isObject$f;
|
1224 | var isSymbol = isSymbol$4;
|
1225 | var anObject$7 = anObject$b;
|
1226 | var toObject$a = toObject$e;
|
1227 | var toIndexedObject$5 = toIndexedObject$a;
|
1228 | var toPropertyKey = toPropertyKey$4;
|
1229 | var $toString = toString$9;
|
1230 | var createPropertyDescriptor$1 = createPropertyDescriptor$5;
|
1231 | var nativeObjectCreate = objectCreate;
|
1232 | var objectKeys$2 = objectKeys$4;
|
1233 | var getOwnPropertyNamesModule$2 = objectGetOwnPropertyNames;
|
1234 | var getOwnPropertyNamesExternal = objectGetOwnPropertyNamesExternal;
|
1235 | var getOwnPropertySymbolsModule$2 = objectGetOwnPropertySymbols;
|
1236 | var getOwnPropertyDescriptorModule$1 = objectGetOwnPropertyDescriptor;
|
1237 | var definePropertyModule$1 = objectDefineProperty;
|
1238 | var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
|
1239 | var createNonEnumerableProperty$4 = createNonEnumerableProperty$9;
|
1240 | var redefine$2 = redefine$3;
|
1241 | var shared = shared$4.exports;
|
1242 | var sharedKey$1 = sharedKey$4;
|
1243 | var hiddenKeys$1 = hiddenKeys$6;
|
1244 | var uid$1 = uid$4;
|
1245 | var wellKnownSymbol$a = wellKnownSymbol$j;
|
1246 | var wrappedWellKnownSymbolModule = wellKnownSymbolWrapped;
|
1247 | var defineWellKnownSymbol$k = defineWellKnownSymbol$l;
|
1248 | var setToStringTag$4 = setToStringTag$5;
|
1249 | var InternalStateModule$4 = internalState;
|
1250 | var $forEach$1 = arrayIteration.forEach;
|
1251 | var HIDDEN = sharedKey$1('hidden');
|
1252 | var SYMBOL = 'Symbol';
|
1253 | var PROTOTYPE = 'prototype';
|
1254 | var TO_PRIMITIVE = wellKnownSymbol$a('toPrimitive');
|
1255 | var setInternalState$4 = InternalStateModule$4.set;
|
1256 | var getInternalState$2 = InternalStateModule$4.getterFor(SYMBOL);
|
1257 | var ObjectPrototype$1 = Object[PROTOTYPE];
|
1258 | var $Symbol = global$8.Symbol;
|
1259 | var $stringify$1 = getBuiltIn$4('JSON', 'stringify');
|
1260 | var nativeGetOwnPropertyDescriptor$1 = getOwnPropertyDescriptorModule$1.f;
|
1261 | var nativeDefineProperty = definePropertyModule$1.f;
|
1262 | var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
|
1263 | var nativePropertyIsEnumerable = propertyIsEnumerableModule$1.f;
|
1264 | var AllSymbols = shared('symbols');
|
1265 | var ObjectPrototypeSymbols = shared('op-symbols');
|
1266 | var StringToSymbolRegistry = shared('string-to-symbol-registry');
|
1267 | var SymbolToStringRegistry = shared('symbol-to-string-registry');
|
1268 | var WellKnownSymbolsStore = shared('wks');
|
1269 | var QObject = global$8.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
|
1270 |
|
1271 | var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
|
1272 |
|
1273 | var setSymbolDescriptor = DESCRIPTORS$a && fails$d(function () {
|
1274 | return nativeObjectCreate(nativeDefineProperty({}, 'a', {
|
1275 | get: function () {
|
1276 | return nativeDefineProperty(this, 'a', {
|
1277 | value: 7
|
1278 | }).a;
|
1279 | }
|
1280 | })).a != 7;
|
1281 | }) ? function (O, P, Attributes) {
|
1282 | var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype$1, P);
|
1283 | if (ObjectPrototypeDescriptor) delete ObjectPrototype$1[P];
|
1284 | nativeDefineProperty(O, P, Attributes);
|
1285 |
|
1286 | if (ObjectPrototypeDescriptor && O !== ObjectPrototype$1) {
|
1287 | nativeDefineProperty(ObjectPrototype$1, P, ObjectPrototypeDescriptor);
|
1288 | }
|
1289 | } : nativeDefineProperty;
|
1290 |
|
1291 | var wrap$1 = function (tag, description) {
|
1292 | var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);
|
1293 | setInternalState$4(symbol, {
|
1294 | type: SYMBOL,
|
1295 | tag: tag,
|
1296 | description: description
|
1297 | });
|
1298 | if (!DESCRIPTORS$a) symbol.description = description;
|
1299 | return symbol;
|
1300 | };
|
1301 |
|
1302 | var $defineProperty = function defineProperty(O, P, Attributes) {
|
1303 | if (O === ObjectPrototype$1) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
|
1304 | anObject$7(O);
|
1305 | var key = toPropertyKey(P);
|
1306 | anObject$7(Attributes);
|
1307 |
|
1308 | if (has$3(AllSymbols, key)) {
|
1309 | if (!Attributes.enumerable) {
|
1310 | if (!has$3(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor$1(1, {}));
|
1311 | O[HIDDEN][key] = true;
|
1312 | } else {
|
1313 | if (has$3(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
|
1314 | Attributes = nativeObjectCreate(Attributes, {
|
1315 | enumerable: createPropertyDescriptor$1(0, false)
|
1316 | });
|
1317 | }
|
1318 |
|
1319 | return setSymbolDescriptor(O, key, Attributes);
|
1320 | }
|
1321 |
|
1322 | return nativeDefineProperty(O, key, Attributes);
|
1323 | };
|
1324 |
|
1325 | var $defineProperties = function defineProperties(O, Properties) {
|
1326 | anObject$7(O);
|
1327 | var properties = toIndexedObject$5(Properties);
|
1328 | var keys = objectKeys$2(properties).concat($getOwnPropertySymbols(properties));
|
1329 | $forEach$1(keys, function (key) {
|
1330 | if (!DESCRIPTORS$a || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
|
1331 | });
|
1332 | return O;
|
1333 | };
|
1334 |
|
1335 | var $create = function create(O, Properties) {
|
1336 | return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
|
1337 | };
|
1338 |
|
1339 | var $propertyIsEnumerable = function propertyIsEnumerable(V) {
|
1340 | var P = toPropertyKey(V);
|
1341 | var enumerable = nativePropertyIsEnumerable.call(this, P);
|
1342 | if (this === ObjectPrototype$1 && has$3(AllSymbols, P) && !has$3(ObjectPrototypeSymbols, P)) return false;
|
1343 | return enumerable || !has$3(this, P) || !has$3(AllSymbols, P) || has$3(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
|
1344 | };
|
1345 |
|
1346 | var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
|
1347 | var it = toIndexedObject$5(O);
|
1348 | var key = toPropertyKey(P);
|
1349 | if (it === ObjectPrototype$1 && has$3(AllSymbols, key) && !has$3(ObjectPrototypeSymbols, key)) return;
|
1350 | var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
|
1351 |
|
1352 | if (descriptor && has$3(AllSymbols, key) && !(has$3(it, HIDDEN) && it[HIDDEN][key])) {
|
1353 | descriptor.enumerable = true;
|
1354 | }
|
1355 |
|
1356 | return descriptor;
|
1357 | };
|
1358 |
|
1359 | var $getOwnPropertyNames = function getOwnPropertyNames(O) {
|
1360 | var names = nativeGetOwnPropertyNames(toIndexedObject$5(O));
|
1361 | var result = [];
|
1362 | $forEach$1(names, function (key) {
|
1363 | if (!has$3(AllSymbols, key) && !has$3(hiddenKeys$1, key)) result.push(key);
|
1364 | });
|
1365 | return result;
|
1366 | };
|
1367 |
|
1368 | var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
|
1369 | var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$1;
|
1370 | var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject$5(O));
|
1371 | var result = [];
|
1372 | $forEach$1(names, function (key) {
|
1373 | if (has$3(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has$3(ObjectPrototype$1, key))) {
|
1374 | result.push(AllSymbols[key]);
|
1375 | }
|
1376 | });
|
1377 | return result;
|
1378 | }; // `Symbol` constructor
|
1379 | // https://tc39.es/ecma262/#sec-symbol-constructor
|
1380 |
|
1381 |
|
1382 | if (!NATIVE_SYMBOL) {
|
1383 | $Symbol = function Symbol() {
|
1384 | if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
|
1385 | var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
|
1386 | var tag = uid$1(description);
|
1387 |
|
1388 | var setter = function (value) {
|
1389 | if (this === ObjectPrototype$1) setter.call(ObjectPrototypeSymbols, value);
|
1390 | if (has$3(this, HIDDEN) && has$3(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
|
1391 | setSymbolDescriptor(this, tag, createPropertyDescriptor$1(1, value));
|
1392 | };
|
1393 |
|
1394 | if (DESCRIPTORS$a && USE_SETTER) setSymbolDescriptor(ObjectPrototype$1, tag, {
|
1395 | configurable: true,
|
1396 | set: setter
|
1397 | });
|
1398 | return wrap$1(tag, description);
|
1399 | };
|
1400 |
|
1401 | redefine$2($Symbol[PROTOTYPE], 'toString', function toString() {
|
1402 | return getInternalState$2(this).tag;
|
1403 | });
|
1404 | redefine$2($Symbol, 'withoutSetter', function (description) {
|
1405 | return wrap$1(uid$1(description), description);
|
1406 | });
|
1407 | propertyIsEnumerableModule$1.f = $propertyIsEnumerable;
|
1408 | definePropertyModule$1.f = $defineProperty;
|
1409 | getOwnPropertyDescriptorModule$1.f = $getOwnPropertyDescriptor;
|
1410 | getOwnPropertyNamesModule$2.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
|
1411 | getOwnPropertySymbolsModule$2.f = $getOwnPropertySymbols;
|
1412 |
|
1413 | wrappedWellKnownSymbolModule.f = function (name) {
|
1414 | return wrap$1(wellKnownSymbol$a(name), name);
|
1415 | };
|
1416 |
|
1417 | if (DESCRIPTORS$a) {
|
1418 | // https://github.com/tc39/proposal-Symbol-description
|
1419 | nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
|
1420 | configurable: true,
|
1421 | get: function description() {
|
1422 | return getInternalState$2(this).description;
|
1423 | }
|
1424 | });
|
1425 | }
|
1426 | }
|
1427 |
|
1428 | $$E({
|
1429 | global: true,
|
1430 | wrap: true,
|
1431 | forced: !NATIVE_SYMBOL,
|
1432 | sham: !NATIVE_SYMBOL
|
1433 | }, {
|
1434 | Symbol: $Symbol
|
1435 | });
|
1436 | $forEach$1(objectKeys$2(WellKnownSymbolsStore), function (name) {
|
1437 | defineWellKnownSymbol$k(name);
|
1438 | });
|
1439 | $$E({
|
1440 | target: SYMBOL,
|
1441 | stat: true,
|
1442 | forced: !NATIVE_SYMBOL
|
1443 | }, {
|
1444 | // `Symbol.for` method
|
1445 | // https://tc39.es/ecma262/#sec-symbol.for
|
1446 | 'for': function (key) {
|
1447 | var string = $toString(key);
|
1448 | if (has$3(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
|
1449 | var symbol = $Symbol(string);
|
1450 | StringToSymbolRegistry[string] = symbol;
|
1451 | SymbolToStringRegistry[symbol] = string;
|
1452 | return symbol;
|
1453 | },
|
1454 | // `Symbol.keyFor` method
|
1455 | // https://tc39.es/ecma262/#sec-symbol.keyfor
|
1456 | keyFor: function keyFor(sym) {
|
1457 | if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
|
1458 | if (has$3(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
|
1459 | },
|
1460 | useSetter: function () {
|
1461 | USE_SETTER = true;
|
1462 | },
|
1463 | useSimple: function () {
|
1464 | USE_SETTER = false;
|
1465 | }
|
1466 | });
|
1467 | $$E({
|
1468 | target: 'Object',
|
1469 | stat: true,
|
1470 | forced: !NATIVE_SYMBOL,
|
1471 | sham: !DESCRIPTORS$a
|
1472 | }, {
|
1473 | // `Object.create` method
|
1474 | // https://tc39.es/ecma262/#sec-object.create
|
1475 | create: $create,
|
1476 | // `Object.defineProperty` method
|
1477 | // https://tc39.es/ecma262/#sec-object.defineproperty
|
1478 | defineProperty: $defineProperty,
|
1479 | // `Object.defineProperties` method
|
1480 | // https://tc39.es/ecma262/#sec-object.defineproperties
|
1481 | defineProperties: $defineProperties,
|
1482 | // `Object.getOwnPropertyDescriptor` method
|
1483 | // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
|
1484 | getOwnPropertyDescriptor: $getOwnPropertyDescriptor
|
1485 | });
|
1486 | $$E({
|
1487 | target: 'Object',
|
1488 | stat: true,
|
1489 | forced: !NATIVE_SYMBOL
|
1490 | }, {
|
1491 | // `Object.getOwnPropertyNames` method
|
1492 | // https://tc39.es/ecma262/#sec-object.getownpropertynames
|
1493 | getOwnPropertyNames: $getOwnPropertyNames,
|
1494 | // `Object.getOwnPropertySymbols` method
|
1495 | // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
|
1496 | getOwnPropertySymbols: $getOwnPropertySymbols
|
1497 | }); // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
|
1498 | // https://bugs.chromium.org/p/v8/issues/detail?id=3443
|
1499 |
|
1500 | $$E({
|
1501 | target: 'Object',
|
1502 | stat: true,
|
1503 | forced: fails$d(function () {
|
1504 | getOwnPropertySymbolsModule$2.f(1);
|
1505 | })
|
1506 | }, {
|
1507 | getOwnPropertySymbols: function getOwnPropertySymbols(it) {
|
1508 | return getOwnPropertySymbolsModule$2.f(toObject$a(it));
|
1509 | }
|
1510 | }); // `JSON.stringify` method behavior with symbols
|
1511 | // https://tc39.es/ecma262/#sec-json.stringify
|
1512 |
|
1513 | if ($stringify$1) {
|
1514 | var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails$d(function () {
|
1515 | var symbol = $Symbol(); // MS Edge converts symbol values to JSON as {}
|
1516 |
|
1517 | return $stringify$1([symbol]) != '[null]' // WebKit converts symbol values to JSON as null
|
1518 | || $stringify$1({
|
1519 | a: symbol
|
1520 | }) != '{}' // V8 throws on boxed symbols
|
1521 | || $stringify$1(Object(symbol)) != '{}';
|
1522 | });
|
1523 | $$E({
|
1524 | target: 'JSON',
|
1525 | stat: true,
|
1526 | forced: FORCED_JSON_STRINGIFY
|
1527 | }, {
|
1528 | // eslint-disable-next-line no-unused-vars -- required for `.length`
|
1529 | stringify: function stringify(it, replacer, space) {
|
1530 | var args = [it];
|
1531 | var index = 1;
|
1532 | var $replacer;
|
1533 |
|
1534 | while (arguments.length > index) args.push(arguments[index++]);
|
1535 |
|
1536 | $replacer = replacer;
|
1537 | if (!isObject$7(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
|
1538 |
|
1539 | if (!isArray$9(replacer)) replacer = function (key, value) {
|
1540 | if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
|
1541 | if (!isSymbol(value)) return value;
|
1542 | };
|
1543 | args[1] = replacer;
|
1544 | return $stringify$1.apply(null, args);
|
1545 | }
|
1546 | });
|
1547 | } // `Symbol.prototype[@@toPrimitive]` method
|
1548 | // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
|
1549 |
|
1550 |
|
1551 | if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
|
1552 | createNonEnumerableProperty$4($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
|
1553 | } // `Symbol.prototype[@@toStringTag]` property
|
1554 | // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
|
1555 |
|
1556 |
|
1557 | setToStringTag$4($Symbol, SYMBOL);
|
1558 | hiddenKeys$1[HIDDEN] = true;
|
1559 |
|
1560 | var defineWellKnownSymbol$j = defineWellKnownSymbol$l; // `Symbol.asyncIterator` well-known symbol
|
1561 | // https://tc39.es/ecma262/#sec-symbol.asynciterator
|
1562 |
|
1563 | defineWellKnownSymbol$j('asyncIterator');
|
1564 |
|
1565 | var defineWellKnownSymbol$i = defineWellKnownSymbol$l; // `Symbol.hasInstance` well-known symbol
|
1566 | // https://tc39.es/ecma262/#sec-symbol.hasinstance
|
1567 |
|
1568 | defineWellKnownSymbol$i('hasInstance');
|
1569 |
|
1570 | var defineWellKnownSymbol$h = defineWellKnownSymbol$l; // `Symbol.isConcatSpreadable` well-known symbol
|
1571 | // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
|
1572 |
|
1573 | defineWellKnownSymbol$h('isConcatSpreadable');
|
1574 |
|
1575 | var defineWellKnownSymbol$g = defineWellKnownSymbol$l; // `Symbol.iterator` well-known symbol
|
1576 | // https://tc39.es/ecma262/#sec-symbol.iterator
|
1577 |
|
1578 | defineWellKnownSymbol$g('iterator');
|
1579 |
|
1580 | var defineWellKnownSymbol$f = defineWellKnownSymbol$l; // `Symbol.match` well-known symbol
|
1581 | // https://tc39.es/ecma262/#sec-symbol.match
|
1582 |
|
1583 | defineWellKnownSymbol$f('match');
|
1584 |
|
1585 | var defineWellKnownSymbol$e = defineWellKnownSymbol$l; // `Symbol.matchAll` well-known symbol
|
1586 | // https://tc39.es/ecma262/#sec-symbol.matchall
|
1587 |
|
1588 | defineWellKnownSymbol$e('matchAll');
|
1589 |
|
1590 | var defineWellKnownSymbol$d = defineWellKnownSymbol$l; // `Symbol.replace` well-known symbol
|
1591 | // https://tc39.es/ecma262/#sec-symbol.replace
|
1592 |
|
1593 | defineWellKnownSymbol$d('replace');
|
1594 |
|
1595 | var defineWellKnownSymbol$c = defineWellKnownSymbol$l; // `Symbol.search` well-known symbol
|
1596 | // https://tc39.es/ecma262/#sec-symbol.search
|
1597 |
|
1598 | defineWellKnownSymbol$c('search');
|
1599 |
|
1600 | var defineWellKnownSymbol$b = defineWellKnownSymbol$l; // `Symbol.species` well-known symbol
|
1601 | // https://tc39.es/ecma262/#sec-symbol.species
|
1602 |
|
1603 | defineWellKnownSymbol$b('species');
|
1604 |
|
1605 | var defineWellKnownSymbol$a = defineWellKnownSymbol$l; // `Symbol.split` well-known symbol
|
1606 | // https://tc39.es/ecma262/#sec-symbol.split
|
1607 |
|
1608 | defineWellKnownSymbol$a('split');
|
1609 |
|
1610 | var defineWellKnownSymbol$9 = defineWellKnownSymbol$l; // `Symbol.toPrimitive` well-known symbol
|
1611 | // https://tc39.es/ecma262/#sec-symbol.toprimitive
|
1612 |
|
1613 | defineWellKnownSymbol$9('toPrimitive');
|
1614 |
|
1615 | var defineWellKnownSymbol$8 = defineWellKnownSymbol$l; // `Symbol.toStringTag` well-known symbol
|
1616 | // https://tc39.es/ecma262/#sec-symbol.tostringtag
|
1617 |
|
1618 | defineWellKnownSymbol$8('toStringTag');
|
1619 |
|
1620 | var defineWellKnownSymbol$7 = defineWellKnownSymbol$l; // `Symbol.unscopables` well-known symbol
|
1621 | // https://tc39.es/ecma262/#sec-symbol.unscopables
|
1622 |
|
1623 | defineWellKnownSymbol$7('unscopables');
|
1624 |
|
1625 | var global$7 = global$i;
|
1626 | var setToStringTag$3 = setToStringTag$5; // JSON[@@toStringTag] property
|
1627 | // https://tc39.es/ecma262/#sec-json-@@tostringtag
|
1628 |
|
1629 | setToStringTag$3(global$7.JSON, 'JSON', true);
|
1630 |
|
1631 | var path$o = path$s;
|
1632 | var symbol$4 = path$o.Symbol;
|
1633 |
|
1634 | var iterators = {};
|
1635 |
|
1636 | var fails$c = fails$l;
|
1637 | var correctPrototypeGetter = !fails$c(function () {
|
1638 | function F() {
|
1639 | /* empty */
|
1640 | }
|
1641 |
|
1642 | F.prototype.constructor = null; // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
1643 |
|
1644 | return Object.getPrototypeOf(new F()) !== F.prototype;
|
1645 | });
|
1646 |
|
1647 | var has$2 = has$b;
|
1648 | var toObject$9 = toObject$e;
|
1649 | var sharedKey = sharedKey$4;
|
1650 | var CORRECT_PROTOTYPE_GETTER$1 = correctPrototypeGetter;
|
1651 | var IE_PROTO = sharedKey('IE_PROTO');
|
1652 | var ObjectPrototype = Object.prototype; // `Object.getPrototypeOf` method
|
1653 | // https://tc39.es/ecma262/#sec-object.getprototypeof
|
1654 | // eslint-disable-next-line es/no-object-getprototypeof -- safe
|
1655 |
|
1656 | var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER$1 ? Object.getPrototypeOf : function (O) {
|
1657 | O = toObject$9(O);
|
1658 | if (has$2(O, IE_PROTO)) return O[IE_PROTO];
|
1659 |
|
1660 | if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
1661 | return O.constructor.prototype;
|
1662 | }
|
1663 |
|
1664 | return O instanceof Object ? ObjectPrototype : null;
|
1665 | };
|
1666 |
|
1667 | var fails$b = fails$l;
|
1668 | var getPrototypeOf$6 = objectGetPrototypeOf;
|
1669 | var createNonEnumerableProperty$3 = createNonEnumerableProperty$9;
|
1670 | var has$1 = has$b;
|
1671 | var wellKnownSymbol$9 = wellKnownSymbol$j;
|
1672 | var ITERATOR$4 = wellKnownSymbol$9('iterator');
|
1673 | var BUGGY_SAFARI_ITERATORS$1 = false;
|
1674 |
|
1675 | var returnThis$2 = function () {
|
1676 | return this;
|
1677 | }; // `%IteratorPrototype%` object
|
1678 | // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
|
1679 |
|
1680 |
|
1681 | var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
1682 | /* eslint-disable es/no-array-prototype-keys -- safe */
|
1683 |
|
1684 | if ([].keys) {
|
1685 | arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next`
|
1686 |
|
1687 | if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;else {
|
1688 | PrototypeOfArrayIteratorPrototype = getPrototypeOf$6(getPrototypeOf$6(arrayIterator));
|
1689 | if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
|
1690 | }
|
1691 | }
|
1692 |
|
1693 | var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails$b(function () {
|
1694 | var test = {}; // FF44- legacy iterators case
|
1695 |
|
1696 | return IteratorPrototype$2[ITERATOR$4].call(test) !== test;
|
1697 | });
|
1698 | if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {}; // `%IteratorPrototype%[@@iterator]()` method
|
1699 | // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
1700 |
|
1701 | if ((NEW_ITERATOR_PROTOTYPE) && !has$1(IteratorPrototype$2, ITERATOR$4)) {
|
1702 | createNonEnumerableProperty$3(IteratorPrototype$2, ITERATOR$4, returnThis$2);
|
1703 | }
|
1704 |
|
1705 | var iteratorsCore = {
|
1706 | IteratorPrototype: IteratorPrototype$2,
|
1707 | BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
|
1708 | };
|
1709 |
|
1710 | var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
|
1711 | var create$8 = objectCreate;
|
1712 | var createPropertyDescriptor = createPropertyDescriptor$5;
|
1713 | var setToStringTag$2 = setToStringTag$5;
|
1714 | var Iterators$5 = iterators;
|
1715 |
|
1716 | var returnThis$1 = function () {
|
1717 | return this;
|
1718 | };
|
1719 |
|
1720 | var createIteratorConstructor$1 = function (IteratorConstructor, NAME, next) {
|
1721 | var TO_STRING_TAG = NAME + ' Iterator';
|
1722 | IteratorConstructor.prototype = create$8(IteratorPrototype$1, {
|
1723 | next: createPropertyDescriptor(1, next)
|
1724 | });
|
1725 | setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false, true);
|
1726 | Iterators$5[TO_STRING_TAG] = returnThis$1;
|
1727 | return IteratorConstructor;
|
1728 | };
|
1729 |
|
1730 | var isObject$6 = isObject$f;
|
1731 |
|
1732 | var aPossiblePrototype$1 = function (it) {
|
1733 | if (!isObject$6(it) && it !== null) {
|
1734 | throw TypeError("Can't set " + String(it) + ' as a prototype');
|
1735 | }
|
1736 |
|
1737 | return it;
|
1738 | };
|
1739 |
|
1740 | /* eslint-disable no-proto -- safe */
|
1741 | var anObject$6 = anObject$b;
|
1742 | var aPossiblePrototype = aPossiblePrototype$1; // `Object.setPrototypeOf` method
|
1743 | // https://tc39.es/ecma262/#sec-object.setprototypeof
|
1744 | // Works with __proto__ only. Old v8 can't work with null proto objects.
|
1745 | // eslint-disable-next-line es/no-object-setprototypeof -- safe
|
1746 |
|
1747 | var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
1748 | var CORRECT_SETTER = false;
|
1749 | var test = {};
|
1750 | var setter;
|
1751 |
|
1752 | try {
|
1753 | // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
1754 | setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
|
1755 | setter.call(test, []);
|
1756 | CORRECT_SETTER = test instanceof Array;
|
1757 | } catch (error) {
|
1758 | /* empty */
|
1759 | }
|
1760 |
|
1761 | return function setPrototypeOf(O, proto) {
|
1762 | anObject$6(O);
|
1763 | aPossiblePrototype(proto);
|
1764 | if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto;
|
1765 | return O;
|
1766 | };
|
1767 | }() : undefined);
|
1768 |
|
1769 | var $$D = _export;
|
1770 | var createIteratorConstructor = createIteratorConstructor$1;
|
1771 | var getPrototypeOf$5 = objectGetPrototypeOf;
|
1772 | var setToStringTag$1 = setToStringTag$5;
|
1773 | var createNonEnumerableProperty$2 = createNonEnumerableProperty$9;
|
1774 | var redefine$1 = redefine$3;
|
1775 | var wellKnownSymbol$8 = wellKnownSymbol$j;
|
1776 | var Iterators$4 = iterators;
|
1777 | var IteratorsCore = iteratorsCore;
|
1778 | var IteratorPrototype = IteratorsCore.IteratorPrototype;
|
1779 | var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
|
1780 | var ITERATOR$3 = wellKnownSymbol$8('iterator');
|
1781 | var KEYS = 'keys';
|
1782 | var VALUES = 'values';
|
1783 | var ENTRIES = 'entries';
|
1784 |
|
1785 | var returnThis = function () {
|
1786 | return this;
|
1787 | };
|
1788 |
|
1789 | var defineIterator$3 = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
1790 | createIteratorConstructor(IteratorConstructor, NAME, next);
|
1791 |
|
1792 | var getIterationMethod = function (KIND) {
|
1793 | if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
1794 | if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
1795 |
|
1796 | switch (KIND) {
|
1797 | case KEYS:
|
1798 | return function keys() {
|
1799 | return new IteratorConstructor(this, KIND);
|
1800 | };
|
1801 |
|
1802 | case VALUES:
|
1803 | return function values() {
|
1804 | return new IteratorConstructor(this, KIND);
|
1805 | };
|
1806 |
|
1807 | case ENTRIES:
|
1808 | return function entries() {
|
1809 | return new IteratorConstructor(this, KIND);
|
1810 | };
|
1811 | }
|
1812 |
|
1813 | return function () {
|
1814 | return new IteratorConstructor(this);
|
1815 | };
|
1816 | };
|
1817 |
|
1818 | var TO_STRING_TAG = NAME + ' Iterator';
|
1819 | var INCORRECT_VALUES_NAME = false;
|
1820 | var IterablePrototype = Iterable.prototype;
|
1821 | var nativeIterator = IterablePrototype[ITERATOR$3] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
|
1822 | var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
1823 | var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
1824 | var CurrentIteratorPrototype, methods, KEY; // fix native
|
1825 |
|
1826 | if (anyNativeIterator) {
|
1827 | CurrentIteratorPrototype = getPrototypeOf$5(anyNativeIterator.call(new Iterable()));
|
1828 |
|
1829 | if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
1830 |
|
1831 |
|
1832 | setToStringTag$1(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
|
1833 | Iterators$4[TO_STRING_TAG] = returnThis;
|
1834 | }
|
1835 | } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
|
1836 |
|
1837 |
|
1838 | if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
1839 | INCORRECT_VALUES_NAME = true;
|
1840 |
|
1841 | defaultIterator = function values() {
|
1842 | return nativeIterator.call(this);
|
1843 | };
|
1844 | } // define iterator
|
1845 |
|
1846 |
|
1847 | if ((FORCED) && IterablePrototype[ITERATOR$3] !== defaultIterator) {
|
1848 | createNonEnumerableProperty$2(IterablePrototype, ITERATOR$3, defaultIterator);
|
1849 | }
|
1850 |
|
1851 | Iterators$4[NAME] = defaultIterator; // export additional methods
|
1852 |
|
1853 | if (DEFAULT) {
|
1854 | methods = {
|
1855 | values: getIterationMethod(VALUES),
|
1856 | keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
1857 | entries: getIterationMethod(ENTRIES)
|
1858 | };
|
1859 | if (FORCED) for (KEY in methods) {
|
1860 | if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
1861 | redefine$1(IterablePrototype, KEY, methods[KEY]);
|
1862 | }
|
1863 | } else $$D({
|
1864 | target: NAME,
|
1865 | proto: true,
|
1866 | forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
|
1867 | }, methods);
|
1868 | }
|
1869 |
|
1870 | return methods;
|
1871 | };
|
1872 |
|
1873 | var toIndexedObject$4 = toIndexedObject$a;
|
1874 | var Iterators$3 = iterators;
|
1875 | var InternalStateModule$3 = internalState;
|
1876 | var defineIterator$2 = defineIterator$3;
|
1877 | var ARRAY_ITERATOR = 'Array Iterator';
|
1878 | var setInternalState$3 = InternalStateModule$3.set;
|
1879 | var getInternalState$1 = InternalStateModule$3.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method
|
1880 | // https://tc39.es/ecma262/#sec-array.prototype.entries
|
1881 | // `Array.prototype.keys` method
|
1882 | // https://tc39.es/ecma262/#sec-array.prototype.keys
|
1883 | // `Array.prototype.values` method
|
1884 | // https://tc39.es/ecma262/#sec-array.prototype.values
|
1885 | // `Array.prototype[@@iterator]` method
|
1886 | // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
|
1887 | // `CreateArrayIterator` internal method
|
1888 | // https://tc39.es/ecma262/#sec-createarrayiterator
|
1889 |
|
1890 | defineIterator$2(Array, 'Array', function (iterated, kind) {
|
1891 | setInternalState$3(this, {
|
1892 | type: ARRAY_ITERATOR,
|
1893 | target: toIndexedObject$4(iterated),
|
1894 | // target
|
1895 | index: 0,
|
1896 | // next index
|
1897 | kind: kind // kind
|
1898 |
|
1899 | }); // `%ArrayIteratorPrototype%.next` method
|
1900 | // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
|
1901 | }, function () {
|
1902 | var state = getInternalState$1(this);
|
1903 | var target = state.target;
|
1904 | var kind = state.kind;
|
1905 | var index = state.index++;
|
1906 |
|
1907 | if (!target || index >= target.length) {
|
1908 | state.target = undefined;
|
1909 | return {
|
1910 | value: undefined,
|
1911 | done: true
|
1912 | };
|
1913 | }
|
1914 |
|
1915 | if (kind == 'keys') return {
|
1916 | value: index,
|
1917 | done: false
|
1918 | };
|
1919 | if (kind == 'values') return {
|
1920 | value: target[index],
|
1921 | done: false
|
1922 | };
|
1923 | return {
|
1924 | value: [index, target[index]],
|
1925 | done: false
|
1926 | };
|
1927 | }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values%
|
1928 | // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
|
1929 | // https://tc39.es/ecma262/#sec-createmappedargumentsobject
|
1930 |
|
1931 | Iterators$3.Arguments = Iterators$3.Array; // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
1932 |
|
1933 | // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
|
1934 |
|
1935 | var domIterables = {
|
1936 | CSSRuleList: 0,
|
1937 | CSSStyleDeclaration: 0,
|
1938 | CSSValueList: 0,
|
1939 | ClientRectList: 0,
|
1940 | DOMRectList: 0,
|
1941 | DOMStringList: 0,
|
1942 | DOMTokenList: 1,
|
1943 | DataTransferItemList: 0,
|
1944 | FileList: 0,
|
1945 | HTMLAllCollection: 0,
|
1946 | HTMLCollection: 0,
|
1947 | HTMLFormElement: 0,
|
1948 | HTMLSelectElement: 0,
|
1949 | MediaList: 0,
|
1950 | MimeTypeArray: 0,
|
1951 | NamedNodeMap: 0,
|
1952 | NodeList: 1,
|
1953 | PaintRequestList: 0,
|
1954 | Plugin: 0,
|
1955 | PluginArray: 0,
|
1956 | SVGLengthList: 0,
|
1957 | SVGNumberList: 0,
|
1958 | SVGPathSegList: 0,
|
1959 | SVGPointList: 0,
|
1960 | SVGStringList: 0,
|
1961 | SVGTransformList: 0,
|
1962 | SourceBufferList: 0,
|
1963 | StyleSheetList: 0,
|
1964 | TextTrackCueList: 0,
|
1965 | TextTrackList: 0,
|
1966 | TouchList: 0
|
1967 | };
|
1968 |
|
1969 | var DOMIterables$4 = domIterables;
|
1970 | var global$6 = global$i;
|
1971 | var classof$7 = classof$9;
|
1972 | var createNonEnumerableProperty$1 = createNonEnumerableProperty$9;
|
1973 | var Iterators$2 = iterators;
|
1974 | var wellKnownSymbol$7 = wellKnownSymbol$j;
|
1975 | var TO_STRING_TAG = wellKnownSymbol$7('toStringTag');
|
1976 |
|
1977 | for (var COLLECTION_NAME in DOMIterables$4) {
|
1978 | var Collection = global$6[COLLECTION_NAME];
|
1979 | var CollectionPrototype = Collection && Collection.prototype;
|
1980 |
|
1981 | if (CollectionPrototype && classof$7(CollectionPrototype) !== TO_STRING_TAG) {
|
1982 | createNonEnumerableProperty$1(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
|
1983 | }
|
1984 |
|
1985 | Iterators$2[COLLECTION_NAME] = Iterators$2.Array;
|
1986 | }
|
1987 |
|
1988 | var parent$R = symbol$4;
|
1989 | var symbol$3 = parent$R;
|
1990 |
|
1991 | var defineWellKnownSymbol$6 = defineWellKnownSymbol$l; // `Symbol.asyncDispose` well-known symbol
|
1992 | // https://github.com/tc39/proposal-using-statement
|
1993 |
|
1994 | defineWellKnownSymbol$6('asyncDispose');
|
1995 |
|
1996 | var defineWellKnownSymbol$5 = defineWellKnownSymbol$l; // `Symbol.dispose` well-known symbol
|
1997 | // https://github.com/tc39/proposal-using-statement
|
1998 |
|
1999 | defineWellKnownSymbol$5('dispose');
|
2000 |
|
2001 | var defineWellKnownSymbol$4 = defineWellKnownSymbol$l; // `Symbol.matcher` well-known symbol
|
2002 | // https://github.com/tc39/proposal-pattern-matching
|
2003 |
|
2004 | defineWellKnownSymbol$4('matcher');
|
2005 |
|
2006 | var defineWellKnownSymbol$3 = defineWellKnownSymbol$l; // `Symbol.metadata` well-known symbol
|
2007 | // https://github.com/tc39/proposal-decorators
|
2008 |
|
2009 | defineWellKnownSymbol$3('metadata');
|
2010 |
|
2011 | var defineWellKnownSymbol$2 = defineWellKnownSymbol$l; // `Symbol.observable` well-known symbol
|
2012 | // https://github.com/tc39/proposal-observable
|
2013 |
|
2014 | defineWellKnownSymbol$2('observable');
|
2015 |
|
2016 | var defineWellKnownSymbol$1 = defineWellKnownSymbol$l; // `Symbol.patternMatch` well-known symbol
|
2017 | // https://github.com/tc39/proposal-pattern-matching
|
2018 |
|
2019 | defineWellKnownSymbol$1('patternMatch');
|
2020 |
|
2021 | var defineWellKnownSymbol = defineWellKnownSymbol$l;
|
2022 | defineWellKnownSymbol('replaceAll');
|
2023 |
|
2024 | var parent$Q = symbol$3; // TODO: Remove from `core-js@4`
|
2025 | // TODO: Remove from `core-js@4`
|
2026 |
|
2027 | var symbol$2 = parent$Q;
|
2028 |
|
2029 | var symbol$1 = symbol$2;
|
2030 |
|
2031 | var toInteger$1 = toInteger$4;
|
2032 | var toString$6 = toString$9;
|
2033 | var requireObjectCoercible$2 = requireObjectCoercible$5; // `String.prototype.codePointAt` methods implementation
|
2034 |
|
2035 | var createMethod$3 = function (CONVERT_TO_STRING) {
|
2036 | return function ($this, pos) {
|
2037 | var S = toString$6(requireObjectCoercible$2($this));
|
2038 | var position = toInteger$1(pos);
|
2039 | var size = S.length;
|
2040 | var first, second;
|
2041 | if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
2042 | first = S.charCodeAt(position);
|
2043 | return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
2044 | };
|
2045 | };
|
2046 |
|
2047 | var stringMultibyte = {
|
2048 | // `String.prototype.codePointAt` method
|
2049 | // https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
2050 | codeAt: createMethod$3(false),
|
2051 | // `String.prototype.at` method
|
2052 | // https://github.com/mathiasbynens/String.prototype.at
|
2053 | charAt: createMethod$3(true)
|
2054 | };
|
2055 |
|
2056 | var charAt = stringMultibyte.charAt;
|
2057 | var toString$5 = toString$9;
|
2058 | var InternalStateModule$2 = internalState;
|
2059 | var defineIterator$1 = defineIterator$3;
|
2060 | var STRING_ITERATOR = 'String Iterator';
|
2061 | var setInternalState$2 = InternalStateModule$2.set;
|
2062 | var getInternalState = InternalStateModule$2.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method
|
2063 | // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
|
2064 |
|
2065 | defineIterator$1(String, 'String', function (iterated) {
|
2066 | setInternalState$2(this, {
|
2067 | type: STRING_ITERATOR,
|
2068 | string: toString$5(iterated),
|
2069 | index: 0
|
2070 | }); // `%StringIteratorPrototype%.next` method
|
2071 | // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
|
2072 | }, function next() {
|
2073 | var state = getInternalState(this);
|
2074 | var string = state.string;
|
2075 | var index = state.index;
|
2076 | var point;
|
2077 | if (index >= string.length) return {
|
2078 | value: undefined,
|
2079 | done: true
|
2080 | };
|
2081 | point = charAt(string, index);
|
2082 | state.index += point.length;
|
2083 | return {
|
2084 | value: point,
|
2085 | done: false
|
2086 | };
|
2087 | });
|
2088 |
|
2089 | var WrappedWellKnownSymbolModule = wellKnownSymbolWrapped;
|
2090 | var iterator$4 = WrappedWellKnownSymbolModule.f('iterator');
|
2091 |
|
2092 | var parent$P = iterator$4;
|
2093 | var iterator$3 = parent$P;
|
2094 |
|
2095 | var parent$O = iterator$3;
|
2096 | var iterator$2 = parent$O;
|
2097 |
|
2098 | var iterator$1 = iterator$2;
|
2099 |
|
2100 | function _typeof(obj) {
|
2101 | "@babel/helpers - typeof";
|
2102 |
|
2103 | if (typeof symbol$1 === "function" && typeof iterator$1 === "symbol") {
|
2104 | _typeof = function _typeof(obj) {
|
2105 | return typeof obj;
|
2106 | };
|
2107 | } else {
|
2108 | _typeof = function _typeof(obj) {
|
2109 | return obj && typeof symbol$1 === "function" && obj.constructor === symbol$1 && obj !== symbol$1.prototype ? "symbol" : typeof obj;
|
2110 | };
|
2111 | }
|
2112 |
|
2113 | return _typeof(obj);
|
2114 | }
|
2115 |
|
2116 | var floor = Math.floor;
|
2117 |
|
2118 | var mergeSort = function (array, comparefn) {
|
2119 | var length = array.length;
|
2120 | var middle = floor(length / 2);
|
2121 | return length < 8 ? insertionSort(array, comparefn) : merge$1(mergeSort(array.slice(0, middle), comparefn), mergeSort(array.slice(middle), comparefn), comparefn);
|
2122 | };
|
2123 |
|
2124 | var insertionSort = function (array, comparefn) {
|
2125 | var length = array.length;
|
2126 | var i = 1;
|
2127 | var element, j;
|
2128 |
|
2129 | while (i < length) {
|
2130 | j = i;
|
2131 | element = array[i];
|
2132 |
|
2133 | while (j && comparefn(array[j - 1], element) > 0) {
|
2134 | array[j] = array[--j];
|
2135 | }
|
2136 |
|
2137 | if (j !== i++) array[j] = element;
|
2138 | }
|
2139 |
|
2140 | return array;
|
2141 | };
|
2142 |
|
2143 | var merge$1 = function (left, right, comparefn) {
|
2144 | var llength = left.length;
|
2145 | var rlength = right.length;
|
2146 | var lindex = 0;
|
2147 | var rindex = 0;
|
2148 | var result = [];
|
2149 |
|
2150 | while (lindex < llength || rindex < rlength) {
|
2151 | if (lindex < llength && rindex < rlength) {
|
2152 | result.push(comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]);
|
2153 | } else {
|
2154 | result.push(lindex < llength ? left[lindex++] : right[rindex++]);
|
2155 | }
|
2156 | }
|
2157 |
|
2158 | return result;
|
2159 | };
|
2160 |
|
2161 | var arraySort = mergeSort;
|
2162 |
|
2163 | var fails$a = fails$l;
|
2164 |
|
2165 | var arrayMethodIsStrict$5 = function (METHOD_NAME, argument) {
|
2166 | var method = [][METHOD_NAME];
|
2167 | return !!method && fails$a(function () {
|
2168 | // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
|
2169 | method.call(null, argument || function () {
|
2170 | throw 1;
|
2171 | }, 1);
|
2172 | });
|
2173 | };
|
2174 |
|
2175 | var userAgent$2 = engineUserAgent;
|
2176 | var firefox = userAgent$2.match(/firefox\/(\d+)/i);
|
2177 | var engineFfVersion = !!firefox && +firefox[1];
|
2178 |
|
2179 | var UA = engineUserAgent;
|
2180 | var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
2181 |
|
2182 | var userAgent$1 = engineUserAgent;
|
2183 | var webkit = userAgent$1.match(/AppleWebKit\/(\d+)\./);
|
2184 | var engineWebkitVersion = !!webkit && +webkit[1];
|
2185 |
|
2186 | var $$C = _export;
|
2187 | var aFunction$4 = aFunction$6;
|
2188 | var toObject$8 = toObject$e;
|
2189 | var toLength$8 = toLength$c;
|
2190 | var toString$4 = toString$9;
|
2191 | var fails$9 = fails$l;
|
2192 | var internalSort = arraySort;
|
2193 | var arrayMethodIsStrict$4 = arrayMethodIsStrict$5;
|
2194 | var FF = engineFfVersion;
|
2195 | var IE_OR_EDGE = engineIsIeOrEdge;
|
2196 | var V8 = engineV8Version;
|
2197 | var WEBKIT = engineWebkitVersion;
|
2198 | var test$1 = [];
|
2199 | var nativeSort = test$1.sort; // IE8-
|
2200 |
|
2201 | var FAILS_ON_UNDEFINED = fails$9(function () {
|
2202 | test$1.sort(undefined);
|
2203 | }); // V8 bug
|
2204 |
|
2205 | var FAILS_ON_NULL = fails$9(function () {
|
2206 | test$1.sort(null);
|
2207 | }); // Old WebKit
|
2208 |
|
2209 | var STRICT_METHOD$4 = arrayMethodIsStrict$4('sort');
|
2210 | var STABLE_SORT = !fails$9(function () {
|
2211 | // feature detection can be too slow, so check engines versions
|
2212 | if (V8) return V8 < 70;
|
2213 | if (FF && FF > 3) return;
|
2214 | if (IE_OR_EDGE) return true;
|
2215 | if (WEBKIT) return WEBKIT < 603;
|
2216 | var result = '';
|
2217 | var code, chr, value, index; // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
2218 |
|
2219 | for (code = 65; code < 76; code++) {
|
2220 | chr = String.fromCharCode(code);
|
2221 |
|
2222 | switch (code) {
|
2223 | case 66:
|
2224 | case 69:
|
2225 | case 70:
|
2226 | case 72:
|
2227 | value = 3;
|
2228 | break;
|
2229 |
|
2230 | case 68:
|
2231 | case 71:
|
2232 | value = 4;
|
2233 | break;
|
2234 |
|
2235 | default:
|
2236 | value = 2;
|
2237 | }
|
2238 |
|
2239 | for (index = 0; index < 47; index++) {
|
2240 | test$1.push({
|
2241 | k: chr + index,
|
2242 | v: value
|
2243 | });
|
2244 | }
|
2245 | }
|
2246 |
|
2247 | test$1.sort(function (a, b) {
|
2248 | return b.v - a.v;
|
2249 | });
|
2250 |
|
2251 | for (index = 0; index < test$1.length; index++) {
|
2252 | chr = test$1[index].k.charAt(0);
|
2253 | if (result.charAt(result.length - 1) !== chr) result += chr;
|
2254 | }
|
2255 |
|
2256 | return result !== 'DGBEFHACIJK';
|
2257 | });
|
2258 | var FORCED$5 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$4 || !STABLE_SORT;
|
2259 |
|
2260 | var getSortCompare = function (comparefn) {
|
2261 | return function (x, y) {
|
2262 | if (y === undefined) return -1;
|
2263 | if (x === undefined) return 1;
|
2264 | if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
2265 | return toString$4(x) > toString$4(y) ? 1 : -1;
|
2266 | };
|
2267 | }; // `Array.prototype.sort` method
|
2268 | // https://tc39.es/ecma262/#sec-array.prototype.sort
|
2269 |
|
2270 |
|
2271 | $$C({
|
2272 | target: 'Array',
|
2273 | proto: true,
|
2274 | forced: FORCED$5
|
2275 | }, {
|
2276 | sort: function sort(comparefn) {
|
2277 | if (comparefn !== undefined) aFunction$4(comparefn);
|
2278 | var array = toObject$8(this);
|
2279 | if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn);
|
2280 | var items = [];
|
2281 | var arrayLength = toLength$8(array.length);
|
2282 | var itemsLength, index;
|
2283 |
|
2284 | for (index = 0; index < arrayLength; index++) {
|
2285 | if (index in array) items.push(array[index]);
|
2286 | }
|
2287 |
|
2288 | items = internalSort(items, getSortCompare(comparefn));
|
2289 | itemsLength = items.length;
|
2290 | index = 0;
|
2291 |
|
2292 | while (index < itemsLength) array[index] = items[index++];
|
2293 |
|
2294 | while (index < arrayLength) delete array[index++];
|
2295 |
|
2296 | return array;
|
2297 | }
|
2298 | });
|
2299 |
|
2300 | var path$n = path$s;
|
2301 |
|
2302 | var entryVirtual$k = function (CONSTRUCTOR) {
|
2303 | return path$n[CONSTRUCTOR + 'Prototype'];
|
2304 | };
|
2305 |
|
2306 | var entryVirtual$j = entryVirtual$k;
|
2307 | var sort$3 = entryVirtual$j('Array').sort;
|
2308 |
|
2309 | var sort$2 = sort$3;
|
2310 | var ArrayPrototype$h = Array.prototype;
|
2311 |
|
2312 | var sort_1 = function (it) {
|
2313 | var own = it.sort;
|
2314 | return it === ArrayPrototype$h || it instanceof Array && own === ArrayPrototype$h.sort ? sort$2 : own;
|
2315 | };
|
2316 |
|
2317 | var parent$N = sort_1;
|
2318 | var sort$1 = parent$N;
|
2319 |
|
2320 | var sort = sort$1;
|
2321 |
|
2322 | /* eslint-disable es/no-array-prototype-indexof -- required for testing */
|
2323 |
|
2324 |
|
2325 | var $$B = _export;
|
2326 | var $indexOf = arrayIncludes$1.indexOf;
|
2327 | var arrayMethodIsStrict$3 = arrayMethodIsStrict$5;
|
2328 | var nativeIndexOf = [].indexOf;
|
2329 | var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
|
2330 | var STRICT_METHOD$3 = arrayMethodIsStrict$3('indexOf'); // `Array.prototype.indexOf` method
|
2331 | // https://tc39.es/ecma262/#sec-array.prototype.indexof
|
2332 |
|
2333 | $$B({
|
2334 | target: 'Array',
|
2335 | proto: true,
|
2336 | forced: NEGATIVE_ZERO || !STRICT_METHOD$3
|
2337 | }, {
|
2338 | indexOf: function indexOf(searchElement
|
2339 | /* , fromIndex = 0 */
|
2340 | ) {
|
2341 | return NEGATIVE_ZERO // convert -0 to +0
|
2342 | ? nativeIndexOf.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
|
2343 | }
|
2344 | });
|
2345 |
|
2346 | var entryVirtual$i = entryVirtual$k;
|
2347 | var indexOf$3 = entryVirtual$i('Array').indexOf;
|
2348 |
|
2349 | var indexOf$2 = indexOf$3;
|
2350 | var ArrayPrototype$g = Array.prototype;
|
2351 |
|
2352 | var indexOf_1 = function (it) {
|
2353 | var own = it.indexOf;
|
2354 | return it === ArrayPrototype$g || it instanceof Array && own === ArrayPrototype$g.indexOf ? indexOf$2 : own;
|
2355 | };
|
2356 |
|
2357 | var parent$M = indexOf_1;
|
2358 | var indexOf$1 = parent$M;
|
2359 |
|
2360 | var indexOf = indexOf$1;
|
2361 |
|
2362 | var $$A = _export;
|
2363 | var $filter = arrayIteration.filter;
|
2364 | var arrayMethodHasSpeciesSupport$3 = arrayMethodHasSpeciesSupport$5;
|
2365 | var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport$3('filter'); // `Array.prototype.filter` method
|
2366 | // https://tc39.es/ecma262/#sec-array.prototype.filter
|
2367 | // with adding support of @@species
|
2368 |
|
2369 | $$A({
|
2370 | target: 'Array',
|
2371 | proto: true,
|
2372 | forced: !HAS_SPECIES_SUPPORT$3
|
2373 | }, {
|
2374 | filter: function filter(callbackfn
|
2375 | /* , thisArg */
|
2376 | ) {
|
2377 | return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
2378 | }
|
2379 | });
|
2380 |
|
2381 | var entryVirtual$h = entryVirtual$k;
|
2382 | var filter$3 = entryVirtual$h('Array').filter;
|
2383 |
|
2384 | var filter$2 = filter$3;
|
2385 | var ArrayPrototype$f = Array.prototype;
|
2386 |
|
2387 | var filter_1 = function (it) {
|
2388 | var own = it.filter;
|
2389 | return it === ArrayPrototype$f || it instanceof Array && own === ArrayPrototype$f.filter ? filter$2 : own;
|
2390 | };
|
2391 |
|
2392 | var parent$L = filter_1;
|
2393 | var filter$1 = parent$L;
|
2394 |
|
2395 | var filter = filter$1;
|
2396 |
|
2397 | var whitespaces$4 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
2398 |
|
2399 | var requireObjectCoercible$1 = requireObjectCoercible$5;
|
2400 | var toString$3 = toString$9;
|
2401 | var whitespaces$3 = whitespaces$4;
|
2402 | var whitespace = '[' + whitespaces$3 + ']';
|
2403 | var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
2404 | var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
2405 |
|
2406 | var createMethod$2 = function (TYPE) {
|
2407 | return function ($this) {
|
2408 | var string = toString$3(requireObjectCoercible$1($this));
|
2409 | if (TYPE & 1) string = string.replace(ltrim, '');
|
2410 | if (TYPE & 2) string = string.replace(rtrim, '');
|
2411 | return string;
|
2412 | };
|
2413 | };
|
2414 |
|
2415 | var stringTrim = {
|
2416 | // `String.prototype.{ trimLeft, trimStart }` methods
|
2417 | // https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
2418 | start: createMethod$2(1),
|
2419 | // `String.prototype.{ trimRight, trimEnd }` methods
|
2420 | // https://tc39.es/ecma262/#sec-string.prototype.trimend
|
2421 | end: createMethod$2(2),
|
2422 | // `String.prototype.trim` method
|
2423 | // https://tc39.es/ecma262/#sec-string.prototype.trim
|
2424 | trim: createMethod$2(3)
|
2425 | };
|
2426 |
|
2427 | var global$5 = global$i;
|
2428 | var toString$2 = toString$9;
|
2429 | var trim$1 = stringTrim.trim;
|
2430 | var whitespaces$2 = whitespaces$4;
|
2431 | var $parseFloat = global$5.parseFloat;
|
2432 | var FORCED$4 = 1 / $parseFloat(whitespaces$2 + '-0') !== -Infinity; // `parseFloat` method
|
2433 | // https://tc39.es/ecma262/#sec-parsefloat-string
|
2434 |
|
2435 | var numberParseFloat = FORCED$4 ? function parseFloat(string) {
|
2436 | var trimmedString = trim$1(toString$2(string));
|
2437 | var result = $parseFloat(trimmedString);
|
2438 | return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result;
|
2439 | } : $parseFloat;
|
2440 |
|
2441 | var $$z = _export;
|
2442 | var parseFloatImplementation = numberParseFloat; // `parseFloat` method
|
2443 | // https://tc39.es/ecma262/#sec-parsefloat-string
|
2444 |
|
2445 | $$z({
|
2446 | global: true,
|
2447 | forced: parseFloat != parseFloatImplementation
|
2448 | }, {
|
2449 | parseFloat: parseFloatImplementation
|
2450 | });
|
2451 |
|
2452 | var path$m = path$s;
|
2453 | var _parseFloat$2 = path$m.parseFloat;
|
2454 |
|
2455 | var parent$K = _parseFloat$2;
|
2456 | var _parseFloat$1 = parent$K;
|
2457 |
|
2458 | var _parseFloat = _parseFloat$1;
|
2459 |
|
2460 | var toObject$7 = toObject$e;
|
2461 | var toAbsoluteIndex$2 = toAbsoluteIndex$4;
|
2462 | var toLength$7 = toLength$c; // `Array.prototype.fill` method implementation
|
2463 | // https://tc39.es/ecma262/#sec-array.prototype.fill
|
2464 |
|
2465 | var arrayFill = function fill(value
|
2466 | /* , start = 0, end = @length */
|
2467 | ) {
|
2468 | var O = toObject$7(this);
|
2469 | var length = toLength$7(O.length);
|
2470 | var argumentsLength = arguments.length;
|
2471 | var index = toAbsoluteIndex$2(argumentsLength > 1 ? arguments[1] : undefined, length);
|
2472 | var end = argumentsLength > 2 ? arguments[2] : undefined;
|
2473 | var endPos = end === undefined ? length : toAbsoluteIndex$2(end, length);
|
2474 |
|
2475 | while (endPos > index) O[index++] = value;
|
2476 |
|
2477 | return O;
|
2478 | };
|
2479 |
|
2480 | var $$y = _export;
|
2481 | var fill$4 = arrayFill;
|
2482 | // https://tc39.es/ecma262/#sec-array.prototype.fill
|
2483 |
|
2484 | $$y({
|
2485 | target: 'Array',
|
2486 | proto: true
|
2487 | }, {
|
2488 | fill: fill$4
|
2489 | }); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
2490 |
|
2491 | var entryVirtual$g = entryVirtual$k;
|
2492 | var fill$3 = entryVirtual$g('Array').fill;
|
2493 |
|
2494 | var fill$2 = fill$3;
|
2495 | var ArrayPrototype$e = Array.prototype;
|
2496 |
|
2497 | var fill_1 = function (it) {
|
2498 | var own = it.fill;
|
2499 | return it === ArrayPrototype$e || it instanceof Array && own === ArrayPrototype$e.fill ? fill$2 : own;
|
2500 | };
|
2501 |
|
2502 | var parent$J = fill_1;
|
2503 | var fill$1 = parent$J;
|
2504 |
|
2505 | var fill = fill$1;
|
2506 |
|
2507 | var entryVirtual$f = entryVirtual$k;
|
2508 | var values$3 = entryVirtual$f('Array').values;
|
2509 |
|
2510 | var parent$I = values$3;
|
2511 | var values$2 = parent$I;
|
2512 |
|
2513 | var values$1 = values$2;
|
2514 | var classof$6 = classof$9;
|
2515 | var ArrayPrototype$d = Array.prototype;
|
2516 | var DOMIterables$3 = {
|
2517 | DOMTokenList: true,
|
2518 | NodeList: true
|
2519 | };
|
2520 |
|
2521 | var values_1 = function (it) {
|
2522 | var own = it.values;
|
2523 | return it === ArrayPrototype$d || it instanceof Array && own === ArrayPrototype$d.values // eslint-disable-next-line no-prototype-builtins -- safe
|
2524 | || DOMIterables$3.hasOwnProperty(classof$6(it)) ? values$1 : own;
|
2525 | };
|
2526 |
|
2527 | var values = values_1;
|
2528 |
|
2529 | var $forEach = arrayIteration.forEach;
|
2530 | var arrayMethodIsStrict$2 = arrayMethodIsStrict$5;
|
2531 | var STRICT_METHOD$2 = arrayMethodIsStrict$2('forEach'); // `Array.prototype.forEach` method implementation
|
2532 | // https://tc39.es/ecma262/#sec-array.prototype.foreach
|
2533 |
|
2534 | var arrayForEach = !STRICT_METHOD$2 ? function forEach(callbackfn
|
2535 | /* , thisArg */
|
2536 | ) {
|
2537 | return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); // eslint-disable-next-line es/no-array-prototype-foreach -- safe
|
2538 | } : [].forEach;
|
2539 |
|
2540 | var $$x = _export;
|
2541 | var forEach$5 = arrayForEach; // `Array.prototype.forEach` method
|
2542 | // https://tc39.es/ecma262/#sec-array.prototype.foreach
|
2543 | // eslint-disable-next-line es/no-array-prototype-foreach -- safe
|
2544 |
|
2545 | $$x({
|
2546 | target: 'Array',
|
2547 | proto: true,
|
2548 | forced: [].forEach != forEach$5
|
2549 | }, {
|
2550 | forEach: forEach$5
|
2551 | });
|
2552 |
|
2553 | var entryVirtual$e = entryVirtual$k;
|
2554 | var forEach$4 = entryVirtual$e('Array').forEach;
|
2555 |
|
2556 | var parent$H = forEach$4;
|
2557 | var forEach$3 = parent$H;
|
2558 |
|
2559 | var forEach$2 = forEach$3;
|
2560 | var classof$5 = classof$9;
|
2561 | var ArrayPrototype$c = Array.prototype;
|
2562 | var DOMIterables$2 = {
|
2563 | DOMTokenList: true,
|
2564 | NodeList: true
|
2565 | };
|
2566 |
|
2567 | var forEach_1 = function (it) {
|
2568 | var own = it.forEach;
|
2569 | return it === ArrayPrototype$c || it instanceof Array && own === ArrayPrototype$c.forEach // eslint-disable-next-line no-prototype-builtins -- safe
|
2570 | || DOMIterables$2.hasOwnProperty(classof$5(it)) ? forEach$2 : own;
|
2571 | };
|
2572 |
|
2573 | var forEach$1 = forEach_1;
|
2574 |
|
2575 | var $$w = _export;
|
2576 | var isArray$8 = isArray$c; // `Array.isArray` method
|
2577 | // https://tc39.es/ecma262/#sec-array.isarray
|
2578 |
|
2579 | $$w({
|
2580 | target: 'Array',
|
2581 | stat: true
|
2582 | }, {
|
2583 | isArray: isArray$8
|
2584 | });
|
2585 |
|
2586 | var path$l = path$s;
|
2587 | var isArray$7 = path$l.Array.isArray;
|
2588 |
|
2589 | var parent$G = isArray$7;
|
2590 | var isArray$6 = parent$G;
|
2591 |
|
2592 | var isArray$5 = isArray$6;
|
2593 |
|
2594 | var $$v = _export; // `Number.isNaN` method
|
2595 | // https://tc39.es/ecma262/#sec-number.isnan
|
2596 |
|
2597 | $$v({
|
2598 | target: 'Number',
|
2599 | stat: true
|
2600 | }, {
|
2601 | isNaN: function isNaN(number) {
|
2602 | // eslint-disable-next-line no-self-compare -- NaN check
|
2603 | return number != number;
|
2604 | }
|
2605 | });
|
2606 |
|
2607 | var path$k = path$s;
|
2608 | var isNan$2 = path$k.Number.isNaN;
|
2609 |
|
2610 | var parent$F = isNan$2;
|
2611 | var isNan$1 = parent$F;
|
2612 |
|
2613 | var isNan = isNan$1;
|
2614 |
|
2615 | var entryVirtual$d = entryVirtual$k;
|
2616 | var concat$3 = entryVirtual$d('Array').concat;
|
2617 |
|
2618 | var concat$2 = concat$3;
|
2619 | var ArrayPrototype$b = Array.prototype;
|
2620 |
|
2621 | var concat_1 = function (it) {
|
2622 | var own = it.concat;
|
2623 | return it === ArrayPrototype$b || it instanceof Array && own === ArrayPrototype$b.concat ? concat$2 : own;
|
2624 | };
|
2625 |
|
2626 | var parent$E = concat_1;
|
2627 | var concat$1 = parent$E;
|
2628 |
|
2629 | var concat = concat$1;
|
2630 |
|
2631 | var $$u = _export;
|
2632 | var global$4 = global$i;
|
2633 | var userAgent = engineUserAgent;
|
2634 | var slice$7 = [].slice;
|
2635 | var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
|
2636 |
|
2637 | var wrap = function (scheduler) {
|
2638 | return function (handler, timeout
|
2639 | /* , ...arguments */
|
2640 | ) {
|
2641 | var boundArgs = arguments.length > 2;
|
2642 | var args = boundArgs ? slice$7.call(arguments, 2) : undefined;
|
2643 | return scheduler(boundArgs ? function () {
|
2644 | // eslint-disable-next-line no-new-func -- spec requirement
|
2645 | (typeof handler == 'function' ? handler : Function(handler)).apply(this, args);
|
2646 | } : handler, timeout);
|
2647 | };
|
2648 | }; // ie9- setTimeout & setInterval additional parameters fix
|
2649 | // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
|
2650 |
|
2651 |
|
2652 | $$u({
|
2653 | global: true,
|
2654 | bind: true,
|
2655 | forced: MSIE
|
2656 | }, {
|
2657 | // `setTimeout` method
|
2658 | // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
|
2659 | setTimeout: wrap(global$4.setTimeout),
|
2660 | // `setInterval` method
|
2661 | // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
|
2662 | setInterval: wrap(global$4.setInterval)
|
2663 | });
|
2664 |
|
2665 | var path$j = path$s;
|
2666 | var setTimeout$2 = path$j.setTimeout;
|
2667 |
|
2668 | var setTimeout$1 = setTimeout$2;
|
2669 |
|
2670 | var DESCRIPTORS$9 = descriptors;
|
2671 | var fails$8 = fails$l;
|
2672 | var objectKeys$1 = objectKeys$4;
|
2673 | var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
|
2674 | var propertyIsEnumerableModule = objectPropertyIsEnumerable;
|
2675 | var toObject$6 = toObject$e;
|
2676 | var IndexedObject$1 = indexedObject; // eslint-disable-next-line es/no-object-assign -- safe
|
2677 |
|
2678 | var $assign = Object.assign; // eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
2679 |
|
2680 | var defineProperty$9 = Object.defineProperty; // `Object.assign` method
|
2681 | // https://tc39.es/ecma262/#sec-object.assign
|
2682 |
|
2683 | var objectAssign = !$assign || fails$8(function () {
|
2684 | // should have correct order of operations (Edge bug)
|
2685 | if (DESCRIPTORS$9 && $assign({
|
2686 | b: 1
|
2687 | }, $assign(defineProperty$9({}, 'a', {
|
2688 | enumerable: true,
|
2689 | get: function () {
|
2690 | defineProperty$9(this, 'b', {
|
2691 | value: 3,
|
2692 | enumerable: false
|
2693 | });
|
2694 | }
|
2695 | }), {
|
2696 | b: 2
|
2697 | })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug)
|
2698 |
|
2699 | var A = {};
|
2700 | var B = {}; // eslint-disable-next-line es/no-symbol -- safe
|
2701 |
|
2702 | var symbol = Symbol();
|
2703 | var alphabet = 'abcdefghijklmnopqrst';
|
2704 | A[symbol] = 7;
|
2705 | alphabet.split('').forEach(function (chr) {
|
2706 | B[chr] = chr;
|
2707 | });
|
2708 | return $assign({}, A)[symbol] != 7 || objectKeys$1($assign({}, B)).join('') != alphabet;
|
2709 | }) ? function assign(target, source) {
|
2710 | // eslint-disable-line no-unused-vars -- required for `.length`
|
2711 | var T = toObject$6(target);
|
2712 | var argumentsLength = arguments.length;
|
2713 | var index = 1;
|
2714 | var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
|
2715 | var propertyIsEnumerable = propertyIsEnumerableModule.f;
|
2716 |
|
2717 | while (argumentsLength > index) {
|
2718 | var S = IndexedObject$1(arguments[index++]);
|
2719 | var keys = getOwnPropertySymbols ? objectKeys$1(S).concat(getOwnPropertySymbols(S)) : objectKeys$1(S);
|
2720 | var length = keys.length;
|
2721 | var j = 0;
|
2722 | var key;
|
2723 |
|
2724 | while (length > j) {
|
2725 | key = keys[j++];
|
2726 | if (!DESCRIPTORS$9 || propertyIsEnumerable.call(S, key)) T[key] = S[key];
|
2727 | }
|
2728 | }
|
2729 |
|
2730 | return T;
|
2731 | } : $assign;
|
2732 |
|
2733 | var $$t = _export;
|
2734 | var assign$5 = objectAssign; // `Object.assign` method
|
2735 | // https://tc39.es/ecma262/#sec-object.assign
|
2736 | // eslint-disable-next-line es/no-object-assign -- required for testing
|
2737 |
|
2738 | $$t({
|
2739 | target: 'Object',
|
2740 | stat: true,
|
2741 | forced: Object.assign !== assign$5
|
2742 | }, {
|
2743 | assign: assign$5
|
2744 | });
|
2745 |
|
2746 | var path$i = path$s;
|
2747 | var assign$4 = path$i.Object.assign;
|
2748 |
|
2749 | var parent$D = assign$4;
|
2750 | var assign$3 = parent$D;
|
2751 |
|
2752 | var assign$2 = assign$3;
|
2753 |
|
2754 | var componentEmitter = {exports: {}};
|
2755 |
|
2756 | (function (module) {
|
2757 | /**
|
2758 | * Expose `Emitter`.
|
2759 | */
|
2760 | {
|
2761 | module.exports = Emitter;
|
2762 | }
|
2763 | /**
|
2764 | * Initialize a new `Emitter`.
|
2765 | *
|
2766 | * @api public
|
2767 | */
|
2768 |
|
2769 |
|
2770 | function Emitter(obj) {
|
2771 | if (obj) return mixin(obj);
|
2772 | }
|
2773 | /**
|
2774 | * Mixin the emitter properties.
|
2775 | *
|
2776 | * @param {Object} obj
|
2777 | * @return {Object}
|
2778 | * @api private
|
2779 | */
|
2780 |
|
2781 | function mixin(obj) {
|
2782 | for (var key in Emitter.prototype) {
|
2783 | obj[key] = Emitter.prototype[key];
|
2784 | }
|
2785 |
|
2786 | return obj;
|
2787 | }
|
2788 | /**
|
2789 | * Listen on the given `event` with `fn`.
|
2790 | *
|
2791 | * @param {String} event
|
2792 | * @param {Function} fn
|
2793 | * @return {Emitter}
|
2794 | * @api public
|
2795 | */
|
2796 |
|
2797 |
|
2798 | Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
|
2799 | this._callbacks = this._callbacks || {};
|
2800 | (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
|
2801 | return this;
|
2802 | };
|
2803 | /**
|
2804 | * Adds an `event` listener that will be invoked a single
|
2805 | * time then automatically removed.
|
2806 | *
|
2807 | * @param {String} event
|
2808 | * @param {Function} fn
|
2809 | * @return {Emitter}
|
2810 | * @api public
|
2811 | */
|
2812 |
|
2813 |
|
2814 | Emitter.prototype.once = function (event, fn) {
|
2815 | function on() {
|
2816 | this.off(event, on);
|
2817 | fn.apply(this, arguments);
|
2818 | }
|
2819 |
|
2820 | on.fn = fn;
|
2821 | this.on(event, on);
|
2822 | return this;
|
2823 | };
|
2824 | /**
|
2825 | * Remove the given callback for `event` or all
|
2826 | * registered callbacks.
|
2827 | *
|
2828 | * @param {String} event
|
2829 | * @param {Function} fn
|
2830 | * @return {Emitter}
|
2831 | * @api public
|
2832 | */
|
2833 |
|
2834 |
|
2835 | Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
|
2836 | this._callbacks = this._callbacks || {}; // all
|
2837 |
|
2838 | if (0 == arguments.length) {
|
2839 | this._callbacks = {};
|
2840 | return this;
|
2841 | } // specific event
|
2842 |
|
2843 |
|
2844 | var callbacks = this._callbacks['$' + event];
|
2845 | if (!callbacks) return this; // remove all handlers
|
2846 |
|
2847 | if (1 == arguments.length) {
|
2848 | delete this._callbacks['$' + event];
|
2849 | return this;
|
2850 | } // remove specific handler
|
2851 |
|
2852 |
|
2853 | var cb;
|
2854 |
|
2855 | for (var i = 0; i < callbacks.length; i++) {
|
2856 | cb = callbacks[i];
|
2857 |
|
2858 | if (cb === fn || cb.fn === fn) {
|
2859 | callbacks.splice(i, 1);
|
2860 | break;
|
2861 | }
|
2862 | } // Remove event specific arrays for event types that no
|
2863 | // one is subscribed for to avoid memory leak.
|
2864 |
|
2865 |
|
2866 | if (callbacks.length === 0) {
|
2867 | delete this._callbacks['$' + event];
|
2868 | }
|
2869 |
|
2870 | return this;
|
2871 | };
|
2872 | /**
|
2873 | * Emit `event` with the given args.
|
2874 | *
|
2875 | * @param {String} event
|
2876 | * @param {Mixed} ...
|
2877 | * @return {Emitter}
|
2878 | */
|
2879 |
|
2880 |
|
2881 | Emitter.prototype.emit = function (event) {
|
2882 | this._callbacks = this._callbacks || {};
|
2883 | var args = new Array(arguments.length - 1),
|
2884 | callbacks = this._callbacks['$' + event];
|
2885 |
|
2886 | for (var i = 1; i < arguments.length; i++) {
|
2887 | args[i - 1] = arguments[i];
|
2888 | }
|
2889 |
|
2890 | if (callbacks) {
|
2891 | callbacks = callbacks.slice(0);
|
2892 |
|
2893 | for (var i = 0, len = callbacks.length; i < len; ++i) {
|
2894 | callbacks[i].apply(this, args);
|
2895 | }
|
2896 | }
|
2897 |
|
2898 | return this;
|
2899 | };
|
2900 | /**
|
2901 | * Return array of callbacks for `event`.
|
2902 | *
|
2903 | * @param {String} event
|
2904 | * @return {Array}
|
2905 | * @api public
|
2906 | */
|
2907 |
|
2908 |
|
2909 | Emitter.prototype.listeners = function (event) {
|
2910 | this._callbacks = this._callbacks || {};
|
2911 | return this._callbacks['$' + event] || [];
|
2912 | };
|
2913 | /**
|
2914 | * Check if this emitter has `event` handlers.
|
2915 | *
|
2916 | * @param {String} event
|
2917 | * @return {Boolean}
|
2918 | * @api public
|
2919 | */
|
2920 |
|
2921 |
|
2922 | Emitter.prototype.hasListeners = function (event) {
|
2923 | return !!this.listeners(event).length;
|
2924 | };
|
2925 | })(componentEmitter);
|
2926 |
|
2927 | var Emitter = componentEmitter.exports;
|
2928 |
|
2929 | var anObject$5 = anObject$b;
|
2930 |
|
2931 | var iteratorClose$2 = function (iterator) {
|
2932 | var returnMethod = iterator['return'];
|
2933 |
|
2934 | if (returnMethod !== undefined) {
|
2935 | return anObject$5(returnMethod.call(iterator)).value;
|
2936 | }
|
2937 | };
|
2938 |
|
2939 | var anObject$4 = anObject$b;
|
2940 | var iteratorClose$1 = iteratorClose$2; // call something on iterator step with safe closing on error
|
2941 |
|
2942 | var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) {
|
2943 | try {
|
2944 | return ENTRIES ? fn(anObject$4(value)[0], value[1]) : fn(value);
|
2945 | } catch (error) {
|
2946 | iteratorClose$1(iterator);
|
2947 | throw error;
|
2948 | }
|
2949 | };
|
2950 |
|
2951 | var wellKnownSymbol$6 = wellKnownSymbol$j;
|
2952 | var Iterators$1 = iterators;
|
2953 | var ITERATOR$2 = wellKnownSymbol$6('iterator');
|
2954 | var ArrayPrototype$a = Array.prototype; // check on default Array iterator
|
2955 |
|
2956 | var isArrayIteratorMethod$2 = function (it) {
|
2957 | return it !== undefined && (Iterators$1.Array === it || ArrayPrototype$a[ITERATOR$2] === it);
|
2958 | };
|
2959 |
|
2960 | var classof$4 = classof$9;
|
2961 | var Iterators = iterators;
|
2962 | var wellKnownSymbol$5 = wellKnownSymbol$j;
|
2963 | var ITERATOR$1 = wellKnownSymbol$5('iterator');
|
2964 |
|
2965 | var getIteratorMethod$7 = function (it) {
|
2966 | if (it != undefined) return it[ITERATOR$1] || it['@@iterator'] || Iterators[classof$4(it)];
|
2967 | };
|
2968 |
|
2969 | var bind$9 = functionBindContext;
|
2970 | var toObject$5 = toObject$e;
|
2971 | var callWithSafeIterationClosing = callWithSafeIterationClosing$1;
|
2972 | var isArrayIteratorMethod$1 = isArrayIteratorMethod$2;
|
2973 | var toLength$6 = toLength$c;
|
2974 | var createProperty$3 = createProperty$5;
|
2975 | var getIteratorMethod$6 = getIteratorMethod$7; // `Array.from` method implementation
|
2976 | // https://tc39.es/ecma262/#sec-array.from
|
2977 |
|
2978 | var arrayFrom = function from(arrayLike
|
2979 | /* , mapfn = undefined, thisArg = undefined */
|
2980 | ) {
|
2981 | var O = toObject$5(arrayLike);
|
2982 | var C = typeof this == 'function' ? this : Array;
|
2983 | var argumentsLength = arguments.length;
|
2984 | var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
|
2985 | var mapping = mapfn !== undefined;
|
2986 | var iteratorMethod = getIteratorMethod$6(O);
|
2987 | var index = 0;
|
2988 | var length, result, step, iterator, next, value;
|
2989 | if (mapping) mapfn = bind$9(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case
|
2990 |
|
2991 | if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod$1(iteratorMethod))) {
|
2992 | iterator = iteratorMethod.call(O);
|
2993 | next = iterator.next;
|
2994 | result = new C();
|
2995 |
|
2996 | for (; !(step = next.call(iterator)).done; index++) {
|
2997 | value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
|
2998 | createProperty$3(result, index, value);
|
2999 | }
|
3000 | } else {
|
3001 | length = toLength$6(O.length);
|
3002 | result = new C(length);
|
3003 |
|
3004 | for (; length > index; index++) {
|
3005 | value = mapping ? mapfn(O[index], index) : O[index];
|
3006 | createProperty$3(result, index, value);
|
3007 | }
|
3008 | }
|
3009 |
|
3010 | result.length = index;
|
3011 | return result;
|
3012 | };
|
3013 |
|
3014 | var wellKnownSymbol$4 = wellKnownSymbol$j;
|
3015 | var ITERATOR = wellKnownSymbol$4('iterator');
|
3016 | var SAFE_CLOSING = false;
|
3017 |
|
3018 | try {
|
3019 | var called = 0;
|
3020 | var iteratorWithReturn = {
|
3021 | next: function () {
|
3022 | return {
|
3023 | done: !!called++
|
3024 | };
|
3025 | },
|
3026 | 'return': function () {
|
3027 | SAFE_CLOSING = true;
|
3028 | }
|
3029 | };
|
3030 |
|
3031 | iteratorWithReturn[ITERATOR] = function () {
|
3032 | return this;
|
3033 | }; // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
|
3034 |
|
3035 |
|
3036 | Array.from(iteratorWithReturn, function () {
|
3037 | throw 2;
|
3038 | });
|
3039 | } catch (error) {
|
3040 | /* empty */
|
3041 | }
|
3042 |
|
3043 | var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
|
3044 | if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
3045 | var ITERATION_SUPPORT = false;
|
3046 |
|
3047 | try {
|
3048 | var object = {};
|
3049 |
|
3050 | object[ITERATOR] = function () {
|
3051 | return {
|
3052 | next: function () {
|
3053 | return {
|
3054 | done: ITERATION_SUPPORT = true
|
3055 | };
|
3056 | }
|
3057 | };
|
3058 | };
|
3059 |
|
3060 | exec(object);
|
3061 | } catch (error) {
|
3062 | /* empty */
|
3063 | }
|
3064 |
|
3065 | return ITERATION_SUPPORT;
|
3066 | };
|
3067 |
|
3068 | var $$s = _export;
|
3069 | var from$5 = arrayFrom;
|
3070 | var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
|
3071 | var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
|
3072 | // eslint-disable-next-line es/no-array-from -- required for testing
|
3073 | Array.from(iterable);
|
3074 | }); // `Array.from` method
|
3075 | // https://tc39.es/ecma262/#sec-array.from
|
3076 |
|
3077 | $$s({
|
3078 | target: 'Array',
|
3079 | stat: true,
|
3080 | forced: INCORRECT_ITERATION
|
3081 | }, {
|
3082 | from: from$5
|
3083 | });
|
3084 |
|
3085 | var path$h = path$s;
|
3086 | var from$4 = path$h.Array.from;
|
3087 |
|
3088 | var parent$C = from$4;
|
3089 | var from$3 = parent$C;
|
3090 |
|
3091 | var from$2 = from$3;
|
3092 |
|
3093 | var getIteratorMethod$5 = getIteratorMethod$7;
|
3094 | var getIteratorMethod_1 = getIteratorMethod$5;
|
3095 |
|
3096 | var parent$B = getIteratorMethod_1;
|
3097 | var getIteratorMethod$4 = parent$B;
|
3098 |
|
3099 | var parent$A = getIteratorMethod$4;
|
3100 | var getIteratorMethod$3 = parent$A;
|
3101 |
|
3102 | var getIteratorMethod$2 = getIteratorMethod$3;
|
3103 |
|
3104 | var path$g = path$s;
|
3105 | var getOwnPropertySymbols$2 = path$g.Object.getOwnPropertySymbols;
|
3106 |
|
3107 | var parent$z = getOwnPropertySymbols$2;
|
3108 | var getOwnPropertySymbols$1 = parent$z;
|
3109 |
|
3110 | var getOwnPropertySymbols = getOwnPropertySymbols$1;
|
3111 |
|
3112 | var getOwnPropertyDescriptor$3 = {exports: {}};
|
3113 |
|
3114 | var $$r = _export;
|
3115 | var fails$7 = fails$l;
|
3116 | var toIndexedObject$3 = toIndexedObject$a;
|
3117 | var nativeGetOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
3118 | var DESCRIPTORS$8 = descriptors;
|
3119 | var FAILS_ON_PRIMITIVES$2 = fails$7(function () {
|
3120 | nativeGetOwnPropertyDescriptor(1);
|
3121 | });
|
3122 | var FORCED$3 = !DESCRIPTORS$8 || FAILS_ON_PRIMITIVES$2; // `Object.getOwnPropertyDescriptor` method
|
3123 | // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
3124 |
|
3125 | $$r({
|
3126 | target: 'Object',
|
3127 | stat: true,
|
3128 | forced: FORCED$3,
|
3129 | sham: !DESCRIPTORS$8
|
3130 | }, {
|
3131 | getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
|
3132 | return nativeGetOwnPropertyDescriptor(toIndexedObject$3(it), key);
|
3133 | }
|
3134 | });
|
3135 |
|
3136 | var path$f = path$s;
|
3137 | var Object$4 = path$f.Object;
|
3138 |
|
3139 | var getOwnPropertyDescriptor$2 = getOwnPropertyDescriptor$3.exports = function getOwnPropertyDescriptor(it, key) {
|
3140 | return Object$4.getOwnPropertyDescriptor(it, key);
|
3141 | };
|
3142 |
|
3143 | if (Object$4.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor$2.sham = true;
|
3144 |
|
3145 | var parent$y = getOwnPropertyDescriptor$3.exports;
|
3146 | var getOwnPropertyDescriptor$1 = parent$y;
|
3147 |
|
3148 | var getOwnPropertyDescriptor = getOwnPropertyDescriptor$1;
|
3149 |
|
3150 | var getBuiltIn$3 = getBuiltIn$8;
|
3151 | var getOwnPropertyNamesModule$1 = objectGetOwnPropertyNames;
|
3152 | var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
|
3153 | var anObject$3 = anObject$b; // all object keys, includes non-enumerable and symbols
|
3154 |
|
3155 | var ownKeys$6 = getBuiltIn$3('Reflect', 'ownKeys') || function ownKeys(it) {
|
3156 | var keys = getOwnPropertyNamesModule$1.f(anObject$3(it));
|
3157 | var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
3158 | return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
3159 | };
|
3160 |
|
3161 | var $$q = _export;
|
3162 | var DESCRIPTORS$7 = descriptors;
|
3163 | var ownKeys$5 = ownKeys$6;
|
3164 | var toIndexedObject$2 = toIndexedObject$a;
|
3165 | var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
|
3166 | var createProperty$2 = createProperty$5; // `Object.getOwnPropertyDescriptors` method
|
3167 | // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
|
3168 |
|
3169 | $$q({
|
3170 | target: 'Object',
|
3171 | stat: true,
|
3172 | sham: !DESCRIPTORS$7
|
3173 | }, {
|
3174 | getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
|
3175 | var O = toIndexedObject$2(object);
|
3176 | var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
3177 | var keys = ownKeys$5(O);
|
3178 | var result = {};
|
3179 | var index = 0;
|
3180 | var key, descriptor;
|
3181 |
|
3182 | while (keys.length > index) {
|
3183 | descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
|
3184 | if (descriptor !== undefined) createProperty$2(result, key, descriptor);
|
3185 | }
|
3186 |
|
3187 | return result;
|
3188 | }
|
3189 | });
|
3190 |
|
3191 | var path$e = path$s;
|
3192 | var getOwnPropertyDescriptors$2 = path$e.Object.getOwnPropertyDescriptors;
|
3193 |
|
3194 | var parent$x = getOwnPropertyDescriptors$2;
|
3195 | var getOwnPropertyDescriptors$1 = parent$x;
|
3196 |
|
3197 | var getOwnPropertyDescriptors = getOwnPropertyDescriptors$1;
|
3198 |
|
3199 | var defineProperties$4 = {exports: {}};
|
3200 |
|
3201 | var $$p = _export;
|
3202 | var DESCRIPTORS$6 = descriptors;
|
3203 | var defineProperties$3 = objectDefineProperties; // `Object.defineProperties` method
|
3204 | // https://tc39.es/ecma262/#sec-object.defineproperties
|
3205 |
|
3206 | $$p({
|
3207 | target: 'Object',
|
3208 | stat: true,
|
3209 | forced: !DESCRIPTORS$6,
|
3210 | sham: !DESCRIPTORS$6
|
3211 | }, {
|
3212 | defineProperties: defineProperties$3
|
3213 | });
|
3214 |
|
3215 | var path$d = path$s;
|
3216 | var Object$3 = path$d.Object;
|
3217 |
|
3218 | var defineProperties$2 = defineProperties$4.exports = function defineProperties(T, D) {
|
3219 | return Object$3.defineProperties(T, D);
|
3220 | };
|
3221 |
|
3222 | if (Object$3.defineProperties.sham) defineProperties$2.sham = true;
|
3223 |
|
3224 | var parent$w = defineProperties$4.exports;
|
3225 | var defineProperties$1 = parent$w;
|
3226 |
|
3227 | var defineProperties = defineProperties$1;
|
3228 |
|
3229 | var defineProperty$8 = {exports: {}};
|
3230 |
|
3231 | var $$o = _export;
|
3232 | var DESCRIPTORS$5 = descriptors;
|
3233 | var objectDefinePropertyModile = objectDefineProperty; // `Object.defineProperty` method
|
3234 | // https://tc39.es/ecma262/#sec-object.defineproperty
|
3235 |
|
3236 | $$o({
|
3237 | target: 'Object',
|
3238 | stat: true,
|
3239 | forced: !DESCRIPTORS$5,
|
3240 | sham: !DESCRIPTORS$5
|
3241 | }, {
|
3242 | defineProperty: objectDefinePropertyModile.f
|
3243 | });
|
3244 |
|
3245 | var path$c = path$s;
|
3246 | var Object$2 = path$c.Object;
|
3247 |
|
3248 | var defineProperty$7 = defineProperty$8.exports = function defineProperty(it, key, desc) {
|
3249 | return Object$2.defineProperty(it, key, desc);
|
3250 | };
|
3251 |
|
3252 | if (Object$2.defineProperty.sham) defineProperty$7.sham = true;
|
3253 |
|
3254 | var parent$v = defineProperty$8.exports;
|
3255 | var defineProperty$6 = parent$v;
|
3256 |
|
3257 | var defineProperty$5 = defineProperty$6;
|
3258 |
|
3259 | function _classCallCheck(instance, Constructor) {
|
3260 | if (!(instance instanceof Constructor)) {
|
3261 | throw new TypeError("Cannot call a class as a function");
|
3262 | }
|
3263 | }
|
3264 |
|
3265 | var parent$u = defineProperty$6;
|
3266 | var defineProperty$4 = parent$u;
|
3267 |
|
3268 | var defineProperty$3 = defineProperty$4;
|
3269 |
|
3270 | function _defineProperties(target, props) {
|
3271 | for (var i = 0; i < props.length; i++) {
|
3272 | var descriptor = props[i];
|
3273 | descriptor.enumerable = descriptor.enumerable || false;
|
3274 | descriptor.configurable = true;
|
3275 | if ("value" in descriptor) descriptor.writable = true;
|
3276 |
|
3277 | defineProperty$3(target, descriptor.key, descriptor);
|
3278 | }
|
3279 | }
|
3280 |
|
3281 | function _createClass(Constructor, protoProps, staticProps) {
|
3282 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
3283 | if (staticProps) _defineProperties(Constructor, staticProps);
|
3284 | return Constructor;
|
3285 | }
|
3286 |
|
3287 | function _defineProperty(obj, key, value) {
|
3288 | if (key in obj) {
|
3289 | defineProperty$3(obj, key, {
|
3290 | value: value,
|
3291 | enumerable: true,
|
3292 | configurable: true,
|
3293 | writable: true
|
3294 | });
|
3295 | } else {
|
3296 | obj[key] = value;
|
3297 | }
|
3298 |
|
3299 | return obj;
|
3300 | }
|
3301 |
|
3302 | var parent$t = isArray$6;
|
3303 | var isArray$4 = parent$t;
|
3304 |
|
3305 | var isArray$3 = isArray$4;
|
3306 |
|
3307 | function _arrayWithHoles(arr) {
|
3308 | if (isArray$3(arr)) return arr;
|
3309 | }
|
3310 |
|
3311 | function _iterableToArrayLimit(arr, i) {
|
3312 | var _i = arr == null ? null : typeof symbol$1 !== "undefined" && getIteratorMethod$2(arr) || arr["@@iterator"];
|
3313 |
|
3314 | if (_i == null) return;
|
3315 | var _arr = [];
|
3316 | var _n = true;
|
3317 | var _d = false;
|
3318 |
|
3319 | var _s, _e;
|
3320 |
|
3321 | try {
|
3322 | for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
3323 | _arr.push(_s.value);
|
3324 |
|
3325 | if (i && _arr.length === i) break;
|
3326 | }
|
3327 | } catch (err) {
|
3328 | _d = true;
|
3329 | _e = err;
|
3330 | } finally {
|
3331 | try {
|
3332 | if (!_n && _i["return"] != null) _i["return"]();
|
3333 | } finally {
|
3334 | if (_d) throw _e;
|
3335 | }
|
3336 | }
|
3337 |
|
3338 | return _arr;
|
3339 | }
|
3340 |
|
3341 | var $$n = _export;
|
3342 | var isObject$5 = isObject$f;
|
3343 | var isArray$2 = isArray$c;
|
3344 | var toAbsoluteIndex$1 = toAbsoluteIndex$4;
|
3345 | var toLength$5 = toLength$c;
|
3346 | var toIndexedObject$1 = toIndexedObject$a;
|
3347 | var createProperty$1 = createProperty$5;
|
3348 | var wellKnownSymbol$3 = wellKnownSymbol$j;
|
3349 | var arrayMethodHasSpeciesSupport$2 = arrayMethodHasSpeciesSupport$5;
|
3350 | var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport$2('slice');
|
3351 | var SPECIES$1 = wellKnownSymbol$3('species');
|
3352 | var nativeSlice = [].slice;
|
3353 | var max$1 = Math.max; // `Array.prototype.slice` method
|
3354 | // https://tc39.es/ecma262/#sec-array.prototype.slice
|
3355 | // fallback for not array-like ES3 strings and DOM objects
|
3356 |
|
3357 | $$n({
|
3358 | target: 'Array',
|
3359 | proto: true,
|
3360 | forced: !HAS_SPECIES_SUPPORT$2
|
3361 | }, {
|
3362 | slice: function slice(start, end) {
|
3363 | var O = toIndexedObject$1(this);
|
3364 | var length = toLength$5(O.length);
|
3365 | var k = toAbsoluteIndex$1(start, length);
|
3366 | var fin = toAbsoluteIndex$1(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
|
3367 |
|
3368 | var Constructor, result, n;
|
3369 |
|
3370 | if (isArray$2(O)) {
|
3371 | Constructor = O.constructor;
|
3372 |
|
3373 | if (typeof Constructor == 'function' && (Constructor === Array || isArray$2(Constructor.prototype))) {
|
3374 | Constructor = undefined;
|
3375 | } else if (isObject$5(Constructor)) {
|
3376 | Constructor = Constructor[SPECIES$1];
|
3377 | if (Constructor === null) Constructor = undefined;
|
3378 | }
|
3379 |
|
3380 | if (Constructor === Array || Constructor === undefined) {
|
3381 | return nativeSlice.call(O, k, fin);
|
3382 | }
|
3383 | }
|
3384 |
|
3385 | result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
|
3386 |
|
3387 | for (n = 0; k < fin; k++, n++) if (k in O) createProperty$1(result, n, O[k]);
|
3388 |
|
3389 | result.length = n;
|
3390 | return result;
|
3391 | }
|
3392 | });
|
3393 |
|
3394 | var entryVirtual$c = entryVirtual$k;
|
3395 | var slice$6 = entryVirtual$c('Array').slice;
|
3396 |
|
3397 | var slice$5 = slice$6;
|
3398 | var ArrayPrototype$9 = Array.prototype;
|
3399 |
|
3400 | var slice_1 = function (it) {
|
3401 | var own = it.slice;
|
3402 | return it === ArrayPrototype$9 || it instanceof Array && own === ArrayPrototype$9.slice ? slice$5 : own;
|
3403 | };
|
3404 |
|
3405 | var parent$s = slice_1;
|
3406 | var slice$4 = parent$s;
|
3407 |
|
3408 | var parent$r = slice$4;
|
3409 | var slice$3 = parent$r;
|
3410 |
|
3411 | var slice$2 = slice$3;
|
3412 |
|
3413 | var parent$q = from$3;
|
3414 | var from$1 = parent$q;
|
3415 |
|
3416 | var from = from$1;
|
3417 |
|
3418 | function _arrayLikeToArray$2(arr, len) {
|
3419 | if (len == null || len > arr.length) len = arr.length;
|
3420 |
|
3421 | for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
3422 | arr2[i] = arr[i];
|
3423 | }
|
3424 |
|
3425 | return arr2;
|
3426 | }
|
3427 |
|
3428 | function _unsupportedIterableToArray$2(o, minLen) {
|
3429 | var _context;
|
3430 |
|
3431 | if (!o) return;
|
3432 | if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
|
3433 |
|
3434 | var n = slice$2(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
|
3435 |
|
3436 | if (n === "Object" && o.constructor) n = o.constructor.name;
|
3437 | if (n === "Map" || n === "Set") return from(o);
|
3438 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
|
3439 | }
|
3440 |
|
3441 | function _nonIterableRest() {
|
3442 | throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
3443 | }
|
3444 |
|
3445 | function _slicedToArray(arr, i) {
|
3446 | return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest();
|
3447 | }
|
3448 |
|
3449 | function _arrayWithoutHoles(arr) {
|
3450 | if (isArray$3(arr)) return _arrayLikeToArray$2(arr);
|
3451 | }
|
3452 |
|
3453 | function _iterableToArray(iter) {
|
3454 | if (typeof symbol$1 !== "undefined" && getIteratorMethod$2(iter) != null || iter["@@iterator"] != null) return from(iter);
|
3455 | }
|
3456 |
|
3457 | function _nonIterableSpread() {
|
3458 | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
3459 | }
|
3460 |
|
3461 | function _toConsumableArray(arr) {
|
3462 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread();
|
3463 | }
|
3464 |
|
3465 | var symbol = symbol$3;
|
3466 |
|
3467 | var slice$1 = slice$4;
|
3468 |
|
3469 | var $$m = _export;
|
3470 | var ownKeys$4 = ownKeys$6;
|
3471 |
|
3472 |
|
3473 | $$m({
|
3474 | target: 'Reflect',
|
3475 | stat: true
|
3476 | }, {
|
3477 | ownKeys: ownKeys$4
|
3478 | });
|
3479 |
|
3480 | var path$b = path$s;
|
3481 | var ownKeys$3 = path$b.Reflect.ownKeys;
|
3482 |
|
3483 | var parent$p = ownKeys$3;
|
3484 | var ownKeys$2 = parent$p;
|
3485 |
|
3486 | var ownKeys$1 = ownKeys$2;
|
3487 |
|
3488 | var $$l = _export;
|
3489 | var $map = arrayIteration.map;
|
3490 | var arrayMethodHasSpeciesSupport$1 = arrayMethodHasSpeciesSupport$5;
|
3491 | var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport$1('map');
|
3492 |
|
3493 |
|
3494 |
|
3495 | $$l({
|
3496 | target: 'Array',
|
3497 | proto: true,
|
3498 | forced: !HAS_SPECIES_SUPPORT$1
|
3499 | }, {
|
3500 | map: function map(callbackfn
|
3501 | /* , thisArg */
|
3502 | ) {
|
3503 | return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
3504 | }
|
3505 | });
|
3506 |
|
3507 | var entryVirtual$b = entryVirtual$k;
|
3508 | var map$6 = entryVirtual$b('Array').map;
|
3509 |
|
3510 | var map$5 = map$6;
|
3511 | var ArrayPrototype$8 = Array.prototype;
|
3512 |
|
3513 | var map_1 = function (it) {
|
3514 | var own = it.map;
|
3515 | return it === ArrayPrototype$8 || it instanceof Array && own === ArrayPrototype$8.map ? map$5 : own;
|
3516 | };
|
3517 |
|
3518 | var parent$o = map_1;
|
3519 | var map$4 = parent$o;
|
3520 |
|
3521 | var map$3 = map$4;
|
3522 |
|
3523 | var $$k = _export;
|
3524 | var toObject$4 = toObject$e;
|
3525 | var nativeKeys = objectKeys$4;
|
3526 | var fails$6 = fails$l;
|
3527 | var FAILS_ON_PRIMITIVES$1 = fails$6(function () {
|
3528 | nativeKeys(1);
|
3529 | });
|
3530 |
|
3531 |
|
3532 | $$k({
|
3533 | target: 'Object',
|
3534 | stat: true,
|
3535 | forced: FAILS_ON_PRIMITIVES$1
|
3536 | }, {
|
3537 | keys: function keys(it) {
|
3538 | return nativeKeys(toObject$4(it));
|
3539 | }
|
3540 | });
|
3541 |
|
3542 | var path$a = path$s;
|
3543 | var keys$6 = path$a.Object.keys;
|
3544 |
|
3545 | var parent$n = keys$6;
|
3546 | var keys$5 = parent$n;
|
3547 |
|
3548 | var keys$4 = keys$5;
|
3549 |
|
3550 | var $$j = _export;
|
3551 |
|
3552 |
|
3553 | $$j({
|
3554 | target: 'Date',
|
3555 | stat: true
|
3556 | }, {
|
3557 | now: function now() {
|
3558 | return new Date().getTime();
|
3559 | }
|
3560 | });
|
3561 |
|
3562 | var path$9 = path$s;
|
3563 | path$9.Date.now;
|
3564 |
|
3565 | var aFunction$3 = aFunction$6;
|
3566 | var isObject$4 = isObject$f;
|
3567 | var slice = [].slice;
|
3568 | var factories = {};
|
3569 |
|
3570 | var construct$3 = function (C, argsLength, args) {
|
3571 | if (!(argsLength in factories)) {
|
3572 | for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
|
3573 |
|
3574 |
|
3575 | factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')');
|
3576 | }
|
3577 |
|
3578 | return factories[argsLength](C, args);
|
3579 | };
|
3580 |
|
3581 |
|
3582 |
|
3583 | var functionBind = Function.bind || function bind(that
|
3584 | /* , ...args */
|
3585 | ) {
|
3586 | var fn = aFunction$3(this);
|
3587 | var partArgs = slice.call(arguments, 1);
|
3588 |
|
3589 | var boundFunction = function bound() {
|
3590 | var args = partArgs.concat(slice.call(arguments));
|
3591 | return this instanceof boundFunction ? construct$3(fn, args.length, args) : fn.apply(that, args);
|
3592 | };
|
3593 |
|
3594 | if (isObject$4(fn.prototype)) boundFunction.prototype = fn.prototype;
|
3595 | return boundFunction;
|
3596 | };
|
3597 |
|
3598 | var $$i = _export;
|
3599 | var bind$8 = functionBind;
|
3600 |
|
3601 |
|
3602 | $$i({
|
3603 | target: 'Function',
|
3604 | proto: true
|
3605 | }, {
|
3606 | bind: bind$8
|
3607 | });
|
3608 |
|
3609 | var entryVirtual$a = entryVirtual$k;
|
3610 | var bind$7 = entryVirtual$a('Function').bind;
|
3611 |
|
3612 | var bind$6 = bind$7;
|
3613 | var FunctionPrototype = Function.prototype;
|
3614 |
|
3615 | var bind_1 = function (it) {
|
3616 | var own = it.bind;
|
3617 | return it === FunctionPrototype || it instanceof Function && own === FunctionPrototype.bind ? bind$6 : own;
|
3618 | };
|
3619 |
|
3620 | var parent$m = bind_1;
|
3621 | var bind$5 = parent$m;
|
3622 |
|
3623 | var bind$4 = bind$5;
|
3624 |
|
3625 | var $$h = _export;
|
3626 | var isArray$1 = isArray$c;
|
3627 | var nativeReverse = [].reverse;
|
3628 | var test = [1, 2];
|
3629 |
|
3630 |
|
3631 |
|
3632 |
|
3633 | $$h({
|
3634 | target: 'Array',
|
3635 | proto: true,
|
3636 | forced: String(test) === String(test.reverse())
|
3637 | }, {
|
3638 | reverse: function reverse() {
|
3639 |
|
3640 | if (isArray$1(this)) this.length = this.length;
|
3641 | return nativeReverse.call(this);
|
3642 | }
|
3643 | });
|
3644 |
|
3645 | var entryVirtual$9 = entryVirtual$k;
|
3646 | var reverse$3 = entryVirtual$9('Array').reverse;
|
3647 |
|
3648 | var reverse$2 = reverse$3;
|
3649 | var ArrayPrototype$7 = Array.prototype;
|
3650 |
|
3651 | var reverse_1 = function (it) {
|
3652 | var own = it.reverse;
|
3653 | return it === ArrayPrototype$7 || it instanceof Array && own === ArrayPrototype$7.reverse ? reverse$2 : own;
|
3654 | };
|
3655 |
|
3656 | var parent$l = reverse_1;
|
3657 | var reverse$1 = parent$l;
|
3658 |
|
3659 | var reverse = reverse$1;
|
3660 |
|
3661 | var $$g = _export;
|
3662 | var toAbsoluteIndex = toAbsoluteIndex$4;
|
3663 | var toInteger = toInteger$4;
|
3664 | var toLength$4 = toLength$c;
|
3665 | var toObject$3 = toObject$e;
|
3666 | var arraySpeciesCreate$1 = arraySpeciesCreate$4;
|
3667 | var createProperty = createProperty$5;
|
3668 | var arrayMethodHasSpeciesSupport = arrayMethodHasSpeciesSupport$5;
|
3669 | var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
|
3670 | var max = Math.max;
|
3671 | var min = Math.min;
|
3672 | var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
3673 | var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
|
3674 |
|
3675 |
|
3676 |
|
3677 | $$g({
|
3678 | target: 'Array',
|
3679 | proto: true,
|
3680 | forced: !HAS_SPECIES_SUPPORT
|
3681 | }, {
|
3682 | splice: function splice(start, deleteCount
|
3683 | /* , ...items */
|
3684 | ) {
|
3685 | var O = toObject$3(this);
|
3686 | var len = toLength$4(O.length);
|
3687 | var actualStart = toAbsoluteIndex(start, len);
|
3688 | var argumentsLength = arguments.length;
|
3689 | var insertCount, actualDeleteCount, A, k, from, to;
|
3690 |
|
3691 | if (argumentsLength === 0) {
|
3692 | insertCount = actualDeleteCount = 0;
|
3693 | } else if (argumentsLength === 1) {
|
3694 | insertCount = 0;
|
3695 | actualDeleteCount = len - actualStart;
|
3696 | } else {
|
3697 | insertCount = argumentsLength - 2;
|
3698 | actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
|
3699 | }
|
3700 |
|
3701 | if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
|
3702 | throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
|
3703 | }
|
3704 |
|
3705 | A = arraySpeciesCreate$1(O, actualDeleteCount);
|
3706 |
|
3707 | for (k = 0; k < actualDeleteCount; k++) {
|
3708 | from = actualStart + k;
|
3709 | if (from in O) createProperty(A, k, O[from]);
|
3710 | }
|
3711 |
|
3712 | A.length = actualDeleteCount;
|
3713 |
|
3714 | if (insertCount < actualDeleteCount) {
|
3715 | for (k = actualStart; k < len - actualDeleteCount; k++) {
|
3716 | from = k + actualDeleteCount;
|
3717 | to = k + insertCount;
|
3718 | if (from in O) O[to] = O[from];else delete O[to];
|
3719 | }
|
3720 |
|
3721 | for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
|
3722 | } else if (insertCount > actualDeleteCount) {
|
3723 | for (k = len - actualDeleteCount; k > actualStart; k--) {
|
3724 | from = k + actualDeleteCount - 1;
|
3725 | to = k + insertCount - 1;
|
3726 | if (from in O) O[to] = O[from];else delete O[to];
|
3727 | }
|
3728 | }
|
3729 |
|
3730 | for (k = 0; k < insertCount; k++) {
|
3731 | O[k + actualStart] = arguments[k + 2];
|
3732 | }
|
3733 |
|
3734 | O.length = len - actualDeleteCount + insertCount;
|
3735 | return A;
|
3736 | }
|
3737 | });
|
3738 |
|
3739 | var entryVirtual$8 = entryVirtual$k;
|
3740 | var splice$3 = entryVirtual$8('Array').splice;
|
3741 |
|
3742 | var splice$2 = splice$3;
|
3743 | var ArrayPrototype$6 = Array.prototype;
|
3744 |
|
3745 | var splice_1 = function (it) {
|
3746 | var own = it.splice;
|
3747 | return it === ArrayPrototype$6 || it instanceof Array && own === ArrayPrototype$6.splice ? splice$2 : own;
|
3748 | };
|
3749 |
|
3750 | var parent$k = splice_1;
|
3751 | var splice$1 = parent$k;
|
3752 |
|
3753 | var splice = splice$1;
|
3754 |
|
3755 | var $$f = _export;
|
3756 | var $includes = arrayIncludes$1.includes;
|
3757 |
|
3758 |
|
3759 | $$f({
|
3760 | target: 'Array',
|
3761 | proto: true
|
3762 | }, {
|
3763 | includes: function includes(el
|
3764 | /* , fromIndex = 0 */
|
3765 | ) {
|
3766 | return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
3767 | }
|
3768 | });
|
3769 |
|
3770 | var entryVirtual$7 = entryVirtual$k;
|
3771 | var includes$4 = entryVirtual$7('Array').includes;
|
3772 |
|
3773 | var isObject$3 = isObject$f;
|
3774 | var classof$3 = classofRaw$1;
|
3775 | var wellKnownSymbol$2 = wellKnownSymbol$j;
|
3776 | var MATCH$1 = wellKnownSymbol$2('match');
|
3777 |
|
3778 |
|
3779 | var isRegexp = function (it) {
|
3780 | var isRegExp;
|
3781 | return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$3(it) == 'RegExp');
|
3782 | };
|
3783 |
|
3784 | var isRegExp = isRegexp;
|
3785 |
|
3786 | var notARegexp = function (it) {
|
3787 | if (isRegExp(it)) {
|
3788 | throw TypeError("The method doesn't accept regular expressions");
|
3789 | }
|
3790 |
|
3791 | return it;
|
3792 | };
|
3793 |
|
3794 | var wellKnownSymbol$1 = wellKnownSymbol$j;
|
3795 | var MATCH = wellKnownSymbol$1('match');
|
3796 |
|
3797 | var correctIsRegexpLogic = function (METHOD_NAME) {
|
3798 | var regexp = /./;
|
3799 |
|
3800 | try {
|
3801 | '/./'[METHOD_NAME](regexp);
|
3802 | } catch (error1) {
|
3803 | try {
|
3804 | regexp[MATCH] = false;
|
3805 | return '/./'[METHOD_NAME](regexp);
|
3806 | } catch (error2) {
|
3807 |
|
3808 | }
|
3809 | }
|
3810 |
|
3811 | return false;
|
3812 | };
|
3813 |
|
3814 | var $$e = _export;
|
3815 | var notARegExp = notARegexp;
|
3816 | var requireObjectCoercible = requireObjectCoercible$5;
|
3817 | var toString$1 = toString$9;
|
3818 | var correctIsRegExpLogic = correctIsRegexpLogic;
|
3819 |
|
3820 |
|
3821 | $$e({
|
3822 | target: 'String',
|
3823 | proto: true,
|
3824 | forced: !correctIsRegExpLogic('includes')
|
3825 | }, {
|
3826 | includes: function includes(searchString
|
3827 | /* , position = 0 */
|
3828 | ) {
|
3829 | return !!~toString$1(requireObjectCoercible(this)).indexOf(toString$1(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : undefined);
|
3830 | }
|
3831 | });
|
3832 |
|
3833 | var entryVirtual$6 = entryVirtual$k;
|
3834 | var includes$3 = entryVirtual$6('String').includes;
|
3835 |
|
3836 | var arrayIncludes = includes$4;
|
3837 | var stringIncludes = includes$3;
|
3838 | var ArrayPrototype$5 = Array.prototype;
|
3839 | var StringPrototype = String.prototype;
|
3840 |
|
3841 | var includes$2 = function (it) {
|
3842 | var own = it.includes;
|
3843 | if (it === ArrayPrototype$5 || it instanceof Array && own === ArrayPrototype$5.includes) return arrayIncludes;
|
3844 |
|
3845 | if (typeof it === 'string' || it === StringPrototype || it instanceof String && own === StringPrototype.includes) {
|
3846 | return stringIncludes;
|
3847 | }
|
3848 |
|
3849 | return own;
|
3850 | };
|
3851 |
|
3852 | var parent$j = includes$2;
|
3853 | var includes$1 = parent$j;
|
3854 |
|
3855 | var includes = includes$1;
|
3856 |
|
3857 | var $$d = _export;
|
3858 | var fails$5 = fails$l;
|
3859 | var toObject$2 = toObject$e;
|
3860 | var nativeGetPrototypeOf = objectGetPrototypeOf;
|
3861 | var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
|
3862 | var FAILS_ON_PRIMITIVES = fails$5(function () {
|
3863 | nativeGetPrototypeOf(1);
|
3864 | });
|
3865 |
|
3866 |
|
3867 | $$d({
|
3868 | target: 'Object',
|
3869 | stat: true,
|
3870 | forced: FAILS_ON_PRIMITIVES,
|
3871 | sham: !CORRECT_PROTOTYPE_GETTER
|
3872 | }, {
|
3873 | getPrototypeOf: function getPrototypeOf(it) {
|
3874 | return nativeGetPrototypeOf(toObject$2(it));
|
3875 | }
|
3876 | });
|
3877 |
|
3878 | var path$8 = path$s;
|
3879 | var getPrototypeOf$4 = path$8.Object.getPrototypeOf;
|
3880 |
|
3881 | var parent$i = getPrototypeOf$4;
|
3882 | var getPrototypeOf$3 = parent$i;
|
3883 |
|
3884 | var getPrototypeOf$2 = getPrototypeOf$3;
|
3885 |
|
3886 | var DESCRIPTORS$4 = descriptors;
|
3887 | var objectKeys = objectKeys$4;
|
3888 | var toIndexedObject = toIndexedObject$a;
|
3889 | var propertyIsEnumerable = objectPropertyIsEnumerable.f;
|
3890 |
|
3891 | var createMethod$1 = function (TO_ENTRIES) {
|
3892 | return function (it) {
|
3893 | var O = toIndexedObject(it);
|
3894 | var keys = objectKeys(O);
|
3895 | var length = keys.length;
|
3896 | var i = 0;
|
3897 | var result = [];
|
3898 | var key;
|
3899 |
|
3900 | while (length > i) {
|
3901 | key = keys[i++];
|
3902 |
|
3903 | if (!DESCRIPTORS$4 || propertyIsEnumerable.call(O, key)) {
|
3904 | result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
|
3905 | }
|
3906 | }
|
3907 |
|
3908 | return result;
|
3909 | };
|
3910 | };
|
3911 |
|
3912 | var objectToArray = {
|
3913 |
|
3914 |
|
3915 | entries: createMethod$1(true),
|
3916 |
|
3917 |
|
3918 | values: createMethod$1(false)
|
3919 | };
|
3920 |
|
3921 | var $$c = _export;
|
3922 | var $values = objectToArray.values;
|
3923 |
|
3924 |
|
3925 | $$c({
|
3926 | target: 'Object',
|
3927 | stat: true
|
3928 | }, {
|
3929 | values: function values(O) {
|
3930 | return $values(O);
|
3931 | }
|
3932 | });
|
3933 |
|
3934 | var path$7 = path$s;
|
3935 | path$7.Object.values;
|
3936 |
|
3937 | var global$3 = global$i;
|
3938 | var toString = toString$9;
|
3939 | var trim = stringTrim.trim;
|
3940 | var whitespaces$1 = whitespaces$4;
|
3941 | var $parseInt = global$3.parseInt;
|
3942 | var hex = /^[+-]?0[Xx]/;
|
3943 | var FORCED$2 = $parseInt(whitespaces$1 + '08') !== 8 || $parseInt(whitespaces$1 + '0x16') !== 22;
|
3944 |
|
3945 |
|
3946 | var numberParseInt = FORCED$2 ? function parseInt(string, radix) {
|
3947 | var S = trim(toString(string));
|
3948 | return $parseInt(S, radix >>> 0 || (hex.test(S) ? 16 : 10));
|
3949 | } : $parseInt;
|
3950 |
|
3951 | var $$b = _export;
|
3952 | var parseIntImplementation = numberParseInt;
|
3953 |
|
3954 |
|
3955 | $$b({
|
3956 | global: true,
|
3957 | forced: parseInt != parseIntImplementation
|
3958 | }, {
|
3959 | parseInt: parseIntImplementation
|
3960 | });
|
3961 |
|
3962 | var path$6 = path$s;
|
3963 | var _parseInt$2 = path$6.parseInt;
|
3964 |
|
3965 | var parent$h = _parseInt$2;
|
3966 | var _parseInt$1 = parent$h;
|
3967 |
|
3968 | var _parseInt = _parseInt$1;
|
3969 |
|
3970 | var fails$4 = fails$l;
|
3971 | var whitespaces = whitespaces$4;
|
3972 | var non = '\u200B\u0085\u180E';
|
3973 |
|
3974 |
|
3975 | var stringTrimForced = function (METHOD_NAME) {
|
3976 | return fails$4(function () {
|
3977 | return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
|
3978 | });
|
3979 | };
|
3980 |
|
3981 | var $$a = _export;
|
3982 | var $trim = stringTrim.trim;
|
3983 | var forcedStringTrimMethod = stringTrimForced;
|
3984 |
|
3985 |
|
3986 | $$a({
|
3987 | target: 'String',
|
3988 | proto: true,
|
3989 | forced: forcedStringTrimMethod('trim')
|
3990 | }, {
|
3991 | trim: function trim() {
|
3992 | return $trim(this);
|
3993 | }
|
3994 | });
|
3995 |
|
3996 | var entryVirtual$5 = entryVirtual$k;
|
3997 | entryVirtual$5('String').trim;
|
3998 |
|
3999 | var $$9 = _export;
|
4000 | var DESCRIPTORS$3 = descriptors;
|
4001 | var create$7 = objectCreate;
|
4002 |
|
4003 |
|
4004 | $$9({
|
4005 | target: 'Object',
|
4006 | stat: true,
|
4007 | sham: !DESCRIPTORS$3
|
4008 | }, {
|
4009 | create: create$7
|
4010 | });
|
4011 |
|
4012 | var path$5 = path$s;
|
4013 | var Object$1 = path$5.Object;
|
4014 |
|
4015 | var create$6 = function create(P, D) {
|
4016 | return Object$1.create(P, D);
|
4017 | };
|
4018 |
|
4019 | var parent$g = create$6;
|
4020 | var create$5 = parent$g;
|
4021 |
|
4022 | var create$4 = create$5;
|
4023 |
|
4024 | var $$8 = _export;
|
4025 | var getBuiltIn$2 = getBuiltIn$8;
|
4026 | var fails$3 = fails$l;
|
4027 | var $stringify = getBuiltIn$2('JSON', 'stringify');
|
4028 | var re = /[\uD800-\uDFFF]/g;
|
4029 | var low = /^[\uD800-\uDBFF]$/;
|
4030 | var hi = /^[\uDC00-\uDFFF]$/;
|
4031 |
|
4032 | var fix = function (match, offset, string) {
|
4033 | var prev = string.charAt(offset - 1);
|
4034 | var next = string.charAt(offset + 1);
|
4035 |
|
4036 | if (low.test(match) && !hi.test(next) || hi.test(match) && !low.test(prev)) {
|
4037 | return '\\u' + match.charCodeAt(0).toString(16);
|
4038 | }
|
4039 |
|
4040 | return match;
|
4041 | };
|
4042 |
|
4043 | var FORCED$1 = fails$3(function () {
|
4044 | return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' || $stringify('\uDEAD') !== '"\\udead"';
|
4045 | });
|
4046 |
|
4047 | if ($stringify) {
|
4048 |
|
4049 |
|
4050 |
|
4051 | $$8({
|
4052 | target: 'JSON',
|
4053 | stat: true,
|
4054 | forced: FORCED$1
|
4055 | }, {
|
4056 |
|
4057 | stringify: function stringify(it, replacer, space) {
|
4058 | var result = $stringify.apply(null, arguments);
|
4059 | return typeof result == 'string' ? result.replace(re, fix) : result;
|
4060 | }
|
4061 | });
|
4062 | }
|
4063 |
|
4064 | var core = path$s;
|
4065 |
|
4066 | if (!core.JSON) core.JSON = {
|
4067 | stringify: JSON.stringify
|
4068 | };
|
4069 |
|
4070 | var stringify$3 = function stringify(it, replacer, space) {
|
4071 | return core.JSON.stringify.apply(null, arguments);
|
4072 | };
|
4073 |
|
4074 | var parent$f = stringify$3;
|
4075 | var stringify$2 = parent$f;
|
4076 |
|
4077 | var stringify$1 = stringify$2;
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 | function _extends() {
|
4086 | _extends = Object.assign || function (target) {
|
4087 | for (var i = 1; i < arguments.length; i++) {
|
4088 | var source = arguments[i];
|
4089 |
|
4090 | for (var key in source) {
|
4091 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
4092 | target[key] = source[key];
|
4093 | }
|
4094 | }
|
4095 | }
|
4096 |
|
4097 | return target;
|
4098 | };
|
4099 |
|
4100 | return _extends.apply(this, arguments);
|
4101 | }
|
4102 |
|
4103 | function _inheritsLoose(subClass, superClass) {
|
4104 | subClass.prototype = Object.create(superClass.prototype);
|
4105 | subClass.prototype.constructor = subClass;
|
4106 | subClass.__proto__ = superClass;
|
4107 | }
|
4108 |
|
4109 | function _assertThisInitialized$1(self) {
|
4110 | if (self === void 0) {
|
4111 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
4112 | }
|
4113 |
|
4114 | return self;
|
4115 | }
|
4116 |
|
4117 |
|
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 |
|
4126 | var assign;
|
4127 |
|
4128 | if (typeof Object.assign !== 'function') {
|
4129 | assign = function assign(target) {
|
4130 | if (target === undefined || target === null) {
|
4131 | throw new TypeError('Cannot convert undefined or null to object');
|
4132 | }
|
4133 |
|
4134 | var output = Object(target);
|
4135 |
|
4136 | for (var index = 1; index < arguments.length; index++) {
|
4137 | var source = arguments[index];
|
4138 |
|
4139 | if (source !== undefined && source !== null) {
|
4140 | for (var nextKey in source) {
|
4141 | if (source.hasOwnProperty(nextKey)) {
|
4142 | output[nextKey] = source[nextKey];
|
4143 | }
|
4144 | }
|
4145 | }
|
4146 | }
|
4147 |
|
4148 | return output;
|
4149 | };
|
4150 | } else {
|
4151 | assign = Object.assign;
|
4152 | }
|
4153 |
|
4154 | var assign$1 = assign;
|
4155 | var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
|
4156 | var TEST_ELEMENT = typeof document === "undefined" ? {
|
4157 | style: {}
|
4158 | } : document.createElement('div');
|
4159 | var TYPE_FUNCTION = 'function';
|
4160 | var round = Math.round,
|
4161 | abs = Math.abs;
|
4162 | var now = Date.now;
|
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 | function prefixed(obj, property) {
|
4172 | var prefix;
|
4173 | var prop;
|
4174 | var camelProp = property[0].toUpperCase() + property.slice(1);
|
4175 | var i = 0;
|
4176 |
|
4177 | while (i < VENDOR_PREFIXES.length) {
|
4178 | prefix = VENDOR_PREFIXES[i];
|
4179 | prop = prefix ? prefix + camelProp : property;
|
4180 |
|
4181 | if (prop in obj) {
|
4182 | return prop;
|
4183 | }
|
4184 |
|
4185 | i++;
|
4186 | }
|
4187 |
|
4188 | return undefined;
|
4189 | }
|
4190 |
|
4191 |
|
4192 |
|
4193 | var win;
|
4194 |
|
4195 | if (typeof window === "undefined") {
|
4196 |
|
4197 | win = {};
|
4198 | } else {
|
4199 | win = window;
|
4200 | }
|
4201 |
|
4202 | var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
|
4203 | var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
|
4204 |
|
4205 | function getTouchActionProps() {
|
4206 | if (!NATIVE_TOUCH_ACTION) {
|
4207 | return false;
|
4208 | }
|
4209 |
|
4210 | var touchMap = {};
|
4211 | var cssSupports = win.CSS && win.CSS.supports;
|
4212 | ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {
|
4213 |
|
4214 |
|
4215 | return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;
|
4216 | });
|
4217 | return touchMap;
|
4218 | }
|
4219 |
|
4220 | var TOUCH_ACTION_COMPUTE = 'compute';
|
4221 | var TOUCH_ACTION_AUTO = 'auto';
|
4222 | var TOUCH_ACTION_MANIPULATION = 'manipulation';
|
4223 |
|
4224 | var TOUCH_ACTION_NONE = 'none';
|
4225 | var TOUCH_ACTION_PAN_X = 'pan-x';
|
4226 | var TOUCH_ACTION_PAN_Y = 'pan-y';
|
4227 | var TOUCH_ACTION_MAP = getTouchActionProps();
|
4228 | var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
|
4229 | var SUPPORT_TOUCH = ('ontouchstart' in win);
|
4230 | var SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;
|
4231 | var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
|
4232 | var INPUT_TYPE_TOUCH = 'touch';
|
4233 | var INPUT_TYPE_PEN = 'pen';
|
4234 | var INPUT_TYPE_MOUSE = 'mouse';
|
4235 | var INPUT_TYPE_KINECT = 'kinect';
|
4236 | var COMPUTE_INTERVAL = 25;
|
4237 | var INPUT_START = 1;
|
4238 | var INPUT_MOVE = 2;
|
4239 | var INPUT_END = 4;
|
4240 | var INPUT_CANCEL = 8;
|
4241 | var DIRECTION_NONE = 1;
|
4242 | var DIRECTION_LEFT = 2;
|
4243 | var DIRECTION_RIGHT = 4;
|
4244 | var DIRECTION_UP = 8;
|
4245 | var DIRECTION_DOWN = 16;
|
4246 | var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
|
4247 | var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
|
4248 | var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
|
4249 | var PROPS_XY = ['x', 'y'];
|
4250 | var PROPS_CLIENT_XY = ['clientX', 'clientY'];
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 |
|
4258 |
|
4259 | function each(obj, iterator, context) {
|
4260 | var i;
|
4261 |
|
4262 | if (!obj) {
|
4263 | return;
|
4264 | }
|
4265 |
|
4266 | if (obj.forEach) {
|
4267 | obj.forEach(iterator, context);
|
4268 | } else if (obj.length !== undefined) {
|
4269 | i = 0;
|
4270 |
|
4271 | while (i < obj.length) {
|
4272 | iterator.call(context, obj[i], i, obj);
|
4273 | i++;
|
4274 | }
|
4275 | } else {
|
4276 | for (i in obj) {
|
4277 | obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
|
4278 | }
|
4279 | }
|
4280 | }
|
4281 |
|
4282 |
|
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 |
|
4291 | function boolOrFn(val, args) {
|
4292 | if (typeof val === TYPE_FUNCTION) {
|
4293 | return val.apply(args ? args[0] || undefined : undefined, args);
|
4294 | }
|
4295 |
|
4296 | return val;
|
4297 | }
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 |
|
4305 |
|
4306 |
|
4307 | function inStr(str, find) {
|
4308 | return str.indexOf(find) > -1;
|
4309 | }
|
4310 |
|
4311 |
|
4312 |
|
4313 |
|
4314 |
|
4315 |
|
4316 |
|
4317 |
|
4318 | function cleanTouchActions(actions) {
|
4319 |
|
4320 | if (inStr(actions, TOUCH_ACTION_NONE)) {
|
4321 | return TOUCH_ACTION_NONE;
|
4322 | }
|
4323 |
|
4324 | var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
4325 | var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
4326 |
|
4327 |
|
4328 |
|
4329 |
|
4330 | if (hasPanX && hasPanY) {
|
4331 | return TOUCH_ACTION_NONE;
|
4332 | }
|
4333 |
|
4334 |
|
4335 | if (hasPanX || hasPanY) {
|
4336 | return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
|
4337 | }
|
4338 |
|
4339 |
|
4340 | if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
|
4341 | return TOUCH_ACTION_MANIPULATION;
|
4342 | }
|
4343 |
|
4344 | return TOUCH_ACTION_AUTO;
|
4345 | }
|
4346 |
|
4347 |
|
4348 |
|
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 | var TouchAction = function () {
|
4357 | function TouchAction(manager, value) {
|
4358 | this.manager = manager;
|
4359 | this.set(value);
|
4360 | }
|
4361 | |
4362 |
|
4363 |
|
4364 |
|
4365 |
|
4366 |
|
4367 |
|
4368 | var _proto = TouchAction.prototype;
|
4369 |
|
4370 | _proto.set = function set(value) {
|
4371 |
|
4372 | if (value === TOUCH_ACTION_COMPUTE) {
|
4373 | value = this.compute();
|
4374 | }
|
4375 |
|
4376 | if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
|
4377 | this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
|
4378 | }
|
4379 |
|
4380 | this.actions = value.toLowerCase().trim();
|
4381 | };
|
4382 | |
4383 |
|
4384 |
|
4385 |
|
4386 |
|
4387 |
|
4388 | _proto.update = function update() {
|
4389 | this.set(this.manager.options.touchAction);
|
4390 | };
|
4391 | |
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 |
|
4398 | _proto.compute = function compute() {
|
4399 | var actions = [];
|
4400 | each(this.manager.recognizers, function (recognizer) {
|
4401 | if (boolOrFn(recognizer.options.enable, [recognizer])) {
|
4402 | actions = actions.concat(recognizer.getTouchAction());
|
4403 | }
|
4404 | });
|
4405 | return cleanTouchActions(actions.join(' '));
|
4406 | };
|
4407 | |
4408 |
|
4409 |
|
4410 |
|
4411 |
|
4412 |
|
4413 |
|
4414 | _proto.preventDefaults = function preventDefaults(input) {
|
4415 | var srcEvent = input.srcEvent;
|
4416 | var direction = input.offsetDirection;
|
4417 |
|
4418 | if (this.manager.session.prevented) {
|
4419 | srcEvent.preventDefault();
|
4420 | return;
|
4421 | }
|
4422 |
|
4423 | var actions = this.actions;
|
4424 | var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
|
4425 | var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
|
4426 | var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
|
4427 |
|
4428 | if (hasNone) {
|
4429 |
|
4430 | var isTapPointer = input.pointers.length === 1;
|
4431 | var isTapMovement = input.distance < 2;
|
4432 | var isTapTouchTime = input.deltaTime < 250;
|
4433 |
|
4434 | if (isTapPointer && isTapMovement && isTapTouchTime) {
|
4435 | return;
|
4436 | }
|
4437 | }
|
4438 |
|
4439 | if (hasPanX && hasPanY) {
|
4440 |
|
4441 | return;
|
4442 | }
|
4443 |
|
4444 | if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {
|
4445 | return this.preventSrc(srcEvent);
|
4446 | }
|
4447 | };
|
4448 | |
4449 |
|
4450 |
|
4451 |
|
4452 |
|
4453 |
|
4454 |
|
4455 | _proto.preventSrc = function preventSrc(srcEvent) {
|
4456 | this.manager.session.prevented = true;
|
4457 | srcEvent.preventDefault();
|
4458 | };
|
4459 |
|
4460 | return TouchAction;
|
4461 | }();
|
4462 |
|
4463 |
|
4464 |
|
4465 |
|
4466 |
|
4467 |
|
4468 |
|
4469 |
|
4470 |
|
4471 |
|
4472 | function hasParent(node, parent) {
|
4473 | while (node) {
|
4474 | if (node === parent) {
|
4475 | return true;
|
4476 | }
|
4477 |
|
4478 | node = node.parentNode;
|
4479 | }
|
4480 |
|
4481 | return false;
|
4482 | }
|
4483 |
|
4484 |
|
4485 |
|
4486 |
|
4487 |
|
4488 |
|
4489 |
|
4490 |
|
4491 | function getCenter(pointers) {
|
4492 | var pointersLength = pointers.length;
|
4493 |
|
4494 | if (pointersLength === 1) {
|
4495 | return {
|
4496 | x: round(pointers[0].clientX),
|
4497 | y: round(pointers[0].clientY)
|
4498 | };
|
4499 | }
|
4500 |
|
4501 | var x = 0;
|
4502 | var y = 0;
|
4503 | var i = 0;
|
4504 |
|
4505 | while (i < pointersLength) {
|
4506 | x += pointers[i].clientX;
|
4507 | y += pointers[i].clientY;
|
4508 | i++;
|
4509 | }
|
4510 |
|
4511 | return {
|
4512 | x: round(x / pointersLength),
|
4513 | y: round(y / pointersLength)
|
4514 | };
|
4515 | }
|
4516 |
|
4517 |
|
4518 |
|
4519 |
|
4520 |
|
4521 |
|
4522 |
|
4523 |
|
4524 | function simpleCloneInputData(input) {
|
4525 |
|
4526 |
|
4527 | var pointers = [];
|
4528 | var i = 0;
|
4529 |
|
4530 | while (i < input.pointers.length) {
|
4531 | pointers[i] = {
|
4532 | clientX: round(input.pointers[i].clientX),
|
4533 | clientY: round(input.pointers[i].clientY)
|
4534 | };
|
4535 | i++;
|
4536 | }
|
4537 |
|
4538 | return {
|
4539 | timeStamp: now(),
|
4540 | pointers: pointers,
|
4541 | center: getCenter(pointers),
|
4542 | deltaX: input.deltaX,
|
4543 | deltaY: input.deltaY
|
4544 | };
|
4545 | }
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 |
|
4554 |
|
4555 |
|
4556 | function getDistance(p1, p2, props) {
|
4557 | if (!props) {
|
4558 | props = PROPS_XY;
|
4559 | }
|
4560 |
|
4561 | var x = p2[props[0]] - p1[props[0]];
|
4562 | var y = p2[props[1]] - p1[props[1]];
|
4563 | return Math.sqrt(x * x + y * y);
|
4564 | }
|
4565 |
|
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 | function getAngle(p1, p2, props) {
|
4576 | if (!props) {
|
4577 | props = PROPS_XY;
|
4578 | }
|
4579 |
|
4580 | var x = p2[props[0]] - p1[props[0]];
|
4581 | var y = p2[props[1]] - p1[props[1]];
|
4582 | return Math.atan2(y, x) * 180 / Math.PI;
|
4583 | }
|
4584 |
|
4585 |
|
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 |
|
4591 |
|
4592 |
|
4593 | function getDirection(x, y) {
|
4594 | if (x === y) {
|
4595 | return DIRECTION_NONE;
|
4596 | }
|
4597 |
|
4598 | if (abs(x) >= abs(y)) {
|
4599 | return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
4600 | }
|
4601 |
|
4602 | return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
4603 | }
|
4604 |
|
4605 | function computeDeltaXY(session, input) {
|
4606 | var center = input.center;
|
4607 |
|
4608 |
|
4609 | var offset = session.offsetDelta || {};
|
4610 | var prevDelta = session.prevDelta || {};
|
4611 | var prevInput = session.prevInput || {};
|
4612 |
|
4613 | if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
|
4614 | prevDelta = session.prevDelta = {
|
4615 | x: prevInput.deltaX || 0,
|
4616 | y: prevInput.deltaY || 0
|
4617 | };
|
4618 | offset = session.offsetDelta = {
|
4619 | x: center.x,
|
4620 | y: center.y
|
4621 | };
|
4622 | }
|
4623 |
|
4624 | input.deltaX = prevDelta.x + (center.x - offset.x);
|
4625 | input.deltaY = prevDelta.y + (center.y - offset.y);
|
4626 | }
|
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 |
|
4633 |
|
4634 |
|
4635 |
|
4636 |
|
4637 | function getVelocity(deltaTime, x, y) {
|
4638 | return {
|
4639 | x: x / deltaTime || 0,
|
4640 | y: y / deltaTime || 0
|
4641 | };
|
4642 | }
|
4643 |
|
4644 |
|
4645 |
|
4646 |
|
4647 |
|
4648 |
|
4649 |
|
4650 |
|
4651 |
|
4652 |
|
4653 | function getScale(start, end) {
|
4654 | return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
|
4655 | }
|
4656 |
|
4657 |
|
4658 |
|
4659 |
|
4660 |
|
4661 |
|
4662 |
|
4663 |
|
4664 |
|
4665 | function getRotation(start, end) {
|
4666 | return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
|
4667 | }
|
4668 |
|
4669 |
|
4670 |
|
4671 |
|
4672 |
|
4673 |
|
4674 |
|
4675 |
|
4676 | function computeIntervalInputData(session, input) {
|
4677 | var last = session.lastInterval || input;
|
4678 | var deltaTime = input.timeStamp - last.timeStamp;
|
4679 | var velocity;
|
4680 | var velocityX;
|
4681 | var velocityY;
|
4682 | var direction;
|
4683 |
|
4684 | if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
|
4685 | var deltaX = input.deltaX - last.deltaX;
|
4686 | var deltaY = input.deltaY - last.deltaY;
|
4687 | var v = getVelocity(deltaTime, deltaX, deltaY);
|
4688 | velocityX = v.x;
|
4689 | velocityY = v.y;
|
4690 | velocity = abs(v.x) > abs(v.y) ? v.x : v.y;
|
4691 | direction = getDirection(deltaX, deltaY);
|
4692 | session.lastInterval = input;
|
4693 | } else {
|
4694 |
|
4695 | velocity = last.velocity;
|
4696 | velocityX = last.velocityX;
|
4697 | velocityY = last.velocityY;
|
4698 | direction = last.direction;
|
4699 | }
|
4700 |
|
4701 | input.velocity = velocity;
|
4702 | input.velocityX = velocityX;
|
4703 | input.velocityY = velocityY;
|
4704 | input.direction = direction;
|
4705 | }
|
4706 |
|
4707 |
|
4708 |
|
4709 |
|
4710 |
|
4711 |
|
4712 |
|
4713 |
|
4714 | function computeInputData(manager, input) {
|
4715 | var session = manager.session;
|
4716 | var pointers = input.pointers;
|
4717 | var pointersLength = pointers.length;
|
4718 |
|
4719 | if (!session.firstInput) {
|
4720 | session.firstInput = simpleCloneInputData(input);
|
4721 | }
|
4722 |
|
4723 |
|
4724 | if (pointersLength > 1 && !session.firstMultiple) {
|
4725 | session.firstMultiple = simpleCloneInputData(input);
|
4726 | } else if (pointersLength === 1) {
|
4727 | session.firstMultiple = false;
|
4728 | }
|
4729 |
|
4730 | var firstInput = session.firstInput,
|
4731 | firstMultiple = session.firstMultiple;
|
4732 | var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
|
4733 | var center = input.center = getCenter(pointers);
|
4734 | input.timeStamp = now();
|
4735 | input.deltaTime = input.timeStamp - firstInput.timeStamp;
|
4736 | input.angle = getAngle(offsetCenter, center);
|
4737 | input.distance = getDistance(offsetCenter, center);
|
4738 | computeDeltaXY(session, input);
|
4739 | input.offsetDirection = getDirection(input.deltaX, input.deltaY);
|
4740 | var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
|
4741 | input.overallVelocityX = overallVelocity.x;
|
4742 | input.overallVelocityY = overallVelocity.y;
|
4743 | input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;
|
4744 | input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
|
4745 | input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
|
4746 | input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;
|
4747 | computeIntervalInputData(session, input);
|
4748 |
|
4749 | var target = manager.element;
|
4750 | var srcEvent = input.srcEvent;
|
4751 | var srcEventTarget;
|
4752 |
|
4753 | if (srcEvent.composedPath) {
|
4754 | srcEventTarget = srcEvent.composedPath()[0];
|
4755 | } else if (srcEvent.path) {
|
4756 | srcEventTarget = srcEvent.path[0];
|
4757 | } else {
|
4758 | srcEventTarget = srcEvent.target;
|
4759 | }
|
4760 |
|
4761 | if (hasParent(srcEventTarget, target)) {
|
4762 | target = srcEventTarget;
|
4763 | }
|
4764 |
|
4765 | input.target = target;
|
4766 | }
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 |
|
4773 |
|
4774 |
|
4775 |
|
4776 | function inputHandler(manager, eventType, input) {
|
4777 | var pointersLen = input.pointers.length;
|
4778 | var changedPointersLen = input.changedPointers.length;
|
4779 | var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
|
4780 | var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
|
4781 | input.isFirst = !!isFirst;
|
4782 | input.isFinal = !!isFinal;
|
4783 |
|
4784 | if (isFirst) {
|
4785 | manager.session = {};
|
4786 | }
|
4787 |
|
4788 |
|
4789 |
|
4790 | input.eventType = eventType;
|
4791 |
|
4792 | computeInputData(manager, input);
|
4793 |
|
4794 | manager.emit('hammer.input', input);
|
4795 | manager.recognize(input);
|
4796 | manager.session.prevInput = input;
|
4797 | }
|
4798 |
|
4799 |
|
4800 |
|
4801 |
|
4802 |
|
4803 |
|
4804 |
|
4805 |
|
4806 | function splitStr(str) {
|
4807 | return str.trim().split(/\s+/g);
|
4808 | }
|
4809 |
|
4810 |
|
4811 |
|
4812 |
|
4813 |
|
4814 |
|
4815 |
|
4816 |
|
4817 |
|
4818 | function addEventListeners(target, types, handler) {
|
4819 | each(splitStr(types), function (type) {
|
4820 | target.addEventListener(type, handler, false);
|
4821 | });
|
4822 | }
|
4823 |
|
4824 |
|
4825 |
|
4826 |
|
4827 |
|
4828 |
|
4829 |
|
4830 |
|
4831 |
|
4832 | function removeEventListeners(target, types, handler) {
|
4833 | each(splitStr(types), function (type) {
|
4834 | target.removeEventListener(type, handler, false);
|
4835 | });
|
4836 | }
|
4837 |
|
4838 |
|
4839 |
|
4840 |
|
4841 |
|
4842 |
|
4843 |
|
4844 |
|
4845 | function getWindowForElement(element) {
|
4846 | var doc = element.ownerDocument || element;
|
4847 | return doc.defaultView || doc.parentWindow || window;
|
4848 | }
|
4849 |
|
4850 |
|
4851 |
|
4852 |
|
4853 |
|
4854 |
|
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 | var Input = function () {
|
4860 | function Input(manager, callback) {
|
4861 | var self = this;
|
4862 | this.manager = manager;
|
4863 | this.callback = callback;
|
4864 | this.element = manager.element;
|
4865 | this.target = manager.options.inputTarget;
|
4866 |
|
4867 |
|
4868 | this.domHandler = function (ev) {
|
4869 | if (boolOrFn(manager.options.enable, [manager])) {
|
4870 | self.handler(ev);
|
4871 | }
|
4872 | };
|
4873 |
|
4874 | this.init();
|
4875 | }
|
4876 | |
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 | var _proto = Input.prototype;
|
4884 |
|
4885 | _proto.handler = function handler() {};
|
4886 | |
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 | _proto.init = function init() {
|
4893 | this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
|
4894 | this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
|
4895 | this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
|
4896 | };
|
4897 | |
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 |
|
4903 | _proto.destroy = function destroy() {
|
4904 | this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
|
4905 | this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
|
4906 | this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
|
4907 | };
|
4908 |
|
4909 | return Input;
|
4910 | }();
|
4911 |
|
4912 |
|
4913 |
|
4914 |
|
4915 |
|
4916 |
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 | function inArray(src, find, findByKey) {
|
4922 | if (src.indexOf && !findByKey) {
|
4923 | return src.indexOf(find);
|
4924 | } else {
|
4925 | var i = 0;
|
4926 |
|
4927 | while (i < src.length) {
|
4928 | if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {
|
4929 |
|
4930 | return i;
|
4931 | }
|
4932 |
|
4933 | i++;
|
4934 | }
|
4935 |
|
4936 | return -1;
|
4937 | }
|
4938 | }
|
4939 |
|
4940 | var POINTER_INPUT_MAP = {
|
4941 | pointerdown: INPUT_START,
|
4942 | pointermove: INPUT_MOVE,
|
4943 | pointerup: INPUT_END,
|
4944 | pointercancel: INPUT_CANCEL,
|
4945 | pointerout: INPUT_CANCEL
|
4946 | };
|
4947 |
|
4948 | var IE10_POINTER_TYPE_ENUM = {
|
4949 | 2: INPUT_TYPE_TOUCH,
|
4950 | 3: INPUT_TYPE_PEN,
|
4951 | 4: INPUT_TYPE_MOUSE,
|
4952 | 5: INPUT_TYPE_KINECT
|
4953 |
|
4954 | };
|
4955 | var POINTER_ELEMENT_EVENTS = 'pointerdown';
|
4956 | var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
|
4957 |
|
4958 | if (win.MSPointerEvent && !win.PointerEvent) {
|
4959 | POINTER_ELEMENT_EVENTS = 'MSPointerDown';
|
4960 | POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
|
4961 | }
|
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 |
|
4967 |
|
4968 |
|
4969 |
|
4970 | var PointerEventInput = function (_Input) {
|
4971 | _inheritsLoose(PointerEventInput, _Input);
|
4972 |
|
4973 | function PointerEventInput() {
|
4974 | var _this;
|
4975 |
|
4976 | var proto = PointerEventInput.prototype;
|
4977 | proto.evEl = POINTER_ELEMENT_EVENTS;
|
4978 | proto.evWin = POINTER_WINDOW_EVENTS;
|
4979 | _this = _Input.apply(this, arguments) || this;
|
4980 | _this.store = _this.manager.session.pointerEvents = [];
|
4981 | return _this;
|
4982 | }
|
4983 | |
4984 |
|
4985 |
|
4986 |
|
4987 |
|
4988 |
|
4989 |
|
4990 | var _proto = PointerEventInput.prototype;
|
4991 |
|
4992 | _proto.handler = function handler(ev) {
|
4993 | var store = this.store;
|
4994 | var removePointer = false;
|
4995 | var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
|
4996 | var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
|
4997 | var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
|
4998 | var isTouch = pointerType === INPUT_TYPE_TOUCH;
|
4999 |
|
5000 | var storeIndex = inArray(store, ev.pointerId, 'pointerId');
|
5001 |
|
5002 | if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
|
5003 | if (storeIndex < 0) {
|
5004 | store.push(ev);
|
5005 | storeIndex = store.length - 1;
|
5006 | }
|
5007 | } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
|
5008 | removePointer = true;
|
5009 | }
|
5010 |
|
5011 |
|
5012 | if (storeIndex < 0) {
|
5013 | return;
|
5014 | }
|
5015 |
|
5016 |
|
5017 | store[storeIndex] = ev;
|
5018 | this.callback(this.manager, eventType, {
|
5019 | pointers: store,
|
5020 | changedPointers: [ev],
|
5021 | pointerType: pointerType,
|
5022 | srcEvent: ev
|
5023 | });
|
5024 |
|
5025 | if (removePointer) {
|
5026 |
|
5027 | store.splice(storeIndex, 1);
|
5028 | }
|
5029 | };
|
5030 |
|
5031 | return PointerEventInput;
|
5032 | }(Input);
|
5033 |
|
5034 |
|
5035 |
|
5036 |
|
5037 |
|
5038 |
|
5039 |
|
5040 |
|
5041 | function toArray(obj) {
|
5042 | return Array.prototype.slice.call(obj, 0);
|
5043 | }
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 | function uniqueArray(src, key, sort) {
|
5055 | var results = [];
|
5056 | var values = [];
|
5057 | var i = 0;
|
5058 |
|
5059 | while (i < src.length) {
|
5060 | var val = key ? src[i][key] : src[i];
|
5061 |
|
5062 | if (inArray(values, val) < 0) {
|
5063 | results.push(src[i]);
|
5064 | }
|
5065 |
|
5066 | values[i] = val;
|
5067 | i++;
|
5068 | }
|
5069 |
|
5070 | if (sort) {
|
5071 | if (!key) {
|
5072 | results = results.sort();
|
5073 | } else {
|
5074 | results = results.sort(function (a, b) {
|
5075 | return a[key] > b[key];
|
5076 | });
|
5077 | }
|
5078 | }
|
5079 |
|
5080 | return results;
|
5081 | }
|
5082 |
|
5083 | var TOUCH_INPUT_MAP = {
|
5084 | touchstart: INPUT_START,
|
5085 | touchmove: INPUT_MOVE,
|
5086 | touchend: INPUT_END,
|
5087 | touchcancel: INPUT_CANCEL
|
5088 | };
|
5089 | var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
|
5090 |
|
5091 |
|
5092 |
|
5093 |
|
5094 |
|
5095 |
|
5096 |
|
5097 | var TouchInput = function (_Input) {
|
5098 | _inheritsLoose(TouchInput, _Input);
|
5099 |
|
5100 | function TouchInput() {
|
5101 | var _this;
|
5102 |
|
5103 | TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;
|
5104 | _this = _Input.apply(this, arguments) || this;
|
5105 | _this.targetIds = {};
|
5106 |
|
5107 | return _this;
|
5108 | }
|
5109 |
|
5110 | var _proto = TouchInput.prototype;
|
5111 |
|
5112 | _proto.handler = function handler(ev) {
|
5113 | var type = TOUCH_INPUT_MAP[ev.type];
|
5114 | var touches = getTouches.call(this, ev, type);
|
5115 |
|
5116 | if (!touches) {
|
5117 | return;
|
5118 | }
|
5119 |
|
5120 | this.callback(this.manager, type, {
|
5121 | pointers: touches[0],
|
5122 | changedPointers: touches[1],
|
5123 | pointerType: INPUT_TYPE_TOUCH,
|
5124 | srcEvent: ev
|
5125 | });
|
5126 | };
|
5127 |
|
5128 | return TouchInput;
|
5129 | }(Input);
|
5130 |
|
5131 | function getTouches(ev, type) {
|
5132 | var allTouches = toArray(ev.touches);
|
5133 | var targetIds = this.targetIds;
|
5134 |
|
5135 | if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
|
5136 | targetIds[allTouches[0].identifier] = true;
|
5137 | return [allTouches, allTouches];
|
5138 | }
|
5139 |
|
5140 | var i;
|
5141 | var targetTouches;
|
5142 | var changedTouches = toArray(ev.changedTouches);
|
5143 | var changedTargetTouches = [];
|
5144 | var target = this.target;
|
5145 |
|
5146 | targetTouches = allTouches.filter(function (touch) {
|
5147 | return hasParent(touch.target, target);
|
5148 | });
|
5149 |
|
5150 | if (type === INPUT_START) {
|
5151 | i = 0;
|
5152 |
|
5153 | while (i < targetTouches.length) {
|
5154 | targetIds[targetTouches[i].identifier] = true;
|
5155 | i++;
|
5156 | }
|
5157 | }
|
5158 |
|
5159 |
|
5160 | i = 0;
|
5161 |
|
5162 | while (i < changedTouches.length) {
|
5163 | if (targetIds[changedTouches[i].identifier]) {
|
5164 | changedTargetTouches.push(changedTouches[i]);
|
5165 | }
|
5166 |
|
5167 |
|
5168 | if (type & (INPUT_END | INPUT_CANCEL)) {
|
5169 | delete targetIds[changedTouches[i].identifier];
|
5170 | }
|
5171 |
|
5172 | i++;
|
5173 | }
|
5174 |
|
5175 | if (!changedTargetTouches.length) {
|
5176 | return;
|
5177 | }
|
5178 |
|
5179 | return [
|
5180 | uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];
|
5181 | }
|
5182 |
|
5183 | var MOUSE_INPUT_MAP = {
|
5184 | mousedown: INPUT_START,
|
5185 | mousemove: INPUT_MOVE,
|
5186 | mouseup: INPUT_END
|
5187 | };
|
5188 | var MOUSE_ELEMENT_EVENTS = 'mousedown';
|
5189 | var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
|
5190 |
|
5191 |
|
5192 |
|
5193 |
|
5194 |
|
5195 |
|
5196 |
|
5197 | var MouseInput = function (_Input) {
|
5198 | _inheritsLoose(MouseInput, _Input);
|
5199 |
|
5200 | function MouseInput() {
|
5201 | var _this;
|
5202 |
|
5203 | var proto = MouseInput.prototype;
|
5204 | proto.evEl = MOUSE_ELEMENT_EVENTS;
|
5205 | proto.evWin = MOUSE_WINDOW_EVENTS;
|
5206 | _this = _Input.apply(this, arguments) || this;
|
5207 | _this.pressed = false;
|
5208 |
|
5209 | return _this;
|
5210 | }
|
5211 | |
5212 |
|
5213 |
|
5214 |
|
5215 |
|
5216 |
|
5217 |
|
5218 | var _proto = MouseInput.prototype;
|
5219 |
|
5220 | _proto.handler = function handler(ev) {
|
5221 | var eventType = MOUSE_INPUT_MAP[ev.type];
|
5222 |
|
5223 | if (eventType & INPUT_START && ev.button === 0) {
|
5224 | this.pressed = true;
|
5225 | }
|
5226 |
|
5227 | if (eventType & INPUT_MOVE && ev.which !== 1) {
|
5228 | eventType = INPUT_END;
|
5229 | }
|
5230 |
|
5231 |
|
5232 | if (!this.pressed) {
|
5233 | return;
|
5234 | }
|
5235 |
|
5236 | if (eventType & INPUT_END) {
|
5237 | this.pressed = false;
|
5238 | }
|
5239 |
|
5240 | this.callback(this.manager, eventType, {
|
5241 | pointers: [ev],
|
5242 | changedPointers: [ev],
|
5243 | pointerType: INPUT_TYPE_MOUSE,
|
5244 | srcEvent: ev
|
5245 | });
|
5246 | };
|
5247 |
|
5248 | return MouseInput;
|
5249 | }(Input);
|
5250 |
|
5251 |
|
5252 |
|
5253 |
|
5254 |
|
5255 |
|
5256 |
|
5257 |
|
5258 |
|
5259 |
|
5260 |
|
5261 |
|
5262 | var DEDUP_TIMEOUT = 2500;
|
5263 | var DEDUP_DISTANCE = 25;
|
5264 |
|
5265 | function setLastTouch(eventData) {
|
5266 | var _eventData$changedPoi = eventData.changedPointers,
|
5267 | touch = _eventData$changedPoi[0];
|
5268 |
|
5269 | if (touch.identifier === this.primaryTouch) {
|
5270 | var lastTouch = {
|
5271 | x: touch.clientX,
|
5272 | y: touch.clientY
|
5273 | };
|
5274 | var lts = this.lastTouches;
|
5275 | this.lastTouches.push(lastTouch);
|
5276 |
|
5277 | var removeLastTouch = function removeLastTouch() {
|
5278 | var i = lts.indexOf(lastTouch);
|
5279 |
|
5280 | if (i > -1) {
|
5281 | lts.splice(i, 1);
|
5282 | }
|
5283 | };
|
5284 |
|
5285 | setTimeout(removeLastTouch, DEDUP_TIMEOUT);
|
5286 | }
|
5287 | }
|
5288 |
|
5289 | function recordTouches(eventType, eventData) {
|
5290 | if (eventType & INPUT_START) {
|
5291 | this.primaryTouch = eventData.changedPointers[0].identifier;
|
5292 | setLastTouch.call(this, eventData);
|
5293 | } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
|
5294 | setLastTouch.call(this, eventData);
|
5295 | }
|
5296 | }
|
5297 |
|
5298 | function isSyntheticEvent(eventData) {
|
5299 | var x = eventData.srcEvent.clientX;
|
5300 | var y = eventData.srcEvent.clientY;
|
5301 |
|
5302 | for (var i = 0; i < this.lastTouches.length; i++) {
|
5303 | var t = this.lastTouches[i];
|
5304 | var dx = Math.abs(x - t.x);
|
5305 | var dy = Math.abs(y - t.y);
|
5306 |
|
5307 | if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
|
5308 | return true;
|
5309 | }
|
5310 | }
|
5311 |
|
5312 | return false;
|
5313 | }
|
5314 |
|
5315 | var TouchMouseInput = function () {
|
5316 | var TouchMouseInput = function (_Input) {
|
5317 | _inheritsLoose(TouchMouseInput, _Input);
|
5318 |
|
5319 | function TouchMouseInput(_manager, callback) {
|
5320 | var _this;
|
5321 |
|
5322 | _this = _Input.call(this, _manager, callback) || this;
|
5323 |
|
5324 | _this.handler = function (manager, inputEvent, inputData) {
|
5325 | var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;
|
5326 | var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;
|
5327 |
|
5328 | if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
|
5329 | return;
|
5330 | }
|
5331 |
|
5332 |
|
5333 | if (isTouch) {
|
5334 | recordTouches.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputEvent, inputData);
|
5335 | } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputData)) {
|
5336 | return;
|
5337 | }
|
5338 |
|
5339 | _this.callback(manager, inputEvent, inputData);
|
5340 | };
|
5341 |
|
5342 | _this.touch = new TouchInput(_this.manager, _this.handler);
|
5343 | _this.mouse = new MouseInput(_this.manager, _this.handler);
|
5344 | _this.primaryTouch = null;
|
5345 | _this.lastTouches = [];
|
5346 | return _this;
|
5347 | }
|
5348 | |
5349 |
|
5350 |
|
5351 |
|
5352 |
|
5353 |
|
5354 |
|
5355 |
|
5356 |
|
5357 | var _proto = TouchMouseInput.prototype;
|
5358 | |
5359 |
|
5360 |
|
5361 |
|
5362 |
|
5363 | _proto.destroy = function destroy() {
|
5364 | this.touch.destroy();
|
5365 | this.mouse.destroy();
|
5366 | };
|
5367 |
|
5368 | return TouchMouseInput;
|
5369 | }(Input);
|
5370 |
|
5371 | return TouchMouseInput;
|
5372 | }();
|
5373 |
|
5374 |
|
5375 |
|
5376 |
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 |
|
5382 | function createInputInstance(manager) {
|
5383 | var Type;
|
5384 |
|
5385 | var inputClass = manager.options.inputClass;
|
5386 |
|
5387 | if (inputClass) {
|
5388 | Type = inputClass;
|
5389 | } else if (SUPPORT_POINTER_EVENTS) {
|
5390 | Type = PointerEventInput;
|
5391 | } else if (SUPPORT_ONLY_TOUCH) {
|
5392 | Type = TouchInput;
|
5393 | } else if (!SUPPORT_TOUCH) {
|
5394 | Type = MouseInput;
|
5395 | } else {
|
5396 | Type = TouchMouseInput;
|
5397 | }
|
5398 |
|
5399 | return new Type(manager, inputHandler);
|
5400 | }
|
5401 |
|
5402 |
|
5403 |
|
5404 |
|
5405 |
|
5406 |
|
5407 |
|
5408 |
|
5409 |
|
5410 |
|
5411 |
|
5412 |
|
5413 | function invokeArrayArg(arg, fn, context) {
|
5414 | if (Array.isArray(arg)) {
|
5415 | each(arg, context[fn], context);
|
5416 | return true;
|
5417 | }
|
5418 |
|
5419 | return false;
|
5420 | }
|
5421 |
|
5422 | var STATE_POSSIBLE = 1;
|
5423 | var STATE_BEGAN = 2;
|
5424 | var STATE_CHANGED = 4;
|
5425 | var STATE_ENDED = 8;
|
5426 | var STATE_RECOGNIZED = STATE_ENDED;
|
5427 | var STATE_CANCELLED = 16;
|
5428 | var STATE_FAILED = 32;
|
5429 |
|
5430 |
|
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 | var _uniqueId = 1;
|
5436 |
|
5437 | function uniqueId() {
|
5438 | return _uniqueId++;
|
5439 | }
|
5440 |
|
5441 |
|
5442 |
|
5443 |
|
5444 |
|
5445 |
|
5446 |
|
5447 |
|
5448 |
|
5449 | function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
|
5450 | var manager = recognizer.manager;
|
5451 |
|
5452 | if (manager) {
|
5453 | return manager.get(otherRecognizer);
|
5454 | }
|
5455 |
|
5456 | return otherRecognizer;
|
5457 | }
|
5458 |
|
5459 |
|
5460 |
|
5461 |
|
5462 |
|
5463 |
|
5464 |
|
5465 |
|
5466 | function stateStr(state) {
|
5467 | if (state & STATE_CANCELLED) {
|
5468 | return 'cancel';
|
5469 | } else if (state & STATE_ENDED) {
|
5470 | return 'end';
|
5471 | } else if (state & STATE_CHANGED) {
|
5472 | return 'move';
|
5473 | } else if (state & STATE_BEGAN) {
|
5474 | return 'start';
|
5475 | }
|
5476 |
|
5477 | return '';
|
5478 | }
|
5479 |
|
5480 |
|
5481 |
|
5482 |
|
5483 |
|
5484 |
|
5485 |
|
5486 |
|
5487 |
|
5488 |
|
5489 |
|
5490 |
|
5491 |
|
5492 |
|
5493 |
|
5494 |
|
5495 |
|
5496 |
|
5497 |
|
5498 |
|
5499 |
|
5500 |
|
5501 |
|
5502 |
|
5503 |
|
5504 |
|
5505 |
|
5506 |
|
5507 |
|
5508 |
|
5509 |
|
5510 |
|
5511 |
|
5512 |
|
5513 |
|
5514 |
|
5515 |
|
5516 |
|
5517 | var Recognizer = function () {
|
5518 | function Recognizer(options) {
|
5519 | if (options === void 0) {
|
5520 | options = {};
|
5521 | }
|
5522 |
|
5523 | this.options = _extends({
|
5524 | enable: true
|
5525 | }, options);
|
5526 | this.id = uniqueId();
|
5527 | this.manager = null;
|
5528 |
|
5529 | this.state = STATE_POSSIBLE;
|
5530 | this.simultaneous = {};
|
5531 | this.requireFail = [];
|
5532 | }
|
5533 | |
5534 |
|
5535 |
|
5536 |
|
5537 |
|
5538 |
|
5539 |
|
5540 |
|
5541 | var _proto = Recognizer.prototype;
|
5542 |
|
5543 | _proto.set = function set(options) {
|
5544 | assign$1(this.options, options);
|
5545 |
|
5546 | this.manager && this.manager.touchAction.update();
|
5547 | return this;
|
5548 | };
|
5549 | |
5550 |
|
5551 |
|
5552 |
|
5553 |
|
5554 |
|
5555 |
|
5556 |
|
5557 | _proto.recognizeWith = function recognizeWith(otherRecognizer) {
|
5558 | if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
|
5559 | return this;
|
5560 | }
|
5561 |
|
5562 | var simultaneous = this.simultaneous;
|
5563 | otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
5564 |
|
5565 | if (!simultaneous[otherRecognizer.id]) {
|
5566 | simultaneous[otherRecognizer.id] = otherRecognizer;
|
5567 | otherRecognizer.recognizeWith(this);
|
5568 | }
|
5569 |
|
5570 | return this;
|
5571 | };
|
5572 | |
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 | _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {
|
5581 | if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
|
5582 | return this;
|
5583 | }
|
5584 |
|
5585 | otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
5586 | delete this.simultaneous[otherRecognizer.id];
|
5587 | return this;
|
5588 | };
|
5589 | |
5590 |
|
5591 |
|
5592 |
|
5593 |
|
5594 |
|
5595 |
|
5596 |
|
5597 | _proto.requireFailure = function requireFailure(otherRecognizer) {
|
5598 | if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
|
5599 | return this;
|
5600 | }
|
5601 |
|
5602 | var requireFail = this.requireFail;
|
5603 | otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
5604 |
|
5605 | if (inArray(requireFail, otherRecognizer) === -1) {
|
5606 | requireFail.push(otherRecognizer);
|
5607 | otherRecognizer.requireFailure(this);
|
5608 | }
|
5609 |
|
5610 | return this;
|
5611 | };
|
5612 | |
5613 |
|
5614 |
|
5615 |
|
5616 |
|
5617 |
|
5618 |
|
5619 |
|
5620 | _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {
|
5621 | if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
|
5622 | return this;
|
5623 | }
|
5624 |
|
5625 | otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
5626 | var index = inArray(this.requireFail, otherRecognizer);
|
5627 |
|
5628 | if (index > -1) {
|
5629 | this.requireFail.splice(index, 1);
|
5630 | }
|
5631 |
|
5632 | return this;
|
5633 | };
|
5634 | |
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 |
|
5640 |
|
5641 | _proto.hasRequireFailures = function hasRequireFailures() {
|
5642 | return this.requireFail.length > 0;
|
5643 | };
|
5644 | |
5645 |
|
5646 |
|
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 |
|
5652 | _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {
|
5653 | return !!this.simultaneous[otherRecognizer.id];
|
5654 | };
|
5655 | |
5656 |
|
5657 |
|
5658 |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 | _proto.emit = function emit(input) {
|
5664 | var self = this;
|
5665 | var state = this.state;
|
5666 |
|
5667 | function emit(event) {
|
5668 | self.manager.emit(event, input);
|
5669 | }
|
5670 |
|
5671 |
|
5672 | if (state < STATE_ENDED) {
|
5673 | emit(self.options.event + stateStr(state));
|
5674 | }
|
5675 |
|
5676 | emit(self.options.event);
|
5677 |
|
5678 | if (input.additionalEvent) {
|
5679 |
|
5680 | emit(input.additionalEvent);
|
5681 | }
|
5682 |
|
5683 |
|
5684 | if (state >= STATE_ENDED) {
|
5685 | emit(self.options.event + stateStr(state));
|
5686 | }
|
5687 | };
|
5688 | |
5689 |
|
5690 |
|
5691 |
|
5692 |
|
5693 |
|
5694 |
|
5695 |
|
5696 |
|
5697 | _proto.tryEmit = function tryEmit(input) {
|
5698 | if (this.canEmit()) {
|
5699 | return this.emit(input);
|
5700 | }
|
5701 |
|
5702 |
|
5703 | this.state = STATE_FAILED;
|
5704 | };
|
5705 | |
5706 |
|
5707 |
|
5708 |
|
5709 |
|
5710 |
|
5711 |
|
5712 | _proto.canEmit = function canEmit() {
|
5713 | var i = 0;
|
5714 |
|
5715 | while (i < this.requireFail.length) {
|
5716 | if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
|
5717 | return false;
|
5718 | }
|
5719 |
|
5720 | i++;
|
5721 | }
|
5722 |
|
5723 | return true;
|
5724 | };
|
5725 | |
5726 |
|
5727 |
|
5728 |
|
5729 |
|
5730 |
|
5731 |
|
5732 | _proto.recognize = function recognize(inputData) {
|
5733 |
|
5734 |
|
5735 | var inputDataClone = assign$1({}, inputData);
|
5736 |
|
5737 | if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
|
5738 | this.reset();
|
5739 | this.state = STATE_FAILED;
|
5740 | return;
|
5741 | }
|
5742 |
|
5743 |
|
5744 | if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
|
5745 | this.state = STATE_POSSIBLE;
|
5746 | }
|
5747 |
|
5748 | this.state = this.process(inputDataClone);
|
5749 |
|
5750 |
|
5751 | if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
|
5752 | this.tryEmit(inputDataClone);
|
5753 | }
|
5754 | };
|
5755 | |
5756 |
|
5757 |
|
5758 |
|
5759 |
|
5760 |
|
5761 |
|
5762 |
|
5763 |
|
5764 |
|
5765 |
|
5766 |
|
5767 | _proto.process = function process(inputData) {};
|
5768 |
|
5769 |
|
5770 | |
5771 |
|
5772 |
|
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 |
|
5778 | _proto.getTouchAction = function getTouchAction() {};
|
5779 | |
5780 |
|
5781 |
|
5782 |
|
5783 |
|
5784 |
|
5785 |
|
5786 |
|
5787 | _proto.reset = function reset() {};
|
5788 |
|
5789 | return Recognizer;
|
5790 | }();
|
5791 |
|
5792 |
|
5793 |
|
5794 |
|
5795 |
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 |
|
5801 |
|
5802 |
|
5803 |
|
5804 | var TapRecognizer = function (_Recognizer) {
|
5805 | _inheritsLoose(TapRecognizer, _Recognizer);
|
5806 |
|
5807 | function TapRecognizer(options) {
|
5808 | var _this;
|
5809 |
|
5810 | if (options === void 0) {
|
5811 | options = {};
|
5812 | }
|
5813 |
|
5814 | _this = _Recognizer.call(this, _extends({
|
5815 | event: 'tap',
|
5816 | pointers: 1,
|
5817 | taps: 1,
|
5818 | interval: 300,
|
5819 |
|
5820 | time: 250,
|
5821 |
|
5822 | threshold: 9,
|
5823 |
|
5824 | posThreshold: 10
|
5825 | }, options)) || this;
|
5826 |
|
5827 |
|
5828 | _this.pTime = false;
|
5829 | _this.pCenter = false;
|
5830 | _this._timer = null;
|
5831 | _this._input = null;
|
5832 | _this.count = 0;
|
5833 | return _this;
|
5834 | }
|
5835 |
|
5836 | var _proto = TapRecognizer.prototype;
|
5837 |
|
5838 | _proto.getTouchAction = function getTouchAction() {
|
5839 | return [TOUCH_ACTION_MANIPULATION];
|
5840 | };
|
5841 |
|
5842 | _proto.process = function process(input) {
|
5843 | var _this2 = this;
|
5844 |
|
5845 | var options = this.options;
|
5846 | var validPointers = input.pointers.length === options.pointers;
|
5847 | var validMovement = input.distance < options.threshold;
|
5848 | var validTouchTime = input.deltaTime < options.time;
|
5849 | this.reset();
|
5850 |
|
5851 | if (input.eventType & INPUT_START && this.count === 0) {
|
5852 | return this.failTimeout();
|
5853 | }
|
5854 |
|
5855 |
|
5856 |
|
5857 | if (validMovement && validTouchTime && validPointers) {
|
5858 | if (input.eventType !== INPUT_END) {
|
5859 | return this.failTimeout();
|
5860 | }
|
5861 |
|
5862 | var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;
|
5863 | var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
|
5864 | this.pTime = input.timeStamp;
|
5865 | this.pCenter = input.center;
|
5866 |
|
5867 | if (!validMultiTap || !validInterval) {
|
5868 | this.count = 1;
|
5869 | } else {
|
5870 | this.count += 1;
|
5871 | }
|
5872 |
|
5873 | this._input = input;
|
5874 |
|
5875 |
|
5876 | var tapCount = this.count % options.taps;
|
5877 |
|
5878 | if (tapCount === 0) {
|
5879 |
|
5880 |
|
5881 | if (!this.hasRequireFailures()) {
|
5882 | return STATE_RECOGNIZED;
|
5883 | } else {
|
5884 | this._timer = setTimeout(function () {
|
5885 | _this2.state = STATE_RECOGNIZED;
|
5886 |
|
5887 | _this2.tryEmit();
|
5888 | }, options.interval);
|
5889 | return STATE_BEGAN;
|
5890 | }
|
5891 | }
|
5892 | }
|
5893 |
|
5894 | return STATE_FAILED;
|
5895 | };
|
5896 |
|
5897 | _proto.failTimeout = function failTimeout() {
|
5898 | var _this3 = this;
|
5899 |
|
5900 | this._timer = setTimeout(function () {
|
5901 | _this3.state = STATE_FAILED;
|
5902 | }, this.options.interval);
|
5903 | return STATE_FAILED;
|
5904 | };
|
5905 |
|
5906 | _proto.reset = function reset() {
|
5907 | clearTimeout(this._timer);
|
5908 | };
|
5909 |
|
5910 | _proto.emit = function emit() {
|
5911 | if (this.state === STATE_RECOGNIZED) {
|
5912 | this._input.tapCount = this.count;
|
5913 | this.manager.emit(this.options.event, this._input);
|
5914 | }
|
5915 | };
|
5916 |
|
5917 | return TapRecognizer;
|
5918 | }(Recognizer);
|
5919 |
|
5920 |
|
5921 |
|
5922 |
|
5923 |
|
5924 |
|
5925 |
|
5926 |
|
5927 | var AttrRecognizer = function (_Recognizer) {
|
5928 | _inheritsLoose(AttrRecognizer, _Recognizer);
|
5929 |
|
5930 | function AttrRecognizer(options) {
|
5931 | if (options === void 0) {
|
5932 | options = {};
|
5933 | }
|
5934 |
|
5935 | return _Recognizer.call(this, _extends({
|
5936 | pointers: 1
|
5937 | }, options)) || this;
|
5938 | }
|
5939 | |
5940 |
|
5941 |
|
5942 |
|
5943 |
|
5944 |
|
5945 |
|
5946 |
|
5947 |
|
5948 | var _proto = AttrRecognizer.prototype;
|
5949 |
|
5950 | _proto.attrTest = function attrTest(input) {
|
5951 | var optionPointers = this.options.pointers;
|
5952 | return optionPointers === 0 || input.pointers.length === optionPointers;
|
5953 | };
|
5954 | |
5955 |
|
5956 |
|
5957 |
|
5958 |
|
5959 |
|
5960 |
|
5961 |
|
5962 |
|
5963 | _proto.process = function process(input) {
|
5964 | var state = this.state;
|
5965 | var eventType = input.eventType;
|
5966 | var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
|
5967 | var isValid = this.attrTest(input);
|
5968 |
|
5969 | if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
|
5970 | return state | STATE_CANCELLED;
|
5971 | } else if (isRecognized || isValid) {
|
5972 | if (eventType & INPUT_END) {
|
5973 | return state | STATE_ENDED;
|
5974 | } else if (!(state & STATE_BEGAN)) {
|
5975 | return STATE_BEGAN;
|
5976 | }
|
5977 |
|
5978 | return state | STATE_CHANGED;
|
5979 | }
|
5980 |
|
5981 | return STATE_FAILED;
|
5982 | };
|
5983 |
|
5984 | return AttrRecognizer;
|
5985 | }(Recognizer);
|
5986 |
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 | function directionStr(direction) {
|
5995 | if (direction === DIRECTION_DOWN) {
|
5996 | return 'down';
|
5997 | } else if (direction === DIRECTION_UP) {
|
5998 | return 'up';
|
5999 | } else if (direction === DIRECTION_LEFT) {
|
6000 | return 'left';
|
6001 | } else if (direction === DIRECTION_RIGHT) {
|
6002 | return 'right';
|
6003 | }
|
6004 |
|
6005 | return '';
|
6006 | }
|
6007 |
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 |
|
6015 |
|
6016 | var PanRecognizer = function (_AttrRecognizer) {
|
6017 | _inheritsLoose(PanRecognizer, _AttrRecognizer);
|
6018 |
|
6019 | function PanRecognizer(options) {
|
6020 | var _this;
|
6021 |
|
6022 | if (options === void 0) {
|
6023 | options = {};
|
6024 | }
|
6025 |
|
6026 | _this = _AttrRecognizer.call(this, _extends({
|
6027 | event: 'pan',
|
6028 | threshold: 10,
|
6029 | pointers: 1,
|
6030 | direction: DIRECTION_ALL
|
6031 | }, options)) || this;
|
6032 | _this.pX = null;
|
6033 | _this.pY = null;
|
6034 | return _this;
|
6035 | }
|
6036 |
|
6037 | var _proto = PanRecognizer.prototype;
|
6038 |
|
6039 | _proto.getTouchAction = function getTouchAction() {
|
6040 | var direction = this.options.direction;
|
6041 | var actions = [];
|
6042 |
|
6043 | if (direction & DIRECTION_HORIZONTAL) {
|
6044 | actions.push(TOUCH_ACTION_PAN_Y);
|
6045 | }
|
6046 |
|
6047 | if (direction & DIRECTION_VERTICAL) {
|
6048 | actions.push(TOUCH_ACTION_PAN_X);
|
6049 | }
|
6050 |
|
6051 | return actions;
|
6052 | };
|
6053 |
|
6054 | _proto.directionTest = function directionTest(input) {
|
6055 | var options = this.options;
|
6056 | var hasMoved = true;
|
6057 | var distance = input.distance;
|
6058 | var direction = input.direction;
|
6059 | var x = input.deltaX;
|
6060 | var y = input.deltaY;
|
6061 |
|
6062 | if (!(direction & options.direction)) {
|
6063 | if (options.direction & DIRECTION_HORIZONTAL) {
|
6064 | direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
6065 | hasMoved = x !== this.pX;
|
6066 | distance = Math.abs(input.deltaX);
|
6067 | } else {
|
6068 | direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
6069 | hasMoved = y !== this.pY;
|
6070 | distance = Math.abs(input.deltaY);
|
6071 | }
|
6072 | }
|
6073 |
|
6074 | input.direction = direction;
|
6075 | return hasMoved && distance > options.threshold && direction & options.direction;
|
6076 | };
|
6077 |
|
6078 | _proto.attrTest = function attrTest(input) {
|
6079 | return AttrRecognizer.prototype.attrTest.call(this, input) && (
|
6080 | this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));
|
6081 | };
|
6082 |
|
6083 | _proto.emit = function emit(input) {
|
6084 | this.pX = input.deltaX;
|
6085 | this.pY = input.deltaY;
|
6086 | var direction = directionStr(input.direction);
|
6087 |
|
6088 | if (direction) {
|
6089 | input.additionalEvent = this.options.event + direction;
|
6090 | }
|
6091 |
|
6092 | _AttrRecognizer.prototype.emit.call(this, input);
|
6093 | };
|
6094 |
|
6095 | return PanRecognizer;
|
6096 | }(AttrRecognizer);
|
6097 |
|
6098 |
|
6099 |
|
6100 |
|
6101 |
|
6102 |
|
6103 |
|
6104 |
|
6105 |
|
6106 | var SwipeRecognizer = function (_AttrRecognizer) {
|
6107 | _inheritsLoose(SwipeRecognizer, _AttrRecognizer);
|
6108 |
|
6109 | function SwipeRecognizer(options) {
|
6110 | if (options === void 0) {
|
6111 | options = {};
|
6112 | }
|
6113 |
|
6114 | return _AttrRecognizer.call(this, _extends({
|
6115 | event: 'swipe',
|
6116 | threshold: 10,
|
6117 | velocity: 0.3,
|
6118 | direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
6119 | pointers: 1
|
6120 | }, options)) || this;
|
6121 | }
|
6122 |
|
6123 | var _proto = SwipeRecognizer.prototype;
|
6124 |
|
6125 | _proto.getTouchAction = function getTouchAction() {
|
6126 | return PanRecognizer.prototype.getTouchAction.call(this);
|
6127 | };
|
6128 |
|
6129 | _proto.attrTest = function attrTest(input) {
|
6130 | var direction = this.options.direction;
|
6131 | var velocity;
|
6132 |
|
6133 | if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
|
6134 | velocity = input.overallVelocity;
|
6135 | } else if (direction & DIRECTION_HORIZONTAL) {
|
6136 | velocity = input.overallVelocityX;
|
6137 | } else if (direction & DIRECTION_VERTICAL) {
|
6138 | velocity = input.overallVelocityY;
|
6139 | }
|
6140 |
|
6141 | return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
|
6142 | };
|
6143 |
|
6144 | _proto.emit = function emit(input) {
|
6145 | var direction = directionStr(input.offsetDirection);
|
6146 |
|
6147 | if (direction) {
|
6148 | this.manager.emit(this.options.event + direction, input);
|
6149 | }
|
6150 |
|
6151 | this.manager.emit(this.options.event, input);
|
6152 | };
|
6153 |
|
6154 | return SwipeRecognizer;
|
6155 | }(AttrRecognizer);
|
6156 |
|
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 |
|
6163 |
|
6164 |
|
6165 | var PinchRecognizer = function (_AttrRecognizer) {
|
6166 | _inheritsLoose(PinchRecognizer, _AttrRecognizer);
|
6167 |
|
6168 | function PinchRecognizer(options) {
|
6169 | if (options === void 0) {
|
6170 | options = {};
|
6171 | }
|
6172 |
|
6173 | return _AttrRecognizer.call(this, _extends({
|
6174 | event: 'pinch',
|
6175 | threshold: 0,
|
6176 | pointers: 2
|
6177 | }, options)) || this;
|
6178 | }
|
6179 |
|
6180 | var _proto = PinchRecognizer.prototype;
|
6181 |
|
6182 | _proto.getTouchAction = function getTouchAction() {
|
6183 | return [TOUCH_ACTION_NONE];
|
6184 | };
|
6185 |
|
6186 | _proto.attrTest = function attrTest(input) {
|
6187 | return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
|
6188 | };
|
6189 |
|
6190 | _proto.emit = function emit(input) {
|
6191 | if (input.scale !== 1) {
|
6192 | var inOut = input.scale < 1 ? 'in' : 'out';
|
6193 | input.additionalEvent = this.options.event + inOut;
|
6194 | }
|
6195 |
|
6196 | _AttrRecognizer.prototype.emit.call(this, input);
|
6197 | };
|
6198 |
|
6199 | return PinchRecognizer;
|
6200 | }(AttrRecognizer);
|
6201 |
|
6202 |
|
6203 |
|
6204 |
|
6205 |
|
6206 |
|
6207 |
|
6208 |
|
6209 |
|
6210 | var RotateRecognizer = function (_AttrRecognizer) {
|
6211 | _inheritsLoose(RotateRecognizer, _AttrRecognizer);
|
6212 |
|
6213 | function RotateRecognizer(options) {
|
6214 | if (options === void 0) {
|
6215 | options = {};
|
6216 | }
|
6217 |
|
6218 | return _AttrRecognizer.call(this, _extends({
|
6219 | event: 'rotate',
|
6220 | threshold: 0,
|
6221 | pointers: 2
|
6222 | }, options)) || this;
|
6223 | }
|
6224 |
|
6225 | var _proto = RotateRecognizer.prototype;
|
6226 |
|
6227 | _proto.getTouchAction = function getTouchAction() {
|
6228 | return [TOUCH_ACTION_NONE];
|
6229 | };
|
6230 |
|
6231 | _proto.attrTest = function attrTest(input) {
|
6232 | return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
|
6233 | };
|
6234 |
|
6235 | return RotateRecognizer;
|
6236 | }(AttrRecognizer);
|
6237 |
|
6238 |
|
6239 |
|
6240 |
|
6241 |
|
6242 |
|
6243 |
|
6244 |
|
6245 |
|
6246 | var PressRecognizer = function (_Recognizer) {
|
6247 | _inheritsLoose(PressRecognizer, _Recognizer);
|
6248 |
|
6249 | function PressRecognizer(options) {
|
6250 | var _this;
|
6251 |
|
6252 | if (options === void 0) {
|
6253 | options = {};
|
6254 | }
|
6255 |
|
6256 | _this = _Recognizer.call(this, _extends({
|
6257 | event: 'press',
|
6258 | pointers: 1,
|
6259 | time: 251,
|
6260 |
|
6261 | threshold: 9
|
6262 | }, options)) || this;
|
6263 | _this._timer = null;
|
6264 | _this._input = null;
|
6265 | return _this;
|
6266 | }
|
6267 |
|
6268 | var _proto = PressRecognizer.prototype;
|
6269 |
|
6270 | _proto.getTouchAction = function getTouchAction() {
|
6271 | return [TOUCH_ACTION_AUTO];
|
6272 | };
|
6273 |
|
6274 | _proto.process = function process(input) {
|
6275 | var _this2 = this;
|
6276 |
|
6277 | var options = this.options;
|
6278 | var validPointers = input.pointers.length === options.pointers;
|
6279 | var validMovement = input.distance < options.threshold;
|
6280 | var validTime = input.deltaTime > options.time;
|
6281 | this._input = input;
|
6282 |
|
6283 |
|
6284 | if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {
|
6285 | this.reset();
|
6286 | } else if (input.eventType & INPUT_START) {
|
6287 | this.reset();
|
6288 | this._timer = setTimeout(function () {
|
6289 | _this2.state = STATE_RECOGNIZED;
|
6290 |
|
6291 | _this2.tryEmit();
|
6292 | }, options.time);
|
6293 | } else if (input.eventType & INPUT_END) {
|
6294 | return STATE_RECOGNIZED;
|
6295 | }
|
6296 |
|
6297 | return STATE_FAILED;
|
6298 | };
|
6299 |
|
6300 | _proto.reset = function reset() {
|
6301 | clearTimeout(this._timer);
|
6302 | };
|
6303 |
|
6304 | _proto.emit = function emit(input) {
|
6305 | if (this.state !== STATE_RECOGNIZED) {
|
6306 | return;
|
6307 | }
|
6308 |
|
6309 | if (input && input.eventType & INPUT_END) {
|
6310 | this.manager.emit(this.options.event + "up", input);
|
6311 | } else {
|
6312 | this._input.timeStamp = now();
|
6313 | this.manager.emit(this.options.event, this._input);
|
6314 | }
|
6315 | };
|
6316 |
|
6317 | return PressRecognizer;
|
6318 | }(Recognizer);
|
6319 |
|
6320 | var defaults = {
|
6321 | |
6322 |
|
6323 |
|
6324 |
|
6325 |
|
6326 |
|
6327 |
|
6328 | domEvents: false,
|
6329 |
|
6330 | |
6331 |
|
6332 |
|
6333 |
|
6334 |
|
6335 |
|
6336 |
|
6337 | touchAction: TOUCH_ACTION_COMPUTE,
|
6338 |
|
6339 | |
6340 |
|
6341 |
|
6342 |
|
6343 |
|
6344 | enable: true,
|
6345 |
|
6346 | |
6347 |
|
6348 |
|
6349 |
|
6350 |
|
6351 |
|
6352 |
|
6353 |
|
6354 | inputTarget: null,
|
6355 |
|
6356 | |
6357 |
|
6358 |
|
6359 |
|
6360 |
|
6361 |
|
6362 | inputClass: null,
|
6363 |
|
6364 | |
6365 |
|
6366 |
|
6367 |
|
6368 |
|
6369 |
|
6370 | cssProps: {
|
6371 | |
6372 |
|
6373 |
|
6374 |
|
6375 |
|
6376 |
|
6377 | userSelect: "none",
|
6378 |
|
6379 | |
6380 |
|
6381 |
|
6382 |
|
6383 |
|
6384 |
|
6385 | touchSelect: "none",
|
6386 |
|
6387 | |
6388 |
|
6389 |
|
6390 |
|
6391 |
|
6392 |
|
6393 |
|
6394 |
|
6395 | touchCallout: "none",
|
6396 |
|
6397 | |
6398 |
|
6399 |
|
6400 |
|
6401 |
|
6402 |
|
6403 | contentZooming: "none",
|
6404 |
|
6405 | |
6406 |
|
6407 |
|
6408 |
|
6409 |
|
6410 |
|
6411 | userDrag: "none",
|
6412 |
|
6413 | |
6414 |
|
6415 |
|
6416 |
|
6417 |
|
6418 |
|
6419 |
|
6420 | tapHighlightColor: "rgba(0,0,0,0)"
|
6421 | }
|
6422 | };
|
6423 |
|
6424 |
|
6425 |
|
6426 |
|
6427 |
|
6428 |
|
6429 |
|
6430 |
|
6431 | var preset = [[RotateRecognizer, {
|
6432 | enable: false
|
6433 | }], [PinchRecognizer, {
|
6434 | enable: false
|
6435 | }, ['rotate']], [SwipeRecognizer, {
|
6436 | direction: DIRECTION_HORIZONTAL
|
6437 | }], [PanRecognizer, {
|
6438 | direction: DIRECTION_HORIZONTAL
|
6439 | }, ['swipe']], [TapRecognizer], [TapRecognizer, {
|
6440 | event: 'doubletap',
|
6441 | taps: 2
|
6442 | }, ['tap']], [PressRecognizer]];
|
6443 | var STOP = 1;
|
6444 | var FORCED_STOP = 2;
|
6445 |
|
6446 |
|
6447 |
|
6448 |
|
6449 |
|
6450 |
|
6451 |
|
6452 | function toggleCssProps(manager, add) {
|
6453 | var element = manager.element;
|
6454 |
|
6455 | if (!element.style) {
|
6456 | return;
|
6457 | }
|
6458 |
|
6459 | var prop;
|
6460 | each(manager.options.cssProps, function (value, name) {
|
6461 | prop = prefixed(element.style, name);
|
6462 |
|
6463 | if (add) {
|
6464 | manager.oldCssProps[prop] = element.style[prop];
|
6465 | element.style[prop] = value;
|
6466 | } else {
|
6467 | element.style[prop] = manager.oldCssProps[prop] || "";
|
6468 | }
|
6469 | });
|
6470 |
|
6471 | if (!add) {
|
6472 | manager.oldCssProps = {};
|
6473 | }
|
6474 | }
|
6475 |
|
6476 |
|
6477 |
|
6478 |
|
6479 |
|
6480 |
|
6481 |
|
6482 |
|
6483 | function triggerDomEvent(event, data) {
|
6484 | var gestureEvent = document.createEvent("Event");
|
6485 | gestureEvent.initEvent(event, true, true);
|
6486 | gestureEvent.gesture = data;
|
6487 | data.target.dispatchEvent(gestureEvent);
|
6488 | }
|
6489 |
|
6490 |
|
6491 |
|
6492 |
|
6493 |
|
6494 |
|
6495 |
|
6496 |
|
6497 |
|
6498 | var Manager = function () {
|
6499 | function Manager(element, options) {
|
6500 | var _this = this;
|
6501 |
|
6502 | this.options = assign$1({}, defaults, options || {});
|
6503 | this.options.inputTarget = this.options.inputTarget || element;
|
6504 | this.handlers = {};
|
6505 | this.session = {};
|
6506 | this.recognizers = [];
|
6507 | this.oldCssProps = {};
|
6508 | this.element = element;
|
6509 | this.input = createInputInstance(this);
|
6510 | this.touchAction = new TouchAction(this, this.options.touchAction);
|
6511 | toggleCssProps(this, true);
|
6512 | each(this.options.recognizers, function (item) {
|
6513 | var recognizer = _this.add(new item[0](item[1]));
|
6514 |
|
6515 | item[2] && recognizer.recognizeWith(item[2]);
|
6516 | item[3] && recognizer.requireFailure(item[3]);
|
6517 | }, this);
|
6518 | }
|
6519 | |
6520 |
|
6521 |
|
6522 |
|
6523 |
|
6524 |
|
6525 |
|
6526 |
|
6527 | var _proto = Manager.prototype;
|
6528 |
|
6529 | _proto.set = function set(options) {
|
6530 | assign$1(this.options, options);
|
6531 |
|
6532 | if (options.touchAction) {
|
6533 | this.touchAction.update();
|
6534 | }
|
6535 |
|
6536 | if (options.inputTarget) {
|
6537 |
|
6538 | this.input.destroy();
|
6539 | this.input.target = options.inputTarget;
|
6540 | this.input.init();
|
6541 | }
|
6542 |
|
6543 | return this;
|
6544 | };
|
6545 | |
6546 |
|
6547 |
|
6548 |
|
6549 |
|
6550 |
|
6551 |
|
6552 |
|
6553 |
|
6554 | _proto.stop = function stop(force) {
|
6555 | this.session.stopped = force ? FORCED_STOP : STOP;
|
6556 | };
|
6557 | |
6558 |
|
6559 |
|
6560 |
|
6561 |
|
6562 |
|
6563 |
|
6564 |
|
6565 |
|
6566 | _proto.recognize = function recognize(inputData) {
|
6567 | var session = this.session;
|
6568 |
|
6569 | if (session.stopped) {
|
6570 | return;
|
6571 | }
|
6572 |
|
6573 |
|
6574 | this.touchAction.preventDefaults(inputData);
|
6575 | var recognizer;
|
6576 | var recognizers = this.recognizers;
|
6577 |
|
6578 |
|
6579 |
|
6580 | var curRecognizer = session.curRecognizer;
|
6581 |
|
6582 |
|
6583 | if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {
|
6584 | session.curRecognizer = null;
|
6585 | curRecognizer = null;
|
6586 | }
|
6587 |
|
6588 | var i = 0;
|
6589 |
|
6590 | while (i < recognizers.length) {
|
6591 | recognizer = recognizers[i];
|
6592 |
|
6593 |
|
6594 |
|
6595 |
|
6596 |
|
6597 |
|
6598 | if (session.stopped !== FORCED_STOP && (
|
6599 | !curRecognizer || recognizer === curRecognizer ||
|
6600 | recognizer.canRecognizeWith(curRecognizer))) {
|
6601 |
|
6602 | recognizer.recognize(inputData);
|
6603 | } else {
|
6604 | recognizer.reset();
|
6605 | }
|
6606 |
|
6607 |
|
6608 |
|
6609 | if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
|
6610 | session.curRecognizer = recognizer;
|
6611 | curRecognizer = recognizer;
|
6612 | }
|
6613 |
|
6614 | i++;
|
6615 | }
|
6616 | };
|
6617 | |
6618 |
|
6619 |
|
6620 |
|
6621 |
|
6622 |
|
6623 |
|
6624 |
|
6625 | _proto.get = function get(recognizer) {
|
6626 | if (recognizer instanceof Recognizer) {
|
6627 | return recognizer;
|
6628 | }
|
6629 |
|
6630 | var recognizers = this.recognizers;
|
6631 |
|
6632 | for (var i = 0; i < recognizers.length; i++) {
|
6633 | if (recognizers[i].options.event === recognizer) {
|
6634 | return recognizers[i];
|
6635 | }
|
6636 | }
|
6637 |
|
6638 | return null;
|
6639 | };
|
6640 | |
6641 |
|
6642 |
|
6643 |
|
6644 |
|
6645 |
|
6646 |
|
6647 |
|
6648 | _proto.add = function add(recognizer) {
|
6649 | if (invokeArrayArg(recognizer, "add", this)) {
|
6650 | return this;
|
6651 | }
|
6652 |
|
6653 |
|
6654 | var existing = this.get(recognizer.options.event);
|
6655 |
|
6656 | if (existing) {
|
6657 | this.remove(existing);
|
6658 | }
|
6659 |
|
6660 | this.recognizers.push(recognizer);
|
6661 | recognizer.manager = this;
|
6662 | this.touchAction.update();
|
6663 | return recognizer;
|
6664 | };
|
6665 | |
6666 |
|
6667 |
|
6668 |
|
6669 |
|
6670 |
|
6671 |
|
6672 |
|
6673 | _proto.remove = function remove(recognizer) {
|
6674 | if (invokeArrayArg(recognizer, "remove", this)) {
|
6675 | return this;
|
6676 | }
|
6677 |
|
6678 | var targetRecognizer = this.get(recognizer);
|
6679 |
|
6680 | if (recognizer) {
|
6681 | var recognizers = this.recognizers;
|
6682 | var index = inArray(recognizers, targetRecognizer);
|
6683 |
|
6684 | if (index !== -1) {
|
6685 | recognizers.splice(index, 1);
|
6686 | this.touchAction.update();
|
6687 | }
|
6688 | }
|
6689 |
|
6690 | return this;
|
6691 | };
|
6692 | |
6693 |
|
6694 |
|
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 |
|
6701 | _proto.on = function on(events, handler) {
|
6702 | if (events === undefined || handler === undefined) {
|
6703 | return this;
|
6704 | }
|
6705 |
|
6706 | var handlers = this.handlers;
|
6707 | each(splitStr(events), function (event) {
|
6708 | handlers[event] = handlers[event] || [];
|
6709 | handlers[event].push(handler);
|
6710 | });
|
6711 | return this;
|
6712 | };
|
6713 | |
6714 |
|
6715 |
|
6716 |
|
6717 |
|
6718 |
|
6719 |
|
6720 |
|
6721 | _proto.off = function off(events, handler) {
|
6722 | if (events === undefined) {
|
6723 | return this;
|
6724 | }
|
6725 |
|
6726 | var handlers = this.handlers;
|
6727 | each(splitStr(events), function (event) {
|
6728 | if (!handler) {
|
6729 | delete handlers[event];
|
6730 | } else {
|
6731 | handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
|
6732 | }
|
6733 | });
|
6734 | return this;
|
6735 | };
|
6736 | |
6737 |
|
6738 |
|
6739 |
|
6740 |
|
6741 |
|
6742 |
|
6743 | _proto.emit = function emit(event, data) {
|
6744 |
|
6745 | if (this.options.domEvents) {
|
6746 | triggerDomEvent(event, data);
|
6747 | }
|
6748 |
|
6749 |
|
6750 | var handlers = this.handlers[event] && this.handlers[event].slice();
|
6751 |
|
6752 | if (!handlers || !handlers.length) {
|
6753 | return;
|
6754 | }
|
6755 |
|
6756 | data.type = event;
|
6757 |
|
6758 | data.preventDefault = function () {
|
6759 | data.srcEvent.preventDefault();
|
6760 | };
|
6761 |
|
6762 | var i = 0;
|
6763 |
|
6764 | while (i < handlers.length) {
|
6765 | handlers[i](data);
|
6766 | i++;
|
6767 | }
|
6768 | };
|
6769 | |
6770 |
|
6771 |
|
6772 |
|
6773 |
|
6774 |
|
6775 |
|
6776 | _proto.destroy = function destroy() {
|
6777 | this.element && toggleCssProps(this, false);
|
6778 | this.handlers = {};
|
6779 | this.session = {};
|
6780 | this.input.destroy();
|
6781 | this.element = null;
|
6782 | };
|
6783 |
|
6784 | return Manager;
|
6785 | }();
|
6786 |
|
6787 | var SINGLE_TOUCH_INPUT_MAP = {
|
6788 | touchstart: INPUT_START,
|
6789 | touchmove: INPUT_MOVE,
|
6790 | touchend: INPUT_END,
|
6791 | touchcancel: INPUT_CANCEL
|
6792 | };
|
6793 | var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
|
6794 | var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
|
6795 |
|
6796 |
|
6797 |
|
6798 |
|
6799 |
|
6800 |
|
6801 |
|
6802 | var SingleTouchInput = function (_Input) {
|
6803 | _inheritsLoose(SingleTouchInput, _Input);
|
6804 |
|
6805 | function SingleTouchInput() {
|
6806 | var _this;
|
6807 |
|
6808 | var proto = SingleTouchInput.prototype;
|
6809 | proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
|
6810 | proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
|
6811 | _this = _Input.apply(this, arguments) || this;
|
6812 | _this.started = false;
|
6813 | return _this;
|
6814 | }
|
6815 |
|
6816 | var _proto = SingleTouchInput.prototype;
|
6817 |
|
6818 | _proto.handler = function handler(ev) {
|
6819 | var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
|
6820 |
|
6821 | if (type === INPUT_START) {
|
6822 | this.started = true;
|
6823 | }
|
6824 |
|
6825 | if (!this.started) {
|
6826 | return;
|
6827 | }
|
6828 |
|
6829 | var touches = normalizeSingleTouches.call(this, ev, type);
|
6830 |
|
6831 | if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
|
6832 | this.started = false;
|
6833 | }
|
6834 |
|
6835 | this.callback(this.manager, type, {
|
6836 | pointers: touches[0],
|
6837 | changedPointers: touches[1],
|
6838 | pointerType: INPUT_TYPE_TOUCH,
|
6839 | srcEvent: ev
|
6840 | });
|
6841 | };
|
6842 |
|
6843 | return SingleTouchInput;
|
6844 | }(Input);
|
6845 |
|
6846 | function normalizeSingleTouches(ev, type) {
|
6847 | var all = toArray(ev.touches);
|
6848 | var changed = toArray(ev.changedTouches);
|
6849 |
|
6850 | if (type & (INPUT_END | INPUT_CANCEL)) {
|
6851 | all = uniqueArray(all.concat(changed), 'identifier', true);
|
6852 | }
|
6853 |
|
6854 | return [all, changed];
|
6855 | }
|
6856 |
|
6857 |
|
6858 |
|
6859 |
|
6860 |
|
6861 |
|
6862 |
|
6863 |
|
6864 |
|
6865 |
|
6866 | function deprecate(method, name, message) {
|
6867 | var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n";
|
6868 | return function () {
|
6869 | var e = new Error('get-stack-trace');
|
6870 | var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
|
6871 | var log = window.console && (window.console.warn || window.console.log);
|
6872 |
|
6873 | if (log) {
|
6874 | log.call(window.console, deprecationMessage, stack);
|
6875 | }
|
6876 |
|
6877 | return method.apply(this, arguments);
|
6878 | };
|
6879 | }
|
6880 |
|
6881 |
|
6882 |
|
6883 |
|
6884 |
|
6885 |
|
6886 |
|
6887 |
|
6888 |
|
6889 |
|
6890 |
|
6891 | var extend = deprecate(function (dest, src, merge) {
|
6892 | var keys = Object.keys(src);
|
6893 | var i = 0;
|
6894 |
|
6895 | while (i < keys.length) {
|
6896 | if (!merge || merge && dest[keys[i]] === undefined) {
|
6897 | dest[keys[i]] = src[keys[i]];
|
6898 | }
|
6899 |
|
6900 | i++;
|
6901 | }
|
6902 |
|
6903 | return dest;
|
6904 | }, 'extend', 'Use `assign`.');
|
6905 |
|
6906 |
|
6907 |
|
6908 |
|
6909 |
|
6910 |
|
6911 |
|
6912 |
|
6913 |
|
6914 | var merge = deprecate(function (dest, src) {
|
6915 | return extend(dest, src, true);
|
6916 | }, 'merge', 'Use `assign`.');
|
6917 |
|
6918 |
|
6919 |
|
6920 |
|
6921 |
|
6922 |
|
6923 |
|
6924 |
|
6925 | function inherit(child, base, properties) {
|
6926 | var baseP = base.prototype;
|
6927 | var childP;
|
6928 | childP = child.prototype = Object.create(baseP);
|
6929 | childP.constructor = child;
|
6930 | childP._super = baseP;
|
6931 |
|
6932 | if (properties) {
|
6933 | assign$1(childP, properties);
|
6934 | }
|
6935 | }
|
6936 |
|
6937 |
|
6938 |
|
6939 |
|
6940 |
|
6941 |
|
6942 |
|
6943 |
|
6944 |
|
6945 | function bindFn(fn, context) {
|
6946 | return function boundFn() {
|
6947 | return fn.apply(context, arguments);
|
6948 | };
|
6949 | }
|
6950 |
|
6951 |
|
6952 |
|
6953 |
|
6954 |
|
6955 |
|
6956 |
|
6957 |
|
6958 |
|
6959 | var Hammer$1 = function () {
|
6960 | var Hammer =
|
6961 | |
6962 |
|
6963 |
|
6964 |
|
6965 | function Hammer(element, options) {
|
6966 | if (options === void 0) {
|
6967 | options = {};
|
6968 | }
|
6969 |
|
6970 | return new Manager(element, _extends({
|
6971 | recognizers: preset.concat()
|
6972 | }, options));
|
6973 | };
|
6974 |
|
6975 | Hammer.VERSION = "2.0.17-rc";
|
6976 | Hammer.DIRECTION_ALL = DIRECTION_ALL;
|
6977 | Hammer.DIRECTION_DOWN = DIRECTION_DOWN;
|
6978 | Hammer.DIRECTION_LEFT = DIRECTION_LEFT;
|
6979 | Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;
|
6980 | Hammer.DIRECTION_UP = DIRECTION_UP;
|
6981 | Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;
|
6982 | Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;
|
6983 | Hammer.DIRECTION_NONE = DIRECTION_NONE;
|
6984 | Hammer.DIRECTION_DOWN = DIRECTION_DOWN;
|
6985 | Hammer.INPUT_START = INPUT_START;
|
6986 | Hammer.INPUT_MOVE = INPUT_MOVE;
|
6987 | Hammer.INPUT_END = INPUT_END;
|
6988 | Hammer.INPUT_CANCEL = INPUT_CANCEL;
|
6989 | Hammer.STATE_POSSIBLE = STATE_POSSIBLE;
|
6990 | Hammer.STATE_BEGAN = STATE_BEGAN;
|
6991 | Hammer.STATE_CHANGED = STATE_CHANGED;
|
6992 | Hammer.STATE_ENDED = STATE_ENDED;
|
6993 | Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;
|
6994 | Hammer.STATE_CANCELLED = STATE_CANCELLED;
|
6995 | Hammer.STATE_FAILED = STATE_FAILED;
|
6996 | Hammer.Manager = Manager;
|
6997 | Hammer.Input = Input;
|
6998 | Hammer.TouchAction = TouchAction;
|
6999 | Hammer.TouchInput = TouchInput;
|
7000 | Hammer.MouseInput = MouseInput;
|
7001 | Hammer.PointerEventInput = PointerEventInput;
|
7002 | Hammer.TouchMouseInput = TouchMouseInput;
|
7003 | Hammer.SingleTouchInput = SingleTouchInput;
|
7004 | Hammer.Recognizer = Recognizer;
|
7005 | Hammer.AttrRecognizer = AttrRecognizer;
|
7006 | Hammer.Tap = TapRecognizer;
|
7007 | Hammer.Pan = PanRecognizer;
|
7008 | Hammer.Swipe = SwipeRecognizer;
|
7009 | Hammer.Pinch = PinchRecognizer;
|
7010 | Hammer.Rotate = RotateRecognizer;
|
7011 | Hammer.Press = PressRecognizer;
|
7012 | Hammer.on = addEventListeners;
|
7013 | Hammer.off = removeEventListeners;
|
7014 | Hammer.each = each;
|
7015 | Hammer.merge = merge;
|
7016 | Hammer.extend = extend;
|
7017 | Hammer.bindFn = bindFn;
|
7018 | Hammer.assign = assign$1;
|
7019 | Hammer.inherit = inherit;
|
7020 | Hammer.bindFn = bindFn;
|
7021 | Hammer.prefixed = prefixed;
|
7022 | Hammer.toArray = toArray;
|
7023 | Hammer.inArray = inArray;
|
7024 | Hammer.uniqueArray = uniqueArray;
|
7025 | Hammer.splitStr = splitStr;
|
7026 | Hammer.boolOrFn = boolOrFn;
|
7027 | Hammer.hasParent = hasParent;
|
7028 | Hammer.addEventListeners = addEventListeners;
|
7029 | Hammer.removeEventListeners = removeEventListeners;
|
7030 | Hammer.defaults = assign$1({}, defaults, {
|
7031 | preset: preset
|
7032 | });
|
7033 | return Hammer;
|
7034 | }();
|
7035 | var RealHammer = Hammer$1;
|
7036 |
|
7037 | function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof symbol !== "undefined" && getIteratorMethod$2(o) || o["@@iterator"]; if (!it) { if (isArray$5(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
7038 |
|
7039 | function _unsupportedIterableToArray$1(o, minLen) { var _context21; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = slice$1(_context21 = Object.prototype.toString.call(o)).call(_context21, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return from$2(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
7040 |
|
7041 | function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
7042 |
|
7043 |
|
7044 |
|
7045 |
|
7046 | var DELETE = symbol("DELETE");
|
7047 |
|
7048 |
|
7049 |
|
7050 |
|
7051 |
|
7052 |
|
7053 |
|
7054 |
|
7055 |
|
7056 |
|
7057 | function pureDeepObjectAssign(base) {
|
7058 | var _context;
|
7059 |
|
7060 | for (var _len = arguments.length, updates = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
7061 | updates[_key - 1] = arguments[_key];
|
7062 | }
|
7063 |
|
7064 | return deepObjectAssign.apply(void 0, concat(_context = [{}, base]).call(_context, updates));
|
7065 | }
|
7066 |
|
7067 |
|
7068 |
|
7069 |
|
7070 |
|
7071 |
|
7072 |
|
7073 |
|
7074 |
|
7075 | function deepObjectAssign() {
|
7076 | var merged = deepObjectAssignNonentry.apply(void 0, arguments);
|
7077 | stripDelete(merged);
|
7078 | return merged;
|
7079 | }
|
7080 |
|
7081 |
|
7082 |
|
7083 |
|
7084 |
|
7085 |
|
7086 |
|
7087 |
|
7088 |
|
7089 |
|
7090 |
|
7091 |
|
7092 | function deepObjectAssignNonentry() {
|
7093 | for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
7094 | values[_key2] = arguments[_key2];
|
7095 | }
|
7096 |
|
7097 | if (values.length < 2) {
|
7098 | return values[0];
|
7099 | } else if (values.length > 2) {
|
7100 | var _context2;
|
7101 |
|
7102 | return deepObjectAssignNonentry.apply(void 0, concat(_context2 = [deepObjectAssign(values[0], values[1])]).call(_context2, _toConsumableArray(slice$1(values).call(values, 2))));
|
7103 | }
|
7104 |
|
7105 | var a = values[0];
|
7106 | var b = values[1];
|
7107 |
|
7108 | var _iterator = _createForOfIteratorHelper$1(ownKeys$1(b)),
|
7109 | _step;
|
7110 |
|
7111 | try {
|
7112 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
7113 | var prop = _step.value;
|
7114 | if (!Object.prototype.propertyIsEnumerable.call(b, prop)) ;else if (b[prop] === DELETE) {
|
7115 | delete a[prop];
|
7116 | } else if (a[prop] !== null && b[prop] !== null && _typeof(a[prop]) === "object" && _typeof(b[prop]) === "object" && !isArray$5(a[prop]) && !isArray$5(b[prop])) {
|
7117 | a[prop] = deepObjectAssignNonentry(a[prop], b[prop]);
|
7118 | } else {
|
7119 | a[prop] = clone(b[prop]);
|
7120 | }
|
7121 | }
|
7122 | } catch (err) {
|
7123 | _iterator.e(err);
|
7124 | } finally {
|
7125 | _iterator.f();
|
7126 | }
|
7127 |
|
7128 | return a;
|
7129 | }
|
7130 |
|
7131 |
|
7132 |
|
7133 |
|
7134 |
|
7135 |
|
7136 |
|
7137 |
|
7138 |
|
7139 | function clone(a) {
|
7140 | if (isArray$5(a)) {
|
7141 | return map$3(a).call(a, function (value) {
|
7142 | return clone(value);
|
7143 | });
|
7144 | } else if (_typeof(a) === "object" && a !== null) {
|
7145 | return deepObjectAssignNonentry({}, a);
|
7146 | } else {
|
7147 | return a;
|
7148 | }
|
7149 | }
|
7150 |
|
7151 |
|
7152 |
|
7153 |
|
7154 |
|
7155 |
|
7156 |
|
7157 | function stripDelete(a) {
|
7158 | for (var _i = 0, _Object$keys = keys$4(a); _i < _Object$keys.length; _i++) {
|
7159 | var prop = _Object$keys[_i];
|
7160 |
|
7161 | if (a[prop] === DELETE) {
|
7162 | delete a[prop];
|
7163 | } else if (_typeof(a[prop]) === "object" && a[prop] !== null) {
|
7164 | stripDelete(a[prop]);
|
7165 | }
|
7166 | }
|
7167 | }
|
7168 |
|
7169 |
|
7170 |
|
7171 |
|
7172 |
|
7173 |
|
7174 |
|
7175 |
|
7176 |
|
7177 | function hammerMock() {
|
7178 | var noop = function noop() {};
|
7179 |
|
7180 | return {
|
7181 | on: noop,
|
7182 | off: noop,
|
7183 | destroy: noop,
|
7184 | emit: noop,
|
7185 | get: function get() {
|
7186 | return {
|
7187 | set: noop
|
7188 | };
|
7189 | }
|
7190 | };
|
7191 | }
|
7192 |
|
7193 | var Hammer = typeof window !== "undefined" ? window.Hammer || RealHammer : function () {
|
7194 |
|
7195 | return hammerMock();
|
7196 | };
|
7197 |
|
7198 |
|
7199 |
|
7200 |
|
7201 |
|
7202 |
|
7203 |
|
7204 |
|
7205 |
|
7206 |
|
7207 |
|
7208 |
|
7209 | function Activator(container) {
|
7210 | var _this = this,
|
7211 | _context3;
|
7212 |
|
7213 | this._cleanupQueue = [];
|
7214 | this.active = false;
|
7215 | this._dom = {
|
7216 | container: container,
|
7217 | overlay: document.createElement("div")
|
7218 | };
|
7219 |
|
7220 | this._dom.overlay.classList.add("vis-overlay");
|
7221 |
|
7222 | this._dom.container.appendChild(this._dom.overlay);
|
7223 |
|
7224 | this._cleanupQueue.push(function () {
|
7225 | _this._dom.overlay.parentNode.removeChild(_this._dom.overlay);
|
7226 | });
|
7227 |
|
7228 | var hammer = Hammer(this._dom.overlay);
|
7229 | hammer.on("tap", bind$4(_context3 = this._onTapOverlay).call(_context3, this));
|
7230 |
|
7231 | this._cleanupQueue.push(function () {
|
7232 | hammer.destroy();
|
7233 |
|
7234 | });
|
7235 |
|
7236 |
|
7237 | var events = ["tap", "doubletap", "press", "pinch", "pan", "panstart", "panmove", "panend"];
|
7238 |
|
7239 | forEach$1(events).call(events, function (event) {
|
7240 | hammer.on(event, function (event) {
|
7241 | event.srcEvent.stopPropagation();
|
7242 | });
|
7243 | });
|
7244 |
|
7245 |
|
7246 | if (document && document.body) {
|
7247 | this._onClick = function (event) {
|
7248 | if (!_hasParent(event.target, container)) {
|
7249 | _this.deactivate();
|
7250 | }
|
7251 | };
|
7252 |
|
7253 | document.body.addEventListener("click", this._onClick);
|
7254 |
|
7255 | this._cleanupQueue.push(function () {
|
7256 | document.body.removeEventListener("click", _this._onClick);
|
7257 | });
|
7258 | }
|
7259 |
|
7260 |
|
7261 | this._escListener = function (event) {
|
7262 | if ("key" in event ? event.key === "Escape" : event.keyCode === 27
|
7263 |
|
7264 | ) {
|
7265 | _this.deactivate();
|
7266 | }
|
7267 | };
|
7268 | }
|
7269 |
|
7270 |
|
7271 | Emitter(Activator.prototype);
|
7272 |
|
7273 | Activator.current = null;
|
7274 |
|
7275 |
|
7276 |
|
7277 |
|
7278 | Activator.prototype.destroy = function () {
|
7279 | var _context4, _context5;
|
7280 |
|
7281 | this.deactivate();
|
7282 |
|
7283 | var _iterator2 = _createForOfIteratorHelper$1(reverse(_context4 = splice(_context5 = this._cleanupQueue).call(_context5, 0)).call(_context4)),
|
7284 | _step2;
|
7285 |
|
7286 | try {
|
7287 | for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
7288 | var callback = _step2.value;
|
7289 | callback();
|
7290 | }
|
7291 | } catch (err) {
|
7292 | _iterator2.e(err);
|
7293 | } finally {
|
7294 | _iterator2.f();
|
7295 | }
|
7296 | };
|
7297 |
|
7298 |
|
7299 |
|
7300 |
|
7301 |
|
7302 |
|
7303 | Activator.prototype.activate = function () {
|
7304 |
|
7305 | if (Activator.current) {
|
7306 | Activator.current.deactivate();
|
7307 | }
|
7308 |
|
7309 | Activator.current = this;
|
7310 | this.active = true;
|
7311 | this._dom.overlay.style.display = "none";
|
7312 |
|
7313 | this._dom.container.classList.add("vis-active");
|
7314 |
|
7315 | this.emit("change");
|
7316 | this.emit("activate");
|
7317 |
|
7318 |
|
7319 | document.body.addEventListener("keydown", this._escListener);
|
7320 | };
|
7321 |
|
7322 |
|
7323 |
|
7324 |
|
7325 |
|
7326 |
|
7327 | Activator.prototype.deactivate = function () {
|
7328 | this.active = false;
|
7329 | this._dom.overlay.style.display = "block";
|
7330 |
|
7331 | this._dom.container.classList.remove("vis-active");
|
7332 |
|
7333 | document.body.removeEventListener("keydown", this._escListener);
|
7334 | this.emit("change");
|
7335 | this.emit("deactivate");
|
7336 | };
|
7337 |
|
7338 |
|
7339 |
|
7340 |
|
7341 |
|
7342 |
|
7343 |
|
7344 |
|
7345 | Activator.prototype._onTapOverlay = function (event) {
|
7346 |
|
7347 | this.activate();
|
7348 | event.srcEvent.stopPropagation();
|
7349 | };
|
7350 |
|
7351 |
|
7352 |
|
7353 |
|
7354 |
|
7355 |
|
7356 |
|
7357 |
|
7358 |
|
7359 |
|
7360 |
|
7361 |
|
7362 | function _hasParent(element, parent) {
|
7363 | while (element) {
|
7364 | if (element === parent) {
|
7365 | return true;
|
7366 | }
|
7367 |
|
7368 | element = element.parentNode;
|
7369 | }
|
7370 |
|
7371 | return false;
|
7372 | }
|
7373 |
|
7374 | var fullHexRE = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
|
7375 | var shortHexRE = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
7376 |
|
7377 |
|
7378 |
|
7379 |
|
7380 |
|
7381 |
|
7382 |
|
7383 |
|
7384 |
|
7385 |
|
7386 |
|
7387 |
|
7388 |
|
7389 | function copyOrDelete(a, b, prop, allowDeletion) {
|
7390 | var doDeletion = false;
|
7391 |
|
7392 | if (allowDeletion === true) {
|
7393 | doDeletion = b[prop] === null && a[prop] !== undefined;
|
7394 | }
|
7395 |
|
7396 | if (doDeletion) {
|
7397 | delete a[prop];
|
7398 | } else {
|
7399 | a[prop] = b[prop];
|
7400 | }
|
7401 | }
|
7402 |
|
7403 |
|
7404 |
|
7405 |
|
7406 |
|
7407 |
|
7408 |
|
7409 |
|
7410 |
|
7411 |
|
7412 |
|
7413 |
|
7414 |
|
7415 |
|
7416 |
|
7417 |
|
7418 |
|
7419 |
|
7420 | function selectiveDeepExtend(props, a, b) {
|
7421 | var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
7422 |
|
7423 |
|
7424 | if (isArray$5(b)) {
|
7425 | throw new TypeError("Arrays are not supported by deepExtend");
|
7426 | }
|
7427 |
|
7428 | for (var p = 0; p < props.length; p++) {
|
7429 | var prop = props[p];
|
7430 |
|
7431 | if (Object.prototype.hasOwnProperty.call(b, prop)) {
|
7432 | if (b[prop] && b[prop].constructor === Object) {
|
7433 | if (a[prop] === undefined) {
|
7434 | a[prop] = {};
|
7435 | }
|
7436 |
|
7437 | if (a[prop].constructor === Object) {
|
7438 | deepExtend(a[prop], b[prop], false, allowDeletion);
|
7439 | } else {
|
7440 | copyOrDelete(a, b, prop, allowDeletion);
|
7441 | }
|
7442 | } else if (isArray$5(b[prop])) {
|
7443 | throw new TypeError("Arrays are not supported by deepExtend");
|
7444 | } else {
|
7445 | copyOrDelete(a, b, prop, allowDeletion);
|
7446 | }
|
7447 | }
|
7448 | }
|
7449 |
|
7450 | return a;
|
7451 | }
|
7452 |
|
7453 |
|
7454 |
|
7455 |
|
7456 |
|
7457 |
|
7458 |
|
7459 |
|
7460 |
|
7461 |
|
7462 |
|
7463 |
|
7464 |
|
7465 |
|
7466 | function deepExtend(a, b) {
|
7467 | var protoExtend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
7468 | var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
7469 |
|
7470 | for (var prop in b) {
|
7471 | if (Object.prototype.hasOwnProperty.call(b, prop) || protoExtend === true) {
|
7472 | if (_typeof(b[prop]) === "object" && b[prop] !== null && getPrototypeOf$2(b[prop]) === Object.prototype) {
|
7473 | if (a[prop] === undefined) {
|
7474 | a[prop] = deepExtend({}, b[prop], protoExtend);
|
7475 | } else if (_typeof(a[prop]) === "object" && a[prop] !== null && getPrototypeOf$2(a[prop]) === Object.prototype) {
|
7476 | deepExtend(a[prop], b[prop], protoExtend);
|
7477 | } else {
|
7478 | copyOrDelete(a, b, prop, allowDeletion);
|
7479 | }
|
7480 | } else if (isArray$5(b[prop])) {
|
7481 | var _context6;
|
7482 |
|
7483 | a[prop] = slice$1(_context6 = b[prop]).call(_context6);
|
7484 | } else {
|
7485 | copyOrDelete(a, b, prop, allowDeletion);
|
7486 | }
|
7487 | }
|
7488 | }
|
7489 |
|
7490 | return a;
|
7491 | }
|
7492 |
|
7493 |
|
7494 |
|
7495 |
|
7496 |
|
7497 |
|
7498 |
|
7499 |
|
7500 |
|
7501 |
|
7502 | function copyAndExtendArray(arr, newValue) {
|
7503 | var _context7;
|
7504 |
|
7505 | return concat(_context7 = []).call(_context7, _toConsumableArray(arr), [newValue]);
|
7506 | }
|
7507 |
|
7508 |
|
7509 |
|
7510 |
|
7511 |
|
7512 |
|
7513 |
|
7514 |
|
7515 |
|
7516 | function copyArray(arr) {
|
7517 | return slice$1(arr).call(arr);
|
7518 | }
|
7519 |
|
7520 |
|
7521 |
|
7522 |
|
7523 |
|
7524 |
|
7525 |
|
7526 |
|
7527 |
|
7528 |
|
7529 | function addEventListener(element, action, listener, useCapture) {
|
7530 | if (element.addEventListener) {
|
7531 | var _context8;
|
7532 |
|
7533 | if (useCapture === undefined) {
|
7534 | useCapture = false;
|
7535 | }
|
7536 |
|
7537 | if (action === "mousewheel" && includes(_context8 = navigator.userAgent).call(_context8, "Firefox")) {
|
7538 | action = "DOMMouseScroll";
|
7539 | }
|
7540 |
|
7541 | element.addEventListener(action, listener, useCapture);
|
7542 | } else {
|
7543 |
|
7544 | element.attachEvent("on" + action, listener);
|
7545 | }
|
7546 | }
|
7547 |
|
7548 |
|
7549 |
|
7550 |
|
7551 |
|
7552 |
|
7553 |
|
7554 |
|
7555 |
|
7556 |
|
7557 | function removeEventListener(element, action, listener, useCapture) {
|
7558 | if (element.removeEventListener) {
|
7559 | var _context9;
|
7560 |
|
7561 |
|
7562 | if (useCapture === undefined) {
|
7563 | useCapture = false;
|
7564 | }
|
7565 |
|
7566 | if (action === "mousewheel" && includes(_context9 = navigator.userAgent).call(_context9, "Firefox")) {
|
7567 | action = "DOMMouseScroll";
|
7568 | }
|
7569 |
|
7570 | element.removeEventListener(action, listener, useCapture);
|
7571 | } else {
|
7572 |
|
7573 | element.detachEvent("on" + action, listener);
|
7574 | }
|
7575 | }
|
7576 |
|
7577 |
|
7578 |
|
7579 |
|
7580 |
|
7581 |
|
7582 |
|
7583 | function preventDefault(event) {
|
7584 | if (!event) {
|
7585 | event = window.event;
|
7586 | }
|
7587 |
|
7588 | if (!event) ;else if (event.preventDefault) {
|
7589 | event.preventDefault();
|
7590 | } else {
|
7591 |
|
7592 | event.returnValue = false;
|
7593 | }
|
7594 | }
|
7595 |
|
7596 |
|
7597 |
|
7598 |
|
7599 |
|
7600 |
|
7601 |
|
7602 |
|
7603 |
|
7604 |
|
7605 |
|
7606 | function hexToRGB(hex) {
|
7607 | var result;
|
7608 |
|
7609 | switch (hex.length) {
|
7610 | case 3:
|
7611 | case 4:
|
7612 | result = shortHexRE.exec(hex);
|
7613 | return result ? {
|
7614 | r: _parseInt(result[1] + result[1], 16),
|
7615 | g: _parseInt(result[2] + result[2], 16),
|
7616 | b: _parseInt(result[3] + result[3], 16)
|
7617 | } : null;
|
7618 |
|
7619 | case 6:
|
7620 | case 7:
|
7621 | result = fullHexRE.exec(hex);
|
7622 | return result ? {
|
7623 | r: _parseInt(result[1], 16),
|
7624 | g: _parseInt(result[2], 16),
|
7625 | b: _parseInt(result[3], 16)
|
7626 | } : null;
|
7627 |
|
7628 | default:
|
7629 | return null;
|
7630 | }
|
7631 | }
|
7632 |
|
7633 |
|
7634 |
|
7635 |
|
7636 |
|
7637 |
|
7638 |
|
7639 |
|
7640 |
|
7641 |
|
7642 |
|
7643 |
|
7644 |
|
7645 |
|
7646 | function HSVToRGB(h, s, v) {
|
7647 | var r;
|
7648 | var g;
|
7649 | var b;
|
7650 | var i = Math.floor(h * 6);
|
7651 | var f = h * 6 - i;
|
7652 | var p = v * (1 - s);
|
7653 | var q = v * (1 - f * s);
|
7654 | var t = v * (1 - (1 - f) * s);
|
7655 |
|
7656 | switch (i % 6) {
|
7657 | case 0:
|
7658 | r = v, g = t, b = p;
|
7659 | break;
|
7660 |
|
7661 | case 1:
|
7662 | r = q, g = v, b = p;
|
7663 | break;
|
7664 |
|
7665 | case 2:
|
7666 | r = p, g = v, b = t;
|
7667 | break;
|
7668 |
|
7669 | case 3:
|
7670 | r = p, g = q, b = v;
|
7671 | break;
|
7672 |
|
7673 | case 4:
|
7674 | r = t, g = p, b = v;
|
7675 | break;
|
7676 |
|
7677 | case 5:
|
7678 | r = v, g = p, b = q;
|
7679 | break;
|
7680 | }
|
7681 |
|
7682 | return {
|
7683 | r: Math.floor(r * 255),
|
7684 | g: Math.floor(g * 255),
|
7685 | b: Math.floor(b * 255)
|
7686 | };
|
7687 | }
|
7688 |
|
7689 |
|
7690 |
|
7691 |
|
7692 |
|
7693 |
|
7694 |
|
7695 |
|
7696 |
|
7697 | function isValidHex(hex) {
|
7698 | var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex);
|
7699 | return isOk;
|
7700 | }
|
7701 |
|
7702 | var errorFound = false;
|
7703 | var allOptions$1;
|
7704 | var VALIDATOR_PRINT_STYLE = "background: #FFeeee; color: #dd0000";
|
7705 |
|
7706 |
|
7707 |
|
7708 |
|
7709 | var Validator = function () {
|
7710 | function Validator() {
|
7711 | _classCallCheck(this, Validator);
|
7712 | }
|
7713 |
|
7714 | _createClass(Validator, null, [{
|
7715 | key: "validate",
|
7716 | value:
|
7717 | |
7718 |
|
7719 |
|
7720 |
|
7721 |
|
7722 |
|
7723 |
|
7724 |
|
7725 |
|
7726 | function validate(options, referenceOptions, subObject) {
|
7727 | errorFound = false;
|
7728 | allOptions$1 = referenceOptions;
|
7729 | var usedOptions = referenceOptions;
|
7730 |
|
7731 | if (subObject !== undefined) {
|
7732 | usedOptions = referenceOptions[subObject];
|
7733 | }
|
7734 |
|
7735 | Validator.parse(options, usedOptions, []);
|
7736 | return errorFound;
|
7737 | }
|
7738 | |
7739 |
|
7740 |
|
7741 |
|
7742 |
|
7743 |
|
7744 |
|
7745 |
|
7746 |
|
7747 | }, {
|
7748 | key: "parse",
|
7749 | value: function parse(options, referenceOptions, path) {
|
7750 | for (var _option3 in options) {
|
7751 | if (Object.prototype.hasOwnProperty.call(options, _option3)) {
|
7752 | Validator.check(_option3, options, referenceOptions, path);
|
7753 | }
|
7754 | }
|
7755 | }
|
7756 | |
7757 |
|
7758 |
|
7759 |
|
7760 |
|
7761 |
|
7762 |
|
7763 |
|
7764 |
|
7765 |
|
7766 | }, {
|
7767 | key: "check",
|
7768 | value: function check(option, options, referenceOptions, path) {
|
7769 | if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) {
|
7770 | Validator.getSuggestion(option, referenceOptions, path);
|
7771 | return;
|
7772 | }
|
7773 |
|
7774 | var referenceOption = option;
|
7775 | var is_object = true;
|
7776 |
|
7777 | if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) {
|
7778 |
|
7779 |
|
7780 |
|
7781 |
|
7782 | referenceOption = "__any__";
|
7783 |
|
7784 |
|
7785 | is_object = Validator.getType(options[option]) === "object";
|
7786 | }
|
7787 |
|
7788 | var refOptionObj = referenceOptions[referenceOption];
|
7789 |
|
7790 | if (is_object && refOptionObj.__type__ !== undefined) {
|
7791 | refOptionObj = refOptionObj.__type__;
|
7792 | }
|
7793 |
|
7794 | Validator.checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path);
|
7795 | }
|
7796 | |
7797 |
|
7798 |
|
7799 |
|
7800 |
|
7801 |
|
7802 |
|
7803 |
|
7804 |
|
7805 |
|
7806 |
|
7807 | }, {
|
7808 | key: "checkFields",
|
7809 | value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) {
|
7810 | var log = function log(message) {
|
7811 | console.error("%c" + message + Validator.printLocation(path, option), VALIDATOR_PRINT_STYLE);
|
7812 | };
|
7813 |
|
7814 | var optionType = Validator.getType(options[option]);
|
7815 | var refOptionType = refOptionObj[optionType];
|
7816 |
|
7817 | if (refOptionType !== undefined) {
|
7818 |
|
7819 | if (Validator.getType(refOptionType) === "array" && indexOf(refOptionType).call(refOptionType, options[option]) === -1) {
|
7820 | log('Invalid option detected in "' + option + '".' + " Allowed values are:" + Validator.print(refOptionType) + ' not "' + options[option] + '". ');
|
7821 | errorFound = true;
|
7822 | } else if (optionType === "object" && referenceOption !== "__any__") {
|
7823 | path = copyAndExtendArray(path, option);
|
7824 | Validator.parse(options[option], referenceOptions[referenceOption], path);
|
7825 | }
|
7826 | } else if (refOptionObj["any"] === undefined) {
|
7827 |
|
7828 | log('Invalid type received for "' + option + '". Expected: ' + Validator.print(keys$4(refOptionObj)) + ". Received [" + optionType + '] "' + options[option] + '"');
|
7829 | errorFound = true;
|
7830 | }
|
7831 | }
|
7832 | |
7833 |
|
7834 |
|
7835 |
|
7836 |
|
7837 |
|
7838 |
|
7839 | }, {
|
7840 | key: "getType",
|
7841 | value: function getType(object) {
|
7842 | var type = _typeof(object);
|
7843 |
|
7844 | if (type === "object") {
|
7845 | if (object === null) {
|
7846 | return "null";
|
7847 | }
|
7848 |
|
7849 | if (object instanceof Boolean) {
|
7850 | return "boolean";
|
7851 | }
|
7852 |
|
7853 | if (object instanceof Number) {
|
7854 | return "number";
|
7855 | }
|
7856 |
|
7857 | if (object instanceof String) {
|
7858 | return "string";
|
7859 | }
|
7860 |
|
7861 | if (isArray$5(object)) {
|
7862 | return "array";
|
7863 | }
|
7864 |
|
7865 | if (object instanceof Date) {
|
7866 | return "date";
|
7867 | }
|
7868 |
|
7869 | if (object.nodeType !== undefined) {
|
7870 | return "dom";
|
7871 | }
|
7872 |
|
7873 | if (object._isAMomentObject === true) {
|
7874 | return "moment";
|
7875 | }
|
7876 |
|
7877 | return "object";
|
7878 | } else if (type === "number") {
|
7879 | return "number";
|
7880 | } else if (type === "boolean") {
|
7881 | return "boolean";
|
7882 | } else if (type === "string") {
|
7883 | return "string";
|
7884 | } else if (type === undefined) {
|
7885 | return "undefined";
|
7886 | }
|
7887 |
|
7888 | return type;
|
7889 | }
|
7890 | |
7891 |
|
7892 |
|
7893 |
|
7894 |
|
7895 |
|
7896 |
|
7897 | }, {
|
7898 | key: "getSuggestion",
|
7899 | value: function getSuggestion(option, options, path) {
|
7900 | var localSearch = Validator.findInOptions(option, options, path, false);
|
7901 | var globalSearch = Validator.findInOptions(option, allOptions$1, [], true);
|
7902 | var localSearchThreshold = 8;
|
7903 | var globalSearchThreshold = 4;
|
7904 | var msg;
|
7905 |
|
7906 | if (localSearch.indexMatch !== undefined) {
|
7907 | msg = " in " + Validator.printLocation(localSearch.path, option, "") + 'Perhaps it was incomplete? Did you mean: "' + localSearch.indexMatch + '"?\n\n';
|
7908 | } else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) {
|
7909 | msg = " in " + Validator.printLocation(localSearch.path, option, "") + "Perhaps it was misplaced? Matching option found at: " + Validator.printLocation(globalSearch.path, globalSearch.closestMatch, "");
|
7910 | } else if (localSearch.distance <= localSearchThreshold) {
|
7911 | msg = '. Did you mean "' + localSearch.closestMatch + '"?' + Validator.printLocation(localSearch.path, option);
|
7912 | } else {
|
7913 | msg = ". Did you mean one of these: " + Validator.print(keys$4(options)) + Validator.printLocation(path, option);
|
7914 | }
|
7915 |
|
7916 | console.error('%cUnknown option detected: "' + option + '"' + msg, VALIDATOR_PRINT_STYLE);
|
7917 | errorFound = true;
|
7918 | }
|
7919 | |
7920 |
|
7921 |
|
7922 |
|
7923 |
|
7924 |
|
7925 |
|
7926 |
|
7927 |
|
7928 |
|
7929 |
|
7930 | }, {
|
7931 | key: "findInOptions",
|
7932 | value: function findInOptions(option, options, path) {
|
7933 | var recursive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
7934 | var min = 1e9;
|
7935 | var closestMatch = "";
|
7936 | var closestMatchPath = [];
|
7937 | var lowerCaseOption = option.toLowerCase();
|
7938 | var indexMatch = undefined;
|
7939 |
|
7940 | for (var op in options) {
|
7941 | var distance = void 0;
|
7942 |
|
7943 | if (options[op].__type__ !== undefined && recursive === true) {
|
7944 | var result = Validator.findInOptions(option, options[op], copyAndExtendArray(path, op));
|
7945 |
|
7946 | if (min > result.distance) {
|
7947 | closestMatch = result.closestMatch;
|
7948 | closestMatchPath = result.path;
|
7949 | min = result.distance;
|
7950 | indexMatch = result.indexMatch;
|
7951 | }
|
7952 | } else {
|
7953 | var _context20;
|
7954 |
|
7955 | if (indexOf(_context20 = op.toLowerCase()).call(_context20, lowerCaseOption) !== -1) {
|
7956 | indexMatch = op;
|
7957 | }
|
7958 |
|
7959 | distance = Validator.levenshteinDistance(option, op);
|
7960 |
|
7961 | if (min > distance) {
|
7962 | closestMatch = op;
|
7963 | closestMatchPath = copyArray(path);
|
7964 | min = distance;
|
7965 | }
|
7966 | }
|
7967 | }
|
7968 |
|
7969 | return {
|
7970 | closestMatch: closestMatch,
|
7971 | path: closestMatchPath,
|
7972 | distance: min,
|
7973 | indexMatch: indexMatch
|
7974 | };
|
7975 | }
|
7976 | |
7977 |
|
7978 |
|
7979 |
|
7980 |
|
7981 |
|
7982 |
|
7983 |
|
7984 | }, {
|
7985 | key: "printLocation",
|
7986 | value: function printLocation(path, option) {
|
7987 | var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Problem value found at: \n";
|
7988 | var str = "\n\n" + prefix + "options = {\n";
|
7989 |
|
7990 | for (var i = 0; i < path.length; i++) {
|
7991 | for (var j = 0; j < i + 1; j++) {
|
7992 | str += " ";
|
7993 | }
|
7994 |
|
7995 | str += path[i] + ": {\n";
|
7996 | }
|
7997 |
|
7998 | for (var _j = 0; _j < path.length + 1; _j++) {
|
7999 | str += " ";
|
8000 | }
|
8001 |
|
8002 | str += option + "\n";
|
8003 |
|
8004 | for (var _i3 = 0; _i3 < path.length + 1; _i3++) {
|
8005 | for (var _j2 = 0; _j2 < path.length - _i3; _j2++) {
|
8006 | str += " ";
|
8007 | }
|
8008 |
|
8009 | str += "}\n";
|
8010 | }
|
8011 |
|
8012 | return str + "\n\n";
|
8013 | }
|
8014 | |
8015 |
|
8016 |
|
8017 |
|
8018 |
|
8019 |
|
8020 | }, {
|
8021 | key: "print",
|
8022 | value: function print(options) {
|
8023 | return stringify$1(options).replace(/(")|(\[)|(\])|(,"__type__")/g, "").replace(/(,)/g, ", ");
|
8024 | }
|
8025 | |
8026 |
|
8027 |
|
8028 |
|
8029 |
|
8030 |
|
8031 |
|
8032 |
|
8033 |
|
8034 |
|
8035 |
|
8036 |
|
8037 |
|
8038 |
|
8039 |
|
8040 |
|
8041 |
|
8042 |
|
8043 | }, {
|
8044 | key: "levenshteinDistance",
|
8045 | value: function levenshteinDistance(a, b) {
|
8046 | if (a.length === 0) return b.length;
|
8047 | if (b.length === 0) return a.length;
|
8048 | var matrix = [];
|
8049 |
|
8050 | var i;
|
8051 |
|
8052 | for (i = 0; i <= b.length; i++) {
|
8053 | matrix[i] = [i];
|
8054 | }
|
8055 |
|
8056 |
|
8057 | var j;
|
8058 |
|
8059 | for (j = 0; j <= a.length; j++) {
|
8060 | matrix[0][j] = j;
|
8061 | }
|
8062 |
|
8063 |
|
8064 | for (i = 1; i <= b.length; i++) {
|
8065 | for (j = 1; j <= a.length; j++) {
|
8066 | if (b.charAt(i - 1) == a.charAt(j - 1)) {
|
8067 | matrix[i][j] = matrix[i - 1][j - 1];
|
8068 | } else {
|
8069 | matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1,
|
8070 | Math.min(matrix[i][j - 1] + 1,
|
8071 | matrix[i - 1][j] + 1));
|
8072 | }
|
8073 | }
|
8074 | }
|
8075 |
|
8076 | return matrix[b.length][a.length];
|
8077 | }
|
8078 | }]);
|
8079 |
|
8080 | return Validator;
|
8081 | }();
|
8082 | var VALIDATOR_PRINT_STYLE$1 = VALIDATOR_PRINT_STYLE;
|
8083 | var Validator$1 = Validator;
|
8084 |
|
8085 |
|
8086 |
|
8087 |
|
8088 |
|
8089 |
|
8090 |
|
8091 |
|
8092 | function Point3d(x, y, z) {
|
8093 | this.x = x !== undefined ? x : 0;
|
8094 | this.y = y !== undefined ? y : 0;
|
8095 | this.z = z !== undefined ? z : 0;
|
8096 | }
|
8097 |
|
8098 |
|
8099 |
|
8100 |
|
8101 |
|
8102 |
|
8103 |
|
8104 |
|
8105 | Point3d.subtract = function (a, b) {
|
8106 | var sub = new Point3d();
|
8107 | sub.x = a.x - b.x;
|
8108 | sub.y = a.y - b.y;
|
8109 | sub.z = a.z - b.z;
|
8110 | return sub;
|
8111 | };
|
8112 |
|
8113 |
|
8114 |
|
8115 |
|
8116 |
|
8117 |
|
8118 |
|
8119 |
|
8120 | Point3d.add = function (a, b) {
|
8121 | var sum = new Point3d();
|
8122 | sum.x = a.x + b.x;
|
8123 | sum.y = a.y + b.y;
|
8124 | sum.z = a.z + b.z;
|
8125 | return sum;
|
8126 | };
|
8127 |
|
8128 |
|
8129 |
|
8130 |
|
8131 |
|
8132 |
|
8133 |
|
8134 |
|
8135 | Point3d.avg = function (a, b) {
|
8136 | return new Point3d((a.x + b.x) / 2, (a.y + b.y) / 2, (a.z + b.z) / 2);
|
8137 | };
|
8138 |
|
8139 |
|
8140 |
|
8141 |
|
8142 |
|
8143 |
|
8144 |
|
8145 |
|
8146 | Point3d.scalarProduct = function (p, c) {
|
8147 | return new Point3d(p.x * c, p.y * c, p.z * c);
|
8148 | };
|
8149 |
|
8150 |
|
8151 |
|
8152 |
|
8153 |
|
8154 |
|
8155 |
|
8156 |
|
8157 |
|
8158 | Point3d.dotProduct = function (a, b) {
|
8159 | return a.x * b.x + a.y * b.y + a.z * b.z;
|
8160 | };
|
8161 |
|
8162 |
|
8163 |
|
8164 |
|
8165 |
|
8166 |
|
8167 |
|
8168 |
|
8169 |
|
8170 | Point3d.crossProduct = function (a, b) {
|
8171 | var crossproduct = new Point3d();
|
8172 | crossproduct.x = a.y * b.z - a.z * b.y;
|
8173 | crossproduct.y = a.z * b.x - a.x * b.z;
|
8174 | crossproduct.z = a.x * b.y - a.y * b.x;
|
8175 | return crossproduct;
|
8176 | };
|
8177 |
|
8178 |
|
8179 |
|
8180 |
|
8181 |
|
8182 |
|
8183 | Point3d.prototype.length = function () {
|
8184 | return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
8185 | };
|
8186 |
|
8187 |
|
8188 |
|
8189 |
|
8190 |
|
8191 |
|
8192 | Point3d.prototype.normalize = function () {
|
8193 | return Point3d.scalarProduct(this, 1 / this.length());
|
8194 | };
|
8195 |
|
8196 | var Point3d_1 = Point3d;
|
8197 |
|
8198 |
|
8199 |
|
8200 |
|
8201 |
|
8202 |
|
8203 |
|
8204 | function Point2d(x, y) {
|
8205 | this.x = x !== undefined ? x : 0;
|
8206 | this.y = y !== undefined ? y : 0;
|
8207 | }
|
8208 |
|
8209 | var Point2d_1 = Point2d;
|
8210 |
|
8211 |
|
8212 |
|
8213 |
|
8214 |
|
8215 |
|
8216 |
|
8217 |
|
8218 |
|
8219 |
|
8220 |
|
8221 | function Slider(container, options) {
|
8222 | if (container === undefined) {
|
8223 | throw new Error('No container element defined');
|
8224 | }
|
8225 |
|
8226 | this.container = container;
|
8227 | this.visible = options && options.visible != undefined ? options.visible : true;
|
8228 |
|
8229 | if (this.visible) {
|
8230 | this.frame = document.createElement('DIV');
|
8231 |
|
8232 | this.frame.style.width = '100%';
|
8233 | this.frame.style.position = 'relative';
|
8234 | this.container.appendChild(this.frame);
|
8235 | this.frame.prev = document.createElement('INPUT');
|
8236 | this.frame.prev.type = 'BUTTON';
|
8237 | this.frame.prev.value = 'Prev';
|
8238 | this.frame.appendChild(this.frame.prev);
|
8239 | this.frame.play = document.createElement('INPUT');
|
8240 | this.frame.play.type = 'BUTTON';
|
8241 | this.frame.play.value = 'Play';
|
8242 | this.frame.appendChild(this.frame.play);
|
8243 | this.frame.next = document.createElement('INPUT');
|
8244 | this.frame.next.type = 'BUTTON';
|
8245 | this.frame.next.value = 'Next';
|
8246 | this.frame.appendChild(this.frame.next);
|
8247 | this.frame.bar = document.createElement('INPUT');
|
8248 | this.frame.bar.type = 'BUTTON';
|
8249 | this.frame.bar.style.position = 'absolute';
|
8250 | this.frame.bar.style.border = '1px solid red';
|
8251 | this.frame.bar.style.width = '100px';
|
8252 | this.frame.bar.style.height = '6px';
|
8253 | this.frame.bar.style.borderRadius = '2px';
|
8254 | this.frame.bar.style.MozBorderRadius = '2px';
|
8255 | this.frame.bar.style.border = '1px solid #7F7F7F';
|
8256 | this.frame.bar.style.backgroundColor = '#E5E5E5';
|
8257 | this.frame.appendChild(this.frame.bar);
|
8258 | this.frame.slide = document.createElement('INPUT');
|
8259 | this.frame.slide.type = 'BUTTON';
|
8260 | this.frame.slide.style.margin = '0px';
|
8261 | this.frame.slide.value = ' ';
|
8262 | this.frame.slide.style.position = 'relative';
|
8263 | this.frame.slide.style.left = '-100px';
|
8264 | this.frame.appendChild(this.frame.slide);
|
8265 |
|
8266 | var me = this;
|
8267 |
|
8268 | this.frame.slide.onmousedown = function (event) {
|
8269 | me._onMouseDown(event);
|
8270 | };
|
8271 |
|
8272 | this.frame.prev.onclick = function (event) {
|
8273 | me.prev(event);
|
8274 | };
|
8275 |
|
8276 | this.frame.play.onclick = function (event) {
|
8277 | me.togglePlay(event);
|
8278 | };
|
8279 |
|
8280 | this.frame.next.onclick = function (event) {
|
8281 | me.next(event);
|
8282 | };
|
8283 | }
|
8284 |
|
8285 | this.onChangeCallback = undefined;
|
8286 | this.values = [];
|
8287 | this.index = undefined;
|
8288 | this.playTimeout = undefined;
|
8289 | this.playInterval = 1000;
|
8290 |
|
8291 | this.playLoop = true;
|
8292 | }
|
8293 |
|
8294 |
|
8295 |
|
8296 |
|
8297 |
|
8298 | Slider.prototype.prev = function () {
|
8299 | var index = this.getIndex();
|
8300 |
|
8301 | if (index > 0) {
|
8302 | index--;
|
8303 | this.setIndex(index);
|
8304 | }
|
8305 | };
|
8306 |
|
8307 |
|
8308 |
|
8309 |
|
8310 |
|
8311 | Slider.prototype.next = function () {
|
8312 | var index = this.getIndex();
|
8313 |
|
8314 | if (index < values(this).length - 1) {
|
8315 | index++;
|
8316 | this.setIndex(index);
|
8317 | }
|
8318 | };
|
8319 |
|
8320 |
|
8321 |
|
8322 |
|
8323 |
|
8324 | Slider.prototype.playNext = function () {
|
8325 | var start = new Date();
|
8326 | var index = this.getIndex();
|
8327 |
|
8328 | if (index < values(this).length - 1) {
|
8329 | index++;
|
8330 | this.setIndex(index);
|
8331 | } else if (this.playLoop) {
|
8332 |
|
8333 | index = 0;
|
8334 | this.setIndex(index);
|
8335 | }
|
8336 |
|
8337 | var end = new Date();
|
8338 | var diff = end - start;
|
8339 |
|
8340 |
|
8341 | var interval = Math.max(this.playInterval - diff, 0);
|
8342 |
|
8343 | var me = this;
|
8344 | this.playTimeout = setTimeout$1(function () {
|
8345 | me.playNext();
|
8346 | }, interval);
|
8347 | };
|
8348 |
|
8349 |
|
8350 |
|
8351 |
|
8352 |
|
8353 | Slider.prototype.togglePlay = function () {
|
8354 | if (this.playTimeout === undefined) {
|
8355 | this.play();
|
8356 | } else {
|
8357 | this.stop();
|
8358 | }
|
8359 | };
|
8360 |
|
8361 |
|
8362 |
|
8363 |
|
8364 |
|
8365 | Slider.prototype.play = function () {
|
8366 |
|
8367 | if (this.playTimeout) return;
|
8368 | this.playNext();
|
8369 |
|
8370 | if (this.frame) {
|
8371 | this.frame.play.value = 'Stop';
|
8372 | }
|
8373 | };
|
8374 |
|
8375 |
|
8376 |
|
8377 |
|
8378 |
|
8379 | Slider.prototype.stop = function () {
|
8380 | clearInterval(this.playTimeout);
|
8381 | this.playTimeout = undefined;
|
8382 |
|
8383 | if (this.frame) {
|
8384 | this.frame.play.value = 'Play';
|
8385 | }
|
8386 | };
|
8387 |
|
8388 |
|
8389 |
|
8390 |
|
8391 |
|
8392 |
|
8393 |
|
8394 |
|
8395 | Slider.prototype.setOnChangeCallback = function (callback) {
|
8396 | this.onChangeCallback = callback;
|
8397 | };
|
8398 |
|
8399 |
|
8400 |
|
8401 |
|
8402 |
|
8403 |
|
8404 | Slider.prototype.setPlayInterval = function (interval) {
|
8405 | this.playInterval = interval;
|
8406 | };
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 | Slider.prototype.getPlayInterval = function () {
|
8414 | return this.playInterval;
|
8415 | };
|
8416 |
|
8417 |
|
8418 |
|
8419 |
|
8420 |
|
8421 |
|
8422 |
|
8423 |
|
8424 |
|
8425 | Slider.prototype.setPlayLoop = function (doLoop) {
|
8426 | this.playLoop = doLoop;
|
8427 | };
|
8428 |
|
8429 |
|
8430 |
|
8431 |
|
8432 |
|
8433 | Slider.prototype.onChange = function () {
|
8434 | if (this.onChangeCallback !== undefined) {
|
8435 | this.onChangeCallback();
|
8436 | }
|
8437 | };
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 |
|
8443 | Slider.prototype.redraw = function () {
|
8444 | if (this.frame) {
|
8445 |
|
8446 | this.frame.bar.style.top = this.frame.clientHeight / 2 - this.frame.bar.offsetHeight / 2 + 'px';
|
8447 | this.frame.bar.style.width = this.frame.clientWidth - this.frame.prev.clientWidth - this.frame.play.clientWidth - this.frame.next.clientWidth - 30 + 'px';
|
8448 |
|
8449 | var left = this.indexToLeft(this.index);
|
8450 | this.frame.slide.style.left = left + 'px';
|
8451 | }
|
8452 | };
|
8453 |
|
8454 |
|
8455 |
|
8456 |
|
8457 |
|
8458 |
|
8459 | Slider.prototype.setValues = function (values$1) {
|
8460 | this.values = values$1;
|
8461 | if (values(this).length > 0) this.setIndex(0);else this.index = undefined;
|
8462 | };
|
8463 |
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 |
|
8469 | Slider.prototype.setIndex = function (index) {
|
8470 | if (index < values(this).length) {
|
8471 | this.index = index;
|
8472 | this.redraw();
|
8473 | this.onChange();
|
8474 | } else {
|
8475 | throw new Error('Index out of range');
|
8476 | }
|
8477 | };
|
8478 |
|
8479 |
|
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 | Slider.prototype.getIndex = function () {
|
8485 | return this.index;
|
8486 | };
|
8487 |
|
8488 |
|
8489 |
|
8490 |
|
8491 |
|
8492 |
|
8493 | Slider.prototype.get = function () {
|
8494 | return values(this)[this.index];
|
8495 | };
|
8496 |
|
8497 | Slider.prototype._onMouseDown = function (event) {
|
8498 |
|
8499 | var leftButtonDown = event.which ? event.which === 1 : event.button === 1;
|
8500 | if (!leftButtonDown) return;
|
8501 | this.startClientX = event.clientX;
|
8502 | this.startSlideX = _parseFloat(this.frame.slide.style.left);
|
8503 | this.frame.style.cursor = 'move';
|
8504 |
|
8505 |
|
8506 |
|
8507 | var me = this;
|
8508 |
|
8509 | this.onmousemove = function (event) {
|
8510 | me._onMouseMove(event);
|
8511 | };
|
8512 |
|
8513 | this.onmouseup = function (event) {
|
8514 | me._onMouseUp(event);
|
8515 | };
|
8516 |
|
8517 | addEventListener(document, 'mousemove', this.onmousemove);
|
8518 | addEventListener(document, 'mouseup', this.onmouseup);
|
8519 | preventDefault(event);
|
8520 | };
|
8521 |
|
8522 | Slider.prototype.leftToIndex = function (left) {
|
8523 | var width = _parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10;
|
8524 | var x = left - 3;
|
8525 | var index = Math.round(x / width * (values(this).length - 1));
|
8526 | if (index < 0) index = 0;
|
8527 | if (index > values(this).length - 1) index = values(this).length - 1;
|
8528 | return index;
|
8529 | };
|
8530 |
|
8531 | Slider.prototype.indexToLeft = function (index) {
|
8532 | var width = _parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10;
|
8533 | var x = index / (values(this).length - 1) * width;
|
8534 | var left = x + 3;
|
8535 | return left;
|
8536 | };
|
8537 |
|
8538 | Slider.prototype._onMouseMove = function (event) {
|
8539 | var diff = event.clientX - this.startClientX;
|
8540 | var x = this.startSlideX + diff;
|
8541 | var index = this.leftToIndex(x);
|
8542 | this.setIndex(index);
|
8543 | preventDefault();
|
8544 | };
|
8545 |
|
8546 | Slider.prototype._onMouseUp = function (event) {
|
8547 |
|
8548 | this.frame.style.cursor = 'auto';
|
8549 |
|
8550 | removeEventListener(document, 'mousemove', this.onmousemove);
|
8551 | removeEventListener(document, 'mouseup', this.onmouseup);
|
8552 | preventDefault();
|
8553 | };
|
8554 |
|
8555 | function StepNumber(start, end, step, prettyStep) {
|
8556 |
|
8557 | this._start = 0;
|
8558 | this._end = 0;
|
8559 | this._step = 1;
|
8560 | this.prettyStep = true;
|
8561 | this.precision = 5;
|
8562 | this._current = 0;
|
8563 | this.setRange(start, end, step, prettyStep);
|
8564 | }
|
8565 |
|
8566 |
|
8567 |
|
8568 |
|
8569 |
|
8570 |
|
8571 |
|
8572 |
|
8573 |
|
8574 |
|
8575 | StepNumber.prototype.isNumeric = function (n) {
|
8576 | return !isNaN(_parseFloat(n)) && isFinite(n);
|
8577 | };
|
8578 |
|
8579 |
|
8580 |
|
8581 |
|
8582 |
|
8583 |
|
8584 |
|
8585 |
|
8586 |
|
8587 |
|
8588 |
|
8589 | StepNumber.prototype.setRange = function (start, end, step, prettyStep) {
|
8590 | if (!this.isNumeric(start)) {
|
8591 | throw new Error('Parameter \'start\' is not numeric; value: ' + start);
|
8592 | }
|
8593 |
|
8594 | if (!this.isNumeric(end)) {
|
8595 | throw new Error('Parameter \'end\' is not numeric; value: ' + start);
|
8596 | }
|
8597 |
|
8598 | if (!this.isNumeric(step)) {
|
8599 | throw new Error('Parameter \'step\' is not numeric; value: ' + start);
|
8600 | }
|
8601 |
|
8602 | this._start = start ? start : 0;
|
8603 | this._end = end ? end : 0;
|
8604 | this.setStep(step, prettyStep);
|
8605 | };
|
8606 |
|
8607 |
|
8608 |
|
8609 |
|
8610 |
|
8611 |
|
8612 |
|
8613 |
|
8614 | StepNumber.prototype.setStep = function (step, prettyStep) {
|
8615 | if (step === undefined || step <= 0) return;
|
8616 | if (prettyStep !== undefined) this.prettyStep = prettyStep;
|
8617 | if (this.prettyStep === true) this._step = StepNumber.calculatePrettyStep(step);else this._step = step;
|
8618 | };
|
8619 |
|
8620 |
|
8621 |
|
8622 |
|
8623 |
|
8624 |
|
8625 |
|
8626 |
|
8627 |
|
8628 | StepNumber.calculatePrettyStep = function (step) {
|
8629 | var log10 = function log10(x) {
|
8630 | return Math.log(x) / Math.LN10;
|
8631 | };
|
8632 |
|
8633 |
|
8634 | var step1 = Math.pow(10, Math.round(log10(step))),
|
8635 | step2 = 2 * Math.pow(10, Math.round(log10(step / 2))),
|
8636 | step5 = 5 * Math.pow(10, Math.round(log10(step / 5)));
|
8637 |
|
8638 | var prettyStep = step1;
|
8639 | if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2;
|
8640 | if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5;
|
8641 |
|
8642 | if (prettyStep <= 0) {
|
8643 | prettyStep = 1;
|
8644 | }
|
8645 |
|
8646 | return prettyStep;
|
8647 | };
|
8648 |
|
8649 |
|
8650 |
|
8651 |
|
8652 |
|
8653 |
|
8654 | StepNumber.prototype.getCurrent = function () {
|
8655 | return _parseFloat(this._current.toPrecision(this.precision));
|
8656 | };
|
8657 |
|
8658 |
|
8659 |
|
8660 |
|
8661 |
|
8662 |
|
8663 | StepNumber.prototype.getStep = function () {
|
8664 | return this._step;
|
8665 | };
|
8666 |
|
8667 |
|
8668 |
|
8669 |
|
8670 |
|
8671 |
|
8672 |
|
8673 |
|
8674 |
|
8675 |
|
8676 |
|
8677 |
|
8678 |
|
8679 | StepNumber.prototype.start = function (checkFirst) {
|
8680 | if (checkFirst === undefined) {
|
8681 | checkFirst = false;
|
8682 | }
|
8683 |
|
8684 | this._current = this._start - this._start % this._step;
|
8685 |
|
8686 | if (checkFirst) {
|
8687 | if (this.getCurrent() < this._start) {
|
8688 | this.next();
|
8689 | }
|
8690 | }
|
8691 | };
|
8692 |
|
8693 |
|
8694 |
|
8695 |
|
8696 |
|
8697 | StepNumber.prototype.next = function () {
|
8698 | this._current += this._step;
|
8699 | };
|
8700 |
|
8701 |
|
8702 |
|
8703 |
|
8704 |
|
8705 |
|
8706 | StepNumber.prototype.end = function () {
|
8707 | return this._current > this._end;
|
8708 | };
|
8709 |
|
8710 | var StepNumber_1 = StepNumber;
|
8711 |
|
8712 |
|
8713 |
|
8714 |
|
8715 | var mathSign = Math.sign || function sign(x) {
|
8716 |
|
8717 | return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
|
8718 | };
|
8719 |
|
8720 | var $$7 = _export;
|
8721 | var sign$3 = mathSign;
|
8722 |
|
8723 |
|
8724 | $$7({
|
8725 | target: 'Math',
|
8726 | stat: true
|
8727 | }, {
|
8728 | sign: sign$3
|
8729 | });
|
8730 |
|
8731 | var path$4 = path$s;
|
8732 | var sign$2 = path$4.Math.sign;
|
8733 |
|
8734 | var parent$e = sign$2;
|
8735 | var sign$1 = parent$e;
|
8736 |
|
8737 | var sign = sign$1;
|
8738 |
|
8739 |
|
8740 |
|
8741 |
|
8742 |
|
8743 |
|
8744 |
|
8745 |
|
8746 |
|
8747 |
|
8748 |
|
8749 |
|
8750 | function Camera() {
|
8751 | this.armLocation = new Point3d_1();
|
8752 | this.armRotation = {};
|
8753 | this.armRotation.horizontal = 0;
|
8754 | this.armRotation.vertical = 0;
|
8755 | this.armLength = 1.7;
|
8756 | this.cameraOffset = new Point3d_1();
|
8757 | this.offsetMultiplier = 0.6;
|
8758 | this.cameraLocation = new Point3d_1();
|
8759 | this.cameraRotation = new Point3d_1(0.5 * Math.PI, 0, 0);
|
8760 | this.calculateCameraOrientation();
|
8761 | }
|
8762 |
|
8763 |
|
8764 |
|
8765 |
|
8766 |
|
8767 |
|
8768 |
|
8769 | Camera.prototype.setOffset = function (x, y) {
|
8770 | var abs = Math.abs,
|
8771 | sign$1 = sign,
|
8772 | mul = this.offsetMultiplier,
|
8773 | border = this.armLength * mul;
|
8774 |
|
8775 | if (abs(x) > border) {
|
8776 | x = sign$1(x) * border;
|
8777 | }
|
8778 |
|
8779 | if (abs(y) > border) {
|
8780 | y = sign$1(y) * border;
|
8781 | }
|
8782 |
|
8783 | this.cameraOffset.x = x;
|
8784 | this.cameraOffset.y = y;
|
8785 | this.calculateCameraOrientation();
|
8786 | };
|
8787 |
|
8788 |
|
8789 |
|
8790 |
|
8791 |
|
8792 |
|
8793 | Camera.prototype.getOffset = function () {
|
8794 | return this.cameraOffset;
|
8795 | };
|
8796 |
|
8797 |
|
8798 |
|
8799 |
|
8800 |
|
8801 |
|
8802 |
|
8803 |
|
8804 | Camera.prototype.setArmLocation = function (x, y, z) {
|
8805 | this.armLocation.x = x;
|
8806 | this.armLocation.y = y;
|
8807 | this.armLocation.z = z;
|
8808 | this.calculateCameraOrientation();
|
8809 | };
|
8810 |
|
8811 |
|
8812 |
|
8813 |
|
8814 |
|
8815 |
|
8816 |
|
8817 |
|
8818 |
|
8819 |
|
8820 | Camera.prototype.setArmRotation = function (horizontal, vertical) {
|
8821 | if (horizontal !== undefined) {
|
8822 | this.armRotation.horizontal = horizontal;
|
8823 | }
|
8824 |
|
8825 | if (vertical !== undefined) {
|
8826 | this.armRotation.vertical = vertical;
|
8827 | if (this.armRotation.vertical < 0) this.armRotation.vertical = 0;
|
8828 | if (this.armRotation.vertical > 0.5 * Math.PI) this.armRotation.vertical = 0.5 * Math.PI;
|
8829 | }
|
8830 |
|
8831 | if (horizontal !== undefined || vertical !== undefined) {
|
8832 | this.calculateCameraOrientation();
|
8833 | }
|
8834 | };
|
8835 |
|
8836 |
|
8837 |
|
8838 |
|
8839 |
|
8840 |
|
8841 | Camera.prototype.getArmRotation = function () {
|
8842 | var rot = {};
|
8843 | rot.horizontal = this.armRotation.horizontal;
|
8844 | rot.vertical = this.armRotation.vertical;
|
8845 | return rot;
|
8846 | };
|
8847 |
|
8848 |
|
8849 |
|
8850 |
|
8851 |
|
8852 |
|
8853 | Camera.prototype.setArmLength = function (length) {
|
8854 | if (length === undefined) return;
|
8855 | this.armLength = length;
|
8856 |
|
8857 |
|
8858 |
|
8859 | if (this.armLength < 0.71) this.armLength = 0.71;
|
8860 | if (this.armLength > 5.0) this.armLength = 5.0;
|
8861 | this.setOffset(this.cameraOffset.x, this.cameraOffset.y);
|
8862 | this.calculateCameraOrientation();
|
8863 | };
|
8864 |
|
8865 |
|
8866 |
|
8867 |
|
8868 |
|
8869 |
|
8870 | Camera.prototype.getArmLength = function () {
|
8871 | return this.armLength;
|
8872 | };
|
8873 |
|
8874 |
|
8875 |
|
8876 |
|
8877 |
|
8878 |
|
8879 | Camera.prototype.getCameraLocation = function () {
|
8880 | return this.cameraLocation;
|
8881 | };
|
8882 |
|
8883 |
|
8884 |
|
8885 |
|
8886 |
|
8887 |
|
8888 | Camera.prototype.getCameraRotation = function () {
|
8889 | return this.cameraRotation;
|
8890 | };
|
8891 |
|
8892 |
|
8893 |
|
8894 |
|
8895 |
|
8896 |
|
8897 | Camera.prototype.calculateCameraOrientation = function () {
|
8898 |
|
8899 | this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical);
|
8900 | this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical);
|
8901 | this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical);
|
8902 |
|
8903 | this.cameraRotation.x = Math.PI / 2 - this.armRotation.vertical;
|
8904 | this.cameraRotation.y = 0;
|
8905 | this.cameraRotation.z = -this.armRotation.horizontal;
|
8906 | var xa = this.cameraRotation.x;
|
8907 | var za = this.cameraRotation.z;
|
8908 | var dx = this.cameraOffset.x;
|
8909 | var dy = this.cameraOffset.y;
|
8910 | var sin = Math.sin,
|
8911 | cos = Math.cos;
|
8912 | this.cameraLocation.x = this.cameraLocation.x + dx * cos(za) + dy * -sin(za) * cos(xa);
|
8913 | this.cameraLocation.y = this.cameraLocation.y + dx * sin(za) + dy * cos(za) * cos(xa);
|
8914 | this.cameraLocation.z = this.cameraLocation.z + dy * sin(xa);
|
8915 | };
|
8916 |
|
8917 | var STYLE = {
|
8918 | BAR: 0,
|
8919 | BARCOLOR: 1,
|
8920 | BARSIZE: 2,
|
8921 | DOT: 3,
|
8922 | DOTLINE: 4,
|
8923 | DOTCOLOR: 5,
|
8924 | DOTSIZE: 6,
|
8925 | GRID: 7,
|
8926 | LINE: 8,
|
8927 | SURFACE: 9
|
8928 | };
|
8929 |
|
8930 | var STYLENAME = {
|
8931 | 'dot': STYLE.DOT,
|
8932 | 'dot-line': STYLE.DOTLINE,
|
8933 | 'dot-color': STYLE.DOTCOLOR,
|
8934 | 'dot-size': STYLE.DOTSIZE,
|
8935 | 'line': STYLE.LINE,
|
8936 | 'grid': STYLE.GRID,
|
8937 | 'surface': STYLE.SURFACE,
|
8938 | 'bar': STYLE.BAR,
|
8939 | 'bar-color': STYLE.BARCOLOR,
|
8940 | 'bar-size': STYLE.BARSIZE
|
8941 | };
|
8942 |
|
8943 |
|
8944 |
|
8945 |
|
8946 |
|
8947 |
|
8948 |
|
8949 | var OPTIONKEYS = ['width', 'height', 'filterLabel', 'legendLabel', 'xLabel', 'yLabel', 'zLabel', 'xValueLabel', 'yValueLabel', 'zValueLabel', 'showXAxis', 'showYAxis', 'showZAxis', 'showGrayBottom', 'showGrid', 'showPerspective', 'showShadow', 'showSurfaceGrid', 'keepAspectRatio', 'rotateAxisLabels', 'verticalRatio', 'dotSizeRatio', 'dotSizeMinFraction', 'dotSizeMaxFraction', 'showAnimationControls', 'animationInterval', 'animationPreload', 'animationAutoStart', 'axisColor', 'axisFontSize', 'axisFontType', 'gridColor', 'xCenter', 'yCenter', 'zoomable', 'tooltipDelay', 'ctrlToZoom'];
|
8950 |
|
8951 |
|
8952 |
|
8953 |
|
8954 |
|
8955 |
|
8956 |
|
8957 | var PREFIXEDOPTIONKEYS = ['xBarWidth', 'yBarWidth', 'valueMin', 'valueMax', 'xMin', 'xMax', 'xStep', 'yMin', 'yMax', 'yStep', 'zMin', 'zMax', 'zStep'];
|
8958 |
|
8959 | var DEFAULTS = undefined;
|
8960 |
|
8961 |
|
8962 |
|
8963 |
|
8964 |
|
8965 |
|
8966 |
|
8967 |
|
8968 |
|
8969 | function isEmpty(obj) {
|
8970 | for (var prop in obj) {
|
8971 | if (obj.hasOwnProperty(prop)) return false;
|
8972 | }
|
8973 |
|
8974 | return true;
|
8975 | }
|
8976 |
|
8977 |
|
8978 |
|
8979 |
|
8980 |
|
8981 |
|
8982 |
|
8983 |
|
8984 |
|
8985 |
|
8986 | function capitalize(str) {
|
8987 | if (str === undefined || str === "" || typeof str != "string") {
|
8988 | return str;
|
8989 | }
|
8990 |
|
8991 | return str.charAt(0).toUpperCase() + slice$1(str).call(str, 1);
|
8992 | }
|
8993 |
|
8994 |
|
8995 |
|
8996 |
|
8997 |
|
8998 |
|
8999 |
|
9000 |
|
9001 |
|
9002 | function prefixFieldName(prefix, fieldName) {
|
9003 | if (prefix === undefined || prefix === "") {
|
9004 | return fieldName;
|
9005 | }
|
9006 |
|
9007 | return prefix + capitalize(fieldName);
|
9008 | }
|
9009 |
|
9010 |
|
9011 |
|
9012 |
|
9013 |
|
9014 |
|
9015 |
|
9016 |
|
9017 |
|
9018 |
|
9019 |
|
9020 |
|
9021 |
|
9022 |
|
9023 |
|
9024 |
|
9025 |
|
9026 |
|
9027 | function forceCopy(src, dst, fields, prefix) {
|
9028 | var srcKey;
|
9029 | var dstKey;
|
9030 |
|
9031 | for (var i = 0; i < fields.length; ++i) {
|
9032 | srcKey = fields[i];
|
9033 | dstKey = prefixFieldName(prefix, srcKey);
|
9034 | dst[dstKey] = src[srcKey];
|
9035 | }
|
9036 | }
|
9037 |
|
9038 |
|
9039 |
|
9040 |
|
9041 |
|
9042 |
|
9043 |
|
9044 |
|
9045 |
|
9046 |
|
9047 |
|
9048 |
|
9049 |
|
9050 | function safeCopy(src, dst, fields, prefix) {
|
9051 | var srcKey;
|
9052 | var dstKey;
|
9053 |
|
9054 | for (var i = 0; i < fields.length; ++i) {
|
9055 | srcKey = fields[i];
|
9056 | if (src[srcKey] === undefined) continue;
|
9057 | dstKey = prefixFieldName(prefix, srcKey);
|
9058 | dst[dstKey] = src[srcKey];
|
9059 | }
|
9060 | }
|
9061 |
|
9062 |
|
9063 |
|
9064 |
|
9065 |
|
9066 |
|
9067 |
|
9068 |
|
9069 |
|
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 | function setDefaults(src, dst) {
|
9075 | if (src === undefined || isEmpty(src)) {
|
9076 | throw new Error('No DEFAULTS passed');
|
9077 | }
|
9078 |
|
9079 | if (dst === undefined) {
|
9080 | throw new Error('No dst passed');
|
9081 | }
|
9082 |
|
9083 |
|
9084 | DEFAULTS = src;
|
9085 |
|
9086 | forceCopy(src, dst, OPTIONKEYS);
|
9087 | forceCopy(src, dst, PREFIXEDOPTIONKEYS, 'default');
|
9088 |
|
9089 | setSpecialSettings(src, dst);
|
9090 |
|
9091 | dst.margin = 10;
|
9092 |
|
9093 | dst.showTooltip = false;
|
9094 | dst.onclick_callback = null;
|
9095 | dst.eye = new Point3d_1(0, 0, -1);
|
9096 | }
|
9097 |
|
9098 |
|
9099 |
|
9100 |
|
9101 |
|
9102 |
|
9103 |
|
9104 | function setOptions(options, dst) {
|
9105 | if (options === undefined) {
|
9106 | return;
|
9107 | }
|
9108 |
|
9109 | if (dst === undefined) {
|
9110 | throw new Error('No dst passed');
|
9111 | }
|
9112 |
|
9113 | if (DEFAULTS === undefined || isEmpty(DEFAULTS)) {
|
9114 | throw new Error('DEFAULTS not set for module Settings');
|
9115 | }
|
9116 |
|
9117 |
|
9118 | safeCopy(options, dst, OPTIONKEYS);
|
9119 | safeCopy(options, dst, PREFIXEDOPTIONKEYS, 'default');
|
9120 |
|
9121 | setSpecialSettings(options, dst);
|
9122 | }
|
9123 |
|
9124 |
|
9125 |
|
9126 |
|
9127 |
|
9128 |
|
9129 |
|
9130 |
|
9131 |
|
9132 |
|
9133 | function setSpecialSettings(src, dst) {
|
9134 | if (src.backgroundColor !== undefined) {
|
9135 | setBackgroundColor(src.backgroundColor, dst);
|
9136 | }
|
9137 |
|
9138 | setDataColor(src.dataColor, dst);
|
9139 | setStyle(src.style, dst);
|
9140 |
|
9141 | if (src.surfaceColors !== undefined) {
|
9142 | console.warn('`options.surfaceColors` is deprecated and may be removed in a future ' + 'version. Please use `options.colormap` instead. Note that the `colormap` ' + 'option uses the inverse array ordering (running from vMin to vMax).');
|
9143 |
|
9144 | if (src.colormap !== undefined) {
|
9145 | throw new Error('The `colormap` and `surfaceColors` options are mutually exclusive.');
|
9146 | }
|
9147 |
|
9148 | if (dst.style !== 'surface') {
|
9149 | console.warn('Ignoring `surfaceColors` in graph style `' + dst.style + '` for ' + 'backward compatibility (only effective in `surface` plots).');
|
9150 | } else {
|
9151 | setSurfaceColor(src.surfaceColors, dst);
|
9152 | }
|
9153 | } else {
|
9154 | setColormap(src.colormap, dst);
|
9155 | }
|
9156 |
|
9157 | setShowLegend(src.showLegend, dst);
|
9158 | setCameraPosition(src.cameraPosition, dst);
|
9159 |
|
9160 |
|
9161 | if (src.tooltip !== undefined) {
|
9162 | dst.showTooltip = src.tooltip;
|
9163 | }
|
9164 |
|
9165 | if (src.onclick != undefined) {
|
9166 | dst.onclick_callback = src.onclick;
|
9167 | console.warn("`options.onclick` is deprecated and may be removed in a future version." + " Please use `Graph3d.on('click', handler)` instead.");
|
9168 | }
|
9169 |
|
9170 | if (src.tooltipStyle !== undefined) {
|
9171 | selectiveDeepExtend(['tooltipStyle'], dst, src);
|
9172 | }
|
9173 | }
|
9174 |
|
9175 |
|
9176 |
|
9177 |
|
9178 |
|
9179 |
|
9180 |
|
9181 |
|
9182 |
|
9183 |
|
9184 |
|
9185 | function setShowLegend(showLegend, dst) {
|
9186 | if (showLegend === undefined) {
|
9187 |
|
9188 | var isAutoByDefault = DEFAULTS.showLegend === undefined;
|
9189 |
|
9190 | if (isAutoByDefault) {
|
9191 |
|
9192 | var isLegendGraphStyle = dst.style === STYLE.DOTCOLOR || dst.style === STYLE.DOTSIZE;
|
9193 | dst.showLegend = isLegendGraphStyle;
|
9194 | }
|
9195 | } else {
|
9196 | dst.showLegend = showLegend;
|
9197 | }
|
9198 | }
|
9199 |
|
9200 |
|
9201 |
|
9202 |
|
9203 |
|
9204 |
|
9205 |
|
9206 |
|
9207 | function getStyleNumberByName(styleName) {
|
9208 | var number = STYLENAME[styleName];
|
9209 |
|
9210 | if (number === undefined) {
|
9211 | return -1;
|
9212 | }
|
9213 |
|
9214 | return number;
|
9215 | }
|
9216 |
|
9217 |
|
9218 |
|
9219 |
|
9220 |
|
9221 |
|
9222 |
|
9223 |
|
9224 | function checkStyleNumber(style) {
|
9225 | var valid = false;
|
9226 |
|
9227 | for (var n in STYLE) {
|
9228 | if (STYLE[n] === style) {
|
9229 | valid = true;
|
9230 | break;
|
9231 | }
|
9232 | }
|
9233 |
|
9234 | return valid;
|
9235 | }
|
9236 |
|
9237 |
|
9238 |
|
9239 |
|
9240 |
|
9241 |
|
9242 |
|
9243 | function setStyle(style, dst) {
|
9244 | if (style === undefined) {
|
9245 | return;
|
9246 | }
|
9247 |
|
9248 | var styleNumber;
|
9249 |
|
9250 | if (typeof style === 'string') {
|
9251 | styleNumber = getStyleNumberByName(style);
|
9252 |
|
9253 | if (styleNumber === -1) {
|
9254 | throw new Error('Style \'' + style + '\' is invalid');
|
9255 | }
|
9256 | } else {
|
9257 |
|
9258 | if (!checkStyleNumber(style)) {
|
9259 | throw new Error('Style \'' + style + '\' is invalid');
|
9260 | }
|
9261 |
|
9262 | styleNumber = style;
|
9263 | }
|
9264 |
|
9265 | dst.style = styleNumber;
|
9266 | }
|
9267 |
|
9268 |
|
9269 |
|
9270 |
|
9271 |
|
9272 |
|
9273 |
|
9274 | function setBackgroundColor(backgroundColor, dst) {
|
9275 | var fill$1 = 'white';
|
9276 | var stroke = 'gray';
|
9277 | var strokeWidth = 1;
|
9278 |
|
9279 | if (typeof backgroundColor === 'string') {
|
9280 | fill$1 = backgroundColor;
|
9281 | stroke = 'none';
|
9282 | strokeWidth = 0;
|
9283 | } else if (_typeof(backgroundColor) === 'object') {
|
9284 | if (fill(backgroundColor) !== undefined) fill$1 = fill(backgroundColor);
|
9285 | if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke;
|
9286 | if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth;
|
9287 | } else {
|
9288 | throw new Error('Unsupported type of backgroundColor');
|
9289 | }
|
9290 |
|
9291 | dst.frame.style.backgroundColor = fill$1;
|
9292 | dst.frame.style.borderColor = stroke;
|
9293 | dst.frame.style.borderWidth = strokeWidth + 'px';
|
9294 | dst.frame.style.borderStyle = 'solid';
|
9295 | }
|
9296 |
|
9297 |
|
9298 |
|
9299 |
|
9300 |
|
9301 |
|
9302 |
|
9303 | function setDataColor(dataColor, dst) {
|
9304 | if (dataColor === undefined) {
|
9305 | return;
|
9306 | }
|
9307 |
|
9308 | if (dst.dataColor === undefined) {
|
9309 | dst.dataColor = {};
|
9310 | }
|
9311 |
|
9312 | if (typeof dataColor === 'string') {
|
9313 | dst.dataColor.fill = dataColor;
|
9314 | dst.dataColor.stroke = dataColor;
|
9315 | } else {
|
9316 | if (fill(dataColor)) {
|
9317 | dst.dataColor.fill = fill(dataColor);
|
9318 | }
|
9319 |
|
9320 | if (dataColor.stroke) {
|
9321 | dst.dataColor.stroke = dataColor.stroke;
|
9322 | }
|
9323 |
|
9324 | if (dataColor.strokeWidth !== undefined) {
|
9325 | dst.dataColor.strokeWidth = dataColor.strokeWidth;
|
9326 | }
|
9327 | }
|
9328 | }
|
9329 |
|
9330 |
|
9331 |
|
9332 |
|
9333 |
|
9334 |
|
9335 |
|
9336 | function setSurfaceColor(surfaceColors, dst) {
|
9337 | if (surfaceColors === undefined || surfaceColors === true) {
|
9338 | return;
|
9339 | }
|
9340 |
|
9341 | if (surfaceColors === false) {
|
9342 | dst.surfaceColors = undefined;
|
9343 | return;
|
9344 | }
|
9345 |
|
9346 | if (dst.surfaceColors === undefined) {
|
9347 | dst.surfaceColors = {};
|
9348 | }
|
9349 |
|
9350 | var rgbColors;
|
9351 |
|
9352 | if (isArray$5(surfaceColors)) {
|
9353 | rgbColors = parseColorArray(surfaceColors);
|
9354 | } else if (_typeof(surfaceColors) === 'object') {
|
9355 | rgbColors = parseColorObject(surfaceColors.hue);
|
9356 | } else {
|
9357 | throw new Error('Unsupported type of surfaceColors');
|
9358 | }
|
9359 |
|
9360 |
|
9361 | reverse(rgbColors).call(rgbColors);
|
9362 |
|
9363 | dst.colormap = rgbColors;
|
9364 | }
|
9365 |
|
9366 |
|
9367 |
|
9368 |
|
9369 |
|
9370 |
|
9371 |
|
9372 | function setColormap(colormap, dst) {
|
9373 | if (colormap === undefined) {
|
9374 | return;
|
9375 | }
|
9376 |
|
9377 | var rgbColors;
|
9378 |
|
9379 | if (isArray$5(colormap)) {
|
9380 | rgbColors = parseColorArray(colormap);
|
9381 | } else if (_typeof(colormap) === 'object') {
|
9382 | rgbColors = parseColorObject(colormap.hue);
|
9383 | } else if (typeof colormap === 'function') {
|
9384 | rgbColors = colormap;
|
9385 | } else {
|
9386 | throw new Error('Unsupported type of colormap');
|
9387 | }
|
9388 |
|
9389 | dst.colormap = rgbColors;
|
9390 | }
|
9391 |
|
9392 |
|
9393 |
|
9394 |
|
9395 |
|
9396 |
|
9397 | function parseColorArray(colormap) {
|
9398 | if (colormap.length < 2) {
|
9399 | throw new Error('Colormap array length must be 2 or above.');
|
9400 | }
|
9401 |
|
9402 | return map$3(colormap).call(colormap, function (colorCode) {
|
9403 | if (!isValidHex(colorCode)) {
|
9404 | throw new Error("Invalid hex color code supplied to colormap.");
|
9405 | }
|
9406 |
|
9407 | return hexToRGB(colorCode);
|
9408 | });
|
9409 | }
|
9410 |
|
9411 |
|
9412 |
|
9413 |
|
9414 |
|
9415 |
|
9416 |
|
9417 |
|
9418 | function parseColorObject(hues) {
|
9419 | if (hues === undefined) {
|
9420 | throw new Error('Unsupported type of colormap');
|
9421 | }
|
9422 |
|
9423 | if (!(hues.saturation >= 0 && hues.saturation <= 100)) {
|
9424 | throw new Error('Saturation is out of bounds. Expected range is 0-100.');
|
9425 | }
|
9426 |
|
9427 | if (!(hues.brightness >= 0 && hues.brightness <= 100)) {
|
9428 | throw new Error('Brightness is out of bounds. Expected range is 0-100.');
|
9429 | }
|
9430 |
|
9431 | if (!(hues.colorStops >= 2)) {
|
9432 | throw new Error('colorStops is out of bounds. Expected 2 or above.');
|
9433 | }
|
9434 |
|
9435 | var hueStep = (hues.end - hues.start) / (hues.colorStops - 1);
|
9436 | var rgbColors = [];
|
9437 |
|
9438 | for (var i = 0; i < hues.colorStops; ++i) {
|
9439 | var hue = (hues.start + hueStep * i) % 360 / 360;
|
9440 | rgbColors.push(HSVToRGB(hue < 0 ? hue + 1 : hue, hues.saturation / 100, hues.brightness / 100));
|
9441 | }
|
9442 |
|
9443 | return rgbColors;
|
9444 | }
|
9445 |
|
9446 |
|
9447 |
|
9448 |
|
9449 |
|
9450 |
|
9451 |
|
9452 | function setCameraPosition(cameraPosition, dst) {
|
9453 | var camPos = cameraPosition;
|
9454 |
|
9455 | if (camPos === undefined) {
|
9456 | return;
|
9457 | }
|
9458 |
|
9459 | if (dst.camera === undefined) {
|
9460 | dst.camera = new Camera();
|
9461 | }
|
9462 |
|
9463 | dst.camera.setArmRotation(camPos.horizontal, camPos.vertical);
|
9464 | dst.camera.setArmLength(camPos.distance);
|
9465 | }
|
9466 |
|
9467 |
|
9468 |
|
9469 |
|
9470 |
|
9471 |
|
9472 |
|
9473 |
|
9474 | var string = 'string';
|
9475 | var bool = 'boolean';
|
9476 | var number = 'number';
|
9477 | var object = 'object';
|
9478 |
|
9479 | var array = 'array';
|
9480 |
|
9481 |
|
9482 |
|
9483 | var colorOptions = {
|
9484 | fill: {
|
9485 | string: string
|
9486 | },
|
9487 | stroke: {
|
9488 | string: string
|
9489 | },
|
9490 | strokeWidth: {
|
9491 | number: number
|
9492 | },
|
9493 | __type__: {
|
9494 | string: string,
|
9495 | object: object,
|
9496 | 'undefined': 'undefined'
|
9497 | }
|
9498 | };
|
9499 | var surfaceColorsOptions = {
|
9500 | hue: {
|
9501 | start: {
|
9502 | number: number
|
9503 | },
|
9504 | end: {
|
9505 | number: number
|
9506 | },
|
9507 | saturation: {
|
9508 | number: number
|
9509 | },
|
9510 | brightness: {
|
9511 | number: number
|
9512 | },
|
9513 | colorStops: {
|
9514 | number: number
|
9515 | },
|
9516 | __type__: {
|
9517 | object: object
|
9518 | }
|
9519 | },
|
9520 | __type__: {
|
9521 | boolean: bool,
|
9522 | array: array,
|
9523 | object: object,
|
9524 | 'undefined': 'undefined'
|
9525 | }
|
9526 | };
|
9527 | var colormapOptions = {
|
9528 | hue: {
|
9529 | start: {
|
9530 | number: number
|
9531 | },
|
9532 | end: {
|
9533 | number: number
|
9534 | },
|
9535 | saturation: {
|
9536 | number: number
|
9537 | },
|
9538 | brightness: {
|
9539 | number: number
|
9540 | },
|
9541 | colorStops: {
|
9542 | number: number
|
9543 | },
|
9544 | __type__: {
|
9545 | object: object
|
9546 | }
|
9547 | },
|
9548 | __type__: {
|
9549 | array: array,
|
9550 | object: object,
|
9551 | 'function': 'function',
|
9552 | 'undefined': 'undefined'
|
9553 | }
|
9554 | };
|
9555 |
|
9556 |
|
9557 |
|
9558 |
|
9559 |
|
9560 |
|
9561 |
|
9562 | var allOptions = {
|
9563 | animationAutoStart: {
|
9564 | boolean: bool,
|
9565 | 'undefined': 'undefined'
|
9566 | },
|
9567 | animationInterval: {
|
9568 | number: number
|
9569 | },
|
9570 | animationPreload: {
|
9571 | boolean: bool
|
9572 | },
|
9573 | axisColor: {
|
9574 | string: string
|
9575 | },
|
9576 | axisFontSize: {
|
9577 | number: number
|
9578 | },
|
9579 | axisFontType: {
|
9580 | string: string
|
9581 | },
|
9582 | backgroundColor: colorOptions,
|
9583 | xBarWidth: {
|
9584 | number: number,
|
9585 | 'undefined': 'undefined'
|
9586 | },
|
9587 | yBarWidth: {
|
9588 | number: number,
|
9589 | 'undefined': 'undefined'
|
9590 | },
|
9591 | cameraPosition: {
|
9592 | distance: {
|
9593 | number: number
|
9594 | },
|
9595 | horizontal: {
|
9596 | number: number
|
9597 | },
|
9598 | vertical: {
|
9599 | number: number
|
9600 | },
|
9601 | __type__: {
|
9602 | object: object
|
9603 | }
|
9604 | },
|
9605 | zoomable: {
|
9606 | boolean: bool
|
9607 | },
|
9608 | ctrlToZoom: {
|
9609 | boolean: bool
|
9610 | },
|
9611 | xCenter: {
|
9612 | string: string
|
9613 | },
|
9614 | yCenter: {
|
9615 | string: string
|
9616 | },
|
9617 | colormap: colormapOptions,
|
9618 | dataColor: colorOptions,
|
9619 | dotSizeMinFraction: {
|
9620 | number: number
|
9621 | },
|
9622 | dotSizeMaxFraction: {
|
9623 | number: number
|
9624 | },
|
9625 | dotSizeRatio: {
|
9626 | number: number
|
9627 | },
|
9628 | filterLabel: {
|
9629 | string: string
|
9630 | },
|
9631 | gridColor: {
|
9632 | string: string
|
9633 | },
|
9634 | onclick: {
|
9635 | 'function': 'function'
|
9636 | },
|
9637 | keepAspectRatio: {
|
9638 | boolean: bool
|
9639 | },
|
9640 | xLabel: {
|
9641 | string: string
|
9642 | },
|
9643 | yLabel: {
|
9644 | string: string
|
9645 | },
|
9646 | zLabel: {
|
9647 | string: string
|
9648 | },
|
9649 | legendLabel: {
|
9650 | string: string
|
9651 | },
|
9652 | xMin: {
|
9653 | number: number,
|
9654 | 'undefined': 'undefined'
|
9655 | },
|
9656 | yMin: {
|
9657 | number: number,
|
9658 | 'undefined': 'undefined'
|
9659 | },
|
9660 | zMin: {
|
9661 | number: number,
|
9662 | 'undefined': 'undefined'
|
9663 | },
|
9664 | xMax: {
|
9665 | number: number,
|
9666 | 'undefined': 'undefined'
|
9667 | },
|
9668 | yMax: {
|
9669 | number: number,
|
9670 | 'undefined': 'undefined'
|
9671 | },
|
9672 | zMax: {
|
9673 | number: number,
|
9674 | 'undefined': 'undefined'
|
9675 | },
|
9676 | showAnimationControls: {
|
9677 | boolean: bool,
|
9678 | 'undefined': 'undefined'
|
9679 | },
|
9680 | showGrayBottom: {
|
9681 | boolean: bool
|
9682 | },
|
9683 | showGrid: {
|
9684 | boolean: bool
|
9685 | },
|
9686 | showLegend: {
|
9687 | boolean: bool,
|
9688 | 'undefined': 'undefined'
|
9689 | },
|
9690 | showPerspective: {
|
9691 | boolean: bool
|
9692 | },
|
9693 | showShadow: {
|
9694 | boolean: bool
|
9695 | },
|
9696 | showSurfaceGrid: {
|
9697 | boolean: bool
|
9698 | },
|
9699 | showXAxis: {
|
9700 | boolean: bool
|
9701 | },
|
9702 | showYAxis: {
|
9703 | boolean: bool
|
9704 | },
|
9705 | showZAxis: {
|
9706 | boolean: bool
|
9707 | },
|
9708 | rotateAxisLabels: {
|
9709 | boolean: bool
|
9710 | },
|
9711 | surfaceColors: surfaceColorsOptions,
|
9712 | xStep: {
|
9713 | number: number,
|
9714 | 'undefined': 'undefined'
|
9715 | },
|
9716 | yStep: {
|
9717 | number: number,
|
9718 | 'undefined': 'undefined'
|
9719 | },
|
9720 | zStep: {
|
9721 | number: number,
|
9722 | 'undefined': 'undefined'
|
9723 | },
|
9724 | style: {
|
9725 | number: number,
|
9726 |
|
9727 | string: ['bar', 'bar-color', 'bar-size', 'dot', 'dot-line', 'dot-color', 'dot-size', 'line', 'grid', 'surface']
|
9728 | },
|
9729 | tooltip: {
|
9730 | boolean: bool,
|
9731 | 'function': 'function'
|
9732 | },
|
9733 | tooltipDelay: {
|
9734 | number: number
|
9735 | },
|
9736 | tooltipStyle: {
|
9737 | content: {
|
9738 | color: {
|
9739 | string: string
|
9740 | },
|
9741 | background: {
|
9742 | string: string
|
9743 | },
|
9744 | border: {
|
9745 | string: string
|
9746 | },
|
9747 | borderRadius: {
|
9748 | string: string
|
9749 | },
|
9750 | boxShadow: {
|
9751 | string: string
|
9752 | },
|
9753 | padding: {
|
9754 | string: string
|
9755 | },
|
9756 | __type__: {
|
9757 | object: object
|
9758 | }
|
9759 | },
|
9760 | line: {
|
9761 | borderLeft: {
|
9762 | string: string
|
9763 | },
|
9764 | height: {
|
9765 | string: string
|
9766 | },
|
9767 | width: {
|
9768 | string: string
|
9769 | },
|
9770 | pointerEvents: {
|
9771 | string: string
|
9772 | },
|
9773 | __type__: {
|
9774 | object: object
|
9775 | }
|
9776 | },
|
9777 | dot: {
|
9778 | border: {
|
9779 | string: string
|
9780 | },
|
9781 | borderRadius: {
|
9782 | string: string
|
9783 | },
|
9784 | height: {
|
9785 | string: string
|
9786 | },
|
9787 | width: {
|
9788 | string: string
|
9789 | },
|
9790 | pointerEvents: {
|
9791 | string: string
|
9792 | },
|
9793 | __type__: {
|
9794 | object: object
|
9795 | }
|
9796 | },
|
9797 | __type__: {
|
9798 | object: object
|
9799 | }
|
9800 | },
|
9801 | xValueLabel: {
|
9802 | 'function': 'function'
|
9803 | },
|
9804 | yValueLabel: {
|
9805 | 'function': 'function'
|
9806 | },
|
9807 | zValueLabel: {
|
9808 | 'function': 'function'
|
9809 | },
|
9810 | valueMax: {
|
9811 | number: number,
|
9812 | 'undefined': 'undefined'
|
9813 | },
|
9814 | valueMin: {
|
9815 | number: number,
|
9816 | 'undefined': 'undefined'
|
9817 | },
|
9818 | verticalRatio: {
|
9819 | number: number
|
9820 | },
|
9821 |
|
9822 | height: {
|
9823 | string: string
|
9824 | },
|
9825 | width: {
|
9826 | string: string
|
9827 | },
|
9828 | __type__: {
|
9829 | object: object
|
9830 | }
|
9831 | };
|
9832 |
|
9833 | var $$6 = _export;
|
9834 | var getBuiltIn$1 = getBuiltIn$8;
|
9835 | var aFunction$2 = aFunction$6;
|
9836 | var anObject$2 = anObject$b;
|
9837 | var isObject$2 = isObject$f;
|
9838 | var create$3 = objectCreate;
|
9839 | var bind$3 = functionBind;
|
9840 | var fails$2 = fails$l;
|
9841 | var nativeConstruct = getBuiltIn$1('Reflect', 'construct');
|
9842 |
|
9843 |
|
9844 |
|
9845 |
|
9846 | var NEW_TARGET_BUG = fails$2(function () {
|
9847 | function F() {
|
9848 |
|
9849 | }
|
9850 |
|
9851 | return !(nativeConstruct(function () {
|
9852 |
|
9853 | }, [], F) instanceof F);
|
9854 | });
|
9855 | var ARGS_BUG = !fails$2(function () {
|
9856 | nativeConstruct(function () {
|
9857 |
|
9858 | });
|
9859 | });
|
9860 | var FORCED = NEW_TARGET_BUG || ARGS_BUG;
|
9861 | $$6({
|
9862 | target: 'Reflect',
|
9863 | stat: true,
|
9864 | forced: FORCED,
|
9865 | sham: FORCED
|
9866 | }, {
|
9867 | construct: function construct(Target, args
|
9868 | /* , newTarget */
|
9869 | ) {
|
9870 | aFunction$2(Target);
|
9871 | anObject$2(args);
|
9872 | var newTarget = arguments.length < 3 ? Target : aFunction$2(arguments[2]);
|
9873 | if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
|
9874 |
|
9875 | if (Target == newTarget) {
|
9876 |
|
9877 | switch (args.length) {
|
9878 | case 0:
|
9879 | return new Target();
|
9880 |
|
9881 | case 1:
|
9882 | return new Target(args[0]);
|
9883 |
|
9884 | case 2:
|
9885 | return new Target(args[0], args[1]);
|
9886 |
|
9887 | case 3:
|
9888 | return new Target(args[0], args[1], args[2]);
|
9889 |
|
9890 | case 4:
|
9891 | return new Target(args[0], args[1], args[2], args[3]);
|
9892 | }
|
9893 |
|
9894 |
|
9895 | var $args = [null];
|
9896 | $args.push.apply($args, args);
|
9897 | return new (bind$3.apply(Target, $args))();
|
9898 | }
|
9899 |
|
9900 |
|
9901 | var proto = newTarget.prototype;
|
9902 | var instance = create$3(isObject$2(proto) ? proto : Object.prototype);
|
9903 | var result = Function.apply.call(Target, instance, args);
|
9904 | return isObject$2(result) ? result : instance;
|
9905 | }
|
9906 | });
|
9907 |
|
9908 | var path$3 = path$s;
|
9909 | var construct$2 = path$3.Reflect.construct;
|
9910 |
|
9911 | var parent$d = construct$2;
|
9912 | var construct$1 = parent$d;
|
9913 |
|
9914 | var construct = construct$1;
|
9915 |
|
9916 | function _assertThisInitialized(self) {
|
9917 | if (self === void 0) {
|
9918 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
9919 | }
|
9920 |
|
9921 | return self;
|
9922 | }
|
9923 |
|
9924 | var parent$c = create$5;
|
9925 | var create$2 = parent$c;
|
9926 |
|
9927 | var create$1 = create$2;
|
9928 |
|
9929 | var $$5 = _export;
|
9930 | var setPrototypeOf$4 = objectSetPrototypeOf;
|
9931 |
|
9932 |
|
9933 | $$5({
|
9934 | target: 'Object',
|
9935 | stat: true
|
9936 | }, {
|
9937 | setPrototypeOf: setPrototypeOf$4
|
9938 | });
|
9939 |
|
9940 | var path$2 = path$s;
|
9941 | var setPrototypeOf$3 = path$2.Object.setPrototypeOf;
|
9942 |
|
9943 | var parent$b = setPrototypeOf$3;
|
9944 | var setPrototypeOf$2 = parent$b;
|
9945 |
|
9946 | var parent$a = setPrototypeOf$2;
|
9947 | var setPrototypeOf$1 = parent$a;
|
9948 |
|
9949 | var setPrototypeOf = setPrototypeOf$1;
|
9950 |
|
9951 | function _setPrototypeOf(o, p) {
|
9952 | _setPrototypeOf = setPrototypeOf || function _setPrototypeOf(o, p) {
|
9953 | o.__proto__ = p;
|
9954 | return o;
|
9955 | };
|
9956 |
|
9957 | return _setPrototypeOf(o, p);
|
9958 | }
|
9959 |
|
9960 | function _inherits(subClass, superClass) {
|
9961 | if (typeof superClass !== "function" && superClass !== null) {
|
9962 | throw new TypeError("Super expression must either be null or a function");
|
9963 | }
|
9964 |
|
9965 | subClass.prototype = create$1(superClass && superClass.prototype, {
|
9966 | constructor: {
|
9967 | value: subClass,
|
9968 | writable: true,
|
9969 | configurable: true
|
9970 | }
|
9971 | });
|
9972 | if (superClass) _setPrototypeOf(subClass, superClass);
|
9973 | }
|
9974 |
|
9975 | function _possibleConstructorReturn(self, call) {
|
9976 | if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
9977 | return call;
|
9978 | } else if (call !== void 0) {
|
9979 | throw new TypeError("Derived constructors may only return object or undefined");
|
9980 | }
|
9981 |
|
9982 | return _assertThisInitialized(self);
|
9983 | }
|
9984 |
|
9985 | var parent$9 = getPrototypeOf$3;
|
9986 | var getPrototypeOf$1 = parent$9;
|
9987 |
|
9988 | var getPrototypeOf = getPrototypeOf$1;
|
9989 |
|
9990 | function _getPrototypeOf(o) {
|
9991 | _getPrototypeOf = setPrototypeOf ? getPrototypeOf : function _getPrototypeOf(o) {
|
9992 | return o.__proto__ || getPrototypeOf(o);
|
9993 | };
|
9994 | return _getPrototypeOf(o);
|
9995 | }
|
9996 |
|
9997 | var runtime = {exports: {}};
|
9998 |
|
9999 |
|
10000 |
|
10001 |
|
10002 |
|
10003 |
|
10004 |
|
10005 |
|
10006 | (function (module) {
|
10007 | var runtime = function (exports) {
|
10008 |
|
10009 | var Op = Object.prototype;
|
10010 | var hasOwn = Op.hasOwnProperty;
|
10011 | var undefined$1;
|
10012 |
|
10013 | var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
10014 | var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
10015 | var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
10016 | var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
10017 |
|
10018 | function define(obj, key, value) {
|
10019 | Object.defineProperty(obj, key, {
|
10020 | value: value,
|
10021 | enumerable: true,
|
10022 | configurable: true,
|
10023 | writable: true
|
10024 | });
|
10025 | return obj[key];
|
10026 | }
|
10027 |
|
10028 | try {
|
10029 |
|
10030 | define({}, "");
|
10031 | } catch (err) {
|
10032 | define = function (obj, key, value) {
|
10033 | return obj[key] = value;
|
10034 | };
|
10035 | }
|
10036 |
|
10037 | function wrap(innerFn, outerFn, self, tryLocsList) {
|
10038 |
|
10039 | var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
10040 | var generator = Object.create(protoGenerator.prototype);
|
10041 | var context = new Context(tryLocsList || []);
|
10042 |
|
10043 |
|
10044 | generator._invoke = makeInvokeMethod(innerFn, self, context);
|
10045 | return generator;
|
10046 | }
|
10047 |
|
10048 | exports.wrap = wrap;
|
10049 |
|
10050 |
|
10051 |
|
10052 |
|
10053 |
|
10054 |
|
10055 |
|
10056 |
|
10057 |
|
10058 |
|
10059 | function tryCatch(fn, obj, arg) {
|
10060 | try {
|
10061 | return {
|
10062 | type: "normal",
|
10063 | arg: fn.call(obj, arg)
|
10064 | };
|
10065 | } catch (err) {
|
10066 | return {
|
10067 | type: "throw",
|
10068 | arg: err
|
10069 | };
|
10070 | }
|
10071 | }
|
10072 |
|
10073 | var GenStateSuspendedStart = "suspendedStart";
|
10074 | var GenStateSuspendedYield = "suspendedYield";
|
10075 | var GenStateExecuting = "executing";
|
10076 | var GenStateCompleted = "completed";
|
10077 |
|
10078 |
|
10079 | var ContinueSentinel = {};
|
10080 |
|
10081 |
|
10082 |
|
10083 |
|
10084 | function Generator() {}
|
10085 |
|
10086 | function GeneratorFunction() {}
|
10087 |
|
10088 | function GeneratorFunctionPrototype() {}
|
10089 |
|
10090 |
|
10091 |
|
10092 | var IteratorPrototype = {};
|
10093 |
|
10094 | IteratorPrototype[iteratorSymbol] = function () {
|
10095 | return this;
|
10096 | };
|
10097 |
|
10098 | var getProto = Object.getPrototypeOf;
|
10099 | var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
10100 |
|
10101 | if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
10102 |
|
10103 |
|
10104 | IteratorPrototype = NativeIteratorPrototype;
|
10105 | }
|
10106 |
|
10107 | var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
10108 | GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
10109 | GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
10110 | GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
10111 |
|
10112 |
|
10113 | function defineIteratorMethods(prototype) {
|
10114 | ["next", "throw", "return"].forEach(function (method) {
|
10115 | define(prototype, method, function (arg) {
|
10116 | return this._invoke(method, arg);
|
10117 | });
|
10118 | });
|
10119 | }
|
10120 |
|
10121 | exports.isGeneratorFunction = function (genFun) {
|
10122 | var ctor = typeof genFun === "function" && genFun.constructor;
|
10123 | return ctor ? ctor === GeneratorFunction ||
|
10124 |
|
10125 | (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
10126 | };
|
10127 |
|
10128 | exports.mark = function (genFun) {
|
10129 | if (Object.setPrototypeOf) {
|
10130 | Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
10131 | } else {
|
10132 | genFun.__proto__ = GeneratorFunctionPrototype;
|
10133 | define(genFun, toStringTagSymbol, "GeneratorFunction");
|
10134 | }
|
10135 |
|
10136 | genFun.prototype = Object.create(Gp);
|
10137 | return genFun;
|
10138 | };
|
10139 |
|
10140 |
|
10141 |
|
10142 |
|
10143 |
|
10144 | exports.awrap = function (arg) {
|
10145 | return {
|
10146 | __await: arg
|
10147 | };
|
10148 | };
|
10149 |
|
10150 | function AsyncIterator(generator, PromiseImpl) {
|
10151 | function invoke(method, arg, resolve, reject) {
|
10152 | var record = tryCatch(generator[method], generator, arg);
|
10153 |
|
10154 | if (record.type === "throw") {
|
10155 | reject(record.arg);
|
10156 | } else {
|
10157 | var result = record.arg;
|
10158 | var value = result.value;
|
10159 |
|
10160 | if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
10161 | return PromiseImpl.resolve(value.__await).then(function (value) {
|
10162 | invoke("next", value, resolve, reject);
|
10163 | }, function (err) {
|
10164 | invoke("throw", err, resolve, reject);
|
10165 | });
|
10166 | }
|
10167 |
|
10168 | return PromiseImpl.resolve(value).then(function (unwrapped) {
|
10169 |
|
10170 |
|
10171 |
|
10172 | result.value = unwrapped;
|
10173 | resolve(result);
|
10174 | }, function (error) {
|
10175 |
|
10176 |
|
10177 | return invoke("throw", error, resolve, reject);
|
10178 | });
|
10179 | }
|
10180 | }
|
10181 |
|
10182 | var previousPromise;
|
10183 |
|
10184 | function enqueue(method, arg) {
|
10185 | function callInvokeWithMethodAndArg() {
|
10186 | return new PromiseImpl(function (resolve, reject) {
|
10187 | invoke(method, arg, resolve, reject);
|
10188 | });
|
10189 | }
|
10190 |
|
10191 | return previousPromise =
|
10192 |
|
10193 |
|
10194 |
|
10195 |
|
10196 |
|
10197 |
|
10198 |
|
10199 |
|
10200 |
|
10201 |
|
10202 |
|
10203 | previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
10204 |
|
10205 | callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
10206 | }
|
10207 |
|
10208 |
|
10209 |
|
10210 | this._invoke = enqueue;
|
10211 | }
|
10212 |
|
10213 | defineIteratorMethods(AsyncIterator.prototype);
|
10214 |
|
10215 | AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
10216 | return this;
|
10217 | };
|
10218 |
|
10219 | exports.AsyncIterator = AsyncIterator;
|
10220 |
|
10221 |
|
10222 |
|
10223 | exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
10224 | if (PromiseImpl === void 0) PromiseImpl = Promise;
|
10225 | var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
10226 | return exports.isGeneratorFunction(outerFn) ? iter
|
10227 | : iter.next().then(function (result) {
|
10228 | return result.done ? result.value : iter.next();
|
10229 | });
|
10230 | };
|
10231 |
|
10232 | function makeInvokeMethod(innerFn, self, context) {
|
10233 | var state = GenStateSuspendedStart;
|
10234 | return function invoke(method, arg) {
|
10235 | if (state === GenStateExecuting) {
|
10236 | throw new Error("Generator is already running");
|
10237 | }
|
10238 |
|
10239 | if (state === GenStateCompleted) {
|
10240 | if (method === "throw") {
|
10241 | throw arg;
|
10242 | }
|
10243 |
|
10244 |
|
10245 |
|
10246 | return doneResult();
|
10247 | }
|
10248 |
|
10249 | context.method = method;
|
10250 | context.arg = arg;
|
10251 |
|
10252 | while (true) {
|
10253 | var delegate = context.delegate;
|
10254 |
|
10255 | if (delegate) {
|
10256 | var delegateResult = maybeInvokeDelegate(delegate, context);
|
10257 |
|
10258 | if (delegateResult) {
|
10259 | if (delegateResult === ContinueSentinel) continue;
|
10260 | return delegateResult;
|
10261 | }
|
10262 | }
|
10263 |
|
10264 | if (context.method === "next") {
|
10265 |
|
10266 |
|
10267 | context.sent = context._sent = context.arg;
|
10268 | } else if (context.method === "throw") {
|
10269 | if (state === GenStateSuspendedStart) {
|
10270 | state = GenStateCompleted;
|
10271 | throw context.arg;
|
10272 | }
|
10273 |
|
10274 | context.dispatchException(context.arg);
|
10275 | } else if (context.method === "return") {
|
10276 | context.abrupt("return", context.arg);
|
10277 | }
|
10278 |
|
10279 | state = GenStateExecuting;
|
10280 | var record = tryCatch(innerFn, self, context);
|
10281 |
|
10282 | if (record.type === "normal") {
|
10283 |
|
10284 |
|
10285 | state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
10286 |
|
10287 | if (record.arg === ContinueSentinel) {
|
10288 | continue;
|
10289 | }
|
10290 |
|
10291 | return {
|
10292 | value: record.arg,
|
10293 | done: context.done
|
10294 | };
|
10295 | } else if (record.type === "throw") {
|
10296 | state = GenStateCompleted;
|
10297 |
|
10298 |
|
10299 | context.method = "throw";
|
10300 | context.arg = record.arg;
|
10301 | }
|
10302 | }
|
10303 | };
|
10304 | }
|
10305 |
|
10306 |
|
10307 |
|
10308 |
|
10309 |
|
10310 | function maybeInvokeDelegate(delegate, context) {
|
10311 | var method = delegate.iterator[context.method];
|
10312 |
|
10313 | if (method === undefined$1) {
|
10314 |
|
10315 |
|
10316 | context.delegate = null;
|
10317 |
|
10318 | if (context.method === "throw") {
|
10319 |
|
10320 | if (delegate.iterator["return"]) {
|
10321 |
|
10322 |
|
10323 | context.method = "return";
|
10324 | context.arg = undefined$1;
|
10325 | maybeInvokeDelegate(delegate, context);
|
10326 |
|
10327 | if (context.method === "throw") {
|
10328 |
|
10329 |
|
10330 | return ContinueSentinel;
|
10331 | }
|
10332 | }
|
10333 |
|
10334 | context.method = "throw";
|
10335 | context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
10336 | }
|
10337 |
|
10338 | return ContinueSentinel;
|
10339 | }
|
10340 |
|
10341 | var record = tryCatch(method, delegate.iterator, context.arg);
|
10342 |
|
10343 | if (record.type === "throw") {
|
10344 | context.method = "throw";
|
10345 | context.arg = record.arg;
|
10346 | context.delegate = null;
|
10347 | return ContinueSentinel;
|
10348 | }
|
10349 |
|
10350 | var info = record.arg;
|
10351 |
|
10352 | if (!info) {
|
10353 | context.method = "throw";
|
10354 | context.arg = new TypeError("iterator result is not an object");
|
10355 | context.delegate = null;
|
10356 | return ContinueSentinel;
|
10357 | }
|
10358 |
|
10359 | if (info.done) {
|
10360 |
|
10361 |
|
10362 | context[delegate.resultName] = info.value;
|
10363 |
|
10364 | context.next = delegate.nextLoc;
|
10365 |
|
10366 |
|
10367 |
|
10368 |
|
10369 |
|
10370 |
|
10371 | if (context.method !== "return") {
|
10372 | context.method = "next";
|
10373 | context.arg = undefined$1;
|
10374 | }
|
10375 | } else {
|
10376 |
|
10377 | return info;
|
10378 | }
|
10379 |
|
10380 |
|
10381 |
|
10382 | context.delegate = null;
|
10383 | return ContinueSentinel;
|
10384 | }
|
10385 |
|
10386 |
|
10387 |
|
10388 | defineIteratorMethods(Gp);
|
10389 | define(Gp, toStringTagSymbol, "Generator");
|
10390 |
|
10391 |
|
10392 |
|
10393 |
|
10394 |
|
10395 | Gp[iteratorSymbol] = function () {
|
10396 | return this;
|
10397 | };
|
10398 |
|
10399 | Gp.toString = function () {
|
10400 | return "[object Generator]";
|
10401 | };
|
10402 |
|
10403 | function pushTryEntry(locs) {
|
10404 | var entry = {
|
10405 | tryLoc: locs[0]
|
10406 | };
|
10407 |
|
10408 | if (1 in locs) {
|
10409 | entry.catchLoc = locs[1];
|
10410 | }
|
10411 |
|
10412 | if (2 in locs) {
|
10413 | entry.finallyLoc = locs[2];
|
10414 | entry.afterLoc = locs[3];
|
10415 | }
|
10416 |
|
10417 | this.tryEntries.push(entry);
|
10418 | }
|
10419 |
|
10420 | function resetTryEntry(entry) {
|
10421 | var record = entry.completion || {};
|
10422 | record.type = "normal";
|
10423 | delete record.arg;
|
10424 | entry.completion = record;
|
10425 | }
|
10426 |
|
10427 | function Context(tryLocsList) {
|
10428 |
|
10429 |
|
10430 |
|
10431 | this.tryEntries = [{
|
10432 | tryLoc: "root"
|
10433 | }];
|
10434 | tryLocsList.forEach(pushTryEntry, this);
|
10435 | this.reset(true);
|
10436 | }
|
10437 |
|
10438 | exports.keys = function (object) {
|
10439 | var keys = [];
|
10440 |
|
10441 | for (var key in object) {
|
10442 | keys.push(key);
|
10443 | }
|
10444 |
|
10445 | keys.reverse();
|
10446 |
|
10447 |
|
10448 | return function next() {
|
10449 | while (keys.length) {
|
10450 | var key = keys.pop();
|
10451 |
|
10452 | if (key in object) {
|
10453 | next.value = key;
|
10454 | next.done = false;
|
10455 | return next;
|
10456 | }
|
10457 | }
|
10458 |
|
10459 |
|
10460 |
|
10461 |
|
10462 | next.done = true;
|
10463 | return next;
|
10464 | };
|
10465 | };
|
10466 |
|
10467 | function values(iterable) {
|
10468 | if (iterable) {
|
10469 | var iteratorMethod = iterable[iteratorSymbol];
|
10470 |
|
10471 | if (iteratorMethod) {
|
10472 | return iteratorMethod.call(iterable);
|
10473 | }
|
10474 |
|
10475 | if (typeof iterable.next === "function") {
|
10476 | return iterable;
|
10477 | }
|
10478 |
|
10479 | if (!isNaN(iterable.length)) {
|
10480 | var i = -1,
|
10481 | next = function next() {
|
10482 | while (++i < iterable.length) {
|
10483 | if (hasOwn.call(iterable, i)) {
|
10484 | next.value = iterable[i];
|
10485 | next.done = false;
|
10486 | return next;
|
10487 | }
|
10488 | }
|
10489 |
|
10490 | next.value = undefined$1;
|
10491 | next.done = true;
|
10492 | return next;
|
10493 | };
|
10494 |
|
10495 | return next.next = next;
|
10496 | }
|
10497 | }
|
10498 |
|
10499 |
|
10500 | return {
|
10501 | next: doneResult
|
10502 | };
|
10503 | }
|
10504 |
|
10505 | exports.values = values;
|
10506 |
|
10507 | function doneResult() {
|
10508 | return {
|
10509 | value: undefined$1,
|
10510 | done: true
|
10511 | };
|
10512 | }
|
10513 |
|
10514 | Context.prototype = {
|
10515 | constructor: Context,
|
10516 | reset: function (skipTempReset) {
|
10517 | this.prev = 0;
|
10518 | this.next = 0;
|
10519 |
|
10520 |
|
10521 | this.sent = this._sent = undefined$1;
|
10522 | this.done = false;
|
10523 | this.delegate = null;
|
10524 | this.method = "next";
|
10525 | this.arg = undefined$1;
|
10526 | this.tryEntries.forEach(resetTryEntry);
|
10527 |
|
10528 | if (!skipTempReset) {
|
10529 | for (var name in this) {
|
10530 |
|
10531 | if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
10532 | this[name] = undefined$1;
|
10533 | }
|
10534 | }
|
10535 | }
|
10536 | },
|
10537 | stop: function () {
|
10538 | this.done = true;
|
10539 | var rootEntry = this.tryEntries[0];
|
10540 | var rootRecord = rootEntry.completion;
|
10541 |
|
10542 | if (rootRecord.type === "throw") {
|
10543 | throw rootRecord.arg;
|
10544 | }
|
10545 |
|
10546 | return this.rval;
|
10547 | },
|
10548 | dispatchException: function (exception) {
|
10549 | if (this.done) {
|
10550 | throw exception;
|
10551 | }
|
10552 |
|
10553 | var context = this;
|
10554 |
|
10555 | function handle(loc, caught) {
|
10556 | record.type = "throw";
|
10557 | record.arg = exception;
|
10558 | context.next = loc;
|
10559 |
|
10560 | if (caught) {
|
10561 |
|
10562 |
|
10563 | context.method = "next";
|
10564 | context.arg = undefined$1;
|
10565 | }
|
10566 |
|
10567 | return !!caught;
|
10568 | }
|
10569 |
|
10570 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
10571 | var entry = this.tryEntries[i];
|
10572 | var record = entry.completion;
|
10573 |
|
10574 | if (entry.tryLoc === "root") {
|
10575 |
|
10576 |
|
10577 |
|
10578 | return handle("end");
|
10579 | }
|
10580 |
|
10581 | if (entry.tryLoc <= this.prev) {
|
10582 | var hasCatch = hasOwn.call(entry, "catchLoc");
|
10583 | var hasFinally = hasOwn.call(entry, "finallyLoc");
|
10584 |
|
10585 | if (hasCatch && hasFinally) {
|
10586 | if (this.prev < entry.catchLoc) {
|
10587 | return handle(entry.catchLoc, true);
|
10588 | } else if (this.prev < entry.finallyLoc) {
|
10589 | return handle(entry.finallyLoc);
|
10590 | }
|
10591 | } else if (hasCatch) {
|
10592 | if (this.prev < entry.catchLoc) {
|
10593 | return handle(entry.catchLoc, true);
|
10594 | }
|
10595 | } else if (hasFinally) {
|
10596 | if (this.prev < entry.finallyLoc) {
|
10597 | return handle(entry.finallyLoc);
|
10598 | }
|
10599 | } else {
|
10600 | throw new Error("try statement without catch or finally");
|
10601 | }
|
10602 | }
|
10603 | }
|
10604 | },
|
10605 | abrupt: function (type, arg) {
|
10606 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
10607 | var entry = this.tryEntries[i];
|
10608 |
|
10609 | if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
10610 | var finallyEntry = entry;
|
10611 | break;
|
10612 | }
|
10613 | }
|
10614 |
|
10615 | if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
10616 |
|
10617 |
|
10618 | finallyEntry = null;
|
10619 | }
|
10620 |
|
10621 | var record = finallyEntry ? finallyEntry.completion : {};
|
10622 | record.type = type;
|
10623 | record.arg = arg;
|
10624 |
|
10625 | if (finallyEntry) {
|
10626 | this.method = "next";
|
10627 | this.next = finallyEntry.finallyLoc;
|
10628 | return ContinueSentinel;
|
10629 | }
|
10630 |
|
10631 | return this.complete(record);
|
10632 | },
|
10633 | complete: function (record, afterLoc) {
|
10634 | if (record.type === "throw") {
|
10635 | throw record.arg;
|
10636 | }
|
10637 |
|
10638 | if (record.type === "break" || record.type === "continue") {
|
10639 | this.next = record.arg;
|
10640 | } else if (record.type === "return") {
|
10641 | this.rval = this.arg = record.arg;
|
10642 | this.method = "return";
|
10643 | this.next = "end";
|
10644 | } else if (record.type === "normal" && afterLoc) {
|
10645 | this.next = afterLoc;
|
10646 | }
|
10647 |
|
10648 | return ContinueSentinel;
|
10649 | },
|
10650 | finish: function (finallyLoc) {
|
10651 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
10652 | var entry = this.tryEntries[i];
|
10653 |
|
10654 | if (entry.finallyLoc === finallyLoc) {
|
10655 | this.complete(entry.completion, entry.afterLoc);
|
10656 | resetTryEntry(entry);
|
10657 | return ContinueSentinel;
|
10658 | }
|
10659 | }
|
10660 | },
|
10661 | "catch": function (tryLoc) {
|
10662 | for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
10663 | var entry = this.tryEntries[i];
|
10664 |
|
10665 | if (entry.tryLoc === tryLoc) {
|
10666 | var record = entry.completion;
|
10667 |
|
10668 | if (record.type === "throw") {
|
10669 | var thrown = record.arg;
|
10670 | resetTryEntry(entry);
|
10671 | }
|
10672 |
|
10673 | return thrown;
|
10674 | }
|
10675 | }
|
10676 |
|
10677 |
|
10678 |
|
10679 | throw new Error("illegal catch attempt");
|
10680 | },
|
10681 | delegateYield: function (iterable, resultName, nextLoc) {
|
10682 | this.delegate = {
|
10683 | iterator: values(iterable),
|
10684 | resultName: resultName,
|
10685 | nextLoc: nextLoc
|
10686 | };
|
10687 |
|
10688 | if (this.method === "next") {
|
10689 |
|
10690 |
|
10691 | this.arg = undefined$1;
|
10692 | }
|
10693 |
|
10694 | return ContinueSentinel;
|
10695 | }
|
10696 | };
|
10697 |
|
10698 |
|
10699 |
|
10700 |
|
10701 | return exports;
|
10702 | }(
|
10703 |
|
10704 |
|
10705 |
|
10706 | module.exports );
|
10707 |
|
10708 | try {
|
10709 | regeneratorRuntime = runtime;
|
10710 | } catch (accidentalStrictMode) {
|
10711 |
|
10712 |
|
10713 |
|
10714 |
|
10715 |
|
10716 |
|
10717 |
|
10718 |
|
10719 |
|
10720 | Function("r", "regeneratorRuntime = r")(runtime);
|
10721 | }
|
10722 | })(runtime);
|
10723 |
|
10724 | var regenerator = runtime.exports;
|
10725 |
|
10726 | var aFunction$1 = aFunction$6;
|
10727 | var toObject$1 = toObject$e;
|
10728 | var IndexedObject = indexedObject;
|
10729 | var toLength$3 = toLength$c;
|
10730 |
|
10731 | var createMethod = function (IS_RIGHT) {
|
10732 | return function (that, callbackfn, argumentsLength, memo) {
|
10733 | aFunction$1(callbackfn);
|
10734 | var O = toObject$1(that);
|
10735 | var self = IndexedObject(O);
|
10736 | var length = toLength$3(O.length);
|
10737 | var index = IS_RIGHT ? length - 1 : 0;
|
10738 | var i = IS_RIGHT ? -1 : 1;
|
10739 | if (argumentsLength < 2) while (true) {
|
10740 | if (index in self) {
|
10741 | memo = self[index];
|
10742 | index += i;
|
10743 | break;
|
10744 | }
|
10745 |
|
10746 | index += i;
|
10747 |
|
10748 | if (IS_RIGHT ? index < 0 : length <= index) {
|
10749 | throw TypeError('Reduce of empty array with no initial value');
|
10750 | }
|
10751 | }
|
10752 |
|
10753 | for (; IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
|
10754 | memo = callbackfn(memo, self[index], index, O);
|
10755 | }
|
10756 |
|
10757 | return memo;
|
10758 | };
|
10759 | };
|
10760 |
|
10761 | var arrayReduce = {
|
10762 |
|
10763 |
|
10764 | left: createMethod(false),
|
10765 |
|
10766 |
|
10767 | right: createMethod(true)
|
10768 | };
|
10769 |
|
10770 | var classof$2 = classofRaw$1;
|
10771 | var global$2 = global$i;
|
10772 | var engineIsNode = classof$2(global$2.process) == 'process';
|
10773 |
|
10774 | var $$4 = _export;
|
10775 | var $reduce = arrayReduce.left;
|
10776 | var arrayMethodIsStrict$1 = arrayMethodIsStrict$5;
|
10777 | var CHROME_VERSION = engineV8Version;
|
10778 | var IS_NODE = engineIsNode;
|
10779 | var STRICT_METHOD$1 = arrayMethodIsStrict$1('reduce');
|
10780 |
|
10781 |
|
10782 | var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
|
10783 |
|
10784 |
|
10785 | $$4({
|
10786 | target: 'Array',
|
10787 | proto: true,
|
10788 | forced: !STRICT_METHOD$1 || CHROME_BUG
|
10789 | }, {
|
10790 | reduce: function reduce(callbackfn
|
10791 | /* , initialValue */
|
10792 | ) {
|
10793 | return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
|
10794 | }
|
10795 | });
|
10796 |
|
10797 | var entryVirtual$4 = entryVirtual$k;
|
10798 | var reduce$3 = entryVirtual$4('Array').reduce;
|
10799 |
|
10800 | var reduce$2 = reduce$3;
|
10801 | var ArrayPrototype$4 = Array.prototype;
|
10802 |
|
10803 | var reduce_1 = function (it) {
|
10804 | var own = it.reduce;
|
10805 | return it === ArrayPrototype$4 || it instanceof Array && own === ArrayPrototype$4.reduce ? reduce$2 : own;
|
10806 | };
|
10807 |
|
10808 | var parent$8 = reduce_1;
|
10809 | var reduce$1 = parent$8;
|
10810 |
|
10811 | var reduce = reduce$1;
|
10812 |
|
10813 | var isArray = isArray$c;
|
10814 | var toLength$2 = toLength$c;
|
10815 | var bind$2 = functionBindContext;
|
10816 |
|
10817 |
|
10818 | var flattenIntoArray$1 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
|
10819 | var targetIndex = start;
|
10820 | var sourceIndex = 0;
|
10821 | var mapFn = mapper ? bind$2(mapper, thisArg, 3) : false;
|
10822 | var element;
|
10823 |
|
10824 | while (sourceIndex < sourceLen) {
|
10825 | if (sourceIndex in source) {
|
10826 | element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
|
10827 |
|
10828 | if (depth > 0 && isArray(element)) {
|
10829 | targetIndex = flattenIntoArray$1(target, original, element, toLength$2(element.length), targetIndex, depth - 1) - 1;
|
10830 | } else {
|
10831 | if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');
|
10832 | target[targetIndex] = element;
|
10833 | }
|
10834 |
|
10835 | targetIndex++;
|
10836 | }
|
10837 |
|
10838 | sourceIndex++;
|
10839 | }
|
10840 |
|
10841 | return targetIndex;
|
10842 | };
|
10843 |
|
10844 | var flattenIntoArray_1 = flattenIntoArray$1;
|
10845 |
|
10846 | var $$3 = _export;
|
10847 | var flattenIntoArray = flattenIntoArray_1;
|
10848 | var toObject = toObject$e;
|
10849 | var toLength$1 = toLength$c;
|
10850 | var aFunction = aFunction$6;
|
10851 | var arraySpeciesCreate = arraySpeciesCreate$4;
|
10852 |
|
10853 |
|
10854 | $$3({
|
10855 | target: 'Array',
|
10856 | proto: true
|
10857 | }, {
|
10858 | flatMap: function flatMap(callbackfn
|
10859 | /* , thisArg */
|
10860 | ) {
|
10861 | var O = toObject(this);
|
10862 | var sourceLen = toLength$1(O.length);
|
10863 | var A;
|
10864 | aFunction(callbackfn);
|
10865 | A = arraySpeciesCreate(O, 0);
|
10866 | A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
10867 | return A;
|
10868 | }
|
10869 | });
|
10870 |
|
10871 | var entryVirtual$3 = entryVirtual$k;
|
10872 | var flatMap$3 = entryVirtual$3('Array').flatMap;
|
10873 |
|
10874 | var flatMap$2 = flatMap$3;
|
10875 | var ArrayPrototype$3 = Array.prototype;
|
10876 |
|
10877 | var flatMap_1 = function (it) {
|
10878 | var own = it.flatMap;
|
10879 | return it === ArrayPrototype$3 || it instanceof Array && own === ArrayPrototype$3.flatMap ? flatMap$2 : own;
|
10880 | };
|
10881 |
|
10882 | var parent$7 = flatMap_1;
|
10883 | var flatMap$1 = parent$7;
|
10884 |
|
10885 | var flatMap = flatMap$1;
|
10886 |
|
10887 | var internalMetadata = {exports: {}};
|
10888 |
|
10889 | var fails$1 = fails$l;
|
10890 | var freezing = !fails$1(function () {
|
10891 |
|
10892 | return Object.isExtensible(Object.preventExtensions({}));
|
10893 | });
|
10894 |
|
10895 | var $$2 = _export;
|
10896 | var hiddenKeys = hiddenKeys$6;
|
10897 | var isObject$1 = isObject$f;
|
10898 | var has = has$b;
|
10899 | var defineProperty$2 = objectDefineProperty.f;
|
10900 | var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
|
10901 | var getOwnPropertyNamesExternalModule = objectGetOwnPropertyNamesExternal;
|
10902 | var uid = uid$4;
|
10903 | var FREEZING = freezing;
|
10904 | var REQUIRED = false;
|
10905 | var METADATA = uid('meta');
|
10906 | var id = 0;
|
10907 |
|
10908 | var isExtensible = Object.isExtensible || function () {
|
10909 | return true;
|
10910 | };
|
10911 |
|
10912 | var setMetadata = function (it) {
|
10913 | defineProperty$2(it, METADATA, {
|
10914 | value: {
|
10915 | objectID: 'O' + id++,
|
10916 |
|
10917 | weakData: {}
|
10918 |
|
10919 | }
|
10920 | });
|
10921 | };
|
10922 |
|
10923 | var fastKey$1 = function (it, create) {
|
10924 |
|
10925 | if (!isObject$1(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
|
10926 |
|
10927 | if (!has(it, METADATA)) {
|
10928 |
|
10929 | if (!isExtensible(it)) return 'F';
|
10930 |
|
10931 | if (!create) return 'E';
|
10932 |
|
10933 | setMetadata(it);
|
10934 | }
|
10935 |
|
10936 | return it[METADATA].objectID;
|
10937 | };
|
10938 |
|
10939 | var getWeakData = function (it, create) {
|
10940 | if (!has(it, METADATA)) {
|
10941 |
|
10942 | if (!isExtensible(it)) return true;
|
10943 |
|
10944 | if (!create) return false;
|
10945 |
|
10946 | setMetadata(it);
|
10947 | }
|
10948 |
|
10949 | return it[METADATA].weakData;
|
10950 | };
|
10951 |
|
10952 |
|
10953 | var onFreeze = function (it) {
|
10954 | if (FREEZING && REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);
|
10955 | return it;
|
10956 | };
|
10957 |
|
10958 | var enable = function () {
|
10959 | meta.enable = function () {
|
10960 |
|
10961 | };
|
10962 |
|
10963 | REQUIRED = true;
|
10964 | var getOwnPropertyNames = getOwnPropertyNamesModule.f;
|
10965 | var splice = [].splice;
|
10966 | var test = {};
|
10967 | test[METADATA] = 1;
|
10968 |
|
10969 | if (getOwnPropertyNames(test).length) {
|
10970 | getOwnPropertyNamesModule.f = function (it) {
|
10971 | var result = getOwnPropertyNames(it);
|
10972 |
|
10973 | for (var i = 0, length = result.length; i < length; i++) {
|
10974 | if (result[i] === METADATA) {
|
10975 | splice.call(result, i, 1);
|
10976 | break;
|
10977 | }
|
10978 | }
|
10979 |
|
10980 | return result;
|
10981 | };
|
10982 |
|
10983 | $$2({
|
10984 | target: 'Object',
|
10985 | stat: true,
|
10986 | forced: true
|
10987 | }, {
|
10988 | getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
|
10989 | });
|
10990 | }
|
10991 | };
|
10992 |
|
10993 | var meta = internalMetadata.exports = {
|
10994 | enable: enable,
|
10995 | fastKey: fastKey$1,
|
10996 | getWeakData: getWeakData,
|
10997 | onFreeze: onFreeze
|
10998 | };
|
10999 | hiddenKeys[METADATA] = true;
|
11000 |
|
11001 | var anObject$1 = anObject$b;
|
11002 | var isArrayIteratorMethod = isArrayIteratorMethod$2;
|
11003 | var toLength = toLength$c;
|
11004 | var bind$1 = functionBindContext;
|
11005 | var getIteratorMethod$1 = getIteratorMethod$7;
|
11006 | var iteratorClose = iteratorClose$2;
|
11007 |
|
11008 | var Result = function (stopped, result) {
|
11009 | this.stopped = stopped;
|
11010 | this.result = result;
|
11011 | };
|
11012 |
|
11013 | var iterate$2 = function (iterable, unboundFunction, options) {
|
11014 | var that = options && options.that;
|
11015 | var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
11016 | var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
11017 | var INTERRUPTED = !!(options && options.INTERRUPTED);
|
11018 | var fn = bind$1(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
|
11019 | var iterator, iterFn, index, length, result, next, step;
|
11020 |
|
11021 | var stop = function (condition) {
|
11022 | if (iterator) iteratorClose(iterator);
|
11023 | return new Result(true, condition);
|
11024 | };
|
11025 |
|
11026 | var callFn = function (value) {
|
11027 | if (AS_ENTRIES) {
|
11028 | anObject$1(value);
|
11029 | return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
11030 | }
|
11031 |
|
11032 | return INTERRUPTED ? fn(value, stop) : fn(value);
|
11033 | };
|
11034 |
|
11035 | if (IS_ITERATOR) {
|
11036 | iterator = iterable;
|
11037 | } else {
|
11038 | iterFn = getIteratorMethod$1(iterable);
|
11039 | if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
|
11040 |
|
11041 | if (isArrayIteratorMethod(iterFn)) {
|
11042 | for (index = 0, length = toLength(iterable.length); length > index; index++) {
|
11043 | result = callFn(iterable[index]);
|
11044 | if (result && result instanceof Result) return result;
|
11045 | }
|
11046 |
|
11047 | return new Result(false);
|
11048 | }
|
11049 |
|
11050 | iterator = iterFn.call(iterable);
|
11051 | }
|
11052 |
|
11053 | next = iterator.next;
|
11054 |
|
11055 | while (!(step = next.call(iterator)).done) {
|
11056 | try {
|
11057 | result = callFn(step.value);
|
11058 | } catch (error) {
|
11059 | iteratorClose(iterator);
|
11060 | throw error;
|
11061 | }
|
11062 |
|
11063 | if (typeof result == 'object' && result && result instanceof Result) return result;
|
11064 | }
|
11065 |
|
11066 | return new Result(false);
|
11067 | };
|
11068 |
|
11069 | var anInstance$2 = function (it, Constructor, name) {
|
11070 | if (!(it instanceof Constructor)) {
|
11071 | throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
|
11072 | }
|
11073 |
|
11074 | return it;
|
11075 | };
|
11076 |
|
11077 | var $$1 = _export;
|
11078 | var global$1 = global$i;
|
11079 | var InternalMetadataModule = internalMetadata.exports;
|
11080 | var fails = fails$l;
|
11081 | var createNonEnumerableProperty = createNonEnumerableProperty$9;
|
11082 | var iterate$1 = iterate$2;
|
11083 | var anInstance$1 = anInstance$2;
|
11084 | var isObject = isObject$f;
|
11085 | var setToStringTag = setToStringTag$5;
|
11086 | var defineProperty$1 = objectDefineProperty.f;
|
11087 | var forEach = arrayIteration.forEach;
|
11088 | var DESCRIPTORS$2 = descriptors;
|
11089 | var InternalStateModule$1 = internalState;
|
11090 | var setInternalState$1 = InternalStateModule$1.set;
|
11091 | var internalStateGetterFor$1 = InternalStateModule$1.getterFor;
|
11092 |
|
11093 | var collection$2 = function (CONSTRUCTOR_NAME, wrapper, common) {
|
11094 | var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
|
11095 | var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
|
11096 | var ADDER = IS_MAP ? 'set' : 'add';
|
11097 | var NativeConstructor = global$1[CONSTRUCTOR_NAME];
|
11098 | var NativePrototype = NativeConstructor && NativeConstructor.prototype;
|
11099 | var exported = {};
|
11100 | var Constructor;
|
11101 |
|
11102 | if (!DESCRIPTORS$2 || typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
|
11103 | new NativeConstructor().entries().next();
|
11104 | }))) {
|
11105 |
|
11106 | Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
|
11107 | InternalMetadataModule.enable();
|
11108 | } else {
|
11109 | Constructor = wrapper(function (target, iterable) {
|
11110 | setInternalState$1(anInstance$1(target, Constructor, CONSTRUCTOR_NAME), {
|
11111 | type: CONSTRUCTOR_NAME,
|
11112 | collection: new NativeConstructor()
|
11113 | });
|
11114 | if (iterable != undefined) iterate$1(iterable, target[ADDER], {
|
11115 | that: target,
|
11116 | AS_ENTRIES: IS_MAP
|
11117 | });
|
11118 | });
|
11119 | var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
|
11120 | forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
|
11121 | var IS_ADDER = KEY == 'add' || KEY == 'set';
|
11122 |
|
11123 | if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
|
11124 | createNonEnumerableProperty(Constructor.prototype, KEY, function (a, b) {
|
11125 | var collection = getInternalState(this).collection;
|
11126 | if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
|
11127 | var result = collection[KEY](a === 0 ? 0 : a, b);
|
11128 | return IS_ADDER ? this : result;
|
11129 | });
|
11130 | }
|
11131 | });
|
11132 | IS_WEAK || defineProperty$1(Constructor.prototype, 'size', {
|
11133 | configurable: true,
|
11134 | get: function () {
|
11135 | return getInternalState(this).collection.size;
|
11136 | }
|
11137 | });
|
11138 | }
|
11139 |
|
11140 | setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
|
11141 | exported[CONSTRUCTOR_NAME] = Constructor;
|
11142 | $$1({
|
11143 | global: true,
|
11144 | forced: true
|
11145 | }, exported);
|
11146 | if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
|
11147 | return Constructor;
|
11148 | };
|
11149 |
|
11150 | var redefine = redefine$3;
|
11151 |
|
11152 | var redefineAll$1 = function (target, src, options) {
|
11153 | for (var key in src) {
|
11154 | if (options && options.unsafe && target[key]) target[key] = src[key];else redefine(target, key, src[key], options);
|
11155 | }
|
11156 |
|
11157 | return target;
|
11158 | };
|
11159 |
|
11160 | var getBuiltIn = getBuiltIn$8;
|
11161 | var definePropertyModule = objectDefineProperty;
|
11162 | var wellKnownSymbol = wellKnownSymbol$j;
|
11163 | var DESCRIPTORS$1 = descriptors;
|
11164 | var SPECIES = wellKnownSymbol('species');
|
11165 |
|
11166 | var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
11167 | var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
11168 | var defineProperty = definePropertyModule.f;
|
11169 |
|
11170 | if (DESCRIPTORS$1 && Constructor && !Constructor[SPECIES]) {
|
11171 | defineProperty(Constructor, SPECIES, {
|
11172 | configurable: true,
|
11173 | get: function () {
|
11174 | return this;
|
11175 | }
|
11176 | });
|
11177 | }
|
11178 | };
|
11179 |
|
11180 | var defineProperty = objectDefineProperty.f;
|
11181 | var create = objectCreate;
|
11182 | var redefineAll = redefineAll$1;
|
11183 | var bind = functionBindContext;
|
11184 | var anInstance = anInstance$2;
|
11185 | var iterate = iterate$2;
|
11186 | var defineIterator = defineIterator$3;
|
11187 | var setSpecies = setSpecies$1;
|
11188 | var DESCRIPTORS = descriptors;
|
11189 | var fastKey = internalMetadata.exports.fastKey;
|
11190 | var InternalStateModule = internalState;
|
11191 | var setInternalState = InternalStateModule.set;
|
11192 | var internalStateGetterFor = InternalStateModule.getterFor;
|
11193 | var collectionStrong$2 = {
|
11194 | getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
|
11195 | var C = wrapper(function (that, iterable) {
|
11196 | anInstance(that, C, CONSTRUCTOR_NAME);
|
11197 | setInternalState(that, {
|
11198 | type: CONSTRUCTOR_NAME,
|
11199 | index: create(null),
|
11200 | first: undefined,
|
11201 | last: undefined,
|
11202 | size: 0
|
11203 | });
|
11204 | if (!DESCRIPTORS) that.size = 0;
|
11205 | if (iterable != undefined) iterate(iterable, that[ADDER], {
|
11206 | that: that,
|
11207 | AS_ENTRIES: IS_MAP
|
11208 | });
|
11209 | });
|
11210 | var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
|
11211 |
|
11212 | var define = function (that, key, value) {
|
11213 | var state = getInternalState(that);
|
11214 | var entry = getEntry(that, key);
|
11215 | var previous, index;
|
11216 |
|
11217 | if (entry) {
|
11218 | entry.value = value;
|
11219 | } else {
|
11220 | state.last = entry = {
|
11221 | index: index = fastKey(key, true),
|
11222 | key: key,
|
11223 | value: value,
|
11224 | previous: previous = state.last,
|
11225 | next: undefined,
|
11226 | removed: false
|
11227 | };
|
11228 | if (!state.first) state.first = entry;
|
11229 | if (previous) previous.next = entry;
|
11230 | if (DESCRIPTORS) state.size++;else that.size++;
|
11231 |
|
11232 | if (index !== 'F') state.index[index] = entry;
|
11233 | }
|
11234 |
|
11235 | return that;
|
11236 | };
|
11237 |
|
11238 | var getEntry = function (that, key) {
|
11239 | var state = getInternalState(that);
|
11240 |
|
11241 | var index = fastKey(key);
|
11242 | var entry;
|
11243 | if (index !== 'F') return state.index[index];
|
11244 |
|
11245 | for (entry = state.first; entry; entry = entry.next) {
|
11246 | if (entry.key == key) return entry;
|
11247 | }
|
11248 | };
|
11249 |
|
11250 | redefineAll(C.prototype, {
|
11251 |
|
11252 |
|
11253 |
|
11254 | clear: function clear() {
|
11255 | var that = this;
|
11256 | var state = getInternalState(that);
|
11257 | var data = state.index;
|
11258 | var entry = state.first;
|
11259 |
|
11260 | while (entry) {
|
11261 | entry.removed = true;
|
11262 | if (entry.previous) entry.previous = entry.previous.next = undefined;
|
11263 | delete data[entry.index];
|
11264 | entry = entry.next;
|
11265 | }
|
11266 |
|
11267 | state.first = state.last = undefined;
|
11268 | if (DESCRIPTORS) state.size = 0;else that.size = 0;
|
11269 | },
|
11270 |
|
11271 |
|
11272 |
|
11273 | 'delete': function (key) {
|
11274 | var that = this;
|
11275 | var state = getInternalState(that);
|
11276 | var entry = getEntry(that, key);
|
11277 |
|
11278 | if (entry) {
|
11279 | var next = entry.next;
|
11280 | var prev = entry.previous;
|
11281 | delete state.index[entry.index];
|
11282 | entry.removed = true;
|
11283 | if (prev) prev.next = next;
|
11284 | if (next) next.previous = prev;
|
11285 | if (state.first == entry) state.first = next;
|
11286 | if (state.last == entry) state.last = prev;
|
11287 | if (DESCRIPTORS) state.size--;else that.size--;
|
11288 | }
|
11289 |
|
11290 | return !!entry;
|
11291 | },
|
11292 |
|
11293 |
|
11294 |
|
11295 | forEach: function forEach(callbackfn
|
11296 | /* , that = undefined */
|
11297 | ) {
|
11298 | var state = getInternalState(this);
|
11299 | var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
|
11300 | var entry;
|
11301 |
|
11302 | while (entry = entry ? entry.next : state.first) {
|
11303 | boundFunction(entry.value, entry.key, this);
|
11304 |
|
11305 | while (entry && entry.removed) entry = entry.previous;
|
11306 | }
|
11307 | },
|
11308 |
|
11309 |
|
11310 |
|
11311 | has: function has(key) {
|
11312 | return !!getEntry(this, key);
|
11313 | }
|
11314 | });
|
11315 | redefineAll(C.prototype, IS_MAP ? {
|
11316 |
|
11317 |
|
11318 | get: function get(key) {
|
11319 | var entry = getEntry(this, key);
|
11320 | return entry && entry.value;
|
11321 | },
|
11322 |
|
11323 |
|
11324 | set: function set(key, value) {
|
11325 | return define(this, key === 0 ? 0 : key, value);
|
11326 | }
|
11327 | } : {
|
11328 |
|
11329 |
|
11330 | add: function add(value) {
|
11331 | return define(this, value = value === 0 ? 0 : value, value);
|
11332 | }
|
11333 | });
|
11334 | if (DESCRIPTORS) defineProperty(C.prototype, 'size', {
|
11335 | get: function () {
|
11336 | return getInternalState(this).size;
|
11337 | }
|
11338 | });
|
11339 | return C;
|
11340 | },
|
11341 | setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
|
11342 | var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
|
11343 | var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
|
11344 | var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
|
11345 |
|
11346 |
|
11347 |
|
11348 |
|
11349 |
|
11350 |
|
11351 |
|
11352 |
|
11353 |
|
11354 | defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
|
11355 | setInternalState(this, {
|
11356 | type: ITERATOR_NAME,
|
11357 | target: iterated,
|
11358 | state: getInternalCollectionState(iterated),
|
11359 | kind: kind,
|
11360 | last: undefined
|
11361 | });
|
11362 | }, function () {
|
11363 | var state = getInternalIteratorState(this);
|
11364 | var kind = state.kind;
|
11365 | var entry = state.last;
|
11366 |
|
11367 | while (entry && entry.removed) entry = entry.previous;
|
11368 |
|
11369 |
|
11370 | if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
|
11371 |
|
11372 | state.target = undefined;
|
11373 | return {
|
11374 | value: undefined,
|
11375 | done: true
|
11376 | };
|
11377 | }
|
11378 |
|
11379 |
|
11380 | if (kind == 'keys') return {
|
11381 | value: entry.key,
|
11382 | done: false
|
11383 | };
|
11384 | if (kind == 'values') return {
|
11385 | value: entry.value,
|
11386 | done: false
|
11387 | };
|
11388 | return {
|
11389 | value: [entry.key, entry.value],
|
11390 | done: false
|
11391 | };
|
11392 | }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
|
11393 |
|
11394 |
|
11395 |
|
11396 | setSpecies(CONSTRUCTOR_NAME);
|
11397 | }
|
11398 | };
|
11399 |
|
11400 | var collection$1 = collection$2;
|
11401 | var collectionStrong$1 = collectionStrong$2;
|
11402 |
|
11403 |
|
11404 | collection$1('Map', function (init) {
|
11405 | return function Map() {
|
11406 | return init(this, arguments.length ? arguments[0] : undefined);
|
11407 | };
|
11408 | }, collectionStrong$1);
|
11409 |
|
11410 | var path$1 = path$s;
|
11411 | var map$2 = path$1.Map;
|
11412 |
|
11413 | var parent$6 = map$2;
|
11414 | var map$1 = parent$6;
|
11415 |
|
11416 | var map = map$1;
|
11417 |
|
11418 | var collection = collection$2;
|
11419 | var collectionStrong = collectionStrong$2;
|
11420 |
|
11421 |
|
11422 | collection('Set', function (init) {
|
11423 | return function Set() {
|
11424 | return init(this, arguments.length ? arguments[0] : undefined);
|
11425 | };
|
11426 | }, collectionStrong);
|
11427 |
|
11428 | var path = path$s;
|
11429 | var set$2 = path.Set;
|
11430 |
|
11431 | var parent$5 = set$2;
|
11432 | var set$1 = parent$5;
|
11433 |
|
11434 | var set = set$1;
|
11435 |
|
11436 | var iterator = iterator$3;
|
11437 |
|
11438 | var anObject = anObject$b;
|
11439 | var getIteratorMethod = getIteratorMethod$7;
|
11440 |
|
11441 | var getIterator$4 = function (it) {
|
11442 | var iteratorMethod = getIteratorMethod(it);
|
11443 |
|
11444 | if (typeof iteratorMethod != 'function') {
|
11445 | throw TypeError(String(it) + ' is not iterable');
|
11446 | }
|
11447 |
|
11448 | return anObject(iteratorMethod.call(it));
|
11449 | };
|
11450 |
|
11451 | var getIterator$3 = getIterator$4;
|
11452 | var getIterator_1 = getIterator$3;
|
11453 |
|
11454 | var parent$4 = getIterator_1;
|
11455 | var getIterator$2 = parent$4;
|
11456 |
|
11457 | var parent$3 = getIterator$2;
|
11458 | var getIterator$1 = parent$3;
|
11459 |
|
11460 | var getIterator = getIterator$1;
|
11461 |
|
11462 | var $ = _export;
|
11463 | var $some = arrayIteration.some;
|
11464 | var arrayMethodIsStrict = arrayMethodIsStrict$5;
|
11465 | var STRICT_METHOD = arrayMethodIsStrict('some');
|
11466 |
|
11467 |
|
11468 | $({
|
11469 | target: 'Array',
|
11470 | proto: true,
|
11471 | forced: !STRICT_METHOD
|
11472 | }, {
|
11473 | some: function some(callbackfn
|
11474 | /* , thisArg */
|
11475 | ) {
|
11476 | return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
11477 | }
|
11478 | });
|
11479 |
|
11480 | var entryVirtual$2 = entryVirtual$k;
|
11481 | var some$3 = entryVirtual$2('Array').some;
|
11482 |
|
11483 | var some$2 = some$3;
|
11484 | var ArrayPrototype$2 = Array.prototype;
|
11485 |
|
11486 | var some_1 = function (it) {
|
11487 | var own = it.some;
|
11488 | return it === ArrayPrototype$2 || it instanceof Array && own === ArrayPrototype$2.some ? some$2 : own;
|
11489 | };
|
11490 |
|
11491 | var parent$2 = some_1;
|
11492 | var some$1 = parent$2;
|
11493 |
|
11494 | var some = some$1;
|
11495 |
|
11496 | var entryVirtual$1 = entryVirtual$k;
|
11497 | var keys$3 = entryVirtual$1('Array').keys;
|
11498 |
|
11499 | var parent$1 = keys$3;
|
11500 | var keys$2 = parent$1;
|
11501 |
|
11502 | var keys$1 = keys$2;
|
11503 | var classof$1 = classof$9;
|
11504 | var ArrayPrototype$1 = Array.prototype;
|
11505 | var DOMIterables$1 = {
|
11506 | DOMTokenList: true,
|
11507 | NodeList: true
|
11508 | };
|
11509 |
|
11510 | var keys_1 = function (it) {
|
11511 | var own = it.keys;
|
11512 | return it === ArrayPrototype$1 || it instanceof Array && own === ArrayPrototype$1.keys
|
11513 | || DOMIterables$1.hasOwnProperty(classof$1(it)) ? keys$1 : own;
|
11514 | };
|
11515 |
|
11516 | var keys = keys_1;
|
11517 |
|
11518 | var entryVirtual = entryVirtual$k;
|
11519 | var entries$3 = entryVirtual('Array').entries;
|
11520 |
|
11521 | var parent = entries$3;
|
11522 | var entries$2 = parent;
|
11523 |
|
11524 | var entries$1 = entries$2;
|
11525 | var classof = classof$9;
|
11526 | var ArrayPrototype = Array.prototype;
|
11527 | var DOMIterables = {
|
11528 | DOMTokenList: true,
|
11529 | NodeList: true
|
11530 | };
|
11531 |
|
11532 | var entries_1 = function (it) {
|
11533 | var own = it.entries;
|
11534 | return it === ArrayPrototype || it instanceof Array && own === ArrayPrototype.entries
|
11535 | || DOMIterables.hasOwnProperty(classof(it)) ? entries$1 : own;
|
11536 | };
|
11537 |
|
11538 | var entries = entries_1;
|
11539 |
|
11540 |
|
11541 |
|
11542 |
|
11543 | var getRandomValues;
|
11544 | var rnds8 = new Uint8Array(16);
|
11545 | function rng() {
|
11546 |
|
11547 | if (!getRandomValues) {
|
11548 |
|
11549 |
|
11550 | getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
11551 |
|
11552 | if (!getRandomValues) {
|
11553 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
11554 | }
|
11555 | }
|
11556 |
|
11557 | return getRandomValues(rnds8);
|
11558 | }
|
11559 |
|
11560 | var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
11561 |
|
11562 | function validate(uuid) {
|
11563 | return typeof uuid === 'string' && REGEX.test(uuid);
|
11564 | }
|
11565 |
|
11566 |
|
11567 |
|
11568 |
|
11569 |
|
11570 |
|
11571 | var byteToHex = [];
|
11572 |
|
11573 | for (var i = 0; i < 256; ++i) {
|
11574 | byteToHex.push((i + 0x100).toString(16).substr(1));
|
11575 | }
|
11576 |
|
11577 | function stringify(arr) {
|
11578 | var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
11579 |
|
11580 |
|
11581 | var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
11582 |
|
11583 |
|
11584 |
|
11585 |
|
11586 |
|
11587 | if (!validate(uuid)) {
|
11588 | throw TypeError('Stringified UUID is invalid');
|
11589 | }
|
11590 |
|
11591 | return uuid;
|
11592 | }
|
11593 |
|
11594 | function v4(options, buf, offset) {
|
11595 | options = options || {};
|
11596 | var rnds = options.random || (options.rng || rng)();
|
11597 |
|
11598 | rnds[6] = rnds[6] & 0x0f | 0x40;
|
11599 | rnds[8] = rnds[8] & 0x3f | 0x80;
|
11600 |
|
11601 | if (buf) {
|
11602 | offset = offset || 0;
|
11603 |
|
11604 | for (var i = 0; i < 16; ++i) {
|
11605 | buf[offset + i] = rnds[i];
|
11606 | }
|
11607 |
|
11608 | return buf;
|
11609 | }
|
11610 |
|
11611 | return stringify(rnds);
|
11612 | }
|
11613 |
|
11614 | function ownKeys(object, enumerableOnly) { var keys = keys$4(object); if (getOwnPropertySymbols) { var symbols = getOwnPropertySymbols(object); if (enumerableOnly) { symbols = filter(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
11615 |
|
11616 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context32; forEach$1(_context32 = ownKeys(Object(source), true)).call(_context32, function (key) { _defineProperty(target, key, source[key]); }); } else if (getOwnPropertyDescriptors) { defineProperties(target, getOwnPropertyDescriptors(source)); } else { var _context33; forEach$1(_context33 = ownKeys(Object(source))).call(_context33, function (key) { defineProperty$5(target, key, getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
11617 |
|
11618 | function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
11619 |
|
11620 | function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !construct) return false; if (construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
11621 |
|
11622 | function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof symbol !== "undefined" && getIteratorMethod$2(o) || o["@@iterator"]; if (!it) { if (isArray$5(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
11623 |
|
11624 | function _unsupportedIterableToArray(o, minLen) { var _context31; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = slice$1(_context31 = Object.prototype.toString.call(o)).call(_context31, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return from$2(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
11625 |
|
11626 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
11627 |
|
11628 |
|
11629 |
|
11630 |
|
11631 |
|
11632 |
|
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 |
|
11640 |
|
11641 |
|
11642 |
|
11643 |
|
11644 |
|
11645 |
|
11646 |
|
11647 |
|
11648 |
|
11649 |
|
11650 |
|
11651 |
|
11652 |
|
11653 |
|
11654 |
|
11655 |
|
11656 |
|
11657 |
|
11658 |
|
11659 |
|
11660 |
|
11661 |
|
11662 | function createNewDataPipeFrom(from) {
|
11663 | return new DataPipeUnderConstruction(from);
|
11664 | }
|
11665 |
|
11666 |
|
11667 |
|
11668 |
|
11669 |
|
11670 |
|
11671 |
|
11672 |
|
11673 |
|
11674 |
|
11675 |
|
11676 | var SimpleDataPipe = function () {
|
11677 | |
11678 |
|
11679 |
|
11680 |
|
11681 |
|
11682 |
|
11683 |
|
11684 |
|
11685 | function SimpleDataPipe(_source, _transformers, _target) {
|
11686 | var _context, _context2, _context3;
|
11687 |
|
11688 | _classCallCheck(this, SimpleDataPipe);
|
11689 |
|
11690 | this._source = _source;
|
11691 | this._transformers = _transformers;
|
11692 | this._target = _target;
|
11693 | |
11694 |
|
11695 |
|
11696 |
|
11697 | this._listeners = {
|
11698 | add: bind$4(_context = this._add).call(_context, this),
|
11699 | remove: bind$4(_context2 = this._remove).call(_context2, this),
|
11700 | update: bind$4(_context3 = this._update).call(_context3, this)
|
11701 | };
|
11702 | }
|
11703 |
|
11704 |
|
11705 |
|
11706 | _createClass(SimpleDataPipe, [{
|
11707 | key: "all",
|
11708 | value: function all() {
|
11709 | this._target.update(this._transformItems(this._source.get()));
|
11710 |
|
11711 | return this;
|
11712 | }
|
11713 |
|
11714 |
|
11715 | }, {
|
11716 | key: "start",
|
11717 | value: function start() {
|
11718 | this._source.on("add", this._listeners.add);
|
11719 |
|
11720 | this._source.on("remove", this._listeners.remove);
|
11721 |
|
11722 | this._source.on("update", this._listeners.update);
|
11723 |
|
11724 | return this;
|
11725 | }
|
11726 |
|
11727 |
|
11728 | }, {
|
11729 | key: "stop",
|
11730 | value: function stop() {
|
11731 | this._source.off("add", this._listeners.add);
|
11732 |
|
11733 | this._source.off("remove", this._listeners.remove);
|
11734 |
|
11735 | this._source.off("update", this._listeners.update);
|
11736 |
|
11737 | return this;
|
11738 | }
|
11739 | |
11740 |
|
11741 |
|
11742 |
|
11743 |
|
11744 |
|
11745 |
|
11746 |
|
11747 | }, {
|
11748 | key: "_transformItems",
|
11749 | value: function _transformItems(items) {
|
11750 | var _context4;
|
11751 |
|
11752 | return reduce(_context4 = this._transformers).call(_context4, function (items, transform) {
|
11753 | return transform(items);
|
11754 | }, items);
|
11755 | }
|
11756 | |
11757 |
|
11758 |
|
11759 |
|
11760 |
|
11761 |
|
11762 |
|
11763 | }, {
|
11764 | key: "_add",
|
11765 | value: function _add(_name, payload) {
|
11766 | if (payload == null) {
|
11767 | return;
|
11768 | }
|
11769 |
|
11770 | this._target.add(this._transformItems(this._source.get(payload.items)));
|
11771 | }
|
11772 | |
11773 |
|
11774 |
|
11775 |
|
11776 |
|
11777 |
|
11778 |
|
11779 | }, {
|
11780 | key: "_update",
|
11781 | value: function _update(_name, payload) {
|
11782 | if (payload == null) {
|
11783 | return;
|
11784 | }
|
11785 |
|
11786 | this._target.update(this._transformItems(this._source.get(payload.items)));
|
11787 | }
|
11788 | |
11789 |
|
11790 |
|
11791 |
|
11792 |
|
11793 |
|
11794 |
|
11795 | }, {
|
11796 | key: "_remove",
|
11797 | value: function _remove(_name, payload) {
|
11798 | if (payload == null) {
|
11799 | return;
|
11800 | }
|
11801 |
|
11802 | this._target.remove(this._transformItems(payload.oldData));
|
11803 | }
|
11804 | }]);
|
11805 |
|
11806 | return SimpleDataPipe;
|
11807 | }();
|
11808 |
|
11809 |
|
11810 |
|
11811 |
|
11812 |
|
11813 |
|
11814 |
|
11815 |
|
11816 |
|
11817 | var DataPipeUnderConstruction = function () {
|
11818 | |
11819 |
|
11820 |
|
11821 |
|
11822 |
|
11823 |
|
11824 | function DataPipeUnderConstruction(_source) {
|
11825 | _classCallCheck(this, DataPipeUnderConstruction);
|
11826 |
|
11827 | this._source = _source;
|
11828 | |
11829 |
|
11830 |
|
11831 |
|
11832 |
|
11833 | this._transformers = [];
|
11834 | }
|
11835 | |
11836 |
|
11837 |
|
11838 |
|
11839 |
|
11840 |
|
11841 |
|
11842 |
|
11843 |
|
11844 |
|
11845 | _createClass(DataPipeUnderConstruction, [{
|
11846 | key: "filter",
|
11847 | value: function filter$1(callback) {
|
11848 | this._transformers.push(function (input) {
|
11849 | return filter(input).call(input, callback);
|
11850 | });
|
11851 |
|
11852 | return this;
|
11853 | }
|
11854 | |
11855 |
|
11856 |
|
11857 |
|
11858 |
|
11859 |
|
11860 |
|
11861 |
|
11862 |
|
11863 |
|
11864 |
|
11865 |
|
11866 | }, {
|
11867 | key: "map",
|
11868 | value: function map(callback) {
|
11869 | this._transformers.push(function (input) {
|
11870 | return map$3(input).call(input, callback);
|
11871 | });
|
11872 |
|
11873 | return this;
|
11874 | }
|
11875 | |
11876 |
|
11877 |
|
11878 |
|
11879 |
|
11880 |
|
11881 |
|
11882 |
|
11883 |
|
11884 |
|
11885 |
|
11886 |
|
11887 | }, {
|
11888 | key: "flatMap",
|
11889 | value: function flatMap$1(callback) {
|
11890 | this._transformers.push(function (input) {
|
11891 | return flatMap(input).call(input, callback);
|
11892 | });
|
11893 |
|
11894 | return this;
|
11895 | }
|
11896 | |
11897 |
|
11898 |
|
11899 |
|
11900 |
|
11901 |
|
11902 |
|
11903 |
|
11904 |
|
11905 | }, {
|
11906 | key: "to",
|
11907 | value: function to(target) {
|
11908 | return new SimpleDataPipe(this._source, this._transformers, target);
|
11909 | }
|
11910 | }]);
|
11911 |
|
11912 | return DataPipeUnderConstruction;
|
11913 | }();
|
11914 |
|
11915 |
|
11916 |
|
11917 |
|
11918 |
|
11919 |
|
11920 |
|
11921 |
|
11922 |
|
11923 | function isId(value) {
|
11924 | return typeof value === "string" || typeof value === "number";
|
11925 | }
|
11926 |
|
11927 |
|
11928 |
|
11929 |
|
11930 |
|
11931 |
|
11932 |
|
11933 | var Queue = function () {
|
11934 | |
11935 |
|
11936 |
|
11937 |
|
11938 |
|
11939 | function Queue(options) {
|
11940 | _classCallCheck(this, Queue);
|
11941 |
|
11942 | this._queue = [];
|
11943 | this._timeout = null;
|
11944 | this._extended = null;
|
11945 |
|
11946 | this.delay = null;
|
11947 | this.max = Infinity;
|
11948 | this.setOptions(options);
|
11949 | }
|
11950 | |
11951 |
|
11952 |
|
11953 |
|
11954 |
|
11955 |
|
11956 |
|
11957 | _createClass(Queue, [{
|
11958 | key: "setOptions",
|
11959 | value: function setOptions(options) {
|
11960 | if (options && typeof options.delay !== "undefined") {
|
11961 | this.delay = options.delay;
|
11962 | }
|
11963 |
|
11964 | if (options && typeof options.max !== "undefined") {
|
11965 | this.max = options.max;
|
11966 | }
|
11967 |
|
11968 | this._flushIfNeeded();
|
11969 | }
|
11970 | |
11971 |
|
11972 |
|
11973 |
|
11974 |
|
11975 |
|
11976 |
|
11977 |
|
11978 |
|
11979 |
|
11980 | }, {
|
11981 | key: "destroy",
|
11982 | value:
|
11983 | |
11984 |
|
11985 |
|
11986 | function destroy() {
|
11987 | this.flush();
|
11988 |
|
11989 | if (this._extended) {
|
11990 | var object = this._extended.object;
|
11991 | var methods = this._extended.methods;
|
11992 |
|
11993 | for (var i = 0; i < methods.length; i++) {
|
11994 | var method = methods[i];
|
11995 |
|
11996 | if (method.original) {
|
11997 |
|
11998 | object[method.name] = method.original;
|
11999 | } else {
|
12000 |
|
12001 | delete object[method.name];
|
12002 | }
|
12003 | }
|
12004 |
|
12005 | this._extended = null;
|
12006 | }
|
12007 | }
|
12008 | |
12009 |
|
12010 |
|
12011 |
|
12012 |
|
12013 |
|
12014 |
|
12015 | }, {
|
12016 | key: "replace",
|
12017 | value: function replace(object, method) {
|
12018 |
|
12019 | var me = this;
|
12020 | var original = object[method];
|
12021 |
|
12022 | if (!original) {
|
12023 | throw new Error("Method " + method + " undefined");
|
12024 | }
|
12025 |
|
12026 | object[method] = function () {
|
12027 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
12028 | args[_key] = arguments[_key];
|
12029 | }
|
12030 |
|
12031 |
|
12032 | me.queue({
|
12033 | args: args,
|
12034 | fn: original,
|
12035 | context: this
|
12036 | });
|
12037 | };
|
12038 | }
|
12039 | |
12040 |
|
12041 |
|
12042 |
|
12043 |
|
12044 |
|
12045 | }, {
|
12046 | key: "queue",
|
12047 | value: function queue(entry) {
|
12048 | if (typeof entry === "function") {
|
12049 | this._queue.push({
|
12050 | fn: entry
|
12051 | });
|
12052 | } else {
|
12053 | this._queue.push(entry);
|
12054 | }
|
12055 |
|
12056 | this._flushIfNeeded();
|
12057 | }
|
12058 | |
12059 |
|
12060 |
|
12061 |
|
12062 | }, {
|
12063 | key: "_flushIfNeeded",
|
12064 | value: function _flushIfNeeded() {
|
12065 | var _this = this;
|
12066 |
|
12067 |
|
12068 | if (this._queue.length > this.max) {
|
12069 | this.flush();
|
12070 | }
|
12071 |
|
12072 |
|
12073 | if (this._timeout != null) {
|
12074 | clearTimeout(this._timeout);
|
12075 | this._timeout = null;
|
12076 | }
|
12077 |
|
12078 | if (this.queue.length > 0 && typeof this.delay === "number") {
|
12079 | this._timeout = setTimeout$1(function () {
|
12080 | _this.flush();
|
12081 | }, this.delay);
|
12082 | }
|
12083 | }
|
12084 | |
12085 |
|
12086 |
|
12087 |
|
12088 | }, {
|
12089 | key: "flush",
|
12090 | value: function flush() {
|
12091 | var _context5, _context6;
|
12092 |
|
12093 | forEach$1(_context5 = splice(_context6 = this._queue).call(_context6, 0)).call(_context5, function (entry) {
|
12094 | entry.fn.apply(entry.context || entry.fn, entry.args || []);
|
12095 | });
|
12096 | }
|
12097 | }], [{
|
12098 | key: "extend",
|
12099 | value: function extend(object, options) {
|
12100 | var queue = new Queue(options);
|
12101 |
|
12102 | if (object.flush !== undefined) {
|
12103 | throw new Error("Target object already has a property flush");
|
12104 | }
|
12105 |
|
12106 | object.flush = function () {
|
12107 | queue.flush();
|
12108 | };
|
12109 |
|
12110 | var methods = [{
|
12111 | name: "flush",
|
12112 | original: undefined
|
12113 | }];
|
12114 |
|
12115 | if (options && options.replace) {
|
12116 | for (var i = 0; i < options.replace.length; i++) {
|
12117 | var name = options.replace[i];
|
12118 | methods.push({
|
12119 | name: name,
|
12120 |
|
12121 | original: object[name]
|
12122 | });
|
12123 |
|
12124 | queue.replace(object, name);
|
12125 | }
|
12126 | }
|
12127 |
|
12128 | queue._extended = {
|
12129 | object: object,
|
12130 | methods: methods
|
12131 | };
|
12132 | return queue;
|
12133 | }
|
12134 | }]);
|
12135 |
|
12136 | return Queue;
|
12137 | }();
|
12138 |
|
12139 |
|
12140 |
|
12141 |
|
12142 |
|
12143 |
|
12144 |
|
12145 |
|
12146 | var DataSetPart = function () {
|
12147 | function DataSetPart() {
|
12148 | _classCallCheck(this, DataSetPart);
|
12149 |
|
12150 | this._subscribers = {
|
12151 | "*": [],
|
12152 | add: [],
|
12153 | remove: [],
|
12154 | update: []
|
12155 | };
|
12156 | |
12157 |
|
12158 |
|
12159 |
|
12160 | this.subscribe = DataSetPart.prototype.on;
|
12161 | |
12162 |
|
12163 |
|
12164 |
|
12165 | this.unsubscribe = DataSetPart.prototype.off;
|
12166 | }
|
12167 | |
12168 |
|
12169 |
|
12170 |
|
12171 |
|
12172 |
|
12173 |
|
12174 |
|
12175 |
|
12176 | _createClass(DataSetPart, [{
|
12177 | key: "_trigger",
|
12178 | value: function _trigger(event, payload, senderId) {
|
12179 | var _context7, _context8;
|
12180 |
|
12181 | if (event === "*") {
|
12182 | throw new Error("Cannot trigger event *");
|
12183 | }
|
12184 |
|
12185 | forEach$1(_context7 = concat(_context8 = []).call(_context8, _toConsumableArray(this._subscribers[event]), _toConsumableArray(this._subscribers["*"]))).call(_context7, function (subscriber) {
|
12186 | subscriber(event, payload, senderId != null ? senderId : null);
|
12187 | });
|
12188 | }
|
12189 | |
12190 |
|
12191 |
|
12192 |
|
12193 |
|
12194 |
|
12195 |
|
12196 |
|
12197 |
|
12198 | }, {
|
12199 | key: "on",
|
12200 | value: function on(event, callback) {
|
12201 | if (typeof callback === "function") {
|
12202 | this._subscribers[event].push(callback);
|
12203 | }
|
12204 |
|
12205 | }
|
12206 | |
12207 |
|
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 |
|
12213 |
|
12214 |
|
12215 | }, {
|
12216 | key: "off",
|
12217 | value: function off(event, callback) {
|
12218 | var _context9;
|
12219 |
|
12220 | this._subscribers[event] = filter(_context9 = this._subscribers[event]).call(_context9, function (subscriber) {
|
12221 | return subscriber !== callback;
|
12222 | });
|
12223 | }
|
12224 | }]);
|
12225 |
|
12226 | return DataSetPart;
|
12227 | }();
|
12228 |
|
12229 |
|
12230 |
|
12231 |
|
12232 |
|
12233 |
|
12234 |
|
12235 |
|
12236 |
|
12237 |
|
12238 |
|
12239 |
|
12240 | var DataStream = function (_Symbol$iterator) {
|
12241 | |
12242 |
|
12243 |
|
12244 |
|
12245 |
|
12246 | function DataStream(pairs) {
|
12247 | _classCallCheck(this, DataStream);
|
12248 |
|
12249 | this._pairs = pairs;
|
12250 | }
|
12251 | |
12252 |
|
12253 |
|
12254 |
|
12255 |
|
12256 | _createClass(DataStream, [{
|
12257 | key: _Symbol$iterator,
|
12258 | value:
|
12259 |
|
12260 | regenerator.mark(function value() {
|
12261 | var _iterator, _step, _step$value, id, item;
|
12262 |
|
12263 | return regenerator.wrap(function value$(_context10) {
|
12264 | while (1) {
|
12265 | switch (_context10.prev = _context10.next) {
|
12266 | case 0:
|
12267 | _iterator = _createForOfIteratorHelper(this._pairs);
|
12268 | _context10.prev = 1;
|
12269 |
|
12270 | _iterator.s();
|
12271 |
|
12272 | case 3:
|
12273 | if ((_step = _iterator.n()).done) {
|
12274 | _context10.next = 9;
|
12275 | break;
|
12276 | }
|
12277 |
|
12278 | _step$value = _slicedToArray(_step.value, 2), id = _step$value[0], item = _step$value[1];
|
12279 | _context10.next = 7;
|
12280 | return [id, item];
|
12281 |
|
12282 | case 7:
|
12283 | _context10.next = 3;
|
12284 | break;
|
12285 |
|
12286 | case 9:
|
12287 | _context10.next = 14;
|
12288 | break;
|
12289 |
|
12290 | case 11:
|
12291 | _context10.prev = 11;
|
12292 | _context10.t0 = _context10["catch"](1);
|
12293 |
|
12294 | _iterator.e(_context10.t0);
|
12295 |
|
12296 | case 14:
|
12297 | _context10.prev = 14;
|
12298 |
|
12299 | _iterator.f();
|
12300 |
|
12301 | return _context10.finish(14);
|
12302 |
|
12303 | case 17:
|
12304 | case "end":
|
12305 | return _context10.stop();
|
12306 | }
|
12307 | }
|
12308 | }, value, this, [[1, 11, 14, 17]]);
|
12309 | })
|
12310 | |
12311 |
|
12312 |
|
12313 |
|
12314 | }, {
|
12315 | key: "entries",
|
12316 | value:
|
12317 |
|
12318 | regenerator.mark(function entries() {
|
12319 | var _iterator2, _step2, _step2$value, id, item;
|
12320 |
|
12321 | return regenerator.wrap(function entries$(_context11) {
|
12322 | while (1) {
|
12323 | switch (_context11.prev = _context11.next) {
|
12324 | case 0:
|
12325 | _iterator2 = _createForOfIteratorHelper(this._pairs);
|
12326 | _context11.prev = 1;
|
12327 |
|
12328 | _iterator2.s();
|
12329 |
|
12330 | case 3:
|
12331 | if ((_step2 = _iterator2.n()).done) {
|
12332 | _context11.next = 9;
|
12333 | break;
|
12334 | }
|
12335 |
|
12336 | _step2$value = _slicedToArray(_step2.value, 2), id = _step2$value[0], item = _step2$value[1];
|
12337 | _context11.next = 7;
|
12338 | return [id, item];
|
12339 |
|
12340 | case 7:
|
12341 | _context11.next = 3;
|
12342 | break;
|
12343 |
|
12344 | case 9:
|
12345 | _context11.next = 14;
|
12346 | break;
|
12347 |
|
12348 | case 11:
|
12349 | _context11.prev = 11;
|
12350 | _context11.t0 = _context11["catch"](1);
|
12351 |
|
12352 | _iterator2.e(_context11.t0);
|
12353 |
|
12354 | case 14:
|
12355 | _context11.prev = 14;
|
12356 |
|
12357 | _iterator2.f();
|
12358 |
|
12359 | return _context11.finish(14);
|
12360 |
|
12361 | case 17:
|
12362 | case "end":
|
12363 | return _context11.stop();
|
12364 | }
|
12365 | }
|
12366 | }, entries, this, [[1, 11, 14, 17]]);
|
12367 | })
|
12368 | |
12369 |
|
12370 |
|
12371 |
|
12372 | }, {
|
12373 | key: "keys",
|
12374 | value:
|
12375 |
|
12376 | regenerator.mark(function keys() {
|
12377 | var _iterator3, _step3, _step3$value, id;
|
12378 |
|
12379 | return regenerator.wrap(function keys$(_context12) {
|
12380 | while (1) {
|
12381 | switch (_context12.prev = _context12.next) {
|
12382 | case 0:
|
12383 | _iterator3 = _createForOfIteratorHelper(this._pairs);
|
12384 | _context12.prev = 1;
|
12385 |
|
12386 | _iterator3.s();
|
12387 |
|
12388 | case 3:
|
12389 | if ((_step3 = _iterator3.n()).done) {
|
12390 | _context12.next = 9;
|
12391 | break;
|
12392 | }
|
12393 |
|
12394 | _step3$value = _slicedToArray(_step3.value, 1), id = _step3$value[0];
|
12395 | _context12.next = 7;
|
12396 | return id;
|
12397 |
|
12398 | case 7:
|
12399 | _context12.next = 3;
|
12400 | break;
|
12401 |
|
12402 | case 9:
|
12403 | _context12.next = 14;
|
12404 | break;
|
12405 |
|
12406 | case 11:
|
12407 | _context12.prev = 11;
|
12408 | _context12.t0 = _context12["catch"](1);
|
12409 |
|
12410 | _iterator3.e(_context12.t0);
|
12411 |
|
12412 | case 14:
|
12413 | _context12.prev = 14;
|
12414 |
|
12415 | _iterator3.f();
|
12416 |
|
12417 | return _context12.finish(14);
|
12418 |
|
12419 | case 17:
|
12420 | case "end":
|
12421 | return _context12.stop();
|
12422 | }
|
12423 | }
|
12424 | }, keys, this, [[1, 11, 14, 17]]);
|
12425 | })
|
12426 | |
12427 |
|
12428 |
|
12429 |
|
12430 | }, {
|
12431 | key: "values",
|
12432 | value:
|
12433 |
|
12434 | regenerator.mark(function values() {
|
12435 | var _iterator4, _step4, _step4$value, item;
|
12436 |
|
12437 | return regenerator.wrap(function values$(_context13) {
|
12438 | while (1) {
|
12439 | switch (_context13.prev = _context13.next) {
|
12440 | case 0:
|
12441 | _iterator4 = _createForOfIteratorHelper(this._pairs);
|
12442 | _context13.prev = 1;
|
12443 |
|
12444 | _iterator4.s();
|
12445 |
|
12446 | case 3:
|
12447 | if ((_step4 = _iterator4.n()).done) {
|
12448 | _context13.next = 9;
|
12449 | break;
|
12450 | }
|
12451 |
|
12452 | _step4$value = _slicedToArray(_step4.value, 2), item = _step4$value[1];
|
12453 | _context13.next = 7;
|
12454 | return item;
|
12455 |
|
12456 | case 7:
|
12457 | _context13.next = 3;
|
12458 | break;
|
12459 |
|
12460 | case 9:
|
12461 | _context13.next = 14;
|
12462 | break;
|
12463 |
|
12464 | case 11:
|
12465 | _context13.prev = 11;
|
12466 | _context13.t0 = _context13["catch"](1);
|
12467 |
|
12468 | _iterator4.e(_context13.t0);
|
12469 |
|
12470 | case 14:
|
12471 | _context13.prev = 14;
|
12472 |
|
12473 | _iterator4.f();
|
12474 |
|
12475 | return _context13.finish(14);
|
12476 |
|
12477 | case 17:
|
12478 | case "end":
|
12479 | return _context13.stop();
|
12480 | }
|
12481 | }
|
12482 | }, values, this, [[1, 11, 14, 17]]);
|
12483 | })
|
12484 | |
12485 |
|
12486 |
|
12487 |
|
12488 |
|
12489 |
|
12490 |
|
12491 |
|
12492 |
|
12493 | }, {
|
12494 | key: "toIdArray",
|
12495 | value: function toIdArray() {
|
12496 | var _context14;
|
12497 |
|
12498 | return map$3(_context14 = _toConsumableArray(this._pairs)).call(_context14, function (pair) {
|
12499 | return pair[0];
|
12500 | });
|
12501 | }
|
12502 | |
12503 |
|
12504 |
|
12505 |
|
12506 |
|
12507 |
|
12508 |
|
12509 |
|
12510 |
|
12511 | }, {
|
12512 | key: "toItemArray",
|
12513 | value: function toItemArray() {
|
12514 | var _context15;
|
12515 |
|
12516 | return map$3(_context15 = _toConsumableArray(this._pairs)).call(_context15, function (pair) {
|
12517 | return pair[1];
|
12518 | });
|
12519 | }
|
12520 | |
12521 |
|
12522 |
|
12523 |
|
12524 |
|
12525 |
|
12526 |
|
12527 |
|
12528 |
|
12529 | }, {
|
12530 | key: "toEntryArray",
|
12531 | value: function toEntryArray() {
|
12532 | return _toConsumableArray(this._pairs);
|
12533 | }
|
12534 | |
12535 |
|
12536 |
|
12537 |
|
12538 |
|
12539 |
|
12540 |
|
12541 |
|
12542 |
|
12543 | }, {
|
12544 | key: "toObjectMap",
|
12545 | value: function toObjectMap() {
|
12546 | var map = create$4(null);
|
12547 |
|
12548 | var _iterator5 = _createForOfIteratorHelper(this._pairs),
|
12549 | _step5;
|
12550 |
|
12551 | try {
|
12552 | for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
12553 | var _step5$value = _slicedToArray(_step5.value, 2),
|
12554 | id = _step5$value[0],
|
12555 | item = _step5$value[1];
|
12556 |
|
12557 | map[id] = item;
|
12558 | }
|
12559 | } catch (err) {
|
12560 | _iterator5.e(err);
|
12561 | } finally {
|
12562 | _iterator5.f();
|
12563 | }
|
12564 |
|
12565 | return map;
|
12566 | }
|
12567 | |
12568 |
|
12569 |
|
12570 |
|
12571 |
|
12572 |
|
12573 | }, {
|
12574 | key: "toMap",
|
12575 | value: function toMap() {
|
12576 | return new map(this._pairs);
|
12577 | }
|
12578 | |
12579 |
|
12580 |
|
12581 |
|
12582 |
|
12583 |
|
12584 | }, {
|
12585 | key: "toIdSet",
|
12586 | value: function toIdSet() {
|
12587 | return new set(this.toIdArray());
|
12588 | }
|
12589 | /**
|
12590 | * Return a set containing all the (unique) items in this stream.
|
12591 | *
|
12592 | * @returns The set of all items from this stream.
|
12593 | */
|
12594 |
|
12595 | }, {
|
12596 | key: "toItemSet",
|
12597 | value: function toItemSet() {
|
12598 | return new set(this.toItemArray());
|
12599 | }
|
12600 | /**
|
12601 | * Cache the items from this stream.
|
12602 | *
|
12603 | * @remarks
|
12604 | * This method allows for items to be fetched immediatelly and used (possibly multiple times) later.
|
12605 | * It can also be used to optimize performance as [[DataStream]] would otherwise reevaluate everything upon each iteration.
|
12606 | *
|
12607 | * ## Example
|
12608 | * ```javascript
|
12609 | * const ds = new DataSet([…])
|
12610 | *
|
12611 | * const cachedStream = ds.stream()
|
12612 | * .filter(…)
|
12613 | * .sort(…)
|
12614 | * .map(…)
|
12615 | * .cached(…) // Data are fetched, processed and cached here.
|
12616 | *
|
12617 | * ds.clear()
|
12618 | * chachedStream // Still has all the items.
|
12619 | * ```
|
12620 | *
|
12621 | * @returns A new [[DataStream]] with cached items (detached from the original [[DataSet]]).
|
12622 | */
|
12623 |
|
12624 | }, {
|
12625 | key: "cache",
|
12626 | value: function cache() {
|
12627 | return new DataStream(_toConsumableArray(this._pairs));
|
12628 | }
|
12629 | |
12630 |
|
12631 |
|
12632 |
|
12633 |
|
12634 |
|
12635 |
|
12636 |
|
12637 |
|
12638 |
|
12639 | }, {
|
12640 | key: "distinct",
|
12641 | value: function distinct(callback) {
|
12642 | var set$1 = new set();
|
12643 |
|
12644 | var _iterator6 = _createForOfIteratorHelper(this._pairs),
|
12645 | _step6;
|
12646 |
|
12647 | try {
|
12648 | for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
12649 | var _step6$value = _slicedToArray(_step6.value, 2),
|
12650 | id = _step6$value[0],
|
12651 | item = _step6$value[1];
|
12652 |
|
12653 | set$1.add(callback(item, id));
|
12654 | }
|
12655 | } catch (err) {
|
12656 | _iterator6.e(err);
|
12657 | } finally {
|
12658 | _iterator6.f();
|
12659 | }
|
12660 |
|
12661 | return set$1;
|
12662 | }
|
12663 | /**
|
12664 | * Filter the items of the stream.
|
12665 | *
|
12666 | * @param callback - The function that decides whether an item will be included.
|
12667 | *
|
12668 | * @returns A new data stream with the filtered items.
|
12669 | */
|
12670 |
|
12671 | }, {
|
12672 | key: "filter",
|
12673 | value: function filter(callback) {
|
12674 | var pairs = this._pairs;
|
12675 | return new DataStream(_defineProperty({}, iterator, regenerator.mark(function _callee() {
|
12676 | var _iterator7, _step7, _step7$value, id, item;
|
12677 |
|
12678 | return regenerator.wrap(function _callee$(_context16) {
|
12679 | while (1) {
|
12680 | switch (_context16.prev = _context16.next) {
|
12681 | case 0:
|
12682 | _iterator7 = _createForOfIteratorHelper(pairs);
|
12683 | _context16.prev = 1;
|
12684 |
|
12685 | _iterator7.s();
|
12686 |
|
12687 | case 3:
|
12688 | if ((_step7 = _iterator7.n()).done) {
|
12689 | _context16.next = 10;
|
12690 | break;
|
12691 | }
|
12692 |
|
12693 | _step7$value = _slicedToArray(_step7.value, 2), id = _step7$value[0], item = _step7$value[1];
|
12694 |
|
12695 | if (!callback(item, id)) {
|
12696 | _context16.next = 8;
|
12697 | break;
|
12698 | }
|
12699 |
|
12700 | _context16.next = 8;
|
12701 | return [id, item];
|
12702 |
|
12703 | case 8:
|
12704 | _context16.next = 3;
|
12705 | break;
|
12706 |
|
12707 | case 10:
|
12708 | _context16.next = 15;
|
12709 | break;
|
12710 |
|
12711 | case 12:
|
12712 | _context16.prev = 12;
|
12713 | _context16.t0 = _context16["catch"](1);
|
12714 |
|
12715 | _iterator7.e(_context16.t0);
|
12716 |
|
12717 | case 15:
|
12718 | _context16.prev = 15;
|
12719 |
|
12720 | _iterator7.f();
|
12721 |
|
12722 | return _context16.finish(15);
|
12723 |
|
12724 | case 18:
|
12725 | case "end":
|
12726 | return _context16.stop();
|
12727 | }
|
12728 | }
|
12729 | }, _callee, null, [[1, 12, 15, 18]]);
|
12730 | })));
|
12731 | }
|
12732 | |
12733 |
|
12734 |
|
12735 |
|
12736 |
|
12737 |
|
12738 | }, {
|
12739 | key: "forEach",
|
12740 | value: function forEach(callback) {
|
12741 | var _iterator8 = _createForOfIteratorHelper(this._pairs),
|
12742 | _step8;
|
12743 |
|
12744 | try {
|
12745 | for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
12746 | var _step8$value = _slicedToArray(_step8.value, 2),
|
12747 | id = _step8$value[0],
|
12748 | item = _step8$value[1];
|
12749 |
|
12750 | callback(item, id);
|
12751 | }
|
12752 | } catch (err) {
|
12753 | _iterator8.e(err);
|
12754 | } finally {
|
12755 | _iterator8.f();
|
12756 | }
|
12757 | }
|
12758 | |
12759 |
|
12760 |
|
12761 |
|
12762 |
|
12763 |
|
12764 |
|
12765 |
|
12766 |
|
12767 |
|
12768 | }, {
|
12769 | key: "map",
|
12770 | value: function map(callback) {
|
12771 | var pairs = this._pairs;
|
12772 | return new DataStream(_defineProperty({}, iterator, regenerator.mark(function _callee2() {
|
12773 | var _iterator9, _step9, _step9$value, id, item;
|
12774 |
|
12775 | return regenerator.wrap(function _callee2$(_context17) {
|
12776 | while (1) {
|
12777 | switch (_context17.prev = _context17.next) {
|
12778 | case 0:
|
12779 | _iterator9 = _createForOfIteratorHelper(pairs);
|
12780 | _context17.prev = 1;
|
12781 |
|
12782 | _iterator9.s();
|
12783 |
|
12784 | case 3:
|
12785 | if ((_step9 = _iterator9.n()).done) {
|
12786 | _context17.next = 9;
|
12787 | break;
|
12788 | }
|
12789 |
|
12790 | _step9$value = _slicedToArray(_step9.value, 2), id = _step9$value[0], item = _step9$value[1];
|
12791 | _context17.next = 7;
|
12792 | return [id, callback(item, id)];
|
12793 |
|
12794 | case 7:
|
12795 | _context17.next = 3;
|
12796 | break;
|
12797 |
|
12798 | case 9:
|
12799 | _context17.next = 14;
|
12800 | break;
|
12801 |
|
12802 | case 11:
|
12803 | _context17.prev = 11;
|
12804 | _context17.t0 = _context17["catch"](1);
|
12805 |
|
12806 | _iterator9.e(_context17.t0);
|
12807 |
|
12808 | case 14:
|
12809 | _context17.prev = 14;
|
12810 |
|
12811 | _iterator9.f();
|
12812 |
|
12813 | return _context17.finish(14);
|
12814 |
|
12815 | case 17:
|
12816 | case "end":
|
12817 | return _context17.stop();
|
12818 | }
|
12819 | }
|
12820 | }, _callee2, null, [[1, 11, 14, 17]]);
|
12821 | })));
|
12822 | }
|
12823 | |
12824 |
|
12825 |
|
12826 |
|
12827 |
|
12828 |
|
12829 |
|
12830 |
|
12831 | }, {
|
12832 | key: "max",
|
12833 | value: function max(callback) {
|
12834 | var iter = getIterator(this._pairs);
|
12835 |
|
12836 | var curr = iter.next();
|
12837 |
|
12838 | if (curr.done) {
|
12839 | return null;
|
12840 | }
|
12841 |
|
12842 | var maxItem = curr.value[1];
|
12843 | var maxValue = callback(curr.value[1], curr.value[0]);
|
12844 |
|
12845 | while (!(curr = iter.next()).done) {
|
12846 | var _curr$value = _slicedToArray(curr.value, 2),
|
12847 | id = _curr$value[0],
|
12848 | item = _curr$value[1];
|
12849 |
|
12850 | var _value = callback(item, id);
|
12851 |
|
12852 | if (_value > maxValue) {
|
12853 | maxValue = _value;
|
12854 | maxItem = item;
|
12855 | }
|
12856 | }
|
12857 |
|
12858 | return maxItem;
|
12859 | }
|
12860 | |
12861 |
|
12862 |
|
12863 |
|
12864 |
|
12865 |
|
12866 |
|
12867 |
|
12868 | }, {
|
12869 | key: "min",
|
12870 | value: function min(callback) {
|
12871 | var iter = getIterator(this._pairs);
|
12872 |
|
12873 | var curr = iter.next();
|
12874 |
|
12875 | if (curr.done) {
|
12876 | return null;
|
12877 | }
|
12878 |
|
12879 | var minItem = curr.value[1];
|
12880 | var minValue = callback(curr.value[1], curr.value[0]);
|
12881 |
|
12882 | while (!(curr = iter.next()).done) {
|
12883 | var _curr$value2 = _slicedToArray(curr.value, 2),
|
12884 | id = _curr$value2[0],
|
12885 | item = _curr$value2[1];
|
12886 |
|
12887 | var _value2 = callback(item, id);
|
12888 |
|
12889 | if (_value2 < minValue) {
|
12890 | minValue = _value2;
|
12891 | minItem = item;
|
12892 | }
|
12893 | }
|
12894 |
|
12895 | return minItem;
|
12896 | }
|
12897 | |
12898 |
|
12899 |
|
12900 |
|
12901 |
|
12902 |
|
12903 |
|
12904 |
|
12905 |
|
12906 |
|
12907 |
|
12908 | }, {
|
12909 | key: "reduce",
|
12910 | value: function reduce(callback, accumulator) {
|
12911 | var _iterator10 = _createForOfIteratorHelper(this._pairs),
|
12912 | _step10;
|
12913 |
|
12914 | try {
|
12915 | for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
12916 | var _step10$value = _slicedToArray(_step10.value, 2),
|
12917 | id = _step10$value[0],
|
12918 | item = _step10$value[1];
|
12919 |
|
12920 | accumulator = callback(accumulator, item, id);
|
12921 | }
|
12922 | } catch (err) {
|
12923 | _iterator10.e(err);
|
12924 | } finally {
|
12925 | _iterator10.f();
|
12926 | }
|
12927 |
|
12928 | return accumulator;
|
12929 | }
|
12930 | |
12931 |
|
12932 |
|
12933 |
|
12934 |
|
12935 |
|
12936 |
|
12937 |
|
12938 | }, {
|
12939 | key: "sort",
|
12940 | value: function sort$1(callback) {
|
12941 | var _this2 = this;
|
12942 |
|
12943 | return new DataStream(_defineProperty({}, iterator, function () {
|
12944 | var _context18;
|
12945 |
|
12946 | return getIterator(sort(_context18 = _toConsumableArray(_this2._pairs)).call(_context18, function (_ref, _ref2) {
|
12947 | var _ref3 = _slicedToArray(_ref, 2),
|
12948 | idA = _ref3[0],
|
12949 | itemA = _ref3[1];
|
12950 |
|
12951 | var _ref4 = _slicedToArray(_ref2, 2),
|
12952 | idB = _ref4[0],
|
12953 | itemB = _ref4[1];
|
12954 |
|
12955 | return callback(itemA, itemB, idA, idB);
|
12956 | }));
|
12957 | }));
|
12958 | }
|
12959 | }]);
|
12960 |
|
12961 | return DataStream;
|
12962 | }(iterator);
|
12963 |
|
12964 |
|
12965 |
|
12966 |
|
12967 |
|
12968 |
|
12969 |
|
12970 |
|
12971 |
|
12972 |
|
12973 |
|
12974 |
|
12975 |
|
12976 |
|
12977 |
|
12978 |
|
12979 | function ensureFullItem(item, idProp) {
|
12980 | if (item[idProp] == null) {
|
12981 |
|
12982 | item[idProp] = v4();
|
12983 | }
|
12984 |
|
12985 | return item;
|
12986 | }
|
12987 |
|
12988 |
|
12989 |
|
12990 |
|
12991 |
|
12992 |
|
12993 |
|
12994 |
|
12995 |
|
12996 |
|
12997 |
|
12998 |
|
12999 |
|
13000 |
|
13001 |
|
13002 |
|
13003 |
|
13004 |
|
13005 |
|
13006 |
|
13007 |
|
13008 |
|
13009 |
|
13010 |
|
13011 |
|
13012 |
|
13013 |
|
13014 |
|
13015 |
|
13016 |
|
13017 |
|
13018 |
|
13019 |
|
13020 |
|
13021 |
|
13022 |
|
13023 |
|
13024 |
|
13025 |
|
13026 |
|
13027 |
|
13028 |
|
13029 |
|
13030 |
|
13031 |
|
13032 |
|
13033 |
|
13034 |
|
13035 |
|
13036 |
|
13037 |
|
13038 |
|
13039 |
|
13040 |
|
13041 |
|
13042 |
|
13043 |
|
13044 |
|
13045 |
|
13046 |
|
13047 |
|
13048 | var DataSet = function (_DataSetPart) {
|
13049 | _inherits(DataSet, _DataSetPart);
|
13050 |
|
13051 | var _super = _createSuper(DataSet);
|
13052 |
|
13053 | |
13054 |
|
13055 |
|
13056 |
|
13057 |
|
13058 |
|
13059 | function DataSet(data, options) {
|
13060 | var _this3;
|
13061 |
|
13062 | _classCallCheck(this, DataSet);
|
13063 |
|
13064 | _this3 = _super.call(this);
|
13065 | _this3._queue = null;
|
13066 |
|
13067 | if (data && !isArray$5(data)) {
|
13068 | options = data;
|
13069 | data = [];
|
13070 | }
|
13071 |
|
13072 | _this3._options = options || {};
|
13073 | _this3._data = new map();
|
13074 |
|
13075 | _this3.length = 0;
|
13076 |
|
13077 | _this3._idProp = _this3._options.fieldId || "id";
|
13078 |
|
13079 |
|
13080 | if (data && data.length) {
|
13081 | _this3.add(data);
|
13082 | }
|
13083 |
|
13084 | _this3.setOptions(options);
|
13085 |
|
13086 | return _this3;
|
13087 | }
|
13088 |
|
13089 |
|
13090 |
|
13091 | _createClass(DataSet, [{
|
13092 | key: "idProp",
|
13093 | get: function get() {
|
13094 | return this._idProp;
|
13095 | }
|
13096 | |
13097 |
|
13098 |
|
13099 |
|
13100 |
|
13101 |
|
13102 | }, {
|
13103 | key: "setOptions",
|
13104 | value: function setOptions(options) {
|
13105 | if (options && options.queue !== undefined) {
|
13106 | if (options.queue === false) {
|
13107 |
|
13108 | if (this._queue) {
|
13109 | this._queue.destroy();
|
13110 |
|
13111 | this._queue = null;
|
13112 | }
|
13113 | } else {
|
13114 |
|
13115 | if (!this._queue) {
|
13116 | this._queue = Queue.extend(this, {
|
13117 | replace: ["add", "update", "remove"]
|
13118 | });
|
13119 | }
|
13120 |
|
13121 | if (options.queue && _typeof(options.queue) === "object") {
|
13122 | this._queue.setOptions(options.queue);
|
13123 | }
|
13124 | }
|
13125 | }
|
13126 | }
|
13127 | |
13128 |
|
13129 |
|
13130 |
|
13131 |
|
13132 |
|
13133 |
|
13134 |
|
13135 |
|
13136 |
|
13137 |
|
13138 |
|
13139 |
|
13140 |
|
13141 |
|
13142 |
|
13143 |
|
13144 |
|
13145 |
|
13146 |
|
13147 |
|
13148 |
|
13149 |
|
13150 |
|
13151 |
|
13152 |
|
13153 |
|
13154 |
|
13155 |
|
13156 | }, {
|
13157 | key: "add",
|
13158 | value: function add(data, senderId) {
|
13159 | var _this4 = this;
|
13160 |
|
13161 | var addedIds = [];
|
13162 | var id;
|
13163 |
|
13164 | if (isArray$5(data)) {
|
13165 |
|
13166 | var idsToAdd = map$3(data).call(data, function (d) {
|
13167 | return d[_this4._idProp];
|
13168 | });
|
13169 |
|
13170 | if (some(idsToAdd).call(idsToAdd, function (id) {
|
13171 | return _this4._data.has(id);
|
13172 | })) {
|
13173 | throw new Error("A duplicate id was found in the parameter array.");
|
13174 | }
|
13175 |
|
13176 | for (var i = 0, len = data.length; i < len; i++) {
|
13177 | id = this._addItem(data[i]);
|
13178 | addedIds.push(id);
|
13179 | }
|
13180 | } else if (data && _typeof(data) === "object") {
|
13181 |
|
13182 | id = this._addItem(data);
|
13183 | addedIds.push(id);
|
13184 | } else {
|
13185 | throw new Error("Unknown dataType");
|
13186 | }
|
13187 |
|
13188 | if (addedIds.length) {
|
13189 | this._trigger("add", {
|
13190 | items: addedIds
|
13191 | }, senderId);
|
13192 | }
|
13193 |
|
13194 | return addedIds;
|
13195 | }
|
13196 | |
13197 |
|
13198 |
|
13199 |
|
13200 |
|
13201 |
|
13202 |
|
13203 |
|
13204 |
|
13205 |
|
13206 |
|
13207 |
|
13208 |
|
13209 |
|
13210 |
|
13211 |
|
13212 |
|
13213 |
|
13214 |
|
13215 |
|
13216 |
|
13217 |
|
13218 |
|
13219 |
|
13220 |
|
13221 |
|
13222 |
|
13223 |
|
13224 |
|
13225 |
|
13226 |
|
13227 |
|
13228 |
|
13229 |
|
13230 |
|
13231 |
|
13232 |
|
13233 |
|
13234 | }, {
|
13235 | key: "update",
|
13236 | value: function update(data, senderId) {
|
13237 | var _this5 = this;
|
13238 |
|
13239 | var addedIds = [];
|
13240 | var updatedIds = [];
|
13241 | var oldData = [];
|
13242 | var updatedData = [];
|
13243 | var idProp = this._idProp;
|
13244 |
|
13245 | var addOrUpdate = function addOrUpdate(item) {
|
13246 | var origId = item[idProp];
|
13247 |
|
13248 | if (origId != null && _this5._data.has(origId)) {
|
13249 | var fullItem = item;
|
13250 |
|
13251 | var oldItem = assign$2({}, _this5._data.get(origId));
|
13252 |
|
13253 |
|
13254 | var id = _this5._updateItem(fullItem);
|
13255 |
|
13256 | updatedIds.push(id);
|
13257 | updatedData.push(fullItem);
|
13258 | oldData.push(oldItem);
|
13259 | } else {
|
13260 |
|
13261 | var _id = _this5._addItem(item);
|
13262 |
|
13263 | addedIds.push(_id);
|
13264 | }
|
13265 | };
|
13266 |
|
13267 | if (isArray$5(data)) {
|
13268 |
|
13269 | for (var i = 0, len = data.length; i < len; i++) {
|
13270 | if (data[i] && _typeof(data[i]) === "object") {
|
13271 | addOrUpdate(data[i]);
|
13272 | } else {
|
13273 | console.warn("Ignoring input item, which is not an object at index " + i);
|
13274 | }
|
13275 | }
|
13276 | } else if (data && _typeof(data) === "object") {
|
13277 |
|
13278 | addOrUpdate(data);
|
13279 | } else {
|
13280 | throw new Error("Unknown dataType");
|
13281 | }
|
13282 |
|
13283 | if (addedIds.length) {
|
13284 | this._trigger("add", {
|
13285 | items: addedIds
|
13286 | }, senderId);
|
13287 | }
|
13288 |
|
13289 | if (updatedIds.length) {
|
13290 | var props = {
|
13291 | items: updatedIds,
|
13292 | oldData: oldData,
|
13293 | data: updatedData
|
13294 | };
|
13295 |
|
13296 |
|
13297 |
|
13298 |
|
13299 |
|
13300 |
|
13301 |
|
13302 | this._trigger("update", props, senderId);
|
13303 | }
|
13304 |
|
13305 | return concat(addedIds).call(addedIds, updatedIds);
|
13306 | }
|
13307 | |
13308 |
|
13309 |
|
13310 |
|
13311 |
|
13312 |
|
13313 |
|
13314 |
|
13315 |
|
13316 |
|
13317 |
|
13318 |
|
13319 |
|
13320 |
|
13321 |
|
13322 |
|
13323 |
|
13324 |
|
13325 |
|
13326 |
|
13327 |
|
13328 |
|
13329 |
|
13330 |
|
13331 |
|
13332 |
|
13333 |
|
13334 |
|
13335 |
|
13336 |
|
13337 |
|
13338 |
|
13339 |
|
13340 |
|
13341 |
|
13342 |
|
13343 |
|
13344 |
|
13345 | }, {
|
13346 | key: "updateOnly",
|
13347 | value: function updateOnly(data, senderId) {
|
13348 | var _context19,
|
13349 | _this6 = this;
|
13350 |
|
13351 | if (!isArray$5(data)) {
|
13352 | data = [data];
|
13353 | }
|
13354 |
|
13355 | var updateEventData = map$3(_context19 = map$3(data).call(data, function (update) {
|
13356 | var oldData = _this6._data.get(update[_this6._idProp]);
|
13357 |
|
13358 | if (oldData == null) {
|
13359 | throw new Error("Updating non-existent items is not allowed.");
|
13360 | }
|
13361 |
|
13362 | return {
|
13363 | oldData: oldData,
|
13364 | update: update
|
13365 | };
|
13366 | })).call(_context19, function (_ref5) {
|
13367 | var oldData = _ref5.oldData,
|
13368 | update = _ref5.update;
|
13369 | var id = oldData[_this6._idProp];
|
13370 | var updatedData = pureDeepObjectAssign(oldData, update);
|
13371 |
|
13372 | _this6._data.set(id, updatedData);
|
13373 |
|
13374 | return {
|
13375 | id: id,
|
13376 | oldData: oldData,
|
13377 | updatedData: updatedData
|
13378 | };
|
13379 | });
|
13380 |
|
13381 | if (updateEventData.length) {
|
13382 | var props = {
|
13383 | items: map$3(updateEventData).call(updateEventData, function (value) {
|
13384 | return value.id;
|
13385 | }),
|
13386 | oldData: map$3(updateEventData).call(updateEventData, function (value) {
|
13387 | return value.oldData;
|
13388 | }),
|
13389 | data: map$3(updateEventData).call(updateEventData, function (value) {
|
13390 | return value.updatedData;
|
13391 | })
|
13392 | };
|
13393 |
|
13394 |
|
13395 |
|
13396 |
|
13397 |
|
13398 |
|
13399 |
|
13400 | this._trigger("update", props, senderId);
|
13401 |
|
13402 | return props.items;
|
13403 | } else {
|
13404 | return [];
|
13405 | }
|
13406 | }
|
13407 |
|
13408 |
|
13409 | }, {
|
13410 | key: "get",
|
13411 | value: function get(first, second) {
|
13412 |
|
13413 |
|
13414 | var id = undefined;
|
13415 | var ids = undefined;
|
13416 | var options = undefined;
|
13417 |
|
13418 | if (isId(first)) {
|
13419 |
|
13420 | id = first;
|
13421 | options = second;
|
13422 | } else if (isArray$5(first)) {
|
13423 |
|
13424 | ids = first;
|
13425 | options = second;
|
13426 | } else {
|
13427 |
|
13428 | options = first;
|
13429 | }
|
13430 |
|
13431 |
|
13432 | var returnType = options && options.returnType === "Object" ? "Object" : "Array";
|
13433 |
|
13434 |
|
13435 |
|
13436 |
|
13437 |
|
13438 |
|
13439 |
|
13440 |
|
13441 |
|
13442 |
|
13443 |
|
13444 |
|
13445 | var filter$1 = options && filter(options);
|
13446 |
|
13447 | var items = [];
|
13448 | var item = undefined;
|
13449 | var itemIds = undefined;
|
13450 | var itemId = undefined;
|
13451 |
|
13452 | if (id != null) {
|
13453 |
|
13454 | item = this._data.get(id);
|
13455 |
|
13456 | if (item && filter$1 && !filter$1(item)) {
|
13457 | item = undefined;
|
13458 | }
|
13459 | } else if (ids != null) {
|
13460 |
|
13461 | for (var i = 0, len = ids.length; i < len; i++) {
|
13462 | item = this._data.get(ids[i]);
|
13463 |
|
13464 | if (item != null && (!filter$1 || filter$1(item))) {
|
13465 | items.push(item);
|
13466 | }
|
13467 | }
|
13468 | } else {
|
13469 | var _context20;
|
13470 |
|
13471 |
|
13472 | itemIds = _toConsumableArray(keys(_context20 = this._data).call(_context20));
|
13473 |
|
13474 | for (var _i = 0, _len2 = itemIds.length; _i < _len2; _i++) {
|
13475 | itemId = itemIds[_i];
|
13476 | item = this._data.get(itemId);
|
13477 |
|
13478 | if (item != null && (!filter$1 || filter$1(item))) {
|
13479 | items.push(item);
|
13480 | }
|
13481 | }
|
13482 | }
|
13483 |
|
13484 |
|
13485 | if (options && options.order && id == undefined) {
|
13486 | this._sort(items, options.order);
|
13487 | }
|
13488 |
|
13489 |
|
13490 | if (options && options.fields) {
|
13491 | var fields = options.fields;
|
13492 |
|
13493 | if (id != undefined && item != null) {
|
13494 | item = this._filterFields(item, fields);
|
13495 | } else {
|
13496 | for (var _i2 = 0, _len3 = items.length; _i2 < _len3; _i2++) {
|
13497 | items[_i2] = this._filterFields(items[_i2], fields);
|
13498 | }
|
13499 | }
|
13500 | }
|
13501 |
|
13502 |
|
13503 | if (returnType == "Object") {
|
13504 | var result = {};
|
13505 |
|
13506 | for (var _i3 = 0, _len4 = items.length; _i3 < _len4; _i3++) {
|
13507 | var resultant = items[_i3];
|
13508 |
|
13509 |
|
13510 | var _id2 = resultant[this._idProp];
|
13511 | result[_id2] = resultant;
|
13512 | }
|
13513 |
|
13514 | return result;
|
13515 | } else {
|
13516 | if (id != null) {
|
13517 | var _item;
|
13518 |
|
13519 |
|
13520 | return (_item = item) !== null && _item !== void 0 ? _item : null;
|
13521 | } else {
|
13522 |
|
13523 | return items;
|
13524 | }
|
13525 | }
|
13526 | }
|
13527 |
|
13528 |
|
13529 | }, {
|
13530 | key: "getIds",
|
13531 | value: function getIds(options) {
|
13532 | var data = this._data;
|
13533 |
|
13534 | var filter$1 = options && filter(options);
|
13535 |
|
13536 | var order = options && options.order;
|
13537 |
|
13538 | var itemIds = _toConsumableArray(keys(data).call(data));
|
13539 |
|
13540 | var ids = [];
|
13541 |
|
13542 | if (filter$1) {
|
13543 |
|
13544 | if (order) {
|
13545 |
|
13546 | var items = [];
|
13547 |
|
13548 | for (var i = 0, len = itemIds.length; i < len; i++) {
|
13549 | var id = itemIds[i];
|
13550 |
|
13551 | var item = this._data.get(id);
|
13552 |
|
13553 | if (item != null && filter$1(item)) {
|
13554 | items.push(item);
|
13555 | }
|
13556 | }
|
13557 |
|
13558 | this._sort(items, order);
|
13559 |
|
13560 | for (var _i4 = 0, _len5 = items.length; _i4 < _len5; _i4++) {
|
13561 | ids.push(items[_i4][this._idProp]);
|
13562 | }
|
13563 | } else {
|
13564 |
|
13565 | for (var _i5 = 0, _len6 = itemIds.length; _i5 < _len6; _i5++) {
|
13566 | var _id3 = itemIds[_i5];
|
13567 |
|
13568 | var _item2 = this._data.get(_id3);
|
13569 |
|
13570 | if (_item2 != null && filter$1(_item2)) {
|
13571 | ids.push(_item2[this._idProp]);
|
13572 | }
|
13573 | }
|
13574 | }
|
13575 | } else {
|
13576 |
|
13577 | if (order) {
|
13578 |
|
13579 | var _items = [];
|
13580 |
|
13581 | for (var _i6 = 0, _len7 = itemIds.length; _i6 < _len7; _i6++) {
|
13582 | var _id4 = itemIds[_i6];
|
13583 |
|
13584 | _items.push(data.get(_id4));
|
13585 | }
|
13586 |
|
13587 | this._sort(_items, order);
|
13588 |
|
13589 | for (var _i7 = 0, _len8 = _items.length; _i7 < _len8; _i7++) {
|
13590 | ids.push(_items[_i7][this._idProp]);
|
13591 | }
|
13592 | } else {
|
13593 |
|
13594 | for (var _i8 = 0, _len9 = itemIds.length; _i8 < _len9; _i8++) {
|
13595 | var _id5 = itemIds[_i8];
|
13596 |
|
13597 | var _item3 = data.get(_id5);
|
13598 |
|
13599 | if (_item3 != null) {
|
13600 | ids.push(_item3[this._idProp]);
|
13601 | }
|
13602 | }
|
13603 | }
|
13604 | }
|
13605 |
|
13606 | return ids;
|
13607 | }
|
13608 |
|
13609 |
|
13610 | }, {
|
13611 | key: "getDataSet",
|
13612 | value: function getDataSet() {
|
13613 | return this;
|
13614 | }
|
13615 |
|
13616 |
|
13617 | }, {
|
13618 | key: "forEach",
|
13619 | value: function forEach(callback, options) {
|
13620 | var filter$1 = options && filter(options);
|
13621 |
|
13622 | var data = this._data;
|
13623 |
|
13624 | var itemIds = _toConsumableArray(keys(data).call(data));
|
13625 |
|
13626 | if (options && options.order) {
|
13627 |
|
13628 | var items = this.get(options);
|
13629 |
|
13630 | for (var i = 0, len = items.length; i < len; i++) {
|
13631 | var item = items[i];
|
13632 | var id = item[this._idProp];
|
13633 | callback(item, id);
|
13634 | }
|
13635 | } else {
|
13636 |
|
13637 | for (var _i9 = 0, _len10 = itemIds.length; _i9 < _len10; _i9++) {
|
13638 | var _id6 = itemIds[_i9];
|
13639 |
|
13640 | var _item4 = this._data.get(_id6);
|
13641 |
|
13642 | if (_item4 != null && (!filter$1 || filter$1(_item4))) {
|
13643 | callback(_item4, _id6);
|
13644 | }
|
13645 | }
|
13646 | }
|
13647 | }
|
13648 |
|
13649 |
|
13650 | }, {
|
13651 | key: "map",
|
13652 | value: function map(callback, options) {
|
13653 | var filter$1 = options && filter(options);
|
13654 |
|
13655 | var mappedItems = [];
|
13656 | var data = this._data;
|
13657 |
|
13658 | var itemIds = _toConsumableArray(keys(data).call(data));
|
13659 |
|
13660 |
|
13661 | for (var i = 0, len = itemIds.length; i < len; i++) {
|
13662 | var id = itemIds[i];
|
13663 |
|
13664 | var item = this._data.get(id);
|
13665 |
|
13666 | if (item != null && (!filter$1 || filter$1(item))) {
|
13667 | mappedItems.push(callback(item, id));
|
13668 | }
|
13669 | }
|
13670 |
|
13671 |
|
13672 | if (options && options.order) {
|
13673 | this._sort(mappedItems, options.order);
|
13674 | }
|
13675 |
|
13676 | return mappedItems;
|
13677 | }
|
13678 | |
13679 |
|
13680 |
|
13681 |
|
13682 |
|
13683 |
|
13684 |
|
13685 |
|
13686 |
|
13687 |
|
13688 |
|
13689 | }, {
|
13690 | key: "_filterFields",
|
13691 | value: function _filterFields(item, fields) {
|
13692 | var _context21;
|
13693 |
|
13694 | if (!item) {
|
13695 |
|
13696 | return item;
|
13697 | }
|
13698 |
|
13699 | return reduce(_context21 = isArray$5(fields) ?
|
13700 | fields :
|
13701 | keys$4(fields)).call(_context21, function (filteredItem, field) {
|
13702 | filteredItem[field] = item[field];
|
13703 | return filteredItem;
|
13704 | }, {});
|
13705 | }
|
13706 | |
13707 |
|
13708 |
|
13709 |
|
13710 |
|
13711 |
|
13712 |
|
13713 |
|
13714 |
|
13715 | }, {
|
13716 | key: "_sort",
|
13717 | value: function _sort(items, order) {
|
13718 | if (typeof order === "string") {
|
13719 |
|
13720 | var name = order;
|
13721 |
|
13722 | sort(items).call(items, function (a, b) {
|
13723 |
|
13724 | var av = a[name];
|
13725 | var bv = b[name];
|
13726 | return av > bv ? 1 : av < bv ? -1 : 0;
|
13727 | });
|
13728 | } else if (typeof order === "function") {
|
13729 |
|
13730 | sort(items).call(items, order);
|
13731 | } else {
|
13732 |
|
13733 |
|
13734 | throw new TypeError("Order must be a function or a string");
|
13735 | }
|
13736 | }
|
13737 | |
13738 |
|
13739 |
|
13740 |
|
13741 |
|
13742 |
|
13743 |
|
13744 |
|
13745 |
|
13746 |
|
13747 |
|
13748 |
|
13749 |
|
13750 |
|
13751 |
|
13752 |
|
13753 |
|
13754 |
|
13755 |
|
13756 |
|
13757 |
|
13758 |
|
13759 |
|
13760 |
|
13761 |
|
13762 |
|
13763 |
|
13764 |
|
13765 | }, {
|
13766 | key: "remove",
|
13767 | value: function remove(id, senderId) {
|
13768 | var removedIds = [];
|
13769 | var removedItems = [];
|
13770 |
|
13771 | var ids = isArray$5(id) ? id : [id];
|
13772 |
|
13773 | for (var i = 0, len = ids.length; i < len; i++) {
|
13774 | var item = this._remove(ids[i]);
|
13775 |
|
13776 | if (item) {
|
13777 | var itemId = item[this._idProp];
|
13778 |
|
13779 | if (itemId != null) {
|
13780 | removedIds.push(itemId);
|
13781 | removedItems.push(item);
|
13782 | }
|
13783 | }
|
13784 | }
|
13785 |
|
13786 | if (removedIds.length) {
|
13787 | this._trigger("remove", {
|
13788 | items: removedIds,
|
13789 | oldData: removedItems
|
13790 | }, senderId);
|
13791 | }
|
13792 |
|
13793 | return removedIds;
|
13794 | }
|
13795 | |
13796 |
|
13797 |
|
13798 |
|
13799 |
|
13800 |
|
13801 |
|
13802 |
|
13803 | }, {
|
13804 | key: "_remove",
|
13805 | value: function _remove(id) {
|
13806 |
|
13807 |
|
13808 | var ident;
|
13809 |
|
13810 | if (isId(id)) {
|
13811 | ident = id;
|
13812 | } else if (id && _typeof(id) === "object") {
|
13813 | ident = id[this._idProp];
|
13814 | }
|
13815 |
|
13816 |
|
13817 | if (ident != null && this._data.has(ident)) {
|
13818 | var item = this._data.get(ident) || null;
|
13819 |
|
13820 | this._data.delete(ident);
|
13821 |
|
13822 | --this.length;
|
13823 | return item;
|
13824 | }
|
13825 |
|
13826 | return null;
|
13827 | }
|
13828 | |
13829 |
|
13830 |
|
13831 |
|
13832 |
|
13833 |
|
13834 |
|
13835 |
|
13836 |
|
13837 |
|
13838 | }, {
|
13839 | key: "clear",
|
13840 | value: function clear(senderId) {
|
13841 | var _context22;
|
13842 |
|
13843 | var ids = _toConsumableArray(keys(_context22 = this._data).call(_context22));
|
13844 |
|
13845 | var items = [];
|
13846 |
|
13847 | for (var i = 0, len = ids.length; i < len; i++) {
|
13848 | items.push(this._data.get(ids[i]));
|
13849 | }
|
13850 |
|
13851 | this._data.clear();
|
13852 |
|
13853 | this.length = 0;
|
13854 |
|
13855 | this._trigger("remove", {
|
13856 | items: ids,
|
13857 | oldData: items
|
13858 | }, senderId);
|
13859 |
|
13860 | return ids;
|
13861 | }
|
13862 | |
13863 |
|
13864 |
|
13865 |
|
13866 |
|
13867 |
|
13868 |
|
13869 |
|
13870 | }, {
|
13871 | key: "max",
|
13872 | value: function max(field) {
|
13873 | var _context23;
|
13874 |
|
13875 | var max = null;
|
13876 | var maxField = null;
|
13877 |
|
13878 | var _iterator11 = _createForOfIteratorHelper(values(_context23 = this._data).call(_context23)),
|
13879 | _step11;
|
13880 |
|
13881 | try {
|
13882 | for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
13883 | var item = _step11.value;
|
13884 | var itemField = item[field];
|
13885 |
|
13886 | if (typeof itemField === "number" && (maxField == null || itemField > maxField)) {
|
13887 | max = item;
|
13888 | maxField = itemField;
|
13889 | }
|
13890 | }
|
13891 | } catch (err) {
|
13892 | _iterator11.e(err);
|
13893 | } finally {
|
13894 | _iterator11.f();
|
13895 | }
|
13896 |
|
13897 | return max || null;
|
13898 | }
|
13899 | |
13900 |
|
13901 |
|
13902 |
|
13903 |
|
13904 |
|
13905 |
|
13906 |
|
13907 | }, {
|
13908 | key: "min",
|
13909 | value: function min(field) {
|
13910 | var _context24;
|
13911 |
|
13912 | var min = null;
|
13913 | var minField = null;
|
13914 |
|
13915 | var _iterator12 = _createForOfIteratorHelper(values(_context24 = this._data).call(_context24)),
|
13916 | _step12;
|
13917 |
|
13918 | try {
|
13919 | for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
13920 | var item = _step12.value;
|
13921 | var itemField = item[field];
|
13922 |
|
13923 | if (typeof itemField === "number" && (minField == null || itemField < minField)) {
|
13924 | min = item;
|
13925 | minField = itemField;
|
13926 | }
|
13927 | }
|
13928 | } catch (err) {
|
13929 | _iterator12.e(err);
|
13930 | } finally {
|
13931 | _iterator12.f();
|
13932 | }
|
13933 |
|
13934 | return min || null;
|
13935 | }
|
13936 | |
13937 |
|
13938 |
|
13939 |
|
13940 |
|
13941 |
|
13942 |
|
13943 |
|
13944 | }, {
|
13945 | key: "distinct",
|
13946 | value: function distinct(prop) {
|
13947 | var data = this._data;
|
13948 |
|
13949 | var itemIds = _toConsumableArray(keys(data).call(data));
|
13950 |
|
13951 | var values = [];
|
13952 | var count = 0;
|
13953 |
|
13954 | for (var i = 0, len = itemIds.length; i < len; i++) {
|
13955 | var id = itemIds[i];
|
13956 | var item = data.get(id);
|
13957 | var _value3 = item[prop];
|
13958 | var exists = false;
|
13959 |
|
13960 | for (var j = 0; j < count; j++) {
|
13961 | if (values[j] == _value3) {
|
13962 | exists = true;
|
13963 | break;
|
13964 | }
|
13965 | }
|
13966 |
|
13967 | if (!exists && _value3 !== undefined) {
|
13968 | values[count] = _value3;
|
13969 | count++;
|
13970 | }
|
13971 | }
|
13972 |
|
13973 | return values;
|
13974 | }
|
13975 | |
13976 |
|
13977 |
|
13978 |
|
13979 |
|
13980 |
|
13981 |
|
13982 |
|
13983 | }, {
|
13984 | key: "_addItem",
|
13985 | value: function _addItem(item) {
|
13986 | var fullItem = ensureFullItem(item, this._idProp);
|
13987 | var id = fullItem[this._idProp];
|
13988 |
|
13989 | if (this._data.has(id)) {
|
13990 |
|
13991 | throw new Error("Cannot add item: item with id " + id + " already exists");
|
13992 | }
|
13993 |
|
13994 | this._data.set(id, fullItem);
|
13995 |
|
13996 | ++this.length;
|
13997 | return id;
|
13998 | }
|
13999 | |
14000 |
|
14001 |
|
14002 |
|
14003 |
|
14004 |
|
14005 |
|
14006 |
|
14007 |
|
14008 | }, {
|
14009 | key: "_updateItem",
|
14010 | value: function _updateItem(update) {
|
14011 | var id = update[this._idProp];
|
14012 |
|
14013 | if (id == null) {
|
14014 | throw new Error("Cannot update item: item has no id (item: " + stringify$1(update) + ")");
|
14015 | }
|
14016 |
|
14017 | var item = this._data.get(id);
|
14018 |
|
14019 | if (!item) {
|
14020 |
|
14021 | throw new Error("Cannot update item: no item with id " + id + " found");
|
14022 | }
|
14023 |
|
14024 | this._data.set(id, _objectSpread(_objectSpread({}, item), update));
|
14025 |
|
14026 | return id;
|
14027 | }
|
14028 |
|
14029 |
|
14030 | }, {
|
14031 | key: "stream",
|
14032 | value: function stream(ids) {
|
14033 | if (ids) {
|
14034 | var data = this._data;
|
14035 | return new DataStream(_defineProperty({}, iterator, regenerator.mark(function _callee3() {
|
14036 | var _iterator13, _step13, id, item;
|
14037 |
|
14038 | return regenerator.wrap(function _callee3$(_context25) {
|
14039 | while (1) {
|
14040 | switch (_context25.prev = _context25.next) {
|
14041 | case 0:
|
14042 | _iterator13 = _createForOfIteratorHelper(ids);
|
14043 | _context25.prev = 1;
|
14044 |
|
14045 | _iterator13.s();
|
14046 |
|
14047 | case 3:
|
14048 | if ((_step13 = _iterator13.n()).done) {
|
14049 | _context25.next = 11;
|
14050 | break;
|
14051 | }
|
14052 |
|
14053 | id = _step13.value;
|
14054 | item = data.get(id);
|
14055 |
|
14056 | if (!(item != null)) {
|
14057 | _context25.next = 9;
|
14058 | break;
|
14059 | }
|
14060 |
|
14061 | _context25.next = 9;
|
14062 | return [id, item];
|
14063 |
|
14064 | case 9:
|
14065 | _context25.next = 3;
|
14066 | break;
|
14067 |
|
14068 | case 11:
|
14069 | _context25.next = 16;
|
14070 | break;
|
14071 |
|
14072 | case 13:
|
14073 | _context25.prev = 13;
|
14074 | _context25.t0 = _context25["catch"](1);
|
14075 |
|
14076 | _iterator13.e(_context25.t0);
|
14077 |
|
14078 | case 16:
|
14079 | _context25.prev = 16;
|
14080 |
|
14081 | _iterator13.f();
|
14082 |
|
14083 | return _context25.finish(16);
|
14084 |
|
14085 | case 19:
|
14086 | case "end":
|
14087 | return _context25.stop();
|
14088 | }
|
14089 | }
|
14090 | }, _callee3, null, [[1, 13, 16, 19]]);
|
14091 | })));
|
14092 | } else {
|
14093 | var _context26;
|
14094 |
|
14095 | return new DataStream(_defineProperty({}, iterator, bind$4(_context26 = entries(this._data)).call(_context26, this._data)));
|
14096 | }
|
14097 | }
|
14098 | }]);
|
14099 |
|
14100 | return DataSet;
|
14101 | }(DataSetPart);
|
14102 |
|
14103 |
|
14104 |
|
14105 |
|
14106 |
|
14107 |
|
14108 |
|
14109 |
|
14110 |
|
14111 |
|
14112 |
|
14113 |
|
14114 |
|
14115 |
|
14116 |
|
14117 |
|
14118 |
|
14119 |
|
14120 |
|
14121 |
|
14122 |
|
14123 |
|
14124 |
|
14125 |
|
14126 |
|
14127 |
|
14128 |
|
14129 |
|
14130 |
|
14131 |
|
14132 |
|
14133 |
|
14134 |
|
14135 |
|
14136 |
|
14137 |
|
14138 |
|
14139 |
|
14140 |
|
14141 |
|
14142 |
|
14143 |
|
14144 |
|
14145 |
|
14146 |
|
14147 |
|
14148 |
|
14149 | var DataView = function (_DataSetPart2) {
|
14150 | _inherits(DataView, _DataSetPart2);
|
14151 |
|
14152 | var _super2 = _createSuper(DataView);
|
14153 |
|
14154 | |
14155 |
|
14156 |
|
14157 |
|
14158 |
|
14159 |
|
14160 | function DataView(data, options) {
|
14161 | var _context27;
|
14162 |
|
14163 | var _this7;
|
14164 |
|
14165 | _classCallCheck(this, DataView);
|
14166 |
|
14167 | _this7 = _super2.call(this);
|
14168 |
|
14169 |
|
14170 | _this7.length = 0;
|
14171 | _this7._ids = new set(); // ids of the items currently in memory (just contains a boolean true)
|
14172 |
|
14173 | _this7._options = options || {};
|
14174 | _this7._listener = bind$4(_context27 = _this7._onEvent).call(_context27, _assertThisInitialized(_this7));
|
14175 |
|
14176 | _this7.setData(data);
|
14177 |
|
14178 | return _this7;
|
14179 | }
|
14180 |
|
14181 |
|
14182 |
|
14183 | _createClass(DataView, [{
|
14184 | key: "idProp",
|
14185 | get: function get() {
|
14186 | return this.getDataSet().idProp;
|
14187 | }
|
14188 |
|
14189 |
|
14190 | |
14191 |
|
14192 |
|
14193 |
|
14194 |
|
14195 |
|
14196 |
|
14197 |
|
14198 |
|
14199 |
|
14200 |
|
14201 |
|
14202 | }, {
|
14203 | key: "setData",
|
14204 | value: function setData(data) {
|
14205 | if (this._data) {
|
14206 |
|
14207 | if (this._data.off) {
|
14208 | this._data.off("*", this._listener);
|
14209 | }
|
14210 |
|
14211 |
|
14212 | var ids = this._data.getIds({
|
14213 | filter: filter(this._options)
|
14214 | });
|
14215 |
|
14216 | var items = this._data.get(ids);
|
14217 |
|
14218 | this._ids.clear();
|
14219 |
|
14220 | this.length = 0;
|
14221 |
|
14222 | this._trigger("remove", {
|
14223 | items: ids,
|
14224 | oldData: items
|
14225 | });
|
14226 | }
|
14227 |
|
14228 | if (data != null) {
|
14229 | this._data = data;
|
14230 |
|
14231 | var _ids = this._data.getIds({
|
14232 | filter: filter(this._options)
|
14233 | });
|
14234 |
|
14235 | for (var i = 0, len = _ids.length; i < len; i++) {
|
14236 | var id = _ids[i];
|
14237 |
|
14238 | this._ids.add(id);
|
14239 | }
|
14240 |
|
14241 | this.length = _ids.length;
|
14242 |
|
14243 | this._trigger("add", {
|
14244 | items: _ids
|
14245 | });
|
14246 | } else {
|
14247 | this._data = new DataSet();
|
14248 | }
|
14249 |
|
14250 |
|
14251 | if (this._data.on) {
|
14252 | this._data.on("*", this._listener);
|
14253 | }
|
14254 | }
|
14255 | |
14256 |
|
14257 |
|
14258 |
|
14259 |
|
14260 | }, {
|
14261 | key: "refresh",
|
14262 | value: function refresh() {
|
14263 | var ids = this._data.getIds({
|
14264 | filter: filter(this._options)
|
14265 | });
|
14266 |
|
14267 | var oldIds = _toConsumableArray(this._ids);
|
14268 |
|
14269 | var newIds = {};
|
14270 | var addedIds = [];
|
14271 | var removedIds = [];
|
14272 | var removedItems = [];
|
14273 |
|
14274 | for (var i = 0, len = ids.length; i < len; i++) {
|
14275 | var id = ids[i];
|
14276 | newIds[id] = true;
|
14277 |
|
14278 | if (!this._ids.has(id)) {
|
14279 | addedIds.push(id);
|
14280 |
|
14281 | this._ids.add(id);
|
14282 | }
|
14283 | }
|
14284 |
|
14285 |
|
14286 | for (var _i10 = 0, _len11 = oldIds.length; _i10 < _len11; _i10++) {
|
14287 | var _id7 = oldIds[_i10];
|
14288 |
|
14289 | var item = this._data.get(_id7);
|
14290 |
|
14291 | if (item == null) {
|
14292 |
|
14293 |
|
14294 |
|
14295 |
|
14296 | console.error("If you see this, report it please.");
|
14297 | } else if (!newIds[_id7]) {
|
14298 | removedIds.push(_id7);
|
14299 | removedItems.push(item);
|
14300 |
|
14301 | this._ids.delete(_id7);
|
14302 | }
|
14303 | }
|
14304 |
|
14305 | this.length += addedIds.length - removedIds.length;
|
14306 |
|
14307 | if (addedIds.length) {
|
14308 | this._trigger("add", {
|
14309 | items: addedIds
|
14310 | });
|
14311 | }
|
14312 |
|
14313 | if (removedIds.length) {
|
14314 | this._trigger("remove", {
|
14315 | items: removedIds,
|
14316 | oldData: removedItems
|
14317 | });
|
14318 | }
|
14319 | }
|
14320 |
|
14321 |
|
14322 | }, {
|
14323 | key: "get",
|
14324 | value: function get(first, second) {
|
14325 | if (this._data == null) {
|
14326 | return null;
|
14327 | }
|
14328 |
|
14329 |
|
14330 | var ids = null;
|
14331 | var options;
|
14332 |
|
14333 | if (isId(first) || isArray$5(first)) {
|
14334 | ids = first;
|
14335 | options = second;
|
14336 | } else {
|
14337 | options = first;
|
14338 | }
|
14339 |
|
14340 |
|
14341 | var viewOptions = assign$2({}, this._options, options);
|
14342 |
|
14343 |
|
14344 | var thisFilter = filter(this._options);
|
14345 |
|
14346 | var optionsFilter = options && filter(options);
|
14347 |
|
14348 | if (thisFilter && optionsFilter) {
|
14349 | viewOptions.filter = function (item) {
|
14350 | return thisFilter(item) && optionsFilter(item);
|
14351 | };
|
14352 | }
|
14353 |
|
14354 | if (ids == null) {
|
14355 | return this._data.get(viewOptions);
|
14356 | } else {
|
14357 | return this._data.get(ids, viewOptions);
|
14358 | }
|
14359 | }
|
14360 |
|
14361 |
|
14362 | }, {
|
14363 | key: "getIds",
|
14364 | value: function getIds(options) {
|
14365 | if (this._data.length) {
|
14366 | var defaultFilter = filter(this._options);
|
14367 |
|
14368 | var optionsFilter = options != null ? filter(options) : null;
|
14369 | var filter$1;
|
14370 |
|
14371 | if (optionsFilter) {
|
14372 | if (defaultFilter) {
|
14373 | filter$1 = function filter(item) {
|
14374 | return defaultFilter(item) && optionsFilter(item);
|
14375 | };
|
14376 | } else {
|
14377 | filter$1 = optionsFilter;
|
14378 | }
|
14379 | } else {
|
14380 | filter$1 = defaultFilter;
|
14381 | }
|
14382 |
|
14383 | return this._data.getIds({
|
14384 | filter: filter$1,
|
14385 | order: options && options.order
|
14386 | });
|
14387 | } else {
|
14388 | return [];
|
14389 | }
|
14390 | }
|
14391 |
|
14392 |
|
14393 | }, {
|
14394 | key: "forEach",
|
14395 | value: function forEach(callback, options) {
|
14396 | if (this._data) {
|
14397 | var _context28;
|
14398 |
|
14399 | var defaultFilter = filter(this._options);
|
14400 |
|
14401 | var optionsFilter = options && filter(options);
|
14402 |
|
14403 | var filter$1;
|
14404 |
|
14405 | if (optionsFilter) {
|
14406 | if (defaultFilter) {
|
14407 | filter$1 = function filter(item) {
|
14408 | return defaultFilter(item) && optionsFilter(item);
|
14409 | };
|
14410 | } else {
|
14411 | filter$1 = optionsFilter;
|
14412 | }
|
14413 | } else {
|
14414 | filter$1 = defaultFilter;
|
14415 | }
|
14416 |
|
14417 | forEach$1(_context28 = this._data).call(_context28, callback, {
|
14418 | filter: filter$1,
|
14419 | order: options && options.order
|
14420 | });
|
14421 | }
|
14422 | }
|
14423 |
|
14424 |
|
14425 | }, {
|
14426 | key: "map",
|
14427 | value: function map(callback, options) {
|
14428 | if (this._data) {
|
14429 | var _context29;
|
14430 |
|
14431 | var defaultFilter = filter(this._options);
|
14432 |
|
14433 | var optionsFilter = options && filter(options);
|
14434 |
|
14435 | var filter$1;
|
14436 |
|
14437 | if (optionsFilter) {
|
14438 | if (defaultFilter) {
|
14439 | filter$1 = function filter(item) {
|
14440 | return defaultFilter(item) && optionsFilter(item);
|
14441 | };
|
14442 | } else {
|
14443 | filter$1 = optionsFilter;
|
14444 | }
|
14445 | } else {
|
14446 | filter$1 = defaultFilter;
|
14447 | }
|
14448 |
|
14449 | return map$3(_context29 = this._data).call(_context29, callback, {
|
14450 | filter: filter$1,
|
14451 | order: options && options.order
|
14452 | });
|
14453 | } else {
|
14454 | return [];
|
14455 | }
|
14456 | }
|
14457 |
|
14458 |
|
14459 | }, {
|
14460 | key: "getDataSet",
|
14461 | value: function getDataSet() {
|
14462 | return this._data.getDataSet();
|
14463 | }
|
14464 |
|
14465 |
|
14466 | }, {
|
14467 | key: "stream",
|
14468 | value: function stream(ids) {
|
14469 | var _context30;
|
14470 |
|
14471 | return this._data.stream(ids || _defineProperty({}, iterator, bind$4(_context30 = keys(this._ids)).call(_context30, this._ids)));
|
14472 | }
|
14473 | |
14474 |
|
14475 |
|
14476 |
|
14477 |
|
14478 |
|
14479 |
|
14480 |
|
14481 |
|
14482 | }, {
|
14483 | key: "dispose",
|
14484 | value: function dispose() {
|
14485 | var _this$_data;
|
14486 |
|
14487 | if ((_this$_data = this._data) !== null && _this$_data !== void 0 && _this$_data.off) {
|
14488 | this._data.off("*", this._listener);
|
14489 | }
|
14490 |
|
14491 | var message = "This data view has already been disposed of.";
|
14492 | var replacement = {
|
14493 | get: function get() {
|
14494 | throw new Error(message);
|
14495 | },
|
14496 | set: function set() {
|
14497 | throw new Error(message);
|
14498 | },
|
14499 | configurable: false
|
14500 | };
|
14501 |
|
14502 | var _iterator14 = _createForOfIteratorHelper(ownKeys$1(DataView.prototype)),
|
14503 | _step14;
|
14504 |
|
14505 | try {
|
14506 | for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
14507 | var key = _step14.value;
|
14508 |
|
14509 | defineProperty$5(this, key, replacement);
|
14510 | }
|
14511 | } catch (err) {
|
14512 | _iterator14.e(err);
|
14513 | } finally {
|
14514 | _iterator14.f();
|
14515 | }
|
14516 | }
|
14517 | |
14518 |
|
14519 |
|
14520 |
|
14521 |
|
14522 |
|
14523 |
|
14524 |
|
14525 | }, {
|
14526 | key: "_onEvent",
|
14527 | value: function _onEvent(event, params, senderId) {
|
14528 | if (!params || !params.items || !this._data) {
|
14529 | return;
|
14530 | }
|
14531 |
|
14532 | var ids = params.items;
|
14533 | var addedIds = [];
|
14534 | var updatedIds = [];
|
14535 | var removedIds = [];
|
14536 | var oldItems = [];
|
14537 | var updatedItems = [];
|
14538 | var removedItems = [];
|
14539 |
|
14540 | switch (event) {
|
14541 | case "add":
|
14542 |
|
14543 | for (var i = 0, len = ids.length; i < len; i++) {
|
14544 | var id = ids[i];
|
14545 | var item = this.get(id);
|
14546 |
|
14547 | if (item) {
|
14548 | this._ids.add(id);
|
14549 |
|
14550 | addedIds.push(id);
|
14551 | }
|
14552 | }
|
14553 |
|
14554 | break;
|
14555 |
|
14556 | case "update":
|
14557 |
|
14558 |
|
14559 | for (var _i11 = 0, _len12 = ids.length; _i11 < _len12; _i11++) {
|
14560 | var _id8 = ids[_i11];
|
14561 |
|
14562 | var _item5 = this.get(_id8);
|
14563 |
|
14564 | if (_item5) {
|
14565 | if (this._ids.has(_id8)) {
|
14566 | updatedIds.push(_id8);
|
14567 | updatedItems.push(params.data[_i11]);
|
14568 | oldItems.push(params.oldData[_i11]);
|
14569 | } else {
|
14570 | this._ids.add(_id8);
|
14571 |
|
14572 | addedIds.push(_id8);
|
14573 | }
|
14574 | } else {
|
14575 | if (this._ids.has(_id8)) {
|
14576 | this._ids.delete(_id8);
|
14577 |
|
14578 | removedIds.push(_id8);
|
14579 | removedItems.push(params.oldData[_i11]);
|
14580 | }
|
14581 | }
|
14582 | }
|
14583 |
|
14584 | break;
|
14585 |
|
14586 | case "remove":
|
14587 |
|
14588 | for (var _i12 = 0, _len13 = ids.length; _i12 < _len13; _i12++) {
|
14589 | var _id9 = ids[_i12];
|
14590 |
|
14591 | if (this._ids.has(_id9)) {
|
14592 | this._ids.delete(_id9);
|
14593 |
|
14594 | removedIds.push(_id9);
|
14595 | removedItems.push(params.oldData[_i12]);
|
14596 | }
|
14597 | }
|
14598 |
|
14599 | break;
|
14600 | }
|
14601 |
|
14602 | this.length += addedIds.length - removedIds.length;
|
14603 |
|
14604 | if (addedIds.length) {
|
14605 | this._trigger("add", {
|
14606 | items: addedIds
|
14607 | }, senderId);
|
14608 | }
|
14609 |
|
14610 | if (updatedIds.length) {
|
14611 | this._trigger("update", {
|
14612 | items: updatedIds,
|
14613 | oldData: oldItems,
|
14614 | data: updatedItems
|
14615 | }, senderId);
|
14616 | }
|
14617 |
|
14618 | if (removedIds.length) {
|
14619 | this._trigger("remove", {
|
14620 | items: removedIds,
|
14621 | oldData: removedItems
|
14622 | }, senderId);
|
14623 | }
|
14624 | }
|
14625 | }]);
|
14626 |
|
14627 | return DataView;
|
14628 | }(DataSetPart);
|
14629 |
|
14630 |
|
14631 |
|
14632 |
|
14633 |
|
14634 |
|
14635 |
|
14636 |
|
14637 |
|
14638 |
|
14639 | function isDataSetLike(idProp, v) {
|
14640 | return _typeof(v) === "object" && v !== null && idProp === v.idProp && typeof v.add === "function" && typeof v.clear === "function" && typeof v.distinct === "function" && typeof forEach$1(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof map$3(v) === "function" && typeof v.max === "function" && typeof v.min === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.remove === "function" && typeof v.setOptions === "function" && typeof v.stream === "function" && typeof v.update === "function" && typeof v.updateOnly === "function";
|
14641 | }
|
14642 |
|
14643 |
|
14644 |
|
14645 |
|
14646 |
|
14647 |
|
14648 |
|
14649 |
|
14650 |
|
14651 |
|
14652 | function isDataViewLike(idProp, v) {
|
14653 | return _typeof(v) === "object" && v !== null && idProp === v.idProp && typeof forEach$1(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof map$3(v) === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.stream === "function" && isDataSetLike(idProp, v.getDataSet());
|
14654 | }
|
14655 |
|
14656 |
|
14657 |
|
14658 |
|
14659 |
|
14660 |
|
14661 |
|
14662 |
|
14663 |
|
14664 |
|
14665 |
|
14666 | function Range() {
|
14667 | this.min = undefined;
|
14668 | this.max = undefined;
|
14669 | }
|
14670 |
|
14671 |
|
14672 |
|
14673 |
|
14674 |
|
14675 |
|
14676 |
|
14677 |
|
14678 |
|
14679 |
|
14680 | Range.prototype.adjust = function (value) {
|
14681 | if (value === undefined) return;
|
14682 |
|
14683 | if (this.min === undefined || this.min > value) {
|
14684 | this.min = value;
|
14685 | }
|
14686 |
|
14687 | if (this.max === undefined || this.max < value) {
|
14688 | this.max = value;
|
14689 | }
|
14690 | };
|
14691 |
|
14692 |
|
14693 |
|
14694 |
|
14695 |
|
14696 |
|
14697 |
|
14698 | Range.prototype.combine = function (range) {
|
14699 | this.add(range.min);
|
14700 | this.add(range.max);
|
14701 | };
|
14702 |
|
14703 |
|
14704 |
|
14705 |
|
14706 |
|
14707 |
|
14708 |
|
14709 |
|
14710 |
|
14711 |
|
14712 |
|
14713 |
|
14714 | Range.prototype.expand = function (val) {
|
14715 | if (val === undefined) {
|
14716 | return;
|
14717 | }
|
14718 |
|
14719 | var newMin = this.min - val;
|
14720 | var newMax = this.max + val;
|
14721 |
|
14722 |
|
14723 | if (newMin > newMax) {
|
14724 | throw new Error('Passed expansion value makes range invalid');
|
14725 | }
|
14726 |
|
14727 | this.min = newMin;
|
14728 | this.max = newMax;
|
14729 | };
|
14730 |
|
14731 |
|
14732 |
|
14733 |
|
14734 |
|
14735 |
|
14736 |
|
14737 | Range.prototype.range = function () {
|
14738 | return this.max - this.min;
|
14739 | };
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 | Range.prototype.center = function () {
|
14748 | return (this.min + this.max) / 2;
|
14749 | };
|
14750 |
|
14751 | var Range_1 = Range;
|
14752 |
|
14753 |
|
14754 |
|
14755 |
|
14756 |
|
14757 |
|
14758 |
|
14759 |
|
14760 |
|
14761 | function Filter(dataGroup, column, graph) {
|
14762 | this.dataGroup = dataGroup;
|
14763 | this.column = column;
|
14764 | this.graph = graph;
|
14765 |
|
14766 | this.index = undefined;
|
14767 | this.value = undefined;
|
14768 |
|
14769 | this.values = dataGroup.getDistinctValues(this.column);
|
14770 |
|
14771 | if (values(this).length > 0) {
|
14772 | this.selectValue(0);
|
14773 | }
|
14774 |
|
14775 |
|
14776 | this.dataPoints = [];
|
14777 | this.loaded = false;
|
14778 | this.onLoadCallback = undefined;
|
14779 |
|
14780 | if (graph.animationPreload) {
|
14781 | this.loaded = false;
|
14782 | this.loadInBackground();
|
14783 | } else {
|
14784 | this.loaded = true;
|
14785 | }
|
14786 | }
|
14787 |
|
14788 |
|
14789 |
|
14790 |
|
14791 |
|
14792 |
|
14793 | Filter.prototype.isLoaded = function () {
|
14794 | return this.loaded;
|
14795 | };
|
14796 |
|
14797 |
|
14798 |
|
14799 |
|
14800 |
|
14801 |
|
14802 | Filter.prototype.getLoadedProgress = function () {
|
14803 | var len = values(this).length;
|
14804 |
|
14805 | var i = 0;
|
14806 |
|
14807 | while (this.dataPoints[i]) {
|
14808 | i++;
|
14809 | }
|
14810 |
|
14811 | return Math.round(i / len * 100);
|
14812 | };
|
14813 |
|
14814 |
|
14815 |
|
14816 |
|
14817 |
|
14818 |
|
14819 | Filter.prototype.getLabel = function () {
|
14820 | return this.graph.filterLabel;
|
14821 | };
|
14822 |
|
14823 |
|
14824 |
|
14825 |
|
14826 |
|
14827 |
|
14828 | Filter.prototype.getColumn = function () {
|
14829 | return this.column;
|
14830 | };
|
14831 |
|
14832 |
|
14833 |
|
14834 |
|
14835 |
|
14836 |
|
14837 | Filter.prototype.getSelectedValue = function () {
|
14838 | if (this.index === undefined) return undefined;
|
14839 | return values(this)[this.index];
|
14840 | };
|
14841 |
|
14842 |
|
14843 |
|
14844 |
|
14845 |
|
14846 |
|
14847 | Filter.prototype.getValues = function () {
|
14848 | return values(this);
|
14849 | };
|
14850 |
|
14851 |
|
14852 |
|
14853 |
|
14854 |
|
14855 |
|
14856 |
|
14857 | Filter.prototype.getValue = function (index) {
|
14858 | if (index >= values(this).length) throw new Error('Index out of range');
|
14859 | return values(this)[index];
|
14860 | };
|
14861 |
|
14862 |
|
14863 |
|
14864 |
|
14865 |
|
14866 |
|
14867 |
|
14868 | Filter.prototype._getDataPoints = function (index) {
|
14869 | if (index === undefined) index = this.index;
|
14870 | if (index === undefined) return [];
|
14871 | var dataPoints;
|
14872 |
|
14873 | if (this.dataPoints[index]) {
|
14874 | dataPoints = this.dataPoints[index];
|
14875 | } else {
|
14876 | var f = {};
|
14877 | f.column = this.column;
|
14878 | f.value = values(this)[index];
|
14879 | var dataView = new DataView(this.dataGroup.getDataSet(), {
|
14880 | filter: function filter(item) {
|
14881 | return item[f.column] == f.value;
|
14882 | }
|
14883 | }).get();
|
14884 | dataPoints = this.dataGroup._getDataPoints(dataView);
|
14885 | this.dataPoints[index] = dataPoints;
|
14886 | }
|
14887 |
|
14888 | return dataPoints;
|
14889 | };
|
14890 |
|
14891 |
|
14892 |
|
14893 |
|
14894 |
|
14895 |
|
14896 |
|
14897 | Filter.prototype.setOnLoadCallback = function (callback) {
|
14898 | this.onLoadCallback = callback;
|
14899 | };
|
14900 |
|
14901 |
|
14902 |
|
14903 |
|
14904 |
|
14905 |
|
14906 |
|
14907 | Filter.prototype.selectValue = function (index) {
|
14908 | if (index >= values(this).length) throw new Error('Index out of range');
|
14909 | this.index = index;
|
14910 | this.value = values(this)[index];
|
14911 | };
|
14912 |
|
14913 |
|
14914 |
|
14915 |
|
14916 |
|
14917 |
|
14918 |
|
14919 |
|
14920 | Filter.prototype.loadInBackground = function (index) {
|
14921 | if (index === undefined) index = 0;
|
14922 | var frame = this.graph.frame;
|
14923 |
|
14924 | if (index < values(this).length) {
|
14925 |
|
14926 | if (frame.progress === undefined) {
|
14927 | frame.progress = document.createElement('DIV');
|
14928 | frame.progress.style.position = 'absolute';
|
14929 | frame.progress.style.color = 'gray';
|
14930 | frame.appendChild(frame.progress);
|
14931 | }
|
14932 |
|
14933 | var progress = this.getLoadedProgress();
|
14934 | frame.progress.innerHTML = 'Loading animation... ' + progress + '%';
|
14935 |
|
14936 | frame.progress.style.bottom = 60 + 'px';
|
14937 |
|
14938 | frame.progress.style.left = 10 + 'px';
|
14939 | var me = this;
|
14940 |
|
14941 | setTimeout$1(function () {
|
14942 | me.loadInBackground(index + 1);
|
14943 | }, 10);
|
14944 |
|
14945 | this.loaded = false;
|
14946 | } else {
|
14947 | this.loaded = true;
|
14948 |
|
14949 | if (frame.progress !== undefined) {
|
14950 | frame.removeChild(frame.progress);
|
14951 | frame.progress = undefined;
|
14952 | }
|
14953 |
|
14954 | if (this.onLoadCallback) this.onLoadCallback();
|
14955 | }
|
14956 | };
|
14957 |
|
14958 |
|
14959 |
|
14960 |
|
14961 |
|
14962 |
|
14963 |
|
14964 |
|
14965 |
|
14966 |
|
14967 |
|
14968 |
|
14969 |
|
14970 |
|
14971 | function DataGroup() {
|
14972 | this.dataTable = null;
|
14973 | }
|
14974 |
|
14975 |
|
14976 |
|
14977 |
|
14978 |
|
14979 |
|
14980 |
|
14981 |
|
14982 |
|
14983 |
|
14984 |
|
14985 |
|
14986 |
|
14987 |
|
14988 |
|
14989 |
|
14990 |
|
14991 | DataGroup.prototype.initializeData = function (graph3d, rawData, style) {
|
14992 | if (rawData === undefined) return;
|
14993 |
|
14994 | if (isArray$5(rawData)) {
|
14995 | rawData = new DataSet(rawData);
|
14996 | }
|
14997 |
|
14998 | var data;
|
14999 |
|
15000 | if (rawData instanceof DataSet || rawData instanceof DataView) {
|
15001 | data = rawData.get();
|
15002 | } else {
|
15003 | throw new Error('Array, DataSet, or DataView expected');
|
15004 | }
|
15005 |
|
15006 | if (data.length == 0) return;
|
15007 | this.style = style;
|
15008 |
|
15009 | if (this.dataSet) {
|
15010 | this.dataSet.off('*', this._onChange);
|
15011 | }
|
15012 |
|
15013 | this.dataSet = rawData;
|
15014 | this.dataTable = data;
|
15015 |
|
15016 | var me = this;
|
15017 |
|
15018 | this._onChange = function () {
|
15019 | graph3d.setData(me.dataSet);
|
15020 | };
|
15021 |
|
15022 | this.dataSet.on('*', this._onChange);
|
15023 |
|
15024 | this.colX = 'x';
|
15025 | this.colY = 'y';
|
15026 | this.colZ = 'z';
|
15027 | var withBars = graph3d.hasBars(style);
|
15028 |
|
15029 | if (withBars) {
|
15030 | if (graph3d.defaultXBarWidth !== undefined) {
|
15031 | this.xBarWidth = graph3d.defaultXBarWidth;
|
15032 | } else {
|
15033 | this.xBarWidth = this.getSmallestDifference(data, this.colX) || 1;
|
15034 | }
|
15035 |
|
15036 | if (graph3d.defaultYBarWidth !== undefined) {
|
15037 | this.yBarWidth = graph3d.defaultYBarWidth;
|
15038 | } else {
|
15039 | this.yBarWidth = this.getSmallestDifference(data, this.colY) || 1;
|
15040 | }
|
15041 | }
|
15042 |
|
15043 |
|
15044 | this._initializeRange(data, this.colX, graph3d, withBars);
|
15045 |
|
15046 | this._initializeRange(data, this.colY, graph3d, withBars);
|
15047 |
|
15048 | this._initializeRange(data, this.colZ, graph3d, false);
|
15049 |
|
15050 | if (data[0].hasOwnProperty('style')) {
|
15051 | this.colValue = 'style';
|
15052 | var valueRange = this.getColumnRange(data, this.colValue);
|
15053 |
|
15054 | this._setRangeDefaults(valueRange, graph3d.defaultValueMin, graph3d.defaultValueMax);
|
15055 |
|
15056 | this.valueRange = valueRange;
|
15057 | } else {
|
15058 | this.colValue = 'z';
|
15059 | this.valueRange = this.zRange;
|
15060 | }
|
15061 |
|
15062 |
|
15063 | var table = this.getDataTable();
|
15064 |
|
15065 | if (table[0].hasOwnProperty('filter')) {
|
15066 | if (this.dataFilter === undefined) {
|
15067 | this.dataFilter = new Filter(this, 'filter', graph3d);
|
15068 | this.dataFilter.setOnLoadCallback(function () {
|
15069 | graph3d.redraw();
|
15070 | });
|
15071 | }
|
15072 | }
|
15073 |
|
15074 | var dataPoints;
|
15075 |
|
15076 | if (this.dataFilter) {
|
15077 |
|
15078 | dataPoints = this.dataFilter._getDataPoints();
|
15079 | } else {
|
15080 |
|
15081 | dataPoints = this._getDataPoints(this.getDataTable());
|
15082 | }
|
15083 |
|
15084 | return dataPoints;
|
15085 | };
|
15086 |
|
15087 |
|
15088 |
|
15089 |
|
15090 |
|
15091 |
|
15092 |
|
15093 |
|
15094 |
|
15095 |
|
15096 |
|
15097 |
|
15098 |
|
15099 |
|
15100 |
|
15101 |
|
15102 |
|
15103 | DataGroup.prototype._collectRangeSettings = function (column, graph3d) {
|
15104 | var _context;
|
15105 |
|
15106 | var index = indexOf(_context = ['x', 'y', 'z']).call(_context, column);
|
15107 |
|
15108 | if (index == -1) {
|
15109 | throw new Error('Column \'' + column + '\' invalid');
|
15110 | }
|
15111 |
|
15112 | var upper = column.toUpperCase();
|
15113 | return {
|
15114 | barWidth: this[column + 'BarWidth'],
|
15115 | min: graph3d['default' + upper + 'Min'],
|
15116 | max: graph3d['default' + upper + 'Max'],
|
15117 | step: graph3d['default' + upper + 'Step'],
|
15118 | range_label: column + 'Range',
|
15119 |
|
15120 | step_label: column + 'Step'
|
15121 |
|
15122 | };
|
15123 | };
|
15124 |
|
15125 |
|
15126 |
|
15127 |
|
15128 |
|
15129 |
|
15130 |
|
15131 |
|
15132 |
|
15133 |
|
15134 |
|
15135 |
|
15136 |
|
15137 |
|
15138 |
|
15139 | DataGroup.prototype._initializeRange = function (data, column, graph3d, withBars) {
|
15140 | var NUMSTEPS = 5;
|
15141 |
|
15142 | var settings = this._collectRangeSettings(column, graph3d);
|
15143 |
|
15144 | var range = this.getColumnRange(data, column);
|
15145 |
|
15146 | if (withBars && column != 'z') {
|
15147 |
|
15148 | range.expand(settings.barWidth / 2);
|
15149 | }
|
15150 |
|
15151 | this._setRangeDefaults(range, settings.min, settings.max);
|
15152 |
|
15153 | this[settings.range_label] = range;
|
15154 | this[settings.step_label] = settings.step !== undefined ? settings.step : range.range() / NUMSTEPS;
|
15155 | };
|
15156 |
|
15157 |
|
15158 |
|
15159 |
|
15160 |
|
15161 |
|
15162 |
|
15163 |
|
15164 |
|
15165 |
|
15166 |
|
15167 |
|
15168 | DataGroup.prototype.getDistinctValues = function (column, data) {
|
15169 | if (data === undefined) {
|
15170 | data = this.dataTable;
|
15171 | }
|
15172 |
|
15173 | var values = [];
|
15174 |
|
15175 | for (var i = 0; i < data.length; i++) {
|
15176 | var value = data[i][column] || 0;
|
15177 |
|
15178 | if (indexOf(values).call(values, value) === -1) {
|
15179 | values.push(value);
|
15180 | }
|
15181 | }
|
15182 |
|
15183 | return sort(values).call(values, function (a, b) {
|
15184 | return a - b;
|
15185 | });
|
15186 | };
|
15187 |
|
15188 |
|
15189 |
|
15190 |
|
15191 |
|
15192 |
|
15193 |
|
15194 |
|
15195 |
|
15196 |
|
15197 |
|
15198 |
|
15199 | DataGroup.prototype.getSmallestDifference = function (data, column) {
|
15200 | var values = this.getDistinctValues(data, column);
|
15201 |
|
15202 |
|
15203 | var smallest_diff = null;
|
15204 |
|
15205 | for (var i = 1; i < values.length; i++) {
|
15206 | var diff = values[i] - values[i - 1];
|
15207 |
|
15208 | if (smallest_diff == null || smallest_diff > diff) {
|
15209 | smallest_diff = diff;
|
15210 | }
|
15211 | }
|
15212 |
|
15213 | return smallest_diff;
|
15214 | };
|
15215 |
|
15216 |
|
15217 |
|
15218 |
|
15219 |
|
15220 |
|
15221 |
|
15222 |
|
15223 |
|
15224 |
|
15225 | DataGroup.prototype.getColumnRange = function (data, column) {
|
15226 | var range = new Range_1();
|
15227 |
|
15228 | for (var i = 0; i < data.length; i++) {
|
15229 | var item = data[i][column];
|
15230 | range.adjust(item);
|
15231 | }
|
15232 |
|
15233 | return range;
|
15234 | };
|
15235 |
|
15236 |
|
15237 |
|
15238 |
|
15239 |
|
15240 |
|
15241 |
|
15242 | DataGroup.prototype.getNumberOfRows = function () {
|
15243 | return this.dataTable.length;
|
15244 | };
|
15245 |
|
15246 |
|
15247 |
|
15248 |
|
15249 |
|
15250 |
|
15251 |
|
15252 |
|
15253 |
|
15254 |
|
15255 |
|
15256 |
|
15257 |
|
15258 |
|
15259 |
|
15260 |
|
15261 | DataGroup.prototype._setRangeDefaults = function (range, defaultMin, defaultMax) {
|
15262 | if (defaultMin !== undefined) {
|
15263 | range.min = defaultMin;
|
15264 | }
|
15265 |
|
15266 | if (defaultMax !== undefined) {
|
15267 | range.max = defaultMax;
|
15268 | }
|
15269 |
|
15270 |
|
15271 |
|
15272 |
|
15273 | if (range.max <= range.min) range.max = range.min + 1;
|
15274 | };
|
15275 |
|
15276 | DataGroup.prototype.getDataTable = function () {
|
15277 | return this.dataTable;
|
15278 | };
|
15279 |
|
15280 | DataGroup.prototype.getDataSet = function () {
|
15281 | return this.dataSet;
|
15282 | };
|
15283 |
|
15284 |
|
15285 |
|
15286 |
|
15287 |
|
15288 |
|
15289 |
|
15290 | DataGroup.prototype.getDataPoints = function (data) {
|
15291 | var dataPoints = [];
|
15292 |
|
15293 | for (var i = 0; i < data.length; i++) {
|
15294 | var point = new Point3d_1();
|
15295 | point.x = data[i][this.colX] || 0;
|
15296 | point.y = data[i][this.colY] || 0;
|
15297 | point.z = data[i][this.colZ] || 0;
|
15298 | point.data = data[i];
|
15299 | point.value = data[i][this.colValue] || 0;
|
15300 | var obj = {};
|
15301 | obj.point = point;
|
15302 | obj.bottom = new Point3d_1(point.x, point.y, this.zRange.min);
|
15303 | obj.trans = undefined;
|
15304 | obj.screen = undefined;
|
15305 | dataPoints.push(obj);
|
15306 | }
|
15307 |
|
15308 | return dataPoints;
|
15309 | };
|
15310 |
|
15311 |
|
15312 |
|
15313 |
|
15314 |
|
15315 |
|
15316 |
|
15317 |
|
15318 |
|
15319 |
|
15320 | DataGroup.prototype.initDataAsMatrix = function (data) {
|
15321 |
|
15322 |
|
15323 | var x, y, i, obj;
|
15324 |
|
15325 | var dataX = this.getDistinctValues(this.colX, data);
|
15326 | var dataY = this.getDistinctValues(this.colY, data);
|
15327 | var dataPoints = this.getDataPoints(data);
|
15328 |
|
15329 | var dataMatrix = [];
|
15330 |
|
15331 | for (i = 0; i < dataPoints.length; i++) {
|
15332 | obj = dataPoints[i];
|
15333 |
|
15334 | var xIndex = indexOf(dataX).call(dataX, obj.point.x);
|
15335 |
|
15336 | var yIndex = indexOf(dataY).call(dataY, obj.point.y);
|
15337 |
|
15338 | if (dataMatrix[xIndex] === undefined) {
|
15339 | dataMatrix[xIndex] = [];
|
15340 | }
|
15341 |
|
15342 | dataMatrix[xIndex][yIndex] = obj;
|
15343 | }
|
15344 |
|
15345 |
|
15346 | for (x = 0; x < dataMatrix.length; x++) {
|
15347 | for (y = 0; y < dataMatrix[x].length; y++) {
|
15348 | if (dataMatrix[x][y]) {
|
15349 | dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined;
|
15350 | dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined;
|
15351 | dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined;
|
15352 | }
|
15353 | }
|
15354 | }
|
15355 |
|
15356 | return dataPoints;
|
15357 | };
|
15358 |
|
15359 |
|
15360 |
|
15361 |
|
15362 |
|
15363 |
|
15364 |
|
15365 | DataGroup.prototype.getInfo = function () {
|
15366 | var dataFilter = this.dataFilter;
|
15367 | if (!dataFilter) return undefined;
|
15368 | return dataFilter.getLabel() + ': ' + dataFilter.getSelectedValue();
|
15369 | };
|
15370 |
|
15371 |
|
15372 |
|
15373 |
|
15374 |
|
15375 | DataGroup.prototype.reload = function () {
|
15376 | if (this.dataTable) {
|
15377 | this.setData(this.dataTable);
|
15378 | }
|
15379 | };
|
15380 |
|
15381 |
|
15382 |
|
15383 |
|
15384 |
|
15385 |
|
15386 |
|
15387 |
|
15388 |
|
15389 | DataGroup.prototype._getDataPoints = function (data) {
|
15390 | var dataPoints = [];
|
15391 |
|
15392 | if (this.style === STYLE.GRID || this.style === STYLE.SURFACE) {
|
15393 | dataPoints = this.initDataAsMatrix(data);
|
15394 | } else {
|
15395 |
|
15396 | dataPoints = this.getDataPoints(data);
|
15397 |
|
15398 | if (this.style === STYLE.LINE) {
|
15399 |
|
15400 | for (var i = 0; i < dataPoints.length; i++) {
|
15401 | if (i > 0) {
|
15402 | dataPoints[i - 1].pointNext = dataPoints[i];
|
15403 | }
|
15404 | }
|
15405 | }
|
15406 | }
|
15407 |
|
15408 | return dataPoints;
|
15409 | };
|
15410 |
|
15411 | Graph3d.STYLE = STYLE;
|
15412 |
|
15413 |
|
15414 |
|
15415 |
|
15416 |
|
15417 |
|
15418 |
|
15419 |
|
15420 | var autoByDefault = undefined;
|
15421 |
|
15422 |
|
15423 |
|
15424 |
|
15425 |
|
15426 |
|
15427 |
|
15428 |
|
15429 |
|
15430 |
|
15431 | Graph3d.DEFAULTS = {
|
15432 | width: '400px',
|
15433 | height: '400px',
|
15434 | filterLabel: 'time',
|
15435 | legendLabel: 'value',
|
15436 | xLabel: 'x',
|
15437 | yLabel: 'y',
|
15438 | zLabel: 'z',
|
15439 | xValueLabel: function xValueLabel(v) {
|
15440 | return v;
|
15441 | },
|
15442 | yValueLabel: function yValueLabel(v) {
|
15443 | return v;
|
15444 | },
|
15445 | zValueLabel: function zValueLabel(v) {
|
15446 | return v;
|
15447 | },
|
15448 | showXAxis: true,
|
15449 | showYAxis: true,
|
15450 | showZAxis: true,
|
15451 | showGrayBottom: false,
|
15452 | showGrid: true,
|
15453 | showPerspective: true,
|
15454 | showShadow: false,
|
15455 | showSurfaceGrid: true,
|
15456 | keepAspectRatio: true,
|
15457 | rotateAxisLabels: true,
|
15458 | verticalRatio: 0.5,
|
15459 |
|
15460 | dotSizeRatio: 0.02,
|
15461 |
|
15462 | dotSizeMinFraction: 0.5,
|
15463 |
|
15464 | dotSizeMaxFraction: 2.5,
|
15465 |
|
15466 | showAnimationControls: autoByDefault,
|
15467 | animationInterval: 1000,
|
15468 |
|
15469 | animationPreload: false,
|
15470 | animationAutoStart: autoByDefault,
|
15471 | axisFontSize: 14,
|
15472 | axisFontType: 'arial',
|
15473 | axisColor: '#4D4D4D',
|
15474 | gridColor: '#D3D3D3',
|
15475 | xCenter: '55%',
|
15476 | yCenter: '50%',
|
15477 | style: Graph3d.STYLE.DOT,
|
15478 | tooltip: false,
|
15479 | tooltipDelay: 300,
|
15480 |
|
15481 | tooltipStyle: {
|
15482 | content: {
|
15483 | padding: '10px',
|
15484 | border: '1px solid #4d4d4d',
|
15485 | color: '#1a1a1a',
|
15486 | background: 'rgba(255,255,255,0.7)',
|
15487 | borderRadius: '2px',
|
15488 | boxShadow: '5px 5px 10px rgba(128,128,128,0.5)'
|
15489 | },
|
15490 | line: {
|
15491 | height: '40px',
|
15492 | width: '0',
|
15493 | borderLeft: '1px solid #4d4d4d',
|
15494 | pointerEvents: 'none'
|
15495 | },
|
15496 | dot: {
|
15497 | height: '0',
|
15498 | width: '0',
|
15499 | border: '5px solid #4d4d4d',
|
15500 | borderRadius: '5px',
|
15501 | pointerEvents: 'none'
|
15502 | }
|
15503 | },
|
15504 | dataColor: {
|
15505 | fill: '#7DC1FF',
|
15506 | stroke: '#3267D2',
|
15507 | strokeWidth: 1
|
15508 |
|
15509 | },
|
15510 | surfaceColors: autoByDefault,
|
15511 | colormap: autoByDefault,
|
15512 | cameraPosition: {
|
15513 | horizontal: 1.0,
|
15514 | vertical: 0.5,
|
15515 | distance: 1.7
|
15516 | },
|
15517 | zoomable: true,
|
15518 | ctrlToZoom: false,
|
15519 |
|
15520 | |
15521 |
|
15522 |
|
15523 | showLegend: autoByDefault,
|
15524 |
|
15525 | backgroundColor: autoByDefault,
|
15526 | xBarWidth: autoByDefault,
|
15527 | yBarWidth: autoByDefault,
|
15528 | valueMin: autoByDefault,
|
15529 | valueMax: autoByDefault,
|
15530 | xMin: autoByDefault,
|
15531 | xMax: autoByDefault,
|
15532 | xStep: autoByDefault,
|
15533 | yMin: autoByDefault,
|
15534 | yMax: autoByDefault,
|
15535 | yStep: autoByDefault,
|
15536 | zMin: autoByDefault,
|
15537 | zMax: autoByDefault,
|
15538 | zStep: autoByDefault
|
15539 | };
|
15540 |
|
15541 |
|
15542 |
|
15543 |
|
15544 |
|
15545 |
|
15546 |
|
15547 |
|
15548 |
|
15549 |
|
15550 |
|
15551 |
|
15552 |
|
15553 |
|
15554 |
|
15555 | function Graph3d(container, data, options) {
|
15556 | if (!(this instanceof Graph3d)) {
|
15557 | throw new SyntaxError('Constructor must be called with the new operator');
|
15558 | }
|
15559 |
|
15560 |
|
15561 | this.containerElement = container;
|
15562 | this.dataGroup = new DataGroup();
|
15563 | this.dataPoints = null;
|
15564 |
|
15565 |
|
15566 | this.create();
|
15567 | setDefaults(Graph3d.DEFAULTS, this);
|
15568 |
|
15569 | this.colX = undefined;
|
15570 | this.colY = undefined;
|
15571 | this.colZ = undefined;
|
15572 | this.colValue = undefined;
|
15573 |
|
15574 |
|
15575 | this.setOptions(options);
|
15576 |
|
15577 | this.setData(data);
|
15578 | }
|
15579 |
|
15580 |
|
15581 | Emitter(Graph3d.prototype);
|
15582 |
|
15583 |
|
15584 |
|
15585 |
|
15586 | Graph3d.prototype._setScale = function () {
|
15587 | this.scale = new Point3d_1(1 / this.xRange.range(), 1 / this.yRange.range(), 1 / this.zRange.range());
|
15588 |
|
15589 | if (this.keepAspectRatio) {
|
15590 | if (this.scale.x < this.scale.y) {
|
15591 |
|
15592 | this.scale.y = this.scale.x;
|
15593 | } else {
|
15594 |
|
15595 | this.scale.x = this.scale.y;
|
15596 | }
|
15597 | }
|
15598 |
|
15599 |
|
15600 | this.scale.z *= this.verticalRatio;
|
15601 |
|
15602 |
|
15603 | if (this.valueRange !== undefined) {
|
15604 | this.scale.value = 1 / this.valueRange.range();
|
15605 | }
|
15606 |
|
15607 |
|
15608 | var xCenter = this.xRange.center() * this.scale.x;
|
15609 | var yCenter = this.yRange.center() * this.scale.y;
|
15610 | var zCenter = this.zRange.center() * this.scale.z;
|
15611 | this.camera.setArmLocation(xCenter, yCenter, zCenter);
|
15612 | };
|
15613 |
|
15614 |
|
15615 |
|
15616 |
|
15617 |
|
15618 |
|
15619 |
|
15620 |
|
15621 |
|
15622 | Graph3d.prototype._convert3Dto2D = function (point3d) {
|
15623 | var translation = this._convertPointToTranslation(point3d);
|
15624 |
|
15625 | return this._convertTranslationToScreen(translation);
|
15626 | };
|
15627 |
|
15628 |
|
15629 |
|
15630 |
|
15631 |
|
15632 |
|
15633 |
|
15634 |
|
15635 |
|
15636 |
|
15637 |
|
15638 | Graph3d.prototype._convertPointToTranslation = function (point3d) {
|
15639 | var cameraLocation = this.camera.getCameraLocation(),
|
15640 | cameraRotation = this.camera.getCameraRotation(),
|
15641 | ax = point3d.x * this.scale.x,
|
15642 | ay = point3d.y * this.scale.y,
|
15643 | az = point3d.z * this.scale.z,
|
15644 | cx = cameraLocation.x,
|
15645 | cy = cameraLocation.y,
|
15646 | cz = cameraLocation.z,
|
15647 |
|
15648 | sinTx = Math.sin(cameraRotation.x),
|
15649 | cosTx = Math.cos(cameraRotation.x),
|
15650 | sinTy = Math.sin(cameraRotation.y),
|
15651 | cosTy = Math.cos(cameraRotation.y),
|
15652 | sinTz = Math.sin(cameraRotation.z),
|
15653 | cosTz = Math.cos(cameraRotation.z),
|
15654 |
|
15655 | dx = cosTy * (sinTz * (ay - cy) + cosTz * (ax - cx)) - sinTy * (az - cz),
|
15656 | dy = sinTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) + cosTx * (cosTz * (ay - cy) - sinTz * (ax - cx)),
|
15657 | dz = cosTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) - sinTx * (cosTz * (ay - cy) - sinTz * (ax - cx));
|
15658 | return new Point3d_1(dx, dy, dz);
|
15659 | };
|
15660 |
|
15661 |
|
15662 |
|
15663 |
|
15664 |
|
15665 |
|
15666 |
|
15667 |
|
15668 |
|
15669 |
|
15670 | Graph3d.prototype._convertTranslationToScreen = function (translation) {
|
15671 | var ex = this.eye.x,
|
15672 | ey = this.eye.y,
|
15673 | ez = this.eye.z,
|
15674 | dx = translation.x,
|
15675 | dy = translation.y,
|
15676 | dz = translation.z;
|
15677 |
|
15678 | var bx;
|
15679 | var by;
|
15680 |
|
15681 | if (this.showPerspective) {
|
15682 | bx = (dx - ex) * (ez / dz);
|
15683 | by = (dy - ey) * (ez / dz);
|
15684 | } else {
|
15685 | bx = dx * -(ez / this.camera.getArmLength());
|
15686 | by = dy * -(ez / this.camera.getArmLength());
|
15687 | }
|
15688 |
|
15689 |
|
15690 |
|
15691 | return new Point2d_1(this.currentXCenter + bx * this.frame.canvas.clientWidth, this.currentYCenter - by * this.frame.canvas.clientWidth);
|
15692 | };
|
15693 |
|
15694 |
|
15695 |
|
15696 |
|
15697 |
|
15698 |
|
15699 |
|
15700 |
|
15701 | Graph3d.prototype._calcTranslations = function (points) {
|
15702 | for (var i = 0; i < points.length; i++) {
|
15703 | var point = points[i];
|
15704 | point.trans = this._convertPointToTranslation(point.point);
|
15705 | point.screen = this._convertTranslationToScreen(point.trans);
|
15706 |
|
15707 | var transBottom = this._convertPointToTranslation(point.bottom);
|
15708 |
|
15709 | point.dist = this.showPerspective ? transBottom.length() : -transBottom.z;
|
15710 | }
|
15711 |
|
15712 |
|
15713 | var sortDepth = function sortDepth(a, b) {
|
15714 | return b.dist - a.dist;
|
15715 | };
|
15716 |
|
15717 | sort(points).call(points, sortDepth);
|
15718 | };
|
15719 |
|
15720 |
|
15721 |
|
15722 |
|
15723 |
|
15724 | Graph3d.prototype._initializeRanges = function () {
|
15725 |
|
15726 | var dg = this.dataGroup;
|
15727 | this.xRange = dg.xRange;
|
15728 | this.yRange = dg.yRange;
|
15729 | this.zRange = dg.zRange;
|
15730 | this.valueRange = dg.valueRange;
|
15731 |
|
15732 |
|
15733 | this.xStep = dg.xStep;
|
15734 | this.yStep = dg.yStep;
|
15735 | this.zStep = dg.zStep;
|
15736 | this.xBarWidth = dg.xBarWidth;
|
15737 | this.yBarWidth = dg.yBarWidth;
|
15738 | this.colX = dg.colX;
|
15739 | this.colY = dg.colY;
|
15740 | this.colZ = dg.colZ;
|
15741 | this.colValue = dg.colValue;
|
15742 |
|
15743 | this._setScale();
|
15744 | };
|
15745 |
|
15746 |
|
15747 |
|
15748 |
|
15749 |
|
15750 |
|
15751 |
|
15752 |
|
15753 | Graph3d.prototype.getDataPoints = function (data) {
|
15754 | var dataPoints = [];
|
15755 |
|
15756 | for (var i = 0; i < data.length; i++) {
|
15757 | var point = new Point3d_1();
|
15758 | point.x = data[i][this.colX] || 0;
|
15759 | point.y = data[i][this.colY] || 0;
|
15760 | point.z = data[i][this.colZ] || 0;
|
15761 | point.data = data[i];
|
15762 | point.value = data[i][this.colValue] || 0;
|
15763 | var obj = {};
|
15764 | obj.point = point;
|
15765 | obj.bottom = new Point3d_1(point.x, point.y, this.zRange.min);
|
15766 | obj.trans = undefined;
|
15767 | obj.screen = undefined;
|
15768 | dataPoints.push(obj);
|
15769 | }
|
15770 |
|
15771 | return dataPoints;
|
15772 | };
|
15773 |
|
15774 |
|
15775 |
|
15776 |
|
15777 |
|
15778 |
|
15779 |
|
15780 |
|
15781 |
|
15782 | Graph3d.prototype._getDataPoints = function (data) {
|
15783 |
|
15784 |
|
15785 | var x, y, i, obj;
|
15786 | var dataPoints = [];
|
15787 |
|
15788 | if (this.style === Graph3d.STYLE.GRID || this.style === Graph3d.STYLE.SURFACE) {
|
15789 |
|
15790 |
|
15791 |
|
15792 | var dataX = this.dataGroup.getDistinctValues(this.colX, data);
|
15793 | var dataY = this.dataGroup.getDistinctValues(this.colY, data);
|
15794 | dataPoints = this.getDataPoints(data);
|
15795 |
|
15796 | var dataMatrix = [];
|
15797 |
|
15798 | for (i = 0; i < dataPoints.length; i++) {
|
15799 | obj = dataPoints[i];
|
15800 |
|
15801 | var xIndex = indexOf(dataX).call(dataX, obj.point.x);
|
15802 |
|
15803 | var yIndex = indexOf(dataY).call(dataY, obj.point.y);
|
15804 |
|
15805 | if (dataMatrix[xIndex] === undefined) {
|
15806 | dataMatrix[xIndex] = [];
|
15807 | }
|
15808 |
|
15809 | dataMatrix[xIndex][yIndex] = obj;
|
15810 | }
|
15811 |
|
15812 |
|
15813 | for (x = 0; x < dataMatrix.length; x++) {
|
15814 | for (y = 0; y < dataMatrix[x].length; y++) {
|
15815 | if (dataMatrix[x][y]) {
|
15816 | dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined;
|
15817 | dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined;
|
15818 | dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined;
|
15819 | }
|
15820 | }
|
15821 | }
|
15822 | } else {
|
15823 |
|
15824 | dataPoints = this.getDataPoints(data);
|
15825 |
|
15826 | if (this.style === Graph3d.STYLE.LINE) {
|
15827 |
|
15828 | for (i = 0; i < dataPoints.length; i++) {
|
15829 | if (i > 0) {
|
15830 | dataPoints[i - 1].pointNext = dataPoints[i];
|
15831 | }
|
15832 | }
|
15833 | }
|
15834 | }
|
15835 |
|
15836 | return dataPoints;
|
15837 | };
|
15838 |
|
15839 |
|
15840 |
|
15841 |
|
15842 |
|
15843 |
|
15844 |
|
15845 |
|
15846 |
|
15847 | Graph3d.prototype.create = function () {
|
15848 |
|
15849 | while (this.containerElement.hasChildNodes()) {
|
15850 | this.containerElement.removeChild(this.containerElement.firstChild);
|
15851 | }
|
15852 |
|
15853 | this.frame = document.createElement('div');
|
15854 | this.frame.style.position = 'relative';
|
15855 | this.frame.style.overflow = 'hidden';
|
15856 |
|
15857 | this.frame.canvas = document.createElement('canvas');
|
15858 | this.frame.canvas.style.position = 'relative';
|
15859 | this.frame.appendChild(this.frame.canvas);
|
15860 |
|
15861 | {
|
15862 | var noCanvas = document.createElement('DIV');
|
15863 | noCanvas.style.color = 'red';
|
15864 | noCanvas.style.fontWeight = 'bold';
|
15865 | noCanvas.style.padding = '10px';
|
15866 | noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
|
15867 | this.frame.canvas.appendChild(noCanvas);
|
15868 | }
|
15869 | this.frame.filter = document.createElement('div');
|
15870 | filter(this.frame).style.position = 'absolute';
|
15871 | filter(this.frame).style.bottom = '0px';
|
15872 | filter(this.frame).style.left = '0px';
|
15873 | filter(this.frame).style.width = '100%';
|
15874 | this.frame.appendChild(filter(this.frame));
|
15875 |
|
15876 | var me = this;
|
15877 |
|
15878 | var onmousedown = function onmousedown(event) {
|
15879 | me._onMouseDown(event);
|
15880 | };
|
15881 |
|
15882 | var ontouchstart = function ontouchstart(event) {
|
15883 | me._onTouchStart(event);
|
15884 | };
|
15885 |
|
15886 | var onmousewheel = function onmousewheel(event) {
|
15887 | me._onWheel(event);
|
15888 | };
|
15889 |
|
15890 | var ontooltip = function ontooltip(event) {
|
15891 | me._onTooltip(event);
|
15892 | };
|
15893 |
|
15894 | var onclick = function onclick(event) {
|
15895 | me._onClick(event);
|
15896 | };
|
15897 |
|
15898 |
|
15899 | addEventListener(this.frame.canvas, 'mousedown', onmousedown);
|
15900 | addEventListener(this.frame.canvas, 'touchstart', ontouchstart);
|
15901 | addEventListener(this.frame.canvas, 'mousewheel', onmousewheel);
|
15902 | addEventListener(this.frame.canvas, 'mousemove', ontooltip);
|
15903 | addEventListener(this.frame.canvas, 'click', onclick);
|
15904 |
|
15905 | this.containerElement.appendChild(this.frame);
|
15906 | };
|
15907 |
|
15908 |
|
15909 |
|
15910 |
|
15911 |
|
15912 |
|
15913 |
|
15914 |
|
15915 |
|
15916 | Graph3d.prototype._setSize = function (width, height) {
|
15917 | this.frame.style.width = width;
|
15918 | this.frame.style.height = height;
|
15919 |
|
15920 | this._resizeCanvas();
|
15921 | };
|
15922 |
|
15923 |
|
15924 |
|
15925 |
|
15926 |
|
15927 | Graph3d.prototype._resizeCanvas = function () {
|
15928 | this.frame.canvas.style.width = '100%';
|
15929 | this.frame.canvas.style.height = '100%';
|
15930 | this.frame.canvas.width = this.frame.canvas.clientWidth;
|
15931 | this.frame.canvas.height = this.frame.canvas.clientHeight;
|
15932 |
|
15933 | filter(this.frame).style.width = this.frame.canvas.clientWidth - 2 * 10 + 'px';
|
15934 | };
|
15935 |
|
15936 |
|
15937 |
|
15938 |
|
15939 |
|
15940 |
|
15941 | Graph3d.prototype.animationStart = function () {
|
15942 |
|
15943 | if (!this.animationAutoStart || !this.dataGroup.dataFilter) return;
|
15944 | if (!filter(this.frame) || !filter(this.frame).slider) throw new Error('No animation available');
|
15945 |
|
15946 | filter(this.frame).slider.play();
|
15947 | };
|
15948 |
|
15949 |
|
15950 |
|
15951 |
|
15952 |
|
15953 | Graph3d.prototype.animationStop = function () {
|
15954 | if (!filter(this.frame) || !filter(this.frame).slider) return;
|
15955 |
|
15956 | filter(this.frame).slider.stop();
|
15957 | };
|
15958 |
|
15959 |
|
15960 |
|
15961 |
|
15962 |
|
15963 |
|
15964 |
|
15965 |
|
15966 | Graph3d.prototype._resizeCenter = function () {
|
15967 |
|
15968 | if (this.xCenter.charAt(this.xCenter.length - 1) === '%') {
|
15969 | this.currentXCenter = _parseFloat(this.xCenter) / 100 * this.frame.canvas.clientWidth;
|
15970 | } else {
|
15971 | this.currentXCenter = _parseFloat(this.xCenter);
|
15972 | }
|
15973 |
|
15974 |
|
15975 | if (this.yCenter.charAt(this.yCenter.length - 1) === '%') {
|
15976 | this.currentYCenter = _parseFloat(this.yCenter) / 100 * (this.frame.canvas.clientHeight - filter(this.frame).clientHeight);
|
15977 | } else {
|
15978 | this.currentYCenter = _parseFloat(this.yCenter);
|
15979 | }
|
15980 | };
|
15981 |
|
15982 |
|
15983 |
|
15984 |
|
15985 |
|
15986 |
|
15987 |
|
15988 |
|
15989 | Graph3d.prototype.getCameraPosition = function () {
|
15990 | var pos = this.camera.getArmRotation();
|
15991 | pos.distance = this.camera.getArmLength();
|
15992 | return pos;
|
15993 | };
|
15994 |
|
15995 |
|
15996 |
|
15997 |
|
15998 |
|
15999 |
|
16000 |
|
16001 |
|
16002 | Graph3d.prototype._readData = function (data) {
|
16003 |
|
16004 | this.dataPoints = this.dataGroup.initializeData(this, data, this.style);
|
16005 |
|
16006 | this._initializeRanges();
|
16007 |
|
16008 | this._redrawFilter();
|
16009 | };
|
16010 |
|
16011 |
|
16012 |
|
16013 |
|
16014 |
|
16015 |
|
16016 |
|
16017 | Graph3d.prototype.setData = function (data) {
|
16018 | if (data === undefined || data === null) return;
|
16019 |
|
16020 | this._readData(data);
|
16021 |
|
16022 | this.redraw();
|
16023 | this.animationStart();
|
16024 | };
|
16025 |
|
16026 |
|
16027 |
|
16028 |
|
16029 |
|
16030 |
|
16031 |
|
16032 | Graph3d.prototype.setOptions = function (options) {
|
16033 | if (options === undefined) return;
|
16034 | var errorFound = Validator$1.validate(options, allOptions);
|
16035 |
|
16036 | if (errorFound === true) {
|
16037 | console.log("%cErrors have been found in the supplied options object.", VALIDATOR_PRINT_STYLE$1);
|
16038 | }
|
16039 |
|
16040 | this.animationStop();
|
16041 | setOptions(options, this);
|
16042 | this.setPointDrawingMethod();
|
16043 |
|
16044 | this._setSize(this.width, this.height);
|
16045 |
|
16046 | this.setAxisLabelMethod();
|
16047 | this.setData(this.dataGroup.getDataTable());
|
16048 | this.animationStart();
|
16049 | };
|
16050 |
|
16051 |
|
16052 |
|
16053 |
|
16054 |
|
16055 | Graph3d.prototype.setPointDrawingMethod = function () {
|
16056 | var method = undefined;
|
16057 |
|
16058 | switch (this.style) {
|
16059 | case Graph3d.STYLE.BAR:
|
16060 | method = this._redrawBarGraphPoint;
|
16061 | break;
|
16062 |
|
16063 | case Graph3d.STYLE.BARCOLOR:
|
16064 | method = this._redrawBarColorGraphPoint;
|
16065 | break;
|
16066 |
|
16067 | case Graph3d.STYLE.BARSIZE:
|
16068 | method = this._redrawBarSizeGraphPoint;
|
16069 | break;
|
16070 |
|
16071 | case Graph3d.STYLE.DOT:
|
16072 | method = this._redrawDotGraphPoint;
|
16073 | break;
|
16074 |
|
16075 | case Graph3d.STYLE.DOTLINE:
|
16076 | method = this._redrawDotLineGraphPoint;
|
16077 | break;
|
16078 |
|
16079 | case Graph3d.STYLE.DOTCOLOR:
|
16080 | method = this._redrawDotColorGraphPoint;
|
16081 | break;
|
16082 |
|
16083 | case Graph3d.STYLE.DOTSIZE:
|
16084 | method = this._redrawDotSizeGraphPoint;
|
16085 | break;
|
16086 |
|
16087 | case Graph3d.STYLE.SURFACE:
|
16088 | method = this._redrawSurfaceGraphPoint;
|
16089 | break;
|
16090 |
|
16091 | case Graph3d.STYLE.GRID:
|
16092 | method = this._redrawGridGraphPoint;
|
16093 | break;
|
16094 |
|
16095 | case Graph3d.STYLE.LINE:
|
16096 | method = this._redrawLineGraphPoint;
|
16097 | break;
|
16098 |
|
16099 | default:
|
16100 | throw new Error('Can not determine point drawing method ' + 'for graph style \'' + this.style + '\'');
|
16101 | }
|
16102 |
|
16103 | this._pointDrawingMethod = method;
|
16104 | };
|
16105 |
|
16106 |
|
16107 |
|
16108 |
|
16109 |
|
16110 | Graph3d.prototype.setAxisLabelMethod = function () {
|
16111 | if (this.rotateAxisLabels) {
|
16112 | this._drawAxisLabelX = this.drawAxisLabelXRotate;
|
16113 | this._drawAxisLabelY = this.drawAxisLabelYRotate;
|
16114 | this._drawAxisLabelZ = this.drawAxisLabelZRotate;
|
16115 | } else {
|
16116 | this._drawAxisLabelX = this.drawAxisLabelX;
|
16117 | this._drawAxisLabelY = this.drawAxisLabelY;
|
16118 | this._drawAxisLabelZ = this.drawAxisLabelZ;
|
16119 | }
|
16120 | };
|
16121 |
|
16122 |
|
16123 |
|
16124 |
|
16125 |
|
16126 | Graph3d.prototype.redraw = function () {
|
16127 | if (this.dataPoints === undefined) {
|
16128 | throw new Error('Graph data not initialized');
|
16129 | }
|
16130 |
|
16131 | this._resizeCanvas();
|
16132 |
|
16133 | this._resizeCenter();
|
16134 |
|
16135 | this._redrawSlider();
|
16136 |
|
16137 | this._redrawClear();
|
16138 |
|
16139 | this._redrawAxis();
|
16140 |
|
16141 | this._redrawDataGraph();
|
16142 |
|
16143 | this._redrawInfo();
|
16144 |
|
16145 | this._redrawLegend();
|
16146 | };
|
16147 |
|
16148 |
|
16149 |
|
16150 |
|
16151 |
|
16152 |
|
16153 |
|
16154 |
|
16155 | Graph3d.prototype._getContext = function () {
|
16156 | var canvas = this.frame.canvas;
|
16157 | var ctx = canvas.getContext('2d');
|
16158 | ctx.lineJoin = 'round';
|
16159 | ctx.lineCap = 'round';
|
16160 | return ctx;
|
16161 | };
|
16162 |
|
16163 |
|
16164 |
|
16165 |
|
16166 |
|
16167 | Graph3d.prototype._redrawClear = function () {
|
16168 | var canvas = this.frame.canvas;
|
16169 | var ctx = canvas.getContext('2d');
|
16170 | ctx.clearRect(0, 0, canvas.width, canvas.height);
|
16171 | };
|
16172 |
|
16173 | Graph3d.prototype._dotSize = function () {
|
16174 | return this.frame.clientWidth * this.dotSizeRatio;
|
16175 | };
|
16176 |
|
16177 |
|
16178 |
|
16179 |
|
16180 |
|
16181 |
|
16182 |
|
16183 |
|
16184 | Graph3d.prototype._getLegendWidth = function () {
|
16185 | var width;
|
16186 |
|
16187 | if (this.style === Graph3d.STYLE.DOTSIZE) {
|
16188 | var dotSize = this._dotSize();
|
16189 |
|
16190 |
|
16191 | width = dotSize * this.dotSizeMaxFraction;
|
16192 | } else if (this.style === Graph3d.STYLE.BARSIZE) {
|
16193 | width = this.xBarWidth;
|
16194 | } else {
|
16195 | width = 20;
|
16196 | }
|
16197 |
|
16198 | return width;
|
16199 | };
|
16200 |
|
16201 |
|
16202 |
|
16203 |
|
16204 |
|
16205 | Graph3d.prototype._redrawLegend = function () {
|
16206 |
|
16207 | if (this.showLegend !== true) {
|
16208 | return;
|
16209 | }
|
16210 |
|
16211 |
|
16212 | if (this.style === Graph3d.STYLE.LINE || this.style === Graph3d.STYLE.BARSIZE
|
16213 | ) {
|
16214 | return;
|
16215 | }
|
16216 |
|
16217 |
|
16218 | var isSizeLegend = this.style === Graph3d.STYLE.BARSIZE || this.style === Graph3d.STYLE.DOTSIZE;
|
16219 |
|
16220 | var isValueLegend = this.style === Graph3d.STYLE.DOTSIZE || this.style === Graph3d.STYLE.DOTCOLOR || this.style === Graph3d.STYLE.SURFACE || this.style === Graph3d.STYLE.BARCOLOR;
|
16221 | var height = Math.max(this.frame.clientHeight * 0.25, 100);
|
16222 | var top = this.margin;
|
16223 |
|
16224 | var width = this._getLegendWidth();
|
16225 |
|
16226 |
|
16227 | var right = this.frame.clientWidth - this.margin;
|
16228 | var left = right - width;
|
16229 | var bottom = top + height;
|
16230 |
|
16231 | var ctx = this._getContext();
|
16232 |
|
16233 | ctx.lineWidth = 1;
|
16234 | ctx.font = '14px arial';
|
16235 |
|
16236 | if (isSizeLegend === false) {
|
16237 |
|
16238 | var ymin = 0;
|
16239 | var ymax = height;
|
16240 |
|
16241 | var y;
|
16242 |
|
16243 | for (y = ymin; y < ymax; y++) {
|
16244 |
|
16245 | var f = 1 - (y - ymin) / (ymax - ymin);
|
16246 |
|
16247 | var color = this._colormap(f, 1);
|
16248 |
|
16249 | ctx.strokeStyle = color;
|
16250 | ctx.beginPath();
|
16251 | ctx.moveTo(left, top + y);
|
16252 | ctx.lineTo(right, top + y);
|
16253 | ctx.stroke();
|
16254 | }
|
16255 |
|
16256 | ctx.strokeStyle = this.axisColor;
|
16257 | ctx.strokeRect(left, top, width, height);
|
16258 | } else {
|
16259 |
|
16260 | var widthMin;
|
16261 |
|
16262 | if (this.style === Graph3d.STYLE.DOTSIZE) {
|
16263 |
|
16264 | widthMin = width * (this.dotSizeMinFraction / this.dotSizeMaxFraction);
|
16265 | } else if (this.style === Graph3d.STYLE.BARSIZE) ;
|
16266 |
|
16267 | ctx.strokeStyle = this.axisColor;
|
16268 | ctx.fillStyle = fill(this.dataColor);
|
16269 | ctx.beginPath();
|
16270 | ctx.moveTo(left, top);
|
16271 | ctx.lineTo(right, top);
|
16272 | ctx.lineTo(left + widthMin, bottom);
|
16273 | ctx.lineTo(left, bottom);
|
16274 | ctx.closePath();
|
16275 |
|
16276 | fill(ctx).call(ctx);
|
16277 |
|
16278 | ctx.stroke();
|
16279 | }
|
16280 |
|
16281 |
|
16282 | var gridLineLen = 5;
|
16283 |
|
16284 | var legendMin = isValueLegend ? this.valueRange.min : this.zRange.min;
|
16285 | var legendMax = isValueLegend ? this.valueRange.max : this.zRange.max;
|
16286 | var step = new StepNumber_1(legendMin, legendMax, (legendMax - legendMin) / 5, true);
|
16287 | step.start(true);
|
16288 | var from;
|
16289 | var to;
|
16290 |
|
16291 | while (!step.end()) {
|
16292 | y = bottom - (step.getCurrent() - legendMin) / (legendMax - legendMin) * height;
|
16293 | from = new Point2d_1(left - gridLineLen, y);
|
16294 | to = new Point2d_1(left, y);
|
16295 |
|
16296 | this._line(ctx, from, to);
|
16297 |
|
16298 | ctx.textAlign = 'right';
|
16299 | ctx.textBaseline = 'middle';
|
16300 | ctx.fillStyle = this.axisColor;
|
16301 | ctx.fillText(step.getCurrent(), left - 2 * gridLineLen, y);
|
16302 | step.next();
|
16303 | }
|
16304 |
|
16305 | ctx.textAlign = 'right';
|
16306 | ctx.textBaseline = 'top';
|
16307 | var label = this.legendLabel;
|
16308 | ctx.fillText(label, right, bottom + this.margin);
|
16309 | };
|
16310 |
|
16311 |
|
16312 |
|
16313 |
|
16314 |
|
16315 | Graph3d.prototype._redrawFilter = function () {
|
16316 | var dataFilter = this.dataGroup.dataFilter;
|
16317 |
|
16318 | var filter$1 = filter(this.frame);
|
16319 |
|
16320 | filter$1.innerHTML = '';
|
16321 |
|
16322 | if (!dataFilter) {
|
16323 | filter$1.slider = undefined;
|
16324 | return;
|
16325 | }
|
16326 |
|
16327 | var options = {
|
16328 | 'visible': this.showAnimationControls
|
16329 | };
|
16330 | var slider = new Slider(filter$1, options);
|
16331 | filter$1.slider = slider;
|
16332 |
|
16333 | filter$1.style.padding = '10px';
|
16334 |
|
16335 | slider.setValues(values(dataFilter));
|
16336 | slider.setPlayInterval(this.animationInterval);
|
16337 |
|
16338 | var me = this;
|
16339 |
|
16340 | var onchange = function onchange() {
|
16341 | var dataFilter = me.dataGroup.dataFilter;
|
16342 | var index = slider.getIndex();
|
16343 | dataFilter.selectValue(index);
|
16344 | me.dataPoints = dataFilter._getDataPoints();
|
16345 | me.redraw();
|
16346 | };
|
16347 |
|
16348 | slider.setOnChangeCallback(onchange);
|
16349 | };
|
16350 |
|
16351 |
|
16352 |
|
16353 |
|
16354 |
|
16355 | Graph3d.prototype._redrawSlider = function () {
|
16356 | if (filter(this.frame).slider !== undefined) {
|
16357 | filter(this.frame).slider.redraw();
|
16358 | }
|
16359 | };
|
16360 |
|
16361 |
|
16362 |
|
16363 |
|
16364 |
|
16365 | Graph3d.prototype._redrawInfo = function () {
|
16366 | var info = this.dataGroup.getInfo();
|
16367 | if (info === undefined) return;
|
16368 |
|
16369 | var ctx = this._getContext();
|
16370 |
|
16371 | ctx.font = '14px arial';
|
16372 |
|
16373 | ctx.lineStyle = 'gray';
|
16374 | ctx.fillStyle = 'gray';
|
16375 | ctx.textAlign = 'left';
|
16376 | ctx.textBaseline = 'top';
|
16377 | var x = this.margin;
|
16378 | var y = this.margin;
|
16379 | ctx.fillText(info, x, y);
|
16380 | };
|
16381 |
|
16382 |
|
16383 |
|
16384 |
|
16385 |
|
16386 |
|
16387 |
|
16388 |
|
16389 |
|
16390 |
|
16391 |
|
16392 |
|
16393 |
|
16394 | Graph3d.prototype._line = function (ctx, from, to, strokeStyle) {
|
16395 | if (strokeStyle !== undefined) {
|
16396 | ctx.strokeStyle = strokeStyle;
|
16397 | }
|
16398 |
|
16399 | ctx.beginPath();
|
16400 | ctx.moveTo(from.x, from.y);
|
16401 | ctx.lineTo(to.x, to.y);
|
16402 | ctx.stroke();
|
16403 | };
|
16404 |
|
16405 |
|
16406 |
|
16407 |
|
16408 |
|
16409 |
|
16410 |
|
16411 |
|
16412 |
|
16413 |
|
16414 | Graph3d.prototype.drawAxisLabelX = function (ctx, point3d, text, armAngle, yMargin) {
|
16415 | if (yMargin === undefined) {
|
16416 | yMargin = 0;
|
16417 | }
|
16418 |
|
16419 | var point2d = this._convert3Dto2D(point3d);
|
16420 |
|
16421 | if (Math.cos(armAngle * 2) > 0) {
|
16422 | ctx.textAlign = 'center';
|
16423 | ctx.textBaseline = 'top';
|
16424 | point2d.y += yMargin;
|
16425 | } else if (Math.sin(armAngle * 2) < 0) {
|
16426 | ctx.textAlign = 'right';
|
16427 | ctx.textBaseline = 'middle';
|
16428 | } else {
|
16429 | ctx.textAlign = 'left';
|
16430 | ctx.textBaseline = 'middle';
|
16431 | }
|
16432 |
|
16433 | ctx.fillStyle = this.axisColor;
|
16434 | ctx.fillText(text, point2d.x, point2d.y);
|
16435 | };
|
16436 |
|
16437 |
|
16438 |
|
16439 |
|
16440 |
|
16441 |
|
16442 |
|
16443 |
|
16444 |
|
16445 |
|
16446 | Graph3d.prototype.drawAxisLabelY = function (ctx, point3d, text, armAngle, yMargin) {
|
16447 | if (yMargin === undefined) {
|
16448 | yMargin = 0;
|
16449 | }
|
16450 |
|
16451 | var point2d = this._convert3Dto2D(point3d);
|
16452 |
|
16453 | if (Math.cos(armAngle * 2) < 0) {
|
16454 | ctx.textAlign = 'center';
|
16455 | ctx.textBaseline = 'top';
|
16456 | point2d.y += yMargin;
|
16457 | } else if (Math.sin(armAngle * 2) > 0) {
|
16458 | ctx.textAlign = 'right';
|
16459 | ctx.textBaseline = 'middle';
|
16460 | } else {
|
16461 | ctx.textAlign = 'left';
|
16462 | ctx.textBaseline = 'middle';
|
16463 | }
|
16464 |
|
16465 | ctx.fillStyle = this.axisColor;
|
16466 | ctx.fillText(text, point2d.x, point2d.y);
|
16467 | };
|
16468 |
|
16469 |
|
16470 |
|
16471 |
|
16472 |
|
16473 |
|
16474 |
|
16475 |
|
16476 |
|
16477 | Graph3d.prototype.drawAxisLabelZ = function (ctx, point3d, text, offset) {
|
16478 | if (offset === undefined) {
|
16479 | offset = 0;
|
16480 | }
|
16481 |
|
16482 | var point2d = this._convert3Dto2D(point3d);
|
16483 |
|
16484 | ctx.textAlign = 'right';
|
16485 | ctx.textBaseline = 'middle';
|
16486 | ctx.fillStyle = this.axisColor;
|
16487 | ctx.fillText(text, point2d.x - offset, point2d.y);
|
16488 | };
|
16489 |
|
16490 |
|
16491 |
|
16492 |
|
16493 |
|
16494 |
|
16495 |
|
16496 |
|
16497 |
|
16498 |
|
16499 | Graph3d.prototype.drawAxisLabelXRotate = function (ctx, point3d, text, armAngle, yMargin) {
|
16500 |
|
16501 | var point2d = this._convert3Dto2D(point3d);
|
16502 |
|
16503 | if (Math.cos(armAngle * 2) > 0) {
|
16504 | ctx.save();
|
16505 | ctx.translate(point2d.x, point2d.y);
|
16506 | ctx.rotate(-Math.PI / 2);
|
16507 | ctx.textAlign = 'right';
|
16508 | ctx.textBaseline = 'middle';
|
16509 | ctx.fillStyle = this.axisColor;
|
16510 | ctx.fillText(text, 0, 0);
|
16511 | ctx.restore();
|
16512 | } else if (Math.sin(armAngle * 2) < 0) {
|
16513 | ctx.textAlign = 'right';
|
16514 | ctx.textBaseline = 'middle';
|
16515 | ctx.fillStyle = this.axisColor;
|
16516 | ctx.fillText(text, point2d.x, point2d.y);
|
16517 | } else {
|
16518 | ctx.textAlign = 'left';
|
16519 | ctx.textBaseline = 'middle';
|
16520 | ctx.fillStyle = this.axisColor;
|
16521 | ctx.fillText(text, point2d.x, point2d.y);
|
16522 | }
|
16523 | };
|
16524 |
|
16525 |
|
16526 |
|
16527 |
|
16528 |
|
16529 |
|
16530 |
|
16531 |
|
16532 |
|
16533 |
|
16534 | Graph3d.prototype.drawAxisLabelYRotate = function (ctx, point3d, text, armAngle, yMargin) {
|
16535 |
|
16536 | var point2d = this._convert3Dto2D(point3d);
|
16537 |
|
16538 | if (Math.cos(armAngle * 2) < 0) {
|
16539 | ctx.save();
|
16540 | ctx.translate(point2d.x, point2d.y);
|
16541 | ctx.rotate(-Math.PI / 2);
|
16542 | ctx.textAlign = 'right';
|
16543 | ctx.textBaseline = 'middle';
|
16544 | ctx.fillStyle = this.axisColor;
|
16545 | ctx.fillText(text, 0, 0);
|
16546 | ctx.restore();
|
16547 | } else if (Math.sin(armAngle * 2) > 0) {
|
16548 | ctx.textAlign = 'right';
|
16549 | ctx.textBaseline = 'middle';
|
16550 | ctx.fillStyle = this.axisColor;
|
16551 | ctx.fillText(text, point2d.x, point2d.y);
|
16552 | } else {
|
16553 | ctx.textAlign = 'left';
|
16554 | ctx.textBaseline = 'middle';
|
16555 | ctx.fillStyle = this.axisColor;
|
16556 | ctx.fillText(text, point2d.x, point2d.y);
|
16557 | }
|
16558 | };
|
16559 |
|
16560 |
|
16561 |
|
16562 |
|
16563 |
|
16564 |
|
16565 |
|
16566 |
|
16567 |
|
16568 | Graph3d.prototype.drawAxisLabelZRotate = function (ctx, point3d, text, offset) {
|
16569 | if (offset === undefined) {
|
16570 | offset = 0;
|
16571 | }
|
16572 |
|
16573 | var point2d = this._convert3Dto2D(point3d);
|
16574 |
|
16575 | ctx.textAlign = 'right';
|
16576 | ctx.textBaseline = 'middle';
|
16577 | ctx.fillStyle = this.axisColor;
|
16578 | ctx.fillText(text, point2d.x - offset, point2d.y);
|
16579 | };
|
16580 |
|
16581 |
|
16582 |
|
16583 |
|
16584 |
|
16585 |
|
16586 |
|
16587 |
|
16588 |
|
16589 |
|
16590 |
|
16591 |
|
16592 |
|
16593 |
|
16594 |
|
16595 |
|
16596 | Graph3d.prototype._line3d = function (ctx, from, to, strokeStyle) {
|
16597 | var from2d = this._convert3Dto2D(from);
|
16598 |
|
16599 | var to2d = this._convert3Dto2D(to);
|
16600 |
|
16601 | this._line(ctx, from2d, to2d, strokeStyle);
|
16602 | };
|
16603 |
|
16604 |
|
16605 |
|
16606 |
|
16607 |
|
16608 | Graph3d.prototype._redrawAxis = function () {
|
16609 | var ctx = this._getContext(),
|
16610 | from,
|
16611 | to,
|
16612 | step,
|
16613 | prettyStep,
|
16614 | text,
|
16615 | xText,
|
16616 | yText,
|
16617 | zText,
|
16618 | offset,
|
16619 | xOffset,
|
16620 | yOffset;
|
16621 |
|
16622 |
|
16623 |
|
16624 |
|
16625 | ctx.font = this.axisFontSize / this.camera.getArmLength() + 'px ' + this.axisFontType;
|
16626 |
|
16627 | var gridLenX = 0.025 / this.scale.x;
|
16628 | var gridLenY = 0.025 / this.scale.y;
|
16629 | var textMargin = 5 / this.camera.getArmLength();
|
16630 |
|
16631 | var armAngle = this.camera.getArmRotation().horizontal;
|
16632 | var armVector = new Point2d_1(Math.cos(armAngle), Math.sin(armAngle));
|
16633 | var xRange = this.xRange;
|
16634 | var yRange = this.yRange;
|
16635 | var zRange = this.zRange;
|
16636 | var point3d;
|
16637 |
|
16638 | ctx.lineWidth = 1;
|
16639 | prettyStep = this.defaultXStep === undefined;
|
16640 | step = new StepNumber_1(xRange.min, xRange.max, this.xStep, prettyStep);
|
16641 | step.start(true);
|
16642 |
|
16643 | while (!step.end()) {
|
16644 | var x = step.getCurrent();
|
16645 |
|
16646 | if (this.showGrid) {
|
16647 | from = new Point3d_1(x, yRange.min, zRange.min);
|
16648 | to = new Point3d_1(x, yRange.max, zRange.min);
|
16649 |
|
16650 | this._line3d(ctx, from, to, this.gridColor);
|
16651 | } else if (this.showXAxis) {
|
16652 | from = new Point3d_1(x, yRange.min, zRange.min);
|
16653 | to = new Point3d_1(x, yRange.min + gridLenX, zRange.min);
|
16654 |
|
16655 | this._line3d(ctx, from, to, this.axisColor);
|
16656 |
|
16657 | from = new Point3d_1(x, yRange.max, zRange.min);
|
16658 | to = new Point3d_1(x, yRange.max - gridLenX, zRange.min);
|
16659 |
|
16660 | this._line3d(ctx, from, to, this.axisColor);
|
16661 | }
|
16662 |
|
16663 | if (this.showXAxis) {
|
16664 | yText = armVector.x > 0 ? yRange.min : yRange.max;
|
16665 | point3d = new Point3d_1(x, yText, zRange.min);
|
16666 | var msg = ' ' + this.xValueLabel(x) + ' ';
|
16667 |
|
16668 | this._drawAxisLabelX.call(this, ctx, point3d, msg, armAngle, textMargin);
|
16669 | }
|
16670 |
|
16671 | step.next();
|
16672 | }
|
16673 |
|
16674 |
|
16675 | ctx.lineWidth = 1;
|
16676 | prettyStep = this.defaultYStep === undefined;
|
16677 | step = new StepNumber_1(yRange.min, yRange.max, this.yStep, prettyStep);
|
16678 | step.start(true);
|
16679 |
|
16680 | while (!step.end()) {
|
16681 | var y = step.getCurrent();
|
16682 |
|
16683 | if (this.showGrid) {
|
16684 | from = new Point3d_1(xRange.min, y, zRange.min);
|
16685 | to = new Point3d_1(xRange.max, y, zRange.min);
|
16686 |
|
16687 | this._line3d(ctx, from, to, this.gridColor);
|
16688 | } else if (this.showYAxis) {
|
16689 | from = new Point3d_1(xRange.min, y, zRange.min);
|
16690 | to = new Point3d_1(xRange.min + gridLenY, y, zRange.min);
|
16691 |
|
16692 | this._line3d(ctx, from, to, this.axisColor);
|
16693 |
|
16694 | from = new Point3d_1(xRange.max, y, zRange.min);
|
16695 | to = new Point3d_1(xRange.max - gridLenY, y, zRange.min);
|
16696 |
|
16697 | this._line3d(ctx, from, to, this.axisColor);
|
16698 | }
|
16699 |
|
16700 | if (this.showYAxis) {
|
16701 | xText = armVector.y > 0 ? xRange.min : xRange.max;
|
16702 | point3d = new Point3d_1(xText, y, zRange.min);
|
16703 |
|
16704 | var _msg = ' ' + this.yValueLabel(y) + ' ';
|
16705 |
|
16706 | this._drawAxisLabelY.call(this, ctx, point3d, _msg, armAngle, textMargin);
|
16707 | }
|
16708 |
|
16709 | step.next();
|
16710 | }
|
16711 |
|
16712 |
|
16713 | if (this.showZAxis) {
|
16714 | ctx.lineWidth = 1;
|
16715 | prettyStep = this.defaultZStep === undefined;
|
16716 | step = new StepNumber_1(zRange.min, zRange.max, this.zStep, prettyStep);
|
16717 | step.start(true);
|
16718 | xText = armVector.x > 0 ? xRange.min : xRange.max;
|
16719 | yText = armVector.y < 0 ? yRange.min : yRange.max;
|
16720 |
|
16721 | while (!step.end()) {
|
16722 | var z = step.getCurrent();
|
16723 |
|
16724 | var from3d = new Point3d_1(xText, yText, z);
|
16725 |
|
16726 | var from2d = this._convert3Dto2D(from3d);
|
16727 |
|
16728 | to = new Point2d_1(from2d.x - textMargin, from2d.y);
|
16729 |
|
16730 | this._line(ctx, from2d, to, this.axisColor);
|
16731 |
|
16732 | var _msg2 = this.zValueLabel(z) + ' ';
|
16733 |
|
16734 | this._drawAxisLabelZ.call(this, ctx, from3d, _msg2, 5);
|
16735 |
|
16736 | step.next();
|
16737 | }
|
16738 |
|
16739 | ctx.lineWidth = 1;
|
16740 | from = new Point3d_1(xText, yText, zRange.min);
|
16741 | to = new Point3d_1(xText, yText, zRange.max);
|
16742 |
|
16743 | this._line3d(ctx, from, to, this.axisColor);
|
16744 | }
|
16745 |
|
16746 |
|
16747 | if (this.showXAxis) {
|
16748 | var xMin2d;
|
16749 | var xMax2d;
|
16750 | ctx.lineWidth = 1;
|
16751 |
|
16752 | xMin2d = new Point3d_1(xRange.min, yRange.min, zRange.min);
|
16753 | xMax2d = new Point3d_1(xRange.max, yRange.min, zRange.min);
|
16754 |
|
16755 | this._line3d(ctx, xMin2d, xMax2d, this.axisColor);
|
16756 |
|
16757 |
|
16758 | xMin2d = new Point3d_1(xRange.min, yRange.max, zRange.min);
|
16759 | xMax2d = new Point3d_1(xRange.max, yRange.max, zRange.min);
|
16760 |
|
16761 | this._line3d(ctx, xMin2d, xMax2d, this.axisColor);
|
16762 | }
|
16763 |
|
16764 |
|
16765 | if (this.showYAxis) {
|
16766 | ctx.lineWidth = 1;
|
16767 |
|
16768 | from = new Point3d_1(xRange.min, yRange.min, zRange.min);
|
16769 | to = new Point3d_1(xRange.min, yRange.max, zRange.min);
|
16770 |
|
16771 | this._line3d(ctx, from, to, this.axisColor);
|
16772 |
|
16773 |
|
16774 | from = new Point3d_1(xRange.max, yRange.min, zRange.min);
|
16775 | to = new Point3d_1(xRange.max, yRange.max, zRange.min);
|
16776 |
|
16777 | this._line3d(ctx, from, to, this.axisColor);
|
16778 | }
|
16779 |
|
16780 |
|
16781 | var xLabel = this.xLabel;
|
16782 |
|
16783 | if (xLabel.length > 0 && this.showXAxis) {
|
16784 | yOffset = 0.1 / this.scale.y;
|
16785 | xText = (xRange.max + 3 * xRange.min) / 4;
|
16786 | yText = armVector.x > 0 ? yRange.min - yOffset : yRange.max + yOffset;
|
16787 | text = new Point3d_1(xText, yText, zRange.min);
|
16788 | this.drawAxisLabelX(ctx, text, xLabel, armAngle);
|
16789 | }
|
16790 |
|
16791 |
|
16792 | var yLabel = this.yLabel;
|
16793 |
|
16794 | if (yLabel.length > 0 && this.showYAxis) {
|
16795 | xOffset = 0.1 / this.scale.x;
|
16796 | xText = armVector.y > 0 ? xRange.min - xOffset : xRange.max + xOffset;
|
16797 | yText = (yRange.max + 3 * yRange.min) / 4;
|
16798 | text = new Point3d_1(xText, yText, zRange.min);
|
16799 | this.drawAxisLabelY(ctx, text, yLabel, armAngle);
|
16800 | }
|
16801 |
|
16802 |
|
16803 | var zLabel = this.zLabel;
|
16804 |
|
16805 | if (zLabel.length > 0 && this.showZAxis) {
|
16806 | offset = 30;
|
16807 |
|
16808 | xText = armVector.x > 0 ? xRange.min : xRange.max;
|
16809 | yText = armVector.y < 0 ? yRange.min : yRange.max;
|
16810 | zText = (zRange.max + 3 * zRange.min) / 4;
|
16811 | text = new Point3d_1(xText, yText, zText);
|
16812 | this.drawAxisLabelZ(ctx, text, zLabel, offset);
|
16813 | }
|
16814 | };
|
16815 |
|
16816 |
|
16817 |
|
16818 |
|
16819 |
|
16820 |
|
16821 |
|
16822 |
|
16823 | Graph3d.prototype._getStrokeWidth = function (point) {
|
16824 | if (point !== undefined) {
|
16825 | if (this.showPerspective) {
|
16826 | return 1 / -point.trans.z * this.dataColor.strokeWidth;
|
16827 | } else {
|
16828 | return -(this.eye.z / this.camera.getArmLength()) * this.dataColor.strokeWidth;
|
16829 | }
|
16830 | }
|
16831 |
|
16832 | return this.dataColor.strokeWidth;
|
16833 | };
|
16834 |
|
16835 |
|
16836 |
|
16837 |
|
16838 |
|
16839 |
|
16840 |
|
16841 |
|
16842 |
|
16843 |
|
16844 |
|
16845 |
|
16846 |
|
16847 |
|
16848 |
|
16849 |
|
16850 | Graph3d.prototype._redrawBar = function (ctx, point, xWidth, yWidth, color, borderColor) {
|
16851 | var surface;
|
16852 |
|
16853 | var me = this;
|
16854 | var point3d = point.point;
|
16855 | var zMin = this.zRange.min;
|
16856 | var top = [{
|
16857 | point: new Point3d_1(point3d.x - xWidth, point3d.y - yWidth, point3d.z)
|
16858 | }, {
|
16859 | point: new Point3d_1(point3d.x + xWidth, point3d.y - yWidth, point3d.z)
|
16860 | }, {
|
16861 | point: new Point3d_1(point3d.x + xWidth, point3d.y + yWidth, point3d.z)
|
16862 | }, {
|
16863 | point: new Point3d_1(point3d.x - xWidth, point3d.y + yWidth, point3d.z)
|
16864 | }];
|
16865 | var bottom = [{
|
16866 | point: new Point3d_1(point3d.x - xWidth, point3d.y - yWidth, zMin)
|
16867 | }, {
|
16868 | point: new Point3d_1(point3d.x + xWidth, point3d.y - yWidth, zMin)
|
16869 | }, {
|
16870 | point: new Point3d_1(point3d.x + xWidth, point3d.y + yWidth, zMin)
|
16871 | }, {
|
16872 | point: new Point3d_1(point3d.x - xWidth, point3d.y + yWidth, zMin)
|
16873 | }];
|
16874 |
|
16875 | forEach$1(top).call(top, function (obj) {
|
16876 | obj.screen = me._convert3Dto2D(obj.point);
|
16877 | });
|
16878 |
|
16879 | forEach$1(bottom).call(bottom, function (obj) {
|
16880 | obj.screen = me._convert3Dto2D(obj.point);
|
16881 | });
|
16882 |
|
16883 |
|
16884 | var surfaces = [{
|
16885 | corners: top,
|
16886 | center: Point3d_1.avg(bottom[0].point, bottom[2].point)
|
16887 | }, {
|
16888 | corners: [top[0], top[1], bottom[1], bottom[0]],
|
16889 | center: Point3d_1.avg(bottom[1].point, bottom[0].point)
|
16890 | }, {
|
16891 | corners: [top[1], top[2], bottom[2], bottom[1]],
|
16892 | center: Point3d_1.avg(bottom[2].point, bottom[1].point)
|
16893 | }, {
|
16894 | corners: [top[2], top[3], bottom[3], bottom[2]],
|
16895 | center: Point3d_1.avg(bottom[3].point, bottom[2].point)
|
16896 | }, {
|
16897 | corners: [top[3], top[0], bottom[0], bottom[3]],
|
16898 | center: Point3d_1.avg(bottom[0].point, bottom[3].point)
|
16899 | }];
|
16900 | point.surfaces = surfaces;
|
16901 |
|
16902 | for (var j = 0; j < surfaces.length; j++) {
|
16903 | surface = surfaces[j];
|
16904 |
|
16905 | var transCenter = this._convertPointToTranslation(surface.center);
|
16906 |
|
16907 | surface.dist = this.showPerspective ? transCenter.length() : -transCenter.z;
|
16908 |
|
16909 |
|
16910 | }
|
16911 |
|
16912 |
|
16913 | sort(surfaces).call(surfaces, function (a, b) {
|
16914 | var diff = b.dist - a.dist;
|
16915 | if (diff) return diff;
|
16916 |
|
16917 | if (a.corners === top) return 1;
|
16918 | if (b.corners === top) return -1;
|
16919 |
|
16920 | return 0;
|
16921 | });
|
16922 |
|
16923 |
|
16924 | ctx.lineWidth = this._getStrokeWidth(point);
|
16925 | ctx.strokeStyle = borderColor;
|
16926 | ctx.fillStyle = color;
|
16927 |
|
16928 | for (var _j = 2; _j < surfaces.length; _j++) {
|
16929 | surface = surfaces[_j];
|
16930 |
|
16931 | this._polygon(ctx, surface.corners);
|
16932 | }
|
16933 | };
|
16934 |
|
16935 |
|
16936 |
|
16937 |
|
16938 |
|
16939 |
|
16940 |
|
16941 |
|
16942 |
|
16943 |
|
16944 | Graph3d.prototype._polygon = function (ctx, points, fillStyle, strokeStyle) {
|
16945 | if (points.length < 2) {
|
16946 | return;
|
16947 | }
|
16948 |
|
16949 | if (fillStyle !== undefined) {
|
16950 | ctx.fillStyle = fillStyle;
|
16951 | }
|
16952 |
|
16953 | if (strokeStyle !== undefined) {
|
16954 | ctx.strokeStyle = strokeStyle;
|
16955 | }
|
16956 |
|
16957 | ctx.beginPath();
|
16958 | ctx.moveTo(points[0].screen.x, points[0].screen.y);
|
16959 |
|
16960 | for (var i = 1; i < points.length; ++i) {
|
16961 | var point = points[i];
|
16962 | ctx.lineTo(point.screen.x, point.screen.y);
|
16963 | }
|
16964 |
|
16965 | ctx.closePath();
|
16966 |
|
16967 | fill(ctx).call(ctx);
|
16968 |
|
16969 | ctx.stroke();
|
16970 | };
|
16971 |
|
16972 |
|
16973 |
|
16974 |
|
16975 |
|
16976 |
|
16977 |
|
16978 |
|
16979 |
|
16980 |
|
16981 | Graph3d.prototype._drawCircle = function (ctx, point, color, borderColor, size) {
|
16982 | var radius = this._calcRadius(point, size);
|
16983 |
|
16984 | ctx.lineWidth = this._getStrokeWidth(point);
|
16985 | ctx.strokeStyle = borderColor;
|
16986 | ctx.fillStyle = color;
|
16987 | ctx.beginPath();
|
16988 | ctx.arc(point.screen.x, point.screen.y, radius, 0, Math.PI * 2, true);
|
16989 |
|
16990 | fill(ctx).call(ctx);
|
16991 |
|
16992 | ctx.stroke();
|
16993 | };
|
16994 |
|
16995 |
|
16996 |
|
16997 |
|
16998 |
|
16999 |
|
17000 |
|
17001 |
|
17002 |
|
17003 | Graph3d.prototype._getColorsRegular = function (point) {
|
17004 | var f = (point.point.value - this.valueRange.min) * this.scale.value;
|
17005 |
|
17006 | var color = this._colormap(f, 1);
|
17007 |
|
17008 | var borderColor = this._colormap(f, 0.8);
|
17009 |
|
17010 | return {
|
17011 | fill: color,
|
17012 | border: borderColor
|
17013 | };
|
17014 | };
|
17015 |
|
17016 |
|
17017 |
|
17018 |
|
17019 |
|
17020 |
|
17021 |
|
17022 |
|
17023 |
|
17024 |
|
17025 |
|
17026 |
|
17027 |
|
17028 |
|
17029 | Graph3d.prototype._getColorsColor = function (point) {
|
17030 |
|
17031 | var color, borderColor, pointStyle;
|
17032 |
|
17033 | if (point && point.point && point.point.data && point.point.data.style) {
|
17034 | pointStyle = point.point.data.style;
|
17035 | }
|
17036 |
|
17037 | if (pointStyle && _typeof(pointStyle) === 'object' && fill(pointStyle) && pointStyle.stroke) {
|
17038 | return {
|
17039 | fill: fill(pointStyle),
|
17040 | border: pointStyle.stroke
|
17041 | };
|
17042 | }
|
17043 |
|
17044 | if (typeof point.point.value === "string") {
|
17045 | color = point.point.value;
|
17046 | borderColor = point.point.value;
|
17047 | } else {
|
17048 | var f = (point.point.value - this.valueRange.min) * this.scale.value;
|
17049 | color = this._colormap(f, 1);
|
17050 | borderColor = this._colormap(f, 0.8);
|
17051 | }
|
17052 |
|
17053 | return {
|
17054 | fill: color,
|
17055 | border: borderColor
|
17056 | };
|
17057 | };
|
17058 |
|
17059 |
|
17060 |
|
17061 |
|
17062 |
|
17063 |
|
17064 |
|
17065 |
|
17066 |
|
17067 | Graph3d.prototype._getColorsSize = function () {
|
17068 | return {
|
17069 | fill: fill(this.dataColor),
|
17070 | border: this.dataColor.stroke
|
17071 | };
|
17072 | };
|
17073 |
|
17074 |
|
17075 |
|
17076 |
|
17077 |
|
17078 |
|
17079 |
|
17080 |
|
17081 |
|
17082 |
|
17083 | Graph3d.prototype._colormap = function (x) {
|
17084 | var v = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
17085 | var r, g, b, a;
|
17086 | var colormap = this.colormap;
|
17087 |
|
17088 | if (isArray$5(colormap)) {
|
17089 | var maxIndex = colormap.length - 1;
|
17090 | var startIndex = Math.max(Math.floor(x * maxIndex), 0);
|
17091 | var endIndex = Math.min(startIndex + 1, maxIndex);
|
17092 | var innerRatio = x * maxIndex - startIndex;
|
17093 | var min = colormap[startIndex];
|
17094 | var max = colormap[endIndex];
|
17095 | r = min.r + innerRatio * (max.r - min.r);
|
17096 | g = min.g + innerRatio * (max.g - min.g);
|
17097 | b = min.b + innerRatio * (max.b - min.b);
|
17098 | } else if (typeof colormap === 'function') {
|
17099 | var _colormap = colormap(x);
|
17100 |
|
17101 | r = _colormap.r;
|
17102 | g = _colormap.g;
|
17103 | b = _colormap.b;
|
17104 | a = _colormap.a;
|
17105 | } else {
|
17106 | var hue = (1 - x) * 240;
|
17107 |
|
17108 | var _util$HSVToRGB = HSVToRGB(hue / 360, 1, 1);
|
17109 |
|
17110 | r = _util$HSVToRGB.r;
|
17111 | g = _util$HSVToRGB.g;
|
17112 | b = _util$HSVToRGB.b;
|
17113 | }
|
17114 |
|
17115 | if (typeof a === 'number' && !isNan(a)) {
|
17116 | var _context, _context2, _context3;
|
17117 |
|
17118 | return concat(_context = concat(_context2 = concat(_context3 = "RGBA(".concat(Math.round(r * v), ", ")).call(_context3, Math.round(g * v), ", ")).call(_context2, Math.round(b * v), ", ")).call(_context, a, ")");
|
17119 | } else {
|
17120 | var _context4, _context5;
|
17121 |
|
17122 | return concat(_context4 = concat(_context5 = "RGB(".concat(Math.round(r * v), ", ")).call(_context5, Math.round(g * v), ", ")).call(_context4, Math.round(b * v), ")");
|
17123 | }
|
17124 | };
|
17125 |
|
17126 |
|
17127 |
|
17128 |
|
17129 |
|
17130 |
|
17131 |
|
17132 |
|
17133 |
|
17134 |
|
17135 |
|
17136 |
|
17137 | Graph3d.prototype._calcRadius = function (point, size) {
|
17138 | if (size === undefined) {
|
17139 | size = this._dotSize();
|
17140 | }
|
17141 |
|
17142 | var radius;
|
17143 |
|
17144 | if (this.showPerspective) {
|
17145 | radius = size / -point.trans.z;
|
17146 | } else {
|
17147 | radius = size * -(this.eye.z / this.camera.getArmLength());
|
17148 | }
|
17149 |
|
17150 | if (radius < 0) {
|
17151 | radius = 0;
|
17152 | }
|
17153 |
|
17154 | return radius;
|
17155 | };
|
17156 |
|
17157 |
|
17158 |
|
17159 |
|
17160 |
|
17161 |
|
17162 |
|
17163 |
|
17164 |
|
17165 |
|
17166 |
|
17167 |
|
17168 | Graph3d.prototype._redrawBarGraphPoint = function (ctx, point) {
|
17169 | var xWidth = this.xBarWidth / 2;
|
17170 | var yWidth = this.yBarWidth / 2;
|
17171 |
|
17172 | var colors = this._getColorsRegular(point);
|
17173 |
|
17174 | this._redrawBar(ctx, point, xWidth, yWidth, fill(colors), colors.border);
|
17175 | };
|
17176 |
|
17177 |
|
17178 |
|
17179 |
|
17180 |
|
17181 |
|
17182 |
|
17183 |
|
17184 |
|
17185 | Graph3d.prototype._redrawBarColorGraphPoint = function (ctx, point) {
|
17186 | var xWidth = this.xBarWidth / 2;
|
17187 | var yWidth = this.yBarWidth / 2;
|
17188 |
|
17189 | var colors = this._getColorsColor(point);
|
17190 |
|
17191 | this._redrawBar(ctx, point, xWidth, yWidth, fill(colors), colors.border);
|
17192 | };
|
17193 |
|
17194 |
|
17195 |
|
17196 |
|
17197 |
|
17198 |
|
17199 |
|
17200 |
|
17201 |
|
17202 | Graph3d.prototype._redrawBarSizeGraphPoint = function (ctx, point) {
|
17203 |
|
17204 | var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range();
|
17205 | var xWidth = this.xBarWidth / 2 * (fraction * 0.8 + 0.2);
|
17206 | var yWidth = this.yBarWidth / 2 * (fraction * 0.8 + 0.2);
|
17207 |
|
17208 | var colors = this._getColorsSize();
|
17209 |
|
17210 | this._redrawBar(ctx, point, xWidth, yWidth, fill(colors), colors.border);
|
17211 | };
|
17212 |
|
17213 |
|
17214 |
|
17215 |
|
17216 |
|
17217 |
|
17218 |
|
17219 |
|
17220 |
|
17221 | Graph3d.prototype._redrawDotGraphPoint = function (ctx, point) {
|
17222 | var colors = this._getColorsRegular(point);
|
17223 |
|
17224 | this._drawCircle(ctx, point, fill(colors), colors.border);
|
17225 | };
|
17226 |
|
17227 |
|
17228 |
|
17229 |
|
17230 |
|
17231 |
|
17232 |
|
17233 |
|
17234 |
|
17235 | Graph3d.prototype._redrawDotLineGraphPoint = function (ctx, point) {
|
17236 |
|
17237 | var from = this._convert3Dto2D(point.bottom);
|
17238 |
|
17239 | ctx.lineWidth = 1;
|
17240 |
|
17241 | this._line(ctx, from, point.screen, this.gridColor);
|
17242 |
|
17243 | this._redrawDotGraphPoint(ctx, point);
|
17244 | };
|
17245 |
|
17246 |
|
17247 |
|
17248 |
|
17249 |
|
17250 |
|
17251 |
|
17252 |
|
17253 |
|
17254 | Graph3d.prototype._redrawDotColorGraphPoint = function (ctx, point) {
|
17255 | var colors = this._getColorsColor(point);
|
17256 |
|
17257 | this._drawCircle(ctx, point, fill(colors), colors.border);
|
17258 | };
|
17259 |
|
17260 |
|
17261 |
|
17262 |
|
17263 |
|
17264 |
|
17265 |
|
17266 |
|
17267 |
|
17268 | Graph3d.prototype._redrawDotSizeGraphPoint = function (ctx, point) {
|
17269 | var dotSize = this._dotSize();
|
17270 |
|
17271 | var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range();
|
17272 | var sizeMin = dotSize * this.dotSizeMinFraction;
|
17273 | var sizeRange = dotSize * this.dotSizeMaxFraction - sizeMin;
|
17274 | var size = sizeMin + sizeRange * fraction;
|
17275 |
|
17276 | var colors = this._getColorsSize();
|
17277 |
|
17278 | this._drawCircle(ctx, point, fill(colors), colors.border, size);
|
17279 | };
|
17280 |
|
17281 |
|
17282 |
|
17283 |
|
17284 |
|
17285 |
|
17286 |
|
17287 |
|
17288 |
|
17289 | Graph3d.prototype._redrawSurfaceGraphPoint = function (ctx, point) {
|
17290 | var right = point.pointRight;
|
17291 | var top = point.pointTop;
|
17292 | var cross = point.pointCross;
|
17293 |
|
17294 | if (point === undefined || right === undefined || top === undefined || cross === undefined) {
|
17295 | return;
|
17296 | }
|
17297 |
|
17298 | var topSideVisible = true;
|
17299 | var fillStyle;
|
17300 | var strokeStyle;
|
17301 | var cosViewAngle;
|
17302 |
|
17303 | if (this.showGrayBottom || this.showShadow) {
|
17304 |
|
17305 |
|
17306 |
|
17307 |
|
17308 | var aDiff = Point3d_1.subtract(cross.trans, point.trans);
|
17309 | var bDiff = Point3d_1.subtract(top.trans, right.trans);
|
17310 | var surfaceNormal = Point3d_1.crossProduct(aDiff, bDiff);
|
17311 |
|
17312 | if (this.showPerspective) {
|
17313 | var surfacePosition = Point3d_1.avg(Point3d_1.avg(point.trans, cross.trans), Point3d_1.avg(right.trans, top.trans));
|
17314 |
|
17315 |
|
17316 | cosViewAngle = -Point3d_1.dotProduct(surfaceNormal.normalize(), surfacePosition.normalize());
|
17317 | } else {
|
17318 | cosViewAngle = surfaceNormal.z / surfaceNormal.length();
|
17319 | }
|
17320 |
|
17321 | topSideVisible = cosViewAngle > 0;
|
17322 | }
|
17323 |
|
17324 | if (topSideVisible || !this.showGrayBottom) {
|
17325 | var vAvg = (point.point.value + right.point.value + top.point.value + cross.point.value) / 4;
|
17326 | var ratio = (vAvg - this.valueRange.min) * this.scale.value;
|
17327 |
|
17328 | var v = this.showShadow ? (1 + cosViewAngle) / 2 : 1;
|
17329 | fillStyle = this._colormap(ratio, v);
|
17330 | } else {
|
17331 | fillStyle = 'gray';
|
17332 | }
|
17333 |
|
17334 | if (this.showSurfaceGrid) {
|
17335 | strokeStyle = this.axisColor;
|
17336 | } else {
|
17337 | strokeStyle = fillStyle;
|
17338 | }
|
17339 |
|
17340 | ctx.lineWidth = this._getStrokeWidth(point);
|
17341 |
|
17342 | var points = [point, right, cross, top];
|
17343 |
|
17344 | this._polygon(ctx, points, fillStyle, strokeStyle);
|
17345 | };
|
17346 |
|
17347 |
|
17348 |
|
17349 |
|
17350 |
|
17351 |
|
17352 |
|
17353 |
|
17354 |
|
17355 |
|
17356 | Graph3d.prototype._drawGridLine = function (ctx, from, to) {
|
17357 | if (from === undefined || to === undefined) {
|
17358 | return;
|
17359 | }
|
17360 |
|
17361 | var vAvg = (from.point.value + to.point.value) / 2;
|
17362 | var f = (vAvg - this.valueRange.min) * this.scale.value;
|
17363 | ctx.lineWidth = this._getStrokeWidth(from) * 2;
|
17364 | ctx.strokeStyle = this._colormap(f, 1);
|
17365 |
|
17366 | this._line(ctx, from.screen, to.screen);
|
17367 | };
|
17368 |
|
17369 |
|
17370 |
|
17371 |
|
17372 |
|
17373 |
|
17374 |
|
17375 |
|
17376 |
|
17377 | Graph3d.prototype._redrawGridGraphPoint = function (ctx, point) {
|
17378 | this._drawGridLine(ctx, point, point.pointRight);
|
17379 |
|
17380 | this._drawGridLine(ctx, point, point.pointTop);
|
17381 | };
|
17382 |
|
17383 |
|
17384 |
|
17385 |
|
17386 |
|
17387 |
|
17388 |
|
17389 |
|
17390 |
|
17391 | Graph3d.prototype._redrawLineGraphPoint = function (ctx, point) {
|
17392 | if (point.pointNext === undefined) {
|
17393 | return;
|
17394 | }
|
17395 |
|
17396 | ctx.lineWidth = this._getStrokeWidth(point);
|
17397 | ctx.strokeStyle = this.dataColor.stroke;
|
17398 |
|
17399 | this._line(ctx, point.screen, point.pointNext.screen);
|
17400 | };
|
17401 |
|
17402 |
|
17403 |
|
17404 |
|
17405 |
|
17406 |
|
17407 | Graph3d.prototype._redrawDataGraph = function () {
|
17408 | var ctx = this._getContext();
|
17409 |
|
17410 | var i;
|
17411 | if (this.dataPoints === undefined || this.dataPoints.length <= 0) return;
|
17412 |
|
17413 | this._calcTranslations(this.dataPoints);
|
17414 |
|
17415 | for (i = 0; i < this.dataPoints.length; i++) {
|
17416 | var point = this.dataPoints[i];
|
17417 |
|
17418 | this._pointDrawingMethod.call(this, ctx, point);
|
17419 | }
|
17420 | };
|
17421 |
|
17422 |
|
17423 |
|
17424 |
|
17425 |
|
17426 |
|
17427 |
|
17428 |
|
17429 |
|
17430 |
|
17431 | Graph3d.prototype._storeMousePosition = function (event) {
|
17432 |
|
17433 | this.startMouseX = getMouseX(event);
|
17434 | this.startMouseY = getMouseY(event);
|
17435 | this._startCameraOffset = this.camera.getOffset();
|
17436 | };
|
17437 |
|
17438 |
|
17439 |
|
17440 |
|
17441 |
|
17442 |
|
17443 |
|
17444 | Graph3d.prototype._onMouseDown = function (event) {
|
17445 | event = event || window.event;
|
17446 |
|
17447 |
|
17448 | if (this.leftButtonDown) {
|
17449 | this._onMouseUp(event);
|
17450 | }
|
17451 |
|
17452 |
|
17453 | this.leftButtonDown = event.which ? event.which === 1 : event.button === 1;
|
17454 | if (!this.leftButtonDown && !this.touchDown) return;
|
17455 |
|
17456 | this._storeMousePosition(event);
|
17457 |
|
17458 | this.startStart = new Date(this.start);
|
17459 | this.startEnd = new Date(this.end);
|
17460 | this.startArmRotation = this.camera.getArmRotation();
|
17461 | this.frame.style.cursor = 'move';
|
17462 |
|
17463 |
|
17464 |
|
17465 | var me = this;
|
17466 |
|
17467 | this.onmousemove = function (event) {
|
17468 | me._onMouseMove(event);
|
17469 | };
|
17470 |
|
17471 | this.onmouseup = function (event) {
|
17472 | me._onMouseUp(event);
|
17473 | };
|
17474 |
|
17475 | addEventListener(document, 'mousemove', me.onmousemove);
|
17476 | addEventListener(document, 'mouseup', me.onmouseup);
|
17477 | preventDefault(event);
|
17478 | };
|
17479 |
|
17480 |
|
17481 |
|
17482 |
|
17483 |
|
17484 |
|
17485 |
|
17486 | Graph3d.prototype._onMouseMove = function (event) {
|
17487 | this.moving = true;
|
17488 | event = event || window.event;
|
17489 |
|
17490 | var diffX = _parseFloat(getMouseX(event)) - this.startMouseX;
|
17491 | var diffY = _parseFloat(getMouseY(event)) - this.startMouseY;
|
17492 |
|
17493 | if (event && event.ctrlKey === true) {
|
17494 |
|
17495 | var scaleX = this.frame.clientWidth * 0.5;
|
17496 | var scaleY = this.frame.clientHeight * 0.5;
|
17497 | var offXNew = (this._startCameraOffset.x || 0) - diffX / scaleX * this.camera.armLength * 0.8;
|
17498 | var offYNew = (this._startCameraOffset.y || 0) + diffY / scaleY * this.camera.armLength * 0.8;
|
17499 | this.camera.setOffset(offXNew, offYNew);
|
17500 |
|
17501 | this._storeMousePosition(event);
|
17502 | } else {
|
17503 | var horizontalNew = this.startArmRotation.horizontal + diffX / 200;
|
17504 | var verticalNew = this.startArmRotation.vertical + diffY / 200;
|
17505 | var snapAngle = 4;
|
17506 |
|
17507 | var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI);
|
17508 |
|
17509 |
|
17510 | if (Math.abs(Math.sin(horizontalNew)) < snapValue) {
|
17511 | horizontalNew = Math.round(horizontalNew / Math.PI) * Math.PI - 0.001;
|
17512 | }
|
17513 |
|
17514 | if (Math.abs(Math.cos(horizontalNew)) < snapValue) {
|
17515 | horizontalNew = (Math.round(horizontalNew / Math.PI - 0.5) + 0.5) * Math.PI - 0.001;
|
17516 | }
|
17517 |
|
17518 |
|
17519 | if (Math.abs(Math.sin(verticalNew)) < snapValue) {
|
17520 | verticalNew = Math.round(verticalNew / Math.PI) * Math.PI;
|
17521 | }
|
17522 |
|
17523 | if (Math.abs(Math.cos(verticalNew)) < snapValue) {
|
17524 | verticalNew = (Math.round(verticalNew / Math.PI - 0.5) + 0.5) * Math.PI;
|
17525 | }
|
17526 |
|
17527 | this.camera.setArmRotation(horizontalNew, verticalNew);
|
17528 | }
|
17529 |
|
17530 | this.redraw();
|
17531 |
|
17532 | var parameters = this.getCameraPosition();
|
17533 | this.emit('cameraPositionChange', parameters);
|
17534 | preventDefault(event);
|
17535 | };
|
17536 |
|
17537 |
|
17538 |
|
17539 |
|
17540 |
|
17541 |
|
17542 |
|
17543 | Graph3d.prototype._onMouseUp = function (event) {
|
17544 | this.frame.style.cursor = 'auto';
|
17545 | this.leftButtonDown = false;
|
17546 |
|
17547 | removeEventListener(document, 'mousemove', this.onmousemove);
|
17548 | removeEventListener(document, 'mouseup', this.onmouseup);
|
17549 | preventDefault(event);
|
17550 | };
|
17551 |
|
17552 |
|
17553 |
|
17554 |
|
17555 |
|
17556 | Graph3d.prototype._onClick = function (event) {
|
17557 |
|
17558 | if (!this.onclick_callback && !this.hasListeners('click')) return;
|
17559 |
|
17560 | if (!this.moving) {
|
17561 | var boundingRect = this.frame.getBoundingClientRect();
|
17562 | var mouseX = getMouseX(event) - boundingRect.left;
|
17563 | var mouseY = getMouseY(event) - boundingRect.top;
|
17564 |
|
17565 | var dataPoint = this._dataPointFromXY(mouseX, mouseY);
|
17566 |
|
17567 | if (dataPoint) {
|
17568 | if (this.onclick_callback) this.onclick_callback(dataPoint.point.data);
|
17569 | this.emit('click', dataPoint.point.data);
|
17570 | }
|
17571 | } else {
|
17572 |
|
17573 | this.moving = false;
|
17574 | }
|
17575 |
|
17576 | preventDefault(event);
|
17577 | };
|
17578 |
|
17579 |
|
17580 |
|
17581 |
|
17582 |
|
17583 |
|
17584 | Graph3d.prototype._onTooltip = function (event) {
|
17585 | var delay = this.tooltipDelay;
|
17586 |
|
17587 | var boundingRect = this.frame.getBoundingClientRect();
|
17588 | var mouseX = getMouseX(event) - boundingRect.left;
|
17589 | var mouseY = getMouseY(event) - boundingRect.top;
|
17590 |
|
17591 | if (!this.showTooltip) {
|
17592 | return;
|
17593 | }
|
17594 |
|
17595 | if (this.tooltipTimeout) {
|
17596 | clearTimeout(this.tooltipTimeout);
|
17597 | }
|
17598 |
|
17599 |
|
17600 | if (this.leftButtonDown) {
|
17601 | this._hideTooltip();
|
17602 |
|
17603 | return;
|
17604 | }
|
17605 |
|
17606 | if (this.tooltip && this.tooltip.dataPoint) {
|
17607 |
|
17608 | var dataPoint = this._dataPointFromXY(mouseX, mouseY);
|
17609 |
|
17610 | if (dataPoint !== this.tooltip.dataPoint) {
|
17611 |
|
17612 | if (dataPoint) {
|
17613 | this._showTooltip(dataPoint);
|
17614 | } else {
|
17615 | this._hideTooltip();
|
17616 | }
|
17617 | }
|
17618 | } else {
|
17619 |
|
17620 | var me = this;
|
17621 | this.tooltipTimeout = setTimeout$1(function () {
|
17622 | me.tooltipTimeout = null;
|
17623 |
|
17624 | var dataPoint = me._dataPointFromXY(mouseX, mouseY);
|
17625 |
|
17626 | if (dataPoint) {
|
17627 | me._showTooltip(dataPoint);
|
17628 | }
|
17629 | }, delay);
|
17630 | }
|
17631 | };
|
17632 |
|
17633 |
|
17634 |
|
17635 |
|
17636 |
|
17637 |
|
17638 | Graph3d.prototype._onTouchStart = function (event) {
|
17639 | this.touchDown = true;
|
17640 | var me = this;
|
17641 |
|
17642 | this.ontouchmove = function (event) {
|
17643 | me._onTouchMove(event);
|
17644 | };
|
17645 |
|
17646 | this.ontouchend = function (event) {
|
17647 | me._onTouchEnd(event);
|
17648 | };
|
17649 |
|
17650 | addEventListener(document, 'touchmove', me.ontouchmove);
|
17651 | addEventListener(document, 'touchend', me.ontouchend);
|
17652 |
|
17653 | this._onMouseDown(event);
|
17654 | };
|
17655 |
|
17656 |
|
17657 |
|
17658 |
|
17659 |
|
17660 |
|
17661 | Graph3d.prototype._onTouchMove = function (event) {
|
17662 | this._onMouseMove(event);
|
17663 | };
|
17664 |
|
17665 |
|
17666 |
|
17667 |
|
17668 |
|
17669 |
|
17670 | Graph3d.prototype._onTouchEnd = function (event) {
|
17671 | this.touchDown = false;
|
17672 | removeEventListener(document, 'touchmove', this.ontouchmove);
|
17673 | removeEventListener(document, 'touchend', this.ontouchend);
|
17674 |
|
17675 | this._onMouseUp(event);
|
17676 | };
|
17677 |
|
17678 |
|
17679 |
|
17680 |
|
17681 |
|
17682 |
|
17683 |
|
17684 | Graph3d.prototype._onWheel = function (event) {
|
17685 | if (!event)
|
17686 |
|
17687 | event = window.event;
|
17688 |
|
17689 | if (this.zoomable && (!this.ctrlToZoom || event.ctrlKey)) {
|
17690 |
|
17691 | var delta = 0;
|
17692 |
|
17693 | if (event.wheelDelta) {
|
17694 |
|
17695 | delta = event.wheelDelta / 120;
|
17696 | } else if (event.detail) {
|
17697 |
|
17698 |
|
17699 |
|
17700 | delta = -event.detail / 3;
|
17701 | }
|
17702 |
|
17703 |
|
17704 |
|
17705 |
|
17706 | if (delta) {
|
17707 | var oldLength = this.camera.getArmLength();
|
17708 | var newLength = oldLength * (1 - delta / 10);
|
17709 | this.camera.setArmLength(newLength);
|
17710 | this.redraw();
|
17711 |
|
17712 | this._hideTooltip();
|
17713 | }
|
17714 |
|
17715 |
|
17716 | var parameters = this.getCameraPosition();
|
17717 | this.emit('cameraPositionChange', parameters);
|
17718 |
|
17719 |
|
17720 |
|
17721 | preventDefault(event);
|
17722 | }
|
17723 | };
|
17724 |
|
17725 |
|
17726 |
|
17727 |
|
17728 |
|
17729 |
|
17730 |
|
17731 |
|
17732 |
|
17733 |
|
17734 |
|
17735 | Graph3d.prototype._insideTriangle = function (point, triangle) {
|
17736 | var a = triangle[0],
|
17737 | b = triangle[1],
|
17738 | c = triangle[2];
|
17739 | |
17740 |
|
17741 |
|
17742 |
|
17743 |
|
17744 |
|
17745 | function sign(x) {
|
17746 | return x > 0 ? 1 : x < 0 ? -1 : 0;
|
17747 | }
|
17748 |
|
17749 | var as = sign((b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x));
|
17750 | var bs = sign((c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x));
|
17751 | var cs = sign((a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x));
|
17752 |
|
17753 | return (as == 0 || bs == 0 || as == bs) && (bs == 0 || cs == 0 || bs == cs) && (as == 0 || cs == 0 || as == cs);
|
17754 | };
|
17755 |
|
17756 |
|
17757 |
|
17758 |
|
17759 |
|
17760 |
|
17761 |
|
17762 |
|
17763 |
|
17764 |
|
17765 |
|
17766 | Graph3d.prototype._dataPointFromXY = function (x, y) {
|
17767 | var i,
|
17768 | distMax = 100,
|
17769 |
|
17770 | dataPoint = null,
|
17771 | closestDataPoint = null,
|
17772 | closestDist = null,
|
17773 | center = new Point2d_1(x, y);
|
17774 |
|
17775 | if (this.style === Graph3d.STYLE.BAR || this.style === Graph3d.STYLE.BARCOLOR || this.style === Graph3d.STYLE.BARSIZE) {
|
17776 |
|
17777 | for (i = this.dataPoints.length - 1; i >= 0; i--) {
|
17778 | dataPoint = this.dataPoints[i];
|
17779 | var surfaces = dataPoint.surfaces;
|
17780 |
|
17781 | if (surfaces) {
|
17782 | for (var s = surfaces.length - 1; s >= 0; s--) {
|
17783 |
|
17784 | var surface = surfaces[s];
|
17785 | var corners = surface.corners;
|
17786 | var triangle1 = [corners[0].screen, corners[1].screen, corners[2].screen];
|
17787 | var triangle2 = [corners[2].screen, corners[3].screen, corners[0].screen];
|
17788 |
|
17789 | if (this._insideTriangle(center, triangle1) || this._insideTriangle(center, triangle2)) {
|
17790 |
|
17791 | return dataPoint;
|
17792 | }
|
17793 | }
|
17794 | }
|
17795 | }
|
17796 | } else {
|
17797 |
|
17798 | for (i = 0; i < this.dataPoints.length; i++) {
|
17799 | dataPoint = this.dataPoints[i];
|
17800 | var point = dataPoint.screen;
|
17801 |
|
17802 | if (point) {
|
17803 | var distX = Math.abs(x - point.x);
|
17804 | var distY = Math.abs(y - point.y);
|
17805 | var dist = Math.sqrt(distX * distX + distY * distY);
|
17806 |
|
17807 | if ((closestDist === null || dist < closestDist) && dist < distMax) {
|
17808 | closestDist = dist;
|
17809 | closestDataPoint = dataPoint;
|
17810 | }
|
17811 | }
|
17812 | }
|
17813 | }
|
17814 |
|
17815 | return closestDataPoint;
|
17816 | };
|
17817 |
|
17818 |
|
17819 |
|
17820 |
|
17821 |
|
17822 |
|
17823 |
|
17824 |
|
17825 | Graph3d.prototype.hasBars = function (style) {
|
17826 | return style == Graph3d.STYLE.BAR || style == Graph3d.STYLE.BARCOLOR || style == Graph3d.STYLE.BARSIZE;
|
17827 | };
|
17828 |
|
17829 |
|
17830 |
|
17831 |
|
17832 |
|
17833 |
|
17834 |
|
17835 | Graph3d.prototype._showTooltip = function (dataPoint) {
|
17836 | var content, line, dot;
|
17837 |
|
17838 | if (!this.tooltip) {
|
17839 | content = document.createElement('div');
|
17840 |
|
17841 | assign$2(content.style, {}, this.tooltipStyle.content);
|
17842 |
|
17843 | content.style.position = 'absolute';
|
17844 | line = document.createElement('div');
|
17845 |
|
17846 | assign$2(line.style, {}, this.tooltipStyle.line);
|
17847 |
|
17848 | line.style.position = 'absolute';
|
17849 | dot = document.createElement('div');
|
17850 |
|
17851 | assign$2(dot.style, {}, this.tooltipStyle.dot);
|
17852 |
|
17853 | dot.style.position = 'absolute';
|
17854 | this.tooltip = {
|
17855 | dataPoint: null,
|
17856 | dom: {
|
17857 | content: content,
|
17858 | line: line,
|
17859 | dot: dot
|
17860 | }
|
17861 | };
|
17862 | } else {
|
17863 | content = this.tooltip.dom.content;
|
17864 | line = this.tooltip.dom.line;
|
17865 | dot = this.tooltip.dom.dot;
|
17866 | }
|
17867 |
|
17868 | this._hideTooltip();
|
17869 |
|
17870 | this.tooltip.dataPoint = dataPoint;
|
17871 |
|
17872 | if (typeof this.showTooltip === 'function') {
|
17873 | content.innerHTML = this.showTooltip(dataPoint.point);
|
17874 | } else {
|
17875 | content.innerHTML = '<table>' + '<tr><td>' + this.xLabel + ':</td><td>' + dataPoint.point.x + '</td></tr>' + '<tr><td>' + this.yLabel + ':</td><td>' + dataPoint.point.y + '</td></tr>' + '<tr><td>' + this.zLabel + ':</td><td>' + dataPoint.point.z + '</td></tr>' + '</table>';
|
17876 | }
|
17877 |
|
17878 | content.style.left = '0';
|
17879 | content.style.top = '0';
|
17880 | this.frame.appendChild(content);
|
17881 | this.frame.appendChild(line);
|
17882 | this.frame.appendChild(dot);
|
17883 |
|
17884 | var contentWidth = content.offsetWidth;
|
17885 | var contentHeight = content.offsetHeight;
|
17886 | var lineHeight = line.offsetHeight;
|
17887 | var dotWidth = dot.offsetWidth;
|
17888 | var dotHeight = dot.offsetHeight;
|
17889 | var left = dataPoint.screen.x - contentWidth / 2;
|
17890 | left = Math.min(Math.max(left, 10), this.frame.clientWidth - 10 - contentWidth);
|
17891 | line.style.left = dataPoint.screen.x + 'px';
|
17892 | line.style.top = dataPoint.screen.y - lineHeight + 'px';
|
17893 | content.style.left = left + 'px';
|
17894 | content.style.top = dataPoint.screen.y - lineHeight - contentHeight + 'px';
|
17895 | dot.style.left = dataPoint.screen.x - dotWidth / 2 + 'px';
|
17896 | dot.style.top = dataPoint.screen.y - dotHeight / 2 + 'px';
|
17897 | };
|
17898 |
|
17899 |
|
17900 |
|
17901 |
|
17902 |
|
17903 |
|
17904 | Graph3d.prototype._hideTooltip = function () {
|
17905 | if (this.tooltip) {
|
17906 | this.tooltip.dataPoint = null;
|
17907 |
|
17908 | for (var prop in this.tooltip.dom) {
|
17909 | if (this.tooltip.dom.hasOwnProperty(prop)) {
|
17910 | var elem = this.tooltip.dom[prop];
|
17911 |
|
17912 | if (elem && elem.parentNode) {
|
17913 | elem.parentNode.removeChild(elem);
|
17914 | }
|
17915 | }
|
17916 | }
|
17917 | }
|
17918 | };
|
17919 |
|
17920 |
|
17921 |
|
17922 |
|
17923 |
|
17924 |
|
17925 |
|
17926 |
|
17927 |
|
17928 |
|
17929 | function getMouseX(event) {
|
17930 | if ('clientX' in event) return event.clientX;
|
17931 | return event.targetTouches[0] && event.targetTouches[0].clientX || 0;
|
17932 | }
|
17933 |
|
17934 |
|
17935 |
|
17936 |
|
17937 |
|
17938 |
|
17939 |
|
17940 |
|
17941 | function getMouseY(event) {
|
17942 | if ('clientY' in event) return event.clientY;
|
17943 | return event.targetTouches[0] && event.targetTouches[0].clientY || 0;
|
17944 | }
|
17945 |
|
17946 |
|
17947 |
|
17948 |
|
17949 |
|
17950 |
|
17951 |
|
17952 |
|
17953 |
|
17954 |
|
17955 |
|
17956 |
|
17957 |
|
17958 |
|
17959 |
|
17960 |
|
17961 |
|
17962 |
|
17963 | Graph3d.prototype.setCameraPosition = function (pos) {
|
17964 | setCameraPosition(pos, this);
|
17965 | this.redraw();
|
17966 | };
|
17967 |
|
17968 |
|
17969 |
|
17970 |
|
17971 |
|
17972 |
|
17973 |
|
17974 |
|
17975 |
|
17976 |
|
17977 | Graph3d.prototype.setSize = function (width, height) {
|
17978 | this._setSize(width, height);
|
17979 |
|
17980 | this.redraw();
|
17981 | };
|
17982 |
|
17983 | export { DELETE, DataSet, DataStream, DataView, Graph3d, Camera as Graph3dCamera, Filter as Graph3dFilter, Point2d_1 as Graph3dPoint2d, Point3d_1 as Graph3dPoint3d, Slider as Graph3dSlider, StepNumber_1 as Graph3dStepNumber, Queue, createNewDataPipeFrom, isDataSetLike, isDataViewLike };
|
17984 |
|