diff --git a/webcomponents-hi-sd-ce.js b/webcomponents-hi-sd-ce.js index c64c8da..259cc86 100644 --- a/webcomponents-hi-sd-ce.js +++ b/webcomponents-hi-sd-ce.js @@ -1,6 +1,6 @@ -(function(){'use strict';function _(Mt){return Mt=$(Mt),te(ee(Mt),Mt)}function $(Mt){return Mt.replace(Re.comments,'').replace(Re.port,'')}function ee(Mt){let Ot={start:0,end:Mt.length},wt=Ot;for(let Dt=0,Lt=Mt.length;Dt{'complete'===document.readyState&&ve()}))}function ve(){requestAnimationFrame(()=>{(At||Pt._elementsHaveApplied)&&Pt.updateStyles(),At=!1})}(Mt=>{const Ot=!!('import'in document.createElement('link'));let wt=null;!1=='currentScript'in document&&Object.defineProperty(document,'currentScript',{get(){return wt||('complete'===document.readyState?null:document.scripts[document.scripts.length-1])},configurable:!0});const Dt=/(^\/)|(^#)|(^[\w-\d]*:)/,Lt=/(url\()([^)]*)(\))/g,kt=/(@import[\s]+(?!url\())([^;]*)(;)/g,Ht=/(]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,Ft={fixUrls(ro,no){ro.href&&ro.setAttribute('href',Ft.replaceAttrUrl(ro.getAttribute('href'),no)),ro.src&&ro.setAttribute('src',Ft.replaceAttrUrl(ro.getAttribute('src'),no)),'style'===ro.localName&&Ft.resolveUrlsInStyle(ro,no)},fixUrlAttributes(ro,no){const so=['action','src','href','url','style'];for(let lo,ao=0;aopo.search(/({{|\[\[)/)&&(io.value='style'===lo?Ft.resolveUrlsInCssText(po,no):Ft.replaceAttrUrl(po,no))}},fixUrlsInTemplates(ro,no){const so=ro.querySelectorAll('template');for(let ao=0;ao{let co=io.replace(/["']/g,'');return no&&(co=Ft.resolveUrl(co,no)),lo+'\''+co+'\''+po})},replaceAttrUrl(ro,no){return ro&&Dt.test(ro)?ro:Ft.resolveUrl(ro,no)},resolveUrl(ro,no){if(void 0===Ft.__workingURL){Ft.__workingURL=!1;try{const ao=new URL('b','http://a');ao.pathname='c%20d',Ft.__workingURL='http://a/c%20d'===ao.href}catch(ao){}}if(Ft.__workingURL)return new URL(ro,no).href;let so=Ft.__tempDoc;return so||(so=document.implementation.createHTMLDocument('temp'),Ft.__tempDoc=so,so.__base=so.createElement('base'),so.head.appendChild(so.__base),so.__anchor=so.createElement('a')),so.__base.href=no,so.__anchor.href=ro,so.__anchor.href||ro}},Ut={async:!0,load(ro){return new Promise((no,so)=>{if(!ro)so({resource:'error: href must be specified'});else if(ro.match(/^data:/)){const ao=ro.split(','),lo=ao[0];let io=ao[1];io=-1{if(4===ao.readyState){let lo;try{const po=ao.getResponseHeader('Location');po&&(lo='/'===po.substr(0,1)?location.origin+po:po)}catch(po){console.error(po.message)}const io={resource:ao.response||ao.responseText,redirectedUrl:lo};304===ao.status||0===ao.status||200<=ao.status&&300>ao.status?no(io):so(io)}}),ao.send()}})}},Wt=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent),qt='onunhandledrejection'in window,Bt='link[rel=import]',jt='import-disable',Gt=`link[rel=stylesheet][href][type=${jt}]`,Xt=`${Bt}, ${Gt}, +(function(){'use strict';function _(Mt){return Mt=$(Mt),te(ee(Mt),Mt)}function $(Mt){return Mt.replace(Re.comments,'').replace(Re.port,'')}function ee(Mt){let Ot={start:0,end:Mt.length},wt=Ot;for(let Dt=0,Lt=Mt.length;Dt{'complete'===document.readyState&&ve()}))}function ve(){requestAnimationFrame(()=>{(Pt||At._elementsHaveApplied)&&At.updateStyles(),Pt=!1})}(Mt=>{const Ot=!!('import'in document.createElement('link'));let wt=null;!1=='currentScript'in document&&Object.defineProperty(document,'currentScript',{get(){return wt||('complete'===document.readyState?null:document.scripts[document.scripts.length-1])},configurable:!0});const Dt=/(^\/)|(^#)|(^[\w-\d]*:)/,Lt=/(url\()([^)]*)(\))/g,kt=/(@import[\s]+(?!url\())([^;]*)(;)/g,Ht=/(]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,Ft={fixUrls(ro,no){ro.href&&ro.setAttribute('href',Ft.replaceAttrUrl(ro.getAttribute('href'),no)),ro.src&&ro.setAttribute('src',Ft.replaceAttrUrl(ro.getAttribute('src'),no)),'style'===ro.localName&&Ft.resolveUrlsInStyle(ro,no)},fixUrlAttributes(ro,no){const so=['action','src','href','url','style'];for(let lo,ao=0;aopo.search(/({{|\[\[)/)&&(io.value='style'===lo?Ft.resolveUrlsInCssText(po,no):Ft.replaceAttrUrl(po,no))}},fixUrlsInTemplates(ro,no){const so=ro.querySelectorAll('template');for(let ao=0;ao{let co=io.replace(/["']/g,'');return no&&(co=Ft.resolveUrl(co,no)),lo+'\''+co+'\''+po})},replaceAttrUrl(ro,no){return ro&&Dt.test(ro)?ro:Ft.resolveUrl(ro,no)},resolveUrl(ro,no){if(void 0===Ft.__workingURL){Ft.__workingURL=!1;try{const ao=new URL('b','http://a');ao.pathname='c%20d',Ft.__workingURL='http://a/c%20d'===ao.href}catch(ao){}}if(Ft.__workingURL)return new URL(ro,no).href;let so=Ft.__tempDoc;return so||(so=document.implementation.createHTMLDocument('temp'),Ft.__tempDoc=so,so.__base=so.createElement('base'),so.head.appendChild(so.__base),so.__anchor=so.createElement('a')),so.__base.href=no,so.__anchor.href=ro,so.__anchor.href||ro}},Ut={async:!0,load(ro){return new Promise((no,so)=>{if(!ro)so({resource:'error: href must be specified'});else if(ro.match(/^data:/)){const ao=ro.split(','),lo=ao[0];let io=ao[1];io=-1{if(4===ao.readyState){let lo;try{const po=ao.getResponseHeader('Location');po&&(lo='/'===po.substr(0,1)?location.origin+po:po)}catch(po){console.error(po.message)}const io={resource:ao.response||ao.responseText,redirectedUrl:lo};304===ao.status||0===ao.status||200<=ao.status&&300>ao.status?no(io):so(io)}}),ao.send()}})}},Wt=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent),qt='onunhandledrejection'in window,Bt='link[rel=import]',jt='import-disable',Gt=`link[rel=stylesheet][href][type=${jt}]`,Xt=`${Bt}, ${Gt}, style:not([type]), link[rel=stylesheet][href]:not([type]), script:not([type]), script[type="application/javascript"], script[type="text/javascript"]`,Vt='import-dependency',Kt=`${Bt}:not(${Vt})`,Yt=`script[${Vt}]`,zt=`style[${Vt}], - link[rel=stylesheet][${Vt}]`;const Zt=ro=>{return ro.nodeType===Node.ELEMENT_NODE&&'link'===ro.localName&&'import'===ro.rel},Qt=ro=>{return ro.__loadPromise||(ro.__loadPromise=new Promise(no=>{'script'!==ro.localName||ro.src?Wt&&'style'===ro.localName?ro.addEventListener('load',no):(ro.addEventListener('load',no),ro.addEventListener('error',no)):no()}).then(()=>{return ro.__loaded=!0,ro})),ro.__loadPromise},Jt=ro=>{eo(()=>to(()=>ro&&ro()))},eo=ro=>{if('loading'!==document.readyState)ro();else{const no=()=>{'loading'!==document.readyState&&(document.removeEventListener('readystatechange',no),ro())};document.addEventListener('readystatechange',no)}},to=ro=>{let no=document.querySelectorAll(Kt);const so=[];for(let io,ao=0,lo=no.length;ao{throw console.error(lo.stack),setTimeout(()=>{throw lo}),'unhandledrejection'})}else ro()},oo=ro=>{if(Ot)return ro.ownerDocument;let no=ro.__ownerImport;if(!no){for(no=ro;(no=no.parentNode||no.host)&&!Zt(no););ro.__ownerImport=no}return no};if(Ot){const ro=document.querySelectorAll(Bt);for(let lo,so=0,ao=ro.length;so{const ao=so.target;Zt(ao)&&(ao.__loaded=!0)};document.addEventListener('load',no,!0),document.addEventListener('error',no,!0)}else new class{constructor(){this.documents={},this.inflight=0,eo(()=>{new MutationObserver(ro=>this.handleMutations(ro)).observe(document.head,{childList:!0,subtree:!0}),this.load()})}load(ro){let no=ro?this.whenImportLoaded(ro):this.whenImportsLoaded(document);return no&&(this.inflight++,no=no.then(()=>{if(0==--this.inflight)return this.onLoadedAll()}),!qt&&(no=no.catch(so=>{throw console.error(so.stack),setTimeout(()=>{throw so}),'unhandledrejection'}))),no}whenImportsLoaded(ro){const no=ro.querySelectorAll(Bt),so=[];for(let ao=0,lo=no.length;aoro):null}whenImportLoaded(ro){const no=ro.href;return void 0===this.documents[no]?(this.documents[no]='pending',Ut.load(no).then(so=>{const ao=this.makeDocument(so.resource,so.redirectedUrl||no);return this.documents[no]=ao,this.whenImportsLoaded(ao)},()=>this.documents[no]=null).then(()=>ro)):null}makeDocument(ro,no){if(!ro)return document.createDocumentFragment();Wt&&(ro=ro.replace(Ht,(ho,_o,uo)=>{return-1===ho.indexOf('type=')?`${_o} type=${jt} ${uo}`:ho}));let so;const ao=document.createElement('template');if(ao.innerHTML=ro,ao.content)so=ao.content;else for(so=document.createDocumentFragment();ao.firstChild;)so.appendChild(ao.firstChild);const lo=so.querySelector('base');lo&&(no=Ft.replaceAttrUrl(lo.getAttribute('href'),no),lo.removeAttribute('href'));const io=so.querySelectorAll('dom-module');for(let _o,ho=0;hothis.fireEvents())}flatten(ro){const no=ro.querySelectorAll(Bt);for(let lo,so=0,ao=no.length;so{const io=document.createElement('script');lo.removeAttribute(Vt);for(let po=0,co=lo.attributes.length;powt=null)});return no}waitForStyles(){const ro=!!document.querySelector(Gt),no=document.querySelectorAll(zt),so=[];for(let io,ao=0,lo=no.length;aoio.removeAttribute(Vt))),ro&&io.parentNode!==document.head){let po=oo(io);for(;po&&oo(po);)po=oo(po);const co=io.parentNode,ho=io.nextSibling,_o=document.createElement(io.localName);_o.__appliedElement=io,_o.setAttribute('type','import-placeholder'),po.parentNode===document.head?document.head.insertBefore(io,po):document.head.appendChild(io),co.insertBefore(_o,ho),io.removeAttribute('type')}return Promise.all(so)}fireEvents(){const ro=document.querySelectorAll(Bt);for(let so,no=ro.length-1;0<=no&&(so=ro[no]);no--)this.fireEventIfNeeded(so)}fireEventIfNeeded(ro){if(!ro.__loaded){ro.__loaded=!0,ro.import&&(ro.import.readyState='complete');const no=ro.import?'load':'error';ro.dispatchEvent(new CustomEvent(no,{bubbles:!1,cancelable:!1,detail:void 0}))}}handleMutations(ro){for(let no=0;nodocument.dispatchEvent(new CustomEvent('HTMLImportsLoaded',{cancelable:!0,bubbles:!0,detail:void 0}))),Mt.useNative=Ot,Mt.whenReady=Jt,Mt.importForElement=oo})(window.HTMLImports=window.HTMLImports||{}),function(){'use strict';function Mt(Ln,kn,Hn){return{index:Ln,removed:kn,addedCount:Hn}}function Ot(Ln){return'ShadyRoot'===Ln.__localName}function Lt(Ln,kn,Hn){(kn=Object.getOwnPropertyDescriptor(kn,Ln))&&Object.defineProperty(Hn,Ln,kn)}function kt(Ln,kn){if(Ln&&kn)for(var Un,Hn=Object.getOwnPropertyNames(kn),Fn=0;Fn100;if(Tr.length&&!Ln&&qt(),Ar=0,Ln)throw Error('Loop detected in ShadyDOM distribution, aborting.')}function Bt(Ln,kn){return Ln.__shady&&Ln.__shady[kn]}function Gt(Ln){return'&'===Ln?'&':'<'===Ln?'<':'>'===Ln?'>':'"'===Ln?'"':'\xA0'===Ln?' ':void 0}function Xt(Ln){return Ln.replace(Mr,Gt)}function Vt(Ln){return Ln.replace(Or,Gt)}function Kt(Ln){for(var kn={},Hn=0;Hn';case Node.TEXT_NODE:return Ln=Ln.data,kn&&Dr[kn.localName]?Ln:Vt(Ln);case Node.COMMENT_NODE:return'';default:throw window.console.error(Ln),Error('not implemented');}}function zt(Ln,kn){'template'===Ln.localName&&(Ln=Ln.content);for(var qn,Hn='',Fn=kn?kn(Ln):Ln.childNodes,Un=0,Wn=Fn.length;Un]/g,wr=Kt('area base br col command embed hr img input keygen link meta param source track wbr'.split(' ')),Dr=Kt('style script xmp iframe noembed noframes plaintext noscript'.split(' '));Ir.getOuterHTML=Yt,Ir.getInnerHTML=zt;var Lr={},kr=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),Hr=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1);Lr.parentNode=function(Ln){return kr.currentNode=Ln,kr.parentNode()},Lr.firstChild=function(Ln){return kr.currentNode=Ln,kr.firstChild()},Lr.lastChild=function(Ln){return kr.currentNode=Ln,kr.lastChild()},Lr.previousSibling=function(Ln){return kr.currentNode=Ln,kr.previousSibling()},Lr.nextSibling=function(Ln){return kr.currentNode=Ln,kr.nextSibling()},Lr.childNodes=to,Lr.parentElement=function(Ln){return Hr.currentNode=Ln,Hr.parentNode()},Lr.firstElementChild=function(Ln){return Hr.currentNode=Ln,Hr.firstChild()},Lr.lastElementChild=function(Ln){return Hr.currentNode=Ln,Hr.lastChild()},Lr.previousElementSibling=function(Ln){return Hr.currentNode=Ln,Hr.previousSibling()},Lr.nextElementSibling=function(Ln){return Hr.currentNode=Ln,Hr.nextSibling()},Lr.children=function(Ln){var kn=[];for(Hr.currentNode=Ln,Ln=Hr.firstChild();Ln;)kn.push(Ln),Ln=Hr.nextSibling();return kn},Lr.innerHTML=function(Ln){return Ir.getInnerHTML(Ln,function(kn){return to(kn)})},Lr.textContent=function(Ln){if(Ln.nodeType!==Node.ELEMENT_NODE)return Ln.nodeValue;Ln=document.createTreeWalker(Ln,NodeFilter.SHOW_TEXT,null,!1);for(var Hn,kn='';Hn=Ln.nextNode();)kn+=Hn.nodeValue;return kn};var Fr={},Ur=Object.getOwnPropertyDescriptor(Element.prototype,'innerHTML')||Object.getOwnPropertyDescriptor(HTMLElement.prototype,'innerHTML'),Wr=document.implementation.createHTMLDocument('inert'),qr=Wr.createElement('div'),Br=Object.getOwnPropertyDescriptor(Document.prototype,'activeElement'),jr={parentElement:co('parentElement'),parentNode:co('parentNode'),nextSibling:co('nextSibling'),previousSibling:co('previousSibling'),className:{get:function(){return this.getAttribute('class')},set:function(Ln){this.setAttribute('class',Ln)},configurable:!0},nextElementSibling:{get:function(){if(xr.hasProperty(this,'nextSibling')){for(var Ln=this.nextSibling;Ln&&Ln.nodeType!==Node.ELEMENT_NODE;)Ln=Ln.nextSibling;return Ln}return Lr.nextElementSibling(this)},configurable:!0},previousElementSibling:{get:function(){if(xr.hasProperty(this,'previousSibling')){for(var Ln=this.previousSibling;Ln&&Ln.nodeType!==Node.ELEMENT_NODE;)Ln=Ln.previousSibling;return Ln}return Lr.previousElementSibling(this)},configurable:!0}},Gr={childNodes:{get:function(){if(xr.hasProperty(this,'firstChild')){if(!this.__shady.childNodes){this.__shady.childNodes=[];for(var Ln=this.firstChild;Ln;Ln=Ln.nextSibling)this.__shady.childNodes.push(Ln)}return this.__shady.childNodes}return Lr.childNodes(this)},configurable:!0},firstChild:co('firstChild'),lastChild:co('lastChild'),textContent:{get:function(){if(xr.hasProperty(this,'firstChild')){for(var Fn,Ln=[],kn=0,Hn=this.childNodes;Fn=Hn[kn];kn++)Fn.nodeType!==Node.COMMENT_NODE&&Ln.push(Fn.textContent);return Ln.join('')}return Lr.textContent(this)},set:function(Ln){this.nodeType===Node.ELEMENT_NODE?(ho(this),Ln&&this.appendChild(document.createTextNode(Ln))):this.nodeValue=Ln},configurable:!0},firstElementChild:{get:function(){if(xr.hasProperty(this,'firstChild')){for(var Ln=this.firstChild;Ln&&Ln.nodeType!==Node.ELEMENT_NODE;)Ln=Ln.nextSibling;return Ln}return Lr.firstElementChild(this)},configurable:!0},lastElementChild:{get:function(){if(xr.hasProperty(this,'lastChild')){for(var Ln=this.lastChild;Ln&&Ln.nodeType!==Node.ELEMENT_NODE;)Ln=Ln.previousSibling;return Ln}return Lr.lastElementChild(this)},configurable:!0},children:{get:function(){return xr.hasProperty(this,'firstChild')?Array.prototype.filter.call(this.childNodes,function(Ln){return Ln.nodeType===Node.ELEMENT_NODE}):Lr.children(this)},configurable:!0},innerHTML:{get:function(){var Ln='template'===this.localName?this.content:this;return xr.hasProperty(this,'firstChild')?Ir.getInnerHTML(Ln):Lr.innerHTML(Ln)},set:function(Ln){var kn='template'===this.localName?this.content:this;for(ho(kn),Ur&&Ur.set?Ur.set.call(qr,Ln):qr.innerHTML=Ln;qr.firstChild;)kn.appendChild(qr.firstChild)},configurable:!0}},Xr={shadowRoot:{get:function(){return this.shadyRoot},set:function(Ln){this.shadyRoot=Ln},configurable:!0}},Vr={activeElement:{get:function(){return uo(this)},set:function(){},configurable:!0}},Kr=mr.settings.hasDescriptors?function(){}:function(Ln){Ln.__shady&&Ln.__shady.__outsideAccessors||(Ln.__shady=Ln.__shady||{},Ln.__shady.__outsideAccessors=!0,mo(Ln,jr,!0))},Yr=mr.settings.hasDescriptors?function(){}:function(Ln){Ln.__shady&&Ln.__shady.__insideAccessors||(Ln.__shady=Ln.__shady||{},Ln.__shady.__insideAccessors=!0,mo(Ln,Gr,!0),mo(Ln,Xr,!0))};Fr.ShadowRootAccessor=Xr,Fr.ActiveElementAccessor=Vr,Fr.patchAccessors=function(Ln){mo(Ln,jr),mo(Ln,Gr),mo(Ln,Vr)},Fr.patchShadowRootAccessors=function(Ln){mo(Ln,Gr,!0),mo(Ln,Vr,!0)},Fr.patchOutsideElementAccessors=Kr,Fr.patchInsideElementAccessors=Yr;var zr={};zr.recordInsertBefore=function(Ln,kn,Hn){if(Fr.patchInsideElementAccessors(kn),kn.__shady=kn.__shady||{},xr.hasProperty(kn,'firstChild')&&(kn.__shady.childNodes=null),Ln.nodeType===Node.DOCUMENT_FRAGMENT_NODE){for(var Fn=Ln.childNodes,Un=0;Un+~])'};const He='style-scope';class Fe{get SCOPE_NAME(){return He}dom(Mt,Ot,wt){Mt.__styleScoped?Mt.__styleScoped=null:this._transformDom(Mt,Ot||'',wt)}_transformDom(Mt,Ot,wt){Mt.nodeType===Node.ELEMENT_NODE&&this.element(Mt,Ot,wt);let Dt='template'===Mt.localName?(Mt.content||Mt._content).childNodes:Mt.children||Mt.childNodes;if(Dt)for(let Lt=0;Lt`:${kt}(${Ht.replace(/\s/g,'')})`),Mt=Mt.replace(Ke,`${Ge} $1`),Mt=Mt.replace(Be,(Lt,kt,Ht)=>{if(!Dt){let Ft=this._transformCompoundSelector(Ht,kt,Ot,wt);Dt=Dt||Ft.stop,kt=Ft.combinator,Ht=Ft.value}return kt+Ht}),Mt}_transformCompoundSelector(Mt,Ot,wt,Dt){let Lt=Mt.indexOf(Ve);0<=Mt.indexOf(Ge)?Mt=this._transformHostSelector(Mt,Dt):0!==Lt&&(Mt=wt?this._transformSimpleSelector(Mt,wt):Mt);let kt=!1;0<=Lt&&(Ot='',kt=!0);let Ht;return kt&&(Ht=!0,kt&&(Mt=Mt.replace(ze,(Ft,Ut)=>` > ${Ut}`))),Mt=Mt.replace($e,(Ft,Ut,Wt)=>`[dir="${Wt}"] ${Ut}, ${Ut}[dir="${Wt}"]`),{value:Mt,combinator:Ot,stop:Ht}}_transformSimpleSelector(Mt,Ot){let wt=Mt.split(Qe);return wt[0]+=Ot,wt.join(Qe)}_transformHostSelector(Mt,Ot){let wt=Mt.match(Ye),Dt=wt&&wt[2].trim()||'';if(Dt){if(!Dt[0].match(je)){let Lt=Dt.split(je)[0];return Lt===Ot?Dt:'should_not_match'}return Mt.replace(Ye,function(Lt,kt,Ht){return Ot+Ht})}return Mt.replace(Ge,Ot)}documentRule(Mt){Mt.selector=Mt.parsedSelector,this.normalizeRootSelector(Mt),this._transformRule(Mt,this._transformDocumentSelector)}normalizeRootSelector(Mt){Mt.selector===':root'&&(Mt.selector='html')}_transformDocumentSelector(Mt){return Mt.match(Ve)?this._transformComplexSelector(Mt,We):this._transformSimpleSelector(Mt.trim(),We)}}let Ue=/:(nth[-\w]+)\(([^)]+)\)/,We=`:not(.${He})`,qe=',',Be=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,je=/[[.:#*]/,Ge=':host',Ve='::slotted',Ke=/^(::slotted)/,Ye=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ze=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,$e=/(.*):dir\((?:(ltr|rtl))\)/,Qe=':';var tt=new Fe,ot={};const rt=Promise.resolve();class nt{static get(Mt){return Mt.__styleInfo}static set(Mt,Ot){return Mt.__styleInfo=Ot,Ot}static invalidate(Mt){ot[Mt]&&(ot[Mt]._applyShimInvalid=!0)}static startValidating(Mt){const Ot=ot[Mt];Ot._validating||(Ot._validating=!0,rt.then(()=>{Ot._applyShimInvalid=!1,Ot._validating=!1}))}constructor(Mt,Ot,wt,Dt,Lt,kt){this.styleRules=Mt||null,this.placeholder=Ot||null,this.ownStylePropertyNames=wt||[],this.overrideStyleProperties=null,this.elementName=Dt||'',this.cssBuild=kt||'',this.typeExtension=Lt||'',this.styleProperties=null,this.scopeSelector=null,this.customStyle=null}}const st=window.Element.prototype,lt=st.matches||st.matchesSelector||st.mozMatchesSelector||st.msMatchesSelector||st.oMatchesSelector||st.webkitMatchesSelector,dt=navigator.userAgent.match('Trident'),it='x-scope';class pt{get XSCOPE_NAME(){return it}decorateStyles(Mt){let Ot=this,wt={},Dt=[],Lt=0;ue(Mt,function(Ht){Ot.decorateRule(Ht),Ht.index=Lt++,Ot.collectPropertiesInCssText(Ht.propertyInfo.cssText,wt)},function(Ft){Dt.push(Ft)}),Mt._keyframes=Dt;let kt=[];for(let Ht in wt)kt.push(Ht);return kt}decorateRule(Mt){if(Mt.propertyInfo)return Mt.propertyInfo;let Ot={},wt={},Dt=this.collectProperties(Mt,wt);return Dt&&(Ot.properties=wt,Mt.rules=null),Ot.cssText=this.collectCssText(Mt),Mt.propertyInfo=Ot,Ot}collectProperties(Mt,Ot){let wt=Mt.propertyInfo;if(!wt){let Dt,Lt=ke.VAR_ASSIGN,kt=Mt.parsedCssText,Ht,Ft;for(;Dt=Lt.exec(kt);)Ht=(Dt[2]||Dt[3]).trim(),('inherit'!==Ht||'unset'!==Ht)&&(Ot[Dt[1].trim()]=Ht),Ft=!0;return Ft}else if(wt.properties)return Object.assign(Ot,wt.properties),!0}collectCssText(Mt){return this.collectConsumingCssText(Mt.parsedCssText)}collectConsumingCssText(Mt){return Mt.replace(ke.BRACKETED,'').replace(ke.VAR_ASSIGN,'')}collectPropertiesInCssText(Mt,Ot){for(let wt,Dt;wt=ke.VAR_CONSUMED.exec(Mt);)Dt=wt[1],':'!==wt[2]&&(Ot[Dt]=!0)}reify(Mt){let Ot=Object.getOwnPropertyNames(Mt);for(let Dt,wt=0;wt *'===kt||'html'===kt,Ft=0===kt.indexOf(':host')&&!Ht;if('shady'===wt&&(Ht=kt===Lt+' > *.'+Lt||-1!==kt.indexOf('html'),Ft=!Ht&&0===kt.indexOf(Lt)),'shadow'===wt&&(Ht=':host > *'===kt||'html'===kt,Ft=Ft&&!Ht),Ht||Ft){let Ut=Lt;Ft&&(Oe&&!Ot.transformedSelector&&(Ot.transformedSelector=tt._transformRuleCss(Ot,tt._transformComplexSelector,tt._calcElementScope(Mt.is),Lt)),Ut=Ot.transformedSelector||Lt),Dt({selector:Ut,isHost:Ft,isRoot:Ht})}}}hostAndRootPropertiesForScope(Mt,Ot){let wt={},Dt={},Lt=this,kt=Ot&&Ot.__cssBuild;return ue(Ot,function(Ht){Lt.whenHostOrRootRule(Mt,Ht,kt,function(Ft){let Ut=Mt._element||Mt;lt.call(Ut,Ft.selector)&&(Ft.isHost?Lt.collectProperties(Ht,wt):Lt.collectProperties(Ht,Dt))})},null,!0),{rootProps:Dt,hostProps:wt}}transformStyles(Mt,Ot,wt){let Dt=this,Lt=tt._calcHostScope(Mt.is,Mt.extends),kt=Mt.extends?'\\'+Lt.slice(0,-1)+'\\]':Lt,Ht=new RegExp(ke.HOST_PREFIX+kt+ke.HOST_SUFFIX),Ft=nt.get(Mt).styleRules,Ut=this._elementKeyframeTransforms(Mt,Ft,wt);return tt.elementStyles(Mt,Ft,function(Wt){Dt.applyProperties(Wt,Ot),Oe||_e(Wt)||!Wt.cssText||(Dt.applyKeyframeTransforms(Wt,Ut),Dt._scopeSelector(Wt,Ht,Lt,wt))})}_elementKeyframeTransforms(Mt,Ot,wt){let Dt=Ot._keyframes,Lt={};if(!Oe&&Dt)for(let kt=0,Ht=Dt[kt];kt=Ht._useCount&&Ht.parentNode&&Ht.parentNode.removeChild(Ht)),Oe?kt.customStyle?(kt.customStyle.textContent=Lt,Dt=kt.customStyle):Lt&&(Dt=me(Lt,wt,Mt.shadowRoot,kt.placeholder)):Dt?!Dt.parentNode&&ye(Dt,null,kt.placeholder):Lt&&(Dt=me(Lt,wt,null,kt.placeholder)),Dt&&(Dt._useCount=Dt._useCount||0,kt.customStyle!=Dt&&Dt._useCount++,kt.customStyle=Dt),dt&&(Dt.textContent=Dt.textContent),Dt}applyCustomStyle(Mt,Ot){let wt=he(Mt),Dt=this;Mt.textContent=pe(wt,function(Lt){let kt=Lt.cssText=Lt.parsedCssText;Lt.propertyInfo&&Lt.propertyInfo.cssText&&(kt=ae(kt),Lt.cssText=Dt.valueForProperties(kt,Ot))})}}var ct=new pt;let ht={};const _t=window.customElements;if(_t&&!Oe){const Mt=_t.define;_t.define=function(Ot,wt,Dt){return ht[Ot]=fe(Ot),Mt.call(_t,Ot,wt,Dt)}}let mt=ke.MIXIN_MATCH,yt=ke.VAR_ASSIGN,gt=/;\s*/m,ft=/^\s*(initial)|(inherit)\s*$/,Nt='_-_';class bt{constructor(){this._map={}}set(Mt,Ot){Mt=Mt.trim(),this._map[Mt]={properties:Ot,dependants:{}}}get(Mt){return Mt=Mt.trim(),this._map[Mt]}}class St{constructor(){this._currentTemplate=null,this._measureElement=null,this._map=new bt,this._separator=Nt,this._boundProduceCssProperties=(Mt,Ot,wt,Dt)=>this._produceCssProperties(Mt,Ot,wt,Dt)}detectMixin(Mt){const Ot=mt.test(Mt)||yt.test(Mt);return mt.lastIndex=0,yt.lastIndex=0,Ot}transformStyle(Mt,Ot){let wt=he(Mt);return this.transformRules(wt,Ot),wt}transformRules(Mt,Ot){this._currentTemplate=ot[Ot],ue(Mt,wt=>{this.transformRule(wt)}),this._currentTemplate=null}transformRule(Mt){Mt.cssText=this.transformCssText(Mt.parsedCssText),':root'===Mt.selector&&(Mt.selector=':host > *')}transformCssText(Mt){return Mt=Mt.replace(yt,this._boundProduceCssProperties),this._consumeCssProperties(Mt)}_getInitialValueForProperty(Mt){return this._measureElement||(this._measureElement=document.createElement('meta'),this._measureElement.style.all='initial',document.head.appendChild(this._measureElement)),window.getComputedStyle(this._measureElement).getPropertyValue(Mt)}_consumeCssProperties(Mt){for(let Ot;Ot=mt.exec(Mt);){let wt=Ot[0],Dt=Ot[1],Lt=Ot.index,kt=Lt+wt.indexOf('@apply'),Ht=Lt+wt.length,Ft=Mt.slice(0,kt),Ut=Mt.slice(Ht),Wt=this._cssTextToMap(Ft),qt=this._atApplyToCssProperties(Dt,Wt);Mt=[Ft,qt,Ut].join(''),mt.lastIndex=Lt+qt.length}return Mt}_atApplyToCssProperties(Mt,Ot){Mt=Mt.replace(gt,'');let wt=[],Dt=this._map.get(Mt);if(Dt||(this._map.set(Mt,{}),Dt=this._map.get(Mt)),Dt){this._currentTemplate&&(Dt.dependants[this._currentTemplate.name]=this._currentTemplate);let Lt,kt,Ht;for(Lt in Dt.properties)Ht=Ot&&Ot[Lt],kt=[Lt,': var(',Mt,Nt,Lt],Ht&&kt.push(',',Ht),kt.push(')'),wt.push(kt.join(''))}return wt.join('; ')}_replaceInitialOrInherit(Mt,Ot){let wt=ft.exec(Ot);return wt&&(wt[1]?Ot=St._getInitialValueForProperty(Mt):Ot='apply-shim-inherit'),Ot}_cssTextToMap(Mt){let Ot=Mt.split(';'),wt,Dt,Lt={};for(let Ht,Ft,kt=0;kt{Vt&&this._map.get(Vt)&&(Dt='@apply '+Vt+';')}),!Dt)return Mt;let Lt=this._consumeCssProperties(Dt),kt=Mt.slice(0,Mt.indexOf('--')),Ht=this._cssTextToMap(Lt),Ft=Ht,Ut=this._map.get(Ot),Wt=Ut&&Ut.properties;Wt?Ft=Object.assign(Object.create(Wt),Ht):this._map.set(Ot,Ft);let Bt,jt,qt=[],Gt=!1;for(Bt in Ft)jt=Ht[Bt],void 0==jt&&(jt='initial'),Wt&&!(Bt in Wt)&&(Gt=!0),qt.push(Ot+Nt+Bt+': '+jt);return Gt&&this._invalidateMixinEntry(Ut),Ut&&(Ut.properties=Ft),wt&&(kt=Mt+';'+kt),kt+qt.join('; ')+';'}}let Et=new St;window.ApplyShim=Et;let Ct=function(){};if(!Oe){let Mt=kt=>{return kt.classList&&!kt.classList.contains(tt.SCOPE_NAME)||kt instanceof SVGElement&&(!kt.hasAttribute('class')||0>kt.getAttribute('class').indexOf(tt.SCOPE_NAME))},Ot=kt=>{for(let Ft,Ht=0;Ht{wt.observe(kt,{childList:!0,subtree:!0})},Lt=window.customElements&&!window.customElements.flush;if(Lt)Dt(document);else{let kt=()=>{Dt(document.body)};window.HTMLImports?window.HTMLImports.whenReady(kt):requestAnimationFrame(function(){if('loading'===document.readyState){let Ht=function(){kt(),document.removeEventListener('readystatechange',Ht)};document.addEventListener('readystatechange',Ht)}else kt()})}Ct=function(){Ot(wt.takeRecords())}}let vt=new class{constructor(Mt=100){this.cache={},this.typeMax=Mt}_validate(Mt,Ot,wt){for(let Lt,Dt=0;Dtthis.typeMax&&Lt.shift(),this.cache[Mt]=Lt}fetch(Mt,Ot,wt){let Dt=this.cache[Mt];if(Dt)for(let kt,Lt=Dt.length-1;0<=Lt;Lt--)if(kt=Dt[Lt],this._validate(kt,Ot,wt))return kt}};class Tt{constructor(){this._scopeCounter={},this._documentOwner=document.documentElement,this._documentOwnerStyleInfo=nt.set(document.documentElement,new nt({rules:[]})),this._elementsHaveApplied=!1}get nativeShadow(){return Oe}get nativeCss(){return we}get nativeCssApply(){return!1}flush(){Ct()}_generateScopeSelector(Mt){let Ot=this._scopeCounter[Mt]=(this._scopeCounter[Mt]||0)+1;return`${Mt}-${Ot}`}getStyleAst(Mt){return he(Mt)}styleAstToString(Mt){return pe(Mt)}_gatherStyles(Mt){let Ot=Mt.content.querySelectorAll('style'),wt=[];for(let Lt,Dt=0;Dt{Oe?tt.normalizeRootSelector(wt):tt.documentRule(wt),this.nativeCss&&!this.nativeCssApply&&Et.transformRule(wt)}),this.nativeCss?Mt.textContent=pe(Ot):this._documentOwnerStyleInfo.styleRules.rules.push(Ot)}_revalidateApplyShim(Mt){if(this.nativeCss&&!this.nativeCssApply){let Ot=he(Mt);Et.transformRules(Ot),Mt.textContent=pe(Ot)}}_applyCustomStyleToDocument(Mt){this.nativeCss||ct.applyCustomStyle(Mt,this._documentOwnerStyleInfo.styleProperties)}getComputedStyleValue(Mt,Ot){let wt;if(!this.nativeCss){let Dt=nt.get(Mt)||nt.get(this._styleOwnerForNode(Mt));wt=Dt.styleProperties[Ot]}return wt=wt||window.getComputedStyle(Mt).getPropertyValue(Ot),wt.trim()}setElementClass(Mt,Ot){let wt=Mt.getRootNode(),Dt=Ot?Ot.split(/\s/):[],Lt=wt.host&&wt.host.localName;if(!Lt){var kt=Mt.getAttribute('class');if(kt){let Ht=kt.split(/\s/);for(let Ft=0;Ft{return ro.nodeType===Node.ELEMENT_NODE&&'link'===ro.localName&&'import'===ro.rel},Qt=ro=>{return ro.__loadPromise||(ro.__loadPromise=new Promise(no=>{'script'!==ro.localName||ro.src?Wt&&'style'===ro.localName?ro.addEventListener('load',no):(ro.addEventListener('load',no),ro.addEventListener('error',no)):no()}).then(()=>{return ro.__loaded=!0,ro})),ro.__loadPromise},Jt=ro=>{eo(()=>to(()=>ro&&ro()))},eo=ro=>{if('loading'!==document.readyState)ro();else{const no=()=>{'loading'!==document.readyState&&(document.removeEventListener('readystatechange',no),ro())};document.addEventListener('readystatechange',no)}},to=ro=>{let no=document.querySelectorAll(Kt);const so=[];for(let io,ao=0,lo=no.length;ao{throw console.error(lo.stack),setTimeout(()=>{throw lo}),'unhandledrejection'})}else ro()},oo=ro=>{if(Ot)return ro.ownerDocument;let no=ro.__ownerImport;if(!no){for(no=ro;(no=no.parentNode||no.host)&&!Zt(no););ro.__ownerImport=no}return no};if(Ot){const ro=document.querySelectorAll(Bt);for(let lo,so=0,ao=ro.length;so{const ao=so.target;Zt(ao)&&(ao.__loaded=!0)};document.addEventListener('load',no,!0),document.addEventListener('error',no,!0)}else new class{constructor(){this.documents={},this.inflight=0,eo(()=>{new MutationObserver(ro=>this.handleMutations(ro)).observe(document.head,{childList:!0,subtree:!0}),this.load()})}load(ro){let no=ro?this.whenImportLoaded(ro):this.whenImportsLoaded(document);return no&&(this.inflight++,no=no.then(()=>{if(0==--this.inflight)return this.onLoadedAll()}),!qt&&(no=no.catch(so=>{throw console.error(so.stack),setTimeout(()=>{throw so}),'unhandledrejection'}))),no}whenImportsLoaded(ro){const no=ro.querySelectorAll(Bt),so=[];for(let ao=0,lo=no.length;aoro):null}whenImportLoaded(ro){const no=ro.href;return void 0===this.documents[no]?(this.documents[no]='pending',Ut.load(no).then(so=>{const ao=this.makeDocument(so.resource,so.redirectedUrl||no);return this.documents[no]=ao,this.whenImportsLoaded(ao)},()=>this.documents[no]=null).then(()=>ro)):null}makeDocument(ro,no){if(!ro)return document.createDocumentFragment();Wt&&(ro=ro.replace(Ht,(ho,_o,uo)=>{return-1===ho.indexOf('type=')?`${_o} type=${jt} ${uo}`:ho}));let so;const ao=document.createElement('template');if(ao.innerHTML=ro,ao.content)so=ao.content;else for(so=document.createDocumentFragment();ao.firstChild;)so.appendChild(ao.firstChild);const lo=so.querySelector('base');lo&&(no=Ft.replaceAttrUrl(lo.getAttribute('href'),no),lo.removeAttribute('href'));const io=so.querySelectorAll('dom-module');for(let _o,ho=0;hothis.fireEvents())}flatten(ro){const no=ro.querySelectorAll(Bt);for(let lo,so=0,ao=no.length;so{const io=document.createElement('script');lo.removeAttribute(Vt);for(let po=0,co=lo.attributes.length;powt=null)});return no}waitForStyles(){const ro=!!document.querySelector(Gt),no=document.querySelectorAll(zt),so=[];for(let io,ao=0,lo=no.length;aoio.removeAttribute(Vt))),ro&&io.parentNode!==document.head){let po=oo(io);for(;po&&oo(po);)po=oo(po);const co=io.parentNode,ho=io.nextSibling,_o=document.createElement(io.localName);_o.__appliedElement=io,_o.setAttribute('type','import-placeholder'),po.parentNode===document.head?document.head.insertBefore(io,po):document.head.appendChild(io),co.insertBefore(_o,ho),io.removeAttribute('type')}return Promise.all(so)}fireEvents(){const ro=document.querySelectorAll(Bt);for(let so,no=ro.length-1;0<=no&&(so=ro[no]);no--)this.fireEventIfNeeded(so)}fireEventIfNeeded(ro){if(!ro.__loaded){ro.__loaded=!0,ro.import&&(ro.import.readyState='complete');const no=ro.import?'load':'error';ro.dispatchEvent(new CustomEvent(no,{bubbles:!1,cancelable:!1,detail:void 0}))}}handleMutations(ro){for(let no=0;nodocument.dispatchEvent(new CustomEvent('HTMLImportsLoaded',{cancelable:!0,bubbles:!0,detail:void 0}))),Mt.useNative=Ot,Mt.whenReady=Jt,Mt.importForElement=oo})(window.HTMLImports=window.HTMLImports||{}),function(){'use strict';function Mt(Ln,kn,Hn){return{index:Ln,removed:kn,addedCount:Hn}}function Ot(Ln){return'ShadyRoot'===Ln.__localName}function Lt(Ln,kn,Hn){(kn=Object.getOwnPropertyDescriptor(kn,Ln))&&Object.defineProperty(Hn,Ln,kn)}function kt(Ln,kn){if(Ln&&kn)for(var Un,Hn=Object.getOwnPropertyNames(kn),Fn=0;Fn100;if(Tr.length&&!Ln&&qt(),Pr=0,Ln)throw Error('Loop detected in ShadyDOM distribution, aborting.')}function Bt(Ln,kn){return Ln.__shady&&Ln.__shady[kn]}function Gt(Ln){return'&'===Ln?'&':'<'===Ln?'<':'>'===Ln?'>':'"'===Ln?'"':'\xA0'===Ln?' ':void 0}function Xt(Ln){return Ln.replace(Mr,Gt)}function Vt(Ln){return Ln.replace(Or,Gt)}function Kt(Ln){for(var kn={},Hn=0;Hn';case Node.TEXT_NODE:return Ln=Ln.data,kn&&Dr[kn.localName]?Ln:Vt(Ln);case Node.COMMENT_NODE:return'';default:throw window.console.error(Ln),Error('not implemented');}}function zt(Ln,kn){'template'===Ln.localName&&(Ln=Ln.content);for(var qn,Hn='',Fn=kn?kn(Ln):Ln.childNodes,Un=0,Wn=Fn.length;Un]/g,wr=Kt('area base br col command embed hr img input keygen link meta param source track wbr'.split(' ')),Dr=Kt('style script xmp iframe noembed noframes plaintext noscript'.split(' '));Ir.getOuterHTML=Yt,Ir.getInnerHTML=zt;var Lr={},kr=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),Hr=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1);Lr.parentNode=function(Ln){return kr.currentNode=Ln,kr.parentNode()},Lr.firstChild=function(Ln){return kr.currentNode=Ln,kr.firstChild()},Lr.lastChild=function(Ln){return kr.currentNode=Ln,kr.lastChild()},Lr.previousSibling=function(Ln){return kr.currentNode=Ln,kr.previousSibling()},Lr.nextSibling=function(Ln){return kr.currentNode=Ln,kr.nextSibling()},Lr.childNodes=to,Lr.parentElement=function(Ln){return Hr.currentNode=Ln,Hr.parentNode()},Lr.firstElementChild=function(Ln){return Hr.currentNode=Ln,Hr.firstChild()},Lr.lastElementChild=function(Ln){return Hr.currentNode=Ln,Hr.lastChild()},Lr.previousElementSibling=function(Ln){return Hr.currentNode=Ln,Hr.previousSibling()},Lr.nextElementSibling=function(Ln){return Hr.currentNode=Ln,Hr.nextSibling()},Lr.children=function(Ln){var kn=[];for(Hr.currentNode=Ln,Ln=Hr.firstChild();Ln;)kn.push(Ln),Ln=Hr.nextSibling();return kn},Lr.innerHTML=function(Ln){return Ir.getInnerHTML(Ln,function(kn){return to(kn)})},Lr.textContent=function(Ln){if(Ln.nodeType!==Node.ELEMENT_NODE)return Ln.nodeValue;Ln=document.createTreeWalker(Ln,NodeFilter.SHOW_TEXT,null,!1);for(var Hn,kn='';Hn=Ln.nextNode();)kn+=Hn.nodeValue;return kn};var Fr={},Ur=Object.getOwnPropertyDescriptor(Element.prototype,'innerHTML')||Object.getOwnPropertyDescriptor(HTMLElement.prototype,'innerHTML'),Wr=document.implementation.createHTMLDocument('inert'),qr=Wr.createElement('div'),Br=Object.getOwnPropertyDescriptor(Document.prototype,'activeElement'),jr={parentElement:co('parentElement'),parentNode:co('parentNode'),nextSibling:co('nextSibling'),previousSibling:co('previousSibling'),className:{get:function(){return this.getAttribute('class')},set:function(Ln){this.setAttribute('class',Ln)},configurable:!0},nextElementSibling:{get:function(){if(xr.hasProperty(this,'nextSibling')){for(var Ln=this.nextSibling;Ln&&Ln.nodeType!==Node.ELEMENT_NODE;)Ln=Ln.nextSibling;return Ln}return Lr.nextElementSibling(this)},configurable:!0},previousElementSibling:{get:function(){if(xr.hasProperty(this,'previousSibling')){for(var Ln=this.previousSibling;Ln&&Ln.nodeType!==Node.ELEMENT_NODE;)Ln=Ln.previousSibling;return Ln}return Lr.previousElementSibling(this)},configurable:!0}},Gr={childNodes:{get:function(){if(xr.hasProperty(this,'firstChild')){if(!this.__shady.childNodes){this.__shady.childNodes=[];for(var Ln=this.firstChild;Ln;Ln=Ln.nextSibling)this.__shady.childNodes.push(Ln)}return this.__shady.childNodes}return Lr.childNodes(this)},configurable:!0},firstChild:co('firstChild'),lastChild:co('lastChild'),textContent:{get:function(){if(xr.hasProperty(this,'firstChild')){for(var Fn,Ln=[],kn=0,Hn=this.childNodes;Fn=Hn[kn];kn++)Fn.nodeType!==Node.COMMENT_NODE&&Ln.push(Fn.textContent);return Ln.join('')}return Lr.textContent(this)},set:function(Ln){this.nodeType===Node.ELEMENT_NODE?(ho(this),Ln&&this.appendChild(document.createTextNode(Ln))):this.nodeValue=Ln},configurable:!0},firstElementChild:{get:function(){if(xr.hasProperty(this,'firstChild')){for(var Ln=this.firstChild;Ln&&Ln.nodeType!==Node.ELEMENT_NODE;)Ln=Ln.nextSibling;return Ln}return Lr.firstElementChild(this)},configurable:!0},lastElementChild:{get:function(){if(xr.hasProperty(this,'lastChild')){for(var Ln=this.lastChild;Ln&&Ln.nodeType!==Node.ELEMENT_NODE;)Ln=Ln.previousSibling;return Ln}return Lr.lastElementChild(this)},configurable:!0},children:{get:function(){return xr.hasProperty(this,'firstChild')?Array.prototype.filter.call(this.childNodes,function(Ln){return Ln.nodeType===Node.ELEMENT_NODE}):Lr.children(this)},configurable:!0},innerHTML:{get:function(){var Ln='template'===this.localName?this.content:this;return xr.hasProperty(this,'firstChild')?Ir.getInnerHTML(Ln):Lr.innerHTML(Ln)},set:function(Ln){var kn='template'===this.localName?this.content:this;for(ho(kn),Ur&&Ur.set?Ur.set.call(qr,Ln):qr.innerHTML=Ln;qr.firstChild;)kn.appendChild(qr.firstChild)},configurable:!0}},Xr={shadowRoot:{get:function(){return this.shadyRoot},set:function(Ln){this.shadyRoot=Ln},configurable:!0}},Vr={activeElement:{get:function(){return uo(this)},set:function(){},configurable:!0}},Kr=mr.settings.hasDescriptors?function(){}:function(Ln){Ln.__shady&&Ln.__shady.__outsideAccessors||(Ln.__shady=Ln.__shady||{},Ln.__shady.__outsideAccessors=!0,mo(Ln,jr,!0))},Yr=mr.settings.hasDescriptors?function(){}:function(Ln){Ln.__shady&&Ln.__shady.__insideAccessors||(Ln.__shady=Ln.__shady||{},Ln.__shady.__insideAccessors=!0,mo(Ln,Gr,!0),mo(Ln,Xr,!0))};Fr.ShadowRootAccessor=Xr,Fr.ActiveElementAccessor=Vr,Fr.patchAccessors=function(Ln){mo(Ln,jr),mo(Ln,Gr),mo(Ln,Vr)},Fr.patchShadowRootAccessors=function(Ln){mo(Ln,Gr,!0),mo(Ln,Vr,!0)},Fr.patchOutsideElementAccessors=Kr,Fr.patchInsideElementAccessors=Yr;var zr={};zr.recordInsertBefore=function(Ln,kn,Hn){if(Fr.patchInsideElementAccessors(kn),kn.__shady=kn.__shady||{},xr.hasProperty(kn,'firstChild')&&(kn.__shady.childNodes=null),Ln.nodeType===Node.DOCUMENT_FRAGMENT_NODE){for(var Fn=Ln.childNodes,Un=0;Un+~])'};const He='style-scope';class Fe{get SCOPE_NAME(){return He}dom(Mt,Ot,wt){Mt.__styleScoped?Mt.__styleScoped=null:this._transformDom(Mt,Ot||'',wt)}_transformDom(Mt,Ot,wt){Mt.nodeType===Node.ELEMENT_NODE&&this.element(Mt,Ot,wt);let Dt='template'===Mt.localName?(Mt.content||Mt._content).childNodes:Mt.children||Mt.childNodes;if(Dt)for(let Lt=0;Lt`:${kt}(${Ht.replace(/\s/g,'')})`),Mt=Mt.replace(Ke,`${Ge} $1`),Mt=Mt.replace(Be,(Lt,kt,Ht)=>{if(!Dt){let Ft=this._transformCompoundSelector(Ht,kt,Ot,wt);Dt=Dt||Ft.stop,kt=Ft.combinator,Ht=Ft.value}return kt+Ht}),Mt}_transformCompoundSelector(Mt,Ot,wt,Dt){let Lt=Mt.indexOf(Ve);0<=Mt.indexOf(Ge)?Mt=this._transformHostSelector(Mt,Dt):0!==Lt&&(Mt=wt?this._transformSimpleSelector(Mt,wt):Mt);let kt=!1;0<=Lt&&(Ot='',kt=!0);let Ht;return kt&&(Ht=!0,kt&&(Mt=Mt.replace(ze,(Ft,Ut)=>` > ${Ut}`))),Mt=Mt.replace($e,(Ft,Ut,Wt)=>`[dir="${Wt}"] ${Ut}, ${Ut}[dir="${Wt}"]`),{value:Mt,combinator:Ot,stop:Ht}}_transformSimpleSelector(Mt,Ot){let wt=Mt.split(Qe);return wt[0]+=Ot,wt.join(Qe)}_transformHostSelector(Mt,Ot){let wt=Mt.match(Ye),Dt=wt&&wt[2].trim()||'';if(Dt){if(!Dt[0].match(je)){let Lt=Dt.split(je)[0];return Lt===Ot?Dt:'should_not_match'}return Mt.replace(Ye,function(Lt,kt,Ht){return Ot+Ht})}return Mt.replace(Ge,Ot)}documentRule(Mt){Mt.selector=Mt.parsedSelector,this.normalizeRootSelector(Mt),this._transformRule(Mt,this._transformDocumentSelector)}normalizeRootSelector(Mt){Mt.selector===':root'&&(Mt.selector='html')}_transformDocumentSelector(Mt){return Mt.match(Ve)?this._transformComplexSelector(Mt,We):this._transformSimpleSelector(Mt.trim(),We)}}let Ue=/:(nth[-\w]+)\(([^)]+)\)/,We=`:not(.${He})`,qe=',',Be=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,je=/[[.:#*]/,Ge=':host',Ve='::slotted',Ke=/^(::slotted)/,Ye=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ze=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,$e=/(.*):dir\((?:(ltr|rtl))\)/,Qe=':';var tt=new Fe,ot={};const rt=Promise.resolve();class nt{static get(Mt){return Mt.__styleInfo}static set(Mt,Ot){return Mt.__styleInfo=Ot,Ot}static invalidate(Mt){ot[Mt]&&(ot[Mt]._applyShimInvalid=!0)}static startValidating(Mt){const Ot=ot[Mt];Ot._validating||(Ot._validating=!0,rt.then(()=>{Ot._applyShimInvalid=!1,Ot._validating=!1}))}constructor(Mt,Ot,wt,Dt,Lt,kt){this.styleRules=Mt||null,this.placeholder=Ot||null,this.ownStylePropertyNames=wt||[],this.overrideStyleProperties=null,this.elementName=Dt||'',this.cssBuild=kt||'',this.typeExtension=Lt||'',this.styleProperties=null,this.scopeSelector=null,this.customStyle=null}}const st=window.Element.prototype,lt=st.matches||st.matchesSelector||st.mozMatchesSelector||st.msMatchesSelector||st.oMatchesSelector||st.webkitMatchesSelector,dt=navigator.userAgent.match('Trident'),it='x-scope';class pt{get XSCOPE_NAME(){return it}decorateStyles(Mt){let Ot=this,wt={},Dt=[],Lt=0;ue(Mt,function(Ht){Ot.decorateRule(Ht),Ht.index=Lt++,Ot.collectPropertiesInCssText(Ht.propertyInfo.cssText,wt)},function(Ft){Dt.push(Ft)}),Mt._keyframes=Dt;let kt=[];for(let Ht in wt)kt.push(Ht);return kt}decorateRule(Mt){if(Mt.propertyInfo)return Mt.propertyInfo;let Ot={},wt={},Dt=this.collectProperties(Mt,wt);return Dt&&(Ot.properties=wt,Mt.rules=null),Ot.cssText=this.collectCssText(Mt),Mt.propertyInfo=Ot,Ot}collectProperties(Mt,Ot){let wt=Mt.propertyInfo;if(!wt){let Dt,Lt=ke.VAR_ASSIGN,kt=Mt.parsedCssText,Ht,Ft;for(;Dt=Lt.exec(kt);)Ht=(Dt[2]||Dt[3]).trim(),('inherit'!==Ht||'unset'!==Ht)&&(Ot[Dt[1].trim()]=Ht),Ft=!0;return Ft}else if(wt.properties)return Object.assign(Ot,wt.properties),!0}collectCssText(Mt){return this.collectConsumingCssText(Mt.parsedCssText)}collectConsumingCssText(Mt){return Mt.replace(ke.BRACKETED,'').replace(ke.VAR_ASSIGN,'')}collectPropertiesInCssText(Mt,Ot){for(let wt,Dt;wt=ke.VAR_CONSUMED.exec(Mt);)Dt=wt[1],':'!==wt[2]&&(Ot[Dt]=!0)}reify(Mt){let Ot=Object.getOwnPropertyNames(Mt);for(let Dt,wt=0;wt *'===kt||'html'===kt,Ft=0===kt.indexOf(':host')&&!Ht;if('shady'===wt&&(Ht=kt===Lt+' > *.'+Lt||-1!==kt.indexOf('html'),Ft=!Ht&&0===kt.indexOf(Lt)),'shadow'===wt&&(Ht=':host > *'===kt||'html'===kt,Ft=Ft&&!Ht),Ht||Ft){let Ut=Lt;Ft&&(Oe&&!Ot.transformedSelector&&(Ot.transformedSelector=tt._transformRuleCss(Ot,tt._transformComplexSelector,tt._calcElementScope(Mt.is),Lt)),Ut=Ot.transformedSelector||Lt),Dt({selector:Ut,isHost:Ft,isRoot:Ht})}}}hostAndRootPropertiesForScope(Mt,Ot){let wt={},Dt={},Lt=this,kt=Ot&&Ot.__cssBuild;return ue(Ot,function(Ht){Lt.whenHostOrRootRule(Mt,Ht,kt,function(Ft){let Ut=Mt._element||Mt;lt.call(Ut,Ft.selector)&&(Ft.isHost?Lt.collectProperties(Ht,wt):Lt.collectProperties(Ht,Dt))})},null,!0),{rootProps:Dt,hostProps:wt}}transformStyles(Mt,Ot,wt){let Dt=this,Lt=tt._calcHostScope(Mt.is,Mt.extends),kt=Mt.extends?'\\'+Lt.slice(0,-1)+'\\]':Lt,Ht=new RegExp(ke.HOST_PREFIX+kt+ke.HOST_SUFFIX),Ft=nt.get(Mt).styleRules,Ut=this._elementKeyframeTransforms(Mt,Ft,wt);return tt.elementStyles(Mt,Ft,function(Wt){Dt.applyProperties(Wt,Ot),Oe||_e(Wt)||!Wt.cssText||(Dt.applyKeyframeTransforms(Wt,Ut),Dt._scopeSelector(Wt,Ht,Lt,wt))})}_elementKeyframeTransforms(Mt,Ot,wt){let Dt=Ot._keyframes,Lt={};if(!Oe&&Dt)for(let kt=0,Ht=Dt[kt];kt=Ht._useCount&&Ht.parentNode&&Ht.parentNode.removeChild(Ht)),Oe?kt.customStyle?(kt.customStyle.textContent=Lt,Dt=kt.customStyle):Lt&&(Dt=me(Lt,wt,Mt.shadowRoot,kt.placeholder)):Dt?!Dt.parentNode&&ye(Dt,null,kt.placeholder):Lt&&(Dt=me(Lt,wt,null,kt.placeholder)),Dt&&(Dt._useCount=Dt._useCount||0,kt.customStyle!=Dt&&Dt._useCount++,kt.customStyle=Dt),dt&&(Dt.textContent=Dt.textContent),Dt}applyCustomStyle(Mt,Ot){let wt=he(Mt),Dt=this;Mt.textContent=pe(wt,function(Lt){let kt=Lt.cssText=Lt.parsedCssText;Lt.propertyInfo&&Lt.propertyInfo.cssText&&(kt=ae(kt),Lt.cssText=Dt.valueForProperties(kt,Ot))})}}var ct=new pt;let ht={};const _t=window.customElements;if(_t&&!Oe){const Mt=_t.define;_t.define=function(Ot,wt,Dt){return ht[Ot]=fe(Ot),Mt.call(_t,Ot,wt,Dt)}}let mt=ke.MIXIN_MATCH,yt=ke.VAR_ASSIGN,gt=/;\s*/m,ft=/^\s*(initial)|(inherit)\s*$/,Nt='_-_';class bt{constructor(){this._map={}}set(Mt,Ot){Mt=Mt.trim(),this._map[Mt]={properties:Ot,dependants:{}}}get(Mt){return Mt=Mt.trim(),this._map[Mt]}}class St{constructor(){this._currentTemplate=null,this._measureElement=null,this._map=new bt,this._separator=Nt,this._boundProduceCssProperties=(Mt,Ot,wt,Dt)=>this._produceCssProperties(Mt,Ot,wt,Dt)}detectMixin(Mt){const Ot=mt.test(Mt)||yt.test(Mt);return mt.lastIndex=0,yt.lastIndex=0,Ot}transformStyle(Mt,Ot){let wt=he(Mt);return this.transformRules(wt,Ot),wt}transformRules(Mt,Ot){this._currentTemplate=ot[Ot],ue(Mt,wt=>{this.transformRule(wt)}),this._currentTemplate=null}transformRule(Mt){Mt.cssText=this.transformCssText(Mt.parsedCssText),':root'===Mt.selector&&(Mt.selector=':host > *')}transformCssText(Mt){return Mt=Mt.replace(yt,this._boundProduceCssProperties),this._consumeCssProperties(Mt)}_getInitialValueForProperty(Mt){return this._measureElement||(this._measureElement=document.createElement('meta'),this._measureElement.style.all='initial',document.head.appendChild(this._measureElement)),window.getComputedStyle(this._measureElement).getPropertyValue(Mt)}_consumeCssProperties(Mt){for(let Ot;Ot=mt.exec(Mt);){let wt=Ot[0],Dt=Ot[1],Lt=Ot.index,kt=Lt+wt.indexOf('@apply'),Ht=Lt+wt.length,Ft=Mt.slice(0,kt),Ut=Mt.slice(Ht),Wt=this._cssTextToMap(Ft),qt=this._atApplyToCssProperties(Dt,Wt);Mt=[Ft,qt,Ut].join(''),mt.lastIndex=Lt+qt.length}return Mt}_atApplyToCssProperties(Mt,Ot){Mt=Mt.replace(gt,'');let wt=[],Dt=this._map.get(Mt);if(Dt||(this._map.set(Mt,{}),Dt=this._map.get(Mt)),Dt){this._currentTemplate&&(Dt.dependants[this._currentTemplate.name]=this._currentTemplate);let Lt,kt,Ht;for(Lt in Dt.properties)Ht=Ot&&Ot[Lt],kt=[Lt,': var(',Mt,Nt,Lt],Ht&&kt.push(',',Ht),kt.push(')'),wt.push(kt.join(''))}return wt.join('; ')}_replaceInitialOrInherit(Mt,Ot){let wt=ft.exec(Ot);return wt&&(wt[1]?Ot=St._getInitialValueForProperty(Mt):Ot='apply-shim-inherit'),Ot}_cssTextToMap(Mt){let Ot=Mt.split(';'),wt,Dt,Lt={};for(let Ht,Ft,kt=0;kt{Vt&&this._map.get(Vt)&&(Dt='@apply '+Vt+';')}),!Dt)return Mt;let Lt=this._consumeCssProperties(Dt),kt=Mt.slice(0,Mt.indexOf('--')),Ht=this._cssTextToMap(Lt),Ft=Ht,Ut=this._map.get(Ot),Wt=Ut&&Ut.properties;Wt?Ft=Object.assign(Object.create(Wt),Ht):this._map.set(Ot,Ft);let Bt,jt,qt=[],Gt=!1;for(Bt in Ft)jt=Ht[Bt],void 0==jt&&(jt='initial'),Wt&&!(Bt in Wt)&&(Gt=!0),qt.push(Ot+Nt+Bt+': '+jt);return Gt&&this._invalidateMixinEntry(Ut),Ut&&(Ut.properties=Ft),wt&&(kt=Mt+';'+kt),kt+qt.join('; ')+';'}}let Et=new St;window.ApplyShim=Et;let Ct=function(){};if(!Oe){let Mt=kt=>{return kt.classList&&!kt.classList.contains(tt.SCOPE_NAME)||kt instanceof SVGElement&&(!kt.hasAttribute('class')||0>kt.getAttribute('class').indexOf(tt.SCOPE_NAME))},Ot=kt=>{for(let Ft,Ht=0;Ht{wt.observe(kt,{childList:!0,subtree:!0})},Lt=window.customElements&&!window.customElements.flush;if(Lt)Dt(document);else{let kt=()=>{Dt(document.body)};window.HTMLImports?window.HTMLImports.whenReady(kt):requestAnimationFrame(function(){if('loading'===document.readyState){let Ht=function(){kt(),document.removeEventListener('readystatechange',Ht)};document.addEventListener('readystatechange',Ht)}else kt()})}Ct=function(){Ot(wt.takeRecords())}}let vt=new class{constructor(Mt=100){this.cache={},this.typeMax=Mt}_validate(Mt,Ot,wt){for(let Lt,Dt=0;Dtthis.typeMax&&Lt.shift(),this.cache[Mt]=Lt}fetch(Mt,Ot,wt){let Dt=this.cache[Mt];if(Dt)for(let kt,Lt=Dt.length-1;0<=Lt;Lt--)if(kt=Dt[Lt],this._validate(kt,Ot,wt))return kt}};class Tt{constructor(){this._scopeCounter={},this._documentOwner=document.documentElement,this._documentOwnerStyleInfo=nt.set(document.documentElement,new nt({rules:[]})),this._elementsHaveApplied=!1}get nativeShadow(){return Oe}get nativeCss(){return we}get nativeCssApply(){return!1}flush(){Ct()}_generateScopeSelector(Mt){let Ot=this._scopeCounter[Mt]=(this._scopeCounter[Mt]||0)+1;return`${Mt}-${Ot}`}getStyleAst(Mt){return he(Mt)}styleAstToString(Mt){return pe(Mt)}_gatherStyles(Mt){let Ot=Mt.content.querySelectorAll('style'),wt=[];for(let Lt,Dt=0;Dt{Oe?tt.normalizeRootSelector(wt):tt.documentRule(wt),this.nativeCss&&!this.nativeCssApply&&Et.transformRule(wt)}),this.nativeCss?Mt.textContent=pe(Ot):this._documentOwnerStyleInfo.styleRules.rules.push(Ot)}_revalidateApplyShim(Mt){if(this.nativeCss&&!this.nativeCssApply){let Ot=he(Mt);Et.transformRules(Ot),Mt.textContent=pe(Ot)}}_applyCustomStyleToDocument(Mt){this.nativeCss||ct.applyCustomStyle(Mt,this._documentOwnerStyleInfo.styleProperties)}getComputedStyleValue(Mt,Ot){let wt;if(!this.nativeCss){let Dt=nt.get(Mt)||nt.get(this._styleOwnerForNode(Mt));wt=Dt.styleProperties[Ot]}return wt=wt||window.getComputedStyle(Mt).getPropertyValue(Ot),wt.trim()}setElementClass(Mt,Ot){let wt=Mt.getRootNode(),Dt=Ot?Ot.split(/\s/):[],Lt=wt.host&&wt.host.localName;if(!Lt){var kt=Mt.getAttribute('class');if(kt){let Ht=kt.split(/\s/);for(let Ft=0;Ft {\n\n /********************* base setup *********************/\n const useNative = Boolean('import' in document.createElement('link'));\n\n // Polyfill `currentScript` for browsers without it.\n let currentScript = null;\n if ('currentScript' in document === false) {\n Object.defineProperty(document, 'currentScript', {\n get() {\n return currentScript ||\n // NOTE: only works when called in synchronously executing code.\n // readyState should check if `loading` but IE10 is\n // interactive when scripts run so we cheat. This is not needed by\n // html-imports polyfill but helps generally polyfill `currentScript`.\n (document.readyState !== 'complete' ?\n document.scripts[document.scripts.length - 1] : null);\n },\n configurable: true\n });\n }\n\n /********************* path fixup *********************/\n const ABS_URL_TEST = /(^\\/)|(^#)|(^[\\w-\\d]*:)/;\n const CSS_URL_REGEXP = /(url\\()([^)]*)(\\))/g;\n const CSS_IMPORT_REGEXP = /(@import[\\s]+(?!url\\())([^;]*)(;)/g;\n const STYLESHEET_REGEXP = /(]*)(rel=['|\"]?stylesheet['|\"]?[^>]*>)/g;\n\n // path fixup: style elements in imports must be made relative to the main\n // document. We fixup url's in url() and @import.\n const Path = {\n\n fixUrls(element, base) {\n if (element.href) {\n element.setAttribute('href',\n Path.replaceAttrUrl(element.getAttribute('href'), base));\n }\n if (element.src) {\n element.setAttribute('src',\n Path.replaceAttrUrl(element.getAttribute('src'), base));\n }\n if (element.localName === 'style') {\n Path.resolveUrlsInStyle(element, base);\n }\n },\n\n fixUrlAttributes(element, base) {\n const attrs = ['action', 'src', 'href', 'url', 'style'];\n for (let i = 0, a; i < attrs.length && (a = attrs[i]); i++) {\n const at = element.attributes[a];\n const v = at && at.value;\n // Skip bound attribute values (assume binding is done via {} and []).\n // TODO(valdrin) consider exposing a library-implementable hook.\n if (v && (v.search(/({{|\\[\\[)/) < 0)) {\n at.value = (a === 'style') ?\n Path.resolveUrlsInCssText(v, base) :\n Path.replaceAttrUrl(v, base);\n }\n }\n },\n\n fixUrlsInTemplates(element, base) {\n const t$ = element.querySelectorAll('template');\n for (let i = 0; i < t$.length; i++) {\n Path.fixUrlsInTemplate(t$[i], base);\n }\n },\n\n fixUrlsInTemplate(template, base) {\n // If template is not supported, still resolve urls within it.\n const content = template.content || template;\n const n$ = content.querySelectorAll(\n 'style, form[action], [src], [href], [url], [style]');\n for (let i = 0; i < n$.length; i++) {\n const n = n$[i];\n if (n.localName == 'style') {\n Path.resolveUrlsInStyle(n, base);\n } else {\n Path.fixUrlAttributes(n, base);\n }\n }\n Path.fixUrlsInTemplates(content, base);\n },\n\n resolveUrlsInStyle(style, linkUrl) {\n style.textContent = Path.resolveUrlsInCssText(style.textContent, linkUrl);\n },\n\n resolveUrlsInCssText(cssText, linkUrl) {\n let r = Path.replaceUrls(cssText, linkUrl, CSS_URL_REGEXP);\n r = Path.replaceUrls(r, linkUrl, CSS_IMPORT_REGEXP);\n return r;\n },\n\n replaceUrls(text, linkUrl, regexp) {\n return text.replace(regexp, (m, pre, url, post) => {\n let urlPath = url.replace(/[\"']/g, '');\n if (linkUrl) {\n urlPath = Path.resolveUrl(urlPath, linkUrl);\n }\n return pre + '\\'' + urlPath + '\\'' + post;\n });\n },\n\n replaceAttrUrl(text, linkUrl) {\n if (text && ABS_URL_TEST.test(text)) {\n return text;\n } else {\n return Path.resolveUrl(text, linkUrl);\n }\n },\n\n resolveUrl(url, base) {\n // Lazy feature detection.\n if (Path.__workingURL === undefined) {\n Path.__workingURL = false;\n try {\n const u = new URL('b', 'http://a');\n u.pathname = 'c%20d';\n Path.__workingURL = (u.href === 'http://a/c%20d');\n } catch (e) {}\n }\n\n if (Path.__workingURL) {\n return (new URL(url, base)).href;\n }\n\n // Fallback to creating an anchor into a disconnected document.\n let doc = Path.__tempDoc;\n if (!doc) {\n doc = document.implementation.createHTMLDocument('temp');\n Path.__tempDoc = doc;\n doc.__base = doc.createElement('base');\n doc.head.appendChild(doc.__base);\n doc.__anchor = doc.createElement('a');\n }\n doc.__base.href = base;\n doc.__anchor.href = url;\n return doc.__anchor.href || url;\n }\n };\n\n /********************* Xhr processor *********************/\n const Xhr = {\n\n async: true,\n\n /**\n * @param {!string} url\n * @return {!Promise}\n */\n load(url) {\n return new Promise((resolve, reject) => {\n if (!url) {\n reject({\n resource: 'error: href must be specified'\n });\n } else if (url.match(/^data:/)) {\n // Handle Data URI Scheme\n const pieces = url.split(',');\n const header = pieces[0];\n let resource = pieces[1];\n if (header.indexOf(';base64') > -1) {\n resource = atob(resource);\n } else {\n resource = decodeURIComponent(resource);\n }\n resolve({\n resource: resource\n });\n } else {\n const request = new XMLHttpRequest();\n request.open('GET', url, Xhr.async);\n request.addEventListener('readystatechange', () => {\n if (request.readyState === 4) {\n // Servers redirecting an import can add a Location header to help us\n // polyfill correctly.\n let redirectedUrl = undefined;\n try {\n const locationHeader = request.getResponseHeader('Location');\n if (locationHeader) {\n // Relative or full path.\n redirectedUrl = (locationHeader.substr(0, 1) === '/') ?\n location.origin + locationHeader : locationHeader;\n }\n } catch (e) {\n console.error(e.message);\n }\n const resp = {\n resource: (request.response || request.responseText),\n redirectedUrl: redirectedUrl\n };\n if (request.status === 304 || request.status === 0 ||\n request.status >= 200 && request.status < 300) {\n resolve(resp);\n } else {\n reject(resp);\n }\n }\n });\n request.send();\n }\n });\n }\n };\n\n /********************* importer *********************/\n\n const isIE = /Trident/.test(navigator.userAgent) ||\n /Edge\\/\\d./i.test(navigator.userAgent);\n const supportsUnhandledrejection = ('onunhandledrejection' in window);\n\n const importSelector = 'link[rel=import]';\n\n // Used to disable loading of resources.\n const importDisableType = 'import-disable';\n\n const disabledLinkSelector = `link[rel=stylesheet][href][type=${importDisableType}]`;\n\n const importDependenciesSelector = `${importSelector}, ${disabledLinkSelector},\n style:not([type]), link[rel=stylesheet][href]:not([type]),\n script:not([type]), script[type=\"application/javascript\"],\n script[type=\"text/javascript\"]`;\n\n const importDependencyAttr = 'import-dependency';\n\n const rootImportSelector = `${importSelector}:not(${importDependencyAttr})`;\n\n const pendingScriptsSelector = `script[${importDependencyAttr}]`;\n\n const pendingStylesSelector = `style[${importDependencyAttr}],\n link[rel=stylesheet][${importDependencyAttr}]`;\n\n /**\n * Importer will:\n * - load any linked import documents (with deduping)\n * - whenever an import is loaded, prompt the parser to try to parse\n * - observe imported documents for new elements (these are handled via the\n * dynamic importer)\n */\n class Importer {\n constructor() {\n this.documents = {};\n // Used to keep track of pending loads, so that flattening and firing of\n // events can be done when all resources are ready.\n this.inflight = 0;\n // 1. Load imports contents\n // 2. Assign them to first import links on the document\n // 3. Wait for import styles & scripts to be done loading/running\n // 4. Fire load/error events\n whenDocumentReady(() => {\n // Observe changes on .\n new MutationObserver(m => this.handleMutations(m)).observe(document.head, {\n childList: true,\n subtree: true\n });\n this.load();\n });\n }\n\n /**\n * Loads the resources needed by the import link and fires the load/error\n * event on the node once finished. If link is not defined or null, loads\n * all imports in the main document.\n * @param {HTMLLinkElement=} link\n * @return {Promise|undefined}\n */\n load(link) {\n let whenLoadedPromise = link ? this.whenImportLoaded(link) :\n this.whenImportsLoaded(document);\n if (whenLoadedPromise) {\n this.inflight++;\n whenLoadedPromise = whenLoadedPromise.then(() => {\n // Wait until all resources are ready, then load import resources.\n if (--this.inflight === 0) {\n return this.onLoadedAll();\n }\n });\n // If browser doesn't support the unhandled rejection event,\n // log the error stack and fire the error outside the promise so it's\n // visible to listeners of window.onerror\n if (!supportsUnhandledrejection) {\n whenLoadedPromise = whenLoadedPromise.catch(err => {\n console.error(err.stack);\n setTimeout(() => {\n throw err;\n });\n throw 'unhandledrejection';\n });\n }\n }\n return whenLoadedPromise;\n }\n\n /**\n * @param {!(HTMLDocument|DocumentFragment)} doc\n * @return {Promise|null}\n */\n whenImportsLoaded(doc) {\n const links = /** @type {!NodeList} */\n (doc.querySelectorAll(importSelector));\n const promises = [];\n for (let i = 0, l = links.length; i < l; i++) {\n const promise = this.whenImportLoaded(links[i]);\n if (promise) {\n promises.push(promise);\n }\n }\n return promises.length ? Promise.all(promises).then(() => doc) : null;\n }\n\n /**\n * @param {!HTMLLinkElement} link\n * @return {Promise|null}\n */\n whenImportLoaded(link) {\n const url = link.href;\n // This resource is already being handled by another import.\n if (this.documents[url] !== undefined) {\n return null;\n }\n // Mark it as pending to notify others this url is being loaded.\n this.documents[url] = 'pending';\n return Xhr.load(url)\n .then(resp => {\n const doc = this.makeDocument(resp.resource, resp.redirectedUrl || url);\n this.documents[url] = doc;\n // Load subtree.\n return this.whenImportsLoaded(doc);\n }, () => this.documents[url] = null) // If load fails, handle error.\n .then(() => link);\n }\n\n /**\n * Creates a new document containing resource and normalizes urls accordingly.\n * @param {string=} resource\n * @param {string=} url\n * @return {!DocumentFragment}\n */\n makeDocument(resource, url) {\n if (!resource) {\n return document.createDocumentFragment();\n }\n\n if (isIE) {\n // should be appended to . Not doing so\n // in IE/Edge breaks the cascading order. We disable the loading by\n // setting the type before setting innerHTML to avoid loading\n // resources twice.\n resource = resource.replace(STYLESHEET_REGEXP, (match, p1, p2) => {\n if (match.indexOf('type=') === -1) {\n return `${p1} type=${importDisableType} ${p2}`;\n }\n return match;\n });\n }\n\n let content;\n const template = /** @type {!HTMLTemplateElement} */\n (document.createElement('template'));\n template.innerHTML = resource;\n if (template.content) {\n // This creates issues in Safari10 when used with shadydom (see #12).\n content = template.content;\n } else {\n //