1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | (function (factory) {
|
9 | typeof define === 'function' && define.amd ? define(factory) :
|
10 | factory();
|
11 | }(function () { 'use strict';
|
12 |
|
13 | var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
14 |
|
15 | function createCommonjsModule(fn, module) {
|
16 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
17 | }
|
18 |
|
19 | var O = 'object';
|
20 | var check = function (it) {
|
21 | return it && it.Math == Math && it;
|
22 | };
|
23 |
|
24 |
|
25 | var global_1 =
|
26 |
|
27 | check(typeof globalThis == O && globalThis) ||
|
28 | check(typeof window == O && window) ||
|
29 | check(typeof self == O && self) ||
|
30 | check(typeof commonjsGlobal == O && commonjsGlobal) ||
|
31 |
|
32 | Function('return this')();
|
33 |
|
34 | var fails = function (exec) {
|
35 | try {
|
36 | return !!exec();
|
37 | } catch (error) {
|
38 | return true;
|
39 | }
|
40 | };
|
41 |
|
42 |
|
43 | var descriptors = !fails(function () {
|
44 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
45 | });
|
46 |
|
47 | var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
|
48 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
49 |
|
50 |
|
51 | var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
|
52 |
|
53 |
|
54 |
|
55 | var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
56 | var descriptor = getOwnPropertyDescriptor(this, V);
|
57 | return !!descriptor && descriptor.enumerable;
|
58 | } : nativePropertyIsEnumerable;
|
59 |
|
60 | var objectPropertyIsEnumerable = {
|
61 | f: f
|
62 | };
|
63 |
|
64 | var createPropertyDescriptor = function (bitmap, value) {
|
65 | return {
|
66 | enumerable: !(bitmap & 1),
|
67 | configurable: !(bitmap & 2),
|
68 | writable: !(bitmap & 4),
|
69 | value: value
|
70 | };
|
71 | };
|
72 |
|
73 | var toString = {}.toString;
|
74 |
|
75 | var classofRaw = function (it) {
|
76 | return toString.call(it).slice(8, -1);
|
77 | };
|
78 |
|
79 | var split = ''.split;
|
80 |
|
81 |
|
82 | var indexedObject = fails(function () {
|
83 |
|
84 |
|
85 | return !Object('z').propertyIsEnumerable(0);
|
86 | }) ? function (it) {
|
87 | return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
|
88 | } : Object;
|
89 |
|
90 |
|
91 |
|
92 | var requireObjectCoercible = function (it) {
|
93 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
94 | return it;
|
95 | };
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | var toIndexedObject = function (it) {
|
102 | return indexedObject(requireObjectCoercible(it));
|
103 | };
|
104 |
|
105 | var isObject = function (it) {
|
106 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
107 | };
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | var toPrimitive = function (input, PREFERRED_STRING) {
|
114 | if (!isObject(input)) return input;
|
115 | var fn, val;
|
116 | if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
117 | if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
|
118 | if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
119 | throw TypeError("Can't convert object to primitive value");
|
120 | };
|
121 |
|
122 | var hasOwnProperty = {}.hasOwnProperty;
|
123 |
|
124 | var has = function (it, key) {
|
125 | return hasOwnProperty.call(it, key);
|
126 | };
|
127 |
|
128 | var document = global_1.document;
|
129 |
|
130 | var EXISTS = isObject(document) && isObject(document.createElement);
|
131 |
|
132 | var documentCreateElement = function (it) {
|
133 | return EXISTS ? document.createElement(it) : {};
|
134 | };
|
135 |
|
136 |
|
137 | var ie8DomDefine = !descriptors && !fails(function () {
|
138 | return Object.defineProperty(documentCreateElement('div'), 'a', {
|
139 | get: function () { return 7; }
|
140 | }).a != 7;
|
141 | });
|
142 |
|
143 | var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
144 |
|
145 |
|
146 |
|
147 | var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
148 | O = toIndexedObject(O);
|
149 | P = toPrimitive(P, true);
|
150 | if (ie8DomDefine) try {
|
151 | return nativeGetOwnPropertyDescriptor(O, P);
|
152 | } catch (error) { }
|
153 | if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
|
154 | };
|
155 |
|
156 | var objectGetOwnPropertyDescriptor = {
|
157 | f: f$1
|
158 | };
|
159 |
|
160 | var anObject = function (it) {
|
161 | if (!isObject(it)) {
|
162 | throw TypeError(String(it) + ' is not an object');
|
163 | } return it;
|
164 | };
|
165 |
|
166 | var nativeDefineProperty = Object.defineProperty;
|
167 |
|
168 |
|
169 |
|
170 | var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
171 | anObject(O);
|
172 | P = toPrimitive(P, true);
|
173 | anObject(Attributes);
|
174 | if (ie8DomDefine) try {
|
175 | return nativeDefineProperty(O, P, Attributes);
|
176 | } catch (error) { }
|
177 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
178 | if ('value' in Attributes) O[P] = Attributes.value;
|
179 | return O;
|
180 | };
|
181 |
|
182 | var objectDefineProperty = {
|
183 | f: f$2
|
184 | };
|
185 |
|
186 | var hide = descriptors ? function (object, key, value) {
|
187 | return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
188 | } : function (object, key, value) {
|
189 | object[key] = value;
|
190 | return object;
|
191 | };
|
192 |
|
193 | var setGlobal = function (key, value) {
|
194 | try {
|
195 | hide(global_1, key, value);
|
196 | } catch (error) {
|
197 | global_1[key] = value;
|
198 | } return value;
|
199 | };
|
200 |
|
201 | var shared = createCommonjsModule(function (module) {
|
202 | var SHARED = '__core-js_shared__';
|
203 | var store = global_1[SHARED] || setGlobal(SHARED, {});
|
204 |
|
205 | (module.exports = function (key, value) {
|
206 | return store[key] || (store[key] = value !== undefined ? value : {});
|
207 | })('versions', []).push({
|
208 | version: '3.2.1',
|
209 | mode: 'global',
|
210 | copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
211 | });
|
212 | });
|
213 |
|
214 | var functionToString = shared('native-function-to-string', Function.toString);
|
215 |
|
216 | var WeakMap = global_1.WeakMap;
|
217 |
|
218 | var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
|
219 |
|
220 | var id = 0;
|
221 | var postfix = Math.random();
|
222 |
|
223 | var uid = function (key) {
|
224 | return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
|
225 | };
|
226 |
|
227 | var keys = shared('keys');
|
228 |
|
229 | var sharedKey = function (key) {
|
230 | return keys[key] || (keys[key] = uid(key));
|
231 | };
|
232 |
|
233 | var hiddenKeys = {};
|
234 |
|
235 | var WeakMap$1 = global_1.WeakMap;
|
236 | var set, get, has$1;
|
237 |
|
238 | var enforce = function (it) {
|
239 | return has$1(it) ? get(it) : set(it, {});
|
240 | };
|
241 |
|
242 | var getterFor = function (TYPE) {
|
243 | return function (it) {
|
244 | var state;
|
245 | if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
246 | throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
247 | } return state;
|
248 | };
|
249 | };
|
250 |
|
251 | if (nativeWeakMap) {
|
252 | var store = new WeakMap$1();
|
253 | var wmget = store.get;
|
254 | var wmhas = store.has;
|
255 | var wmset = store.set;
|
256 | set = function (it, metadata) {
|
257 | wmset.call(store, it, metadata);
|
258 | return metadata;
|
259 | };
|
260 | get = function (it) {
|
261 | return wmget.call(store, it) || {};
|
262 | };
|
263 | has$1 = function (it) {
|
264 | return wmhas.call(store, it);
|
265 | };
|
266 | } else {
|
267 | var STATE = sharedKey('state');
|
268 | hiddenKeys[STATE] = true;
|
269 | set = function (it, metadata) {
|
270 | hide(it, STATE, metadata);
|
271 | return metadata;
|
272 | };
|
273 | get = function (it) {
|
274 | return has(it, STATE) ? it[STATE] : {};
|
275 | };
|
276 | has$1 = function (it) {
|
277 | return has(it, STATE);
|
278 | };
|
279 | }
|
280 |
|
281 | var internalState = {
|
282 | set: set,
|
283 | get: get,
|
284 | has: has$1,
|
285 | enforce: enforce,
|
286 | getterFor: getterFor
|
287 | };
|
288 |
|
289 | var redefine = createCommonjsModule(function (module) {
|
290 | var getInternalState = internalState.get;
|
291 | var enforceInternalState = internalState.enforce;
|
292 | var TEMPLATE = String(functionToString).split('toString');
|
293 |
|
294 | shared('inspectSource', function (it) {
|
295 | return functionToString.call(it);
|
296 | });
|
297 |
|
298 | (module.exports = function (O, key, value, options) {
|
299 | var unsafe = options ? !!options.unsafe : false;
|
300 | var simple = options ? !!options.enumerable : false;
|
301 | var noTargetGet = options ? !!options.noTargetGet : false;
|
302 | if (typeof value == 'function') {
|
303 | if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
|
304 | enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
|
305 | }
|
306 | if (O === global_1) {
|
307 | if (simple) O[key] = value;
|
308 | else setGlobal(key, value);
|
309 | return;
|
310 | } else if (!unsafe) {
|
311 | delete O[key];
|
312 | } else if (!noTargetGet && O[key]) {
|
313 | simple = true;
|
314 | }
|
315 | if (simple) O[key] = value;
|
316 | else hide(O, key, value);
|
317 |
|
318 | })(Function.prototype, 'toString', function toString() {
|
319 | return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
|
320 | });
|
321 | });
|
322 |
|
323 | var path = global_1;
|
324 |
|
325 | var aFunction = function (variable) {
|
326 | return typeof variable == 'function' ? variable : undefined;
|
327 | };
|
328 |
|
329 | var getBuiltIn = function (namespace, method) {
|
330 | return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
|
331 | : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
|
332 | };
|
333 |
|
334 | var ceil = Math.ceil;
|
335 | var floor = Math.floor;
|
336 |
|
337 |
|
338 |
|
339 | var toInteger = function (argument) {
|
340 | return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
|
341 | };
|
342 |
|
343 | var min = Math.min;
|
344 |
|
345 |
|
346 |
|
347 | var toLength = function (argument) {
|
348 | return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0;
|
349 | };
|
350 |
|
351 | var max = Math.max;
|
352 | var min$1 = Math.min;
|
353 |
|
354 |
|
355 |
|
356 |
|
357 | var toAbsoluteIndex = function (index, length) {
|
358 | var integer = toInteger(index);
|
359 | return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
360 | };
|
361 |
|
362 |
|
363 | var createMethod = function (IS_INCLUDES) {
|
364 | return function ($this, el, fromIndex) {
|
365 | var O = toIndexedObject($this);
|
366 | var length = toLength(O.length);
|
367 | var index = toAbsoluteIndex(fromIndex, length);
|
368 | var value;
|
369 |
|
370 |
|
371 | if (IS_INCLUDES && el != el) while (length > index) {
|
372 | value = O[index++];
|
373 |
|
374 | if (value != value) return true;
|
375 |
|
376 | } else for (;length > index; index++) {
|
377 | if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
378 | } return !IS_INCLUDES && -1;
|
379 | };
|
380 | };
|
381 |
|
382 | var arrayIncludes = {
|
383 |
|
384 |
|
385 | includes: createMethod(true),
|
386 |
|
387 |
|
388 | indexOf: createMethod(false)
|
389 | };
|
390 |
|
391 | var indexOf = arrayIncludes.indexOf;
|
392 |
|
393 |
|
394 | var objectKeysInternal = function (object, names) {
|
395 | var O = toIndexedObject(object);
|
396 | var i = 0;
|
397 | var result = [];
|
398 | var key;
|
399 | for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
|
400 |
|
401 | while (names.length > i) if (has(O, key = names[i++])) {
|
402 | ~indexOf(result, key) || result.push(key);
|
403 | }
|
404 | return result;
|
405 | };
|
406 |
|
407 |
|
408 | var enumBugKeys = [
|
409 | 'constructor',
|
410 | 'hasOwnProperty',
|
411 | 'isPrototypeOf',
|
412 | 'propertyIsEnumerable',
|
413 | 'toLocaleString',
|
414 | 'toString',
|
415 | 'valueOf'
|
416 | ];
|
417 |
|
418 | var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
|
419 |
|
420 |
|
421 |
|
422 | var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
423 | return objectKeysInternal(O, hiddenKeys$1);
|
424 | };
|
425 |
|
426 | var objectGetOwnPropertyNames = {
|
427 | f: f$3
|
428 | };
|
429 |
|
430 | var f$4 = Object.getOwnPropertySymbols;
|
431 |
|
432 | var objectGetOwnPropertySymbols = {
|
433 | f: f$4
|
434 | };
|
435 |
|
436 |
|
437 | var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
438 | var keys = objectGetOwnPropertyNames.f(anObject(it));
|
439 | var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
440 | return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
441 | };
|
442 |
|
443 | var copyConstructorProperties = function (target, source) {
|
444 | var keys = ownKeys(source);
|
445 | var defineProperty = objectDefineProperty.f;
|
446 | var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
447 | for (var i = 0; i < keys.length; i++) {
|
448 | var key = keys[i];
|
449 | if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
450 | }
|
451 | };
|
452 |
|
453 | var replacement = /#|\.prototype\./;
|
454 |
|
455 | var isForced = function (feature, detection) {
|
456 | var value = data[normalize(feature)];
|
457 | return value == POLYFILL ? true
|
458 | : value == NATIVE ? false
|
459 | : typeof detection == 'function' ? fails(detection)
|
460 | : !!detection;
|
461 | };
|
462 |
|
463 | var normalize = isForced.normalize = function (string) {
|
464 | return String(string).replace(replacement, '.').toLowerCase();
|
465 | };
|
466 |
|
467 | var data = isForced.data = {};
|
468 | var NATIVE = isForced.NATIVE = 'N';
|
469 | var POLYFILL = isForced.POLYFILL = 'P';
|
470 |
|
471 | var isForced_1 = isForced;
|
472 |
|
473 | var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 | |
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 | var _export = function (options, source) {
|
495 | var TARGET = options.target;
|
496 | var GLOBAL = options.global;
|
497 | var STATIC = options.stat;
|
498 | var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
499 | if (GLOBAL) {
|
500 | target = global_1;
|
501 | } else if (STATIC) {
|
502 | target = global_1[TARGET] || setGlobal(TARGET, {});
|
503 | } else {
|
504 | target = (global_1[TARGET] || {}).prototype;
|
505 | }
|
506 | if (target) for (key in source) {
|
507 | sourceProperty = source[key];
|
508 | if (options.noTargetGet) {
|
509 | descriptor = getOwnPropertyDescriptor$1(target, key);
|
510 | targetProperty = descriptor && descriptor.value;
|
511 | } else targetProperty = target[key];
|
512 | FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
513 |
|
514 | if (!FORCED && targetProperty !== undefined) {
|
515 | if (typeof sourceProperty === typeof targetProperty) continue;
|
516 | copyConstructorProperties(sourceProperty, targetProperty);
|
517 | }
|
518 |
|
519 | if (options.sham || (targetProperty && targetProperty.sham)) {
|
520 | hide(sourceProperty, 'sham', true);
|
521 | }
|
522 |
|
523 | redefine(target, key, sourceProperty, options);
|
524 | }
|
525 | };
|
526 |
|
527 | var aFunction$1 = function (it) {
|
528 | if (typeof it != 'function') {
|
529 | throw TypeError(String(it) + ' is not a function');
|
530 | } return it;
|
531 | };
|
532 |
|
533 |
|
534 | var bindContext = function (fn, that, length) {
|
535 | aFunction$1(fn);
|
536 | if (that === undefined) return fn;
|
537 | switch (length) {
|
538 | case 0: return function () {
|
539 | return fn.call(that);
|
540 | };
|
541 | case 1: return function (a) {
|
542 | return fn.call(that, a);
|
543 | };
|
544 | case 2: return function (a, b) {
|
545 | return fn.call(that, a, b);
|
546 | };
|
547 | case 3: return function (a, b, c) {
|
548 | return fn.call(that, a, b, c);
|
549 | };
|
550 | }
|
551 | return function (/* ...args */) {
|
552 | return fn.apply(that, arguments);
|
553 | };
|
554 | };
|
555 |
|
556 |
|
557 |
|
558 | var toObject = function (argument) {
|
559 | return Object(requireObjectCoercible(argument));
|
560 | };
|
561 |
|
562 |
|
563 |
|
564 | var isArray = Array.isArray || function isArray(arg) {
|
565 | return classofRaw(arg) == 'Array';
|
566 | };
|
567 |
|
568 | var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
569 |
|
570 |
|
571 | return !String(Symbol());
|
572 | });
|
573 |
|
574 | var Symbol$1 = global_1.Symbol;
|
575 | var store$1 = shared('wks');
|
576 |
|
577 | var wellKnownSymbol = function (name) {
|
578 | return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
|
579 | || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
|
580 | };
|
581 |
|
582 | var SPECIES = wellKnownSymbol('species');
|
583 |
|
584 |
|
585 |
|
586 | var arraySpeciesCreate = function (originalArray, length) {
|
587 | var C;
|
588 | if (isArray(originalArray)) {
|
589 | C = originalArray.constructor;
|
590 |
|
591 | if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
|
592 | else if (isObject(C)) {
|
593 | C = C[SPECIES];
|
594 | if (C === null) C = undefined;
|
595 | }
|
596 | } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
|
597 | };
|
598 |
|
599 | var push = [].push;
|
600 |
|
601 |
|
602 | var createMethod$1 = function (TYPE) {
|
603 | var IS_MAP = TYPE == 1;
|
604 | var IS_FILTER = TYPE == 2;
|
605 | var IS_SOME = TYPE == 3;
|
606 | var IS_EVERY = TYPE == 4;
|
607 | var IS_FIND_INDEX = TYPE == 6;
|
608 | var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
609 | return function ($this, callbackfn, that, specificCreate) {
|
610 | var O = toObject($this);
|
611 | var self = indexedObject(O);
|
612 | var boundFunction = bindContext(callbackfn, that, 3);
|
613 | var length = toLength(self.length);
|
614 | var index = 0;
|
615 | var create = specificCreate || arraySpeciesCreate;
|
616 | var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
|
617 | var value, result;
|
618 | for (;length > index; index++) if (NO_HOLES || index in self) {
|
619 | value = self[index];
|
620 | result = boundFunction(value, index, O);
|
621 | if (TYPE) {
|
622 | if (IS_MAP) target[index] = result;
|
623 | else if (result) switch (TYPE) {
|
624 | case 3: return true;
|
625 | case 5: return value;
|
626 | case 6: return index;
|
627 | case 2: push.call(target, value);
|
628 | } else if (IS_EVERY) return false;
|
629 | }
|
630 | }
|
631 | return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
632 | };
|
633 | };
|
634 |
|
635 | var arrayIteration = {
|
636 |
|
637 |
|
638 | forEach: createMethod$1(0),
|
639 |
|
640 |
|
641 | map: createMethod$1(1),
|
642 |
|
643 |
|
644 | filter: createMethod$1(2),
|
645 |
|
646 |
|
647 | some: createMethod$1(3),
|
648 |
|
649 |
|
650 | every: createMethod$1(4),
|
651 |
|
652 |
|
653 | find: createMethod$1(5),
|
654 |
|
655 |
|
656 | findIndex: createMethod$1(6)
|
657 | };
|
658 |
|
659 |
|
660 |
|
661 | var objectKeys = Object.keys || function keys(O) {
|
662 | return objectKeysInternal(O, enumBugKeys);
|
663 | };
|
664 |
|
665 |
|
666 |
|
667 | var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
|
668 | anObject(O);
|
669 | var keys = objectKeys(Properties);
|
670 | var length = keys.length;
|
671 | var index = 0;
|
672 | var key;
|
673 | while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
|
674 | return O;
|
675 | };
|
676 |
|
677 | var html = getBuiltIn('document', 'documentElement');
|
678 |
|
679 | var IE_PROTO = sharedKey('IE_PROTO');
|
680 |
|
681 | var PROTOTYPE = 'prototype';
|
682 | var Empty = function () { };
|
683 |
|
684 |
|
685 | var createDict = function () {
|
686 |
|
687 | var iframe = documentCreateElement('iframe');
|
688 | var length = enumBugKeys.length;
|
689 | var lt = '<';
|
690 | var script = 'script';
|
691 | var gt = '>';
|
692 | var js = 'java' + script + ':';
|
693 | var iframeDocument;
|
694 | iframe.style.display = 'none';
|
695 | html.appendChild(iframe);
|
696 | iframe.src = String(js);
|
697 | iframeDocument = iframe.contentWindow.document;
|
698 | iframeDocument.open();
|
699 | iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
|
700 | iframeDocument.close();
|
701 | createDict = iframeDocument.F;
|
702 | while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
|
703 | return createDict();
|
704 | };
|
705 |
|
706 |
|
707 |
|
708 | var objectCreate = Object.create || function create(O, Properties) {
|
709 | var result;
|
710 | if (O !== null) {
|
711 | Empty[PROTOTYPE] = anObject(O);
|
712 | result = new Empty();
|
713 | Empty[PROTOTYPE] = null;
|
714 |
|
715 | result[IE_PROTO] = O;
|
716 | } else result = createDict();
|
717 | return Properties === undefined ? result : objectDefineProperties(result, Properties);
|
718 | };
|
719 |
|
720 | hiddenKeys[IE_PROTO] = true;
|
721 |
|
722 | var UNSCOPABLES = wellKnownSymbol('unscopables');
|
723 | var ArrayPrototype = Array.prototype;
|
724 |
|
725 |
|
726 |
|
727 | if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
728 | hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
|
729 | }
|
730 |
|
731 |
|
732 | var addToUnscopables = function (key) {
|
733 | ArrayPrototype[UNSCOPABLES][key] = true;
|
734 | };
|
735 |
|
736 | var $find = arrayIteration.find;
|
737 |
|
738 |
|
739 | var FIND = 'find';
|
740 | var SKIPS_HOLES = true;
|
741 |
|
742 |
|
743 | if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
744 |
|
745 |
|
746 |
|
747 | _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
748 | find: function find(callbackfn /* , that = undefined */) {
|
749 | return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
750 | }
|
751 | });
|
752 |
|
753 |
|
754 | addToUnscopables(FIND);
|
755 |
|
756 | var $includes = arrayIncludes.includes;
|
757 |
|
758 |
|
759 |
|
760 |
|
761 | _export({ target: 'Array', proto: true }, {
|
762 | includes: function includes(el /* , fromIndex = 0 */) {
|
763 | return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
764 | }
|
765 | });
|
766 |
|
767 |
|
768 | addToUnscopables('includes');
|
769 |
|
770 | var nativeAssign = Object.assign;
|
771 |
|
772 |
|
773 |
|
774 |
|
775 | var objectAssign = !nativeAssign || fails(function () {
|
776 | var A = {};
|
777 | var B = {};
|
778 |
|
779 | var symbol = Symbol();
|
780 | var alphabet = 'abcdefghijklmnopqrst';
|
781 | A[symbol] = 7;
|
782 | alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
783 | return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
|
784 | }) ? function assign(target, source) {
|
785 | var T = toObject(target);
|
786 | var argumentsLength = arguments.length;
|
787 | var index = 1;
|
788 | var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
789 | var propertyIsEnumerable = objectPropertyIsEnumerable.f;
|
790 | while (argumentsLength > index) {
|
791 | var S = indexedObject(arguments[index++]);
|
792 | var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
|
793 | var length = keys.length;
|
794 | var j = 0;
|
795 | var key;
|
796 | while (length > j) {
|
797 | key = keys[j++];
|
798 | if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
|
799 | }
|
800 | } return T;
|
801 | } : nativeAssign;
|
802 |
|
803 |
|
804 |
|
805 | _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
|
806 | assign: objectAssign
|
807 | });
|
808 |
|
809 | var MATCH = wellKnownSymbol('match');
|
810 |
|
811 |
|
812 |
|
813 | var isRegexp = function (it) {
|
814 | var isRegExp;
|
815 | return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
816 | };
|
817 |
|
818 | var notARegexp = function (it) {
|
819 | if (isRegexp(it)) {
|
820 | throw TypeError("The method doesn't accept regular expressions");
|
821 | } return it;
|
822 | };
|
823 |
|
824 | var MATCH$1 = wellKnownSymbol('match');
|
825 |
|
826 | var correctIsRegexpLogic = function (METHOD_NAME) {
|
827 | var regexp = /./;
|
828 | try {
|
829 | '/./'[METHOD_NAME](regexp);
|
830 | } catch (e) {
|
831 | try {
|
832 | regexp[MATCH$1] = false;
|
833 | return '/./'[METHOD_NAME](regexp);
|
834 | } catch (f) { }
|
835 | } return false;
|
836 | };
|
837 |
|
838 |
|
839 |
|
840 | _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
|
841 | includes: function includes(searchString /* , position = 0 */) {
|
842 | return !!~String(requireObjectCoercible(this))
|
843 | .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
|
844 | }
|
845 | });
|
846 |
|
847 | var nativeStartsWith = ''.startsWith;
|
848 | var min$2 = Math.min;
|
849 |
|
850 |
|
851 |
|
852 | _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('startsWith') }, {
|
853 | startsWith: function startsWith(searchString /* , position = 0 */) {
|
854 | var that = String(requireObjectCoercible(this));
|
855 | notARegexp(searchString);
|
856 | var index = toLength(min$2(arguments.length > 1 ? arguments[1] : undefined, that.length));
|
857 | var search = String(searchString);
|
858 | return nativeStartsWith
|
859 | ? nativeStartsWith.call(that, search, index)
|
860 | : that.slice(index, index + search.length) === search;
|
861 | }
|
862 | });
|
863 |
|
864 | if (typeof window !== "undefined") {
|
865 | (function () {
|
866 | var serializeXML = function (node, output) {
|
867 | var nodeType = node.nodeType;
|
868 | if (nodeType === 3) {
|
869 | output.push(node.textContent.replace(/&/, '&').replace(/</, '<').replace('>', '>'));
|
870 | } else if (nodeType === 1) {
|
871 | output.push('<', node.tagName);
|
872 | if (node.hasAttributes()) {
|
873 | [].forEach.call(node.attributes, function(attrNode){
|
874 | output.push(' ', attrNode.item.name, '=\'', attrNode.item.value, '\'');
|
875 | });
|
876 | }
|
877 | if (node.hasChildNodes()) {
|
878 | output.push('>');
|
879 | [].forEach.call(node.childNodes, function(childNode){
|
880 | serializeXML(childNode, output);
|
881 | });
|
882 | output.push('</', node.tagName, '>');
|
883 | } else {
|
884 | output.push('/>');
|
885 | }
|
886 | } else if (nodeType == 8) {
|
887 | output.push('<!--', node.nodeValue, '-->');
|
888 | }
|
889 | };
|
890 |
|
891 | Object.defineProperty(SVGElement.prototype, 'innerHTML', {
|
892 | get: function () {
|
893 | var output = [];
|
894 | var childNode = this.firstChild;
|
895 | while (childNode) {
|
896 | serializeXML(childNode, output);
|
897 | childNode = childNode.nextSibling;
|
898 | }
|
899 | return output.join('');
|
900 | },
|
901 | set: function (markupText) {
|
902 | while (this.firstChild) {
|
903 | this.removeChild(this.firstChild);
|
904 | }
|
905 |
|
906 | try {
|
907 | var dXML = new DOMParser();
|
908 | dXML.async = false;
|
909 |
|
910 | var sXML = '<svg xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\'>' + markupText + '</svg>';
|
911 | var svgDocElement = dXML.parseFromString(sXML, 'text/xml').documentElement;
|
912 |
|
913 | var childNode = svgDocElement.firstChild;
|
914 | while (childNode) {
|
915 | this.appendChild(this.ownerDocument.importNode(childNode, true));
|
916 | childNode = childNode.nextSibling;
|
917 | }
|
918 | } catch (e) {} }
|
919 | });
|
920 |
|
921 | Object.defineProperty(SVGElement.prototype, 'innerSVG', {
|
922 | get: function () {
|
923 | return this.innerHTML;
|
924 | },
|
925 | set: function (markup) {
|
926 | this.innerHTML = markup;
|
927 | }
|
928 | });
|
929 |
|
930 | })();
|
931 | }
|
932 |
|
933 | }));
|
934 |
|
935 | (function (global, factory) {
|
936 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('windows-locale'), require('iso639-codes'), require('d3-selection'), require('d3-transition'), require('d3-array'), require('d3-collection')) :
|
937 | typeof define === 'function' && define.amd ? define('d3plus-common', ['exports', 'windows-locale', 'iso639-codes', 'd3-selection', 'd3-transition', 'd3-array', 'd3-collection'], factory) :
|
938 | (global = global || self, factory(global.d3plus = {}, global.lcid, global.iso, global.d3Selection, global.d3Transition, global.d3Array, global.d3Collection));
|
939 | }(this, function (exports, lcid, iso, d3Selection, d3Transition, d3Array, d3Collection) { 'use strict';
|
940 |
|
941 | lcid = lcid && lcid.hasOwnProperty('default') ? lcid['default'] : lcid;
|
942 | iso = iso && iso.hasOwnProperty('default') ? iso['default'] : iso;
|
943 |
|
944 | |
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 | function accessor (key, def) {
|
957 | if (def === void 0) return function (d) {
|
958 | return d[key];
|
959 | };
|
960 | return function (d) {
|
961 | return d[key] === void 0 ? def : d[key];
|
962 | };
|
963 | }
|
964 |
|
965 | function _typeof(obj) {
|
966 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
967 | _typeof = function (obj) {
|
968 | return typeof obj;
|
969 | };
|
970 | } else {
|
971 | _typeof = function (obj) {
|
972 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
973 | };
|
974 | }
|
975 |
|
976 | return _typeof(obj);
|
977 | }
|
978 |
|
979 | function _classCallCheck(instance, Constructor) {
|
980 | if (!(instance instanceof Constructor)) {
|
981 | throw new TypeError("Cannot call a class as a function");
|
982 | }
|
983 | }
|
984 |
|
985 | function _defineProperties(target, props) {
|
986 | for (var i = 0; i < props.length; i++) {
|
987 | var descriptor = props[i];
|
988 | descriptor.enumerable = descriptor.enumerable || false;
|
989 | descriptor.configurable = true;
|
990 | if ("value" in descriptor) descriptor.writable = true;
|
991 | Object.defineProperty(target, descriptor.key, descriptor);
|
992 | }
|
993 | }
|
994 |
|
995 | function _createClass(Constructor, protoProps, staticProps) {
|
996 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
997 | if (staticProps) _defineProperties(Constructor, staticProps);
|
998 | return Constructor;
|
999 | }
|
1000 |
|
1001 | function _defineProperty(obj, key, value) {
|
1002 | if (key in obj) {
|
1003 | Object.defineProperty(obj, key, {
|
1004 | value: value,
|
1005 | enumerable: true,
|
1006 | configurable: true,
|
1007 | writable: true
|
1008 | });
|
1009 | } else {
|
1010 | obj[key] = value;
|
1011 | }
|
1012 |
|
1013 | return obj;
|
1014 | }
|
1015 |
|
1016 | |
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 | function isObject (item) {
|
1022 | return item && _typeof(item) === "object" && (typeof window === "undefined" || item !== window && item !== window.document && !(item instanceof Element)) && !Array.isArray(item) ? true : false;
|
1023 | }
|
1024 |
|
1025 | |
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 | function validObject(obj) {
|
1033 | if (typeof window === "undefined") return true;else return obj !== window && obj !== document;
|
1034 | }
|
1035 | |
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 | function assign() {
|
1047 | var _arguments = arguments;
|
1048 | var target = arguments.length <= 0 ? undefined : arguments[0];
|
1049 |
|
1050 | var _loop = function _loop(i) {
|
1051 | var source = i < 0 || _arguments.length <= i ? undefined : _arguments[i];
|
1052 | Object.keys(source).forEach(function (prop) {
|
1053 | var value = source[prop];
|
1054 |
|
1055 | if (isObject(value) && validObject(value)) {
|
1056 | if (target.hasOwnProperty(prop) && isObject(target[prop])) target[prop] = assign({}, target[prop], value);else target[prop] = assign({}, value);
|
1057 | } else if (Array.isArray(value)) target[prop] = value.slice();else target[prop] = value;
|
1058 | });
|
1059 | };
|
1060 |
|
1061 | for (var i = 1; i < arguments.length; i++) {
|
1062 | _loop(i);
|
1063 | }
|
1064 |
|
1065 | return target;
|
1066 | }
|
1067 |
|
1068 | |
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 | function attrize (e) {
|
1075 | var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1076 |
|
1077 | for (var k in a) {
|
1078 | if ({}.hasOwnProperty.call(a, k)) e.attr(k, a[k]);
|
1079 | }
|
1080 | }
|
1081 |
|
1082 | var locales = [];
|
1083 | var isoKeys = Object.keys(iso);
|
1084 | Object.keys(lcid).map(function (id) {
|
1085 | var locale = lcid[id];
|
1086 | var isoLanguage = isoKeys.find(function (name) {
|
1087 | return name.toLowerCase() === locale.language.toLowerCase();
|
1088 | });
|
1089 |
|
1090 | if (locale.location && isoLanguage) {
|
1091 | var _locales$push;
|
1092 |
|
1093 | locales.push((_locales$push = {}, _defineProperty(_locales$push, "name", locale.language), _defineProperty(_locales$push, "location", locale.location), _defineProperty(_locales$push, "tag", locale.tag), _defineProperty(_locales$push, "lcid", locale.id), _defineProperty(_locales$push, "iso639-2", iso[isoLanguage]["iso639-2"]), _defineProperty(_locales$push, "iso639-1", iso[isoLanguage]["iso639-1"]), _locales$push));
|
1094 | }
|
1095 | });
|
1096 | var defaultLocales = {
|
1097 | ar: "ar-SA",
|
1098 | ca: "ca-ES",
|
1099 | da: "da-DK",
|
1100 | en: "en-US",
|
1101 | ko: "ko-KR",
|
1102 | pa: "pa-IN",
|
1103 | pt: "pt-BR",
|
1104 | sv: "sv-SE"
|
1105 | };
|
1106 | |
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 | function findLocale (locale) {
|
1112 | if (typeof locale !== "string" || locale.length === 5) return locale;
|
1113 | if (defaultLocales[locale]) return defaultLocales[locale];
|
1114 | var list = locales.filter(function (d) {
|
1115 | return d["iso639-1"] === locale;
|
1116 | });
|
1117 | if (!list.length) return locale;else if (list.length === 1) return list[0].tag;else if (list.find(function (d) {
|
1118 | return d.tag === "".concat(locale, "-").concat(locale.toUpperCase());
|
1119 | })) return "".concat(locale, "-").concat(locale.toUpperCase());else return list[0].tag;
|
1120 | }
|
1121 |
|
1122 | |
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 | function s() {
|
1128 | return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
1129 | }
|
1130 | |
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 | function uuid () {
|
1137 | return "".concat(s()).concat(s(), "-").concat(s(), "-").concat(s(), "-").concat(s(), "-").concat(s()).concat(s()).concat(s());
|
1138 | }
|
1139 |
|
1140 | |
1141 |
|
1142 |
|
1143 |
|
1144 | var RESET = "D3PLUS-COMMON-RESET";
|
1145 |
|
1146 | var esES = {
|
1147 | "and": "y",
|
1148 | "Back": "Atrás",
|
1149 | "Click to Expand": "Clic para Ampliar",
|
1150 | "Click to Hide": "Clic para Ocultar",
|
1151 | "Click to Highlight": "Clic para Resaltar",
|
1152 | "Click to Reset": "Clic para Restablecer",
|
1153 | "Download": "Descargar",
|
1154 | "Loading Visualization": "Cargando Visualización",
|
1155 | "No Data Available": "Datos No Disponibles",
|
1156 | "Powered by D3plus": "Funciona con D3plus",
|
1157 | "Share": "Porcentaje",
|
1158 | "Shift+Click to Hide": "Mayús+Clic para Ocultar",
|
1159 | "Total": "Total",
|
1160 | "Values": "Valores"
|
1161 | };
|
1162 |
|
1163 | var dictionaries = {
|
1164 | "es-ES": esES
|
1165 | };
|
1166 |
|
1167 | |
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 | function nestedReset(obj, defaults) {
|
1175 | if (isObject(obj)) {
|
1176 | for (var nestedKey in obj) {
|
1177 | if ({}.hasOwnProperty.call(obj, nestedKey) && !nestedKey.startsWith("_")) {
|
1178 | var defaultValue = defaults && isObject(defaults) ? defaults[nestedKey] : undefined;
|
1179 |
|
1180 | if (obj[nestedKey] === RESET) {
|
1181 | if (defaultValue) obj[nestedKey] = defaultValue;else delete obj[nestedKey];
|
1182 | } else if (isObject(obj[nestedKey])) {
|
1183 | nestedReset(obj[nestedKey], defaultValue);
|
1184 | }
|
1185 | }
|
1186 | }
|
1187 | }
|
1188 | }
|
1189 | |
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 | function getAllMethods(obj) {
|
1197 | var props = [];
|
1198 |
|
1199 | do {
|
1200 | props = props.concat(Object.getOwnPropertyNames(obj));
|
1201 | obj = Object.getPrototypeOf(obj);
|
1202 | } while (obj && obj !== Object.prototype);
|
1203 |
|
1204 | return props.filter(function (e) {
|
1205 | return e.indexOf("_") !== 0 && !["config", "constructor", "render"].includes(e);
|
1206 | });
|
1207 | }
|
1208 | |
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 | var BaseClass =
|
1215 |
|
1216 | function () {
|
1217 | |
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 | function BaseClass() {
|
1223 | var _this = this;
|
1224 |
|
1225 | _classCallCheck(this, BaseClass);
|
1226 |
|
1227 | this._locale = "en-US";
|
1228 | this._on = {};
|
1229 |
|
1230 | this._translate = function (d) {
|
1231 | var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this._locale;
|
1232 | var dictionary = dictionaries[locale];
|
1233 | return dictionary && dictionary[d] ? dictionary[d] : d;
|
1234 | };
|
1235 |
|
1236 | this._uuid = uuid();
|
1237 | }
|
1238 | |
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 | _createClass(BaseClass, [{
|
1247 | key: "config",
|
1248 | value: function config(_) {
|
1249 | var _this2 = this;
|
1250 |
|
1251 | if (!this._configDefault) {
|
1252 | var config = {};
|
1253 | getAllMethods(this.__proto__).forEach(function (k) {
|
1254 | var v = _this2[k]();
|
1255 |
|
1256 | config[k] = isObject(v) ? assign({}, v) : v;
|
1257 | });
|
1258 | this._configDefault = config;
|
1259 | }
|
1260 |
|
1261 | if (arguments.length) {
|
1262 | for (var k in _) {
|
1263 | if ({}.hasOwnProperty.call(_, k) && k in this) {
|
1264 | var v = _[k];
|
1265 |
|
1266 | if (v === RESET) {
|
1267 | if (k === "on") this._on = this._configDefault[k];else this[k](this._configDefault[k]);
|
1268 | } else {
|
1269 | nestedReset(v, this._configDefault[k]);
|
1270 | this[k](v);
|
1271 | }
|
1272 | }
|
1273 | }
|
1274 |
|
1275 | return this;
|
1276 | } else {
|
1277 | var _config = {};
|
1278 | getAllMethods(this.__proto__).forEach(function (k) {
|
1279 | _config[k] = _this2[k]();
|
1280 | });
|
1281 | return _config;
|
1282 | }
|
1283 | }
|
1284 | |
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 | }, {
|
1303 | key: "locale",
|
1304 | value: function locale(_) {
|
1305 | return arguments.length ? (this._locale = findLocale(_), this) : this._locale;
|
1306 | }
|
1307 | |
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 | }, {
|
1324 | key: "on",
|
1325 | value: function on(_, f) {
|
1326 | return arguments.length === 2 ? (this._on[_] = f, this) : arguments.length ? typeof _ === "string" ? this._on[_] : (this._on = Object.assign({}, this._on, _), this) : this._on;
|
1327 | }
|
1328 | |
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 | }, {
|
1340 | key: "translate",
|
1341 | value: function translate(_) {
|
1342 | return arguments.length ? (this._translate = _, this) : this._translate;
|
1343 | }
|
1344 | |
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 | }, {
|
1352 | key: "shapeConfig",
|
1353 | value: function shapeConfig(_) {
|
1354 | return arguments.length ? (this._shapeConfig = assign(this._shapeConfig, _), this) : this._shapeConfig;
|
1355 | }
|
1356 | }]);
|
1357 |
|
1358 | return BaseClass;
|
1359 | }();
|
1360 |
|
1361 | |
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 | function closest (n) {
|
1368 | var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
1369 | if (!arr || !(arr instanceof Array) || !arr.length) return undefined;
|
1370 | return arr.reduce(function (prev, curr) {
|
1371 | return Math.abs(curr - n) < Math.abs(prev - n) ? curr : prev;
|
1372 | });
|
1373 | }
|
1374 |
|
1375 | |
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 | function configPrep() {
|
1383 | var _this = this;
|
1384 |
|
1385 | var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._shapeConfig;
|
1386 | var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "shape";
|
1387 | var nest = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
1388 | var newConfig = {
|
1389 | duration: this._duration,
|
1390 | on: {}
|
1391 | };
|
1392 |
|
1393 | var wrapFunction = function wrapFunction(func) {
|
1394 | return function (d, i, s) {
|
1395 | var parent;
|
1396 |
|
1397 | while (d.__d3plus__) {
|
1398 | if (parent) d.__d3plusParent__ = parent;
|
1399 | parent = d;
|
1400 | i = d.i;
|
1401 | d = d.data || d.feature;
|
1402 | }
|
1403 |
|
1404 | return func.bind(_this)(d, i, s || parent);
|
1405 | };
|
1406 | };
|
1407 |
|
1408 | var parseEvents = function parseEvents(newObj, on) {
|
1409 | for (var event in on) {
|
1410 | if ({}.hasOwnProperty.call(on, event) && !event.includes(".") || event.includes(".".concat(type))) {
|
1411 | newObj.on[event] = wrapFunction(on[event]);
|
1412 | }
|
1413 | }
|
1414 | };
|
1415 |
|
1416 | var arrayEval = function arrayEval(arr) {
|
1417 | return arr.map(function (d) {
|
1418 | if (d instanceof Array) return arrayEval(d);else if (_typeof(d) === "object") return keyEval({}, d);else if (typeof d === "function") return wrapFunction(d);else return d;
|
1419 | });
|
1420 | };
|
1421 |
|
1422 | var keyEval = function keyEval(newObj, obj) {
|
1423 | for (var key in obj) {
|
1424 | if ({}.hasOwnProperty.call(obj, key)) {
|
1425 | if (key === "on") parseEvents(newObj, obj[key]);else if (typeof obj[key] === "function") {
|
1426 | newObj[key] = wrapFunction(obj[key]);
|
1427 | } else if (obj[key] instanceof Array) {
|
1428 | newObj[key] = arrayEval(obj[key]);
|
1429 | } else if (_typeof(obj[key]) === "object") {
|
1430 | newObj[key] = {
|
1431 | on: {}
|
1432 | };
|
1433 | keyEval(newObj[key], obj[key]);
|
1434 | } else newObj[key] = obj[key];
|
1435 | }
|
1436 | }
|
1437 | };
|
1438 |
|
1439 | keyEval(newConfig, config);
|
1440 | if (this._on) parseEvents(newConfig, this._on);
|
1441 |
|
1442 | if (nest && config[nest]) {
|
1443 | keyEval(newConfig, config[nest]);
|
1444 | if (config[nest].on) parseEvents(newConfig, config[nest].on);
|
1445 | }
|
1446 |
|
1447 | return newConfig;
|
1448 | }
|
1449 |
|
1450 | |
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 | function constant (value) {
|
1462 | return function constant() {
|
1463 | return value;
|
1464 | };
|
1465 | }
|
1466 |
|
1467 | |
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 | function elem (selector, p) {
|
1481 |
|
1482 | p = Object.assign({}, {
|
1483 | condition: true,
|
1484 | enter: {},
|
1485 | exit: {},
|
1486 | parent: d3Selection.select("body"),
|
1487 | transition: d3Transition.transition().duration(0),
|
1488 | update: {}
|
1489 | }, p);
|
1490 | var className = /\.([^#]+)/g.exec(selector),
|
1491 | id = /#([^\.]+)/g.exec(selector),
|
1492 | tag = /^([^.^#]+)/g.exec(selector)[1];
|
1493 | var elem = p.parent.selectAll(selector.includes(":") ? selector.split(":")[1] : selector).data(p.condition ? [null] : []);
|
1494 | var enter = elem.enter().append(tag).call(attrize, p.enter);
|
1495 | if (id) enter.attr("id", id[1]);
|
1496 | if (className) enter.attr("class", className[1]);
|
1497 | elem.exit().transition(p.transition).call(attrize, p.exit).remove();
|
1498 | var update = enter.merge(elem);
|
1499 | update.transition(p.transition).call(attrize, p.update);
|
1500 | return update;
|
1501 | }
|
1502 |
|
1503 | |
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 | function unique (arr) {
|
1513 | return arr.filter(function (k, i, a) {
|
1514 | return a.indexOf(k) === i;
|
1515 | });
|
1516 | }
|
1517 |
|
1518 | |
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 | function objectMerge(objects) {
|
1533 | var aggs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1534 | var availableKeys = unique(d3Array.merge(objects.map(function (o) {
|
1535 | return d3Collection.keys(o);
|
1536 | }))),
|
1537 | newObject = {};
|
1538 | availableKeys.forEach(function (k) {
|
1539 | var values = objects.map(function (o) {
|
1540 | return o[k];
|
1541 | });
|
1542 | var value;
|
1543 | if (aggs[k]) value = aggs[k](values);else {
|
1544 | var types = values.map(function (v) {
|
1545 | return v || v === false ? v.constructor : v;
|
1546 | }).filter(function (v) {
|
1547 | return v !== void 0;
|
1548 | });
|
1549 | if (!types.length) value = undefined;else if (types.indexOf(Array) >= 0) {
|
1550 | value = d3Array.merge(values.map(function (v) {
|
1551 | return v instanceof Array ? v : [v];
|
1552 | }));
|
1553 | value = unique(value);
|
1554 | if (value.length === 1) value = value[0];
|
1555 | } else if (types.indexOf(String) >= 0) {
|
1556 | value = unique(values);
|
1557 | if (value.length === 1) value = value[0];
|
1558 | } else if (types.indexOf(Number) >= 0) value = d3Array.sum(values);else if (types.indexOf(Object) >= 0) {
|
1559 | value = unique(values.filter(function (v) {
|
1560 | return v;
|
1561 | }));
|
1562 | if (value.length === 1) value = value[0];else value = objectMerge(value);
|
1563 | } else {
|
1564 | value = unique(values.filter(function (v) {
|
1565 | return v !== void 0;
|
1566 | }));
|
1567 | if (value.length === 1) value = value[0];
|
1568 | }
|
1569 | }
|
1570 | newObject[k] = value;
|
1571 | });
|
1572 | return newObject;
|
1573 | }
|
1574 |
|
1575 | |
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 | function parseSides (sides) {
|
1581 | var values;
|
1582 | if (typeof sides === "number") values = [sides];else values = sides.split(/\s+/);
|
1583 | if (values.length === 1) values = [values[0], values[0], values[0], values[0]];else if (values.length === 2) values = values.concat(values);else if (values.length === 3) values.push(values[1]);
|
1584 | return ["top", "right", "bottom", "left"].reduce(function (acc, direction, i) {
|
1585 | var value = parseFloat(values[i]);
|
1586 | acc[direction] = value || 0;
|
1587 | return acc;
|
1588 | }, {});
|
1589 | }
|
1590 |
|
1591 | |
1592 |
|
1593 |
|
1594 |
|
1595 | function prefix () {
|
1596 | if ("-webkit-transform" in document.body.style) return "-webkit-";else if ("-moz-transform" in document.body.style) return "-moz-";else if ("-ms-transform" in document.body.style) return "-ms-";else if ("-o-transform" in document.body.style) return "-o-";else return "";
|
1597 | }
|
1598 |
|
1599 | |
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 |
|
1605 | function stylize (e) {
|
1606 | var s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1607 |
|
1608 | for (var k in s) {
|
1609 | if ({}.hasOwnProperty.call(s, k)) e.style(k, s[k]);
|
1610 | }
|
1611 | }
|
1612 |
|
1613 | exports.BaseClass = BaseClass;
|
1614 | exports.RESET = RESET;
|
1615 | exports.accessor = accessor;
|
1616 | exports.assign = assign;
|
1617 | exports.attrize = attrize;
|
1618 | exports.closest = closest;
|
1619 | exports.configPrep = configPrep;
|
1620 | exports.constant = constant;
|
1621 | exports.elem = elem;
|
1622 | exports.findLocale = findLocale;
|
1623 | exports.isObject = isObject;
|
1624 | exports.merge = objectMerge;
|
1625 | exports.parseSides = parseSides;
|
1626 | exports.prefix = prefix;
|
1627 | exports.stylize = stylize;
|
1628 | exports.unique = unique;
|
1629 | exports.uuid = uuid;
|
1630 |
|
1631 | Object.defineProperty(exports, '__esModule', { value: true });
|
1632 |
|
1633 | }));
|
1634 |
|