blob: e9d570e00100e118b6cd21ac0a68f7315666b492 [file] [log] [blame]
if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateShadowRoot||window.__forceShadowDomPolyfill){(function(){Element.prototype.webkitCreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return window.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})})();var SideTable;"undefined"!=typeof WeakMap&&0>navigator.userAgent.indexOf("Firefox/")?SideTable=WeakMap:function(){var e=Object.defineProperty,t=Object.hasOwnProperty,n=(new Date).getTime()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(n++ +"__")},SideTable.prototype={set:function(t,n){e(t,this.name,{value:n,writable:!0})},get:function(e){return t.call(e,this.name)?e[this.name]:void 0},"delete":function(e){this.set(e,void 0)}}}();var ShadowDOMPolyfill={};(function(e){"use strict";function t(e){if(!e)throw new Error("Assertion failed")}function n(e,t){return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function r(e,t){return Object.getOwnPropertyNames(t).forEach(function(n){switch(n){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":return}Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function i(e){var t=e.__proto__||Object.getPrototypeOf(e),n=M.get(t);if(n)return n;var r=i(t),o=p(r);return u(t,o,e),o}function o(e,t){l(e,t,!0)}function a(e,t){l(t,e,!1)}function l(e,t,n){Object.getOwnPropertyNames(e).forEach(function(r){if(!(r in t)){L&&e.__lookupGetter__(r);var i;try{i=Object.getOwnPropertyDescriptor(e,r)}catch(o){i=C}var a,l;if(n&&"function"==typeof i.value)return t[r]=function(){return this.impl[r].apply(this.impl,arguments)},void 0;a=function(){return this.impl[r]},(i.writable||i.set)&&(l=function(e){this.impl[r]=e}),Object.defineProperty(t,r,{get:a,set:l,configurable:i.configurable,enumerable:i.enumerable})}})}function s(e,t,n){var i=e.prototype;u(i,t,n),r(t,e)}function u(e,n,r){var i=n.prototype;t(void 0===M.get(e)),M.set(e,n),o(e,i),r&&a(i,r)}function c(e,t){return M.get(t.prototype)===e}function d(e){var t=Object.getPrototypeOf(e),n=i(t),r=p(n);return u(t,r,e),r}function p(e){function t(t){e.call(this,t)}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t._ShadowDOMPolyfill$isGeneratedWrapper=!0,t}function h(e){return e instanceof N.EventTarget||e instanceof N.Event||e instanceof N.DOMImplementation}function f(e){return e instanceof D||e instanceof O||e instanceof _||e instanceof H}function m(e){if(null===e)return null;t(f(e));var n=S.get(e);if(!n){var r=i(e);n=new r(e),S.set(e,n)}return n}function g(e){return null===e?null:(t(h(e)),e.impl)}function w(e){return e&&h(e)?g(e):e}function v(e){return e&&!h(e)?m(e):e}function E(e,n){null!==n&&(t(f(e)),t(void 0===n||h(n)),S.set(e,n))}function y(e,t,n){Object.defineProperty(e.prototype,t,{get:n,configurable:!0,enumerable:!0})}function T(e,t){y(e,t,function(){return m(this.impl[t])})}function b(e,t){e.forEach(function(e){t.forEach(function(t){e.prototype[t]=function(){var e=m(this);return e[t].apply(e,arguments)}})})}var S=new SideTable,M=new SideTable,N=Object.create(null);Object.getOwnPropertyNames(window);var L=/Firefox/.test(navigator.userAgent),C={get:function(){},set:function(){},configurable:!0,enumerable:!0},H=DOMImplementation,O=Event,D=Node,_=Window;e.assert=t,e.defineGetter=y,e.defineWrapGetter=T,e.forwardMethodsToWrapper=b,e.isWrapper=h,e.isWrapperFor=c,e.mixin=n,e.registerObject=d,e.registerWrapper=s,e.rewrap=E,e.unwrap=g,e.unwrapIfNeeded=w,e.wrap=m,e.wrapIfNeeded=v,e.wrappers=N})(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e instanceof I.ShadowRoot}function n(e){var t=e.localName;return"content"===t||"shadow"===t}function r(e){return!!e.shadowRoot}function i(e){var t;return e.parentNode||(t=e.defaultView)&&R(t)||null}function o(o,a,l){if(l.length)return l.shift();if(t(o))return o.insertionParent||e.getHostForShadowRoot(o);var s=e.eventParentsTable.get(o);if(s){for(var u=1;s.length>u;u++)l[u-1]=s[u];return s[0]}if(a&&n(o)){var c=o.parentNode;if(c&&r(c))for(var d=e.getShadowTrees(c),p=a.insertionParent,u=0;d.length>u;u++)if(d[u].contains(p))return p}return i(o)}function a(e){for(var r=[],i=e,a=[],s=[];i;){var u=null;if(n(i)){u=l(r);var c=r[r.length-1]||i;r.push(c)}else r.length||r.push(i);var d=r[r.length-1];a.push({target:d,currentTarget:i}),t(i)&&r.pop(),i=o(i,u,s)}return a}function l(e){for(var t=e.length-1;t>=0;t--)if(!n(e[t]))return e[t];return null}function s(r,i){for(var a=[];r;){for(var s=[],c=i,p=void 0;c;){var h=null;if(s.length){if(n(c)&&(h=l(s),u(p))){var f=s[s.length-1];s.push(f)}}else s.push(c);if(d(c,r))return s[s.length-1];t(c)&&s.pop(),p=c,c=o(c,h,a)}r=t(r)?e.getHostForShadowRoot(r):r.parentNode}}function u(e){return e.insertionParent}function c(e){for(var t;t=e.parentNode;)e=t;return e}function d(e,t){return c(e)===c(t)}function p(e){switch(e){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function h(t){if(!F.get(t)){F.set(t,!0),p(t.type)||e.renderAllPending();var n=R(t.target),r=R(t);return f(r,n)}}function f(e,t){var n=a(t);return"load"===e.type&&2===n.length&&n[0].target instanceof I.Document&&n.shift(),m(e,n)&&g(e,n)&&w(e,n),k.set(e,y.NONE),W.set(e,null),e.defaultPrevented}function m(e,t){for(var n,r=t.length-1;r>0;r--){var i=t[r].target,o=t[r].currentTarget;if(i!==o&&(n=y.CAPTURING_PHASE,!v(t[r],e,n)))return!1}return!0}function g(e,t){var n=y.AT_TARGET;return v(t[0],e,n)}function w(e,t){for(var n,r=e.bubbles,i=1;t.length>i;i++){var o=t[i].target,a=t[i].currentTarget;if(o===a)n=y.AT_TARGET;else{if(!r||q.get(e))continue;n=y.BUBBLING_PHASE}if(!v(t[i],e,n))return}}function v(e,t,n){var r=e.target,i=e.currentTarget,o=A.get(i);if(!o)return!0;if("relatedTarget"in t){var a=x(t),l=R(a.relatedTarget),u=s(i,l);if(u===r)return!0;B.set(t,u)}k.set(t,n);var c=t.type,d=!1;j.set(t,r),W.set(t,i);for(var p=0;o.length>p;p++){var h=o[p];if(h.removed)d=!0;else if(!(h.type!==c||!h.capture&&n===y.CAPTURING_PHASE||h.capture&&n===y.BUBBLING_PHASE))try{if("function"==typeof h.handler?h.handler.call(i,t):h.handler.handleEvent(t),q.get(t))return!1}catch(f){window.onerror?window.onerror(f.message):console.error(f)}}if(d){var m=o.slice();o.length=0;for(var p=0;m.length>p;p++)m[p].removed||o.push(m[p])}return!G.get(t)}function E(e,t,n){this.type=e,this.handler=t,this.capture=Boolean(n)}function y(e,t){return e instanceof U?(this.impl=e,void 0):R(M(U,"Event",e,t))}function T(e){return e&&e.relatedTarget?Object.create(e,{relatedTarget:{value:x(e.relatedTarget)}}):e}function b(e,t,n){var r=window[e],i=function(t,n){return t instanceof r?(this.impl=t,void 0):R(M(r,e,t,n))};return i.prototype=Object.create(t.prototype),n&&_(i.prototype,n),r&&P(r,i,document.createEvent(e)),i}function S(e,t){return function(){arguments[t]=x(arguments[t]);var n=x(this);n[e].apply(n,arguments)}}function M(e,t,n,r){if(et)return new e(n,T(r));var i=x(document.createEvent(t)),o=J[t],a=[n];return Object.keys(o).forEach(function(e){var t=null!=r&&e in r?r[e]:o[e];"relatedTarget"===e&&(t=x(t)),a.push(t)}),i["init"+t].apply(i,a),i}function N(e){return"function"==typeof e?!0:e&&e.handleEvent}function L(e){this.impl=e}function C(t){return t instanceof I.ShadowRoot&&(t=e.getHostForShadowRoot(t)),x(t)}function H(e){D(e,rt)}function O(t,n,r,i){e.renderAllPending();for(var o=R(it.call(n.impl,r,i)),l=a(o,this),s=0;l.length>s;s++){var u=l[s];if(u.currentTarget===t)return u.target}return null}var D=e.forwardMethodsToWrapper,_=e.mixin,P=e.registerWrapper,x=e.unwrap,R=e.wrap,I=e.wrappers;new SideTable;var A=new SideTable,F=new SideTable,j=new SideTable,W=new SideTable,B=new SideTable,k=new SideTable,G=new SideTable,q=new SideTable;E.prototype={equals:function(e){return this.handler===e.handler&&this.type===e.type&&this.capture===e.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var U=window.Event;y.prototype={get target(){return j.get(this)},get currentTarget(){return W.get(this)},get eventPhase(){return k.get(this)},stopPropagation:function(){G.set(this,!0)},stopImmediatePropagation:function(){G.set(this,!0),q.set(this,!0)}},P(U,y,document.createEvent("Event"));var V=b("UIEvent",y),K=b("CustomEvent",y),$={get relatedTarget(){return B.get(this)||R(x(this).relatedTarget)}},z=_({initMouseEvent:S("initMouseEvent",14)},$),X=_({initFocusEvent:S("initFocusEvent",5)},$),Y=b("MouseEvent",V,z),Q=b("FocusEvent",V,X),Z=b("MutationEvent",y,{initMutationEvent:S("initMutationEvent",3),get relatedNode(){return R(this.impl.relatedNode)}}),J=Object.create(null),et=function(){try{new window.MouseEvent("click")}catch(e){return!1}return!0}();if(!et){var tt=function(e,t,n){if(n){var r=J[n];t=_(_({},r),t)}J[e]=t};tt("Event",{bubbles:!1,cancelable:!1}),tt("CustomEvent",{detail:null},"Event"),tt("UIEvent",{view:null,detail:0},"Event"),tt("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),tt("FocusEvent",{relatedTarget:null},"UIEvent")}var nt=window.EventTarget,rt=["addEventListener","removeEventListener","dispatchEvent"];[Element,Window,Document].forEach(function(e){var t=e.prototype;rt.forEach(function(e){Object.defineProperty(t,e+"_",{value:t[e]})})}),L.prototype={addEventListener:function(e,t,n){if(N(t)){var r=new E(e,t,n),i=A.get(this);if(i){for(var o=0;i.length>o;o++)if(r.equals(i[o]))return}else i=[],A.set(this,i);i.push(r);var a=C(this);a.addEventListener_(e,h,!0)}},removeEventListener:function(e,t,n){n=Boolean(n);var r=A.get(this);if(r){for(var i=0,o=!1,a=0;r.length>a;a++)r[a].type===e&&r[a].capture===n&&(i++,r[a].handler===t&&(o=!0,r[a].remove()));if(o&&1===i){var l=C(this);l.removeEventListener_(e,h,!0)}}},dispatchEvent:function(t){e.renderAllPending();var n=C(this);return n.dispatchEvent_(x(t))}},nt&&P(nt,L);var it=document.elementFromPoint;e.adjustRelatedTarget=s,e.elementFromPoint=O,e.wrapEventTargetMethods=H,e.wrappers.CustomEvent=K,e.wrappers.Event=y,e.wrappers.EventTarget=L,e.wrappers.FocusEvent=Q,e.wrappers.MouseEvent=Y,e.wrappers.MutationEvent=Z,e.wrappers.UIEvent=V}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,{enumerable:!1})}function n(){this.length=0,t(this,"length")}function r(e){if(null==e)return e;for(var t=new n,r=0,i=e.length;i>r;r++)t[r]=o(e[r]);return t.length=i,t}function i(e,t){e.prototype[t]=function(){return r(this.impl[t].apply(this.impl,arguments))}}var o=e.wrap;n.prototype={item:function(e){return this[e]}},t(n.prototype,"item"),e.wrappers.NodeList=n,e.addWrapNodeListMethod=i,e.wrapNodeList=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){s(e instanceof o)}function n(e,t,n,r){if(e.nodeType!==o.DOCUMENT_FRAGMENT_NODE)return e.parentNode&&e.parentNode.removeChild(e),e.parentNode_=t,e.previousSibling_=n,e.nextSibling_=r,n&&(n.nextSibling_=e),r&&(r.previousSibling_=e),[e];for(var i,a=[];i=e.firstChild;)e.removeChild(i),a.push(i),i.parentNode_=t;for(var l=0;a.length>l;l++)a[l].previousSibling_=a[l-1]||n,a[l].nextSibling_=a[l+1]||r;return n&&(n.nextSibling_=a[0]),r&&(r.previousSibling_=a[a.length-1]),a}function r(e){if(1===e.length)return d(e[0]);for(var t=d(document.createDocumentFragment()),n=0;e.length>n;n++)t.appendChild(d(e[n]));return t}function i(e){for(var t=e.firstChild;t;){s(t.parentNode===e);var n=t.nextSibling,r=d(t),i=r.parentNode;i&&w.call(i,r),t.previousSibling_=t.nextSibling_=t.parentNode_=null,t=n}e.firstChild_=e.lastChild_=null}function o(e){s(e instanceof h),a.call(this,e),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0}var a=e.wrappers.EventTarget,l=e.wrappers.NodeList;e.defineWrapGetter;var s=e.assert,u=e.mixin,c=e.registerWrapper,d=e.unwrap,p=e.wrap,h=window.Node,f=h.prototype.appendChild,m=h.prototype.insertBefore,g=h.prototype.replaceChild,w=h.prototype.removeChild,v=h.prototype.compareDocumentPosition;o.prototype=Object.create(a.prototype),u(o.prototype,{appendChild:function(e){t(e),this.invalidateShadowRenderer();var i=this.lastChild,o=null,a=n(e,this,i,o);return this.lastChild_=a[a.length-1],i||(this.firstChild_=a[0]),f.call(this.impl,r(a)),e},insertBefore:function(e,i){if(!i)return this.appendChild(e);t(e),t(i),s(i.parentNode===this),this.invalidateShadowRenderer();var o=i.previousSibling,a=i,l=n(e,this,o,a);this.firstChild===i&&(this.firstChild_=l[0]);var u=d(i),c=u.parentNode;return c&&m.call(c,r(l),u),e},removeChild:function(e){if(t(e),e.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var n=this.firstChild,r=this.lastChild,i=e.nextSibling,o=e.previousSibling,a=d(e),l=a.parentNode;return l&&w.call(l,a),n===e&&(this.firstChild_=i),r===e&&(this.lastChild_=o),o&&(o.nextSibling_=i),i&&(i.previousSibling_=o),e.previousSibling_=e.nextSibling_=e.parentNode_=null,e},replaceChild:function(e,i){if(t(e),t(i),i.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var o=i.previousSibling,a=i.nextSibling;a===e&&(a=e.nextSibling);var l=n(e,this,o,a);this.firstChild===i&&(this.firstChild_=l[0]),this.lastChild===i&&(this.lastChild_=l[l.length-1]),i.previousSibling_=null,i.nextSibling_=null,i.parentNode_=null;var s=d(i);return s.parentNode&&g.call(s.parentNode,r(l),s),i},hasChildNodes:function(){return null===this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:p(this.impl.parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:p(this.impl.firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:p(this.impl.lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:p(this.impl.nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:p(this.impl.previousSibling)},get parentElement(){for(var e=this.parentNode;e&&e.nodeType!==o.ELEMENT_NODE;)e=e.parentNode;return e},get textContent(){for(var e="",t=this.firstChild;t;t=t.nextSibling)e+=t.textContent;return e},set textContent(e){if(i(this),this.invalidateShadowRenderer(),""!==e){var t=this.impl.ownerDocument.createTextNode(e);this.appendChild(t)}},get childNodes(){for(var e=new l,t=0,n=this.firstChild;n;n=n.nextSibling)e[t++]=n;return e.length=t,e},cloneNode:function(e){if(!this.invalidateShadowRenderer())return p(this.impl.cloneNode(e));var t=p(this.impl.cloneNode(!1));if(e)for(var n=this.firstChild;n;n=n.nextSibling)t.appendChild(n.cloneNode(!0));return t},contains:function(e){if(!e)return!1;if(e===this)return!0;var t=e.parentNode;return t?this.contains(t):!1},compareDocumentPosition:function(e){return v.call(this.impl,d(e))},get ownerDocument(){return e.renderAllPending(),p(this.impl.ownerDocument)}}),c(h,o,document.createDocumentFragment()),delete o.prototype.querySelector,delete o.prototype.querySelectorAll,o.prototype=u(Object.create(a.prototype),o.prototype),e.wrappers.Node=o}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e,n){for(var r,i=e.firstElementChild;i;){if(i.matches(n))return i;if(r=t(i,n))return r;i=i.nextElementSibling}return null}function n(e,t,r){for(var i=e.firstElementChild;i;)i.matches(t)&&(r[r.length++]=i),n(i,t,r),i=i.nextElementSibling;return r}var r={querySelector:function(e){return t(this,e)},querySelectorAll:function(e){return n(this,e,new NodeList)}},i={getElementsByTagName:function(e){return this.querySelectorAll(e)},getElementsByClassName:function(e){return this.querySelectorAll("."+e)},getElementsByTagNameNS:function(e,t){if("*"===e)return this.getElementsByTagName(t);for(var n=new NodeList,r=this.getElementsByTagName(t),i=0,o=0;r.length>i;i++)r[i].namespaceURI===e&&(n[o++]=r[i]);return n.length=o,n}};e.GetElementsByInterface=i,e.SelectorsInterface=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;return e}function n(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.previousSibling;return e}var r=e.wrappers.NodeList,i={get firstElementChild(){return t(this.firstChild)},get lastElementChild(){return n(this.lastChild)},get childElementCount(){for(var e=0,t=this.firstElementChild;t;t=t.nextElementSibling)e++;return e},get children(){for(var e=new r,t=0,n=this.firstElementChild;n;n=n.nextElementSibling)e[t++]=n;return e.length=t,e}},o={get nextElementSibling(){return t(this.nextSibling)},get previousElementSibling(){return n(this.nextSibling)}};e.ChildNodeInterface=o,e.ParentNodeInterface=i}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}var n=e.ChildNodeInterface,r=e.wrappers.Node,i=e.mixin,o=e.registerWrapper,a=window.CharacterData;t.prototype=Object.create(r.prototype),i(t.prototype,{get textContent(){return this.data},set textContent(e){this.data=e}}),i(t.prototype,n),o(a,t,document.createTextNode("")),e.wrappers.CharacterData=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){i.call(this,e)}var n=e.ChildNodeInterface,r=e.GetElementsByInterface,i=e.wrappers.Node,o=e.ParentNodeInterface,a=e.SelectorsInterface;e.addWrapNodeListMethod;var l=e.mixin,s=e.registerWrapper,u=e.wrappers,c=new SideTable,d=window.Element,p=d.prototype.matches||d.prototype.mozMatchesSelector||d.prototype.msMatchesSelector||d.prototype.webkitMatchesSelector;t.prototype=Object.create(i.prototype),l(t.prototype,{createShadowRoot:function(){var t=new u.ShadowRoot(this);return c.set(this,t),e.getRendererForHost(this),this.invalidateShadowRenderer(!0),t},get shadowRoot(){return c.get(this)||null},setAttribute:function(e,t){this.impl.setAttribute(e,t),this.invalidateShadowRenderer()},matches:function(e){return p.call(this.impl,e)}}),l(t.prototype,n),l(t.prototype,r),l(t.prototype,o),l(t.prototype,a),s(d,t),e.wrappers.Element=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case'"':return"&quot;"}}function n(e){return e.replace(m,t)}function r(e){switch(e.nodeType){case Node.ELEMENT_NODE:for(var t,r=e.tagName.toLowerCase(),o="<"+r,a=e.attributes,l=0;t=a[l];l++)o+=" "+t.name+'="'+n(t.value)+'"';return o+=">",g[r]?o:o+i(e)+"</"+r+">";case Node.TEXT_NODE:return n(e.nodeValue);case Node.COMMENT_NODE:return"<!--"+n(e.nodeValue)+"-->";default:throw console.error(e),new Error("not implemented")}}function i(e){for(var t="",n=e.firstChild;n;n=n.nextSibling)t+=r(n);return t}function o(e,t,n){var r=n||"div";e.textContent="";var i=h(e.ownerDocument.createElement(r));i.innerHTML=t;for(var o;o=i.firstChild;)e.appendChild(f(o))}function a(e){u.call(this,e)}function l(t){c(a,t,function(){return e.renderAllPending(),this.impl[t]})}function s(t){Object.defineProperty(a.prototype,t,{value:function(){return e.renderAllPending(),this.impl[t].apply(this.impl,arguments)},configurable:!0,enumerable:!0})}var u=e.wrappers.Element,c=e.defineGetter,d=e.mixin,p=e.registerWrapper,h=e.unwrap,f=e.wrap,m=/&|<|"/g,g={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},w=window.HTMLElement;a.prototype=Object.create(u.prototype),d(a.prototype,{get innerHTML(){return i(this)},set innerHTML(e){o(this,e,this.tagName)},get outerHTML(){return r(this)},set outerHTML(e){if(this.invalidateShadowRenderer())throw new Error("not implemented");this.impl.outerHTML=e}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth"].forEach(l),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(s),p(w,a,document.createElement("b")),e.wrappers.HTMLElement=a,e.getInnerHTML=i,e.setInnerHTML=o}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,i=e.registerWrapper,o=window.HTMLContentElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get select(){return this.getAttribute("select")},set select(e){this.setAttribute("select",e)},setAttribute:function(e,t){n.prototype.setAttribute.call(this,e,t),"select"===String(e).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),o&&i(o,t),e.wrappers.HTMLContentElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e),this.olderShadowRoot_=null}var n=e.wrappers.HTMLElement,r=e.mixin,i=e.registerWrapper,o=window.HTMLShadowElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get olderShadowRoot(){return this.olderShadowRoot_},invalidateShadowRenderer:function(){n.prototype.invalidateShadowRenderer.call(this,!0)}}),o&&i(o,t),e.wrappers.HTMLShadowElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){if(!e.defaultView)return e;var t=d.get(e);if(!t){for(t=e.implementation.createHTMLDocument("");t.lastChild;)t.removeChild(t.lastChild);d.set(e,t)}return t}function n(e){for(var n,r=t(e.ownerDocument),i=r.createDocumentFragment();n=e.firstChild;)i.appendChild(n);return i}function r(e){i.call(this,e)}var i=e.wrappers.HTMLElement,o=e.getInnerHTML,a=e.mixin,l=e.registerWrapper,s=e.setInnerHTML,u=e.wrap,c=new SideTable,d=new SideTable,p=window.HTMLTemplateElement;r.prototype=Object.create(i.prototype),a(r.prototype,{get content(){if(p)return u(this.impl.content);var e=c.get(this);return e||(e=n(this),c.set(this,e)),e},get innerHTML(){return o(this.content)},set innerHTML(e){s(this.content,e),this.invalidateShadowRenderer()}}),p&&l(p,r),e.wrappers.HTMLTemplateElement=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e.localName){case"content":return new n(e);case"shadow":return new i(e);case"template":return new o(e)}r.call(this,e)}var n=e.wrappers.HTMLContentElement,r=e.wrappers.HTMLElement,i=e.wrappers.HTMLShadowElement,o=e.wrappers.HTMLTemplateElement;e.mixin;var a=e.registerWrapper,l=window.HTMLUnknownElement;t.prototype=Object.create(r.prototype),a(l,t),e.wrappers.HTMLUnknownElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";var t=e.GetElementsByInterface,n=e.ParentNodeInterface,r=e.SelectorsInterface,i=e.mixin,o=e.registerObject,a=o(document.createDocumentFragment());i(a.prototype,n),i(a.prototype,r),i(a.prototype,t);var l=o(document.createTextNode("")),s=o(document.createComment(""));e.wrappers.Comment=s,e.wrappers.DocumentFragment=a,e.wrappers.Text=l}(this.ShadowDOMPolyfill),function(e){"use strict";function t(t){var r=s(t.impl.ownerDocument.createDocumentFragment());n.call(this,r),a(r,this);var i=t.shadowRoot;e.nextOlderShadowTreeTable.set(this,i),u.set(this,t)}var n=e.wrappers.DocumentFragment,r=e.elementFromPoint,i=e.getInnerHTML,o=e.mixin,a=e.rewrap,l=e.setInnerHTML,s=e.unwrap,u=new SideTable;t.prototype=Object.create(n.prototype),o(t.prototype,{get innerHTML(){return i(this)},set innerHTML(e){l(this,e),this.invalidateShadowRenderer()},invalidateShadowRenderer:function(){return u.get(this).invalidateShadowRenderer()},elementFromPoint:function(e,t){return r(this,this.ownerDocument,e,t)},getElementById:function(e){return this.querySelector("#"+e)}}),e.wrappers.ShadowRoot=t,e.getHostForShadowRoot=function(e){return u.get(e)}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.previousSibling_=e.previousSibling,e.nextSibling_=e.nextSibling,e.parentNode_=e.parentNode}function n(e){e.firstChild_=e.firstChild,e.lastChild_=e.lastChild}function r(e){_(e instanceof D);for(var r=e.firstChild;r;r=r.nextSibling)t(r);n(e)}function i(e){var t=x(e);r(e),t.textContent=""}function o(e,n){var i=x(e),o=x(n);o.nodeType===D.DOCUMENT_FRAGMENT_NODE?r(n):(l(n),t(n)),e.lastChild_=e.lastChild,e.lastChild===e.firstChild&&(e.firstChild_=e.firstChild);var a=R(i.lastChild);a&&(a.nextSibling_=a.nextSibling),i.appendChild(o)}function a(e,n){var r=x(e),i=x(n);t(n),n.previousSibling&&(n.previousSibling.nextSibling_=n),n.nextSibling&&(n.nextSibling.previousSibling_=n),e.lastChild===n&&(e.lastChild_=n),e.firstChild===n&&(e.firstChild_=n),r.removeChild(i)}function l(e){var t=x(e),n=t.parentNode;n&&a(R(n),e)}function s(e,t){c(t).push(e),F.set(e,t);var n=A.get(e);n||A.set(e,n=[]),n.push(t)}function u(e){I.set(e,[])}function c(e){return I.get(e)}function d(e){for(var t=[],n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t}function p(e,t,n){for(var r=d(e),i=0;r.length>i;i++){var o=r[i];if(t(o)){if(n(o)===!1)return}else p(o,t,n)}}function h(e,t){var n=!1;return p(e,y,function(e){u(e);for(var r=0;t.length>r;r++){var i=t[r];void 0!==i&&m(i,e)&&(s(i,e),t[r]=void 0,n=!0)}}),n?t.filter(function(e){return void 0!==e}):t}function f(e,t){for(var n=0;t.length>n;n++)if(t[n]in e)return t[n]}function m(e,t){var n=t.getAttribute("select");if(!n)return!0;if(n=n.trim(),!n)return!0;if(e.nodeType!==D.ELEMENT_NODE)return!1;if(!k.test(n))return!1;if(":"===n[0]&&!G.test(n))return!1;try{return e.matches(n)}catch(r){return!1}}function g(){H=null,U.forEach(function(e){e.render()}),U=[]}function w(e){this.host=e,this.dirty=!1,this.associateNode(e)}function v(e){var t=W.get(e);return t||(t=new w(e),W.set(e,t)),t}function E(e){return"content"===e.localName}function y(e){return"content"===e.localName}function T(e){return"shadow"===e.localName}function b(e){return"shadow"===e.localName}function S(e){return!!e.shadowRoot}function M(e){return j.get(e)}function N(e){for(var t=[],n=e.shadowRoot;n;n=j.get(n))t.push(n);return t}function L(e,t){F.set(e,t)}function C(e){new w(e).render()}var H,O=e.wrappers.HTMLContentElement,D=e.wrappers.Node,_=e.assert,P=e.mixin,x=e.unwrap,R=e.wrap,I=new SideTable,A=new SideTable,F=new SideTable,j=new SideTable,W=new SideTable,B=new SideTable,k=/^[*.:#[a-zA-Z_|]/,G=new RegExp("^:("+["link","visited","target","enabled","disabled","checked","indeterminate","nth-child","nth-last-child","nth-of-type","nth-last-of-type","first-child","last-child","first-of-type","last-of-type","only-of-type"].join("|")+")"),q=f(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),U=[];w.prototype={render:function(){if(this.dirty){var e=this.host;this.treeComposition();var t=e.shadowRoot;if(t){this.removeAllChildNodes(this.host);var n=d(t);n.forEach(function(n){this.renderNode(e,t,n,!1)},this),this.dirty=!1}}},invalidate:function(){if(!this.dirty){if(this.dirty=!0,U.push(this),H)return;H=window[q](g,0)}},renderNode:function(e,t,n,r){if(S(n)){this.appendChild(e,n);var i=v(n);i.dirty=!0,i.render()}else E(n)?this.renderInsertionPoint(e,t,n,r):T(n)?this.renderShadowInsertionPoint(e,t,n):this.renderAsAnyDomTree(e,t,n,r)},renderAsAnyDomTree:function(e,t,n,r){if(this.appendChild(e,n),S(n))C(n);else{var i=n,o=d(i);o.forEach(function(e){this.renderNode(i,t,e,r)},this)}},renderInsertionPoint:function(e,t,n,r){var i=c(n);i.length?(this.removeAllChildNodes(n),i.forEach(function(n){E(n)&&r?this.renderInsertionPoint(e,t,n,r):this.renderAsAnyDomTree(e,t,n,r)},this)):this.renderFallbackContent(e,n),this.remove(n)},renderShadowInsertionPoint:function(e,t,n){var r=M(t);if(r){F.set(r,n),n.olderShadowRoot_=r,this.remove(n);var i=d(r);i.forEach(function(t){this.renderNode(e,r,t,!0)},this)}else this.renderFallbackContent(e,n)},renderFallbackContent:function(e,t){var n=d(t);n.forEach(function(t){this.appendChild(e,t)},this)},treeComposition:function(){var e=this.host,t=e.shadowRoot,n=[],r=d(e);r.forEach(function(e){if(E(e)){var t=c(e);t&&t.length||(t=d(e)),n.push.apply(n,t)}else n.push(e)});for(var i,o;t;){if(i=void 0,p(t,b,function(e){return i=e,!1}),o=i,n=h(t,n),o){var a=M(t);if(a){t=a,L(t,o);continue}break}break}},appendChild:function(e,t){o(e,t),this.associateNode(t)},remove:function(e){l(e),this.associateNode(e)},removeAllChildNodes:function(e){i(e)},associateNode:function(e){B.set(e,this)}},D.prototype.invalidateShadowRenderer=function(e){var t=B.get(this);if(!t)return!1;var n;return(e||this.shadowRoot||(n=this.parentNode)&&(n.shadowRoot||n instanceof ShadowRoot))&&t.invalidate(),!0},O.prototype.getDistributedNodes=function(){return g(),c(this)},P(D.prototype,{get insertionParent(){return F.get(this)||null}}),e.eventParentsTable=A,e.getRendererForHost=v,e.getShadowTrees=N,e.nextOlderShadowTreeTable=j,e.renderAllPending=g,e.visual={removeAllChildNodes:i,appendChild:o,removeChild:a}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){l.call(this,e)}function n(e){var n=document[e];t.prototype[e]=function(){return g(n.apply(this.impl,arguments))}}function r(e){this.impl=e}function i(e,t){var n=document.implementation[t];e.prototype[t]=function(){return g(n.apply(this.impl,arguments))}}function o(e,t){var n=document.implementation[t];e.prototype[t]=function(){return n.apply(this.impl,arguments)}}var a=e.GetElementsByInterface,l=e.wrappers.Node,s=e.ParentNodeInterface,u=e.SelectorsInterface,c=e.defineWrapGetter,d=e.elementFromPoint,p=e.forwardMethodsToWrapper,h=e.mixin,f=e.registerWrapper,m=e.unwrap,g=e.wrap,w=e.wrapEventTargetMethods;e.wrapNodeList;var v=new SideTable;t.prototype=Object.create(l.prototype),c(t,"documentElement"),c(t,"body"),c(t,"head"),["getElementById","createElement","createElementNS","createTextNode","createDocumentFragment","createEvent","createEventNS"].forEach(n);var E=document.adoptNode,y=document.write;h(t.prototype,{adoptNode:function(e){return E.call(this.impl,m(e)),e},elementFromPoint:function(e,t){return d(this,this,e,t)},write:function(e){for(var t=this.querySelectorAll("*"),n=t[t.length-1];n.nextSibling;)n=n.nextSibling;var r=n.parentNode;r.lastChild_=void 0,n.nextSibling_=void 0,y.call(this.impl,e)}}),p([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement],["appendChild","compareDocumentPosition","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),p([window.HTMLDocument||window.Document],["adoptNode","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createTextNode","elementFromPoint","getElementById","write"]),h(t.prototype,a),h(t.prototype,s),h(t.prototype,u),h(t.prototype,{get implementation(){var e=v.get(this);return e?e:(e=new r(m(this).implementation),v.set(this,e),e)}}),f(window.Document,t,document.implementation.createHTMLDocument("")),window.HTMLDocument&&f(window.HTMLDocument,t),w([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]),i(r,"createDocumentType"),i(r,"createDocument"),i(r,"createHTMLDocument"),o(r,"hasFeature"),f(window.DOMImplementation,r),p([window.DOMImplementation],["createDocumentType","createDocument","createHTMLDocument","hasFeature"]),e.wrappers.Document=t,e.wrappers.DOMImplementation=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.mixin,i=e.registerWrapper,o=e.unwrap,a=e.unwrapIfNeeded,l=e.wrap,s=window.Window;t.prototype=Object.create(n.prototype);var u=window.getComputedStyle;s.prototype.getComputedStyle=function(e,t){return u.call(this||window,a(e),t)},["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){s.prototype[e]=function(){var t=l(this||window);return t[e].apply(t,arguments)}}),r(t.prototype,{getComputedStyle:function(e,t){return u.call(o(this),a(e),t)}}),i(s,t),e.wrappers.Window=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){this.impl=e}function n(e){return new t(e)}function r(e){return e.map(n)}function i(e){var t=this;this.impl=new c(function(n){e.call(t,r(n),t)})}var o=e.defineGetter,a=e.defineWrapGetter,l=e.registerWrapper,s=e.unwrapIfNeeded,u=e.wrapNodeList;e.wrappers;var c=window.MutationObserver||window.WebKitMutationObserver;if(c){var d=window.MutationRecord;t.prototype={get addedNodes(){return u(this.impl.addedNodes)},get removedNodes(){return u(this.impl.removedNodes)}},["target","previousSibling","nextSibling"].forEach(function(e){a(t,e)}),["type","attributeName","attributeNamespace","oldValue"].forEach(function(e){o(t,e,function(){return this.impl[e]
})}),d&&l(d,t),window.Node,i.prototype={observe:function(e,t){this.impl.observe(s(e),t)},disconnect:function(){this.impl.disconnect()},takeRecords:function(){return r(this.impl.takeRecords())}},e.wrappers.MutationObserver=i,e.wrappers.MutationRecord=t}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=n[e],r=window[t];if(r){var i=document.createElement(e),o=i.constructor;window[t]=o}}e.isWrapperFor;var n={a:"HTMLAnchorElement",applet:"HTMLAppletElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseElement",body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",dl:"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadingElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElement",li:"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link:"HTMLLinkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElement",ol:"HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HTMLTableRowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElement",textarea:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement",video:"HTMLVideoElement"};Object.keys(n).forEach(t),Object.getOwnPropertyNames(e.wrappers).forEach(function(t){window[t]=e.wrappers[t]}),e.knownElements=n}(this.ShadowDOMPolyfill),function(){var e=window.ShadowDOMPolyfill;e.wrap,Object.defineProperties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return this.shadowRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.prototype.createShadowRoot,window.dartExperimentalFixupGetTag=function(t){function n(e){if(e instanceof r)return"NodeList";if(e instanceof i)return"ShadowRoot";if(e instanceof MutationRecord)return"MutationRecord";if(e instanceof MutationObserver)return"MutationObserver";if(o(e)){e=a(e);var n=e.constructor;if(n&&n._ShadowDOMPolyfill$isGeneratedWrapper){var l=n._ShadowDOMPolyfill$cacheTag_;return l||(l=Object.prototype.toString.call(e),l=l.substring(8,l.length-1),n._ShadowDOMPolyfill$cacheTag_=l),l}}return t(e)}var r=e.wrappers.NodeList,i=e.wrappers.ShadowRoot,o=e.isWrapper,a=e.unwrap;return n}}()}