UNPKG

15.1 kBJavaScriptView Raw
1(function(){
2'use strict';var h=new function(){};var aa=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function m(b){var a=aa.has(b);b=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(b);return!a&&b}function n(b){var a=b.isConnected;if(void 0!==a)return a;for(;b&&!(b.__CE_isImportDocument||b instanceof Document);)b=b.parentNode||(window.ShadowRoot&&b instanceof ShadowRoot?b.host:void 0);return!(!b||!(b.__CE_isImportDocument||b instanceof Document))}
3function p(b,a){for(;a&&a!==b&&!a.nextSibling;)a=a.parentNode;return a&&a!==b?a.nextSibling:null}
4function r(b,a,e){e=e?e:new Set;for(var d=b;d;){if(d.nodeType===Node.ELEMENT_NODE){var c=d;a(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)r(d,a,e);d=p(b,c);continue}else if("template"===f){d=p(b,c);continue}if(c=c.__CE_shadowRoot)for(c=c.firstChild;c;c=c.nextSibling)r(c,a,e)}d=d.firstChild?d.firstChild:p(b,d)}}function u(b,a,e){b[a]=e};function v(){this.a=new Map;this.o=new Map;this.f=[];this.b=!1}function ba(b,a,e){b.a.set(a,e);b.o.set(e.constructor,e)}function w(b,a){b.b=!0;b.f.push(a)}function x(b,a){b.b&&r(a,function(e){return y(b,e)})}function y(b,a){if(b.b&&!a.__CE_patched){a.__CE_patched=!0;for(var e=0;e<b.f.length;e++)b.f[e](a)}}function z(b,a){var e=[];r(a,function(b){return e.push(b)});for(a=0;a<e.length;a++){var d=e[a];1===d.__CE_state?b.connectedCallback(d):A(b,d)}}
5function B(b,a){var e=[];r(a,function(b){return e.push(b)});for(a=0;a<e.length;a++){var d=e[a];1===d.__CE_state&&b.disconnectedCallback(d)}}
6function C(b,a,e){e=e?e:{};var d=e.w||new Set,c=e.s||function(d){return A(b,d)},f=[];r(a,function(e){if("link"===e.localName&&"import"===e.getAttribute("rel")){var a=e.import;a instanceof Node&&(a.__CE_isImportDocument=!0,a.__CE_hasRegistry=!0);a&&"complete"===a.readyState?a.__CE_documentLoadHandled=!0:e.addEventListener("load",function(){var a=e.import;if(!a.__CE_documentLoadHandled){a.__CE_documentLoadHandled=!0;var f=new Set(d);f.delete(a);C(b,a,{w:f,s:c})}})}else f.push(e)},d);if(b.b)for(a=0;a<
7f.length;a++)y(b,f[a]);for(a=0;a<f.length;a++)c(f[a])}
8function A(b,a){if(void 0===a.__CE_state){var e=a.ownerDocument;if(e.defaultView||e.__CE_isImportDocument&&e.__CE_hasRegistry)if(e=b.a.get(a.localName)){e.constructionStack.push(a);var d=e.constructor;try{try{if(new d!==a)throw Error("The custom element constructor did not produce the element being upgraded.");}finally{e.constructionStack.pop()}}catch(t){throw a.__CE_state=2,t;}a.__CE_state=1;a.__CE_definition=e;if(e.attributeChangedCallback)for(e=e.observedAttributes,d=0;d<e.length;d++){var c=e[d],
9f=a.getAttribute(c);null!==f&&b.attributeChangedCallback(a,c,null,f,null)}n(a)&&b.connectedCallback(a)}}}v.prototype.connectedCallback=function(b){var a=b.__CE_definition;a.connectedCallback&&a.connectedCallback.call(b)};v.prototype.disconnectedCallback=function(b){var a=b.__CE_definition;a.disconnectedCallback&&a.disconnectedCallback.call(b)};
10v.prototype.attributeChangedCallback=function(b,a,e,d,c){var f=b.__CE_definition;f.attributeChangedCallback&&-1<f.observedAttributes.indexOf(a)&&f.attributeChangedCallback.call(b,a,e,d,c)};function D(b,a){this.c=b;this.a=a;this.b=void 0;C(this.c,this.a);"loading"===this.a.readyState&&(this.b=new MutationObserver(this.f.bind(this)),this.b.observe(this.a,{childList:!0,subtree:!0}))}function E(b){b.b&&b.b.disconnect()}D.prototype.f=function(b){var a=this.a.readyState;"interactive"!==a&&"complete"!==a||E(this);for(a=0;a<b.length;a++)for(var e=b[a].addedNodes,d=0;d<e.length;d++)C(this.c,e[d])};function ca(){var b=this;this.b=this.a=void 0;this.f=new Promise(function(a){b.b=a;b.a&&a(b.a)})}function F(b){if(b.a)throw Error("Already resolved.");b.a=void 0;b.b&&b.b(void 0)};function G(b){this.i=!1;this.c=b;this.m=new Map;this.j=function(b){return b()};this.g=!1;this.l=[];this.u=new D(b,document)}
11G.prototype.define=function(b,a){var e=this;if(!(a instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!m(b))throw new SyntaxError("The element name '"+b+"' is not valid.");if(this.c.a.get(b))throw Error("A custom element with name '"+b+"' has already been defined.");if(this.i)throw Error("A custom element is already being defined.");this.i=!0;var d,c,f,t,l;try{var g=function(b){var e=k[b];if(void 0!==e&&!(e instanceof Function))throw Error("The '"+b+"' callback must be a function.");
12return e},k=a.prototype;if(!(k instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");d=g("connectedCallback");c=g("disconnectedCallback");f=g("adoptedCallback");t=g("attributeChangedCallback");l=a.observedAttributes||[]}catch(q){return}finally{this.i=!1}a={localName:b,constructor:a,connectedCallback:d,disconnectedCallback:c,adoptedCallback:f,attributeChangedCallback:t,observedAttributes:l,constructionStack:[]};ba(this.c,b,a);this.l.push(a);this.g||
13(this.g=!0,this.j(function(){return da(e)}))};function da(b){if(!1!==b.g){b.g=!1;for(var a=b.l,e=[],d=new Map,c=0;c<a.length;c++)d.set(a[c].localName,[]);C(b.c,document,{s:function(a){if(void 0===a.__CE_state){var c=a.localName,f=d.get(c);f?f.push(a):b.c.a.get(c)&&e.push(a)}}});for(c=0;c<e.length;c++)A(b.c,e[c]);for(;0<a.length;){for(var f=a.shift(),c=f.localName,f=d.get(f.localName),t=0;t<f.length;t++)A(b.c,f[t]);(c=b.m.get(c))&&F(c)}}}G.prototype.get=function(b){if(b=this.c.a.get(b))return b.constructor};
14G.prototype.whenDefined=function(b){if(!m(b))return Promise.reject(new SyntaxError("'"+b+"' is not a valid custom element name."));var a=this.m.get(b);if(a)return a.f;a=new ca;this.m.set(b,a);this.c.a.get(b)&&!this.l.some(function(e){return e.localName===b})&&F(a);return a.f};G.prototype.v=function(b){E(this.u);var a=this.j;this.j=function(e){return b(function(){return a(e)})}};window.CustomElementRegistry=G;G.prototype.define=G.prototype.define;G.prototype.get=G.prototype.get;
15G.prototype.whenDefined=G.prototype.whenDefined;G.prototype.polyfillWrapFlushCallback=G.prototype.v;var H=window.Document.prototype.createElement,ea=window.Document.prototype.createElementNS,fa=window.Document.prototype.importNode,ga=window.Document.prototype.prepend,ha=window.Document.prototype.append,I=Object.getOwnPropertyDescriptor(window.Document.prototype,"body"),ia=window.DocumentFragment.prototype.prepend,ja=window.DocumentFragment.prototype.append,J=window.Node.prototype.cloneNode,K=window.Node.prototype.appendChild,L=window.Node.prototype.insertBefore,M=window.Node.prototype.removeChild,
16N=window.Node.prototype.replaceChild,O=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),P=window.Element.prototype.attachShadow,Q=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),R=window.Element.prototype.getAttribute,S=window.Element.prototype.setAttribute,ka=window.Element.prototype.removeAttribute,T=window.Element.prototype.getAttributeNS,la=window.Element.prototype.setAttributeNS,ma=window.Element.prototype.removeAttributeNS,na=window.Element.prototype.insertAdjacentElement,
17oa=window.Element.prototype.prepend,pa=window.Element.prototype.append,U=window.Element.prototype.before,qa=window.Element.prototype.after,ra=window.Element.prototype.replaceWith,sa=window.Element.prototype.remove,V=Object.getOwnPropertyDescriptor(window.HTMLDocument.prototype,"body"),ta=window.HTMLElement,W=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),ua=window.HTMLElement.prototype.insertAdjacentElement;function va(){var b=X;window.HTMLElement=function(){function a(){var e=this.constructor,a=b.o.get(e);if(!a)throw Error("The custom element being constructed was not registered with `customElements`.");var c=a.constructionStack;if(!c.length)return c=H.call(document,a.localName),Object.setPrototypeOf(c,e.prototype),c.__CE_state=1,c.__CE_definition=a,y(b,c),c;var a=c.length-1,f=c[a];if(f===h)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");
18c[a]=h;Object.setPrototypeOf(f,e.prototype);y(b,f);return f}a.prototype=ta.prototype;return a}()};function Y(b,a,e){function d(a){return function(e){for(var d=[],c=0;c<arguments.length;++c)d[c-0]=arguments[c];for(var c=[],f=[],k=0;k<d.length;k++){var q=d[k];q instanceof Element&&n(q)&&f.push(q);if(q instanceof DocumentFragment)for(q=q.firstChild;q;q=q.nextSibling)c.push(q);else c.push(q)}a.apply(this,d);for(d=0;d<f.length;d++)B(b,f[d]);if(n(this))for(d=0;d<c.length;d++)f=c[d],f instanceof Element&&z(b,f)}}e.h&&(a.prepend=d(e.h));e.append&&(a.append=d(e.append))};function wa(){var b=X;function a(a,d){Object.defineProperty(a,"body",{get:d.get,set:function(a){var e=d.get.call(this),c=n(a);d.set.call(this,a);a!==e&&(c&&B(b,a),B(b,e),z(b,a))}})}u(Document.prototype,"createElement",function(a){if(this.__CE_hasRegistry){var d=b.a.get(a);if(d)return new d.constructor}a=H.call(this,a);y(b,a);return a});u(Document.prototype,"importNode",function(a,d){a=fa.call(this,a,d);this.__CE_hasRegistry?C(b,a):x(b,a);return a});u(Document.prototype,"createElementNS",function(a,
19d){if(this.__CE_hasRegistry&&(null===a||"http://www.w3.org/1999/xhtml"===a)){var c=b.a.get(d);if(c)return new c.constructor}a=ea.call(this,a,d);y(b,a);return a});I&&I.get?a(Document.prototype,I):V&&V.get&&a(HTMLDocument.prototype,V);Y(b,Document.prototype,{h:ga,append:ha})};function xa(){var b=X;function a(a,d){Object.defineProperty(a,"textContent",{enumerable:d.enumerable,configurable:!0,get:d.get,set:function(a){if(this.nodeType===Node.TEXT_NODE)d.set.call(this,a);else{var e=void 0;if(this.firstChild){var c=this.childNodes,l=c.length;if(0<l&&n(this))for(var e=Array(l),g=0;g<l;g++)e[g]=c[g]}d.set.call(this,a);if(e)for(a=0;a<e.length;a++)B(b,e[a])}}})}u(Node.prototype,"insertBefore",function(a,d){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);
20a=L.call(this,a,d);if(n(this))for(d=0;d<c.length;d++)z(b,c[d]);return a}c=n(a);d=L.call(this,a,d);c&&B(b,a);n(this)&&z(b,a);return d});u(Node.prototype,"appendChild",function(a){if(a instanceof DocumentFragment){var d=Array.prototype.slice.apply(a.childNodes);a=K.call(this,a);if(n(this))for(var c=0;c<d.length;c++)z(b,d[c]);return a}d=n(a);c=K.call(this,a);d&&B(b,a);n(this)&&z(b,a);return c});u(Node.prototype,"cloneNode",function(a){a=J.call(this,a);this.ownerDocument.__CE_hasRegistry?C(b,a):x(b,a);
21return a});u(Node.prototype,"removeChild",function(a){var d=n(a),c=M.call(this,a);d&&B(b,a);return c});u(Node.prototype,"replaceChild",function(a,d){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);a=N.call(this,a,d);if(n(this))for(B(b,d),d=0;d<c.length;d++)z(b,c[d]);return a}var c=n(a),e=N.call(this,a,d),t=n(this);t&&B(b,d);c&&B(b,a);t&&z(b,a);return e});O&&O.get?a(Node.prototype,O):w(b,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){for(var a=[],b=
220;b<this.childNodes.length;b++)a.push(this.childNodes[b].textContent);return a.join("")},set:function(a){for(;this.firstChild;)M.call(this,this.firstChild);K.call(this,document.createTextNode(a))}})})};function ya(b){var a=Element.prototype;function e(a){return function(d){for(var c=[],e=0;e<arguments.length;++e)c[e-0]=arguments[e];for(var e=[],l=[],g=0;g<c.length;g++){var k=c[g];k instanceof Element&&n(k)&&l.push(k);if(k instanceof DocumentFragment)for(k=k.firstChild;k;k=k.nextSibling)e.push(k);else e.push(k)}a.apply(this,c);for(c=0;c<l.length;c++)B(b,l[c]);if(n(this))for(c=0;c<e.length;c++)l=e[c],l instanceof Element&&z(b,l)}}U&&(a.before=e(U));U&&(a.after=e(qa));ra&&u(a,"replaceWith",function(a){for(var c=
23[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];for(var d=[],e=[],l=0;l<c.length;l++){var g=c[l];g instanceof Element&&n(g)&&e.push(g);if(g instanceof DocumentFragment)for(g=g.firstChild;g;g=g.nextSibling)d.push(g);else d.push(g)}l=n(this);ra.apply(this,c);for(c=0;c<e.length;c++)B(b,e[c]);if(l)for(B(b,this),c=0;c<d.length;c++)e=d[c],e instanceof Element&&z(b,e)});sa&&u(a,"remove",function(){var a=n(this);sa.call(this);a&&B(b,this)})};function za(){var b=X;function a(a,c){Object.defineProperty(a,"innerHTML",{enumerable:c.enumerable,configurable:!0,get:c.get,set:function(a){var d=this,e=void 0;n(this)&&(e=[],r(this,function(a){a!==d&&e.push(a)}));c.set.call(this,a);if(e)for(var f=0;f<e.length;f++){var k=e[f];1===k.__CE_state&&b.disconnectedCallback(k)}this.ownerDocument.__CE_hasRegistry?C(b,this):x(b,this);return a}})}function e(a,c){u(a,"insertAdjacentElement",function(a,d){var e=n(d);a=c.call(this,a,d);e&&B(b,d);n(a)&&z(b,d);
24return a})}P&&u(Element.prototype,"attachShadow",function(a){return this.__CE_shadowRoot=a=P.call(this,a)});Q&&Q.get?a(Element.prototype,Q):W&&W.get?a(HTMLElement.prototype,W):w(b,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){return J.call(this,!0).innerHTML},set:function(a){var b="template"===this.localName,d=b?this.content:this,c=H.call(document,this.localName);for(c.innerHTML=a;0<d.childNodes.length;)M.call(d,d.childNodes[0]);for(a=b?c.content:c;0<a.childNodes.length;)K.call(d,
25a.childNodes[0])}})});u(Element.prototype,"setAttribute",function(a,c){if(1!==this.__CE_state)return S.call(this,a,c);var d=R.call(this,a);S.call(this,a,c);c=R.call(this,a);b.attributeChangedCallback(this,a,d,c,null)});u(Element.prototype,"setAttributeNS",function(a,c,e){if(1!==this.__CE_state)return la.call(this,a,c,e);var d=T.call(this,a,c);la.call(this,a,c,e);e=T.call(this,a,c);b.attributeChangedCallback(this,c,d,e,a)});u(Element.prototype,"removeAttribute",function(a){if(1!==this.__CE_state)return ka.call(this,
26a);var c=R.call(this,a);ka.call(this,a);null!==c&&b.attributeChangedCallback(this,a,c,null,null)});u(Element.prototype,"removeAttributeNS",function(a,c){if(1!==this.__CE_state)return ma.call(this,a,c);var d=T.call(this,a,c);ma.call(this,a,c);var e=T.call(this,a,c);d!==e&&b.attributeChangedCallback(this,c,d,e,a)});ua?e(HTMLElement.prototype,ua):na?e(Element.prototype,na):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");Y(b,Element.prototype,{h:oa,append:pa});ya(b)}
27;/*
28
29 Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
30 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
31 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
32 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
33 Code distributed by Google as part of the polymer project is also
34 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
35*/
36var Z=window.customElements;if(!Z||Z.forcePolyfill||"function"!=typeof Z.define||"function"!=typeof Z.get){var X=new v;va();wa();Y(X,DocumentFragment.prototype,{h:ia,append:ja});xa();za();document.__CE_hasRegistry=!0;var customElements=new G(X);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:customElements})};
37}).call(self);
38
39//# sourceMappingURL=custom-elements.min.js.map