@webcomponents/shadydom
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -28,1 +28,7 @@ /** | ||
Node.prototype.__shady; | ||
/** @interface */ | ||
function IWrapper() {} | ||
/** @type {Object} */ | ||
IWrapper.prototype._activeElement; |
{ | ||
"name": "@webcomponents/shadydom", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "Shadow DOM polyfill", | ||
@@ -31,3 +31,3 @@ "main": "shadydom.min.js", | ||
"test": "npm run lint && npm run build && wct", | ||
"debug": "rollup -c", | ||
"debug": "gulp debug", | ||
"lint": "eslint src", | ||
@@ -47,3 +47,3 @@ "regen-package-lock": "rm -rf node_modules package-lock.json; npm install", | ||
"@webcomponents/custom-elements": "^1.1.3", | ||
"@webcomponents/shadycss": "^1.5.0", | ||
"@webcomponents/shadycss": "^1.7.1", | ||
"@webcomponents/template": "^1.3.1", | ||
@@ -55,2 +55,4 @@ "@webcomponents/webcomponents-platform": "^1.0.0", | ||
"gulp": "^4.0.0", | ||
"gulp-rename": "^1.4.0", | ||
"gulp-rollup": "^2.16.2", | ||
"gulp-size": "^3.0.0", | ||
@@ -57,0 +59,0 @@ "gulp-sourcemaps": "^2.6.4", |
@@ -10,83 +10,85 @@ (function(){/* | ||
*/ | ||
'use strict';var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},m="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function ba(){ba=function(){};m.Symbol||(m.Symbol=ca)}var ca=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}(); | ||
function p(){ba();var a=m.Symbol.iterator;a||(a=m.Symbol.iterator=m.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return da(this)}});p=function(){}}function da(a){var b=0;return ea(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}function ea(a){p();a={next:a};a[m.Symbol.iterator]=function(){return this};return a}function q(a){p();ba();p();var b=a[Symbol.iterator];return b?b.call(a):da(a)} | ||
function fa(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}function t(a,b){return{index:a,m:[],v:b}} | ||
function ha(a,b,c,d){var e=0,f=0,h=0,g=0,k=Math.min(b-e,d-f);if(0==e&&0==f)a:{for(h=0;h<k;h++)if(a[h]!==c[h])break a;h=k}if(b==a.length&&d==c.length){g=a.length;for(var l=c.length,n=0;n<k-h&&ia(a[--g],c[--l]);)n++;g=n}e+=h;f+=h;b-=g;d-=g;if(0==b-e&&0==d-f)return[];if(e==b){for(b=t(e,0);f<d;)b.m.push(c[f++]);return[b]}if(f==d)return[t(e,b-e)];k=e;h=f;d=d-h+1;g=b-k+1;b=Array(d);for(l=0;l<d;l++)b[l]=Array(g),b[l][0]=l;for(l=0;l<g;l++)b[0][l]=l;for(l=1;l<d;l++)for(n=1;n<g;n++)if(a[k+n-1]===c[h+l-1])b[l][n]= | ||
b[l-1][n-1];else{var r=b[l-1][n]+1,S=b[l][n-1]+1;b[l][n]=r<S?r:S}k=b.length-1;h=b[0].length-1;d=b[k][h];for(a=[];0<k||0<h;)0==k?(a.push(2),h--):0==h?(a.push(3),k--):(g=b[k-1][h-1],l=b[k-1][h],n=b[k][h-1],r=l<n?l<g?l:g:n<g?n:g,r==g?(g==d?a.push(0):(a.push(1),d=g),k--,h--):r==l?(a.push(3),k--,d=l):(a.push(2),h--,d=n));a.reverse();b=void 0;k=[];for(h=0;h<a.length;h++)switch(a[h]){case 0:b&&(k.push(b),b=void 0);e++;f++;break;case 1:b||(b=t(e,0));b.v++;e++;b.m.push(c[f]);f++;break;case 2:b||(b=t(e,0)); | ||
b.v++;e++;break;case 3:b||(b=t(e,0)),b.m.push(c[f]),f++}b&&k.push(b);return k}function ia(a,b){return a===b};function ja(){this.M=this.root=null;this.A=!1;this.h=this.u=this.F=this.assignedSlot=this.assignedNodes=this.i=null;this.childNodes=this.nextSibling=this.previousSibling=this.lastChild=this.firstChild=this.parentNode=this.l=void 0;this.P=this.I=!1;this.s={}}ja.prototype.toJSON=function(){return{}};function u(a){a.__shady||(a.__shady=new ja);return a.__shady}function v(a){return a&&a.__shady};var w=window.ShadyDOM||{};w.Z=!(!Element.prototype.attachShadow||!Node.prototype.getRootNode);var ka=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild");w.g=!!(ka&&ka.configurable&&ka.get);w.G=w.force||!w.Z;var la=navigator.userAgent.match("Trident"),ma=navigator.userAgent.match("Edge");void 0===w.N&&(w.N=w.g&&(la||ma));function x(a){return(a=v(a))&&void 0!==a.firstChild}function y(a){return"ShadyRoot"===a.V}function z(a){a=a.getRootNode();if(y(a))return a} | ||
var A=Element.prototype,na=A.matches||A.matchesSelector||A.mozMatchesSelector||A.msMatchesSelector||A.oMatchesSelector||A.webkitMatchesSelector;function oa(a,b){if(a&&b)for(var c=Object.getOwnPropertyNames(b),d=0,e;d<c.length&&(e=c[d]);d++){var f=e,h=a,g=Object.getOwnPropertyDescriptor(b,f);g&&Object.defineProperty(h,f,g)}}function B(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];for(d=0;d<c.length;d++)oa(a,c[d]);return a}function pa(a,b){for(var c in b)a[c]=b[c]} | ||
var qa=document.createTextNode(""),ra=0,sa=[];(new MutationObserver(function(){for(;sa.length;)try{sa.shift()()}catch(a){throw qa.textContent=ra++,a;}})).observe(qa,{characterData:!0});function ta(a){sa.push(a);qa.textContent=ra++}var ua=!!document.contains;function va(a,b){for(;b;){if(b==a)return!0;b=b.parentNode}return!1} | ||
function wa(a){for(var b=a.length-1;0<=b;b--){var c=a[b],d=c.getAttribute("id")||c.getAttribute("name");d&&"length"!==d&&isNaN(d)&&(a[d]=c)}a.item=function(b){return a[b]};a.namedItem=function(b){if("length"!==b&&isNaN(b)&&a[b])return a[b];for(var c=q(a),d=c.next();!d.done;d=c.next())if(d=d.value,(d.getAttribute("id")||d.getAttribute("name"))==b)return d;return null};return a};var C=[],xa;function ya(a){xa||(xa=!0,ta(D));C.push(a)}function D(){xa=!1;for(var a=!!C.length;C.length;)C.shift()();return a}D.list=C;var za=/[&\u00A0"]/g,Aa=/[&\u00A0<>]/g;function Ba(a){switch(a){case "&":return"&";case "<":return"<";case ">":return">";case '"':return""";case "\u00a0":return" "}}function Ca(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}var Da=Ca("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),Ea=Ca("style script xmp iframe noembed noframes plaintext noscript".split(" ")); | ||
function Fa(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):a.childNodes,e=0,f=d.length,h;e<f&&(h=d[e]);e++){a:{var g=h;var k=a;var l=b;switch(g.nodeType){case Node.ELEMENT_NODE:for(var n=g.localName,r="<"+n,S=g.attributes,Xa=0;k=S[Xa];Xa++)r+=" "+k.name+'="'+k.value.replace(za,Ba)+'"';r+=">";g=Da[n]?r:r+Fa(g,l)+"</"+n+">";break a;case Node.TEXT_NODE:g=g.data;g=k&&Ea[k.localName]?g:g.replace(Aa,Ba);break a;case Node.COMMENT_NODE:g="\x3c!--"+g.data+"--\x3e";break a;default:throw window.console.error(g), | ||
Error("not implemented");}}c+=g}return c};var E=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),F=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1);function Ga(a){var b=[];E.currentNode=a;for(a=E.firstChild();a;)b.push(a),a=E.nextSibling();return b} | ||
var G={parentNode:function(a){E.currentNode=a;return E.parentNode()},firstChild:function(a){E.currentNode=a;return E.firstChild()},lastChild:function(a){E.currentNode=a;return E.lastChild()},previousSibling:function(a){E.currentNode=a;return E.previousSibling()},nextSibling:function(a){E.currentNode=a;return E.nextSibling()}};G.childNodes=Ga;G.parentElement=function(a){F.currentNode=a;return F.parentNode()};G.firstElementChild=function(a){F.currentNode=a;return F.firstChild()}; | ||
G.lastElementChild=function(a){F.currentNode=a;return F.lastChild()};G.previousElementSibling=function(a){F.currentNode=a;return F.previousSibling()};G.nextElementSibling=function(a){F.currentNode=a;return F.nextSibling()};G.children=function(a){var b=[];F.currentNode=a;for(a=F.firstChild();a;)b.push(a),a=F.nextSibling();return wa(b)};G.innerHTML=function(a){return Fa(a,function(a){return Ga(a)})}; | ||
G.textContent=function(a){switch(a.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:a=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null,!1);for(var b="",c;c=a.nextNode();)b+=c.nodeValue;return b;default:return a.nodeValue}};var Ha=w.g,Ia=[Node.prototype,Element.prototype,HTMLElement.prototype];function H(a){var b;a:{for(b=0;b<Ia.length;b++){var c=Ia[b];if(c.hasOwnProperty(a)){b=c;break a}}b=void 0}if(!b)throw Error("Could not find descriptor for "+a);return Object.getOwnPropertyDescriptor(b,a)} | ||
var I=Ha?{parentNode:H("parentNode"),firstChild:H("firstChild"),lastChild:H("lastChild"),previousSibling:H("previousSibling"),nextSibling:H("nextSibling"),childNodes:H("childNodes"),parentElement:H("parentElement"),previousElementSibling:H("previousElementSibling"),nextElementSibling:H("nextElementSibling"),innerHTML:H("innerHTML"),textContent:H("textContent"),firstElementChild:H("firstElementChild"),lastElementChild:H("lastElementChild"),children:H("children")}:{},J=Ha?{firstElementChild:Object.getOwnPropertyDescriptor(DocumentFragment.prototype, | ||
"firstElementChild"),lastElementChild:Object.getOwnPropertyDescriptor(DocumentFragment.prototype,"lastElementChild"),children:Object.getOwnPropertyDescriptor(DocumentFragment.prototype,"children")}:{},K=Ha?{firstElementChild:Object.getOwnPropertyDescriptor(Document.prototype,"firstElementChild"),lastElementChild:Object.getOwnPropertyDescriptor(Document.prototype,"lastElementChild"),children:Object.getOwnPropertyDescriptor(Document.prototype,"children")}:{},Ja={L:I,ia:J,da:K,parentNode:function(a){return I.parentNode.get.call(a)}, | ||
firstChild:function(a){return I.firstChild.get.call(a)},lastChild:function(a){return I.lastChild.get.call(a)},previousSibling:function(a){return I.previousSibling.get.call(a)},nextSibling:function(a){return I.nextSibling.get.call(a)},childNodes:function(a){return Array.prototype.slice.call(I.childNodes.get.call(a))},parentElement:function(a){return I.parentElement.get.call(a)},previousElementSibling:function(a){return I.previousElementSibling.get.call(a)},nextElementSibling:function(a){return I.nextElementSibling.get.call(a)}, | ||
innerHTML:function(a){return I.innerHTML.get.call(a)},textContent:function(a){return I.textContent.get.call(a)},children:function(a){switch(a.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:return J.children.get.call(a);case Node.DOCUMENT_NODE:return K.children.get.call(a);default:return I.children.get.call(a)}},firstElementChild:function(a){switch(a.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:return J.firstElementChild.get.call(a);case Node.DOCUMENT_NODE:return K.firstElementChild.get.call(a);default:return I.firstElementChild.get.call(a)}}, | ||
lastElementChild:function(a){switch(a.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:return J.lastElementChild.get.call(a);case Node.DOCUMENT_NODE:return K.lastElementChild.get.call(a);default:return I.lastElementChild.get.call(a)}}};var L=w.N?Ja:G;var Ka=Element.prototype.insertBefore,La=Element.prototype.replaceChild,Ma=Element.prototype.removeChild,Na=Element.prototype.setAttribute,Oa=Element.prototype.removeAttribute,Pa=Element.prototype.cloneNode,Qa=Document.prototype.importNode,Ra=Element.prototype.addEventListener,Sa=Element.prototype.removeEventListener,Ta=Window.prototype.addEventListener,Ua=Window.prototype.removeEventListener,Va=Element.prototype.dispatchEvent,Wa=Node.prototype.contains||HTMLElement.prototype.contains,Ya=Document.prototype.getElementById, | ||
Za=Element.prototype.querySelector,$a=DocumentFragment.prototype.querySelector,ab=Document.prototype.querySelector,bb=Element.prototype.querySelectorAll,cb=DocumentFragment.prototype.querySelectorAll,db=Document.prototype.querySelectorAll,M={};M.appendChild=Element.prototype.appendChild;M.insertBefore=Ka;M.replaceChild=La;M.removeChild=Ma;M.setAttribute=Na;M.removeAttribute=Oa;M.cloneNode=Pa;M.importNode=Qa;M.addEventListener=Ra;M.removeEventListener=Sa;M.$=Ta;M.aa=Ua;M.dispatchEvent=Va; | ||
M.contains=Wa;M.getElementById=Ya;M.ga=Za;M.ja=$a;M.ea=ab;M.querySelector=function(a){switch(this.nodeType){case Node.ELEMENT_NODE:return Za.call(this,a);case Node.DOCUMENT_NODE:return ab.call(this,a);default:return $a.call(this,a)}};M.ha=bb;M.ka=cb;M.fa=db;M.querySelectorAll=function(a){switch(this.nodeType){case Node.ELEMENT_NODE:return bb.call(this,a);case Node.DOCUMENT_NODE:return db.call(this,a);default:return cb.call(this,a)}};function eb(a){for(;a.firstChild;)a.removeChild(a.firstChild)} | ||
var fb=w.g,gb=document.implementation.createHTMLDocument("inert"),hb=Object.getOwnPropertyDescriptor(Node.prototype,"isConnected"),ib=hb&&hb.get,jb=Object.getOwnPropertyDescriptor(Document.prototype,"activeElement"),kb={parentElement:{get:function(){var a=v(this);(a=a&&a.parentNode)&&a.nodeType!==Node.ELEMENT_NODE&&(a=null);return void 0!==a?a:L.parentElement(this)},configurable:!0},parentNode:{get:function(){var a=v(this);a=a&&a.parentNode;return void 0!==a?a:L.parentNode(this)},configurable:!0}, | ||
nextSibling:{get:function(){var a=v(this);a=a&&a.nextSibling;return void 0!==a?a:L.nextSibling(this)},configurable:!0},previousSibling:{get:function(){var a=v(this);a=a&&a.previousSibling;return void 0!==a?a:L.previousSibling(this)},configurable:!0},nextElementSibling:{get:function(){var a=v(this);if(a&&void 0!==a.nextSibling){for(a=this.nextSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibling;return a}return L.nextElementSibling(this)},configurable:!0},previousElementSibling:{get:function(){var a= | ||
v(this);if(a&&void 0!==a.previousSibling){for(a=this.previousSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.previousSibling;return a}return L.previousElementSibling(this)},configurable:!0}},lb={className:{get:function(){return this.getAttribute("class")||""},set:function(a){this.setAttribute("class",a)},configurable:!0}},mb={childNodes:{get:function(){if(x(this)){var a=v(this);if(!a.childNodes){a.childNodes=[];for(var b=this.firstChild;b;b=b.nextSibling)a.childNodes.push(b)}var c=a.childNodes}else c= | ||
L.childNodes(this);c.item=function(a){return c[a]};return c},configurable:!0},childElementCount:{get:function(){return this.children.length},configurable:!0},firstChild:{get:function(){var a=v(this);a=a&&a.firstChild;return void 0!==a?a:L.firstChild(this)},configurable:!0},lastChild:{get:function(){var a=v(this);a=a&&a.lastChild;return void 0!==a?a:L.lastChild(this)},configurable:!0},textContent:{get:function(){if(x(this)){for(var a=[],b=0,c=this.childNodes,d;d=c[b];b++)d.nodeType!==Node.COMMENT_NODE&& | ||
a.push(d.textContent);return a.join("")}return L.textContent(this)},set:function(a){if("undefined"===typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:if(!x(this)&&fb){var b=this.firstChild;(b!=this.lastChild||b&&b.nodeType!=Node.TEXT_NODE)&&eb(this);Ja.L.textContent.set.call(this,a)}else eb(this),(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.appendChild(document.createTextNode(a));break;default:this.nodeValue=a}},configurable:!0},firstElementChild:{get:function(){var a= | ||
v(this);if(a&&void 0!==a.firstChild){for(a=this.firstChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibling;return a}return L.firstElementChild(this)},configurable:!0},lastElementChild:{get:function(){var a=v(this);if(a&&void 0!==a.lastChild){for(a=this.lastChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.previousSibling;return a}return L.lastElementChild(this)},configurable:!0},children:{get:function(){return x(this)?wa(Array.prototype.filter.call(this.childNodes,function(a){return a.nodeType===Node.ELEMENT_NODE})): | ||
L.children(this)},configurable:!0},innerHTML:{get:function(){return x(this)?Fa("template"===this.localName?this.content:this):L.innerHTML(this)},set:function(a){var b="template"===this.localName?this.content:this;eb(b);var c=this.localName||"div";c=this.namespaceURI&&this.namespaceURI!==gb.namespaceURI?gb.createElementNS(this.namespaceURI,c):gb.createElement(c);fb?Ja.L.innerHTML.set.call(c,a):c.innerHTML=a;for(a="template"===this.localName?c.content:c;a.firstChild;)b.appendChild(a.firstChild)},configurable:!0}}, | ||
nb={shadowRoot:{get:function(){var a=v(this);return a&&a.M||null},configurable:!0}},ob={activeElement:{get:function(){var a=jb&&jb.get?jb.get.call(document):w.g?void 0:document.activeElement;if(a&&a.nodeType){var b=!!y(this);if(this===document||b&&this.host!==a&&M.contains.call(this.host,a)){for(b=z(a);b&&b!==this;)a=b.host,b=z(a);a=this===document?b?null:a:b===this?a:null}else a=null}else a=null;return a},set:function(){},configurable:!0}}; | ||
function N(a,b,c){for(var d in b){var e=Object.getOwnPropertyDescriptor(a,d);e&&e.configurable||!e&&c?Object.defineProperty(a,d,b[d]):c&&console.warn("Could not define",d,"on",a)}}function O(a){N(a,kb);N(a,lb);N(a,mb);N(a,ob)} | ||
function pb(){var a=P.prototype;a.__proto__=DocumentFragment.prototype;N(a,kb,!0);N(a,mb,!0);N(a,ob,!0);Object.defineProperties(a,{nodeType:{value:Node.DOCUMENT_FRAGMENT_NODE,configurable:!0},nodeName:{value:"#document-fragment",configurable:!0},nodeValue:{value:null,configurable:!0}});["localName","namespaceURI","prefix"].forEach(function(b){Object.defineProperty(a,b,{value:void 0,configurable:!0})});["ownerDocument","baseURI","isConnected"].forEach(function(b){Object.defineProperty(a,b,{get:function(){return this.host[b]}, | ||
configurable:!0})})}var qb=w.g?function(){}:function(a){var b=u(a);b.I||(b.I=!0,N(a,kb,!0),N(a,lb,!0))},rb=w.g?function(){}:function(a){u(a).P||(N(a,mb,!0),N(a,nb,!0))};var sb=L.childNodes;function tb(a,b,c){rb(b);var d=u(b);void 0!==d.firstChild&&(d.childNodes=null);if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){d=a.childNodes;for(var e=0;e<d.length;e++)ub(d[e],b,c);a=u(a);b=void 0!==a.firstChild?null:void 0;a.firstChild=a.lastChild=b;a.childNodes=b}else ub(a,b,c)} | ||
function ub(a,b,c){qb(a);c=c||null;var d=u(a),e=u(b),f=c?u(c):null;d.previousSibling=c?f.previousSibling:b.lastChild;if(f=v(d.previousSibling))f.nextSibling=a;if(f=v(d.nextSibling=c))f.previousSibling=a;d.parentNode=b;c?c===e.firstChild&&(e.firstChild=a):(e.lastChild=a,e.firstChild||(e.firstChild=a));e.childNodes=null} | ||
function vb(a,b){var c=u(a);b=u(b);a===b.firstChild&&(b.firstChild=c.nextSibling);a===b.lastChild&&(b.lastChild=c.previousSibling);a=c.previousSibling;var d=c.nextSibling;a&&(u(a).nextSibling=d);d&&(u(d).previousSibling=a);c.parentNode=c.previousSibling=c.nextSibling=void 0;void 0!==b.childNodes&&(b.childNodes=null)} | ||
function wb(a,b){var c=u(a);if(void 0===c.firstChild)for(c.childNodes=null,b=b||sb(a),c.firstChild=b[0]||null,c.lastChild=b[b.length-1]||null,rb(a),c=0;c<b.length;c++){var d=b[c],e=u(d);e.parentNode=a;e.nextSibling=b[c+1]||null;e.previousSibling=b[c-1]||null;qb(d)}};var xb=L.parentNode,yb=L.childNodes,zb={},Q=w.deferConnectionCallbacks&&"loading"===document.readyState,R;function Ab(a){var b=[];do b.unshift(a);while(a=a.parentNode);return b} | ||
function P(a,b,c){if(a!==zb)throw new TypeError("Illegal constructor");this.V="ShadyRoot";this.host=b;this.Y=c&&c.mode;a=yb(b);wb(b,a);c=u(b);c.root=this;c.M="closed"!==this.Y?this:null;c=u(this);c.firstChild=c.lastChild=c.parentNode=c.nextSibling=c.previousSibling=null;c.childNodes=[];this.K=this.j=!1;this.c=this.b=this.a=null;if(w.preferPerformance){c=0;for(var d=a.length;c<d;c++)M.removeChild.call(b,a[c])}else T(this)}function T(a){a.j||(a.j=!0,ya(function(){return Bb(a)}))} | ||
function Bb(a){for(var b;a;){a.j&&(b=a);a:{var c=a;a=c.host.getRootNode();if(y(a))for(var d=c.host.childNodes,e=0;e<d.length;e++)if(c=d[e],"slot"==c.localName)break a;a=void 0}}b&&b._renderRoot()} | ||
P.prototype._renderRoot=function(){var a=Q;Q=!0;this.j=!1;if(this.a){U(this);for(var b=0,c;b<this.a.length;b++){c=this.a[b];var d=v(c),e=d.assignedNodes;d.assignedNodes=[];d.h=[];if(d.F=e)for(d=0;d<e.length;d++){var f=v(e[d]);f.u=f.assignedSlot;f.assignedSlot===c&&(f.assignedSlot=null)}}for(c=this.host.firstChild;c;c=c.nextSibling)Cb(this,c);for(b=0;b<this.a.length;b++){c=this.a[b];e=v(c);if(!e.assignedNodes.length)for(d=c.firstChild;d;d=d.nextSibling)Cb(this,d,c);(d=(d=v(c.parentNode))&&d.root)&& | ||
(Db(d)||d.j)&&d._renderRoot();Eb(this,e.h,e.assignedNodes);if(d=e.F){for(f=0;f<d.length;f++)v(d[f]).u=null;e.F=null;d.length>e.assignedNodes.length&&(e.A=!0)}e.A&&(e.A=!1,Fb(this,c))}b=this.a;c=[];for(e=0;e<b.length;e++)d=b[e].parentNode,(f=v(d))&&f.root||!(0>c.indexOf(d))||c.push(d);for(b=0;b<c.length;b++){e=c[b];d=e===this?this.host:e;f=[];e=e.childNodes;for(var h=0;h<e.length;h++){var g=e[h];if("slot"==g.localName){g=v(g).h;for(var k=0;k<g.length;k++)f.push(g[k])}else f.push(g)}e=void 0;h=yb(d); | ||
g=ha(f,f.length,h,h.length);for(var l=k=0;k<g.length&&(e=g[k]);k++){for(var n=0,r;n<e.m.length&&(r=e.m[n]);n++)xb(r)===d&&M.removeChild.call(d,r),h.splice(e.index+l,1);l-=e.v}for(l=0;l<g.length&&(e=g[l]);l++)for(k=h[e.index],n=e.index;n<e.index+e.v;n++)r=f[n],M.insertBefore.call(d,r,k),h.splice(n,0,r)}}if(!w.preferPerformance&&!this.K)for(r=this.host.childNodes,c=0,b=r.length;c<b;c++)e=r[c],d=v(e),xb(e)!==this.host||"slot"!==e.localName&&d.assignedSlot||M.removeChild.call(this.host,e);this.K=!0;Q= | ||
a;R&&R()};function Cb(a,b,c){var d=u(b),e=d.u;d.u=null;c||(c=(a=a.b[b.slot||"__catchall"])&&a[0]);c?(u(c).assignedNodes.push(b),d.assignedSlot=c):d.assignedSlot=void 0;e!==d.assignedSlot&&d.assignedSlot&&(u(d.assignedSlot).A=!0)}function Eb(a,b,c){for(var d=0,e;d<c.length&&(e=c[d]);d++)if("slot"==e.localName){var f=v(e).assignedNodes;f&&f.length&&Eb(a,b,f)}else b.push(c[d])}function Fb(a,b){M.dispatchEvent.call(b,new Event("slotchange"));b=v(b);b.assignedSlot&&Fb(a,b.assignedSlot)} | ||
function Gb(a,b){a.c=a.c||[];a.a=a.a||[];a.b=a.b||{};a.c.push.apply(a.c,b instanceof Array?b:fa(q(b)))}function U(a){if(a.c&&a.c.length){for(var b=a.c,c,d=0;d<b.length;d++){var e=b[d];wb(e);wb(e.parentNode);var f=Hb(e);a.b[f]?(c=c||{},c[f]=!0,a.b[f].push(e)):a.b[f]=[e];a.a.push(e)}if(c)for(var h in c)a.b[h]=Ib(a.b[h]);a.c=[]}}function Hb(a){var b=a.name||a.getAttribute("name")||"__catchall";return a.T=b} | ||
function Ib(a){return a.sort(function(a,c){a=Ab(a);for(var b=Ab(c),e=0;e<a.length;e++){c=a[e];var f=b[e];if(c!==f)return a=Array.from(c.parentNode.childNodes),a.indexOf(c)-a.indexOf(f)}})}function Jb(a,b){if(a.a){U(a);var c=a.b,d;for(d in c)for(var e=c[d],f=0;f<e.length;f++){var h=e[f];if(va(b,h)){e.splice(f,1);var g=a.a.indexOf(h);0<=g&&a.a.splice(g,1);f--;h=v(h);if(g=h.h)for(var k=0;k<g.length;k++){var l=g[k],n=xb(l);n&&M.removeChild.call(n,l)}h.h=[];h.assignedNodes=[];g=!0}}return g}} | ||
function Db(a){U(a);return!(!a.a||!a.a.length)} | ||
if(window.customElements&&w.G&&!w.preferPerformance){var V=new Map;R=function(){var a=Array.from(V);V.clear();a=q(a);for(var b=a.next();!b.done;b=a.next()){b=q(b.value);var c=b.next().value;b.next().value?c.R():c.S()}};Q&&document.addEventListener("readystatechange",function(){Q=!1;R()},{once:!0});var Kb=function(a,b,c){var d=0,e="__isConnected"+d++;if(b||c)a.prototype.connectedCallback=a.prototype.R=function(){Q?V.set(this,!0):this[e]||(this[e]=!0,b&&b.call(this))},a.prototype.disconnectedCallback= | ||
a.prototype.S=function(){Q?this.isConnected||V.set(this,!1):this[e]&&(this[e]=!1,c&&c.call(this))};return a},Lb=window.customElements.define;Object.defineProperty(window.CustomElementRegistry.prototype,"define",{value:function(a,b){var c=b.prototype.connectedCallback,d=b.prototype.disconnectedCallback;Lb.call(window.customElements,a,Kb(b,c,d));b.prototype.connectedCallback=c;b.prototype.disconnectedCallback=d}})};var Mb=L.parentNode,Nb=window.document,Ob=w.la; | ||
function Pb(a,b,c){if(a.ownerDocument!==Nb&&b.ownerDocument!==Nb)return M.insertBefore.call(a,b,c);if(b===a)throw Error("Failed to execute 'appendChild' on 'Node': The new child element contains the parent.");if(c){var d=v(c);d=d&&d.parentNode;if(void 0!==d&&d!==a||void 0===d&&Mb(c)!==a)throw Error("Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.");}if(c===b)return b;var e=[],f=Qb,h=z(a),g;h?g=h.host.localName:g=Rb(a);if(b.parentNode){var k= | ||
Rb(b);Sb(b.parentNode,b,!!h||!(b.getRootNode()instanceof ShadowRoot));f=function(a,b){W()&&(Tb(a,k),Qb(a,b))}}d=!0;var l=(!Ob||void 0===b.__noInsertionPoint)&&!Ub(b,g);if(h)b.__noInsertionPoint&&!l||Vb(b,function(a){"slot"===a.localName&&e.push(a);l&&f(a,g)});else if(l){var n=Rb(b);Vb(b,function(a){var b=g;W()&&(Tb(a,n),Qb(a,b))})}e.length&&Gb(h,e);("slot"===a.localName||e.length)&&h&&T(h);x(a)&&(tb(b,a,c),h=v(a),Wb(a)?(T(h.root),d=!1):h.root&&(d=!1));d?(d=y(a)?a.host:a,c?(c=Xb(c),M.insertBefore.call(d, | ||
b,c)):M.appendChild.call(d,b)):b.ownerDocument!==a.ownerDocument&&a.ownerDocument.adoptNode(b);Yb(a,b);return b} | ||
function Sb(a,b,c){c=void 0===c?!1:c;if(a.ownerDocument!==Nb)return M.removeChild.call(a,b);if(b.parentNode!==a)throw Error("The node to be removed is not a child of this node: "+b);var d=z(b),e=v(a);if(x(a)&&(vb(b,a),Wb(a))){T(e.root);var f=!0}if(W()&&!c&&d){var h=Rb(b);Vb(b,function(a){Tb(a,h)})}Zb(b);if(d){var g=a&&"slot"===a.localName;g&&(f=!0);((c=Jb(d,b))||g)&&T(d)}f||(f=y(a)?a.host:a,(!e.root&&"slot"!==b.localName||f===Mb(b))&&M.removeChild.call(f,b));Yb(a,null,b);return b} | ||
function Zb(a){var b=v(a);if(b&&void 0!==b.l){b=a.childNodes;for(var c=0,d=b.length,e;c<d&&(e=b[c]);c++)Zb(e)}if(a=v(a))a.l=void 0}function Xb(a){var b=a;a&&"slot"===a.localName&&(b=(b=(b=v(a))&&b.h)&&b.length?b[0]:Xb(a.nextSibling));return b}function Wb(a){return(a=(a=v(a))&&a.root)&&Db(a)} | ||
function $b(a,b){if("slot"===b)a=a.parentNode,Wb(a)&&T(v(a).root);else if("slot"===a.localName&&"name"===b&&(b=z(a))){if(b.a){U(b);var c=a.T,d=Hb(a);if(d!==c){c=b.b[c];var e=c.indexOf(a);0<=e&&c.splice(e,1);c=b.b[d]||(b.b[d]=[]);c.push(a);1<c.length&&(b.b[d]=Ib(c))}}T(b)}}function Yb(a,b,c){if(a=(a=v(a))&&a.i)b&&a.addedNodes.push(b),c&&a.removedNodes.push(c),ac(a)} | ||
function bc(a){if(a&&a.nodeType){var b=u(a),c=b.l;void 0===c&&(y(a)?(c=a,b.l=c):(c=(c=a.parentNode)?bc(c):a,M.contains.call(document.documentElement,a)&&(b.l=c)));return c}}function cc(a,b,c){var d=[];dc(a.childNodes,b,c,d);return d}function dc(a,b,c,d){for(var e=0,f=a.length,h;e<f&&(h=a[e]);e++){var g;if(g=h.nodeType===Node.ELEMENT_NODE){g=h;var k=b,l=c,n=d,r=k(g);r&&n.push(g);l&&l(r)?g=r:(dc(g.childNodes,k,l,n),g=void 0)}if(g)break}}var ec=null; | ||
function W(){ec||(ec=window.ShadyCSS&&window.ShadyCSS.ScopingShim);return ec||null}function fc(a,b,c){if(a.ownerDocument!==Nb)M.setAttribute.call(a,b,c);else{var d=W();d&&"class"===b?d.setElementClass(a,c):(M.setAttribute.call(a,b,c),$b(a,b))}}function gc(a,b){if(a.ownerDocument!==document||"template"===a.localName)return M.importNode.call(document,a,b);var c=M.importNode.call(document,a,!1);if(b){a=a.childNodes;b=0;for(var d;b<a.length;b++)d=gc(a[b],!0),c.appendChild(d)}return c} | ||
function Qb(a,b){var c=W();c&&c.scopeNode(a,b)}function Tb(a,b){var c=W();c&&c.unscopeNode(a,b)}function Ub(a,b){var c=W();if(!c)return!0;if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){c=!0;for(var d=0;c&&d<a.childNodes.length;d++)c=c&&Ub(a.childNodes[d],b);return c}return a.nodeType!==Node.ELEMENT_NODE?!0:c.currentScopeForNode(a)===b}function Rb(a){if(a.nodeType!==Node.ELEMENT_NODE)return"";var b=W();return b?b.currentScopeForNode(a):""} | ||
function Vb(a,b){if(a){a.nodeType===Node.ELEMENT_NODE&&b(a);for(var c=0,d;c<a.childNodes.length;c++)d=a.childNodes[c],d.nodeType===Node.ELEMENT_NODE&&Vb(d,b)}};function hc(){this.c=!1;this.addedNodes=[];this.removedNodes=[];this.w=new Set}function ac(a){a.c||(a.c=!0,ta(function(){a.flush()}))}hc.prototype.flush=function(){if(this.c){this.c=!1;var a=this.takeRecords();a.length&&this.w.forEach(function(b){b(a)})}};hc.prototype.takeRecords=function(){if(this.addedNodes.length||this.removedNodes.length){var a=[{addedNodes:this.addedNodes,removedNodes:this.removedNodes}];this.addedNodes=[];this.removedNodes=[];return a}return[]}; | ||
function ic(a,b){var c=u(a);c.i||(c.i=new hc);c.i.w.add(b);var d=c.i;return{U:b,X:d,W:a,takeRecords:function(){return d.takeRecords()}}}function jc(a){var b=a&&a.X;b&&(b.w.delete(a.U),b.w.size||(u(a.W).i=null))} | ||
function kc(a,b){var c=b.getRootNode();return a.map(function(a){var b=c===a.target.getRootNode();if(b&&a.addedNodes){if(b=Array.from(a.addedNodes).filter(function(a){return c===a.getRootNode()}),b.length)return a=Object.create(a),Object.defineProperty(a,"addedNodes",{value:b,configurable:!0}),a}else if(b)return a}).filter(function(a){return a})};var X="__eventWrappers"+Date.now(),lc=function(){var a=Object.getOwnPropertyDescriptor(Event.prototype,"composed");return a?function(b){return a.get.call(b)}:null}(),mc={blur:!0,focus:!0,focusin:!0,focusout:!0,click:!0,dblclick:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,wheel:!0,beforeinput:!0,input:!0,keydown:!0,keyup:!0,compositionstart:!0,compositionupdate:!0,compositionend:!0,touchstart:!0,touchend:!0,touchmove:!0,touchcancel:!0,pointerover:!0, | ||
pointerenter:!0,pointerdown:!0,pointermove:!0,pointerup:!0,pointercancel:!0,pointerout:!0,pointerleave:!0,gotpointercapture:!0,lostpointercapture:!0,dragstart:!0,drag:!0,dragenter:!0,dragleave:!0,dragover:!0,drop:!0,dragend:!0,DOMActivate:!0,DOMFocusIn:!0,DOMFocusOut:!0,keypress:!0},nc={DOMAttrModified:!0,DOMAttributeNameChanged:!0,DOMCharacterDataModified:!0,DOMElementNameChanged:!0,DOMNodeInserted:!0,DOMNodeInsertedIntoDocument:!0,DOMNodeRemoved:!0,DOMNodeRemovedFromDocument:!0,DOMSubtreeModified:!0}; | ||
function oc(a,b){var c=[],d=a;for(a=a===window?window:a.getRootNode();d;)c.push(d),d=d.assignedSlot?d.assignedSlot:d.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&d.host&&(b||d!==a)?d.host:d.parentNode;c[c.length-1]===document&&c.push(window);return c}function pc(a,b){if(!y)return a;a=oc(a,!0);for(var c=0,d,e,f,h;c<b.length;c++)if(d=b[c],f=d===window?window:d.getRootNode(),f!==e&&(h=a.indexOf(f),e=f),!y(f)||-1<h)return d} | ||
var qc={get composed(){void 0===this.o&&(lc?this.o="focusin"===this.type||"focusout"===this.type||lc(this):!1!==this.isTrusted&&(this.o=mc[this.type]));return this.o||!1},composedPath:function(){this.H||(this.H=oc(this.__target,this.composed));return this.H},get target(){return pc(this.currentTarget||this.__previousCurrentTarget,this.composedPath())},get relatedTarget(){if(!this.C)return null;this.J||(this.J=oc(this.C,!0));return pc(this.currentTarget||this.__previousCurrentTarget,this.J)},stopPropagation:function(){Event.prototype.stopPropagation.call(this); | ||
this.B=!0},stopImmediatePropagation:function(){Event.prototype.stopImmediatePropagation.call(this);this.B=this.O=!0}};function rc(a){function b(b,d){b=new a(b,d);b.o=d&&!!d.composed;return b}pa(b,a);b.prototype=a.prototype;return b}var sc={focus:!0,blur:!0};function tc(a){return a.__target!==a.target||a.C!==a.relatedTarget}function uc(a,b,c){if(c=b.__handlers&&b.__handlers[a.type]&&b.__handlers[a.type][c])for(var d=0,e;(e=c[d])&&(!tc(a)||a.target!==a.relatedTarget)&&(e.call(b,a),!a.O);d++);} | ||
function vc(a){var b=a.composedPath();Object.defineProperty(a,"currentTarget",{get:function(){return d},configurable:!0});for(var c=b.length-1;0<=c;c--){var d=b[c];uc(a,d,"capture");if(a.B)return}Object.defineProperty(a,"eventPhase",{get:function(){return Event.AT_TARGET}});var e;for(c=0;c<b.length;c++){d=b[c];var f=v(d);f=f&&f.root;if(0===c||f&&f===e)if(uc(a,d,"bubble"),d!==window&&(e=d.getRootNode()),a.B)break}} | ||
function wc(a,b,c,d,e,f){for(var h=0;h<a.length;h++){var g=a[h],k=g.type,l=g.capture,n=g.once,r=g.passive;if(b===g.node&&c===k&&d===l&&e===n&&f===r)return h}return-1} | ||
function xc(a,b,c){if(b){var d=typeof b;if("function"===d||"object"===d)if("object"!==d||b.handleEvent&&"function"===typeof b.handleEvent){var e=this instanceof Window?M.$:M.addEventListener;if(nc[a])return e.call(this,a,b,c);if(c&&"object"===typeof c){var f=!!c.capture;var h=!!c.once;var g=!!c.passive}else f=!!c,g=h=!1;var k=c&&c.D||this,l=b[X];if(l){if(-1<wc(l,k,a,f,h,g))return}else b[X]=[];l=function(e){h&&this.removeEventListener(a,b,c);e.__target||yc(e);if(k!==this){var f=Object.getOwnPropertyDescriptor(e, | ||
"currentTarget");Object.defineProperty(e,"currentTarget",{get:function(){return k},configurable:!0})}e.__previousCurrentTarget=e.currentTarget;if(!y(k)||-1!=e.composedPath().indexOf(k))if(e.composed||-1<e.composedPath().indexOf(k))if(tc(e)&&e.target===e.relatedTarget)e.eventPhase===Event.BUBBLING_PHASE&&e.stopImmediatePropagation();else if(e.eventPhase===Event.CAPTURING_PHASE||e.bubbles||e.target===k||k instanceof Window){var g="function"===d?b.call(k,e):b.handleEvent&&b.handleEvent(e);k!==this&& | ||
(f?(Object.defineProperty(e,"currentTarget",f),f=null):delete e.currentTarget);return g}};b[X].push({node:k,type:a,capture:f,once:h,passive:g,ba:l});sc[a]?(this.__handlers=this.__handlers||{},this.__handlers[a]=this.__handlers[a]||{capture:[],bubble:[]},this.__handlers[a][f?"capture":"bubble"].push(l)):e.call(this,a,l,c)}}} | ||
function zc(a,b,c){if(b){var d=this instanceof Window?M.aa:M.removeEventListener;if(nc[a])return d.call(this,a,b,c);if(c&&"object"===typeof c){var e=!!c.capture;var f=!!c.once;var h=!!c.passive}else e=!!c,h=f=!1;var g=c&&c.D||this,k=void 0;var l=null;try{l=b[X]}catch(n){}l&&(f=wc(l,g,a,e,f,h),-1<f&&(k=l.splice(f,1)[0].ba,l.length||(b[X]=void 0)));d.call(this,a,k||b,c);k&&sc[a]&&this.__handlers&&this.__handlers[a]&&(a=this.__handlers[a][e?"capture":"bubble"],k=a.indexOf(k),-1<k&&a.splice(k,1))}} | ||
function Ac(){for(var a in sc)window.addEventListener(a,function(a){a.__target||(yc(a),vc(a))},!0)}function yc(a){a.__target=a.target;a.C=a.relatedTarget;if(w.g){var b=Object.getPrototypeOf(a);if(!b.hasOwnProperty("__patchProto")){var c=Object.create(b);c.ca=b;oa(c,qc);b.__patchProto=c}a.__proto__=b.__patchProto}else oa(a,qc)}var Bc=rc(window.Event),Cc=rc(window.CustomEvent),Dc=rc(window.MouseEvent); | ||
function Ec(){window.Event=Bc;window.CustomEvent=Cc;window.MouseEvent=Dc;Ac();if(!lc&&Object.getOwnPropertyDescriptor(Event.prototype,"isTrusted")){var a=function(){var a=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a)};Element.prototype.click?Element.prototype.click=a:HTMLElement.prototype.click&&(HTMLElement.prototype.click=a)}};function Fc(a){var b=a.getRootNode();y(b)&&Bb(b);return(a=v(a))&&a.assignedSlot||null} | ||
var Gc={addEventListener:xc.bind(window),removeEventListener:zc.bind(window)},Hc={addEventListener:xc,removeEventListener:zc,appendChild:function(a){return Pb(this,a)},insertBefore:function(a,b){return Pb(this,a,b)},removeChild:function(a){return Sb(this,a)},replaceChild:function(a,b){Pb(this,a,b);Sb(this,b);return a},cloneNode:function(a){if("template"==this.localName)var b=M.cloneNode.call(this,a);else if(b=M.cloneNode.call(this,!1),a&&b.nodeType!==Node.ATTRIBUTE_NODE){a=this.childNodes;for(var c= | ||
0,d;c<a.length;c++)d=a[c].cloneNode(!0),b.appendChild(d)}return b},getRootNode:function(){return bc(this)},contains:function(a){return va(this,a)},dispatchEvent:function(a){D();return M.dispatchEvent.call(this,a)}}; | ||
Object.defineProperties(Hc,{isConnected:{get:function(){if(ib&&ib.call(this))return!0;if(this.nodeType==Node.DOCUMENT_FRAGMENT_NODE)return!1;var a=this.ownerDocument;if(ua){if(M.contains.call(a,this))return!0}else if(a.documentElement&&M.contains.call(a.documentElement,this))return!0;for(a=this;a&&!(a instanceof Document);)a=a.parentNode||(y(a)?a.host:void 0);return!!(a&&a instanceof Document)},configurable:!0}}); | ||
var Ic={get assignedSlot(){return Fc(this)}},Jc={querySelector:function(a){return cc(this,function(b){return na.call(b,a)},function(a){return!!a})[0]||null},querySelectorAll:function(a,b){if(b){b=Array.prototype.slice.call(M.querySelectorAll.call(this,a));var c=this.getRootNode();return b.filter(function(a){return a.getRootNode()==c})}return cc(this,function(b){return na.call(b,a)})}},Kc={},Lc={assignedNodes:function(a){if("slot"===this.localName){var b=this.getRootNode();y(b)&&Bb(b);return(b=v(this))? | ||
(a&&a.flatten?b.h:b.assignedNodes)||[]:[]}}},Mc=B({setAttribute:function(a,b){fc(this,a,b)},removeAttribute:function(a){M.removeAttribute.call(this,a);$b(this,a)},attachShadow:function(a){if(!this)throw"Must provide a host.";if(!a)throw"Not enough arguments.";return new P(zb,this,a)},get slot(){return this.getAttribute("slot")},set slot(a){fc(this,"slot",a)},get assignedSlot(){return Fc(this)}},Jc,Lc);Object.defineProperties(Mc,nb); | ||
var Nc={importNode:function(a,b){return gc(a,b)},getElementById:function(a){return cc(this,function(b){return b.id==a},function(a){return!!a})[0]||null}};Object.defineProperties(Nc,{_activeElement:ob.activeElement}); | ||
for(var Oc=HTMLElement.prototype.blur,Pc={blur:function(){var a=v(this);(a=(a=a&&a.root)&&a.activeElement)?a.blur():Oc.call(this)}},Y={},Qc=q(Object.getOwnPropertyNames(Document.prototype)),Rc=Qc.next();!Rc.done;Y={f:Y.f},Rc=Qc.next())Y.f=Rc.value,"on"===Y.f.substring(0,2)&&Object.defineProperty(Pc,Y.f,{set:function(a){return function(b){var c=u(this),d=a.f.substring(2);c.s[a.f]&&this.removeEventListener(d,c.s[a.f]);this.addEventListener(d,b,{});c.s[a.f]=b}}(Y),get:function(a){return function(){var b= | ||
v(this);return b&&b.s[a.f]}}(Y),configurable:!0});var Sc=B({addEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.D=this;this.host.addEventListener(a,b,c)},removeEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.D=this;this.host.removeEventListener(a,b,c)},getElementById:function(a){return cc(this,function(b){return b.id==a},function(a){return!!a})[0]||null}},Jc);w.preferPerformance||(B(Nc,Jc),B(Kc,Jc)); | ||
function Z(a,b){for(var c=Object.getOwnPropertyNames(b),d=0;d<c.length;d++){var e=c[d],f=Object.getOwnPropertyDescriptor(b,e);f.value?a[e]=f.value:Object.defineProperty(a,e,f)}};if(w.G){window.ShadyDOM={inUse:w.G,patch:function(a){rb(a);qb(a);return a},isShadyRoot:y,enqueue:ya,flush:D,settings:w,filterMutations:kc,observeChildren:ic,unobserveChildren:jc,nativeMethods:M,nativeTree:L,deferConnectionCallbacks:w.deferConnectionCallbacks,preferPerformance:w.preferPerformance,handlesDynamicScoping:!0};Ec();var Tc=window.customElements&&window.customElements.nativeHTMLElement||HTMLElement;Z(P.prototype,Sc);Z(window.Node.prototype,Hc);Z(window.Window.prototype,Gc);Z(window.Text.prototype, | ||
Ic);Z(window.Element.prototype,Mc);Z(window.DocumentFragment.prototype,Kc);Z(window.Document.prototype,Nc);window.HTMLSlotElement&&Z(window.HTMLSlotElement.prototype,Lc);Z(Tc.prototype,Pc);w.g&&(O(window.Node.prototype),O(window.Text.prototype),O(window.DocumentFragment.prototype),O(window.Element.prototype),O(Tc.prototype),O(window.Document.prototype),window.HTMLSlotElement&&O(window.HTMLSlotElement.prototype));pb();window.ShadowRoot=P};}).call(this); | ||
'use strict';var m,p="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};function ba(){ba=function(){};p.Symbol||(p.Symbol=ca)}var ca=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}(); | ||
function da(){ba();var a=p.Symbol.iterator;a||(a=p.Symbol.iterator=p.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ea(this)}});da=function(){}}function ea(a){var b=0;return fa(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}function fa(a){da();a={next:a};a[p.Symbol.iterator]=function(){return this};return a}function ha(a){da();var b=a[Symbol.iterator];return b?b.call(a):ea(a)} | ||
function ia(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}function r(a,b){return{index:a,s:[],A:b}} | ||
function ja(a,b,c,d){var e=0,f=0,h=0,g=0,k=Math.min(b-e,d-f);if(0==e&&0==f)a:{for(h=0;h<k;h++)if(a[h]!==c[h])break a;h=k}if(b==a.length&&d==c.length){g=a.length;for(var l=c.length,n=0;n<k-h&&ka(a[--g],c[--l]);)n++;g=n}e+=h;f+=h;b-=g;d-=g;if(0==b-e&&0==d-f)return[];if(e==b){for(b=r(e,0);f<d;)b.s.push(c[f++]);return[b]}if(f==d)return[r(e,b-e)];k=e;h=f;d=d-h+1;g=b-k+1;b=Array(d);for(l=0;l<d;l++)b[l]=Array(g),b[l][0]=l;for(l=0;l<g;l++)b[0][l]=l;for(l=1;l<d;l++)for(n=1;n<g;n++)if(a[k+n-1]===c[h+l-1])b[l][n]= | ||
b[l-1][n-1];else{var q=b[l-1][n]+1,P=b[l][n-1]+1;b[l][n]=q<P?q:P}k=b.length-1;h=b[0].length-1;d=b[k][h];for(a=[];0<k||0<h;)0==k?(a.push(2),h--):0==h?(a.push(3),k--):(g=b[k-1][h-1],l=b[k-1][h],n=b[k][h-1],q=l<n?l<g?l:g:n<g?n:g,q==g?(g==d?a.push(0):(a.push(1),d=g),k--,h--):q==l?(a.push(3),k--,d=l):(a.push(2),h--,d=n));a.reverse();b=void 0;k=[];for(h=0;h<a.length;h++)switch(a[h]){case 0:b&&(k.push(b),b=void 0);e++;f++;break;case 1:b||(b=r(e,0));b.A++;e++;b.s.push(c[f]);f++;break;case 2:b||(b=r(e,0)); | ||
b.A++;e++;break;case 3:b||(b=r(e,0)),b.s.push(c[f]),f++}b&&k.push(b);return k}function ka(a,b){return a===b};function la(){this.O=this.root=null;this.C=!1;this.h=this.w=this.I=this.assignedSlot=this.assignedNodes=this.j=null;this.childNodes=this.nextSibling=this.previousSibling=this.lastChild=this.firstChild=this.parentNode=this.o=void 0;this.K=this.L=!1;this.v={}}la.prototype.toJSON=function(){return{}};function t(a){a.__shady||(a.__shady=new la);return a.__shady}function u(a){return a&&a.__shady};var v=window.ShadyDOM||{};v.Y=!(!Element.prototype.attachShadow||!Node.prototype.getRootNode);var ma=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild");v.f=!!(ma&&ma.configurable&&ma.get);v.J=v.force||!v.Y;v.m=v.noPatch||!1;v.N=v.preferPerformance;function w(a){return(a=u(a))&&void 0!==a.firstChild}function x(a){return"ShadyRoot"===a.V}function y(a){a=a.__shady_getRootNode();if(x(a))return a}function na(a){return(a=(a=u(a))&&a.root)&&oa(a)} | ||
var z=Element.prototype,pa=z.matches||z.matchesSelector||z.mozMatchesSelector||z.msMatchesSelector||z.oMatchesSelector||z.webkitMatchesSelector,qa=document.createTextNode(""),ra=0,sa=[];(new MutationObserver(function(){for(;sa.length;)try{sa.shift()()}catch(a){throw qa.textContent=ra++,a;}})).observe(qa,{characterData:!0});function ta(a){sa.push(a);qa.textContent=ra++}var ua=!!document.contains;function va(a,b){for(;b;){if(b==a)return!0;b=b.__shady_parentNode}return!1} | ||
function wa(a){for(var b=a.length-1;0<=b;b--){var c=a[b],d=c.getAttribute("id")||c.getAttribute("name");d&&"length"!==d&&isNaN(d)&&(a[d]=c)}a.item=function(b){return a[b]};a.namedItem=function(b){if("length"!==b&&isNaN(b)&&a[b])return a[b];for(var c=ha(a),d=c.next();!d.done;d=c.next())if(d=d.value,(d.getAttribute("id")||d.getAttribute("name"))==b)return d;return null};return a} | ||
function A(a,b,c){c=void 0===c?"":c;for(var d in b){var e=b[d];e.configurable=!0;var f=c+d;if(e.value)a[f]=e.value;else try{Object.defineProperty(a,f,e)}catch(h){}}}function B(a){var b={};Object.getOwnPropertyNames(a).forEach(function(c){b[c]=Object.getOwnPropertyDescriptor(a,c)});return b};var C=[],xa;function ya(a){xa||(xa=!0,ta(D));C.push(a)}function D(){xa=!1;for(var a=!!C.length;C.length;)C.shift()();return a}D.list=C;var E=B({get childNodes(){return this.__shady_childNodes},get firstChild(){return this.__shady_firstChild},get lastChild(){return this.__shady_lastChild},get textContent(){return this.__shady_textContent},set textContent(a){this.__shady_textContent=a},get childElementCount(){return this.__shady_childElementCount},get children(){return this.__shady_children},get firstElementChild(){return this.__shady_firstElementChild},get lastElementChild(){return this.__shady_lastElementChild},get innerHTML(){return this.__shady_innerHTML}, | ||
set innerHTML(a){return this.__shady_innerHTML=a},get shadowRoot(){return this.__shady_shadowRoot}}),F=B({get parentElement(){return this.__shady_parentElement},get parentNode(){return this.__shady_parentNode},get nextSibling(){return this.__shady_nextSibling},get previousSibling(){return this.__shady_previousSibling},get nextElementSibling(){return this.__shady_nextElementSibling},get previousElementSibling(){return this.__shady_previousElementSibling},get className(){return this.__shady_className}, | ||
set className(a){return this.__shady_className=a}}),za;for(za in E)E[za].enumerable=!1;for(var Aa in F)F[Aa].enumerable=!1;var Ba=v.f||v.m,Ca=Ba?function(){}:function(a){var b=t(a);b.L||(b.L=!0,A(a,F))},Da=Ba?function(){}:function(a){var b=t(a);b.K||(b.K=!0,A(a,E))};function Ea(a,b,c){Ca(a);c=c||null;var d=t(a),e=t(b),f=c?t(c):null;d.previousSibling=c?f.previousSibling:b.__shady_lastChild;if(f=u(d.previousSibling))f.nextSibling=a;if(f=u(d.nextSibling=c))f.previousSibling=a;d.parentNode=b;c?c===e.firstChild&&(e.firstChild=a):(e.lastChild=a,e.firstChild||(e.firstChild=a));e.childNodes=null} | ||
function Fa(a,b,c){Da(b);var d=t(b);void 0!==d.firstChild&&(d.childNodes=null);if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){d=a.__shady_childNodes;for(var e=0;e<d.length;e++)Ea(d[e],b,c);a=t(a);b=void 0!==a.firstChild?null:void 0;a.firstChild=a.lastChild=b;a.childNodes=b}else Ea(a,b,c)} | ||
function Ga(a,b){var c=t(a);b=t(b);a===b.firstChild&&(b.firstChild=c.nextSibling);a===b.lastChild&&(b.lastChild=c.previousSibling);a=c.previousSibling;var d=c.nextSibling;a&&(t(a).nextSibling=d);d&&(t(d).previousSibling=a);c.parentNode=c.previousSibling=c.nextSibling=void 0;void 0!==b.childNodes&&(b.childNodes=null)} | ||
function Ha(a){var b=t(a);if(void 0===b.firstChild){b.childNodes=null;var c=b.firstChild=a.__shady_native_firstChild||null;b.lastChild=a.__shady_native_lastChild||null;Da(a);b=c;for(var d;b;b=b.__shady_native_nextSibling)c=t(b),c.parentNode=a,c.nextSibling=b.__shady_native_nextSibling||null,c.previousSibling=d||null,d=b,Ca(b)}};var Ia=window.document,Ja=v.N,Ka=Object.getOwnPropertyDescriptor(Node.prototype,"isConnected"),La=Ka&&Ka.get;function Ma(a){for(var b;b=a.__shady_firstChild;)a.__shady_removeChild(b)}function Na(a){var b=u(a);if(b&&void 0!==b.o){b=a.__shady_childNodes;for(var c=0,d=b.length,e;c<d&&(e=b[c]);c++)Na(e)}if(a=u(a))a.o=void 0}function Oa(a){var b=a;a&&"slot"===a.localName&&(b=(b=(b=u(a))&&b.h)&&b.length?b[0]:Oa(a.__shady_nextSibling));return b} | ||
function Pa(a,b,c){if(a=(a=u(a))&&a.j)b&&a.addedNodes.push(b),c&&a.removedNodes.push(c),Qa(a)} | ||
var J=B({get parentNode(){var a=u(this);a=a&&a.parentNode;return void 0!==a?a:this.__shady_native_parentNode},get firstChild(){var a=u(this);a=a&&a.firstChild;return void 0!==a?a:this.__shady_native_firstChild},get lastChild(){var a=u(this);a=a&&a.lastChild;return void 0!==a?a:this.__shady_native_lastChild},get nextSibling(){var a=u(this);a=a&&a.nextSibling;return void 0!==a?a:this.__shady_native_nextSibling},get previousSibling(){var a=u(this);a=a&&a.previousSibling;return void 0!==a?a:this.__shady_native_previousSibling}, | ||
get childNodes(){if(w(this)){var a=u(this);if(!a.childNodes){a.childNodes=[];for(var b=this.__shady_firstChild;b;b=b.__shady_nextSibling)a.childNodes.push(b)}var c=a.childNodes}else c=this.__shady_native_childNodes;c.item=function(a){return c[a]};return c},get parentElement(){var a=u(this);(a=a&&a.parentNode)&&a.nodeType!==Node.ELEMENT_NODE&&(a=null);return void 0!==a?a:this.__shady_native_parentElement},get isConnected(){if(La&&La.call(this))return!0;if(this.nodeType==Node.DOCUMENT_FRAGMENT_NODE)return!1; | ||
var a=this.ownerDocument;if(ua){if(a.__shady_native_contains(this))return!0}else if(a.documentElement&&a.documentElement.__shady_native_contains(this))return!0;for(a=this;a&&!(a instanceof Document);)a=a.__shady_parentNode||(x(a)?a.host:void 0);return!!(a&&a instanceof Document)},get textContent(){if(w(this)){for(var a=[],b=0,c=this.__shady_childNodes,d;d=c[b];b++)d.nodeType!==Node.COMMENT_NODE&&a.push(d.__shady_textContent);return a.join("")}return this.__shady_native_textContent},set textContent(a){if("undefined"=== | ||
typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:if(!w(this)&&v.f){var b=this.__shady_firstChild;(b!=this.__shady_lastChild||b&&b.nodeType!=Node.TEXT_NODE)&&Ma(this);this.__shady_native_textContent=a}else Ma(this),(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_insertBefore(document.createTextNode(a));break;default:this.nodeValue=a}},insertBefore:function(a,b){if(this.ownerDocument!==Ia&&a.ownerDocument!==Ia)return this.__shady_native_insertBefore(a, | ||
b),a;if(a===this)throw Error("Failed to execute 'appendChild' on 'Node': The new child element contains the parent.");if(b){var c=u(b);c=c&&c.parentNode;if(void 0!==c&&c!==this||void 0===c&&b.__shady_native_parentNode!==this)throw Error("Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.");}if(b===a)return a;var d=[],e=(c=y(this))?c.host.localName:G(this),f=a.__shady_parentNode;if(f){var h=G(a);f.__shady_removeChild(a,!!c|| | ||
!y(a))}f=!0;var g=(!Ja||void 0===a.__noInsertionPoint)&&!Ra(a,e),k=c&&!a.__noInsertionPoint&&(!Ja||a.nodeType===Node.DOCUMENT_FRAGMENT_NODE);if(k||g)g&&(h=h||G(a)),Sa(a,function(a){k&&"slot"===a.localName&&d.push(a);if(g){var b=h;H()&&(b&&Ta(a,b),(b=H())&&b.scopeNode(a,e))}});if("slot"===this.localName||d.length)d.length&&(c.c=c.c||[],c.a=c.a||[],c.b=c.b||{},c.c.push.apply(c.c,d instanceof Array?d:ia(ha(d)))),c&&I(c);w(this)&&(Fa(a,this,b),c=u(this),na(this)?(I(c.root),f=!1):c.root&&(f=!1));f?(c= | ||
x(this)?this.host:this,b?(b=Oa(b),c.__shady_native_insertBefore(a,b)):c.__shady_native_appendChild(a)):a.ownerDocument!==this.ownerDocument&&this.ownerDocument.adoptNode(a);Pa(this,a);return a},appendChild:function(a){return this.__shady_insertBefore(a)},removeChild:function(a,b){b=void 0===b?!1:b;if(this.ownerDocument!==Ia)return this.__shady_native_removeChild(a);if(a.__shady_parentNode!==this)throw Error("The node to be removed is not a child of this node: "+a);var c=y(a),d=u(this);if(w(this)&& | ||
(Ga(a,this),na(this))){I(d.root);var e=!0}if(H()&&!b&&c){var f=G(a);Sa(a,function(a){Ta(a,f)})}Na(a);if(c){var h=this&&"slot"===this.localName;h&&(e=!0);((b=Ua(c,a))||h)&&I(c)}e||(e=x(this)?this.host:this,(!d.root&&"slot"!==a.localName||e===a.__shady_native_parentNode)&&e.__shady_native_removeChild(a));Pa(this,null,a);return a},replaceChild:function(a,b){this.__shady_insertBefore(a,b);this.__shady_removeChild(b);return a},cloneNode:function(a){if("template"==this.localName)return this.__shady_native_cloneNode(a); | ||
var b=this.__shady_native_cloneNode(!1);if(a&&b.nodeType!==Node.ATTRIBUTE_NODE){a=this.__shady_childNodes;for(var c=0,d;c<a.length;c++)d=a[c].__shady_cloneNode(!0),b.__shady_appendChild(d)}return b},getRootNode:function(a){if(this&&this.nodeType){var b=t(this),c=b.o;void 0===c&&(x(this)?(c=this,b.o=c):(c=(c=this.__shady_parentNode)?c.__shady_getRootNode(a):this,document.documentElement.__shady_native_contains(this)&&(b.o=c)));return c}},contains:function(a){return va(this,a)}});function Va(a,b,c){var d=[];Wa(a.__shady_childNodes,b,c,d);return d}function Wa(a,b,c,d){for(var e=0,f=a.length,h;e<f&&(h=a[e]);e++){var g;if(g=h.nodeType===Node.ELEMENT_NODE){g=h;var k=b,l=c,n=d,q=k(g);q&&n.push(g);l&&l(q)?g=q:(Wa(g.__shady_childNodes,k,l,n),g=void 0)}if(g)break}} | ||
var K=B({get firstElementChild(){var a=u(this);if(a&&void 0!==a.firstChild){for(a=this.__shady_firstChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_firstElementChild},get lastElementChild(){var a=u(this);if(a&&void 0!==a.lastChild){for(a=this.__shady_lastChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_lastElementChild},get children(){return w(this)?wa(Array.prototype.filter.call(this.__shady_childNodes, | ||
function(a){return a.nodeType===Node.ELEMENT_NODE})):this.__shady_native_children},get childElementCount(){return this.__shady_children.length}}),Xa=B({querySelector:function(a){return Va(this,function(b){return pa.call(b,a)},function(a){return!!a})[0]||null},querySelectorAll:function(a,b){if(b){b=Array.prototype.slice.call(this.__shady_native_querySelectorAll(a));var c=this.__shady_getRootNode();return b.filter(function(a){return a.__shady_getRootNode()==c})}return Va(this,function(b){return pa.call(b, | ||
a)})}}),Ya=v.N?Object.assign({},K):K;Object.assign(K,Xa);var Za=B({getElementById:function(a){return""===a?null:Va(this,function(b){return b.id==a},function(a){return!!a})[0]||null}});var $a=B({get activeElement(){var a=v.f?document.__shady_native_activeElement:document.activeElement;if(!a||!a.nodeType)return null;var b=!!x(this);if(!(this===document||b&&this.host!==a&&this.host.__shady_native_contains(a)))return null;for(b=y(a);b&&b!==this;)a=b.host,b=y(a);return this===document?b?null:a:b===this?a:null}});var ab=/[&\u00A0"]/g,cb=/[&\u00A0<>]/g;function db(a){switch(a){case "&":return"&";case "<":return"<";case ">":return">";case '"':return""";case "\u00a0":return" "}}function eb(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}var fb=eb("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),gb=eb("style script xmp iframe noembed noframes plaintext noscript".split(" ")); | ||
function hb(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):a.childNodes,e=0,f=d.length,h;e<f&&(h=d[e]);e++){a:{var g=h;var k=a;var l=b;switch(g.nodeType){case Node.ELEMENT_NODE:for(var n=g.localName,q="<"+n,P=g.attributes,bb=0;k=P[bb];bb++)q+=" "+k.name+'="'+k.value.replace(ab,db)+'"';q+=">";g=fb[n]?q:q+hb(g,l)+"</"+n+">";break a;case Node.TEXT_NODE:g=g.data;g=k&&gb[k.localName]?g:g.replace(cb,db);break a;case Node.COMMENT_NODE:g="\x3c!--"+g.data+"--\x3e";break a;default:throw window.console.error(g), | ||
Error("not implemented");}}c+=g}return c};var ib=document.implementation.createHTMLDocument("inert"),jb=B({get innerHTML(){return w(this)?hb("template"===this.localName?this.content:this,function(a){return a.__shady_childNodes}):this.__shady_native_innerHTML},set innerHTML(a){if("template"===this.localName)this.__shady_native_innerHTML=a;else{Ma(this);var b=this.localName||"div";b=this.namespaceURI&&this.namespaceURI!==ib.namespaceURI?ib.createElementNS(this.namespaceURI,b):ib.createElement(b);for(v.f?b.__shady_native_innerHTML=a:b.innerHTML= | ||
a;a=b.__shady_firstChild;)this.__shady_insertBefore(a)}}});var kb=B({addEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.H=this;this.host.__shady_addEventListener(a,b,c)},removeEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.H=this;this.host.__shady_removeEventListener(a,b,c)}});function lb(a,b){A(a,kb,b);A(a,$a,b);A(a,jb,b);A(a,K,b);v.m&&!b?(A(a,J,b),A(a,Za,b)):v.f||(A(a,F),A(a,E))};var mb={},L=v.deferConnectionCallbacks&&"loading"===document.readyState,M;function nb(a){var b=[];do b.unshift(a);while(a=a.__shady_parentNode);return b} | ||
function N(a,b,c){if(a!==mb)throw new TypeError("Illegal constructor");this.V="ShadyRoot";this.host=b;this.mode=c&&c.mode;Ha(b);a=t(b);a.root=this;a.O="closed"!==this.mode?this:null;a=t(this);a.firstChild=a.lastChild=a.parentNode=a.nextSibling=a.previousSibling=null;a.childNodes=[];this.g=this.i=!1;this.c=this.b=this.a=null;if(v.preferPerformance)for(;a=b.__shady_native_firstChild;)b.__shady_native_removeChild(a);else I(this)} | ||
function I(a){a.i||(a.i=!0,ya(function(){var b=ob(a);b&&b._renderRoot()}))}function ob(a){for(var b;a;){a.i&&(b=a);a:{var c=a;a=c.host.__shady_getRootNode();if(x(a))for(var d=c.host.__shady_childNodes,e=0;e<d.length;e++)if(c=d[e],"slot"==c.localName)break a;a=void 0}}return b}function pb(a){(a=ob(a))&&a.i&&a._renderRoot()} | ||
N.prototype._renderRoot=function(){var a=L;L=!0;this.i=!1;if(this.a){O(this);for(var b=0,c;b<this.a.length;b++){c=this.a[b];var d=u(c),e=d.assignedNodes;d.assignedNodes=[];d.h=[];if(d.I=e)for(d=0;d<e.length;d++){var f=u(e[d]);f.w=f.assignedSlot;f.assignedSlot===c&&(f.assignedSlot=null)}}for(c=this.host.__shady_firstChild;c;c=c.__shady_nextSibling)qb(this,c);for(b=0;b<this.a.length;b++){c=this.a[b];e=u(c);if(!e.assignedNodes.length)for(d=c.__shady_firstChild;d;d=d.__shady_nextSibling)qb(this,d,c); | ||
(d=(d=u(c.__shady_parentNode))&&d.root)&&(oa(d)||d.i)&&d._renderRoot();rb(this,e.h,e.assignedNodes);if(d=e.I){for(f=0;f<d.length;f++)u(d[f]).w=null;e.I=null;d.length>e.assignedNodes.length&&(e.C=!0)}e.C&&(e.C=!1,sb(this,c))}b=this.a;c=[];for(e=0;e<b.length;e++)d=b[e].__shady_parentNode,(f=u(d))&&f.root||!(0>c.indexOf(d))||c.push(d);for(b=0;b<c.length;b++){e=c[b];d=e===this?this.host:e;f=[];e=e.__shady_childNodes;for(var h=0;h<e.length;h++){var g=e[h];if("slot"==g.localName){g=u(g).h;for(var k=0;k< | ||
g.length;k++)f.push(g[k])}else f.push(g)}e=void 0;h=Array.prototype.slice.call(d.__shady_native_childNodes);g=ja(f,f.length,h,h.length);for(var l=k=0;k<g.length&&(e=g[k]);k++){for(var n=0,q;n<e.s.length&&(q=e.s[n]);n++)q.__shady_native_parentNode===d&&d.__shady_native_removeChild(q),h.splice(e.index+l,1);l-=e.A}for(l=0;l<g.length&&(e=g[l]);l++)for(k=h[e.index],n=e.index;n<e.index+e.A;n++)q=f[n],d.__shady_native_insertBefore(q,k),h.splice(n,0,q)}}if(!v.preferPerformance&&!this.g)for(q=this.host.__shady_childNodes, | ||
c=0,b=q.length;c<b;c++)e=q[c],d=u(e),e.__shady_native_parentNode!==this.host||"slot"!==e.localName&&d.assignedSlot||this.host.__shady_native_removeChild(e);this.g=!0;L=a;M&&M()};function qb(a,b,c){var d=t(b),e=d.w;d.w=null;c||(c=(a=a.b[b.__shady_slot||"__catchall"])&&a[0]);c?(t(c).assignedNodes.push(b),d.assignedSlot=c):d.assignedSlot=void 0;e!==d.assignedSlot&&d.assignedSlot&&(t(d.assignedSlot).C=!0)} | ||
function rb(a,b,c){for(var d=0,e;d<c.length&&(e=c[d]);d++)if("slot"==e.localName){var f=u(e).assignedNodes;f&&f.length&&rb(a,b,f)}else b.push(c[d])}function sb(a,b){b.__shady_native_dispatchEvent(new Event("slotchange"));b=u(b);b.assignedSlot&&sb(a,b.assignedSlot)}function O(a){if(a.c&&a.c.length){for(var b=a.c,c,d=0;d<b.length;d++){var e=b[d];Ha(e);Ha(e.__shady_parentNode);var f=tb(e);a.b[f]?(c=c||{},c[f]=!0,a.b[f].push(e)):a.b[f]=[e];a.a.push(e)}if(c)for(var h in c)a.b[h]=ub(a.b[h]);a.c=[]}} | ||
function tb(a){var b=a.name||a.getAttribute("name")||"__catchall";return a.T=b}function ub(a){return a.sort(function(a,c){a=nb(a);for(var b=nb(c),e=0;e<a.length;e++){c=a[e];var f=b[e];if(c!==f)return a=Array.from(c.__shady_parentNode.__shady_childNodes),a.indexOf(c)-a.indexOf(f)}})} | ||
function Ua(a,b){if(a.a){O(a);var c=a.b,d;for(d in c)for(var e=c[d],f=0;f<e.length;f++){var h=e[f];if(va(b,h)){e.splice(f,1);var g=a.a.indexOf(h);0<=g&&a.a.splice(g,1);f--;h=u(h);if(g=h.h)for(var k=0;k<g.length;k++){var l=g[k],n=l.__shady_native_parentNode;n&&n.__shady_native_removeChild(l)}h.h=[];h.assignedNodes=[];g=!0}}return g}}function oa(a){O(a);return!(!a.a||!a.a.length)} | ||
(function(a){a.__proto__=DocumentFragment.prototype;lb(a,"__shady_");lb(a);Object.defineProperties(a,{nodeType:{value:Node.DOCUMENT_FRAGMENT_NODE,configurable:!0},nodeName:{value:"#document-fragment",configurable:!0},nodeValue:{value:null,configurable:!0}});["localName","namespaceURI","prefix"].forEach(function(b){Object.defineProperty(a,b,{value:void 0,configurable:!0})});["ownerDocument","baseURI","isConnected"].forEach(function(b){Object.defineProperty(a,b,{get:function(){return this.host[b]}, | ||
configurable:!0})})})(N.prototype); | ||
if(window.customElements&&v.J&&!v.preferPerformance){var Q=new Map;M=function(){var a=[];Q.forEach(function(b,c){a.push([c,b])});Q.clear();for(var b=0;b<a.length;b++){var c=a[b][0];a[b][1]?c.R():c.S()}};L&&document.addEventListener("readystatechange",function(){L=!1;M()},{once:!0});var vb=function(a,b,c){var d=0,e="__isConnected"+d++;if(b||c)a.prototype.connectedCallback=a.prototype.R=function(){L?Q.set(this,!0):this[e]||(this[e]=!0,b&&b.call(this))},a.prototype.disconnectedCallback=a.prototype.S= | ||
function(){L?this.isConnected||Q.set(this,!1):this[e]&&(this[e]=!1,c&&c.call(this))};return a},wb=window.customElements.define;Object.defineProperty(window.CustomElementRegistry.prototype,"define",{value:function(a,b){var c=b.prototype.connectedCallback,d=b.prototype.disconnectedCallback;wb.call(window.customElements,a,vb(b,c,d));b.prototype.connectedCallback=c;b.prototype.disconnectedCallback=d}})};function xb(){this.g=!1;this.addedNodes=[];this.removedNodes=[];this.B=new Set}function Qa(a){a.g||(a.g=!0,ta(function(){a.flush()}))}xb.prototype.flush=function(){if(this.g){this.g=!1;var a=this.takeRecords();a.length&&this.B.forEach(function(b){b(a)})}};xb.prototype.takeRecords=function(){if(this.addedNodes.length||this.removedNodes.length){var a=[{addedNodes:this.addedNodes,removedNodes:this.removedNodes}];this.addedNodes=[];this.removedNodes=[];return a}return[]}; | ||
function yb(a,b){var c=t(a);c.j||(c.j=new xb);c.j.B.add(b);var d=c.j;return{U:b,X:d,W:a,takeRecords:function(){return d.takeRecords()}}}function zb(a){var b=a&&a.X;b&&(b.B.delete(a.U),b.B.size||(t(a.W).j=null))} | ||
function Ab(a,b){var c=b.getRootNode();return a.map(function(a){var b=c===a.target.getRootNode();if(b&&a.addedNodes){if(b=Array.from(a.addedNodes).filter(function(a){return c===a.getRootNode()}),b.length)return a=Object.create(a),Object.defineProperty(a,"addedNodes",{value:b,configurable:!0}),a}else if(b)return a}).filter(function(a){return a})};var R="__eventWrappers"+Date.now(),Bb=function(){var a=Object.getOwnPropertyDescriptor(Event.prototype,"composed");return a?function(b){return a.get.call(b)}:null}(),Cb={blur:!0,focus:!0,focusin:!0,focusout:!0,click:!0,dblclick:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,wheel:!0,beforeinput:!0,input:!0,keydown:!0,keyup:!0,compositionstart:!0,compositionupdate:!0,compositionend:!0,touchstart:!0,touchend:!0,touchmove:!0,touchcancel:!0,pointerover:!0, | ||
pointerenter:!0,pointerdown:!0,pointermove:!0,pointerup:!0,pointercancel:!0,pointerout:!0,pointerleave:!0,gotpointercapture:!0,lostpointercapture:!0,dragstart:!0,drag:!0,dragenter:!0,dragleave:!0,dragover:!0,drop:!0,dragend:!0,DOMActivate:!0,DOMFocusIn:!0,DOMFocusOut:!0,keypress:!0},Db={DOMAttrModified:!0,DOMAttributeNameChanged:!0,DOMCharacterDataModified:!0,DOMElementNameChanged:!0,DOMNodeInserted:!0,DOMNodeInsertedIntoDocument:!0,DOMNodeRemoved:!0,DOMNodeRemovedFromDocument:!0,DOMSubtreeModified:!0}; | ||
function Eb(a){return a instanceof Node?a.__shady_getRootNode():a}function S(a,b){var c=[],d=a;for(a=Eb(a);d;)c.push(d),d.__shady_assignedSlot?d=d.__shady_assignedSlot:d.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&d.host&&(b||d!==a)?d=d.host:d=d.__shady_parentNode;c[c.length-1]===document&&c.push(window);return c}function Fb(a){a.l||(a.l=S(a.target,!0));return a.l} | ||
function Gb(a,b){if(!x)return a;a=S(a,!0);for(var c=0,d,e,f,h;c<b.length;c++)if(d=b[c],f=Eb(d),f!==e&&(h=a.indexOf(f),e=f),!x(f)||-1<h)return d}function Hb(a){function b(b,d){b=new a(b,d);b.u=d&&!!d.composed;return b}b.__proto__=a;b.prototype=a.prototype;return b}var Ib={focus:!0,blur:!0};function Jb(a){return a.__target!==a.target||a.G!==a.relatedTarget} | ||
function Kb(a,b,c){if(c=b.__handlers&&b.__handlers[a.type]&&b.__handlers[a.type][c])for(var d=0,e;(e=c[d])&&(!Jb(a)||a.target!==a.relatedTarget)&&(e.call(b,a),!a.P);d++);} | ||
function Lb(a){var b=a.composedPath();Object.defineProperty(a,"currentTarget",{get:function(){return d},configurable:!0});for(var c=b.length-1;0<=c;c--){var d=b[c];Kb(a,d,"capture");if(a.F)return}Object.defineProperty(a,"eventPhase",{get:function(){return Event.AT_TARGET}});var e;for(c=0;c<b.length;c++){d=b[c];var f=u(d);f=f&&f.root;if(0===c||f&&f===e)if(Kb(a,d,"bubble"),d!==window&&(e=d.__shady_getRootNode()),a.F)break}} | ||
function Mb(a,b,c,d,e,f){for(var h=0;h<a.length;h++){var g=a[h],k=g.type,l=g.capture,n=g.once,q=g.passive;if(b===g.node&&c===k&&d===l&&e===n&&f===q)return h}return-1} | ||
function Nb(a,b,c){if(b){var d=typeof b;if("function"===d||"object"===d)if("object"!==d||b.handleEvent&&"function"===typeof b.handleEvent){if(Db[a])return this.__shady_native_addEventListener(a,b,c);if(c&&"object"===typeof c){var e=!!c.capture;var f=!!c.once;var h=!!c.passive}else e=!!c,h=f=!1;var g=c&&c.H||this,k=b[R];if(k){if(-1<Mb(k,g,a,e,f,h))return}else b[R]=[];k=function(e){f&&this.__shady_removeEventListener(a,b,c);e.__target||Ob(e);if(g!==this){var h=Object.getOwnPropertyDescriptor(e,"currentTarget"); | ||
Object.defineProperty(e,"currentTarget",{get:function(){return g},configurable:!0})}e.__previousCurrentTarget=e.currentTarget;if(!x(g)||-1!=e.composedPath().indexOf(g))if(e.composed||-1<e.composedPath().indexOf(g))if(Jb(e)&&e.target===e.relatedTarget)e.eventPhase===Event.BUBBLING_PHASE&&e.stopImmediatePropagation();else if(e.eventPhase===Event.CAPTURING_PHASE||e.bubbles||e.target===g||g instanceof Window){var k="function"===d?b.call(g,e):b.handleEvent&&b.handleEvent(e);g!==this&&(h?(Object.defineProperty(e, | ||
"currentTarget",h),h=null):delete e.currentTarget);return k}};b[R].push({node:g,type:a,capture:e,once:f,passive:h,Z:k});Ib[a]?(this.__handlers=this.__handlers||{},this.__handlers[a]=this.__handlers[a]||{capture:[],bubble:[]},this.__handlers[a][e?"capture":"bubble"].push(k)):this.__shady_native_addEventListener(a,k,c)}}} | ||
function Pb(a,b,c){if(b){if(Db[a])return this.__shady_native_removeEventListener(a,b,c);if(c&&"object"===typeof c){var d=!!c.capture;var e=!!c.once;var f=!!c.passive}else d=!!c,f=e=!1;var h=c&&c.H||this,g=void 0;var k=null;try{k=b[R]}catch(l){}k&&(e=Mb(k,h,a,d,e,f),-1<e&&(g=k.splice(e,1)[0].Z,k.length||(b[R]=void 0)));this.__shady_native_removeEventListener(a,g||b,c);g&&Ib[a]&&this.__handlers&&this.__handlers[a]&&(a=this.__handlers[a][d?"capture":"bubble"],g=a.indexOf(g),-1<g&&a.splice(g,1))}} | ||
function Qb(){for(var a in Ib)window.__shady_native_addEventListener(a,function(a){a.__target||(Ob(a),Lb(a))},!0)} | ||
var Rb=B({get composed(){void 0===this.u&&(Bb?this.u="focusin"===this.type||"focusout"===this.type||Bb(this):!1!==this.isTrusted&&(this.u=Cb[this.type]));return this.u||!1},composedPath:function(){this.l||(this.l=S(this.__target,this.composed));return this.l},get target(){return Gb(this.currentTarget||this.__previousCurrentTarget,this.composedPath())},get relatedTarget(){if(!this.G)return null;this.M||(this.M=S(this.G,!0));return Gb(this.currentTarget||this.__previousCurrentTarget,this.M)},stopPropagation:function(){Event.prototype.stopPropagation.call(this); | ||
this.F=!0},stopImmediatePropagation:function(){Event.prototype.stopImmediatePropagation.call(this);this.F=this.P=!0}});function Ob(a){a.__target=a.target;a.G=a.relatedTarget;if(v.f){var b=Object.getPrototypeOf(a);if(!Object.hasOwnProperty(b,"__shady_patchedProto")){var c=Object.create(b);c.__shady_sourceProto=b;A(c,Rb);b.__shady_patchedProto=c}a.__proto__=b.__shady_patchedProto}else A(a,Rb)}var Sb=Hb(Event),Tb=Hb(CustomEvent),Ub=Hb(MouseEvent); | ||
function Vb(){if(!Bb&&Object.getOwnPropertyDescriptor(Event.prototype,"isTrusted")){var a=function(){var a=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0});this.__shady_dispatchEvent(a)};Element.prototype.click?Element.prototype.click=a:HTMLElement.prototype.click&&(HTMLElement.prototype.click=a)}}var Wb=Object.getOwnPropertyNames(Document.prototype).filter(function(a){return"on"===a.substring(0,2)});var T=v.f,Xb={querySelector:function(a){return this.__shady_native_querySelector(a)},querySelectorAll:function(a){return this.__shady_native_querySelectorAll(a)}},Yb={};function Zb(a){Yb[a]=function(b){return b["__shady_native_"+a]}}function U(a,b){A(a,b,"__shady_native_");for(var c in b)Zb(c)}function V(a,b){b=void 0===b?[]:b;for(var c=0;c<b.length;c++){var d=b[c],e=Object.getOwnPropertyDescriptor(a,d);e&&(Object.defineProperty(a,"__shady_native_"+d,e),e.value?Xb[d]||(Xb[d]=e.value):Zb(d))}} | ||
var W=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),X=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1),$b=document.implementation.createHTMLDocument("inert");function ac(a){for(var b;b=a.__shady_native_firstChild;)a.__shady_native_removeChild(b)}var bc=["firstElementChild","lastElementChild","children","childElementCount"],cc=["querySelector","querySelectorAll"]; | ||
function dc(){var a=["dispatchEvent","addEventListener","removeEventListener"];window.EventTarget?V(window.EventTarget.prototype,a):(V(Node.prototype,a),V(Window.prototype,a));T?V(Node.prototype,"parentNode firstChild lastChild previousSibling nextSibling childNodes parentElement textContent".split(" ")):U(Node.prototype,{parentNode:{get:function(){W.currentNode=this;return W.parentNode()}},firstChild:{get:function(){W.currentNode=this;return W.firstChild()}},lastChild:{get:function(){W.currentNode= | ||
this;return W.lastChild()}},previousSibling:{get:function(){W.currentNode=this;return W.previousSibling()}},nextSibling:{get:function(){W.currentNode=this;return W.nextSibling()}},childNodes:{get:function(){var a=[];W.currentNode=this;for(var c=W.firstChild();c;)a.push(c),c=W.nextSibling();return a}},parentElement:{get:function(){X.currentNode=this;return X.parentNode()}},textContent:{get:function(){switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:for(var a=document.createTreeWalker(this, | ||
NodeFilter.SHOW_TEXT,null,!1),c="",d;d=a.nextNode();)c+=d.nodeValue;return c;default:return this.nodeValue}},set:function(a){if("undefined"===typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:ac(this);(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_native_insertBefore(document.createTextNode(a),void 0);break;default:this.nodeValue=a}}}});V(Node.prototype,"appendChild insertBefore removeChild replaceChild cloneNode contains".split(" ")); | ||
a={firstElementChild:{get:function(){X.currentNode=this;return X.firstChild()}},lastElementChild:{get:function(){X.currentNode=this;return X.lastChild()}},children:{get:function(){var a=[];X.currentNode=this;for(var c=X.firstChild();c;)a.push(c),c=X.nextSibling();return wa(a)}},childElementCount:{get:function(){return this.children.length}}};T?(V(Element.prototype,bc),V(Element.prototype,["previousElementSibling","nextElementSibling","innerHTML"]),Object.getOwnPropertyDescriptor(HTMLElement.prototype, | ||
"children")&&V(HTMLElement.prototype,["children"]),Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")&&V(HTMLElement.prototype,["innerHTML"])):(U(Element.prototype,a),U(Element.prototype,{previousElementSibling:{get:function(){X.currentNode=this;return X.previousSibling()}},nextElementSibling:{get:function(){X.currentNode=this;return X.nextSibling()}},innerHTML:{get:function(){return hb(this,function(a){return a.__shady_native_childNodes})},set:function(a){var b="template"===this.localName? | ||
this.content:this;ac(b);var d=this.localName||"div";d=this.namespaceURI&&this.namespaceURI!==$b.namespaceURI?$b.createElementNS(this.namespaceURI,d):$b.createElement(d);d.innerHTML=a;for(a="template"===this.localName?d.content:d;d=a.__shady_native_firstChild;)b.__shady_native_insertBefore(d,void 0)}}}));V(Element.prototype,"setAttribute getAttribute hasAttribute removeAttribute focus blur".split(" "));V(Element.prototype,cc);V(HTMLElement.prototype,["focus","blur","contains"]);T&&V(HTMLElement.prototype, | ||
["parentElement","children","innerHTML"]);window.HTMLTemplateElement&&V(window.HTMLTemplateElement.prototype,["innerHTML"]);T?V(DocumentFragment.prototype,bc):U(DocumentFragment.prototype,a);V(DocumentFragment.prototype,cc);T?(V(DocumentFragment.prototype,bc),V(Document.prototype,["activeElement"])):U(Document.prototype,a);V(Document.prototype,["importNode","getElementById"]);V(Document.prototype,cc)};var ec=B({dispatchEvent:function(a){D();return this.__shady_native_dispatchEvent(a)},addEventListener:Nb,removeEventListener:Pb});var fc=B({get assignedSlot(){var a=this.__shady_parentNode;(a=a&&a.__shady_shadowRoot)&&pb(a);return(a=u(this))&&a.assignedSlot||null}});var gc=null;function H(){gc||(gc=window.ShadyCSS&&window.ShadyCSS.ScopingShim);return gc||null}function Ta(a,b){var c=H();c&&c.unscopeNode(a,b)}function Ra(a,b){var c=H();if(!c)return!0;if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){c=!0;a=a.__shady_childNodes;for(var d=0;c&&d<a.length;d++)c=c&&Ra(a[d],b);return c}return a.nodeType!==Node.ELEMENT_NODE?!0:c.currentScopeForNode(a)===b}function G(a){if(a.nodeType!==Node.ELEMENT_NODE)return"";var b=H();return b?b.currentScopeForNode(a):""} | ||
function Sa(a,b){if(a){a.nodeType===Node.ELEMENT_NODE&&b(a);a=a.__shady_childNodes;for(var c=0,d;c<a.length;c++)d=a[c],d.nodeType===Node.ELEMENT_NODE&&Sa(d,b)}};var hc=window.document;function ic(a,b){if("slot"===b)a=a.__shady_parentNode,na(a)&&I(u(a).root);else if("slot"===a.localName&&"name"===b&&(b=y(a))){if(b.a){O(b);var c=a.T,d=tb(a);if(d!==c){c=b.b[c];var e=c.indexOf(a);0<=e&&c.splice(e,1);c=b.b[d]||(b.b[d]=[]);c.push(a);1<c.length&&(b.b[d]=ub(c))}}I(b)}} | ||
var jc=B({get previousElementSibling(){var a=u(this);if(a&&void 0!==a.previousSibling){for(a=this.__shady_previousSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_previousElementSibling},get nextElementSibling(){var a=u(this);if(a&&void 0!==a.nextSibling){for(a=this.__shady_nextSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_nextElementSibling},get slot(){return this.getAttribute("slot")}, | ||
set slot(a){this.__shady_setAttribute("slot",a)},get shadowRoot(){var a=u(this);return a&&a.O||null},get className(){return this.getAttribute("class")||""},set className(a){this.__shady_setAttribute("class",a)},setAttribute:function(a,b){if(this.ownerDocument!==hc)this.__shady_native_setAttribute(a,b);else{var c;(c=H())&&"class"===a?(c.setElementClass(this,b),c=!0):c=!1;c||(this.__shady_native_setAttribute(a,b),ic(this,a))}},removeAttribute:function(a){this.__shady_native_removeAttribute(a);ic(this, | ||
a)},attachShadow:function(a){if(!this)throw"Must provide a host.";if(!a)throw"Not enough arguments.";return new N(mb,this,a)}});var kc=B({blur:function(){var a=u(this);(a=(a=a&&a.root)&&a.activeElement)?a.__shady_blur():this.__shady_native_blur()}});Wb.forEach(function(a){kc[a]={set:function(b){var c=t(this),d=a.substring(2);c.v[a]&&this.removeEventListener(d,c.v[a]);this.__shady_addEventListener(d,b);c.v[a]=b},get:function(){var b=u(this);return b&&b.v[a]},configurable:!0}});var lc=B({assignedNodes:function(a){if("slot"===this.localName){var b=this.__shady_getRootNode();b&&x(b)&&pb(b);return(b=u(this))?(a&&a.flatten?b.h:b.assignedNodes)||[]:[]}}});var mc=window.document,nc=B({importNode:function(a,b){if(a.ownerDocument!==mc||"template"===a.localName)return this.__shady_native_importNode(a,b);var c=this.__shady_native_importNode(a,!1);if(b){a=a.__shady_childNodes;b=0;for(var d;b<a.length;b++)d=this.__shady_importNode(a[b],!0),c.__shady_appendChild(d)}return c}});var oc=B({addEventListener:Nb.bind(window),removeEventListener:Pb.bind(window)});var Y={};Object.getOwnPropertyDescriptor(HTMLElement.prototype,"parentElement")&&(Y.parentElement=J.parentElement);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"contains")&&(Y.contains=J.contains);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"children")&&(Y.children=K.children);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")&&(Y.innerHTML=jb.innerHTML); | ||
var pc={EventTarget:[ec],Node:[J,window.EventTarget?null:ec],Text:[fc],Element:[jc,K,fc,!v.f||"innerHTML"in Element.prototype?jb:null,window.HTMLSlotElement?null:lc],HTMLElement:[kc,Y],HTMLSlotElement:[lc],DocumentFragment:[Ya,Za],Document:[nc,Ya,Za,$a],Window:[oc]};function qc(a){var b={},c;for(c in pc)b.D=window[c]&&window[c].prototype,pc[c].forEach(function(b){return function(c){return b.D&&c&&A(b.D,c,a)}}(b)),b={D:b.D}};function Z(a){this.node=a}m=Z.prototype;m.addEventListener=function(a,b,c){return this.node.__shady_addEventListener(a,b,c)};m.removeEventListener=function(a,b,c){return this.node.__shady_removeEventListener(a,b,c)};m.appendChild=function(a){return this.node.__shady_appendChild(a)};m.insertBefore=function(a,b){return this.node.__shady_insertBefore(a,b)};m.removeChild=function(a){return this.node.__shady_removeChild(a)};m.replaceChild=function(a,b){return this.node.__shady_replaceChild(a,b)}; | ||
m.cloneNode=function(a){return this.node.__shady_cloneNode(a)};m.getRootNode=function(a){return this.node.__shady_getRootNode(a)};m.contains=function(a){return this.node.__shady_contains(a)};m.dispatchEvent=function(a){return this.node.__shady_dispatchEvent(a)};m.setAttribute=function(a,b){this.node.__shady_setAttribute(a,b)};m.getAttribute=function(a){return this.node.__shady_native_getAttribute(a)};m.removeAttribute=function(a){this.node.__shady_removeAttribute(a)};m.attachShadow=function(a){return this.node.__shady_attachShadow(a)}; | ||
m.focus=function(){this.node.__shady_native_focus()};m.blur=function(){this.node.__shady_blur()};m.importNode=function(a,b){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_importNode(a,b)};m.getElementById=function(a){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_getElementById(a)};m.querySelector=function(a){return this.node.__shady_querySelector(a)};m.querySelectorAll=function(a,b){return this.node.__shady_querySelectorAll(a,b)}; | ||
m.assignedNodes=function(a){if("slot"===this.node.localName)return this.node.__shady_assignedNodes(a)}; | ||
p.Object.defineProperties(Z.prototype,{activeElement:{configurable:!0,enumerable:!0,get:function(){if(x(this.node)||this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_activeElement}},_activeElement:{configurable:!0,enumerable:!0,get:function(){return this.activeElement}},host:{configurable:!0,enumerable:!0,get:function(){if(x(this.node))return this.node.host}},parentNode:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_parentNode}},firstChild:{configurable:!0,enumerable:!0, | ||
get:function(){return this.node.__shady_firstChild}},lastChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_lastChild}},nextSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_nextSibling}},previousSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_previousSibling}},childNodes:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_childNodes}},parentElement:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_parentElement}}, | ||
firstElementChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_firstElementChild}},lastElementChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_lastElementChild}},nextElementSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_nextElementSibling}},previousElementSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_previousElementSibling}},children:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_children}}, | ||
childElementCount:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_childElementCount}},shadowRoot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_shadowRoot}},assignedSlot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_assignedSlot}},isConnected:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_isConnected}},innerHTML:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_innerHTML},set:function(a){this.node.__shady_innerHTML= | ||
a}},textContent:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_textContent},set:function(a){this.node.__shady_textContent=a}},slot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_slot},set:function(a){this.node.__shady_slot=a}}});Wb.forEach(function(a){Object.defineProperty(Z.prototype,a,{get:function(){return this.node["__shady_"+a]},set:function(b){this.node["__shady_"+a]=b},configurable:!0})});var rc=new WeakMap; | ||
function sc(a){if(x(a)||a instanceof Z)return a;var b=rc.get(a);b||(b=new Z(a),rc.set(a,b));return b};v.J&&(window.ShadyDOM={inUse:v.J,patch:function(a){Da(a);Ca(a);return a},isShadyRoot:x,enqueue:ya,flush:D,settings:v,filterMutations:Ab,observeChildren:yb,unobserveChildren:zb,deferConnectionCallbacks:v.deferConnectionCallbacks,preferPerformance:v.preferPerformance,handlesDynamicScoping:!0,wrap:v.m?sc:function(a){return a},Wrapper:Z,composedPath:Fb,noPatch:v.m,nativeMethods:Xb,nativeTree:Yb},dc(),qc("__shady_"),Object.defineProperty(document,"_activeElement",$a.activeElement),A(Window.prototype,oc, | ||
"__shady_"),v.m||(qc(),Vb()),Qb(),window.Event=Sb,window.CustomEvent=Tb,window.MouseEvent=Ub,window.ShadowRoot=N);}).call(this); | ||
//# sourceMappingURL=shadydom.min.js.map |
@@ -14,9 +14,6 @@ /** | ||
import {enqueue} from './flush.js'; | ||
import {recordChildNodes} from './logical-tree.js'; | ||
import {removeChild, insertBefore, dispatchEvent} from './native-methods.js'; | ||
import {accessors} from './native-tree.js'; | ||
import {ensureShadyDataForNode, shadyDataForNode} from './shady-data.js'; | ||
import {recordChildNodes} from './link-nodes.js'; | ||
import {patchShadyRoot} from './patch-shadyRoot.js'; | ||
const {parentNode, childNodes} = accessors; | ||
// Do not export this object. It must be passed as the first argument to the | ||
@@ -40,3 +37,3 @@ // ShadyRoot constructor in `attachShadow` to prevent the constructor from | ||
ancestors.unshift(node); | ||
} while ((node = node.parentNode)); | ||
} while ((node = node[utils.SHADY_PREFIX + 'parentNode'])); | ||
return ancestors; | ||
@@ -60,8 +57,7 @@ } | ||
this.host = host; | ||
this._mode = options && options.mode; | ||
const c$ = childNodes(host); | ||
recordChildNodes(host, c$); | ||
this.mode = options && options.mode; | ||
recordChildNodes(host); | ||
const hostData = ensureShadyDataForNode(host); | ||
hostData.root = this; | ||
hostData.publicRoot = this._mode !== MODE_CLOSED ? this : null; | ||
hostData.publicRoot = this.mode !== MODE_CLOSED ? this : null; | ||
// setup root | ||
@@ -84,4 +80,5 @@ const rootData = ensureShadyDataForNode(this); | ||
if (utils.settings['preferPerformance']) { | ||
for (let i=0, l=c$.length; i < l; i++) { | ||
removeChild.call(host, c$[i]) | ||
let n; | ||
while ((n = host[utils.NATIVE_PREFIX + 'firstChild'])) { | ||
host[utils.NATIVE_PREFIX + 'removeChild'](n); | ||
} | ||
@@ -117,5 +114,5 @@ } else { | ||
_rendererForHost() { | ||
let root = this.host.getRootNode(); | ||
let root = this.host[utils.SHADY_PREFIX + 'getRootNode'](); | ||
if (utils.isShadyRoot(root)) { | ||
let c$ = this.host.childNodes; | ||
let c$ = this.host[utils.SHADY_PREFIX + 'childNodes']; | ||
for (let i=0, c; i < c$.length; i++) { | ||
@@ -137,2 +134,10 @@ c = c$[i]; | ||
// renders if render is pending. | ||
_flush() { | ||
const root = this._getRenderRoot(); | ||
if (root && root._renderPending) { | ||
root['_renderRoot'](); | ||
} | ||
} | ||
// NOTE: avoid renaming to ease testability. | ||
@@ -152,9 +157,9 @@ ['_renderRoot']() { | ||
if (!utils.settings['preferPerformance'] && !this._hasRendered) { | ||
const c$ = this.host.childNodes; | ||
const c$ = this.host[utils.SHADY_PREFIX + 'childNodes']; | ||
for (let i=0, l=c$.length; i < l; i++) { | ||
const child = c$[i]; | ||
const data = shadyDataForNode(child); | ||
if (parentNode(child) === this.host && | ||
if (child[utils.NATIVE_PREFIX + 'parentNode'] === this.host && | ||
(child.localName === 'slot' || !data.assignedSlot)) { | ||
removeChild.call(this.host, child); | ||
this.host[utils.NATIVE_PREFIX + 'removeChild'](child); | ||
} | ||
@@ -178,3 +183,3 @@ } | ||
// distribute host children. | ||
for (let n=this.host.firstChild; n; n=n.nextSibling) { | ||
for (let n=this.host[utils.SHADY_PREFIX + 'firstChild']; n; n=n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
this._distributeNodeToSlot(n); | ||
@@ -188,7 +193,7 @@ } | ||
if (!slotData.assignedNodes.length) { | ||
for (let n=slot.firstChild; n; n=n.nextSibling) { | ||
for (let n=slot[utils.SHADY_PREFIX + 'firstChild']; n; n=n[utils.SHADY_PREFIX + 'nextSibling']) { | ||
this._distributeNodeToSlot(n, slot); | ||
} | ||
} | ||
const slotParentData = shadyDataForNode(slot.parentNode); | ||
const slotParentData = shadyDataForNode(slot[utils.SHADY_PREFIX + 'parentNode']); | ||
const slotParentRoot = slotParentData && slotParentData.root; | ||
@@ -238,3 +243,3 @@ if (slotParentRoot && (slotParentRoot._hasInsertionPoint() || slotParentRoot._renderPending)) { | ||
if (!slot) { | ||
let name = node.slot || CATCHALL_NAME; | ||
let name = node[utils.SHADY_PREFIX + 'slot'] || CATCHALL_NAME; | ||
const list = this._slotMap[name]; | ||
@@ -303,3 +308,3 @@ slot = list && list[0]; | ||
// Spec says it bubbles (https://dom.spec.whatwg.org/#mutation-observers) | ||
dispatchEvent.call(slot, new Event('slotchange')); | ||
slot[utils.NATIVE_PREFIX + 'dispatchEvent'](new Event('slotchange')); | ||
const slotData = shadyDataForNode(slot); | ||
@@ -320,3 +325,3 @@ if (slotData.assignedSlot) { | ||
for (let i=0; i < slots.length; i++) { | ||
const parent = slots[i].parentNode; | ||
const parent = slots[i][utils.SHADY_PREFIX + 'parentNode']; | ||
/* compose node only if: | ||
@@ -344,3 +349,3 @@ (1) parent does not have a shadowRoot since shadowRoot has already | ||
let children = []; | ||
let c$ = node.childNodes; | ||
let c$ = node[utils.SHADY_PREFIX + 'childNodes']; | ||
for (let i = 0; i < c$.length; i++) { | ||
@@ -370,3 +375,3 @@ let child = c$[i]; | ||
_updateChildNodes(container, children) { | ||
let composed = childNodes(container); | ||
let composed = Array.prototype.slice.call(container[utils.NATIVE_PREFIX + 'childNodes']); | ||
let splices = calculateSplices(children, composed); | ||
@@ -380,4 +385,4 @@ // process removals | ||
// the node being removed here. | ||
if (parentNode(n) === container) { | ||
removeChild.call(container, n); | ||
if (n[utils.NATIVE_PREFIX + 'parentNode'] === container) { | ||
container[utils.NATIVE_PREFIX + 'removeChild'](n); | ||
} | ||
@@ -394,3 +399,3 @@ // TODO(sorvell): avoid the need for splicing here. | ||
n = children[j]; | ||
insertBefore.call(container, n, next); | ||
container[utils.NATIVE_PREFIX + 'insertBefore'](n, next); | ||
composed.splice(j, 0, n); | ||
@@ -433,3 +438,3 @@ } | ||
recordChildNodes(slot); | ||
recordChildNodes(slot.parentNode); | ||
recordChildNodes(slot[utils.SHADY_PREFIX + 'parentNode']); | ||
let name = this._nameForSlot(slot); | ||
@@ -473,3 +478,3 @@ if (this._slotMap[name]) { | ||
if (nA !== nB) { | ||
let c$ = Array.from(nA.parentNode.childNodes); | ||
let c$ = Array.from(nA[utils.SHADY_PREFIX + 'parentNode'][utils.SHADY_PREFIX + 'childNodes']); | ||
return c$.indexOf(nA) - c$.indexOf(nB); | ||
@@ -543,5 +548,5 @@ } | ||
let node = n$[i]; | ||
let parent = parentNode(node); | ||
let parent = node[utils.NATIVE_PREFIX + 'parentNode']; | ||
if (parent) { | ||
removeChild.call(parent, node); | ||
parent[utils.NATIVE_PREFIX + 'removeChild'](node); | ||
} | ||
@@ -560,2 +565,3 @@ } | ||
patchShadyRoot(ShadyRoot.prototype); | ||
export {ShadyRoot}; | ||
@@ -567,3 +573,3 @@ | ||
*/ | ||
export function attachShadow(host, options) { | ||
export const attachShadow = (host, options) => { | ||
if (!host) { | ||
@@ -586,5 +592,10 @@ throw 'Must provide a host.'; | ||
// allow elements to connect | ||
const map = Array.from(connectMap); | ||
// save map state (without needing polyfills on IE11) | ||
const r = []; | ||
connectMap.forEach((v, k) => { | ||
r.push([k, v]); | ||
}); | ||
connectMap.clear(); | ||
for (const [e, value] of map) { | ||
for (let i=0; i < r.length; i++) { | ||
const e = r[i][0], value = r[i][1]; | ||
if (value) { | ||
@@ -591,0 +602,0 @@ e.__shadydom_connectedCallback(); |
@@ -12,3 +12,2 @@ /** | ||
import * as utils from './utils.js'; | ||
import * as nativeMethods from './native-methods.js'; | ||
import {shadyDataForNode} from './shady-data.js'; | ||
@@ -90,14 +89,29 @@ | ||
/** | ||
* Some EventTarget subclasses are not Node subclasses, and you cannot call | ||
* `getRootNode()` on them. | ||
* | ||
* @param {!(Node|EventTarget)} eventTarget | ||
* @return {!(Node|EventTarget)} | ||
*/ | ||
function getRootNodeWithFallback(eventTarget) { | ||
if (eventTarget instanceof Node) { | ||
return eventTarget[utils.SHADY_PREFIX + 'getRootNode'](); | ||
} else { | ||
return eventTarget; | ||
} | ||
} | ||
function pathComposer(startNode, composed) { | ||
let composedPath = []; | ||
let current = startNode; | ||
let startRoot = startNode === window ? window : startNode.getRootNode(); | ||
let startRoot = getRootNodeWithFallback(startNode); | ||
while (current) { | ||
composedPath.push(current); | ||
if (current.assignedSlot) { | ||
current = current.assignedSlot; | ||
if (current[utils.SHADY_PREFIX + 'assignedSlot']) { | ||
current = current[utils.SHADY_PREFIX + 'assignedSlot']; | ||
} else if (current.nodeType === Node.DOCUMENT_FRAGMENT_NODE && current.host && (composed || current !== startRoot)) { | ||
current = current.host; | ||
} else { | ||
current = current.parentNode; | ||
current = current[utils.SHADY_PREFIX + 'parentNode']; | ||
} | ||
@@ -112,2 +126,9 @@ } | ||
export const composedPath = (event) => { | ||
if (!event.__composedPath) { | ||
event.__composedPath = pathComposer(event.target, true); | ||
} | ||
return event.__composedPath; | ||
} | ||
function retarget(refNode, path) { | ||
@@ -123,3 +144,3 @@ if (!utils.isShadyRoot) { | ||
ancestor = p$[i]; | ||
root = ancestor === window ? window : ancestor.getRootNode(); | ||
root = getRootNodeWithFallback(ancestor); | ||
if (root !== lastRoot) { | ||
@@ -135,3 +156,3 @@ rootIdx = refNodePath.indexOf(root); | ||
let eventMixin = { | ||
let EventPatches = { | ||
@@ -213,3 +234,3 @@ /** | ||
// put constructor properties on subclass | ||
utils.mixin(klazz, Base); | ||
klazz.__proto__ = Base; | ||
klazz.prototype = Base.prototype; | ||
@@ -289,3 +310,3 @@ return klazz; | ||
if (node !== window) { | ||
lastFiredRoot = node.getRootNode(); | ||
lastFiredRoot = node[utils.SHADY_PREFIX + 'getRootNode'](); | ||
} | ||
@@ -356,7 +377,4 @@ if (e.__propagationStopped) { | ||
const ael = this instanceof Window ? nativeMethods.windowAddEventListener : | ||
nativeMethods.addEventListener; | ||
if (unpatchedEvents[type]) { | ||
return ael.call(this, type, fnOrObj, optionsOrCapture); | ||
return this[utils.NATIVE_PREFIX + 'addEventListener'](type, fnOrObj, optionsOrCapture); | ||
} | ||
@@ -402,3 +420,3 @@ | ||
if (once) { | ||
this.removeEventListener(type, fnOrObj, optionsOrCapture); | ||
this[utils.SHADY_PREFIX + 'removeEventListener'](type, fnOrObj, optionsOrCapture); | ||
} | ||
@@ -468,3 +486,3 @@ if (!e['__target']) { | ||
} else { | ||
ael.call(this, type, wrapperFn, optionsOrCapture); | ||
this[utils.NATIVE_PREFIX + 'addEventListener'](type, wrapperFn, optionsOrCapture); | ||
} | ||
@@ -480,6 +498,4 @@ } | ||
} | ||
const rel = this instanceof Window ? nativeMethods.windowRemoveEventListener : | ||
nativeMethods.removeEventListener; | ||
if (unpatchedEvents[type]) { | ||
return rel.call(this, type, fnOrObj, optionsOrCapture); | ||
return this[utils.NATIVE_PREFIX + 'removeEventListener'](type, fnOrObj, optionsOrCapture); | ||
} | ||
@@ -511,3 +527,3 @@ // NOTE(valdrin) invoking external functions is costly, inline has better perf. | ||
} | ||
rel.call(this, type, wrapperFn || fnOrObj, optionsOrCapture); | ||
this[utils.NATIVE_PREFIX + 'removeEventListener'](type, wrapperFn || fnOrObj, optionsOrCapture); | ||
if (wrapperFn && nonBubblingEventsToRetarget[type] && | ||
@@ -525,3 +541,3 @@ this.__handlers && this.__handlers[type]) { | ||
for (let ev in nonBubblingEventsToRetarget) { | ||
window.addEventListener(ev, function(e) { | ||
window[utils.NATIVE_PREFIX + 'addEventListener'](ev, function(e) { | ||
if (!e['__target']) { | ||
@@ -535,24 +551,39 @@ patchEvent(e); | ||
const EventPatchesDescriptors = utils.getOwnPropertyDescriptors(EventPatches); | ||
const SHADY_PROTO = '__shady_patchedProto'; | ||
const SHADY_SOURCE_PROTO = '__shady_sourceProto'; | ||
function patchEvent(event) { | ||
event['__target'] = event.target; | ||
event.__relatedTarget = event.relatedTarget; | ||
// patch event prototype if we can | ||
// attempt to patch prototype (via cache) | ||
if (utils.settings.hasDescriptors) { | ||
utils.patchPrototype(event, eventMixin); | ||
const proto = Object.getPrototypeOf(event); | ||
if (!Object.hasOwnProperty(proto, SHADY_PROTO)) { | ||
const patchedProto = Object.create(proto); | ||
patchedProto[SHADY_SOURCE_PROTO] = proto; | ||
utils.patchProperties(patchedProto, EventPatchesDescriptors); | ||
proto[SHADY_PROTO] = patchedProto; | ||
} | ||
event.__proto__ = proto[SHADY_PROTO]; | ||
// and fallback to patching instance | ||
} else { | ||
utils.extend(event, eventMixin); | ||
utils.patchProperties(event, EventPatchesDescriptors); | ||
} | ||
} | ||
let PatchedEvent = mixinComposedFlag(window.Event); | ||
let PatchedCustomEvent = mixinComposedFlag(window.CustomEvent); | ||
let PatchedMouseEvent = mixinComposedFlag(window.MouseEvent); | ||
let PatchedEvent = mixinComposedFlag(Event); | ||
let PatchedCustomEvent = mixinComposedFlag(CustomEvent); | ||
let PatchedMouseEvent = mixinComposedFlag(MouseEvent); | ||
export function patchEvents() { | ||
activateFocusEventOverrides(); | ||
window.Event = PatchedEvent; | ||
window.CustomEvent = PatchedCustomEvent; | ||
window.MouseEvent = PatchedMouseEvent; | ||
activateFocusEventOverrides(); | ||
} | ||
export function patchClick() { | ||
// Fix up `Element.prototype.click()` if `isTrusted` is supported, but `composed` isn't | ||
@@ -567,3 +598,3 @@ if (!composedGetter && Object.getOwnPropertyDescriptor(Event.prototype, 'isTrusted')) { | ||
}); | ||
this.dispatchEvent(ev); | ||
this[utils.SHADY_PREFIX + 'dispatchEvent'](ev); | ||
}; | ||
@@ -577,1 +608,4 @@ if (Element.prototype.click) { | ||
} | ||
export const eventPropertyNames = Object.getOwnPropertyNames(Document.prototype) | ||
.filter(name => name.substring(0,2) === 'on'); |
@@ -24,8 +24,8 @@ /** | ||
import {observeChildren, unobserveChildren, filterMutations} from './observe-changes.js'; | ||
import * as nativeMethods from './native-methods.js'; | ||
import {accessors as nativeTree} from './native-tree.js'; | ||
import {patchBuiltins} from './patch-builtins.js'; | ||
import {patchInsideElementAccessors, patchOutsideElementAccessors} from './patch-accessors.js'; | ||
import {patchEvents} from './patch-events.js'; | ||
import {addNativePrefixedProperties, nativeMethods, nativeTree} from './patch-native.js'; | ||
import {patchInsideElementAccessors, patchOutsideElementAccessors} from './patch-instances.js'; | ||
import {patchEvents, patchClick, composedPath} from './patch-events.js'; | ||
import {ShadyRoot} from './attach-shadow.js'; | ||
import {wrap, Wrapper} from './wrapper.js'; | ||
import {addShadyPrefixedProperties, applyPatches} from './patch-prototypes.js'; | ||
@@ -55,4 +55,2 @@ if (utils.settings.inUse) { | ||
'unobserveChildren': unobserveChildren, | ||
'nativeMethods': nativeMethods, | ||
'nativeTree': nativeTree, | ||
// Set to true to defer native custom elements connection until the | ||
@@ -75,3 +73,14 @@ // document has fully parsed. This enables custom elements that create | ||
// as ShadyDOM will now handle dynamic scoping. | ||
'handlesDynamicScoping': true | ||
'handlesDynamicScoping': true, | ||
'wrap': utils.settings.noPatch ? wrap : (n) => n, | ||
'Wrapper': Wrapper, | ||
'composedPath': composedPath, | ||
// Set to true to avoid patching regular platform property names. When set, | ||
// Shadow DOM compatible behavior is only available when accessing DOM | ||
// API using `ShadyDOM.wrap`, e.g. `ShadyDOM.wrap(element).shadowRoot`. | ||
// This setting provides a small performance boost, but requires all DOM API | ||
// access that requires Shadow DOM behavior to be proxied via `ShadyDOM.wrap`. | ||
'noPatch': utils.settings.noPatch, | ||
'nativeMethods': nativeMethods, | ||
'nativeTree': nativeTree | ||
}; | ||
@@ -81,8 +90,44 @@ | ||
// Apply patches to events... | ||
// Modifies native prototypes for Node, Element, etc. to | ||
// make native platform behavior available at prefixed names, e.g. | ||
// `utils.NATIVE_PREFIX + 'firstChild'` or `__shady_native_firstChild`. | ||
// This allows the standard names to be safely patched while retaining the | ||
// ability for native behavior to be used. This polyfill manipulates DOM | ||
// by using this saved native behavior. | ||
// Note, some browsers do not have proper element descriptors for | ||
// accessors; in this case, native behavior for these accessors is simulated | ||
// via a TreeWalker. | ||
addNativePrefixedProperties(); | ||
// Modifies native prototypes for Node, Element, etc. to make ShadowDOM | ||
// behavior available at prefixed names, e.g. | ||
// `utils.SHADY_PREFIX + 'firstChild` or `__shady_firstChild`. This is done | ||
// so this polyfill can perform Shadow DOM style DOM manipulation. | ||
// Because patching normal platform property names is optional, these prefixed | ||
// names are used internally. | ||
addShadyPrefixedProperties(); | ||
// Modifies native prototypes for Node, Element, etc. to patch | ||
// regular platform property names to have Shadow DOM compatible API behavior. | ||
// This applies the utils.SHADY_PREFIX behavior to normal names. For example, | ||
// if `noPatch` is not set, then `el.__shady_firstChild` is equivalent to | ||
// `el.firstChild`. | ||
// NOTE, on older browsers (old Chrome/Safari) native accessors cannot be | ||
// patched on prototypes (e.g. Node.prototype.firstChild cannot be modified). | ||
// On these browsers, instance level patching is performed where needed; this | ||
// instance patching is only done when `noPatch` is *not* set. | ||
if (!utils.settings.noPatch) { | ||
applyPatches(); | ||
// Patch click event behavior only if we're patching | ||
patchClick() | ||
} | ||
// For simplicity, patch events unconditionally. | ||
// Patches the event system to have Shadow DOM compatible behavior (e.g. | ||
// event retargeting). When `noPatch` is set, retargeting is only available | ||
// when adding event listeners and dispatching events via `ShadyDOM.wrap` | ||
// (e.g. `ShadyDOM.wrap(element).addEventListener(...)`). | ||
patchEvents(); | ||
// Apply patches to builtins (e.g. Element.prototype) where applicable. | ||
patchBuiltins(); | ||
window.ShadowRoot = ShadyRoot; | ||
} |
133
src/utils.js
@@ -12,20 +12,14 @@ /** | ||
export let settings = window['ShadyDOM'] || {}; | ||
export const settings = window['ShadyDOM'] || {}; | ||
settings.hasNativeShadowDOM = Boolean(Element.prototype.attachShadow && Node.prototype.getRootNode); | ||
let desc = Object.getOwnPropertyDescriptor(Node.prototype, 'firstChild'); | ||
const desc = Object.getOwnPropertyDescriptor(Node.prototype, 'firstChild'); | ||
settings.hasDescriptors = Boolean(desc && desc.configurable && desc.get); | ||
settings.inUse = settings['force'] || !settings.hasNativeShadowDOM; | ||
settings.noPatch = settings['noPatch'] || false; | ||
settings.preferPerformance = settings['preferPerformance']; | ||
// Default to using native accessors (instead of treewalker) only for | ||
// IE/Edge where they are faster. | ||
const IS_IE = navigator.userAgent.match('Trident'); | ||
const IS_EDGE = navigator.userAgent.match('Edge'); | ||
if (settings.useNativeAccessors === undefined) { | ||
settings.useNativeAccessors = settings.hasDescriptors && (IS_IE || IS_EDGE); | ||
} | ||
export function isTrackingLogicalChildNodes(node) { | ||
export const isTrackingLogicalChildNodes = (node) => { | ||
const nodeData = shadyDataForNode(node); | ||
@@ -35,8 +29,8 @@ return (nodeData && nodeData.firstChild !== undefined); | ||
export function isShadyRoot(obj) { | ||
export const isShadyRoot = (obj) => { | ||
return Boolean(obj._localName === 'ShadyRoot'); | ||
} | ||
export function ownerShadyRootForNode(node) { | ||
let root = node.getRootNode(); | ||
export const ownerShadyRootForNode = (node) => { | ||
let root = node[SHADY_PREFIX + 'getRootNode'](); | ||
if (isShadyRoot(root)) { | ||
@@ -47,2 +41,8 @@ return root; | ||
export const hasShadowRootWithSlot = (node) => { | ||
const nodeData = shadyDataForNode(node); | ||
let root = nodeData && nodeData.root; | ||
return (root && root._hasInsertionPoint()); | ||
} | ||
let p = Element.prototype; | ||
@@ -53,31 +53,7 @@ let matches = p.matches || p.matchesSelector || | ||
export function matchesSelector(element, selector) { | ||
export const matchesSelector = (element, selector) => { | ||
return matches.call(element, selector); | ||
} | ||
function copyOwnProperty(name, source, target) { | ||
let pd = Object.getOwnPropertyDescriptor(source, name); | ||
if (pd) { | ||
Object.defineProperty(target, name, pd); | ||
} | ||
} | ||
export function extend(target, source) { | ||
if (target && source) { | ||
let n$ = Object.getOwnPropertyNames(source); | ||
for (let i=0, n; (i<n$.length) && (n=n$[i]); i++) { | ||
copyOwnProperty(n, source, target); | ||
} | ||
} | ||
return target || source; | ||
} | ||
export function extendAll(target, ...sources) { | ||
for (let i=0; i < sources.length; i++) { | ||
extend(target, sources[i]); | ||
} | ||
return target; | ||
} | ||
export function mixin(target, source) { | ||
export const mixin = (target, source) => { | ||
for (var i in source) { | ||
@@ -89,15 +65,4 @@ target[i] = source[i]; | ||
export function patchPrototype(obj, mixin) { | ||
let proto = Object.getPrototypeOf(obj); | ||
if (!proto.hasOwnProperty('__patchProto')) { | ||
let patchProto = Object.create(proto); | ||
patchProto.__sourceProto = proto; | ||
extend(patchProto, mixin); | ||
proto['__patchProto'] = patchProto; | ||
} | ||
// old browsers don't have setPrototypeOf | ||
obj.__proto__ = proto['__patchProto']; | ||
} | ||
// NOTE, prefer MutationObserver over Promise for microtask timing | ||
// for consistency x-platform. | ||
let twiddle = document.createTextNode(''); | ||
@@ -120,3 +85,3 @@ let content = 0; | ||
// use MutationObserver to get microtask async timing. | ||
export function microtask(callback) { | ||
export const microtask = (callback) => { | ||
queue.push(callback); | ||
@@ -128,3 +93,3 @@ twiddle.textContent = content++; | ||
export function contains(container, node) { | ||
export const contains = (container, node) => { | ||
while (node) { | ||
@@ -134,3 +99,3 @@ if (node == container) { | ||
} | ||
node = node.parentNode; | ||
node = node[SHADY_PREFIX + 'parentNode']; | ||
} | ||
@@ -140,11 +105,8 @@ return false; | ||
function getNodeHTMLCollectionName(node) { | ||
return node.getAttribute('id') || node.getAttribute('name'); | ||
} | ||
const getNodeHTMLCollectionName = (node) => | ||
node.getAttribute('id') || node.getAttribute('name'); | ||
function isValidHTMLCollectionName(name) { | ||
return name !== 'length' && isNaN(name); | ||
} | ||
const isValidHTMLCollectionName = (name) => name !== 'length' && isNaN(name); | ||
export function createPolyfilledHTMLCollection(nodes) { | ||
export const createPolyfilledHTMLCollection = (nodes) => { | ||
// Note: loop in reverse so that the first named item matches the named property | ||
@@ -179,1 +141,46 @@ for (let l = nodes.length - 1; l >= 0; l--) { | ||
} | ||
export const NATIVE_PREFIX = '__shady_native_'; | ||
export const SHADY_PREFIX = '__shady_'; | ||
// patch a group of accessors on an object only if it exists or if the `force` | ||
// argument is true. | ||
/** | ||
* @param {!Object} obj | ||
* @param {!Object} descriptors | ||
* @param {boolean=} force | ||
*/ | ||
export const patchProperties = (proto, descriptors, prefix = '') => { | ||
for (let p in descriptors) { | ||
const newDescriptor = descriptors[p]; | ||
newDescriptor.configurable = true; | ||
const name = prefix + p; | ||
// NOTE: we prefer writing directly because some browsers | ||
// have descriptors that are writable but not configurable (e.g. | ||
// `appendChild` on older browsers) | ||
if (newDescriptor.value) { | ||
proto[name] = newDescriptor.value; | ||
} else { | ||
// NOTE: this can throw if 'force' is used so catch the error. | ||
try { | ||
Object.defineProperty(proto, name, newDescriptor); | ||
} catch(e) { | ||
// this error is harmless so we just trap it. | ||
} | ||
} | ||
} | ||
} | ||
export const NativeHTMLElement = | ||
(window['customElements'] && window['customElements']['nativeHTMLElement']) || | ||
HTMLElement; | ||
// note, this is not a perfect polyfill since it doesn't include symbols | ||
export const getOwnPropertyDescriptors = (obj) => { | ||
const descriptors = {}; | ||
Object.getOwnPropertyNames(obj).forEach((name) => { | ||
descriptors[name] = Object.getOwnPropertyDescriptor(obj, name); | ||
}); | ||
return descriptors; | ||
}; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
433234
35
4325
16
1