30 lines
9.5 KiB
JavaScript
30 lines
9.5 KiB
JavaScript
(function(){/*
|
|
|
|
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
Code distributed by Google as part of the polymer project is also
|
|
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
'use strict';var k={};function n(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""}
|
|
function p(a){a=a.replace(ba,"").replace(ca,"");var c=r,b=a,d=new n;d.start=0;d.end=b.length;for(var e=d,f=0,h=b.length;f<h;f++)if("{"===b[f]){e.rules||(e.rules=[]);var g=e,m=g.rules[g.rules.length-1]||null;e=new n;e.start=f+1;e.parent=g;e.previous=m;g.rules.push(e)}else"}"===b[f]&&(e.end=f+1,e=e.parent||d);return c(d,a)}
|
|
function r(a,c){var b=c.substring(a.start,a.end-1);a.parsedCssText=a.cssText=b.trim();a.parent&&(b=c.substring(a.previous?a.previous.end:a.parent.start,a.start-1),b=da(b),b=b.replace(t," "),b=b.substring(b.lastIndexOf(";")+1),b=a.parsedSelector=a.selector=b.trim(),a.atRule=0===b.indexOf("@"),a.atRule?0===b.indexOf("@media")?a.type=u:b.match(ea)&&(a.type=v,a.keyframesName=a.selector.split(t).pop()):a.type=0===b.indexOf("--")?w:y);if(b=a.rules)for(var d=0,e=b.length,f;d<e&&(f=b[d]);d++)r(f,c);return a}
|
|
function da(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,b){a=b;for(b=6-a.length;b--;)a="0"+a;return"\\"+a})}
|
|
function z(a,c,b){b=void 0===b?"":b;var d="";if(a.cssText||a.rules){var e=a.rules,f;if(f=e)f=e[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var h=e.length,g;f<h&&(g=e[f]);f++)d=z(g,c,d)}else c?c=a.cssText:(c=a.cssText,c=c.replace(fa,"").replace(ha,""),c=c.replace(ia,"").replace(ja,"")),(d=c.trim())&&(d=" "+d+"\n")}d&&(a.selector&&(b+=a.selector+" {\n"),b+=d,a.selector&&(b+="}\n\n"));return b}
|
|
var y=1,v=7,u=4,w=1E3,ba=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ca=/@import[^;]*;/gim,fa=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,ha=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,ia=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,ja=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,ea=/^@[^\s]*keyframes/,t=/\s+/g;var ka=Promise.resolve();function la(a){if(a=k[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function A(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function ma(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a.b||(a.b=!0,ka.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a.b=!1}))};var B=!(window.ShadyDOM&&window.ShadyDOM.inUse),C;function D(a){C=a&&a.shimcssproperties?!1:B||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?C=window.ShadyCSS.nativeCss:window.ShadyCSS?(D(window.ShadyCSS),window.ShadyCSS=void 0):D(window.WebComponents&&window.WebComponents.flags);var E=C;var G=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,H=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,na=/@media\s(.*)/;var I=new Set;function J(a){if(!a)return"";"string"===typeof a&&(a=p(a));return z(a,E)}function K(a){!a.__cssRules&&a.textContent&&(a.__cssRules=p(a.textContent));return a.__cssRules||null}function L(a,c,b,d){if(a){var e=!1,f=a.type;if(d&&f===u){var h=a.selector.match(na);h&&(window.matchMedia(h[1]).matches||(e=!0))}f===y?c(a):b&&f===v?b(a):f===w&&(e=!0);if((a=a.rules)&&!e){e=0;f=a.length;for(var g;e<f&&(g=a[e]);e++)L(g,c,b,d)}}}
|
|
function M(a,c){var b=a.indexOf("var(");if(-1===b)return c(a,"","","");a:{var d=0;var e=b+3;for(var f=a.length;e<f;e++)if("("===a[e])d++;else if(")"===a[e]&&0===--d)break a;e=-1}d=a.substring(b+4,e);b=a.substring(0,b);a=M(a.substring(e+1),c);e=d.indexOf(",");return-1===e?c(b,d.trim(),"",a):c(b,d.substring(0,e).trim(),d.substring(e+1).trim(),a)};var oa=/;\s*/m,pa=/^\s*(initial)|(inherit)\s*$/,N=/\s*!important/;function O(){this.a={}}O.prototype.set=function(a,c){a=a.trim();this.a[a]={h:c,i:{}}};O.prototype.get=function(a){a=a.trim();return this.a[a]||null};var P=null;function Q(){this.b=this.c=null;this.a=new O}Q.prototype.o=function(a){a=H.test(a)||G.test(a);H.lastIndex=0;G.lastIndex=0;return a};
|
|
Q.prototype.m=function(a,c){if(void 0===a.a){var b=[];for(var d=a.content.querySelectorAll("style"),e=0;e<d.length;e++){var f=d[e];if(f.hasAttribute("shady-unscoped")){if(!B){var h=f.textContent;I.has(h)||(I.add(h),h=f.cloneNode(!0),document.head.appendChild(h));f.parentNode.removeChild(f)}}else b.push(f.textContent),f.parentNode.removeChild(f)}(b=b.join("").trim())?(d=document.createElement("style"),d.textContent=b,a.content.insertBefore(d,a.content.firstChild),b=d):b=null;a.a=b}return(a=a.a)?this.j(a,
|
|
c):null};Q.prototype.j=function(a,c){c=void 0===c?"":c;var b=K(a);this.l(b,c);a.textContent=J(b);return b};Q.prototype.f=function(a){var c=this,b=K(a);L(b,function(a){":root"===a.selector&&(a.selector="html");c.g(a)});a.textContent=J(b);return b};Q.prototype.l=function(a,c){var b=this;this.c=c;L(a,function(a){b.g(a)});this.c=null};Q.prototype.g=function(a){a.cssText=qa(this,a.parsedCssText);":root"===a.selector&&(a.selector=":host > *")};
|
|
function qa(a,c){c=c.replace(G,function(b,c,e,f){return ra(a,b,c,e,f)});return R(a,c)}
|
|
function R(a,c){for(var b;b=H.exec(c);){var d=b[0],e=b[1];b=b.index;var f=c.slice(0,b+d.indexOf("@apply"));c=c.slice(b+d.length);var h=S(a,f);d=void 0;var g=a;e=e.replace(oa,"");var m=[];var l=g.a.get(e);l||(g.a.set(e,{}),l=g.a.get(e));if(l){g.c&&(l.i[g.c]=!0);var q=l.h;for(d in q)g=h&&h[d],l=[d,": var(",e,"_-_",d],g&&l.push(",",g.replace(N,"")),l.push(")"),N.test(q[d])&&l.push(" !important"),m.push(l.join(""))}d=m.join("; ");c=""+f+d+c;H.lastIndex=b+d.length}return c}
|
|
function S(a,c){c=c.split(";");for(var b,d,e={},f=0,h;f<c.length;f++)if(b=c[f])if(h=b.split(":"),1<h.length){b=h[0].trim();var g=a;d=b;h=h.slice(1).join(":");var m=pa.exec(h);m&&(m[1]?(g.b||(g.b=document.createElement("meta"),g.b.setAttribute("apply-shim-measure",""),g.b.style.all="initial",document.head.appendChild(g.b)),d=window.getComputedStyle(g.b).getPropertyValue(d)):d="apply-shim-inherit",h=d);d=h;e[b]=d}return e}function sa(a,c){if(P)for(var b in c.i)b!==a.c&&P(b)}
|
|
function ra(a,c,b,d,e){d&&M(d,function(c,b){b&&a.a.get(b)&&(e="@apply "+b+";")});if(!e)return c;var f=R(a,""+e),h=c.slice(0,c.indexOf("--")),g=f=S(a,f),m=a.a.get(b),l=m&&m.h;l?g=Object.assign(Object.create(l),f):a.a.set(b,g);var q=[],x,aa=!1;for(x in g){var F=f[x];void 0===F&&(F="initial");!l||x in l||(aa=!0);q.push(""+b+"_-_"+x+": "+F)}aa&&sa(a,m);m&&(m.h=g);d&&(h=c+";"+h);return""+h+q.join("; ")+";"}Q.prototype.detectMixin=Q.prototype.o;Q.prototype.transformStyle=Q.prototype.j;
|
|
Q.prototype.transformCustomStyle=Q.prototype.f;Q.prototype.transformRules=Q.prototype.l;Q.prototype.transformRule=Q.prototype.g;Q.prototype.transformTemplate=Q.prototype.m;Q.prototype._separator="_-_";Object.defineProperty(Q.prototype,"invalidCallback",{get:function(){return P},set:function(a){P=a}});var T=null,ta=window.HTMLImports&&window.HTMLImports.whenReady||null,U;function ua(a){requestAnimationFrame(function(){ta?ta(a):(T||(T=new Promise(function(a){U=a}),"complete"===document.readyState?U():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&U()})),T.then(function(){a&&a()}))})};var V=new Q;function W(){var a=this;this.a=null;ua(function(){X(a)});V.invalidCallback=la}function X(a){a.a||(a.a=window.ShadyCSS.CustomStyleInterface,a.a&&(a.a.transformCallback=function(a){V.f(a)},a.a.validateCallback=function(){requestAnimationFrame(function(){a.a.enqueued&&Y(a)})}))}W.prototype.prepareTemplate=function(a,c){X(this);k[c]=a;c=V.m(a,c);a._styleAst=c};
|
|
function Y(a){X(a);if(a.a){var c=a.a.processStyles();if(a.a.enqueued){for(var b=0;b<c.length;b++){var d=a.a.getStyleForCustomStyle(c[b]);d&&V.f(d)}a.a.enqueued=!1}}}W.prototype.styleSubtree=function(a,c){X(this);if(c)for(var b in c)null===b?a.style.removeProperty(b):a.style.setProperty(b,c[b]);if(a.shadowRoot)for(this.styleElement(a),a=a.shadowRoot.children||a.shadowRoot.childNodes,c=0;c<a.length;c++)this.styleSubtree(a[c]);else for(a=a.children||a.childNodes,c=0;c<a.length;c++)this.styleSubtree(a[c])};
|
|
W.prototype.styleElement=function(a){X(this);var c=a.localName,b;c?-1<c.indexOf("-")?b=c:b=a.getAttribute&&a.getAttribute("is")||"":b=a.is;if((c=k[b])&&!A(c)){if(A(c)||c._applyShimValidatingVersion!==c._applyShimNextVersion)this.prepareTemplate(c,b),ma(c);if(a=a.shadowRoot)if(a=a.querySelector("style"))a.__cssRules=c._styleAst,a.textContent=J(c._styleAst)}};W.prototype.styleDocument=function(a){X(this);this.styleSubtree(document.body,a)};
|
|
if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){var Z=new W,va=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate:function(a,c){Y(Z);Z.prepareTemplate(a,c)},styleSubtree:function(a,c){Y(Z);Z.styleSubtree(a,c)},styleElement:function(a){Y(Z);Z.styleElement(a)},styleDocument:function(a){Y(Z);Z.styleDocument(a)},getComputedStyleValue:function(a,c){return(a=window.getComputedStyle(a).getPropertyValue(c))?a.trim():""},nativeCss:E,nativeShadow:B};va&&(window.ShadyCSS.CustomStyleInterface=
|
|
va)}window.ShadyCSS.ApplyShim=V;}).call(this);
|
|
|
|
//# sourceMappingURL=apply-shim.min.js.map
|