Repository navigation
Expand file tree
/
Copy pathmin.js
More file actions
2 lines (2 loc) · 14.1 KB
/
Copy pathmin.js
File metadata and controls
2 lines (2 loc) · 14.1 KB
1
2
/*! (c) Andrea Giammarchi - ISC */
var lighterhtml=function(e,t){"use strict";function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var a={};try{a.WeakMap=WeakMap}catch(e){a.WeakMap=function(e,t){var n=t.defineProperty,r=t.hasOwnProperty,a=i.prototype;return a.delete=function(e){return this.has(e)&&delete e[this._]},a.get=function(e){return this.has(e)?e[this._]:void 0},a.has=function(e){return r.call(e,this._)},a.set=function(e,t){return n(e,this._,{configurable:!0,value:t}),this},i;function i(t){n(this,"_",{value:"_@ungap/weakmap"+e++}),t&&t.forEach(o,this)}function o(e){this.set(e[0],e[1])}}(Math.random(),Object)}var i,o=a.WeakMap,u="-"+Math.random().toFixed(6)+"%",c=!1;try{"content"in(i=e.createElement("template"))&&(i.innerHTML='<p tabindex="'+u+'"></p>',i.content.childNodes[0].getAttribute("tabindex")==u)||(u="_dt: "+u.slice(1,-1)+";",c=!0)}catch(e){}var s="\x3c!--"+u+"--\x3e",l=8,f=1,d=3,v=/^(?:style|textarea)$/i,p=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;function h(e){return e.join(s).replace(x,S).replace(N,C)}var g=" \\f\\n\\r\\t",m="[^"+g+"\\/>\"'=]+",y="["+g+"]+"+m,b="<([A-Za-z]+[A-Za-z0-9:._-]*)((?:",w="(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|<[^>]*?>|"+m.replace("\\/","")+"))?)",N=new RegExp(b+y+w+"+)(["+g+"]*/?>)","g"),x=new RegExp(b+y+w+"*)(["+g+"]*/>)","g"),E=new RegExp("("+y+"\\s*=\\s*)(['\"]?)"+s+"\\2","gi");function C(e,t,n,r){return"<"+t+n.replace(E,A)+r}function A(e,t,n){return t+(n||'"')+u+(n||'"')}function S(e,t,n){return p.test(t)?e:"<"+t+n+"></"+t+">"}var k=Array.isArray,O=[].slice,j=function(e){return{get:function(t){return e.get(t)},set:function(t,n){return e.set(t,n),n}}},M=function(t,n){return 111===t.nodeType?1/n<0?n?(a=(r=t).firstChild,i=r.lastChild,(o=e.createRange()).setStartAfter(a),o.setEndAfter(i),o.deleteContents(),a):t.lastChild:n?t.valueOf():t.firstChild:t;var r,a,i,o},T={};T.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(t){return n.prototype=new n("").constructor.prototype,n;function n(t,n){n||(n={});var r=e.createEvent("CustomEvent");return r.initCustomEvent(t,!!n.bubbles,!!n.cancelable,n.detail),r}}();var L=T.CustomEvent;var $=function(e){var t="fragment",n="content"in a("template")?function(e){var t=a("template");return t.innerHTML=e,t.content}:function(e){var n=a(t),i=a("template"),o=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var u=RegExp.$1;i.innerHTML="<table>"+e+"</table>",o=i.querySelectorAll(u)}else i.innerHTML=e,o=i.childNodes;return r(n,o),n};return function(e,i){return("svg"===i?function(e){var n=a(t),i=a("div");return i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",r(n,i.firstChild.childNodes),n}:n)(e)};function r(e,t){for(var n=t.length;n--;)e.appendChild(t[0])}function a(n){return n===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",n)}}(e),_=function(e,t,n,r,a){for(var i=n.length,o=t.length,u=i,c=0,s=0,l=null;c<o||s<u;)if(o===c)for(var f=u<i?s?r(n[s-1],-0).nextSibling:r(n[u-s],0):a;s<u;)e.insertBefore(r(n[s++],1),f);else if(u===s)for(;c<o;)l&&l.has(t[c])||e.removeChild(r(t[c],-1)),c++;else if(t[c]===n[s])c++,s++;else if(t[o-1]===n[u-1])o--,u--;else if(t[c]===n[u-1]&&n[s]===t[o-1]){var d=r(t[--o],-1).nextSibling;e.insertBefore(r(n[s++],1),r(t[c++],-1).nextSibling),e.insertBefore(r(n[--u],1),d),t[o]=n[u]}else{if(!l){l=new Map;for(var v=s;v<u;)l.set(n[v],v++)}if(l.has(t[c])){var p=l.get(t[c]);if(s<p&&p<u){for(var h=c,g=1;++h<o&&h<u&&l.get(t[h])===p+g;)g++;if(g>p-s)for(var m=r(t[c],0);s<p;)e.insertBefore(r(n[s++],1),m);else e.replaceChild(r(n[s++],1),r(t[c++],-1))}else c++}else e.removeChild(r(t[c++],-1))}return n},D=function(e,t,n,r,a){var i="importNode"in e,o=e.createDocumentFragment();return o.appendChild(e.createTextNode("g")),o.appendChild(e.createTextNode("")),(i?e.importNode(o,!0):o.cloneNode(!0)).childNodes.length<2?function e(t,n){for(var r=t.cloneNode(),a=t.childNodes||[],i=a.length,o=0;n&&o<i;o++)r.appendChild(e(a[o],n));return r}:i?e.importNode:function(e,t){return e.cloneNode(!!t)}}(e),W="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},R=c?function(e,t){var n=t.join(" ");return t.slice.call(e,0).sort(function(e,t){return n.indexOf(e.name)<=n.indexOf(t.name)?-1:1})}:function(e,t){return t.slice.call(e,0)};function V(e,t){for(var n=t.length,r=0;r<n;)e=e.childNodes[t[r++]];return e}function H(t,n,r,a){for(var i=t.attributes,o=[],l=[],f=R(i,r),d=f.length,v=0;v<d;){var p,h=f[v++],g=h.value===u;if(g||1<(p=h.value.split(s)).length){var m=h.name;if(o.indexOf(m)<0){o.push(m);var y=r.shift().replace(g?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+m+")\\s*=\\s*('|\")[\\S\\s]*","i"),"$1"),b=i[y]||i[y.toLowerCase()];if(g)n.push(z(b,a,y,null));else{for(var w=p.length-2;w--;)r.shift();n.push(z(b,a,y,p))}}l.push(h)}}v=0;for(var N=(0<(d=l.length)&&c&&!("ownerSVGElement"in t));v<d;){var x=l[v++];N&&(x.value=""),t.removeAttribute(x.name)}var E=t.nodeName;if(/^script$/i.test(E)){var C=e.createElement(E);for(d=i.length,v=0;v<d;)C.setAttributeNode(i[v++].cloneNode(!0));C.textContent=t.textContent,t.parentNode.replaceChild(C,t)}}function F(e,t){return{type:"any",node:e,path:t}}function z(e,t,n,r){return{type:"attr",node:e,path:t,name:n,sparse:r}}function B(e,t){return{type:"text",node:e,path:t}}var I=j(new o);function Z(e,t){var n=(e.convert||h)(t),r=e.transform;r&&(n=r(n));var a=$(n,e.type);q(a);var i=[];return function e(t,n,r,a){for(var i=t.childNodes,o=i.length,c=0;c<o;){var p=i[c];switch(p.nodeType){case f:var h=a.concat(c);H(p,n,r,h),e(p,n,r,h);break;case l:var g=p.textContent;if(g===u)r.shift(),n.push(v.test(t.nodeName)?B(t,a):F(p,a.concat(c)));else switch(g.slice(0,2)){case"/*":if("*/"!==g.slice(-2))break;case"👻":t.removeChild(p),c--,o--}break;case d:v.test(t.nodeName)&&W.call(p.textContent)===s&&(r.shift(),n.push(B(t,a)))}c++}}(a,i,t.slice(0),[]),{content:a,updates:function(n){for(var r=[],a=i.length,o=0,u=0;o<a;){var c=i[o++],s=V(n,c.path);switch(c.type){case"any":r.push({fn:e.any(s,[]),sparse:!1});break;case"attr":var l=c.sparse,f=e.attribute(s,c.name,c.node);null===l?r.push({fn:f,sparse:!1}):(u+=l.length-2,r.push({fn:f,sparse:!0,values:l}));break;case"text":r.push({fn:e.text(s),sparse:!1}),s.textContent=""}}return a+=u,function(){var e=arguments.length;if(a!==e-1)throw new Error(e-1+" values instead of "+a+"\n"+t.join("${value}"));for(var i=1,o=1;i<e;){var u=r[i-o];if(u.sparse){var c=u.values,s=c[0],l=1,f=c.length;for(o+=f-2;l<f;)s+=arguments[i++]+c[l++];u.fn(s)}else u.fn(arguments[i++])}return n}}}}var P=[];function G(t){var n=P,r=q;return function(a){return n!==a&&(r=function(t,n){var r=I.get(n)||I.set(n,Z(t,n));return r.updates(D.call(e,r.content,!0))}(t,n=a)),r.apply(null,arguments)}}function q(e){for(var t=e.childNodes,n=t.length;n--;){var r=t[n];1!==r.nodeType&&0===W.call(r.textContent).length&&e.removeChild(r)}}var U=function(){var e=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,t=/([^A-Z])([A-Z]+)/g;return function(e,t){return"ownerSVGElement"in e?function(e,t){var n;t?n=t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),n=e.getAttributeNode("style"));return n.value="",e.setAttributeNode(n),r(n,!0)}(e,t):r(e.style,!1)};function n(e,t,n){return t+"-"+n.toLowerCase()}function r(r,a){var i,o;return function(u){var c,s,l,f;switch(typeof u){case"object":if(u){if("object"===i){if(!a&&o!==u)for(s in o)s in u||(r[s]="")}else a?r.value="":r.cssText="";for(s in c=a?{}:r,u)l="number"!=typeof(f=u[s])||e.test(s)?f:f+"px",!a&&/^--/.test(s)?c.setProperty(s,l):c[s]=l;i="object",a?r.value=function(e){var r,a=[];for(r in e)a.push(r.replace(t,n),":",e[r],";");return a.join("")}(o=c):o=u;break}default:o!=u&&(i="string",o=u,a?r.value=u||"":r.cssText=u||"")}}}}(),J=function(t,n){var r,a=!0,i=e.createAttributeNS(null,n);return function(e){r!==e&&(null==(r=e)?a||(t.removeAttributeNode(i),a=!0):(i.value=e,a&&(t.setAttributeNodeNS(i),a=!1)))}},K=function(e,t){return function(n){e[t]=n}},Q={Event:L,WeakSet:"function"==("undefined"==typeof WeakSet?"undefined":typeof WeakSet)?WeakSet:function(){var e=new o;return e.add=ee,e}},X=function(e){var t=e.Event,n=e.WeakSet,r=!0,a=null;return function(e){return r&&(r=!r,a=new n,function(e){var r=new n,i=new n;try{new MutationObserver(s).observe(e,{subtree:!0,childList:!0})}catch(t){var o=0,u=[],c=function(e){u.push(e),clearTimeout(o),o=setTimeout(function(){s(u.splice(o=0,u.length))},0)};e.addEventListener("DOMNodeRemoved",function(e){c({addedNodes:[],removedNodes:[e.target]})},!0),e.addEventListener("DOMNodeInserted",function(e){c({addedNodes:[e.target],removedNodes:[]})},!0)}function s(e){for(var t,n=e.length,a=0;a<n;a++)l((t=e[a]).removedNodes,"disconnected",i,r),l(t.addedNodes,"connected",r,i)}function l(e,n,r,a){for(var i,o=new t(n),u=e.length,c=0;c<u;1===(i=e[c++]).nodeType&&f(i,o,n,r,a));}function f(e,t,n,r,i){a.has(e)&&!r.has(e)&&(i.delete(e),r.add(e),e.dispatchEvent(t));for(var o=e.children||[],u=o.length,c=0;c<u;f(o[c++],t,n,r,i));}}(e.ownerDocument)),a.add(e),e}}(Q),Y=function(e){var t=e.Event;return function(e,t){var r={attributes:!0,attributeOldValue:!0},o=t instanceof Array&&t.length;o&&(r.attributeFilter=t.slice(0));try{new MutationObserver(a).observe(e,r)}catch(t){r.handleEvent=o?i:n,e.addEventListener("DOMAttrModified",r,!0)}return e};function n(e){r(e.target,e.attrName,e.prevValue)}function r(e,n,r){var a=new t("attributechanged");a.attributeName=n,a.oldValue=r,a.newValue=e.getAttribute(n),e.dispatchEvent(a)}function a(e){for(var t,n=0,a=e.length;n<a;n++)r((t=e[n]).target,t.attributeName,t.oldValue)}function i(e){-1<this.attributeFilter.indexOf(e.attrName)&&n(e)}}(Q);function ee(e){return this.set(e,!0)}var te=/^(?:form|list)$/i;function ne(e){return this.type=e,G(this)}function re(e){return e(this)}ne.prototype={attribute:function(e,t,n){var r,a="svg"===this.type;switch(t){case"class":if(a)return J(e,t);t="className";case"props":return K(e,t);case"aria":return function(e){return function(t){for(var n in t)e.setAttribute("role"===n?n:"aria-".concat(n),t[n])}}(e);case"style":return U(e,n,a);case"ref":return function(e){return function(t){"function"==typeof t?t(e):t.current=e}}(e);case".dataset":return r=e.dataset,function(e){for(var t in e)r[t]=e[t]};default:return"."===t.slice(0,1)?K(e,t.slice(1)):"on"===t.slice(0,2)?function(e,t){var n,r=t.slice(2);return"connected"===r||"disconnected"===r?X(e):"attributechanged"===r?Y(e):!(t in e)&&t.toLowerCase()in e&&(r=r.toLowerCase()),function(t){var a=k(t)?t:[t,!1];n!==a[0]&&(n&&e.removeEventListener(r,n,a[1]),(n=a[0])&&e.addEventListener(r,n,a[1]))}}(e,t):t in e&&!a&&!te.test(t)?function(e,t){var n;return function(r){n!==r&&(n=r,e[t]!==r&&(null==r?(e[t]="",e.removeAttribute(t)):e[t]=r))}}(e,t):J(e,t)}},any:function(e,t){var n,r=this.type,a=!1;return function i(o){switch(typeof o){case"string":case"number":case"boolean":a?n!==o&&(n=o,t[0].textContent=o):(a=!0,n=o,t=_(e.parentNode,t,[function(e,t){return e.ownerDocument.createTextNode(t)}(e,o)],M,e));break;case"function":i(o(e));break;case"object":case"undefined":if(null==o){a=!1,t=_(e.parentNode,t,[],M,e);break}default:if(a=!1,n=o,k(o))if(0===o.length)t.length&&(t=_(e.parentNode,t,[],M,e));else switch(typeof o[0]){case"string":case"number":case"boolean":i(String(o));break;case"function":i(o.map(re,e));break;case"object":k(o[0])&&(o=o.concat.apply([],o));default:t=_(e.parentNode,t,o,M,e)}else"ELEMENT_NODE"in o?t=_(e.parentNode,t,11===o.nodeType?O.call(o.childNodes):[o],M,e):"text"in o?i(String(o.text)):"any"in o?i(o.any):"html"in o?t=_(e.parentNode,t,O.call($([].concat(o.html).join(""),r).childNodes),M,e):"length"in o&&i(O.call(o))}}},text:function(e){var t;return function n(r){if(t!==r){t=r;var a=typeof r;"object"===a&&r?"text"in r?n(String(r.text)):"any"in r?n(r.any):"html"in r?n([].concat(r.html).join("")):"length"in r&&n(O.call(r).join("")):"function"===a?n(r(e)):e.textContent=null==r?"":r}}}};var ae=Object.create,ie=Object.freeze,oe=Object.keys,ue=ne.prototype,ce=j(new o),se=function(e){return{html:fe("html",e),svg:fe("svg",e),render:function(t,n){var r="function"==typeof n?n():n,a=ce.get(t)||ce.set(t,le()),i=r instanceof pe?de(e,a,r):r;return i!==a.wire&&(a.wire=i,t.textContent="",t.appendChild(i.valueOf())),t}}},le=function(){return{stack:[],entry:null,wire:null}},fe=function(e,t){var n=j(new o);return r.for=function(e,a){var i,o=n.get(e)||n.set(e,ae(null));return o[a]||(o[a]=(i=le(),function(){return de(t,i,r.apply(null,arguments))}))},r.node=function(){return de(t,le(),r.apply(null,arguments)).valueOf()},r;function r(){return new pe(e,function(){var e=[],t=0,n=arguments.length;for(;t<n;)e.push(arguments[t++]);return e}.apply(null,arguments))}},de=function(e,t,r){var a,i=r.type,o=r.template,u=r.values,c=u.length;ve(e,t,u,c);var s=t.entry;if(s&&s.template===o&&s.type===i)(a=s).tag.apply(a,[o].concat(n(u)));else{var l=new e(i);t.entry=s={type:i,template:o,tag:l,wire:function(e){var t=e.childNodes,n=t.length;if(n<2)return n?t[0]:e;var r=O.call(t,0);return{ELEMENT_NODE:1,nodeType:111,firstChild:r[0],lastChild:r[n-1],valueOf:function(){if(t.length!==n)for(var a=0;a<n;)e.appendChild(r[a++]);return e}}}(l.apply(void 0,[o].concat(n(u))))}}return s.wire},ve=function e(t,n,r,a){for(var i=n.stack,o=0;o<a;o++){var u=r[o];u instanceof he?r[o]=de(t,i[o]||(i[o]=le()),u):k(u)?e(t,i[o]||(i[o]=le()),u,u.length):i[o]=null}a<i.length&&i.splice(a)};function pe(e,t){this.type=e,this.template=t.shift(),this.values=t}ie(pe);var he=pe,ge=se(ne),me=ge.render,ye=ge.html,be=ge.svg;return t.Hole=he,t.custom=function(e){var t=ae(ue);return oe(e).forEach(function(n){t[n]=e[n](t[n]||("convert"===n?h:String))}),n.prototype=t,se(n);function n(){return ne.apply(this,arguments)}},t.html=ye,t.render=me,t.svg=be,t}(document,{});