Skip to content

Instantly share code, notes, and snippets.

@nevercast
Created August 13, 2020 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevercast/7332f9116cf42c0ea27b02b1e81b2846 to your computer and use it in GitHub Desktop.
Save nevercast/7332f9116cf42c0ea27b02b1e81b2846 to your computer and use it in GitHub Desktop.
Dumps the Computed CSS stylesheet of an element and it's children for diff use.
/* Simmer.js https://github.com/gmmorris/simmerjs/ */
var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.owns=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},$jscomp.ASSUME_ES5=!1,$jscomp.ASSUME_NO_NATIVE_MAP=!1,$jscomp.ASSUME_NO_NATIVE_SET=!1,$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)},$jscomp.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:"undefined"!=typeof global&&null!=global?global:t},$jscomp.global=$jscomp.getGlobal(this),$jscomp.polyfill=function(t,e,n,r){if(e){for(n=$jscomp.global,t=t.split("."),r=0;r<t.length-1;r++){var o=t[r];o in n||(n[o]={}),n=n[o]}(e=e(r=n[t=t[t.length-1]]))!=r&&null!=e&&$jscomp.defineProperty(n,t,{configurable:!0,writable:!0,value:e})}},$jscomp.polyfill("Object.assign",function(t){return t||function(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var o in r)$jscomp.owns(r,o)&&(t[o]=r[o])}return t}},"es6-impl","es3"),$jscomp.SYMBOL_PREFIX="jscomp_symbol_",$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){},$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)},$jscomp.symbolCounter_=0,$jscomp.Symbol=function(t){return $jscomp.SYMBOL_PREFIX+(t||"")+$jscomp.symbolCounter_++},$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var t=$jscomp.global.Symbol.iterator;t||(t=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&$jscomp.defineProperty(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}}),$jscomp.initSymbolIterator=function(){}},$jscomp.arrayIterator=function(t){var e=0;return $jscomp.iteratorPrototype(function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}})},$jscomp.iteratorPrototype=function(t){return $jscomp.initSymbolIterator(),(t={next:t})[$jscomp.global.Symbol.iterator]=function(){return this},t},$jscomp.polyfill("Array.from",function(t){return t||function(t,e,n){$jscomp.initSymbolIterator(),e=null!=e?e:function(t){return t};var r=[];if("function"==typeof(o=t[Symbol.iterator]))for(t=o.call(t);!(o=t.next()).done;)r.push(e.call(n,o.value));else for(var o=t.length,i=0;i<o;i++)r.push(e.call(n,t[i]));return r}},"es6-impl","es3"),$jscomp.iteratorFromArray=function(t,e){$jscomp.initSymbolIterator(),t instanceof String&&(t+="");var n=0,r={next:function(){if(n<t.length){var o=n++;return{value:e(o,t[o]),done:!1}}return r.next=function(){return{done:!0,value:void 0}},r.next()}};return r[Symbol.iterator]=function(){return r},r},$jscomp.polyfill("Array.prototype.keys",function(t){return t||function(){return $jscomp.iteratorFromArray(this,function(t){return t})}},"es6-impl","es3"),$jscomp.polyfill("Object.is",function(t){return t||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},"es6-impl","es3"),$jscomp.polyfill("Array.prototype.includes",function(t){return t||function(t,e){var n=this;n instanceof String&&(n=String(n));var r=n.length;for(e=e||0;e<r;e++)if(n[e]==t||Object.is(n[e],t))return!0;return!1}},"es7","es3"),$jscomp.checkStringArgs=function(t,e,n){if(null==t)throw new TypeError("The 'this' value for String.prototype."+n+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+n+" must not be a regular expression");return t+""},$jscomp.polyfill("String.prototype.includes",function(t){return t||function(t,e){return-1!==$jscomp.checkStringArgs(this,t,"includes").indexOf(t,e||0)}},"es6-impl","es3"),$jscomp.polyfill("Array.prototype.fill",function(t){return t||function(t,e,n){var r=this.length||0;for(0>e&&(e=Math.max(0,r+e)),(null==n||n>r)&&(n=r),0>(n=Number(n))&&(n=Math.max(0,r+n)),e=Number(e||0);e<n;e++)this[e]=t;return this}},"es6-impl","es3"),function(){function t(t,n){var r=[];for(t=t[n];t&&9!==t.nodeType;)1===t.nodeType&&r.push(e(t)),t=t[n];return r}function e(n){return{el:n,getClass:function(){return this.el.getAttribute("class")||""},getClasses:function(){return this.getClass().split(" ").map(function(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}).filter(function(t){return 0<t.length})},prevAll:function(){return t(this.el,"previousSibling")},nextAll:function(){return t(this.el,"nextSibling")},parent:function(){return this.el.parentNode&&11!==this.el.parentNode.nodeType?e(this.el.parentNode):null}}}function n(t){return"string"==typeof t&&null!==t.match(/^[a-zA-Z0-9]+$/gi)&&t}function r(t){return"string"==typeof t&&null!==t.match(/^\.?[a-zA-Z_\-:0-9]*$/gi)&&t}function o(t){var e=void 0===t?"undefined":w(t);return!!t&&("object"==e||"function"==e)}function i(t,e){var n;if(n=!(!t||!t.length)){t:if(e!=e)e:{e=u,n=t.length;for(var r=-1;++r<n;)if(e(t[r],r,t)){t=r;break e}t=-1}else{for(n=-1,r=t.length;++n<r;)if(t[n]===e){t=n;break t}t=-1}n=-1<t}return n}function u(t){return t!=t}function c(t,e){return t.has(e)}function a(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function f(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function l(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function s(t){var e=-1,n=t?t.length:0;for(this.__data__=new l;++e<n;)this.add(t[e])}function p(t,e){for(var n=t.length;n--;){var r=t[n][0];if(r===e||r!=r&&e!=e)return n}return-1}function h(t,e){t=t.__data__;var n=void 0===e?"undefined":w(e);return("string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e)?t["string"==typeof e?"string":"hash"]:t.map}function d(t,e){return(e=!(!_(t=null==t?void 0:t[e])||V&&V in t)&&(b(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?Z:R).test(function(t){if(null!=t){try{return G.call(t)}catch(t){}return t+""}return""}(t)))?t:void 0}function y(t){var e;return(e=nt(t))||(e=v(t)&&H.call(t,"callee")&&(!X.call(t,"callee")||"[object Arguments]"==W.call(t))),e||!!(J&&t&&t[J])}function v(t){var e;return(e=!!t&&"object"==(void 0===t?"undefined":w(t)))&&((e=null!=t)&&(e="number"==typeof(e=t.length)&&-1<e&&0==e%1&&9007199254740991>=e),e=e&&!b(t)),e}function b(t){return"[object Function]"==(t=_(t)?W.call(t):"")||"[object GeneratorFunction]"==t}function _(t){var e=void 0===t?"undefined":w(t);return!!t&&("object"==e||"function"==e)}function g(t){var e=void 0===t?"undefined":w(t);return!!t&&("object"==e||"function"==e)}function m(t){var e=t.getMethods();return{finished:function(){return 0===e.length},next:function(){return!this.finished()&&e.shift().apply(void 0,arguments)}}}function j(){return O({},_t,0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}var S,A={querySelectorAll:function(){throw Error("An invalid context has been provided to Simmer, it doesnt know how to query it")}},$=function(t,e){var n="function"==typeof e?e:function(t){var e="function"==typeof t.querySelectorAll?t:t.document?t.document:A;return function(t,n){try{return e.querySelectorAll(t)}catch(t){n(t)}}}(t);return function(e,r){return"string"!=typeof e?[]:n(e,r,t)}},w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},k=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t)){var n=[],r=!0,o=!1,i=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&c.return&&c.return()}finally{if(o)throw i}}return n}throw new TypeError("Invalid attempt to destructure non-iterable instance")},E=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)},x=NaN,M=/^\s+|\s+$/g,I=/^[-+]0x[0-9a-f]+$/i,P=/^0b[01]+$/i,N=/^0o[0-7]+$/i,T=parseInt,C=Object.prototype.toString,F=function(t,e,n){if(!t||!t.length)return[];n||void 0===e?n=1:((n=e)?n=(n=function(t){if("number"==typeof t)return t;var e=t;return"symbol"==(void 0===e?"undefined":w(e))||e&&"object"==(void 0===e?"undefined":w(e))&&"[object Symbol]"==C.call(e)?x:(o(t)&&(t=o(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t?0===t?t:+t:(t=t.replace(M,""),(e=P.test(t))||N.test(t)?T(t.slice(2),e?2:8):I.test(t)?x:+t))}(n))===1/0||n===-1/0?1.7976931348623157e308*(0>n?-1:1):n==n?n:0:n=0===n?n:0,e=n%1,n=n==n?e?n-e:n:0),e=n,n=0;var r=0>e?0:e;e=-1;var i=t.length;for(0>n&&(n=-n>i?0:i+n),0>(r=r>i?i:r)&&(r+=i),i=n>r?0:r-n>>>0,n>>>=0,r=Array(i);++e<i;)r[e]=t[e+n];return r},D="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},R=/^\[object .+?Constructor\]$/,U="object"==w(D)&&D&&D.Object===Object&&D,z="object"==("undefined"==typeof self?"undefined":w(self))&&self&&self.Object===Object&&self,L=(U=U||z||Function("return this")(),z=Array.prototype,Function.prototype),q=Object.prototype,B=U["__core-js_shared__"],V=(S=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""))?"Symbol(src)_1."+S:"",G=L.toString,H=q.hasOwnProperty,W=q.toString,Z=RegExp("^"+G.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),X=(L=U.Symbol,q.propertyIsEnumerable),Y=z.splice,J=L?L.isConcatSpreadable:void 0,K=Math.max,Q=d(U,"Map"),tt=d(Object,"create");a.prototype.clear=function(){this.__data__=tt?tt(null):{}},a.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},a.prototype.get=function(t){var e=this.__data__;return tt?"__lodash_hash_undefined__"===(t=e[t])?void 0:t:H.call(e,t)?e[t]:void 0},a.prototype.has=function(t){var e=this.__data__;return tt?void 0!==e[t]:H.call(e,t)},a.prototype.set=function(t,e){return this.__data__[t]=tt&&void 0===e?"__lodash_hash_undefined__":e,this},f.prototype.clear=function(){this.__data__=[]},f.prototype.delete=function(t){var e=this.__data__;return!(0>(t=p(e,t)))&&(t==e.length-1?e.pop():Y.call(e,t,1),!0)},f.prototype.get=function(t){var e=this.__data__;return 0>(t=p(e,t))?void 0:e[t][1]},f.prototype.has=function(t){return-1<p(this.__data__,t)},f.prototype.set=function(t,e){var n=this.__data__,r=p(n,t);return 0>r?n.push([t,e]):n[r][1]=e,this},l.prototype.clear=function(){this.__data__={hash:new a,map:new(Q||f),string:new a}},l.prototype.delete=function(t){return h(this,t).delete(t)},l.prototype.get=function(t){return h(this,t).get(t)},l.prototype.has=function(t){return h(this,t).has(t)},l.prototype.set=function(t,e){return h(this,t).set(t,e),this},s.prototype.add=s.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},s.prototype.has=function(t){return this.__data__.has(t)};U=function(t,e){return e=K(void 0===e?t.length-1:e,0),function(){for(var n=arguments,r=-1,o=K(n.length-e,0),i=Array(o);++r<o;)i[r]=n[e+r];for(r=-1,o=Array(e+1);++r<e;)o[r]=n[r];return o[e]=i,function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,o)}}(function(t,e){if(v(t)){e=function t(e,n,r,o,i){var u=-1,c=e.length;for(r||(r=y),i||(i=[]);++u<c;){var a=e[u];if(0<n&&r(a))if(1<n)t(a,n-1,r,o,i);else for(var f=i,l=-1,s=a.length,p=f.length;++l<s;)f[p+l]=a[l];else o||(i[i.length]=a)}return i}(e,1,v,!0);var n=-1,r=i,o=!0,u=t.length,a=[],f=e.length;if(u)t:for(200<=e.length&&(r=c,o=!1,e=new s(e));++n<u;){var l=p=t[n],p=0!==p?p:0;if(o&&l==l){for(var h=f;h--;)if(e[h]===l)continue t;a.push(p)}else r(e,l,void 0)||a.push(p)}t=a}else t=[];return t});var et,nt=Array.isArray,rt=U,ot=(function(t,e){function n(t,e){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function r(t,e){for(var n=-1,r=t?t.length:0;++n<r;)if(e(t[n],n,t))return!0;return!1}function o(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function i(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function u(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function c(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function a(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function f(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function l(t){var e=-1,n=t?t.length:0;for(this.__data__=new f;++e<n;)this.add(t[e])}function s(t){this.__data__=new a(t)}function p(t,e){for(var n=t.length;n--;)if(x(t[n][0],e))return n;return-1}function h(t,e){e=A(e,t)?[e]:b(e);for(var n=0,r=e.length;null!=t&&n<r;)t=t[O(e[n++])];return n&&n==r?t:void 0}function d(t,e,n,r,c){if(t===e)return!0;if(null==t||null==e||!T(t)&&!C(e))return t!=t&&e!=e;t:{var a=Ft(t),f=Ft(e),l="[object Array]",p="[object Array]";a||(l="[object Arguments]"==(l=Tt(t))?"[object Object]":l),f||(p="[object Arguments]"==(p=Tt(e))?"[object Object]":p);var h="[object Object]"==l&&!o(t),f="[object Object]"==p&&!o(e);if((p=l==p)&&!h)c||(c=new s),e=a||Dt(t)?_(t,e,d,n,r,c):function(t,e,n,r,o,c,a){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!r(new ht(t),new ht(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return x(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var f=i;case"[object Set]":if(f||(f=u),t.size!=e.size&&!(2&c))break;return(n=a.get(t))?n==e:(c|=1,a.set(t,e),e=_(f(t),f(e),r,o,c,a),a.delete(t),e);case"[object Symbol]":if(Mt)return Mt.call(t)==Mt.call(e)}return!1}(t,e,l,d,n,r,c);else{if(!(2&r)&&(a=h&&ft.call(t,"__wrapped__"),l=f&&ft.call(e,"__wrapped__"),a||l)){t=a?t.value():t,e=l?e.value():e,c||(c=new s),e=d(t,e,n,r,c);break t}if(p){c||(c=new s);e:{var y,a=2&r,l=R(t),f=l.length,p=R(e).length;if(f==p||a){for(h=f;h--;){var v=l[h];if(!(a?v in e:ft.call(e,v))){e=!1;break e}}if((p=c.get(t))&&c.get(e))e=p==e;else{p=!0,c.set(t,e),c.set(e,t);for(var b=a;++h<f;){v=l[h];var g=t[v],m=e[v];if(n&&(y=a?n(m,g,v,e,t,c):n(g,m,v,t,e,c)),void 0===y?g!==m&&!d(g,m,n,r,c):!y){p=!1;break}b||(b="constructor"==v)}p&&!b&&(n=t.constructor,r=e.constructor,n!=r&&"constructor"in t&&"constructor"in e&&!("function"==typeof n&&n instanceof n&&"function"==typeof r&&r instanceof r)&&(p=!1)),c.delete(t),c.delete(e),e=p}}else e=!1}}else e=!1}}return e}function y(t,e){var n=-1,r=I(t)?Array(t.length):[];return Pt(t,function(t,o,i){r[++n]=e(t,o,i)}),r}function v(t){var e=function(t){for(var e=R(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,o==o&&!T(o)]}return e}(t);return 1==e.length&&e[0][2]?$(e[0][0],e[0][1]):function(n){return n===t||function(t,e,n,r){var o,i=n.length,u=i,c=!r;if(null==t)return!u;for(t=Object(t);i--;){var a=n[i];if(c&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<u;){var f=(a=n[i])[0],l=t[f],p=a[1];if(c&&a[2]){if(void 0===l&&!(f in t))return!1}else if(a=new s,r&&(o=r(l,p,f,t,e,a)),void 0===o?!d(p,l,r,3,a):!o)return!1}return!0}(n,t,e)}}function b(t){return Ft(t)?t:Ct(t)}function _(t,e,n,o,i,u){var c,a=2&i,f=t.length,s=e.length;if(f!=s&&!(a&&s>f))return!1;if((s=u.get(t))&&u.get(e))return s==e;var s=-1,p=!0,h=1&i?new l:void 0;for(u.set(t,e),u.set(e,t);++s<f;){var d=t[s],y=e[s];if(o&&(c=a?o(y,d,s,e,t,u):o(d,y,s,t,e,u)),void 0!==c){if(c)continue;p=!1;break}if(h){if(!r(e,function(t,e){if(!h.has(e)&&(d===t||n(d,t,o,i,u)))return h.add(e)})){p=!1;break}}else if(d!==y&&!n(d,y,o,i,u)){p=!1;break}}return u.delete(t),u.delete(e),p}function g(t,e){t=t.__data__;var n=void 0===e?"undefined":w(e);return("string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e)?t["string"==typeof e?"string":"hash"]:t.map}function m(t,e){return t=null==t?void 0:t[e],(e=!(!T(t)||ct&&ct in t)&&(P(t)||o(t)?st:H).test(k(t)))?t:void 0}function j(t){return Ft(t)||M(t)||!!(vt&&t&&t[vt])}function S(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||W.test(t))&&-1<t&&0==t%1&&t<e}function A(t,e){if(Ft(t))return!1;var n=void 0===t?"undefined":w(t);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!F(t))||q.test(t)||!L.test(t)||null!=e&&t in Object(e)}function $(t,e){return function(n){return null!=n&&n[t]===e&&(void 0!==e||t in Object(n))}}function O(t){if("string"==typeof t||F(t))return t;var e=t+"";return"0"==e&&1/t==-z?"-0":e}function k(t){if(null!=t){try{return at.call(t)}catch(t){}return t+""}return""}function E(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function n(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;return i.has(o)?i.get(o):(r=t.apply(this,r),n.cache=i.set(o,r),r)};return n.cache=new(E.Cache||f),n}function x(t,e){return t===e||t!=t&&e!=e}function M(t){return C(t)&&I(t)&&ft.call(t,"callee")&&(!dt.call(t,"callee")||"[object Arguments]"==lt.call(t))}function I(t){return null!=t&&N(t.length)&&!P(t)}function P(t){return"[object Function]"==(t=T(t)?lt.call(t):"")||"[object GeneratorFunction]"==t}function N(t){return"number"==typeof t&&-1<t&&0==t%1&&9007199254740991>=t}function T(t){var e=void 0===t?"undefined":w(t);return!!t&&("object"==e||"function"==e)}function C(t){return!!t&&"object"==(void 0===t?"undefined":w(t))}function F(t){return"symbol"==(void 0===t?"undefined":w(t))||C(t)&&"[object Symbol]"==lt.call(t)}function R(t){if(I(t)){if(Ft(t)||M(t)){for(var e=t.length,n=String,r=-1,o=Array(e);++r<e;)o[r]=n(r);e=o}else e=[];var n=e.length,r=!!n;for(i in t)!ft.call(t,i)||r&&("length"==i||S(i,n))||e.push(i);t=e}else{var i=t&&t.constructor;if(t===("function"==typeof i&&i.prototype||it)){for(e in i=[],Object(t))ft.call(t,e)&&"constructor"!=e&&i.push(e);t=i}else t=bt(t)}return t}function U(t){return t}var z=1/0,L=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q=/^\w*$/,B=/^\./,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/\\(\\)?/g,H=/^\[object .+?Constructor\]$/,W=/^(?:0|[1-9]\d*)$/,Z={};Z["[object Float32Array]"]=Z["[object Float64Array]"]=Z["[object Int8Array]"]=Z["[object Int16Array]"]=Z["[object Int32Array]"]=Z["[object Uint8Array]"]=Z["[object Uint8ClampedArray]"]=Z["[object Uint16Array]"]=Z["[object Uint32Array]"]=!0,Z["[object Arguments]"]=Z["[object Array]"]=Z["[object ArrayBuffer]"]=Z["[object Boolean]"]=Z["[object DataView]"]=Z["[object Date]"]=Z["[object Error]"]=Z["[object Function]"]=Z["[object Map]"]=Z["[object Number]"]=Z["[object Object]"]=Z["[object RegExp]"]=Z["[object Set]"]=Z["[object String]"]=Z["[object WeakMap]"]=!1;var X="object"==w(D)&&D&&D.Object===Object&&D,Y="object"==("undefined"==typeof self?"undefined":w(self))&&self&&self.Object===Object&&self,J=X||Y||Function("return this")(),K=e&&!e.nodeType&&e,Q=K&&t&&!t.nodeType&&t,tt=Q&&Q.exports===K&&X.process;t:{try{var et=tt&&tt.binding("util");break t}catch(t){}et=void 0}var nt=et&&et.isTypedArray,rt=Array.prototype,ot=Function.prototype,it=Object.prototype,ut=J["__core-js_shared__"],ct=function(){var t=/[^.]+$/.exec(ut&&ut.keys&&ut.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),at=ot.toString,ft=it.hasOwnProperty,lt=it.toString,st=RegExp("^"+at.call(ft).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pt=J.Symbol,ht=J.Uint8Array,dt=it.propertyIsEnumerable,yt=rt.splice,vt=pt?pt.isConcatSpreadable:void 0,bt=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),_t=m(J,"DataView"),gt=m(J,"Map"),mt=m(J,"Promise"),jt=m(J,"Set"),St=m(J,"WeakMap"),At=m(Object,"create"),$t=k(_t),wt=k(gt),Ot=k(mt),kt=k(jt),Et=k(St),xt=pt?pt.prototype:void 0,Mt=xt?xt.valueOf:void 0,It=xt?xt.toString:void 0;c.prototype.clear=function(){this.__data__=At?At(null):{}},c.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},c.prototype.get=function(t){var e=this.__data__;return At?"__lodash_hash_undefined__"===(t=e[t])?void 0:t:ft.call(e,t)?e[t]:void 0},c.prototype.has=function(t){var e=this.__data__;return At?void 0!==e[t]:ft.call(e,t)},c.prototype.set=function(t,e){return this.__data__[t]=At&&void 0===e?"__lodash_hash_undefined__":e,this},a.prototype.clear=function(){this.__data__=[]},a.prototype.delete=function(t){var e=this.__data__;return!(0>(t=p(e,t))||(t==e.length-1?e.pop():yt.call(e,t,1),0))},a.prototype.get=function(t){var e=this.__data__;return 0>(t=p(e,t))?void 0:e[t][1]},a.prototype.has=function(t){return-1<p(this.__data__,t)},a.prototype.set=function(t,e){var n=this.__data__,r=p(n,t);return 0>r?n.push([t,e]):n[r][1]=e,this},f.prototype.clear=function(){this.__data__={hash:new c,map:new(gt||a),string:new c}},f.prototype.delete=function(t){return g(this,t).delete(t)},f.prototype.get=function(t){return g(this,t).get(t)},f.prototype.has=function(t){return g(this,t).has(t)},f.prototype.set=function(t,e){return g(this,t).set(t,e),this},l.prototype.add=l.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},l.prototype.has=function(t){return this.__data__.has(t)},s.prototype.clear=function(){this.__data__=new a},s.prototype.delete=function(t){return this.__data__.delete(t)},s.prototype.get=function(t){return this.__data__.get(t)},s.prototype.has=function(t){return this.__data__.has(t)},s.prototype.set=function(t,e){var n=this.__data__;if(n instanceof a){if(n=n.__data__,!gt||199>n.length)return n.push([t,e]),this;n=this.__data__=new f(n)}return n.set(t,e),this};var Pt=function(t,e){if(null==t)return t;if(!I(t))return function(t,e){return t&&Nt(t,e,R)}(t,e);for(var n=t.length,r=-1,o=Object(t);++r<n&&!1!==e(o[r],r,o););return t},Nt=function(t,e,n){for(var r=-1,o=Object(t),i=(n=n(t)).length;i--;){var u=n[++r];if(!1===e(o[u],u,o))break}return t},Tt=function(t){return lt.call(t)};(_t&&"[object DataView]"!=Tt(new _t(new ArrayBuffer(1)))||gt&&"[object Map]"!=Tt(new gt)||mt&&"[object Promise]"!=Tt(mt.resolve())||jt&&"[object Set]"!=Tt(new jt)||St&&"[object WeakMap]"!=Tt(new St))&&(Tt=function(t){var e=lt.call(t);if(t=(t="[object Object]"==e?t.constructor:void 0)?k(t):void 0)switch(t){case $t:return"[object DataView]";case wt:return"[object Map]";case Ot:return"[object Promise]";case kt:return"[object Set]";case Et:return"[object WeakMap]"}return e});var Ct=E(function(t){t=null==t?"":function(t){if("string"==typeof t)return t;if(F(t))return It?It.call(t):"";var e=t+"";return"0"==e&&1/t==-z?"-0":e}(t);var e=[];return B.test(t)&&e.push(""),t.replace(V,function(t,n,r,o){e.push(r?o.replace(G,"$1"):n||t)}),e});E.Cache=f;var Ft=Array.isArray,Dt=nt?function(t){return function(e){return t(e)}}(nt):function(t){return C(t)&&N(t.length)&&!!Z[lt.call(t)]};t.exports=function(t,e){var r=Ft(t)?n:y;return e="function"==typeof e?e:null==e?U:"object"==(void 0===e?"undefined":w(e))?Ft(e)?function(t,e){return A(t)&&e==e&&!T(e)?$(O(t),e):function(n){var r=null==n?void 0:h(n,t);if(void 0===(r=void 0===r?void 0:r)&&r===e){if(r=null!=n){r=A(r=t,n)?[r]:b(r);for(var o,i=-1,u=r.length;++i<u;){var c=O(r[i]);if(!(o=null!=n&&null!=n&&c in Object(n)))break;n=n[c]}o?r=o:(u=n?n.length:0,r=!!u&&N(u)&&S(c,u)&&(Ft(n)||M(n)))}c=r}else c=d(e,r,void 0,3);return c}}(e[0],e[1]):v(e):A(e)?function(t){return function(e){return null==e?void 0:e[t]}}(O(e)):function(t){return function(e){return h(e,t)}}(e),function t(e,n,r,o,i){var u=-1,c=e.length;for(r||(r=j),i||(i=[]);++u<c;){var a=e[u];if(0<n&&r(a))if(1<n)t(a,n-1,r,o,i);else for(var f=i,l=-1,s=a.length,p=f.length;++l<s;)f[p+l]=a[l];else o||(i[i.length]=a)}return i}(t=r(t,e),1)}}(et={exports:{}},et.exports),et.exports),it=function(t){return t.map(function(t){return t.el.nodeName})},ut={A:function(t,e){return(e=e.el.getAttribute("href"))&&(t.stack[0].push('A[href="'+e+'"]'),t.specificity+=10),t},IMG:function(t,e){return(e=e.el.getAttribute("src"))&&(t.stack[0].push('IMG[src="'+e+'"]'),t.specificity+=10),t}},ct={methods:[],getMethods:function(){return this.methods.slice(0)},addMethod:function(t){this.methods.push(t)}};ct.addMethod(function(t,e,n,r,o){return t.reduce(function(t,e,i){return t.verified?t:(e=[e.el.getAttribute("id")].filter(function(t){return t="string"==typeof t&&null!==t.match(/^[0-9a-zA-Z][a-zA-Z_\-:0-9.]*$/gi)&&t}).filter(function(t){return 1===(o('[id="'+t+'"]')||[]).length}).map(function(e){return t.stack[i].push("[id='"+e+"']"),t.specificity+=100,t.specificity>=r.specificityThreshold&&n(t)&&(t.verified=!0),t.verified||0!==i||(t.stack[i].pop(),t.specificity-=100),t}),k(e,1)[0]||t)},e)}),ct.addMethod(function(t,e){return t.reduce(function(t,e,r){return[e.el.nodeName].filter(n).forEach(function(e){t.stack[r].splice(0,0,e),t.specificity+=10}),t},e)}),ct.addMethod(function(t,e,n){var r=(t=t[0]).el.nodeName;return ut[r]&&(n(e=ut[r](e,t))?e.verified=!0:e.stack[0].pop()),e}),ct.addMethod(function(t,e){return t.reduce(function(t,e,n){return(e=F(e.getClasses(),10).filter(r).map(function(t){return"."+t})).length&&(t.stack[n].push(e.join("")),t.specificity+=10*e.length),t},e)}),ct.addMethod(function(t,e,n){return t.reduce(function(t,e,r){if(!t.verified){var o=e.prevAll(),i=e.nextAll(),u=o.length+1;!o.length&&!i.length||function(t,e){return 0<rt(t.getClasses(),ot(e,function(t){return t.getClasses()})).length||!it(e).includes(t.el.nodeName)}(e,[].concat(E(o),E(i)))||(t.stack[r].push(":nth-child("+u+")"),t.verified=n(t))}return t},e)});var at=NaN,ft=/^\s+|\s+$/g,lt=/^[-+]0x[0-9a-f]+$/i,st=/^0b[01]+$/i,pt=/^0o[0-7]+$/i,ht=parseInt,dt=Object.prototype.toString,yt=function(t,e,n){if(!(o=t?t.length:0))return[];n||void 0===e?e=1:(e?e=(e=function(t){if("number"==typeof t)return t;var e=t;return"symbol"==(void 0===e?"undefined":w(e))||e&&"object"==(void 0===e?"undefined":w(e))&&"[object Symbol]"==dt.call(e)?at:(g(t)&&(t=g(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t?0===t?t:+t:(t=t.replace(ft,""),(e=st.test(t))||pt.test(t)?ht(t.slice(2),e?2:8):lt.test(t)?at:+t))}(e))===1/0||e===-1/0?1.7976931348623157e308*(0>e?-1:1):e==e?e:0:e=0===e?e:0,n=e%1,e=e==e?n?e-n:e:0),e=0>(e=o-e)?0:e;var r=o,o=-1;for(n=t.length,0>e&&(e=-e>n?0:n+e),0>(r=r>n?n:r)&&(r+=n),n=e>r?0:r-e>>>0,e>>>=0,r=Array(n);++o<n;)r[o]=t[o+e];return r},vt=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.stack.length;return yt(t.stack.reduceRight(function(t,e){return e.length?t.push(e.join("")):t.length&&t.push("*"),t},[]),e).join(" > ")||"*"},bt=function(t,e,n,r){var o=e.selectorMaxLength;return function(e){for(var i=!1,u=1;u<=e.stack.length&&!i;u+=1){if(!(i=vt(e,u).trim())||!i.length||o&&i.length>o)return!1;(i=1===(i=n(i,r)).length&&(void 0!==t.el?i[0]===t.el:i[0]===t))&&(e.verificationDepth=u)}return i}},_t={queryEngine:null,specificityThreshold:100,depth:3,errorHandling:!1,selectorMaxLength:512};!function(t,e){var n=t.Simmer;t.Simmer=e,e.noConflict=function(){return t.Simmer=n,e}}(window,function t(){function n(t,e){if(!0===i.errorHandling)throw t;"function"==typeof i.errorHandling&&i.errorHandling(t,e)}var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:window,o=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=j(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}),u=o||$(r,i.queryEngine);return(o=function t(r){if(!r)return n.call(t,Error("Simmer: No element was specified for parsing."),r),!1;for(var o=new m(ct),c=function(t,e){if(0>=e)throw Error("Simmer: An invalid depth of "+e+" has been specified");return Array(e-1).fill().reduce(function(t,e){return t[t.length-1].parent()&&(e=t[t.length-1].parent(),t.push(e)),t},[t])}(e(r),i.depth),a={stack:Array(c.length).fill().map(function(){return[]}),specificity:0},f=bt(r,i,u,n);!o.finished()&&!a.verified;)try{(a=o.next(c,a,f,i,u)).specificity>=i.specificityThreshold&&!a.verified&&(a.verified=f(a))}catch(e){n.call(t,e,r)}return(void 0===a.verified||a.specificity<i.specificityThreshold)&&(a.verified=f(a)),!!a.verified&&(a.verificationDepth?vt(a,a.verificationDepth):vt(a))}).configure=function(){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:r,n=j(O({},i,0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}));return t(e,n,$(e,n.queryEngine))},o}(window))}();
var simmer = Simmer.noConflict();
/* dump-css MIT 2020 */
// Don't emit CSS for any rule specified here
const ruleDenylist = [
'inline-size',
'perspective-origin',
'transform-origin'
];
// Don't emit CSS for any vendor prefixed rule (starting with a dash)
const denyVendorPrefix = true;
// Don't emit CSS for the root element
const skipRootElement = true;
// Cache simmer paths and parent CSS rules
var cacheContainer = {
'cache': {}
}
function getElementCSS(rootElement, targetElement) {
// Get the computed CSS of the targetElement
// CSS that is identical to a parent is discarded
// Parent searching stops at the rootElement.
let cache = cacheContainer.cache;
let computedStyle = window.getComputedStyle(targetElement);
let targetElementStyle = {};
for (let ruleName of computedStyle) {
if (denyVendorPrefix && ruleName[0] == '-') continue;
if (ruleDenylist && ruleDenylist.includes(ruleName)) continue;
targetElementStyle[ruleName] = computedStyle[ruleName];
}
let searchPath = targetElement.parentPath;
let searchElement = undefined;
do {
let searchCacheEntry = cache[searchPath];
if (!searchCacheEntry) return targetElementStyle;
searchElement = searchCacheEntry.element;
let searchCss = searchCacheEntry.css;
for (let styleName in searchCss) {
if (targetElementStyle[styleName] == searchCss[styleName]) {
delete targetElementStyle[styleName];
}
}
searchPath = searchElement.parentPath;
} while (searchPath && searchElement != rootElement);
return targetElementStyle;
}
function dumpCSS(rootElement) {
let elementStack = [rootElement];
let cache = cacheContainer.cache;
let cacheOrder = [];
while (elementStack.length) {
let element = elementStack.shift();
let elementPath = element.elementPath = simmer(element);
let children = Array.apply(null, element.children);
children.forEach(child => child.parentPath = elementPath);
if (children.length) {
elementStack.push(...children);
}
cacheOrder.push(elementPath);
cache[elementPath] = {
element: element,
css: getElementCSS(rootElement, element)
};
}
if (skipRootElement) cacheOrder.shift();
let generatedStylesheetTable = [];
for (let elementPath of cacheOrder) {
let elementCacheEntry = cache[elementPath];
if (!elementCacheEntry) continue;
let elementCss = elementCacheEntry.css;
if (Object.keys(elementCss).length) { // It's possible there could be no CSS rules for this element, and we wouldn't want to emit it.
generatedStylesheetTable.push(elementPath + " {");
for (let ruleName in elementCss) {
generatedStylesheetTable.push(' ' + ruleName + ': ' + elementCss[ruleName] + ';');
}
generatedStylesheetTable.push("}");
}
}
return generatedStylesheetTable.join('\n');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment