mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 08:51:22 +00:00
78 lines
26 KiB
JavaScript
78 lines
26 KiB
JavaScript
(function(){
|
|
/*
|
|
|
|
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
|
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
Code distributed by Google as part of the polymer project is also
|
|
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
|
|
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
|
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
Code distributed by Google as part of the polymer project is also
|
|
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
|
|
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
Code distributed by Google as part of the polymer project is also
|
|
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
'use strict';(function(){function W(b){function a(a,e){Object.defineProperty(a,"innerHTML",{enumerable:e.enumerable,configurable:!0,get:e.get,set:function(a){var f=this,d=void 0;h(this)&&(d=[],t(this,function(b){b!==f&&d.push(b)}));e.set.call(this,a);if(d)for(var c=0;c<d.length;c++){var g=d[c];1===g.__CE_state&&b.disconnectedCallback(g)}this.ownerDocument.__CE_hasRegistry?b.patchAndUpgradeTree(this):b.patchTree(this);return a}})}function d(a,e){p(a,"insertAdjacentElement",function(a,f){var d=h(f);
|
|
a=e.call(this,a,f);d&&b.disconnectTree(f);h(a)&&b.connectTree(f);return a})}J?p(Element.prototype,"attachShadow",function(b){return this.__CE_shadowRoot=b=J.call(this,b)}):console.warn("Custom Elements: `Element#attachShadow` was not patched.");if(v&&v.get)a(Element.prototype,v);else if(w&&w.get)a(HTMLElement.prototype,w);else{var c=z.call(document,"div");b.addPatch(function(b){a(b,{enumerable:!0,configurable:!0,get:function(){return K.call(this,!0).innerHTML},set:function(b){var a="template"===this.localName?
|
|
this.content:this;for(c.innerHTML=b;0<a.childNodes.length;)D.call(a,a.childNodes[0]);for(;0<c.childNodes.length;)y.call(a,c.childNodes[0])}})})}p(Element.prototype,"setAttribute",function(a,e){if(1!==this.__CE_state)return L.call(this,a,e);var f=E.call(this,a);L.call(this,a,e);e=E.call(this,a);f!==e&&b.attributeChangedCallback(this,a,f,e,null)});p(Element.prototype,"setAttributeNS",function(a,e,d){if(1!==this.__CE_state)return M.call(this,a,e,d);var f=x.call(this,a,e);M.call(this,a,e,d);d=x.call(this,
|
|
a,e);f!==d&&b.attributeChangedCallback(this,e,f,d,a)});p(Element.prototype,"removeAttribute",function(a){if(1!==this.__CE_state)return N.call(this,a);var d=E.call(this,a);N.call(this,a);null!==d&&b.attributeChangedCallback(this,a,d,null,null)});p(Element.prototype,"removeAttributeNS",function(a,d){if(1!==this.__CE_state)return O.call(this,a,d);var f=x.call(this,a,d);O.call(this,a,d);var c=x.call(this,a,d);f!==c&&b.attributeChangedCallback(this,d,f,c,a)});P?d(HTMLElement.prototype,P):Q?d(Element.prototype,
|
|
Q):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");R(b,Element.prototype,{prepend:X,append:Y});Z(b,Element.prototype,{before:aa,after:ba,replaceWith:ca,remove:da})}function Z(b,a,d){a.before=function(a){for(var f=[],c=0;c<arguments.length;++c)f[c-0]=arguments[c];c=f.filter(function(b){return b instanceof Node&&h(b)});d.before.apply(this,f);for(var g=0;g<c.length;g++)b.disconnectTree(c[g]);if(h(this))for(c=0;c<f.length;c++)g=f[c],g instanceof Element&&b.connectTree(g)};
|
|
a.after=function(a){for(var c=[],e=0;e<arguments.length;++e)c[e-0]=arguments[e];e=c.filter(function(b){return b instanceof Node&&h(b)});d.after.apply(this,c);for(var g=0;g<e.length;g++)b.disconnectTree(e[g]);if(h(this))for(e=0;e<c.length;e++)g=c[e],g instanceof Element&&b.connectTree(g)};a.replaceWith=function(a){for(var c=[],e=0;e<arguments.length;++e)c[e-0]=arguments[e];var e=c.filter(function(b){return b instanceof Node&&h(b)}),g=h(this);d.replaceWith.apply(this,c);for(var u=0;u<e.length;u++)b.disconnectTree(e[u]);
|
|
if(g)for(b.disconnectTree(this),e=0;e<c.length;e++)g=c[e],g instanceof Element&&b.connectTree(g)};a.remove=function(){var a=h(this);d.remove.call(this);a&&b.disconnectTree(this)}}function ea(b){function a(a,c){Object.defineProperty(a,"textContent",{enumerable:c.enumerable,configurable:!0,get:c.get,set:function(a){if(this.nodeType===Node.TEXT_NODE)c.set.call(this,a);else{var d=void 0;if(this.firstChild){var f=this.childNodes,u=f.length;if(0<u&&h(this))for(var d=Array(u),n=0;n<u;n++)d[n]=f[n]}c.set.call(this,
|
|
a);if(d)for(a=0;a<d.length;a++)b.disconnectTree(d[a])}}})}p(Node.prototype,"insertBefore",function(a,c){if(a instanceof DocumentFragment){var d=Array.prototype.slice.apply(a.childNodes);a=S.call(this,a,c);if(h(this))for(c=0;c<d.length;c++)b.connectTree(d[c]);return a}d=h(a);c=S.call(this,a,c);d&&b.disconnectTree(a);h(this)&&b.connectTree(a);return c});p(Node.prototype,"appendChild",function(a){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);a=y.call(this,a);if(h(this))for(var d=
|
|
0;d<c.length;d++)b.connectTree(c[d]);return a}c=h(a);d=y.call(this,a);c&&b.disconnectTree(a);h(this)&&b.connectTree(a);return d});p(Node.prototype,"cloneNode",function(a){a=K.call(this,a);this.ownerDocument.__CE_hasRegistry?b.patchAndUpgradeTree(a):b.patchTree(a);return a});p(Node.prototype,"removeChild",function(a){var c=h(a),d=D.call(this,a);c&&b.disconnectTree(a);return d});p(Node.prototype,"replaceChild",function(a,c){if(a instanceof DocumentFragment){var d=Array.prototype.slice.apply(a.childNodes);
|
|
a=T.call(this,a,c);if(h(this))for(b.disconnectTree(c),c=0;c<d.length;c++)b.connectTree(d[c]);return a}var d=h(a),e=T.call(this,a,c),g=h(this);g&&b.disconnectTree(c);d&&b.disconnectTree(a);g&&b.connectTree(a);return e});F&&F.get?a(Node.prototype,F):b.addPatch(function(b){a(b,{enumerable:!0,configurable:!0,get:function(){for(var a=[],b=0;b<this.childNodes.length;b++)a.push(this.childNodes[b].textContent);return a.join("")},set:function(a){for(;this.firstChild;)D.call(this,this.firstChild);y.call(this,
|
|
document.createTextNode(a))}})})}function fa(b){p(Document.prototype,"createElement",function(a){if(this.__CE_hasRegistry){var d=b.localNameToDefinition(a);if(d)return new d.constructor}a=z.call(this,a);b.patch(a);return a});p(Document.prototype,"importNode",function(a,d){a=ga.call(this,a,d);this.__CE_hasRegistry?b.patchAndUpgradeTree(a):b.patchTree(a);return a});p(Document.prototype,"createElementNS",function(a,d){if(this.__CE_hasRegistry&&(null===a||"http://www.w3.org/1999/xhtml"===a)){var c=b.localNameToDefinition(d);
|
|
if(c)return new c.constructor}a=ha.call(this,a,d);b.patch(a);return a});R(b,Document.prototype,{prepend:ia,append:ja})}function R(b,a,d){a.prepend=function(a){for(var c=[],e=0;e<arguments.length;++e)c[e-0]=arguments[e];e=c.filter(function(a){return a instanceof Node&&h(a)});d.prepend.apply(this,c);for(var g=0;g<e.length;g++)b.disconnectTree(e[g]);if(h(this))for(e=0;e<c.length;e++)g=c[e],g instanceof Element&&b.connectTree(g)};a.append=function(a){for(var c=[],e=0;e<arguments.length;++e)c[e-0]=arguments[e];
|
|
e=c.filter(function(a){return a instanceof Node&&h(a)});d.append.apply(this,c);for(var g=0;g<e.length;g++)b.disconnectTree(e[g]);if(h(this))for(e=0;e<c.length;e++)g=c[e],g instanceof Element&&b.connectTree(g)}}function ka(b){window.HTMLElement=function(){function a(){var a=this.constructor,c=b.constructorToDefinition(a);if(!c)throw Error("The custom element being constructed was not registered with `customElements`.");var f=c.constructionStack;if(0===f.length)return f=z.call(document,c.localName),
|
|
Object.setPrototypeOf(f,a.prototype),f.__CE_state=1,f.__CE_definition=c,b.patch(f),f;var c=f.length-1,e=f[c];if(e===U)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");f[c]=U;Object.setPrototypeOf(e,a.prototype);b.patch(e);return e}a.prototype=la.prototype;return a}()}function m(b){this._elementDefinitionIsRunning=!1;this._internals=b;this._whenDefinedDeferred=new Map;this._flushCallback=function(a){return a()};this._flushPending=
|
|
!1;this._unflushedLocalNames=[];this._documentConstructionObserver=new G(b,document)}function H(){var b=this;this._resolve=this._value=void 0;this._promise=new Promise(function(a){b._resolve=a;b._value&&a(b._value)})}function G(b,a){this._internals=b;this._document=a;this._observer=void 0;this._internals.patchAndUpgradeTree(this._document);"loading"===this._document.readyState&&(this._observer=new MutationObserver(this._handleMutations.bind(this)),this._observer.observe(this._document,{childList:!0,
|
|
subtree:!0}))}function q(){this._localNameToDefinition=new Map;this._constructorToDefinition=new Map;this._patches=[];this._hasPatches=!1}function V(b){var a=ma.has(b);b=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(b);return!a&&b}function h(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))}function I(b,a){for(;a&&
|
|
a!==b&&!a.nextSibling;)a=a.parentNode;return a&&a!==b?a.nextSibling:null}function t(b,a,d){d=void 0===d?new Set:d;for(var c=b;c;){if(c.nodeType===Node.ELEMENT_NODE){var f=c;a(f);var e=f.localName;if("link"===e&&"import"===f.getAttribute("rel")){c=f.import;if(c instanceof Node&&!d.has(c))for(d.add(c),c=c.firstChild;c;c=c.nextSibling)t(c,a,d);c=I(b,f);continue}else if("template"===e){c=I(b,f);continue}if(f=f.__CE_shadowRoot)for(f=f.firstChild;f;f=f.nextSibling)t(f,a,d)}c=c.firstChild?c.firstChild:I(b,
|
|
c)}}function p(b,a,d){b[a]=d}(function(b){function a(a,b){if("function"===typeof window.CustomEvent)return new CustomEvent(a,b);var c=document.createEvent("CustomEvent");c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail);return c}function d(a){if(m)return a.ownerDocument!==document?a.ownerDocument:null;var b=a.__importDoc;if(!b&&a.parentNode){b=a.parentNode;if("function"===typeof b.closest)b=b.closest("link[rel=import]");else for(;!h(b)&&(b=b.parentNode););a.__importDoc=b}return b}function c(a){var b=
|
|
document.querySelectorAll("link[rel=import]:not(import-dependency)"),c=b.length;if(c)for(var l=0,d=b.length,e;l<d&&(e=b[l]);l++)g(e,function(){0===--c&&a()});else a()}function f(a){if("loading"!==document.readyState)a();else{var b=function(){"loading"!==document.readyState&&(document.removeEventListener("readystatechange",b),a())};document.addEventListener("readystatechange",b)}}function e(a){f(function(){return c(function(){return a&&a()})})}function g(a,b){if(a.__loaded)b&&b();else if("script"!==
|
|
a.localName||a.src){var c=function(l){a.removeEventListener(l.type,c);a.__loaded=!0;b&&b()};a.addEventListener("load",c);v&&"style"===a.localName||a.addEventListener("error",c)}else a.__loaded=!0,b&&b()}function h(a){return a.nodeType===Node.ELEMENT_NODE&&"link"===a.localName&&"import"===a.rel}function n(){var a=this;this.documents={};this.inflight=0;this.dynamicImportsMO=new MutationObserver(function(b){return a.handleMutations(b)});f(function(){a.dynamicImportsMO.observe(document.head,{childList:!0,
|
|
subtree:!0});a.loadImports(document)})}var m="import"in document.createElement("link"),p=null;!1==="currentScript"in document&&Object.defineProperty(document,"currentScript",{get:function(){return p||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null)},configurable:!0});var q=/(^\/)|(^#)|(^[\w-\d]*:)/,r=/(url\()([^)]*)(\))/g,t=/(@import[\s]+(?!url\())([^;]*)(;)/g,y=/(<link[^>]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,k={fixUrls:function(a,b){a.href&&a.setAttribute("href",
|
|
k.replaceAttrUrl(a.getAttribute("href"),b));a.src&&a.setAttribute("src",k.replaceAttrUrl(a.getAttribute("src"),b));"style"===a.localName&&k.resolveUrlsInStyle(a,b)},fixUrlAttributes:function(a,b){for(var c=["action","src","href","url","style"],d=0,e;d<c.length&&(e=c[d]);d++){var l=a.attributes[e],B=l&&l.value;B&&0>B.search(/({{|\[\[)/)&&(l.value="style"===e?k.resolveUrlsInCssText(B,b):k.replaceAttrUrl(B,b))}},fixUrlsInTemplates:function(a,b){a=a.querySelectorAll("template");for(var c=0;c<a.length;c++)k.fixUrlsInTemplate(a[c],
|
|
b)},fixUrlsInTemplate:function(a,b){a=a.content||a;for(var c=a.querySelectorAll("style, form[action], [src], [href], [url], [style]"),d=0;d<c.length;d++){var e=c[d];"style"==e.localName?k.resolveUrlsInStyle(e,b):k.fixUrlAttributes(e,b)}k.fixUrlsInTemplates(a,b)},resolveUrlsInStyle:function(a,b){a.textContent=k.resolveUrlsInCssText(a.textContent,b)},resolveUrlsInCssText:function(a,b){a=k.replaceUrls(a,b,r);return a=k.replaceUrls(a,b,t)},replaceUrls:function(a,b,c){return a.replace(c,function(a,c,d,
|
|
e){a=d.replace(/["']/g,"");b&&(a=k.resolveUrl(a,b));return c+"'"+a+"'"+e})},replaceAttrUrl:function(a,b){return a&&q.test(a)?a:k.resolveUrl(a,b)},resolveUrl:function(a,b){if(void 0===k.__workingURL){k.__workingURL=!1;try{var c=new URL("b","http://a");c.pathname="c%20d";k.__workingURL="http://a/c%20d"===c.href}catch(oa){}}if(k.__workingURL)return(new URL(a,b)).href;c=k.__tempDoc;c||(c=document.implementation.createHTMLDocument("temp"),k.__tempDoc=c,c.__base=c.createElement("base"),c.head.appendChild(c.__base),
|
|
c.__anchor=c.createElement("a"));c.__base.href=b;c.__anchor.href=a;return c.__anchor.href||a}},x={async:!0,load:function(a,b,c){if(a)if(a.match(/^data:/)){a=a.split(",");var d=a[1],d=-1<a[0].indexOf(";base64")?atob(d):decodeURIComponent(d);b(d)}else{var e=new XMLHttpRequest;e.open("GET",a,x.async);e.onload=function(){var a=e.getResponseHeader("Location");a&&0===a.indexOf("/")&&(a=(location.origin||location.protocol+"//"+location.host)+a);var d=e.response||e.responseText;304===e.status||0===e.status||
|
|
200<=e.status&&300>e.status?b(d,a):c(d)};e.send()}else c("error: href must be specified")}},v=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent);n.prototype.loadImports=function(a){a=a.querySelectorAll("link[rel=import]");for(var b=0,c=a.length;b<c;b++)this.loadImport(a[b])};n.prototype.loadImport=function(a){var b=this,c=a.href;if(void 0!==this.documents[c]){var d=this.documents[c];d&&d.__loaded&&(a.import=d,this.fireEventIfNeeded(a))}else this.inflight++,this.documents[c]=
|
|
"pending",x.load(c,function(a,d){a=b.makeDocument(a,d||c);b.documents[c]=a;b.inflight--;b.loadImports(a);b.processImportsIfLoadingDone()},function(){b.documents[c]=null;b.inflight--;b.processImportsIfLoadingDone()})};n.prototype.makeDocument=function(a,b){if(!a)return document.createDocumentFragment();v&&(a=a.replace(y,function(a,b,c){return-1===a.indexOf("type=")?b+" type=import-disable "+c:a}));var c=document.createElement("template");c.innerHTML=a;if(c.content)a=c.content;else for(a=document.createDocumentFragment();c.firstChild;)a.appendChild(c.firstChild);
|
|
if(c=a.querySelector("base"))b=k.replaceAttrUrl(c.getAttribute("href"),b),c.removeAttribute("href");for(var c=a.querySelectorAll('link[rel=import], link[rel=stylesheet][href][type=import-disable],\n style:not([type]), link[rel=stylesheet][href]:not([type]),\n script:not([type]), script[type="application/javascript"],\n script[type="text/javascript"]'),d=0,e=0,f=c.length,l;e<f&&(l=c[e]);e++)g(l),k.fixUrls(l,b),l.setAttribute("import-dependency",""),"script"===l.localName&&!l.src&&l.textContent&&
|
|
(l.setAttribute("src","data:text/javascript;charset=utf-8,"+encodeURIComponent(l.textContent+("\n//# sourceURL="+b+(d?"-"+d:"")+".js\n"))),l.textContent="",d++);k.fixUrlsInTemplates(a,b);return a};n.prototype.processImportsIfLoadingDone=function(){var a=this;if(!this.inflight){this.dynamicImportsMO.disconnect();this.flatten(document);var b=!1,c=!1,d=function(){c&&b&&(a.dynamicImportsMO.observe(document.head,{childList:!0,subtree:!0}),a.fireEvents())};this.waitForStyles(function(){c=!0;d()});this.runScripts(function(){b=
|
|
!0;d()})}};n.prototype.flatten=function(a){a=a.querySelectorAll("link[rel=import]");for(var b={},c=0,d=a.length;c<d&&(b.n=a[c]);b={n:b.n},c++){var e=this.documents[b.n.href];(b.n.import=e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(this.documents[b.n.href]=b.n,b.n.readyState="loading",b.n.import=b.n,Object.defineProperty(b.n,"baseURI",{get:function(a){return function(){return a.n.href}}(b),configurable:!0,enumerable:!0}),this.flatten(e),b.n.appendChild(e))}};n.prototype.runScripts=function(a){function b(e){if(e<
|
|
d){var f=c[e],l=document.createElement("script");f.removeAttribute("import-dependency");for(var h=0,k=f.attributes.length;h<k;h++)l.setAttribute(f.attributes[h].name,f.attributes[h].value);p=l;f.parentNode.replaceChild(l,f);g(l,function(){p=null;b(e+1)})}else a()}var c=document.querySelectorAll("script[import-dependency]"),d=c.length;b(0)};n.prototype.waitForStyles=function(a){var b=document.querySelectorAll("style[import-dependency],\n link[rel=stylesheet][import-dependency]"),c=b.length;if(c)for(var e=
|
|
v&&!!document.querySelector("link[rel=stylesheet][href][type=import-disable]"),f={},l=0,h=b.length;l<h&&(f.s=b[l]);f={s:f.s},l++){if(g(f.s,function(b){return function(){b.s.removeAttribute("import-dependency");0===--c&&a()}}(f)),e&&f.s.parentNode!==document.head){var k=document.createElement(f.s.localName);k.__appliedElement=f.s;k.setAttribute("type","import-placeholder");f.s.parentNode.insertBefore(k,f.s.nextSibling);for(k=d(f.s);k&&d(k);)k=d(k);k.parentNode!==document.head&&(k=null);document.head.insertBefore(f.s,
|
|
k);f.s.removeAttribute("type")}}else a()};n.prototype.fireEvents=function(){for(var a=document.querySelectorAll("link[rel=import]"),b=a.length-1,c;0<=b&&(c=a[b]);b--)this.fireEventIfNeeded(c)};n.prototype.fireEventIfNeeded=function(b){b.__loaded||(b.__loaded=!0,b.import&&(b.import.readyState="complete"),b.dispatchEvent(a(b.import?"load":"error",{bubbles:!1,cancelable:!1,detail:void 0})))};n.prototype.handleMutations=function(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.addedNodes)for(var d=0;d<
|
|
c.addedNodes.length;d++){var e=c.addedNodes[d];e&&e.nodeType===Node.ELEMENT_NODE&&(h(e)?this.loadImport(e):this.loadImports(e))}}};if(m){for(var A=document.querySelectorAll("link[rel=import]"),w=0,z=A.length,C;w<z&&(C=A[w]);w++)C.import&&"loading"===C.import.readyState||(C.__loaded=!0);A=function(a){a=a.target;h(a)&&(a.__loaded=!0)};document.addEventListener("load",A,!0);document.addEventListener("error",A,!0)}else new n;e(function(){return document.dispatchEvent(a("HTMLImportsLoaded",{cancelable:!0,
|
|
bubbles:!0,detail:void 0}))});b.useNative=m;b.whenReady=e;b.importForElement=d})(window.HTMLImports=window.HTMLImports||{});var ma=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));q.prototype.setDefinition=function(b,a){this._localNameToDefinition.set(b,a);this._constructorToDefinition.set(a.constructor,a)};q.prototype.localNameToDefinition=function(b){return this._localNameToDefinition.get(b)};q.prototype.constructorToDefinition=
|
|
function(b){return this._constructorToDefinition.get(b)};q.prototype.addPatch=function(b){this._hasPatches=!0;this._patches.push(b)};q.prototype.patchTree=function(b){var a=this;this._hasPatches&&t(b,function(b){return a.patch(b)})};q.prototype.patch=function(b){if(this._hasPatches&&!b.__CE_patched){b.__CE_patched=!0;for(var a=0;a<this._patches.length;a++)this._patches[a](b)}};q.prototype.connectTree=function(b){var a=[];t(b,function(b){return a.push(b)});for(b=0;b<a.length;b++){var d=a[b];1===d.__CE_state?
|
|
this.connectedCallback(d):this.upgradeElement(d)}};q.prototype.disconnectTree=function(b){var a=[];t(b,function(b){return a.push(b)});for(b=0;b<a.length;b++){var d=a[b];1===d.__CE_state&&this.disconnectedCallback(d)}};q.prototype.patchAndUpgradeTree=function(b,a){a=void 0===a?new Set:a;var d=this,c=[];t(b,function(b){if("link"===b.localName&&"import"===b.getAttribute("rel")){var e=b.import;e instanceof Node&&"complete"===e.readyState?(e.__CE_isImportDocument=!0,e.__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(a),a.delete(c),d.patchAndUpgradeTree(c,a))})}else c.push(b)},a);if(this._hasPatches)for(b=0;b<c.length;b++)this.patch(c[b]);for(b=0;b<c.length;b++)this.upgradeElement(c[b])};q.prototype.upgradeElement=function(b){if(void 0===b.__CE_state){var a=this.localNameToDefinition(b.localName);if(a){a.constructionStack.push(b);var d=a.constructor;try{try{if(new d!==b)throw Error("The custom element constructor did not produce the element being upgraded.");
|
|
}finally{a.constructionStack.pop()}}catch(e){throw b.__CE_state=2,e;}b.__CE_state=1;b.__CE_definition=a;if(a.attributeChangedCallback)for(a=a.observedAttributes,d=0;d<a.length;d++){var c=a[d],f=b.getAttribute(c);null!==f&&this.attributeChangedCallback(b,c,null,f,null)}h(b)&&this.connectedCallback(b)}}};q.prototype.connectedCallback=function(b){var a=b.__CE_definition;a.connectedCallback&&a.connectedCallback.call(b)};q.prototype.disconnectedCallback=function(b){var a=b.__CE_definition;a.disconnectedCallback&&
|
|
a.disconnectedCallback.call(b)};q.prototype.attributeChangedCallback=function(b,a,d,c,f){var e=b.__CE_definition;e.attributeChangedCallback&&-1<e.observedAttributes.indexOf(a)&&e.attributeChangedCallback.call(b,a,d,c,f)};G.prototype.disconnect=function(){this._observer&&this._observer.disconnect()};G.prototype._handleMutations=function(b){var a=this._document.readyState;"interactive"!==a&&"complete"!==a||this.disconnect();for(a=0;a<b.length;a++)for(var d=b[a].addedNodes,c=0;c<d.length;c++)this._internals.patchAndUpgradeTree(d[c])};
|
|
H.prototype.resolve=function(b){if(this._value)throw Error("Already resolved.");this._value=b;this._resolve&&this._resolve(b)};H.prototype.toPromise=function(){return this._promise};m.prototype.define=function(b,a){var d=this;if(!(a instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!V(b))throw new SyntaxError("The element name '"+b+"' is not valid.");if(this._internals.localNameToDefinition(b))throw Error("A custom element with name '"+b+"' has already been defined.");
|
|
if(this._elementDefinitionIsRunning)throw Error("A custom element is already being defined.");this._elementDefinitionIsRunning=!0;var c,f,e,g,h;try{var n=function(a){var b=m[a];if(void 0!==b&&!(b instanceof Function))throw Error("The '"+a+"' callback must be a function.");return b},m=a.prototype;if(!(m instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");c=n("connectedCallback");f=n("disconnectedCallback");e=n("adoptedCallback");g=n("attributeChangedCallback");
|
|
h=a.observedAttributes||[]}catch(na){return}finally{this._elementDefinitionIsRunning=!1}this._internals.setDefinition(b,{localName:b,constructor:a,connectedCallback:c,disconnectedCallback:f,adoptedCallback:e,attributeChangedCallback:g,observedAttributes:h,constructionStack:[]});this._unflushedLocalNames.push(b);this._flushPending||(this._flushPending=!0,this._flushCallback(function(){return d._flush()}))};m.prototype._flush=function(){if(!1!==this._flushPending)for(this._flushPending=!1,this._internals.patchAndUpgradeTree(document);0<
|
|
this._unflushedLocalNames.length;){var b=this._unflushedLocalNames.shift();(b=this._whenDefinedDeferred.get(b))&&b.resolve(void 0)}};m.prototype.get=function(b){if(b=this._internals.localNameToDefinition(b))return b.constructor};m.prototype.whenDefined=function(b){if(!V(b))return Promise.reject(new SyntaxError("'"+b+"' is not a valid custom element name."));var a=this._whenDefinedDeferred.get(b);if(a)return a.toPromise();a=new H;this._whenDefinedDeferred.set(b,a);this._internals.localNameToDefinition(b)&&
|
|
-1===this._unflushedLocalNames.indexOf(b)&&a.resolve(void 0);return a.toPromise()};m.prototype.polyfillWrapFlushCallback=function(b){this._documentConstructionObserver.disconnect();var a=this._flushCallback;this._flushCallback=function(d){return b(function(){return a(d)})}};window.CustomElementRegistry=m;m.prototype.define=m.prototype.define;m.prototype.get=m.prototype.get;m.prototype.whenDefined=m.prototype.whenDefined;m.prototype.polyfillWrapFlushCallback=m.prototype.polyfillWrapFlushCallback;var z=
|
|
window.Document.prototype.createElement,ha=window.Document.prototype.createElementNS,ga=window.Document.prototype.importNode,ia=window.Document.prototype.prepend,ja=window.Document.prototype.append,K=window.Node.prototype.cloneNode,y=window.Node.prototype.appendChild,S=window.Node.prototype.insertBefore,D=window.Node.prototype.removeChild,T=window.Node.prototype.replaceChild,F=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),J=window.Element.prototype.attachShadow,v=Object.getOwnPropertyDescriptor(window.Element.prototype,
|
|
"innerHTML"),E=window.Element.prototype.getAttribute,L=window.Element.prototype.setAttribute,N=window.Element.prototype.removeAttribute,x=window.Element.prototype.getAttributeNS,M=window.Element.prototype.setAttributeNS,O=window.Element.prototype.removeAttributeNS,Q=window.Element.prototype.insertAdjacentElement,X=window.Element.prototype.prepend,Y=window.Element.prototype.append,aa=window.Element.prototype.before,ba=window.Element.prototype.after,ca=window.Element.prototype.replaceWith,da=window.Element.prototype.remove,
|
|
la=window.HTMLElement,w=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),P=window.HTMLElement.prototype.insertAdjacentElement,U=new function(){},r=window.customElements;if(!r||r.forcePolyfill||"function"!=typeof r.define||"function"!=typeof r.get)r=new q,ka(r),fa(r),ea(r),W(r),document.__CE_hasRegistry=!0,r=new m(r),Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:r});(function(){if(customElements&&customElements.polyfillWrapFlushCallback){var b=
|
|
function(){if(a){var b=a;a=null;b();return!0}},a,d=HTMLImports.whenReady;customElements.polyfillWrapFlushCallback(function(c){a=c;d(b)});HTMLImports.whenReady=function(a){d(function(){b()?HTMLImports.whenReady(a):a()})}}HTMLImports.whenReady(function(){requestAnimationFrame(function(){window.dispatchEvent(new CustomEvent("WebComponentsReady"))})})})(window.WebComponents);(function(){var b=document.createElement("style");b.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";
|
|
var a=document.querySelector("head");a.insertBefore(b,a.firstChild)})(window.WebComponents)})();
|
|
}).call(self)
|
|
|
|
//# sourceMappingURL=webcomponents-hi-ce.js.map
|