33 lines
10 KiB
JavaScript
33 lines
10 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=!(window.ShadyDOM&&window.ShadyDOM.inUse),p;function r(a){p=a&&a.shimcssproperties?!1:k||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var t;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(t=window.ShadyCSS.cssBuild);var aa=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime);
|
|
window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?p=window.ShadyCSS.nativeCss:window.ShadyCSS?(r(window.ShadyCSS),window.ShadyCSS=void 0):r(window.WebComponents&&window.WebComponents.flags);var u=p;function v(){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 w(a){var b=a=a.replace(ba,"").replace(ca,""),c=new v;c.start=0;c.end=b.length;for(var d=c,e=0,f=b.length;e<f;e++)if("{"===b[e]){d.rules||(d.rules=[]);var g=d,h=g.rules[g.rules.length-1]||null;d=new v;d.start=e+1;d.parent=g;d.previous=h;g.rules.push(d)}else"}"===b[e]&&(d.end=e+1,d=d.parent||c);return x(c,a)}
|
|
function x(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&(c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=da(c),c=c.replace(y," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=0===c.indexOf("@"),a.atRule?0===c.indexOf("@media")?a.type=z:c.match(ea)&&(a.type=A,a.keyframesName=a.selector.split(y).pop()):a.type=0===c.indexOf("--")?B:C);if(c=a.rules)for(var d=0,e=c.length,f=void 0;d<e&&(f=c[d]);d++)x(f,b);
|
|
return a}function da(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(b,c){b=c;for(c=6-b.length;c--;)b="0"+b;return"\\"+b})}
|
|
function D(a,b,c){c=void 0===c?"":c;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 g=e.length,h=void 0;f<g&&(h=e[f]);f++)d=D(h,b,d)}else b?b=a.cssText:(b=a.cssText,b=b.replace(fa,"").replace(ha,""),b=b.replace(ia,"").replace(ja,"")),(d=b.trim())&&(d=" "+d+"\n")}d&&(a.selector&&(c+=a.selector+" {\n"),c+=d,a.selector&&(c+="}\n\n"));return c}
|
|
var C=1,A=7,z=4,B=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/,y=/\s+/g;var E=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,H=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,ka=/@media\s(.*)/;var I=new Set;function J(a){if(!a)return"";"string"===typeof a&&(a=w(a));return D(a,u)}function K(a){!a.__cssRules&&a.textContent&&(a.__cssRules=w(a.textContent));return a.__cssRules||null}function L(a,b,c,d){if(a){var e=!1,f=a.type;if(d&&f===z){var g=a.selector.match(ka);g&&(window.matchMedia(g[1]).matches||(e=!0))}f===C?b(a):c&&f===A?c(a):f===B&&(e=!0);if((a=a.rules)&&!e)for(e=0,f=a.length,g=void 0;e<f&&(g=a[e]);e++)L(g,b,c,d)}}
|
|
function M(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");a:{var d=0;var e=c+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(c+4,e);c=a.substring(0,c);a=M(a.substring(e+1),b);e=d.indexOf(",");return-1===e?b(c,d.trim(),"",a):b(c,d.substring(0,e).trim(),d.substring(e+1).trim(),a)}
|
|
function N(a){if(void 0!==t)return t;if(void 0===a.__cssBuild){var b=a.getAttribute("css-build");if(b)a.__cssBuild=b;else{a:{b="template"===a.localName?a.content.firstChild:a.firstChild;if(b instanceof Comment&&(b=b.textContent.trim().split(":"),"css-build"===b[0])){b=b[1];break a}b=""}if(""!==b){var c="template"===a.localName?a.content.firstChild:a.firstChild;c.parentNode.removeChild(c)}a.__cssBuild=b}}return a.__cssBuild||""};var la=/;\s*/m,ma=/^\s*(initial)|(inherit)\s*$/,O=/\s*!important/;function P(){this.g={}}P.prototype.set=function(a,b){a=a.trim();this.g[a]={m:b,o:{}}};P.prototype.get=function(a){a=a.trim();return this.g[a]||null};var Q=null;function R(){this.h=this.i=null;this.g=new P}R.prototype.A=function(a){a=H.test(a)||E.test(a);H.lastIndex=0;E.lastIndex=0;return a};
|
|
R.prototype.v=function(a,b){if(void 0===a._gatheredStyle){var c=[];for(var d=a.content.querySelectorAll("style"),e=0;e<d.length;e++){var f=d[e];if(f.hasAttribute("shady-unscoped")){if(!k){var g=f.textContent;if(!I.has(g)){I.add(g);var h=document.createElement("style");h.setAttribute("shady-unscoped","");h.textContent=g;document.head.appendChild(h)}f.parentNode.removeChild(f)}}else c.push(f.textContent),f.parentNode.removeChild(f)}(c=c.join("").trim())?(d=document.createElement("style"),d.textContent=
|
|
c,a.content.insertBefore(d,a.content.firstChild),c=d):c=null;a._gatheredStyle=c}return(a=a._gatheredStyle)?this.s(a,b):null};R.prototype.s=function(a,b){b=void 0===b?"":b;var c=K(a);this.u(c,b);a.textContent=J(c);return c};R.prototype.j=function(a){var b=this,c=K(a);L(c,function(d){":root"===d.selector&&(d.selector="html");b.l(d)});a.textContent=J(c);return c};R.prototype.u=function(a,b){var c=this;this.i=b;L(a,function(d){c.l(d)});this.i=null};
|
|
R.prototype.l=function(a){a.cssText=na(this,a.parsedCssText,a);":root"===a.selector&&(a.selector=":host > *")};function na(a,b,c){b=b.replace(E,function(d,e,f,g){return oa(a,d,e,f,g,c)});return S(a,b,c)}function pa(a,b){for(var c=b;c.parent;)c=c.parent;var d={},e=!1;L(c,function(f){(e=e||f===b)||f.selector===b.selector&&Object.assign(d,T(a,f.parsedCssText))});return d}
|
|
function S(a,b,c){for(var d;d=H.exec(b);){var e=d[0],f=d[1];d=d.index;var g=b.slice(0,d+e.indexOf("@apply"));b=b.slice(d+e.length);var h=c?pa(a,c):{};Object.assign(h,T(a,g));e=void 0;var l=a;f=f.replace(la,"");var n=[];var m=l.g.get(f);m||(l.g.set(f,{}),m=l.g.get(f));if(m){l.i&&(m.o[l.i]=!0);var q=m.m;for(e in q)l=h&&h[e],m=[e,": var(",f,"_-_",e],l&&m.push(",",l.replace(O,"")),m.push(")"),O.test(q[e])&&m.push(" !important"),n.push(m.join(""))}e=n.join("; ");b=g+e+b;H.lastIndex=d+e.length}return b}
|
|
function T(a,b,c){c=void 0===c?!1:c;b=b.split(";");for(var d,e,f={},g=0,h;g<b.length;g++)if(d=b[g])if(h=d.split(":"),1<h.length){d=h[0].trim();e=h.slice(1).join(":");if(c){var l=a;h=d;var n=ma.exec(e);n&&(n[1]?(l.h||(l.h=document.createElement("meta"),l.h.setAttribute("apply-shim-measure",""),l.h.style.all="initial",document.head.appendChild(l.h)),h=window.getComputedStyle(l.h).getPropertyValue(h)):h="apply-shim-inherit",e=h)}f[d]=e}return f}function qa(a,b){if(Q)for(var c in b.o)c!==a.i&&Q(c)}
|
|
function oa(a,b,c,d,e,f){d&&M(d,function(wa,F){F&&a.g.get(F)&&(e="@apply "+F+";")});if(!e)return b;var g=S(a,""+e,f);f=b.slice(0,b.indexOf("--"));var h=g=T(a,g,!0),l=a.g.get(c),n=l&&l.m;n?h=Object.assign(Object.create(n),g):a.g.set(c,h);var m=[],q,Z=!1;for(q in h){var G=g[q];void 0===G&&(G="initial");!n||q in n||(Z=!0);m.push(c+"_-_"+q+": "+G)}Z&&qa(a,l);l&&(l.m=h);d&&(f=b+";"+f);return f+m.join("; ")+";"}R.prototype.detectMixin=R.prototype.A;R.prototype.transformStyle=R.prototype.s;
|
|
R.prototype.transformCustomStyle=R.prototype.j;R.prototype.transformRules=R.prototype.u;R.prototype.transformRule=R.prototype.l;R.prototype.transformTemplate=R.prototype.v;R.prototype._separator="_-_";Object.defineProperty(R.prototype,"invalidCallback",{get:function(){return Q},set:function(a){Q=a}});var U={};var ra=Promise.resolve();function sa(a){if(a=U[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function ta(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function ua(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a._validating||(a._validating=!0,ra.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a._validating=!1}))};var V=new R;function W(){this.g=null;V.invalidCallback=sa}function X(a){!a.g&&window.ShadyCSS.CustomStyleInterface&&(a.g=window.ShadyCSS.CustomStyleInterface,a.g.transformCallback=function(b){V.j(b)},a.g.validateCallback=function(){requestAnimationFrame(function(){a.g.enqueued&&a.flushCustomStyles()})})}W.prototype.prepareTemplate=function(a,b){X(this);""===N(a)&&(U[b]=a,b=V.v(a,b),a._styleAst=b)};
|
|
W.prototype.flushCustomStyles=function(){X(this);if(this.g){var a=this.g.processStyles();if(this.g.enqueued){for(var b=0;b<a.length;b++){var c=this.g.getStyleForCustomStyle(a[b]);c&&V.j(c)}this.g.enqueued=!1}}};
|
|
W.prototype.styleSubtree=function(a,b){X(this);if(b)for(var c in b)null===c?a.style.removeProperty(c):a.style.setProperty(c,b[c]);if(a.shadowRoot)for(this.styleElement(a),a=a.shadowRoot.children||a.shadowRoot.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b]);else for(a=a.children||a.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b])};
|
|
W.prototype.styleElement=function(a){X(this);var b=a.localName,c;b?-1<b.indexOf("-")?c=b:c=a.getAttribute&&a.getAttribute("is")||"":c=a.is;b=U[c];if(!(b&&""!==N(b)||!b||ta(b))){if(ta(b)||b._applyShimValidatingVersion!==b._applyShimNextVersion)this.prepareTemplate(b,c),ua(b);if(a=a.shadowRoot)if(a=a.querySelector("style"))a.__cssRules=b._styleAst,a.textContent=J(b._styleAst)}};W.prototype.styleDocument=function(a){X(this);this.styleSubtree(document.body,a)};
|
|
if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){var Y=new W,va=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate:function(a,b){Y.flushCustomStyles();Y.prepareTemplate(a,b)},prepareTemplateStyles:function(a,b,c){window.ShadyCSS.prepareTemplate(a,b,c)},prepareTemplateDom:function(){},styleSubtree:function(a,b){Y.flushCustomStyles();Y.styleSubtree(a,b)},styleElement:function(a){Y.flushCustomStyles();Y.styleElement(a)},styleDocument:function(a){Y.flushCustomStyles();
|
|
Y.styleDocument(a)},getComputedStyleValue:function(a,b){return(a=window.getComputedStyle(a).getPropertyValue(b))?a.trim():""},flushCustomStyles:function(){Y.flushCustomStyles()},nativeCss:u,nativeShadow:k,cssBuild:t,disableRuntime:aa};va&&(window.ShadyCSS.CustomStyleInterface=va)}window.ShadyCSS.ApplyShim=V;}).call(this);
|
|
|
|
//# sourceMappingURL=apply-shim.min.js.map
|