tao_on_rails 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/tao/component.coffee +2 -1
- data/lib/tao_on_rails/version.rb +1 -1
- data/vendor/assets/javascripts/polyfills/custom-elements.js +54 -856
- data/vendor/assets/javascripts/polyfills/native-shim.coffee +101 -89
- data/vendor/assets/javascripts/polyfills/polyfills.coffee +1 -2
- metadata +2 -3
- data/vendor/assets/javascripts/polyfills/es6.js +0 -1963
@@ -1,856 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
var
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
function
|
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
|
-
var
|
41
|
-
|
42
|
-
(function () {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
var _observerProp = '__$CE_observer';
|
57
|
-
var _attachedProp = '__$CE_attached';
|
58
|
-
var _upgradedProp = '__$CE_upgraded';
|
59
|
-
|
60
|
-
if (_customElements()) {
|
61
|
-
_customElements().flush = function () {};
|
62
|
-
if (!_customElements().forcePolyfill) {
|
63
|
-
return;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
// name validation
|
68
|
-
// https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-element-name
|
69
|
-
|
70
|
-
/**
|
71
|
-
* @const
|
72
|
-
* @type {Array<string>}
|
73
|
-
*/
|
74
|
-
var reservedTagList = ['annotation-xml', 'color-profile', 'font-face', 'font-face-src', 'font-face-uri', 'font-face-format', 'font-face-name', 'missing-glyph'];
|
75
|
-
|
76
|
-
/**
|
77
|
-
* @param {!string} name
|
78
|
-
* @return {!Error|undefined}
|
79
|
-
*/
|
80
|
-
function checkValidCustomElementName(name) {
|
81
|
-
if (!(/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(name) && reservedTagList.indexOf(name) === -1)) {
|
82
|
-
return new Error('The element name \'' + name + '\' is not valid.');
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|
86
|
-
/**
|
87
|
-
* @param {!Node} root
|
88
|
-
* @return {TreeWalker}
|
89
|
-
*/
|
90
|
-
function createTreeWalker(root) {
|
91
|
-
// IE 11 requires the third and fourth arguments be present. If the third
|
92
|
-
// arg is null, it applies the default behaviour. However IE also requires
|
93
|
-
// the fourth argument be present even though the other browsers ignore it.
|
94
|
-
return document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, null, false);
|
95
|
-
}
|
96
|
-
|
97
|
-
/**
|
98
|
-
* @param {!Node} node
|
99
|
-
* @return {boolean}
|
100
|
-
*/
|
101
|
-
function isElement(node) {
|
102
|
-
return node.nodeType === Node.ELEMENT_NODE;
|
103
|
-
}
|
104
|
-
|
105
|
-
/**
|
106
|
-
* @param {!Element} element
|
107
|
-
* @return {boolean}
|
108
|
-
*/
|
109
|
-
function isHtmlImport(element) {
|
110
|
-
return element.tagName === 'LINK' && element.rel && element.rel.toLowerCase().split(' ').indexOf('import') !== -1;
|
111
|
-
}
|
112
|
-
|
113
|
-
/**
|
114
|
-
* @param {!Element} element
|
115
|
-
* @return {boolean}
|
116
|
-
*/
|
117
|
-
function isConnected(element) {
|
118
|
-
var n = element;
|
119
|
-
do {
|
120
|
-
if (n[_attachedProp] || n.nodeType === Node.DOCUMENT_NODE) return true;
|
121
|
-
n = n.parentNode || n.nodeType === Node.DOCUMENT_FRAGMENT_NODE && n.host;
|
122
|
-
} while (n);
|
123
|
-
return false;
|
124
|
-
}
|
125
|
-
|
126
|
-
/**
|
127
|
-
* A registry of custom element definitions.
|
128
|
-
*
|
129
|
-
* See https://html.spec.whatwg.org/multipage/scripting.html#customelementsregistry
|
130
|
-
*
|
131
|
-
* @property {boolean} enableFlush Set to true to enable the flush() method
|
132
|
-
* to work. This should only be done for tests, as it causes a memory leak.
|
133
|
-
*/
|
134
|
-
|
135
|
-
var CustomElementRegistry = function () {
|
136
|
-
function CustomElementRegistry() {
|
137
|
-
_classCallCheck(this, CustomElementRegistry);
|
138
|
-
|
139
|
-
/** @private {!Map<string, !CustomElementDefinition>} **/
|
140
|
-
this._definitions = new Map();
|
141
|
-
|
142
|
-
/** @private {!Map<Function, string>} **/
|
143
|
-
this._constructors = new Map();
|
144
|
-
|
145
|
-
/** @private {!Map<string, !Deferred>} **/
|
146
|
-
this._whenDefinedMap = new Map();
|
147
|
-
|
148
|
-
/** @private {!Set<!MutationObserver>} **/
|
149
|
-
this._observers = new Set();
|
150
|
-
|
151
|
-
/** @private {!MutationObserver} **/
|
152
|
-
this._attributeObserver = new MutationObserver(
|
153
|
-
/** @type {function(Array<MutationRecord>, MutationObserver)} */
|
154
|
-
this._handleAttributeChange.bind(this));
|
155
|
-
|
156
|
-
/** @private {?HTMLElement} **/
|
157
|
-
this._newInstance = null;
|
158
|
-
|
159
|
-
/** @private {!Set<string>} **/
|
160
|
-
this._pendingHtmlImportUrls = new Set();
|
161
|
-
|
162
|
-
/** @type {boolean} **/
|
163
|
-
this.enableFlush = true;
|
164
|
-
|
165
|
-
/** @private {boolean} **/
|
166
|
-
this._upgradeScheduled = false;
|
167
|
-
|
168
|
-
/** @type {MutationObserver} **/
|
169
|
-
this._mainDocumentObserver = null;
|
170
|
-
}
|
171
|
-
|
172
|
-
// HTML spec part 4.13.4
|
173
|
-
// https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregistry-define
|
174
|
-
/**
|
175
|
-
* @param {string} name
|
176
|
-
* @param {function(new:HTMLElement)} constructor
|
177
|
-
* @param {{extends: string}} options
|
178
|
-
* @return {undefined}
|
179
|
-
*/
|
180
|
-
|
181
|
-
|
182
|
-
_createClass(CustomElementRegistry, [{
|
183
|
-
key: 'define',
|
184
|
-
value: function define(name, constructor, options) {
|
185
|
-
// 1:
|
186
|
-
if (typeof constructor !== 'function') {
|
187
|
-
throw new TypeError('constructor must be a Constructor');
|
188
|
-
}
|
189
|
-
|
190
|
-
// 2. If constructor is an interface object whose corresponding interface
|
191
|
-
// either is HTMLElement or has HTMLElement in its set of inherited
|
192
|
-
// interfaces, throw a TypeError and abort these steps.
|
193
|
-
//
|
194
|
-
// It doesn't appear possible to check this condition from script
|
195
|
-
|
196
|
-
// 3:
|
197
|
-
var nameError = checkValidCustomElementName(name);
|
198
|
-
if (nameError) throw nameError;
|
199
|
-
|
200
|
-
// 4, 5:
|
201
|
-
// Note: we don't track being-defined names and constructors because
|
202
|
-
// define() isn't normally reentrant. The only time user code can run
|
203
|
-
// during define() is when getting callbacks off the prototype, which
|
204
|
-
// would be highly-unusual. We can make define() reentrant-safe if needed.
|
205
|
-
if (this._definitions.has(name)) {
|
206
|
-
throw new Error('An element with name \'' + name + '\' is already defined');
|
207
|
-
}
|
208
|
-
|
209
|
-
// 6, 7:
|
210
|
-
if (this._constructors.has(constructor)) {
|
211
|
-
throw new Error('Definition failed for \'' + name + '\': ' + 'The constructor is already used.');
|
212
|
-
}
|
213
|
-
|
214
|
-
// 8:
|
215
|
-
/** @type {string} */
|
216
|
-
var localName = name;
|
217
|
-
|
218
|
-
// 9, 10: We do not support extends currently.
|
219
|
-
|
220
|
-
// 11, 12, 13: Our define() isn't rentrant-safe
|
221
|
-
|
222
|
-
// 14.1:
|
223
|
-
/** @type {Object} */
|
224
|
-
var prototype = constructor.prototype;
|
225
|
-
|
226
|
-
// 14.2:
|
227
|
-
if ((typeof prototype === 'undefined' ? 'undefined' : _typeof(prototype)) !== 'object') {
|
228
|
-
throw new TypeError('Definition failed for \'' + name + '\': ' + 'constructor.prototype must be an object');
|
229
|
-
}
|
230
|
-
|
231
|
-
/**
|
232
|
-
* @param {string} callbackName
|
233
|
-
* @return {Function|undefined}
|
234
|
-
*/
|
235
|
-
function getCallback(callbackName) {
|
236
|
-
var callback = prototype[callbackName];
|
237
|
-
if (callback !== undefined && typeof callback !== 'function') {
|
238
|
-
throw new Error(localName + ' \'' + callbackName + '\' is not a Function');
|
239
|
-
}
|
240
|
-
return callback;
|
241
|
-
}
|
242
|
-
|
243
|
-
// 3, 4:
|
244
|
-
var connectedCallback = getCallback('connectedCallback');
|
245
|
-
|
246
|
-
// 5, 6:
|
247
|
-
var disconnectedCallback = getCallback('disconnectedCallback');
|
248
|
-
|
249
|
-
// Divergence from spec: we always throw if attributeChangedCallback is
|
250
|
-
// not a function.
|
251
|
-
|
252
|
-
// 7, 9.1:
|
253
|
-
var attributeChangedCallback = getCallback('attributeChangedCallback');
|
254
|
-
|
255
|
-
// 8, 9.2, 9.3:
|
256
|
-
var observedAttributes = attributeChangedCallback && constructor['observedAttributes'] || [];
|
257
|
-
|
258
|
-
// 15:
|
259
|
-
/** @type {CustomElementDefinition} */
|
260
|
-
var definition = {
|
261
|
-
name: name,
|
262
|
-
localName: localName,
|
263
|
-
constructor: constructor,
|
264
|
-
connectedCallback: connectedCallback,
|
265
|
-
disconnectedCallback: disconnectedCallback,
|
266
|
-
attributeChangedCallback: attributeChangedCallback,
|
267
|
-
observedAttributes: observedAttributes
|
268
|
-
};
|
269
|
-
|
270
|
-
// 16:
|
271
|
-
this._definitions.set(localName, definition);
|
272
|
-
this._constructors.set(constructor, localName);
|
273
|
-
|
274
|
-
// 17, 18, 19:
|
275
|
-
this._upgradeDoc();
|
276
|
-
|
277
|
-
// 20:
|
278
|
-
/** @type {Deferred} **/
|
279
|
-
var deferred = this._whenDefinedMap.get(localName);
|
280
|
-
if (deferred) {
|
281
|
-
deferred.resolve(undefined);
|
282
|
-
this._whenDefinedMap.delete(localName);
|
283
|
-
}
|
284
|
-
}
|
285
|
-
|
286
|
-
/**
|
287
|
-
* Returns the constructor defined for `name`, or `null`.
|
288
|
-
*
|
289
|
-
* @param {string} name
|
290
|
-
* @return {Function|undefined}
|
291
|
-
*/
|
292
|
-
|
293
|
-
}, {
|
294
|
-
key: 'get',
|
295
|
-
value: function get(name) {
|
296
|
-
// https://html.spec.whatwg.org/multipage/scripting.html#custom-elements-api
|
297
|
-
var def = this._definitions.get(name);
|
298
|
-
return def ? def.constructor : undefined;
|
299
|
-
}
|
300
|
-
|
301
|
-
/**
|
302
|
-
* Returns a `Promise` that resolves when a custom element for `name` has
|
303
|
-
* been defined.
|
304
|
-
*
|
305
|
-
* @param {string} name
|
306
|
-
* @return {!Promise}
|
307
|
-
*/
|
308
|
-
|
309
|
-
}, {
|
310
|
-
key: 'whenDefined',
|
311
|
-
value: function whenDefined(name) {
|
312
|
-
// https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregistry-whendefined
|
313
|
-
var nameError = checkValidCustomElementName(name);
|
314
|
-
if (nameError) return Promise.reject(nameError);
|
315
|
-
if (this._definitions.has(name)) return Promise.resolve();
|
316
|
-
|
317
|
-
/** @type {Deferred} **/
|
318
|
-
var deferred = this._whenDefinedMap.get(name);
|
319
|
-
if (deferred) return deferred.promise;
|
320
|
-
|
321
|
-
var resolve = void 0;
|
322
|
-
var promise = new Promise(function (_resolve, _) {
|
323
|
-
resolve = _resolve;
|
324
|
-
});
|
325
|
-
deferred = { promise: promise, resolve: resolve };
|
326
|
-
this._whenDefinedMap.set(name, deferred);
|
327
|
-
return promise;
|
328
|
-
}
|
329
|
-
|
330
|
-
/**
|
331
|
-
* Causes all pending mutation records to be processed, and thus all
|
332
|
-
* customization, upgrades and custom element reactions to be called.
|
333
|
-
* `enableFlush` must be true for this to work. Only use during tests!
|
334
|
-
*/
|
335
|
-
|
336
|
-
}, {
|
337
|
-
key: 'flush',
|
338
|
-
value: function flush() {
|
339
|
-
if (this.enableFlush) {
|
340
|
-
// console.warn("flush!!!");
|
341
|
-
this._handleMutations(this._mainDocumentObserver.takeRecords());
|
342
|
-
this._handleAttributeChange(this._attributeObserver.takeRecords());
|
343
|
-
this._observers.forEach(
|
344
|
-
/**
|
345
|
-
* @param {!MutationObserver} observer
|
346
|
-
* @this {CustomElementRegistry}
|
347
|
-
*/
|
348
|
-
function (observer) {
|
349
|
-
this._handleMutations(observer.takeRecords());
|
350
|
-
}, this);
|
351
|
-
}
|
352
|
-
}
|
353
|
-
|
354
|
-
/**
|
355
|
-
* Upgrade all existing in document elements. This process is expensive so
|
356
|
-
* is optionally batched based on the state of HTMLImports. (Note,
|
357
|
-
* this batching might not be necessary if instead of walking the dom,
|
358
|
-
* a map of upgrade candidates was maintained.)
|
359
|
-
* @private
|
360
|
-
*/
|
361
|
-
|
362
|
-
}, {
|
363
|
-
key: '_upgradeDoc',
|
364
|
-
value: function _upgradeDoc() {
|
365
|
-
var _this2 = this;
|
366
|
-
|
367
|
-
if (!this._upgradeScheduled) {
|
368
|
-
this._upgradeScheduled = true;
|
369
|
-
var onReady = function onReady() {
|
370
|
-
_this2._upgradeScheduled = false;
|
371
|
-
if (!_this2._mainDocumentObserver) {
|
372
|
-
_this2._mainDocumentObserver = _this2._observeRoot(document);
|
373
|
-
}
|
374
|
-
_this2._addNodes(document.childNodes);
|
375
|
-
};
|
376
|
-
if (window['HTMLImports']) {
|
377
|
-
window['HTMLImports']['whenReady'](onReady);
|
378
|
-
} else {
|
379
|
-
onReady();
|
380
|
-
}
|
381
|
-
}
|
382
|
-
}
|
383
|
-
|
384
|
-
/**
|
385
|
-
* @param {?HTMLElement} instance
|
386
|
-
* @private
|
387
|
-
*/
|
388
|
-
|
389
|
-
}, {
|
390
|
-
key: '_setNewInstance',
|
391
|
-
value: function _setNewInstance(instance) {
|
392
|
-
this._newInstance = instance;
|
393
|
-
}
|
394
|
-
|
395
|
-
/**
|
396
|
-
* Observes a DOM root for mutations that trigger upgrades and reactions.
|
397
|
-
* @param {Node} root
|
398
|
-
* @private
|
399
|
-
*/
|
400
|
-
|
401
|
-
}, {
|
402
|
-
key: '_observeRoot',
|
403
|
-
value: function _observeRoot(root) {
|
404
|
-
//console.log('_observeRoot', root, root.baseURI);
|
405
|
-
// console.assert(!root[_observerProp]);
|
406
|
-
if (root[_observerProp] != null) {
|
407
|
-
//console.warn(`Root ${root} is already observed`);
|
408
|
-
return root[_observerProp];
|
409
|
-
}
|
410
|
-
root[_observerProp] = new MutationObserver(
|
411
|
-
/** @type {function(Array<MutationRecord>, MutationObserver)} */
|
412
|
-
this._handleMutations.bind(this));
|
413
|
-
root[_observerProp].observe(root, { childList: true, subtree: true });
|
414
|
-
if (this.enableFlush) {
|
415
|
-
// this is memory leak, only use in tests
|
416
|
-
this._observers.add(root[_observerProp]);
|
417
|
-
}
|
418
|
-
return root[_observerProp];
|
419
|
-
}
|
420
|
-
|
421
|
-
/**
|
422
|
-
* @param {Node} root
|
423
|
-
* @private
|
424
|
-
*/
|
425
|
-
|
426
|
-
}, {
|
427
|
-
key: '_unobserveRoot',
|
428
|
-
value: function _unobserveRoot(root) {
|
429
|
-
if (root[_observerProp] != null) {
|
430
|
-
root[_observerProp].disconnect();
|
431
|
-
if (this.enableFlush) {
|
432
|
-
this._observers.delete(root[_observerProp]);
|
433
|
-
}
|
434
|
-
root[_observerProp] = null;
|
435
|
-
}
|
436
|
-
}
|
437
|
-
|
438
|
-
/**
|
439
|
-
* @param {!Array<!MutationRecord>} mutations
|
440
|
-
* @private
|
441
|
-
*/
|
442
|
-
|
443
|
-
}, {
|
444
|
-
key: '_handleMutations',
|
445
|
-
value: function _handleMutations(mutations) {
|
446
|
-
for (var i = 0; i < mutations.length; i++) {
|
447
|
-
/** @type {!MutationRecord} */
|
448
|
-
var mutation = mutations[i];
|
449
|
-
if (mutation.type === 'childList') {
|
450
|
-
// Note: we can't get an ordering between additions and removals, and
|
451
|
-
// so might diverge from spec reaction ordering
|
452
|
-
var addedNodes = /** @type {!NodeList<!Node>} */mutation.addedNodes;
|
453
|
-
var removedNodes = /** @type {!NodeList<!Node>} */mutation.removedNodes;
|
454
|
-
this._removeNodes(removedNodes, mutation.target);
|
455
|
-
this._addNodes(addedNodes);
|
456
|
-
}
|
457
|
-
}
|
458
|
-
}
|
459
|
-
|
460
|
-
/**
|
461
|
-
* @param {!(NodeList<!Node>|Array<!Node>)} nodeList
|
462
|
-
* @param {?Set<Node>=} visitedNodes
|
463
|
-
* @private
|
464
|
-
*/
|
465
|
-
|
466
|
-
}, {
|
467
|
-
key: '_addNodes',
|
468
|
-
value: function _addNodes(nodeList, visitedNodes) {
|
469
|
-
visitedNodes = visitedNodes || new Set();
|
470
|
-
|
471
|
-
for (var i = 0; i < nodeList.length; i++) {
|
472
|
-
var root = nodeList[i];
|
473
|
-
|
474
|
-
if (!isElement(root)) {
|
475
|
-
continue;
|
476
|
-
}
|
477
|
-
|
478
|
-
// Since we're adding this node to an observed tree, we can unobserve
|
479
|
-
this._unobserveRoot(root);
|
480
|
-
|
481
|
-
var walker = createTreeWalker(root);
|
482
|
-
do {
|
483
|
-
var node = /** @type {!HTMLElement} */walker.currentNode;
|
484
|
-
this._addElement(node, visitedNodes);
|
485
|
-
} while (walker.nextNode());
|
486
|
-
}
|
487
|
-
}
|
488
|
-
|
489
|
-
/**
|
490
|
-
* @param {!HTMLElement} element
|
491
|
-
* @param {!Set<Node>=} visitedNodes
|
492
|
-
*/
|
493
|
-
|
494
|
-
}, {
|
495
|
-
key: '_addElement',
|
496
|
-
value: function _addElement(element, visitedNodes) {
|
497
|
-
if (visitedNodes.has(element)) return;
|
498
|
-
visitedNodes.add(element);
|
499
|
-
|
500
|
-
/** @type {?CustomElementDefinition} */
|
501
|
-
var definition = this._definitions.get(element.localName);
|
502
|
-
if (definition) {
|
503
|
-
if (!element[_upgradedProp]) {
|
504
|
-
this._upgradeElement(element, definition, true);
|
505
|
-
}
|
506
|
-
if (element[_upgradedProp] && !element[_attachedProp] && isConnected(element)) {
|
507
|
-
element[_attachedProp] = true;
|
508
|
-
if (definition.connectedCallback) {
|
509
|
-
definition.connectedCallback.call(element);
|
510
|
-
}
|
511
|
-
}
|
512
|
-
}
|
513
|
-
if (element.shadowRoot) {
|
514
|
-
// TODO(justinfagnani): do we need to check that the shadowRoot
|
515
|
-
// is observed?
|
516
|
-
this._addNodes(element.shadowRoot.childNodes, visitedNodes);
|
517
|
-
}
|
518
|
-
if (isHtmlImport(element)) {
|
519
|
-
this._addImport( /** @type {!HTMLLinkElement} */element, visitedNodes);
|
520
|
-
}
|
521
|
-
}
|
522
|
-
|
523
|
-
/**
|
524
|
-
* @param {!HTMLLinkElement} link
|
525
|
-
* @param {!Set<Node>=} visitedNodes
|
526
|
-
*/
|
527
|
-
|
528
|
-
}, {
|
529
|
-
key: '_addImport',
|
530
|
-
value: function _addImport(link, visitedNodes) {
|
531
|
-
var _this3 = this;
|
532
|
-
|
533
|
-
// During a tree walk to add or upgrade nodes, we may encounter multiple
|
534
|
-
// HTML imports that reference the same document, and may encounter
|
535
|
-
// imports in various states of loading.
|
536
|
-
|
537
|
-
// First, we only want to process the first import for a document in a
|
538
|
-
// walk, so we check visitedNodes for the document, not the link.
|
539
|
-
//
|
540
|
-
// Second, for documents that haven't loaded yet, we only want to add one
|
541
|
-
// listener, regardless of the number of links or walks, so we track
|
542
|
-
// pending loads in _pendingHtmlImportUrls.
|
543
|
-
|
544
|
-
// Check to see if the import is loaded
|
545
|
-
/** @type {?Document} */
|
546
|
-
var _import = link.import;
|
547
|
-
if (_import) {
|
548
|
-
// The import is loaded, but only process the first link element
|
549
|
-
if (visitedNodes.has(_import)) return;
|
550
|
-
visitedNodes.add(_import);
|
551
|
-
|
552
|
-
// The import is loaded observe it
|
553
|
-
if (!_import[_observerProp]) this._observeRoot(_import);
|
554
|
-
|
555
|
-
// walk the document
|
556
|
-
this._addNodes(_import.childNodes, visitedNodes);
|
557
|
-
} else {
|
558
|
-
var _ret = function () {
|
559
|
-
// The import is not loaded, so wait for it
|
560
|
-
/** @type {string} */
|
561
|
-
var importUrl = link.href;
|
562
|
-
if (_this3._pendingHtmlImportUrls.has(importUrl)) return {
|
563
|
-
v: void 0
|
564
|
-
};
|
565
|
-
_this3._pendingHtmlImportUrls.add(importUrl);
|
566
|
-
|
567
|
-
/**
|
568
|
-
* @const
|
569
|
-
* @type {CustomElementRegistry}
|
570
|
-
*/
|
571
|
-
var _this = _this3;
|
572
|
-
var onLoad = function onLoad() {
|
573
|
-
link.removeEventListener('load', /** @type {function(Event)} */onLoad);
|
574
|
-
if (!link.import[_observerProp]) _this._observeRoot(link.import);
|
575
|
-
// We don't pass visitedNodes because this is async and not part of
|
576
|
-
// the current tree walk.
|
577
|
-
_this._addNodes(link.import.childNodes);
|
578
|
-
};
|
579
|
-
link.addEventListener('load', onLoad);
|
580
|
-
}();
|
581
|
-
|
582
|
-
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
|
583
|
-
}
|
584
|
-
}
|
585
|
-
|
586
|
-
/**
|
587
|
-
* @param {NodeList} nodeList
|
588
|
-
* @private
|
589
|
-
*/
|
590
|
-
|
591
|
-
}, {
|
592
|
-
key: '_removeNodes',
|
593
|
-
value: function _removeNodes(nodeList, parentNode) {
|
594
|
-
for (var i = 0; i < nodeList.length; i++) {
|
595
|
-
var root = nodeList[i];
|
596
|
-
|
597
|
-
if (!isElement(root)) {
|
598
|
-
continue;
|
599
|
-
}
|
600
|
-
|
601
|
-
// Since we're detatching this element from an observed root, we need to
|
602
|
-
// reobserve it.
|
603
|
-
// TODO(justinfagnani): can we do this in a microtask so we don't thrash
|
604
|
-
// on creating and destroying MutationObservers on batch DOM mutations?
|
605
|
-
this._observeRoot(root);
|
606
|
-
|
607
|
-
var walker = createTreeWalker(root);
|
608
|
-
do {
|
609
|
-
var node = walker.currentNode;
|
610
|
-
if (node[_upgradedProp] && node[_attachedProp] && isConnected(parentNode)) {
|
611
|
-
node[_attachedProp] = false;
|
612
|
-
var definition = this._definitions.get(node.localName);
|
613
|
-
if (definition && definition.disconnectedCallback) {
|
614
|
-
definition.disconnectedCallback.call(node);
|
615
|
-
}
|
616
|
-
}
|
617
|
-
} while (walker.nextNode());
|
618
|
-
}
|
619
|
-
}
|
620
|
-
|
621
|
-
/**
|
622
|
-
* Upgrades or customizes a custom element.
|
623
|
-
*
|
624
|
-
* @param {HTMLElement} element
|
625
|
-
* @param {CustomElementDefinition} definition
|
626
|
-
* @param {boolean} callConstructor
|
627
|
-
* @private
|
628
|
-
*/
|
629
|
-
|
630
|
-
}, {
|
631
|
-
key: '_upgradeElement',
|
632
|
-
value: function _upgradeElement(element, definition, callConstructor) {
|
633
|
-
var prototype = definition.constructor.prototype;
|
634
|
-
element.__proto__ = prototype;
|
635
|
-
if (callConstructor) {
|
636
|
-
this._setNewInstance(element);
|
637
|
-
new definition.constructor();
|
638
|
-
element[_upgradedProp] = true;
|
639
|
-
console.assert(this._newInstance == null);
|
640
|
-
}
|
641
|
-
|
642
|
-
var observedAttributes = definition.observedAttributes;
|
643
|
-
var attributeChangedCallback = definition.attributeChangedCallback;
|
644
|
-
if (attributeChangedCallback && observedAttributes.length > 0) {
|
645
|
-
this._attributeObserver.observe(element, {
|
646
|
-
attributes: true,
|
647
|
-
attributeOldValue: true,
|
648
|
-
attributeFilter: observedAttributes
|
649
|
-
});
|
650
|
-
|
651
|
-
// Trigger attributeChangedCallback for existing attributes.
|
652
|
-
// https://html.spec.whatwg.org/multipage/scripting.html#upgrades
|
653
|
-
for (var i = 0; i < observedAttributes.length; i++) {
|
654
|
-
var name = observedAttributes[i];
|
655
|
-
if (element.hasAttribute(name)) {
|
656
|
-
var value = element.getAttribute(name);
|
657
|
-
attributeChangedCallback.call(element, name, null, value, null);
|
658
|
-
}
|
659
|
-
}
|
660
|
-
}
|
661
|
-
}
|
662
|
-
|
663
|
-
/**
|
664
|
-
* @param {!Array<!MutationRecord>} mutations
|
665
|
-
* @private
|
666
|
-
*/
|
667
|
-
|
668
|
-
}, {
|
669
|
-
key: '_handleAttributeChange',
|
670
|
-
value: function _handleAttributeChange(mutations) {
|
671
|
-
for (var i = 0; i < mutations.length; i++) {
|
672
|
-
var mutation = mutations[i];
|
673
|
-
if (mutation.type === 'attributes') {
|
674
|
-
var target = /** @type {HTMLElement} */mutation.target;
|
675
|
-
// We should be gaurenteed to have a definition because this mutation
|
676
|
-
// observer is only observing custom elements observedAttributes
|
677
|
-
var definition = this._definitions.get(target.localName);
|
678
|
-
var name = /** @type {!string} */mutation.attributeName;
|
679
|
-
var oldValue = mutation.oldValue;
|
680
|
-
var newValue = target.getAttribute(name);
|
681
|
-
// Skip changes that were handled synchronously by setAttribute
|
682
|
-
if (newValue !== oldValue) {
|
683
|
-
var namespace = mutation.attributeNamespace;
|
684
|
-
definition.attributeChangedCallback.call(target, name, oldValue, newValue, namespace);
|
685
|
-
}
|
686
|
-
}
|
687
|
-
}
|
688
|
-
}
|
689
|
-
}]);
|
690
|
-
|
691
|
-
return CustomElementRegistry;
|
692
|
-
}();
|
693
|
-
|
694
|
-
// Closure Compiler Exports
|
695
|
-
|
696
|
-
|
697
|
-
window['CustomElementRegistry'] = CustomElementRegistry;
|
698
|
-
CustomElementRegistry.prototype['define'] = CustomElementRegistry.prototype.define;
|
699
|
-
CustomElementRegistry.prototype['get'] = CustomElementRegistry.prototype.get;
|
700
|
-
CustomElementRegistry.prototype['whenDefined'] = CustomElementRegistry.prototype.whenDefined;
|
701
|
-
CustomElementRegistry.prototype['flush'] = CustomElementRegistry.prototype.flush;
|
702
|
-
CustomElementRegistry.prototype['polyfilled'] = true;
|
703
|
-
// TODO(justinfagnani): remove these in production code
|
704
|
-
CustomElementRegistry.prototype['_observeRoot'] = CustomElementRegistry.prototype._observeRoot;
|
705
|
-
CustomElementRegistry.prototype['_addImport'] = CustomElementRegistry.prototype._addImport;
|
706
|
-
|
707
|
-
// patch window.HTMLElement
|
708
|
-
|
709
|
-
/** @const */
|
710
|
-
var origHTMLElement = window.HTMLElement;
|
711
|
-
CustomElementRegistry.prototype['nativeHTMLElement'] = origHTMLElement;
|
712
|
-
/**
|
713
|
-
* @type {function(new: HTMLElement)}
|
714
|
-
*/
|
715
|
-
var newHTMLElement = function HTMLElement() {
|
716
|
-
var customElements = _customElements();
|
717
|
-
|
718
|
-
// If there's an being upgraded, return that
|
719
|
-
if (customElements._newInstance) {
|
720
|
-
var i = customElements._newInstance;
|
721
|
-
customElements._newInstance = null;
|
722
|
-
return i;
|
723
|
-
}
|
724
|
-
if (this.constructor) {
|
725
|
-
// Find the tagname of the constructor and create a new element with it
|
726
|
-
var tagName = customElements._constructors.get(this.constructor);
|
727
|
-
return _createElement(document, tagName, undefined, false);
|
728
|
-
}
|
729
|
-
throw new Error('Unknown constructor. Did you call customElements.define()?');
|
730
|
-
};
|
731
|
-
window.HTMLElement = newHTMLElement;
|
732
|
-
// By setting the patched HTMLElement's prototype property to the native
|
733
|
-
// HTMLElement's prototype we make sure that:
|
734
|
-
// document.createElement('a') instanceof HTMLElement
|
735
|
-
// works because instanceof uses HTMLElement.prototype, which is on the
|
736
|
-
// ptototype chain of built-in elements.
|
737
|
-
window.HTMLElement.prototype = origHTMLElement.prototype;
|
738
|
-
|
739
|
-
// patch doc.createElement
|
740
|
-
// TODO(justinfagnani): why is the cast neccessary?
|
741
|
-
// Can we fix the Closure DOM externs?
|
742
|
-
var _nativeCreateElement =
|
743
|
-
/** @type {function(this:Document, string, (Object|undefined)=): !HTMLElement}}*/
|
744
|
-
document.createElement;
|
745
|
-
|
746
|
-
/**
|
747
|
-
* Creates a new element and upgrades it if it's a custom element.
|
748
|
-
* @param {!Document} doc
|
749
|
-
* @param {!string} tagName
|
750
|
-
* @param {Object|undefined} options
|
751
|
-
* @param {boolean} callConstructor whether or not to call the elements
|
752
|
-
* constructor after upgrading. If an element is created by calling its
|
753
|
-
* constructor, then `callConstructor` should be false to prevent double
|
754
|
-
* initialization.
|
755
|
-
*/
|
756
|
-
function _createElement(doc, tagName, options, callConstructor) {
|
757
|
-
var customElements = _customElements();
|
758
|
-
var element = options ? _nativeCreateElement.call(doc, tagName, options) : _nativeCreateElement.call(doc, tagName);
|
759
|
-
var definition = customElements._definitions.get(tagName.toLowerCase());
|
760
|
-
if (definition) {
|
761
|
-
customElements._upgradeElement(element, definition, callConstructor);
|
762
|
-
}
|
763
|
-
customElements._observeRoot(element);
|
764
|
-
return element;
|
765
|
-
};
|
766
|
-
document.createElement = function (tagName, options) {
|
767
|
-
return _createElement(document, tagName, options, true);
|
768
|
-
};
|
769
|
-
|
770
|
-
// patch document.createElementNS
|
771
|
-
|
772
|
-
var HTMLNS = 'http://www.w3.org/1999/xhtml';
|
773
|
-
|
774
|
-
/** @type {function(this:Document,string,string):Element} */
|
775
|
-
var _nativeCreateElementNS = document.createElementNS;
|
776
|
-
document.createElementNS =
|
777
|
-
/** @type {function(this:Document,(string|null),string):!Element} */
|
778
|
-
function (namespaceURI, qualifiedName) {
|
779
|
-
if (namespaceURI === HTMLNS) {
|
780
|
-
return document.createElement(qualifiedName);
|
781
|
-
} else {
|
782
|
-
return _nativeCreateElementNS.call(document, namespaceURI, qualifiedName);
|
783
|
-
}
|
784
|
-
};
|
785
|
-
|
786
|
-
// patch Element.attachShadow
|
787
|
-
|
788
|
-
/** @type {function({closed: boolean})} */
|
789
|
-
var _nativeAttachShadow = Element.prototype['attachShadow'];
|
790
|
-
if (_nativeAttachShadow) {
|
791
|
-
Object.defineProperty(Element.prototype, 'attachShadow', {
|
792
|
-
value: function value(options) {
|
793
|
-
/** @type {!Node} */
|
794
|
-
var root = _nativeAttachShadow.call(this, options);
|
795
|
-
/** @type {CustomElementRegistry} */
|
796
|
-
var customElements = _customElements();
|
797
|
-
customElements._observeRoot(root);
|
798
|
-
return root;
|
799
|
-
}
|
800
|
-
});
|
801
|
-
}
|
802
|
-
|
803
|
-
// patch document.importNode
|
804
|
-
|
805
|
-
var _nativeImportNode = document.importNode;
|
806
|
-
document.importNode = function (node, deep) {
|
807
|
-
var clone = /** @type{!Node} */_nativeImportNode.call(document, node, deep);
|
808
|
-
var customElements = _customElements();
|
809
|
-
var nodes = isElement(clone) ? [clone] : clone.childNodes;
|
810
|
-
/** @type {CustomElementRegistry} */_customElements()._addNodes(nodes);
|
811
|
-
return clone;
|
812
|
-
};
|
813
|
-
|
814
|
-
// patch Element.setAttribute & removeAttribute
|
815
|
-
|
816
|
-
var _nativeSetAttribute = Element.prototype.setAttribute;
|
817
|
-
Element.prototype['setAttribute'] = function (name, value) {
|
818
|
-
changeAttribute(this, name, value, _nativeSetAttribute);
|
819
|
-
};
|
820
|
-
var _nativeRemoveAttribute = Element.prototype.removeAttribute;
|
821
|
-
Element.prototype['removeAttribute'] = function (name) {
|
822
|
-
changeAttribute(this, name, null, _nativeRemoveAttribute);
|
823
|
-
};
|
824
|
-
|
825
|
-
function changeAttribute(element, name, value, operation) {
|
826
|
-
name = name.toLowerCase();
|
827
|
-
var oldValue = element.getAttribute(name);
|
828
|
-
operation.call(element, name, value);
|
829
|
-
|
830
|
-
// Bail if this wasn't a fully upgraded custom element
|
831
|
-
if (element[_upgradedProp] == true) {
|
832
|
-
var definition = _customElements()._definitions.get(element.localName);
|
833
|
-
var observedAttributes = definition.observedAttributes;
|
834
|
-
var attributeChangedCallback = definition.attributeChangedCallback;
|
835
|
-
if (attributeChangedCallback && observedAttributes.indexOf(name) >= 0) {
|
836
|
-
var newValue = element.getAttribute(name);
|
837
|
-
if (newValue !== oldValue) {
|
838
|
-
attributeChangedCallback.call(element, name, oldValue, newValue, null);
|
839
|
-
}
|
840
|
-
}
|
841
|
-
}
|
842
|
-
}
|
843
|
-
|
844
|
-
Object.defineProperty(window, 'customElements', {
|
845
|
-
value: new CustomElementRegistry(),
|
846
|
-
configurable: true,
|
847
|
-
enumerable: true
|
848
|
-
});
|
849
|
-
|
850
|
-
// TODO(justinfagnani): Remove. Temporary for backward-compatibility
|
851
|
-
window['CustomElements'] = {
|
852
|
-
takeRecords: function takeRecords() {
|
853
|
-
if (_customElements().flush) _customElements().flush();
|
854
|
-
}
|
855
|
-
};
|
856
|
-
})();
|
1
|
+
(function(){
|
2
|
+
'use strict';var h="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,e){if(e.get||e.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=e.value)},k="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function m(){m=function(){};k.Symbol||(k.Symbol=aa)}var ba=0;function aa(a){return"jscomp_symbol_"+(a||"")+ba++}
|
3
|
+
function n(){m();var a=k.Symbol.iterator;a||(a=k.Symbol.iterator=k.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&h(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return q(this)}});n=function(){}}function q(a){var b=0;return r(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}function r(a){n();a={next:a};a[k.Symbol.iterator]=function(){return this};return a}function t(a){n();var b=a[Symbol.iterator];return b?b.call(a):q(a)}
|
4
|
+
function u(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function v(a,b){if(b){var e=k;a=a.split(".");for(var d=0;d<a.length-1;d++){var c=a[d];c in e||(e[c]={});e=e[c]}a=a[a.length-1];d=e[a];b=b(d);b!=d&&null!=b&&h(e,a,{configurable:!0,writable:!0,value:b})}}
|
5
|
+
v("WeakMap",function(a){function b(a){this.a=(f+=Math.random()+1).toString();if(a){m();n();a=t(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}}function e(a){u(a,c)||h(a,c,{value:{}})}function d(a){var b=Object[a];b&&(Object[a]=function(a){e(a);return b(a)})}if(function(){if(!a||!Object.seal)return!1;try{var b=Object.seal({}),c=Object.seal({}),f=new a([[b,2],[c,3]]);if(2!=f.get(b)||3!=f.get(c))return!1;f.delete(b);f.set(c,4);return!f.has(b)&&4==f.get(c)}catch(H){return!1}}())return a;
|
6
|
+
var c="$jscomp_hidden_"+Math.random().toString().substring(2);d("freeze");d("preventExtensions");d("seal");var f=0;b.prototype.set=function(a,b){e(a);if(!u(a,c))throw Error("WeakMap key fail: "+a);a[c][this.a]=b;return this};b.prototype.get=function(a){return u(a,c)?a[c][this.a]:void 0};b.prototype.has=function(a){return u(a,c)&&u(a[c],this.a)};b.prototype.delete=function(a){return u(a,c)&&u(a[c],this.a)?delete a[c][this.a]:!1};return b});
|
7
|
+
v("Map",function(a){function b(){var a={};return a.j=a.next=a.head=a}function e(a,b){var c=a.a;return r(function(){if(c){for(;c.head!=a.a;)c=c.j;for(;c.next!=c.head;)return c=c.next,{done:!1,value:b(c)};c=null}return{done:!0,value:void 0}})}function d(a,b){var c;c=b&&typeof b;"object"==c||"function"==c?f.has(b)?c=f.get(b):(c=""+ ++g,f.set(b,c)):c="p_"+b;var e=a.b[c];if(e&&u(a.b,c))for(a=0;a<e.length;a++){var d=e[a];if(b!==b&&d.key!==d.key||b===d.key)return{id:c,list:e,index:a,f:d}}return{id:c,list:e,
|
8
|
+
index:-1,f:void 0}}function c(a){this.b={};this.a=b();this.size=0;if(a){a=t(a);for(var c;!(c=a.next()).done;)c=c.value,this.set(c[0],c[1])}}if(function(){if(!a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var b=Object.seal({x:4}),c=new a(t([[b,"s"]]));if("s"!=c.get(b)||1!=c.size||c.get({x:4})||c.set({x:4},"t")!=c||2!=c.size)return!1;var f=c.entries(),e=f.next();if(e.done||e.value[0]!=b||"s"!=e.value[1])return!1;e=f.next();return e.done||4!=e.value[0].x||"t"!=e.value[1]||!f.next().done?
|
9
|
+
!1:!0}catch(Ha){return!1}}())return a;m();n();var f=new WeakMap;c.prototype.set=function(a,b){var c=d(this,a);c.list||(c.list=this.b[c.id]=[]);c.f?c.f.value=b:(c.f={next:this.a,j:this.a.j,head:this.a,key:a,value:b},c.list.push(c.f),this.a.j.next=c.f,this.a.j=c.f,this.size++);return this};c.prototype.delete=function(a){a=d(this,a);return a.f&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.b[a.id],a.f.j.next=a.f.next,a.f.next.j=a.f.j,a.f.head=null,this.size--,!0):!1};c.prototype.clear=
|
10
|
+
function(){this.b={};this.a=this.a.j=b();this.size=0};c.prototype.has=function(a){return!!d(this,a).f};c.prototype.get=function(a){return(a=d(this,a).f)&&a.value};c.prototype.entries=function(){return e(this,function(a){return[a.key,a.value]})};c.prototype.keys=function(){return e(this,function(a){return a.key})};c.prototype.values=function(){return e(this,function(a){return a.value})};c.prototype.forEach=function(a,b){for(var c=this.entries(),e;!(e=c.next()).done;)e=e.value,a.call(b,e[1],e[0],this)};
|
11
|
+
c.prototype[Symbol.iterator]=c.prototype.entries;var g=0;return c});
|
12
|
+
v("Set",function(a){function b(a){this.a=new Map;if(a){a=t(a);for(var b;!(b=a.next()).done;)this.add(b.value)}this.size=this.a.size}if(function(){if(!a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var b=Object.seal({x:4}),d=new a(t([b]));if(!d.has(b)||1!=d.size||d.add(b)!=d||1!=d.size||d.add({x:4})!=d||2!=d.size)return!1;var c=d.entries(),f=c.next();if(f.done||f.value[0]!=b||f.value[1]!=b)return!1;f=c.next();return f.done||f.value[0]==b||4!=f.value[0].x||f.value[1]!=f.value[0]?
|
13
|
+
!1:c.next().done}catch(g){return!1}}())return a;m();n();b.prototype.add=function(a){this.a.set(a,a);this.size=this.a.size;return this};b.prototype.delete=function(a){a=this.a.delete(a);this.size=this.a.size;return a};b.prototype.clear=function(){this.a.clear();this.size=0};b.prototype.has=function(a){return this.a.has(a)};b.prototype.entries=function(){return this.a.entries()};b.prototype.values=function(){return this.a.values()};b.prototype.keys=b.prototype.values;b.prototype[Symbol.iterator]=b.prototype.values;
|
14
|
+
b.prototype.forEach=function(a,b){var c=this;this.a.forEach(function(f){return a.call(b,f,f,c)})};return b});
|
15
|
+
v("Promise",function(a){function b(a){this.b=0;this.i=void 0;this.a=[];var b=this.g();try{a(b.resolve,b.reject)}catch(l){b.reject(l)}}function e(){this.a=null}if(a)return a;e.prototype.b=function(a){this.a||(this.a=[],this.g());this.a.push(a)};e.prototype.g=function(){var a=this;this.c(function(){a.i()})};var d=k.setTimeout;e.prototype.c=function(a){d(a,0)};e.prototype.i=function(){for(;this.a&&this.a.length;){var a=this.a;this.a=[];for(var b=0;b<a.length;++b){var c=a[b];delete a[b];try{c()}catch(p){this.h(p)}}}this.a=
|
16
|
+
null};e.prototype.h=function(a){this.c(function(){throw a;})};b.prototype.g=function(){function a(a){return function(e){c||(c=!0,a.call(b,e))}}var b=this,c=!1;return{resolve:a(this.v),reject:a(this.h)}};b.prototype.v=function(a){if(a===this)this.h(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof b)this.w(a);else{var c;a:switch(typeof a){case "object":c=null!=a;break a;case "function":c=!0;break a;default:c=!1}c?this.s(a):this.l(a)}};b.prototype.s=function(a){var b=void 0;
|
17
|
+
try{b=a.then}catch(l){this.h(l);return}"function"==typeof b?this.A(b,a):this.l(a)};b.prototype.h=function(a){this.m(2,a)};b.prototype.l=function(a){this.m(1,a)};b.prototype.m=function(a,b){if(0!=this.b)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.b);this.b=a;this.i=b;this.o()};b.prototype.o=function(){if(this.a){for(var a=this.a,b=0;b<a.length;++b)a[b].call(),a[b]=null;this.a=null}};var c=new e;b.prototype.w=function(a){var b=this.g();a.c(b.resolve,b.reject)};b.prototype.A=
|
18
|
+
function(a,b){var c=this.g();try{a.call(b,c.resolve,c.reject)}catch(p){c.reject(p)}};b.prototype.then=function(a,c){function e(a,b){return"function"==typeof a?function(b){try{d(a(b))}catch(ma){f(ma)}}:b}var d,f,g=new b(function(a,b){d=a;f=b});this.c(e(a,d),e(c,f));return g};b.prototype.catch=function(a){return this.then(void 0,a)};b.prototype.c=function(a,b){function e(){switch(d.b){case 1:a(d.i);break;case 2:b(d.i);break;default:throw Error("Unexpected state: "+d.b);}}var d=this;this.a?this.a.push(function(){c.b(e)}):
|
19
|
+
c.b(e)};b.resolve=function(a){return a instanceof b?a:new b(function(b){b(a)})};b.reject=function(a){return new b(function(b,c){c(a)})};b.b=function(a){return new b(function(c,e){for(var d=t(a),f=d.next();!f.done;f=d.next())b.resolve(f.value).c(c,e)})};b.a=function(a){var c=t(a),e=c.next();return e.done?b.resolve([]):new b(function(a,d){function f(b){return function(c){g[b]=c;l--;l||a(g)}}var g=[],l=0;do g.push(void 0),l++,b.resolve(e.value).c(f(g.length-1),d),e=c.next();while(!e.done)})};b.$jscomp$new$AsyncExecutor=
|
20
|
+
function(){return new e};return b});v("Object.setPrototypeOf",function(a){return a?a:"object"!=typeof"".__proto__?null:function(a,e){a.__proto__=e;if(a.__proto__!==e)throw new TypeError(a+" is not extensible");return a}});var w=new function(){};var ca=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function x(a){var b=ca.has(a);a=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(a);return!b&&a}function y(a){var b=a.isConnected;if(void 0!==b)return b;for(;a&&!(a.__CE_isImportDocument||a instanceof Document);)a=a.parentNode||(window.ShadowRoot&&a instanceof ShadowRoot?a.host:void 0);return!(!a||!(a.__CE_isImportDocument||a instanceof Document))}
|
21
|
+
function z(a,b){for(;b&&b!==a&&!b.nextSibling;)b=b.parentNode;return b&&b!==a?b.nextSibling:null}
|
22
|
+
function A(a,b,e){e=e?e:new Set;for(var d=a;d;){if(d.nodeType===Node.ELEMENT_NODE){var c=d;b(c);var f=c.localName;if("link"===f&&"import"===c.getAttribute("rel")){d=c.import;if(d instanceof Node&&!e.has(d))for(e.add(d),d=d.firstChild;d;d=d.nextSibling)A(d,b,e);d=z(a,c);continue}else if("template"===f){d=z(a,c);continue}if(c=c.__CE_shadowRoot)for(c=c.firstChild;c;c=c.nextSibling)A(c,b,e)}d=d.firstChild?d.firstChild:z(a,d)}}function B(a,b,e){a[b]=e};function C(){this.a=new Map;this.g=new Map;this.c=[];this.b=!1}function da(a,b,e){a.a.set(b,e);a.g.set(e.constructor,e)}function D(a,b){a.b=!0;a.c.push(b)}function E(a,b){a.b&&A(b,function(b){return F(a,b)})}function F(a,b){if(a.b&&!b.__CE_patched){b.__CE_patched=!0;for(var e=0;e<a.c.length;e++)a.c[e](b)}}function G(a,b){var e=[];A(b,function(a){return e.push(a)});for(b=0;b<e.length;b++){var d=e[b];1===d.__CE_state?a.connectedCallback(d):I(a,d)}}
|
23
|
+
function J(a,b){var e=[];A(b,function(a){return e.push(a)});for(b=0;b<e.length;b++){var d=e[b];1===d.__CE_state&&a.disconnectedCallback(d)}}
|
24
|
+
function K(a,b,e){e=e?e:new Set;var d=[];A(b,function(b){if("link"===b.localName&&"import"===b.getAttribute("rel")){var c=b.import;c instanceof Node&&"complete"===c.readyState?(c.__CE_isImportDocument=!0,c.__CE_hasRegistry=!0):b.addEventListener("load",function(){var c=b.import;c.__CE_documentLoadHandled||(c.__CE_documentLoadHandled=!0,c.__CE_isImportDocument=!0,c.__CE_hasRegistry=!0,new Set(e),e.delete(c),K(a,c,e))})}else d.push(b)},e);if(a.b)for(b=0;b<d.length;b++)F(a,d[b]);for(b=0;b<d.length;b++)I(a,
|
25
|
+
d[b])}
|
26
|
+
function I(a,b){if(void 0===b.__CE_state){var e=a.a.get(b.localName);if(e){e.constructionStack.push(b);var d=e.constructor;try{try{if(new d!==b)throw Error("The custom element constructor did not produce the element being upgraded.");}finally{e.constructionStack.pop()}}catch(g){throw b.__CE_state=2,g;}b.__CE_state=1;b.__CE_definition=e;if(e.attributeChangedCallback)for(e=e.observedAttributes,d=0;d<e.length;d++){var c=e[d],f=b.getAttribute(c);null!==f&&a.attributeChangedCallback(b,c,null,f,null)}y(b)&&a.connectedCallback(b)}}}
|
27
|
+
C.prototype.connectedCallback=function(a){var b=a.__CE_definition;b.connectedCallback&&b.connectedCallback.call(a)};C.prototype.disconnectedCallback=function(a){var b=a.__CE_definition;b.disconnectedCallback&&b.disconnectedCallback.call(a)};C.prototype.attributeChangedCallback=function(a,b,e,d,c){var f=a.__CE_definition;f.attributeChangedCallback&&-1<f.observedAttributes.indexOf(b)&&f.attributeChangedCallback.call(a,b,e,d,c)};function L(a,b){this.c=a;this.a=b;this.b=void 0;K(this.c,this.a);"loading"===this.a.readyState&&(this.b=new MutationObserver(this.g.bind(this)),this.b.observe(this.a,{childList:!0,subtree:!0}))}function M(a){a.b&&a.b.disconnect()}L.prototype.g=function(a){var b=this.a.readyState;"interactive"!==b&&"complete"!==b||M(this);for(b=0;b<a.length;b++)for(var e=a[b].addedNodes,d=0;d<e.length;d++)K(this.c,e[d])};function N(){var a=this;this.b=this.a=void 0;this.c=new Promise(function(b){a.b=b;a.a&&b(a.a)})}N.prototype.resolve=function(a){if(this.a)throw Error("Already resolved.");this.a=a;this.b&&this.b(a)};function O(a){this.g=!1;this.a=a;this.i=new Map;this.h=function(a){return a()};this.b=!1;this.c=[];this.l=new L(a,document)}
|
28
|
+
O.prototype.m=function(a,b){var e=this;if(!(b instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!x(a))throw new SyntaxError("The element name '"+a+"' is not valid.");if(this.a.a.get(a))throw Error("A custom element with name '"+a+"' has already been defined.");if(this.g)throw Error("A custom element is already being defined.");this.g=!0;var d,c,f,g,l;try{var p=function(a){var b=H[a];if(void 0!==b&&!(b instanceof Function))throw Error("The '"+a+"' callback must be a function.");
|
29
|
+
return b},H=b.prototype;if(!(H instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");d=p("connectedCallback");c=p("disconnectedCallback");f=p("adoptedCallback");g=p("attributeChangedCallback");l=b.observedAttributes||[]}catch(Ga){return}finally{this.g=!1}da(this.a,a,{localName:a,constructor:b,connectedCallback:d,disconnectedCallback:c,adoptedCallback:f,attributeChangedCallback:g,observedAttributes:l,constructionStack:[]});this.c.push(a);this.b||(this.b=
|
30
|
+
!0,this.h(function(){if(!1!==e.b)for(e.b=!1,K(e.a,document);0<e.c.length;){var a=e.c.shift();(a=e.i.get(a))&&a.resolve(void 0)}}))};O.prototype.get=function(a){if(a=this.a.a.get(a))return a.constructor};O.prototype.s=function(a){if(!x(a))return Promise.reject(new SyntaxError("'"+a+"' is not a valid custom element name."));var b=this.i.get(a);if(b)return b.c;b=new N;this.i.set(a,b);this.a.a.get(a)&&-1===this.c.indexOf(a)&&b.resolve(void 0);return b.c};
|
31
|
+
O.prototype.o=function(a){M(this.l);var b=this.h;this.h=function(e){return a(function(){return b(e)})}};window.CustomElementRegistry=O;O.prototype.define=O.prototype.m;O.prototype.get=O.prototype.get;O.prototype.whenDefined=O.prototype.s;O.prototype.polyfillWrapFlushCallback=O.prototype.o;var P=window.Document.prototype.createElement,ea=window.Document.prototype.createElementNS,fa=window.Document.prototype.importNode,ga=window.Document.prototype.prepend,ha=window.Document.prototype.append,Q=window.Node.prototype.cloneNode,R=window.Node.prototype.appendChild,ia=window.Node.prototype.insertBefore,S=window.Node.prototype.removeChild,ja=window.Node.prototype.replaceChild,T=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),ka=window.Element.prototype.attachShadow,U=Object.getOwnPropertyDescriptor(window.Element.prototype,
|
32
|
+
"innerHTML"),V=window.Element.prototype.getAttribute,la=window.Element.prototype.setAttribute,na=window.Element.prototype.removeAttribute,W=window.Element.prototype.getAttributeNS,oa=window.Element.prototype.setAttributeNS,pa=window.Element.prototype.removeAttributeNS,qa=window.Element.prototype.insertAdjacentElement,ra=window.Element.prototype.prepend,sa=window.Element.prototype.append,ta=window.Element.prototype.before,ua=window.Element.prototype.after,va=window.Element.prototype.replaceWith,wa=
|
33
|
+
window.Element.prototype.remove,xa=window.HTMLElement,X=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),ya=window.HTMLElement.prototype.insertAdjacentElement;function za(){var a=Y;window.HTMLElement=function(){function b(){var b=this.constructor,d=a.g.get(b);if(!d)throw Error("The custom element being constructed was not registered with `customElements`.");var c=d.constructionStack;if(!c.length)return c=P.call(document,d.localName),Object.setPrototypeOf(c,b.prototype),c.__CE_state=1,c.__CE_definition=d,F(a,c),c;var d=c.length-1,f=c[d];if(f===w)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");
|
34
|
+
c[d]=w;Object.setPrototypeOf(f,b.prototype);F(a,f);return f}b.prototype=xa.prototype;return b}()};function Aa(a,b,e){b.prepend=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];d=c.filter(function(a){return a instanceof Node&&y(a)});e.u.apply(this,c);for(var g=0;g<d.length;g++)J(a,d[g]);if(y(this))for(d=0;d<c.length;d++)g=c[d],g instanceof Element&&G(a,g)};b.append=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];d=c.filter(function(a){return a instanceof Node&&y(a)});e.append.apply(this,c);for(var g=0;g<d.length;g++)J(a,d[g]);if(y(this))for(d=0;d<
|
35
|
+
c.length;d++)g=c[d],g instanceof Element&&G(a,g)}};function Ba(){var a=Y;B(Document.prototype,"createElement",function(b){if(this.__CE_hasRegistry){var e=a.a.get(b);if(e)return new e.constructor}b=P.call(this,b);F(a,b);return b});B(Document.prototype,"importNode",function(b,e){b=fa.call(this,b,e);this.__CE_hasRegistry?K(a,b):E(a,b);return b});B(Document.prototype,"createElementNS",function(b,e){if(this.__CE_hasRegistry&&(null===b||"http://www.w3.org/1999/xhtml"===b)){var d=a.a.get(e);if(d)return new d.constructor}b=ea.call(this,b,e);F(a,b);return b});
|
36
|
+
Aa(a,Document.prototype,{u:ga,append:ha})};function Ca(){var a=Y;function b(b,d){Object.defineProperty(b,"textContent",{enumerable:d.enumerable,configurable:!0,get:d.get,set:function(b){if(this.nodeType===Node.TEXT_NODE)d.set.call(this,b);else{var c=void 0;if(this.firstChild){var e=this.childNodes,l=e.length;if(0<l&&y(this))for(var c=Array(l),p=0;p<l;p++)c[p]=e[p]}d.set.call(this,b);if(c)for(b=0;b<c.length;b++)J(a,c[b])}}})}B(Node.prototype,"insertBefore",function(b,d){if(b instanceof DocumentFragment){var c=Array.prototype.slice.apply(b.childNodes);
|
37
|
+
b=ia.call(this,b,d);if(y(this))for(d=0;d<c.length;d++)G(a,c[d]);return b}c=y(b);d=ia.call(this,b,d);c&&J(a,b);y(this)&&G(a,b);return d});B(Node.prototype,"appendChild",function(b){if(b instanceof DocumentFragment){var d=Array.prototype.slice.apply(b.childNodes);b=R.call(this,b);if(y(this))for(var c=0;c<d.length;c++)G(a,d[c]);return b}d=y(b);c=R.call(this,b);d&&J(a,b);y(this)&&G(a,b);return c});B(Node.prototype,"cloneNode",function(b){b=Q.call(this,b);this.ownerDocument.__CE_hasRegistry?K(a,b):E(a,
|
38
|
+
b);return b});B(Node.prototype,"removeChild",function(b){var d=y(b),c=S.call(this,b);d&&J(a,b);return c});B(Node.prototype,"replaceChild",function(b,d){if(b instanceof DocumentFragment){var c=Array.prototype.slice.apply(b.childNodes);b=ja.call(this,b,d);if(y(this))for(J(a,d),d=0;d<c.length;d++)G(a,c[d]);return b}var c=y(b),e=ja.call(this,b,d),g=y(this);g&&J(a,d);c&&J(a,b);g&&G(a,b);return e});T&&T.get?b(Node.prototype,T):D(a,function(a){b(a,{enumerable:!0,configurable:!0,get:function(){for(var a=
|
39
|
+
[],b=0;b<this.childNodes.length;b++)a.push(this.childNodes[b].textContent);return a.join("")},set:function(a){for(;this.firstChild;)S.call(this,this.firstChild);R.call(this,document.createTextNode(a))}})})};function Da(a){var b=Element.prototype;b.before=function(b){for(var d=[],c=0;c<arguments.length;++c)d[c-0]=arguments[c];c=d.filter(function(a){return a instanceof Node&&y(a)});ta.apply(this,d);for(var e=0;e<c.length;e++)J(a,c[e]);if(y(this))for(c=0;c<d.length;c++)e=d[c],e instanceof Element&&G(a,e)};b.after=function(b){for(var d=[],c=0;c<arguments.length;++c)d[c-0]=arguments[c];c=d.filter(function(a){return a instanceof Node&&y(a)});ua.apply(this,d);for(var e=0;e<c.length;e++)J(a,c[e]);if(y(this))for(c=
|
40
|
+
0;c<d.length;c++)e=d[c],e instanceof Element&&G(a,e)};b.replaceWith=function(b){for(var d=[],c=0;c<arguments.length;++c)d[c-0]=arguments[c];var c=d.filter(function(a){return a instanceof Node&&y(a)}),e=y(this);va.apply(this,d);for(var g=0;g<c.length;g++)J(a,c[g]);if(e)for(J(a,this),c=0;c<d.length;c++)e=d[c],e instanceof Element&&G(a,e)};b.remove=function(){var b=y(this);wa.call(this);b&&J(a,this)}};function Ea(){var a=Y;function b(b,d){Object.defineProperty(b,"innerHTML",{enumerable:d.enumerable,configurable:!0,get:d.get,set:function(b){var c=this,e=void 0;y(this)&&(e=[],A(this,function(a){a!==c&&e.push(a)}));d.set.call(this,b);if(e)for(var f=0;f<e.length;f++){var g=e[f];1===g.__CE_state&&a.disconnectedCallback(g)}this.ownerDocument.__CE_hasRegistry?K(a,this):E(a,this);return b}})}function e(b,d){B(b,"insertAdjacentElement",function(b,c){var e=y(c);b=d.call(this,b,c);e&&J(a,c);y(b)&&G(a,c);
|
41
|
+
return b})}ka?B(Element.prototype,"attachShadow",function(a){return this.__CE_shadowRoot=a=ka.call(this,a)}):console.warn("Custom Elements: `Element#attachShadow` was not patched.");if(U&&U.get)b(Element.prototype,U);else if(X&&X.get)b(HTMLElement.prototype,X);else{var d=P.call(document,"div");D(a,function(a){b(a,{enumerable:!0,configurable:!0,get:function(){return Q.call(this,!0).innerHTML},set:function(a){var b="template"===this.localName?this.content:this;for(d.innerHTML=a;0<b.childNodes.length;)S.call(b,
|
42
|
+
b.childNodes[0]);for(;0<d.childNodes.length;)R.call(b,d.childNodes[0])}})})}B(Element.prototype,"setAttribute",function(b,d){if(1!==this.__CE_state)return la.call(this,b,d);var c=V.call(this,b);la.call(this,b,d);d=V.call(this,b);c!==d&&a.attributeChangedCallback(this,b,c,d,null)});B(Element.prototype,"setAttributeNS",function(b,d,e){if(1!==this.__CE_state)return oa.call(this,b,d,e);var c=W.call(this,b,d);oa.call(this,b,d,e);e=W.call(this,b,d);c!==e&&a.attributeChangedCallback(this,d,c,e,b)});B(Element.prototype,
|
43
|
+
"removeAttribute",function(b){if(1!==this.__CE_state)return na.call(this,b);var c=V.call(this,b);na.call(this,b);null!==c&&a.attributeChangedCallback(this,b,c,null,null)});B(Element.prototype,"removeAttributeNS",function(b,d){if(1!==this.__CE_state)return pa.call(this,b,d);var c=W.call(this,b,d);pa.call(this,b,d);var e=W.call(this,b,d);c!==e&&a.attributeChangedCallback(this,d,c,e,b)});ya?e(HTMLElement.prototype,ya):qa?e(Element.prototype,qa):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");
|
44
|
+
Aa(a,Element.prototype,{u:ra,append:sa});Da(a)};/*
|
45
|
+
|
46
|
+
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
47
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
48
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
49
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
50
|
+
Code distributed by Google as part of the polymer project is also
|
51
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
52
|
+
*/
|
53
|
+
var Z=window.customElements;if(!Z||Z.forcePolyfill||"function"!=typeof Z.define||"function"!=typeof Z.get){var Y=new C;za();Ba();Ca();Ea();document.__CE_hasRegistry=!0;var Fa=new O(Y);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:Fa})};
|
54
|
+
}).call(self);
|