-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.js
More file actions
2686 lines (2295 loc) · 84.6 KB
/
Copy pathindex.js
File metadata and controls
2686 lines (2295 loc) · 84.6 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function (exports) {
'use strict';
/*! (c) Andrea Giammarchi @webreflection ISC */
(function () {
var Lie = typeof Promise === 'function' ? Promise : function (fn) {
var queue = [],
resolved = 0,
value;
fn(function ($) {
value = $;
resolved = 1;
queue.splice(0).forEach(then);
});
return {
then: then
};
function then(fn) {
return resolved ? setTimeout(fn, 0, value) : queue.push(fn), this;
}
};
var attributesObserver = function attributesObserver(whenDefined, MutationObserver) {
var attributeChanged = function attributeChanged(records) {
for (var i = 0, length = records.length; i < length; i++) {
dispatch(records[i]);
}
};
var dispatch = function dispatch(_ref) {
var target = _ref.target,
attributeName = _ref.attributeName,
oldValue = _ref.oldValue;
target.attributeChangedCallback(attributeName, oldValue, target.getAttribute(attributeName));
};
return function (target, is) {
var attributeFilter = target.constructor.observedAttributes;
if (attributeFilter) {
whenDefined(is).then(function () {
new MutationObserver(attributeChanged).observe(target, {
attributes: true,
attributeOldValue: true,
attributeFilter: attributeFilter
});
for (var i = 0, length = attributeFilter.length; i < length; i++) {
if (target.hasAttribute(attributeFilter[i])) dispatch({
target: target,
attributeName: attributeFilter[i],
oldValue: null
});
}
});
}
return target;
};
};
var TRUE = true,
FALSE = false;
var QSA$1 = 'querySelectorAll';
function add(node) {
this.observe(node, {
subtree: TRUE,
childList: TRUE
});
}
/**
* Start observing a generic document or root element.
* @param {Function} callback triggered per each dis/connected node
* @param {Element?} root by default, the global document to observe
* @param {Function?} MO by default, the global MutationObserver
* @returns {MutationObserver}
*/
var notify = function notify(callback, root, MO) {
var loop = function loop(nodes, added, removed, connected, pass) {
for (var i = 0, length = nodes.length; i < length; i++) {
var node = nodes[i];
if (pass || QSA$1 in node) {
if (connected) {
if (!added.has(node)) {
added.add(node);
removed["delete"](node);
callback(node, connected);
}
} else if (!removed.has(node)) {
removed.add(node);
added["delete"](node);
callback(node, connected);
}
if (!pass) loop(node[QSA$1]('*'), added, removed, connected, TRUE);
}
}
};
var observer = new (MO || MutationObserver)(function (records) {
for (var added = new Set(), removed = new Set(), i = 0, length = records.length; i < length; i++) {
var _records$i = records[i],
addedNodes = _records$i.addedNodes,
removedNodes = _records$i.removedNodes;
loop(removedNodes, added, removed, FALSE, FALSE);
loop(addedNodes, added, removed, TRUE, FALSE);
}
});
observer.add = add;
observer.add(root || document);
return observer;
};
var QSA = 'querySelectorAll';
var _self$1 = self,
document$2 = _self$1.document,
Element$1 = _self$1.Element,
MutationObserver$2 = _self$1.MutationObserver,
Set$2 = _self$1.Set,
WeakMap$1 = _self$1.WeakMap;
var elements = function elements(element) {
return QSA in element;
};
var filter = [].filter;
var qsaObserver = function qsaObserver(options) {
var live = new WeakMap$1();
var drop = function drop(elements) {
for (var i = 0, length = elements.length; i < length; i++) {
live["delete"](elements[i]);
}
};
var flush = function flush() {
var records = observer.takeRecords();
for (var i = 0, length = records.length; i < length; i++) {
parse(filter.call(records[i].removedNodes, elements), false);
parse(filter.call(records[i].addedNodes, elements), true);
}
};
var matches = function matches(element) {
return element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
};
var notifier = function notifier(element, connected) {
var selectors;
if (connected) {
for (var q, m = matches(element), i = 0, length = query.length; i < length; i++) {
if (m.call(element, q = query[i])) {
if (!live.has(element)) live.set(element, new Set$2());
selectors = live.get(element);
if (!selectors.has(q)) {
selectors.add(q);
options.handle(element, connected, q);
}
}
}
} else if (live.has(element)) {
selectors = live.get(element);
live["delete"](element);
selectors.forEach(function (q) {
options.handle(element, connected, q);
});
}
};
var parse = function parse(elements) {
var connected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
for (var i = 0, length = elements.length; i < length; i++) {
notifier(elements[i], connected);
}
};
var query = options.query;
var root = options.root || document$2;
var observer = notify(notifier, root, MutationObserver$2);
var attachShadow = Element$1.prototype.attachShadow;
if (attachShadow) Element$1.prototype.attachShadow = function (init) {
var shadowRoot = attachShadow.call(this, init);
observer.add(shadowRoot);
return shadowRoot;
};
if (query.length) parse(root[QSA](query));
return {
drop: drop,
flush: flush,
observer: observer,
parse: parse
};
};
var _self = self,
document$1 = _self.document,
Map = _self.Map,
MutationObserver$1 = _self.MutationObserver,
Object$1 = _self.Object,
Set$1 = _self.Set,
WeakMap = _self.WeakMap,
Element = _self.Element,
HTMLElement = _self.HTMLElement,
Node = _self.Node,
Error = _self.Error,
TypeError = _self.TypeError,
Reflect = _self.Reflect;
var Promise$1 = self.Promise || Lie;
var defineProperty = Object$1.defineProperty,
keys = Object$1.keys,
getOwnPropertyNames = Object$1.getOwnPropertyNames,
setPrototypeOf = Object$1.setPrototypeOf;
var legacy = !self.customElements;
var expando = function expando(element) {
var key = keys(element);
var value = [];
var length = key.length;
for (var i = 0; i < length; i++) {
value[i] = element[key[i]];
delete element[key[i]];
}
return function () {
for (var _i = 0; _i < length; _i++) {
element[key[_i]] = value[_i];
}
};
};
if (legacy) {
var HTMLBuiltIn = function HTMLBuiltIn() {
var constructor = this.constructor;
if (!classes.has(constructor)) throw new TypeError('Illegal constructor');
var is = classes.get(constructor);
if (override) return augment(override, is);
var element = createElement.call(document$1, is);
return augment(setPrototypeOf(element, constructor.prototype), is);
};
var createElement = document$1.createElement;
var classes = new Map();
var defined = new Map();
var prototypes = new Map();
var registry = new Map();
var query = [];
var handle = function handle(element, connected, selector) {
var proto = prototypes.get(selector);
if (connected && !proto.isPrototypeOf(element)) {
var redefine = expando(element);
override = setPrototypeOf(element, proto);
try {
new proto.constructor();
} finally {
override = null;
redefine();
}
}
var method = "".concat(connected ? '' : 'dis', "connectedCallback");
if (method in proto) element[method]();
};
var _qsaObserver = qsaObserver({
query: query,
handle: handle
}),
parse = _qsaObserver.parse;
var override = null;
var whenDefined = function whenDefined(name) {
if (!defined.has(name)) {
var _,
$ = new Lie(function ($) {
_ = $;
});
defined.set(name, {
$: $,
_: _
});
}
return defined.get(name).$;
};
var augment = attributesObserver(whenDefined, MutationObserver$1);
defineProperty(self, 'customElements', {
configurable: true,
value: {
define: function define(is, Class) {
if (registry.has(is)) throw new Error("the name \"".concat(is, "\" has already been used with this registry"));
classes.set(Class, is);
prototypes.set(is, Class.prototype);
registry.set(is, Class);
query.push(is);
whenDefined(is).then(function () {
parse(document$1.querySelectorAll(is));
});
defined.get(is)._(Class);
},
get: function get(is) {
return registry.get(is);
},
whenDefined: whenDefined
}
});
defineProperty(HTMLBuiltIn.prototype = HTMLElement.prototype, 'constructor', {
value: HTMLBuiltIn
});
defineProperty(self, 'HTMLElement', {
configurable: true,
value: HTMLBuiltIn
});
defineProperty(document$1, 'createElement', {
configurable: true,
value: function value(name, options) {
var is = options && options.is;
var Class = is ? registry.get(is) : registry.get(name);
return Class ? new Class() : createElement.call(document$1, name);
}
}); // in case ShadowDOM is used through a polyfill, to avoid issues
// with builtin extends within shadow roots
if (!('isConnected' in Node.prototype)) defineProperty(Node.prototype, 'isConnected', {
configurable: true,
get: function get() {
return !(this.ownerDocument.compareDocumentPosition(this) & this.DOCUMENT_POSITION_DISCONNECTED);
}
});
} else {
try {
var LI = function LI() {
return self.Reflect.construct(HTMLLIElement, [], LI);
};
LI.prototype = HTMLLIElement.prototype;
var is = 'extends-li';
self.customElements.define('extends-li', LI, {
'extends': 'li'
});
legacy = document$1.createElement('li', {
is: is
}).outerHTML.indexOf(is) < 0;
var _self$customElements = self.customElements,
get = _self$customElements.get,
_whenDefined = _self$customElements.whenDefined;
defineProperty(self.customElements, 'whenDefined', {
configurable: true,
value: function value(is) {
var _this = this;
return _whenDefined.call(this, is).then(function (Class) {
return Class || get.call(_this, is);
});
}
});
} catch (o_O) {
legacy = !legacy;
}
}
if (legacy) {
var parseShadow = function parseShadow(element) {
var root = shadowRoots.get(element);
_parse(root.querySelectorAll(this), element.isConnected);
};
var customElements = self.customElements;
var attachShadow = Element.prototype.attachShadow;
var _createElement = document$1.createElement;
var define = customElements.define,
_get = customElements.get;
var _ref = Reflect || {
construct: function construct(HTMLElement) {
return HTMLElement.call(this);
}
},
construct = _ref.construct;
var shadowRoots = new WeakMap();
var shadows = new Set$1();
var _classes = new Map();
var _defined = new Map();
var _prototypes = new Map();
var _registry = new Map();
var shadowed = [];
var _query = [];
var getCE = function getCE(is) {
return _registry.get(is) || _get.call(customElements, is);
};
var _handle = function _handle(element, connected, selector) {
var proto = _prototypes.get(selector);
if (connected && !proto.isPrototypeOf(element)) {
var redefine = expando(element);
_override = setPrototypeOf(element, proto);
try {
new proto.constructor();
} finally {
_override = null;
redefine();
}
}
var method = "".concat(connected ? '' : 'dis', "connectedCallback");
if (method in proto) element[method]();
};
var _qsaObserver2 = qsaObserver({
query: _query,
handle: _handle
}),
_parse = _qsaObserver2.parse;
var _qsaObserver3 = qsaObserver({
query: shadowed,
handle: function handle(element, connected) {
if (shadowRoots.has(element)) {
if (connected) shadows.add(element);else shadows["delete"](element);
if (_query.length) parseShadow.call(_query, element);
}
}
}),
parseShadowed = _qsaObserver3.parse;
var _whenDefined2 = function _whenDefined2(name) {
if (!_defined.has(name)) {
var _,
$ = new Promise$1(function ($) {
_ = $;
});
_defined.set(name, {
$: $,
_: _
});
}
return _defined.get(name).$;
};
var _augment = attributesObserver(_whenDefined2, MutationObserver$1);
var _override = null;
getOwnPropertyNames(self).filter(function (k) {
return /^HTML/.test(k);
}).forEach(function (k) {
var HTMLElement = self[k];
function HTMLBuiltIn() {
var constructor = this.constructor;
if (!_classes.has(constructor)) throw new TypeError('Illegal constructor');
var _classes$get = _classes.get(constructor),
is = _classes$get.is,
tag = _classes$get.tag;
if (is) {
if (_override) return _augment(_override, is);
var element = _createElement.call(document$1, tag);
element.setAttribute('is', is);
return _augment(setPrototypeOf(element, constructor.prototype), is);
} else return construct.call(this, HTMLElement, [], constructor);
}
defineProperty(HTMLBuiltIn.prototype = HTMLElement.prototype, 'constructor', {
value: HTMLBuiltIn
});
defineProperty(self, k, {
value: HTMLBuiltIn
});
});
defineProperty(document$1, 'createElement', {
configurable: true,
value: function value(name, options) {
var is = options && options.is;
if (is) {
var Class = _registry.get(is);
if (Class && _classes.get(Class).tag === name) return new Class();
}
var element = _createElement.call(document$1, name);
if (is) element.setAttribute('is', is);
return element;
}
});
if (attachShadow) Element.prototype.attachShadow = function (init) {
var root = attachShadow.call(this, init);
shadowRoots.set(this, root);
return root;
};
defineProperty(customElements, 'get', {
configurable: true,
value: getCE
});
defineProperty(customElements, 'whenDefined', {
configurable: true,
value: _whenDefined2
});
defineProperty(customElements, 'define', {
configurable: true,
value: function value(is, Class, options) {
if (getCE(is)) throw new Error("'".concat(is, "' has already been defined as a custom element"));
var selector;
var tag = options && options["extends"];
_classes.set(Class, tag ? {
is: is,
tag: tag
} : {
is: '',
tag: is
});
if (tag) {
selector = "".concat(tag, "[is=\"").concat(is, "\"]");
_prototypes.set(selector, Class.prototype);
_registry.set(is, Class);
_query.push(selector);
} else {
define.apply(customElements, arguments);
shadowed.push(selector = is);
}
_whenDefined2(is).then(function () {
if (tag) {
_parse(document$1.querySelectorAll(selector));
shadows.forEach(parseShadow, [selector]);
} else parseShadowed(document$1.querySelectorAll(selector));
});
_defined.get(is)._(Class);
}
});
}
})();
var Lie = typeof Promise === 'function' ? Promise : function (fn) {
var queue = [],
resolved = 0,
value;
fn(function ($) {
value = $;
resolved = 1;
queue.splice(0).forEach(then);
});
return {
then: then
};
function then(fn) {
return resolved ? setTimeout(fn, 0, value) : queue.push(fn), this;
}
};
var queryHelper = function queryHelper(attr, arr) {
return function (element) {
return [].reduce.call(element.querySelectorAll('[' + attr + ']'), function (slot, node) {
var parentNode = node.parentNode;
do {
if (parentNode === element) {
var name = get(node, attr);
slot[name] = arr ? [].concat(slot[name] || [], node) : node;
break;
} else if (/-/.test(parentNode.tagName) || get(parentNode, 'is')) break;
} while (parentNode = parentNode.parentNode);
return slot;
}, {});
};
};
var get = function get(child, name) {
return child.getAttribute(name);
};
var has = function has(child, name) {
return child.hasAttribute(name);
};
var ref$1 = queryHelper('ref', false);
var slot = queryHelper('slot', true);
var info$1 = null,
schedule = new Set();
var invoke = function invoke(effect) {
var $ = effect.$,
r = effect.r,
h = effect.h;
if (isFunction(r)) {
fx.get(h)["delete"](effect);
r();
}
if (isFunction(effect.r = $())) fx.get(h).add(effect);
};
var runSchedule = function runSchedule() {
var previous = schedule;
schedule = new Set();
previous.forEach(function (_ref) {
var h = _ref.h,
c = _ref.c,
a = _ref.a,
e = _ref.e;
// avoid running schedules when the hook is
// re-executed before such schedule happens
if (e) h.apply(c, a);
});
};
var fx = new WeakMap();
var effects = [];
var layoutEffects = [];
function different(value, i) {
return value !== this[i];
}
var dropEffect = function dropEffect(hook) {
var effects = fx.get(hook);
if (effects) wait.then(function () {
effects.forEach(function (effect) {
effect.r();
effect.r = null;
});
effects.clear();
});
};
var getInfo = function getInfo() {
return info$1;
};
var hasEffect = function hasEffect(hook) {
return fx.has(hook);
};
var isFunction = function isFunction(f) {
return typeof f === 'function';
};
var hooked = function hooked(callback) {
var current = {
h: hook,
c: null,
a: null,
e: 0,
i: 0,
s: []
};
return hook;
function hook() {
var prev = info$1;
info$1 = current;
current.e = current.i = 0;
try {
return callback.apply(current.c = this, current.a = arguments);
} finally {
info$1 = prev;
if (effects.length) wait.then(effects.forEach.bind(effects.splice(0), invoke));
if (layoutEffects.length) layoutEffects.splice(0).forEach(invoke);
}
}
};
var reschedule = function reschedule(info) {
if (!schedule.has(info)) {
info.e = 1;
schedule.add(info);
wait.then(runSchedule);
}
};
var wait = new Lie(function ($) {
return $();
});
var createContext = function createContext(value) {
return {
_: new Set(),
provide: provide,
value: value
};
};
var useContext = function useContext(_ref) {
var _ = _ref._,
value = _ref.value;
_.add(getInfo());
return value;
};
function provide(newValue) {
var _ = this._,
value = this.value;
if (value !== newValue) {
this._ = new Set();
this.value = newValue;
_.forEach(function (_ref2) {
var h = _ref2.h,
c = _ref2.c,
a = _ref2.a;
h.apply(c, a);
});
}
}
var useCallback = function useCallback(fn, guards) {
return useMemo(function () {
return fn;
}, guards);
};
var useMemo = function useMemo(memo, guards) {
var info = getInfo();
var i = info.i,
s = info.s;
if (i === s.length || !guards || guards.some(different, s[i]._)) s[i] = {
$: memo(),
_: guards
};
return s[info.i++].$;
};
var createEffect = function createEffect(stack) {
return function (callback, guards) {
var info = getInfo();
var i = info.i,
s = info.s,
h = info.h;
var call = i === s.length;
info.i++;
if (call) {
if (!fx.has(h)) fx.set(h, new Set());
s[i] = {
$: callback,
_: guards,
r: null,
h: h
};
}
if (call || !guards || guards.some(different, s[i]._)) stack.push(s[i]);
s[i].$ = callback;
s[i]._ = guards;
};
};
var useEffect = createEffect(effects);
var useLayoutEffect = createEffect(layoutEffects);
var getValue = function getValue(value, f) {
return isFunction(f) ? f(value) : f;
};
var useReducer = function useReducer(reducer, value, init) {
var info = getInfo();
var i = info.i,
s = info.s;
if (i === s.length) s.push({
$: isFunction(init) ? init(value) : getValue(void 0, value),
set: function set(value) {
s[i].$ = reducer(s[i].$, value);
reschedule(info);
}
});
var _s$info$i = s[info.i++],
$ = _s$info$i.$,
set = _s$info$i.set;
return [$, set];
};
var useState = function useState(value) {
return useReducer(getValue, value);
};
var useRef = function useRef(current) {
var info = getInfo();
var i = info.i,
s = info.s;
if (i === s.length) s.push({
current: current
});
return s[info.i++];
};
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var umap = (function (_) {
return {
// About: get: _.get.bind(_)
// It looks like WebKit/Safari didn't optimize bind at all,
// so that using bind slows it down by 60%.
// Firefox and Chrome are just fine in both cases,
// so let's use the approach that works fast everywhere 👍
get: function get(key) {
return _.get(key);
},
set: function set(key, value) {
return _.set(key, value), value;
}
};
});
var attr = /([^\s\\>"'=]+)\s*=\s*(['"]?)$/;
var empty = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
var node = /<[a-z][^>]+$/i;
var notNode = />[^<>]*$/;
var selfClosing = /<([a-z]+[a-z0-9:._-]*)([^>]*?)(\/>)/ig;
var trimEnd = /\s+$/;
var isNode = function isNode(template, i) {
return 0 < i-- && (node.test(template[i]) || !notNode.test(template[i]) && isNode(template, i));
};
var regular = function regular(original, name, extra) {
return empty.test(name) ? original : "<".concat(name).concat(extra.replace(trimEnd, ''), "></").concat(name, ">");
};
var instrument = (function (template, prefix, svg) {
var text = [];
var length = template.length;
var _loop = function _loop(i) {
var chunk = template[i - 1];
text.push(attr.test(chunk) && isNode(template, i) ? chunk.replace(attr, function (_, $1, $2) {
return "".concat(prefix).concat(i - 1, "=").concat($2 || '"').concat($1).concat($2 ? '' : '"');
}) : "".concat(chunk, "<!--").concat(prefix).concat(i - 1, "-->"));
};
for (var i = 1; i < length; i++) {
_loop(i);
}
text.push(template[length - 1]);
var output = text.join('').trim();
return svg ? output : output.replace(selfClosing, regular);
});
var isArray = Array.isArray;
var _ref = [],
indexOf = _ref.indexOf,
slice = _ref.slice;
var ELEMENT_NODE = 1;
var nodeType = 111;
var remove = function remove(_ref) {
var firstChild = _ref.firstChild,
lastChild = _ref.lastChild;
var range = document.createRange();
range.setStartAfter(firstChild);
range.setEndAfter(lastChild);
range.deleteContents();
return firstChild;
};
var diffable = function diffable(node, operation) {
return node.nodeType === nodeType ? 1 / operation < 0 ? operation ? remove(node) : node.lastChild : operation ? node.valueOf() : node.firstChild : node;
};
var persistent = function persistent(fragment) {
var childNodes = fragment.childNodes;
var length = childNodes.length;
if (length < 2) return length ? childNodes[0] : fragment;