-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathmin.js
More file actions
3 lines (3 loc) · 16.6 KB
/
min.js
File metadata and controls
3 lines (3 loc) · 16.6 KB
1
2
3
/*! (c) Andrea Giammarchi (ISC) */var hyperHTML=function(e){"use strict";function t(){return this}function n(e){return e.join(X).replace(le,o).replace(ce,r)}function r(e,t,n,r){return"<"+t+n.replace(se,i)+r}function i(e,t,n){return t+(n||'"')+U+(n||'"')}function o(e,t,n){return re.test(t)?e:"<"+t+n+"></"+t+">"}function a(e,t,n,r){return{name:r,node:t,path:n,type:e}}function u(e,t){for(var n=t.length,r=0;r<n;)e=e.childNodes[t[r++]];return e}function c(e,t,n,r){for(var i=e.childNodes,o=i.length,u=0;u<o;){var s=i[u];switch(s.nodeType){case ee:var f=r.concat(u);l(s,t,n,f),c(s,t,n,f);break;case Y:s.textContent===U&&(n.shift(),t.push(ne.test(e.nodeName)?a("text",e,r):a("any",s,r.concat(u))));break;case te:ne.test(e.nodeName)&&Q.call(s.textContent)===X&&(n.shift(),t.push(a("text",e,r)))}u++}}function l(t,n,r,i){for(var o=new E,u=t.attributes,c=[],l=c.slice.call(u,0),s=l.length,f=0;f<s;){var h=l[f++];if(h.value===U){var d=h.name;if(!o.has(d)){var v=r.shift().replace(/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*['"]?$/,"$1"),p=u[v]||u[v.toLowerCase()];o.set(d,p),n.push(a("attr",p,i,v))}c.push(h)}}for(s=c.length,f=0;f<s;){var m=c[f++];/^id$/i.test(m.name)?t.removeAttribute(m.name):t.removeAttributeNode(m)}var g=t.nodeName;if(/^script$/i.test(g)){var b=e.createElement(g);for(s=u.length,f=0;f<s;)b.setAttributeNode(u[f++].cloneNode(!0));b.textContent=t.textContent,t.parentNode.replaceChild(b,t)}}function s(e,t){var r=n(t),i=e.transform;i&&(r=i(r));var o=J(r,e.type);d(o);var a=[];c(o,a,t.slice(0),[]);var l={content:o,updates:function(n){for(var r=[],i=a.length,o=0;o<i;){var c=a[o++],l=u(n,c.path);switch(c.type){case"any":r.push(e.any(l,[]));break;case"attr":r.push(e.attribute(l,c.name,c.node));break;case"text":r.push(e.text(l)),l.textContent=""}}return function(){var e=arguments.length,o=e-1,a=1;if(i!==o)throw new Error(o+" values instead of "+i+"\n"+t.join(", "));for(;a<e;)r[a-1](arguments[a++]);return n}}};return fe.set(t,l),l}function f(t,n){var r=fe.get(n)||s(t,n),i=K.call(e,r.content,!0),o={content:i,template:n,updates:r.updates(i)};return he.set(t,o),o}function h(e){return function(t){var n=he.get(e);return null!=n&&n.template===t||(n=f(e,t)),n.updates.apply(null,arguments),n.content}}function d(e){for(var t=e.childNodes,n=t.length;n--;){var r=t[n];1!==r.nodeType&&0===Q.call(r.textContent).length&&e.removeChild(r)}}function v(e){return this.type=e,h(this)}function p(){var e=_e.get(this),t=be.apply(null,arguments);return e&&e.template===t[0]?e.tagger.apply(null,t):m.apply(this,t),this}function m(e){var t=ve in this?"svg":"html",n=new v(t);_e.set(this,{tagger:n,template:e}),this.textContent="",this.appendChild(n.apply(null,arguments))}function g(e){return arguments.length<2?null==e?je("html"):"string"==typeof e?g.wire(null,e):"raw"in e?je("html")(e):"nodeType"in e?g.bind(e):Te(e,"html"):("raw"in e?je("html"):g.wire).apply(null,arguments)}/*! (c) Andrea Giammarchi - ISC */
var b={};try{b.WeakMap=WeakMap}catch(WeakMap){b.WeakMap=function(e,t){function n(t){i(this,"_",{value:"_@ungap/weakmap"+e++}),t&&t.forEach(r,this)}function r(e){this.set(e[0],e[1])}var i=t.defineProperty,o=t.hasOwnProperty,a=n.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 o.call(e,this._)},a.set=function(e,t){return i(e,this._,{configurable:!0,value:t}),this},n}(Math.random(),Object)}var w=b.WeakMap,y={};try{y.WeakSet=WeakSet}catch(WeakSet){!function(e,t){function n(){t(this,"_",{value:"_@ungap/weakmap"+e++})}var r=n.prototype;r.add=function(e){return this.has(e)||t(e,this._,{value:!0,configurable:!0}),this},r.has=function(e){return this.hasOwnProperty.call(e,this._)},r["delete"]=function(e){return this.has(e)&&delete e[this._]},y.WeakSet=n}(Math.random(),Object.defineProperty)}var N=y.WeakSet,x={};try{x.Map=Map}catch(Map){x.Map=function(){function e(e){return-1<(t=n.indexOf(e))}var t=0,n=[],r=[];return{"delete":function(i){var o=e(i);return o&&(n.splice(t,1),r.splice(t,1)),o},get:function(n){return e(n)?r[t]:void 0},has:function(t){return e(t)},set:function(i,o){return r[e(i)?t:n.push(i)-1]=o,this}}}}var E=x.Map,k=function(e,t,n,r,i,o){if(i-r<2)t.insertBefore(e(n[r],1),o);else{for(var a=t.ownerDocument.createDocumentFragment();r<i;)a.appendChild(e(n[r++],1));t.insertBefore(a,o)}},C=function(e,t){return e==t},A=function(e){return e},S=function(e,t,n,r,i,o,a){var u=o-i;if(u<1)return-1;for(;n-t>=u;){for(var c=t,l=i;c<n&&l<o&&a(e[c],r[l]);)c++,l++;if(l===o)return t;t=c+1}return-1},M=function(e,t,n,r,i,o){for(;r<i&&o(n[r],e[t-1]);)r++,t--;return 0===t},j=function(e,t,n,r,i){return n<r?e(t[n],0):0<n?e(t[n-1],-0).nextSibling:i},T=function(e,t,n,r,i){if(i-r<2)t.removeChild(e(n[r],-1));else{var o=t.ownerDocument.createRange();o.setStartBefore(e(n[r],-1)),o.setEndAfter(e(n[i-1],-1)),o.deleteContents()}},O=function(e,t,n,r,i,o,a,u){var c=0,l=r<u?r:u,s=Array(l++),f=Array(l);f[0]=-1;for(var h=1;h<l;h++)f[h]=a;for(var d=new E,v=o;v<a;v++)d.set(i[v],v);for(var p=t;p<n;p++){var m=d.get(e[p]);null!=m&&-1<(c=P(f,l,m))&&(f[c]=m,s[c]={newi:p,oldi:m,prev:s[c-1]})}for(c=--l,--a;f[c]>a;)--c;l=u+r-c;var g=Array(l),b=s[c];for(--n;b;){for(var w=b,y=w.newi,N=w.oldi;n>y;)g[--l]=1,--n;for(;a>N;)g[--l]=-1,--a;g[--l]=0,--n,--a,b=b.prev}for(;n>=t;)g[--l]=1,--n;for(;a>=o;)g[--l]=-1,--a;return g},_=function(e,t,n,r,i,o,a){var u,c,l,s,f,h,d,v=n+o,p=[];e:for(u=0;u<=v;u++){if(u>50)return null;for(d=u-1,f=u?p[u-1]:[0,0],h=p[u]=[],c=-u;c<=u;c+=2){for(s=c===-u||c!==u&&f[d+c-1]<f[d+c+1]?f[d+c+1]:f[d+c-1]+1,l=s-c;s<o&&l<n&&a(r[i+s],e[t+l]);)s++,l++;if(s===o&&l===n)break e;h[u+c]=s}}var m=Array(u/2+v/2),g=m.length-1;for(u=p.length-1;u>=0;u--){for(;s>0&&l>0&&a(r[i+s-1],e[t+l-1]);)m[g--]=0,s--,l--;if(!u)break;d=u-1,f=u?p[u-1]:[0,0],c=s-l,c===-u||c!==u&&f[d+c-1]<f[d+c+1]?(l--,m[g--]=1):(s--,m[g--]=-1)}return m},L=function(e,t,n,r,i,o,a,u,c){for(var l=new E,s=e.length,f=a,h=0;h<s;)switch(e[h++]){case 0:i++,f++;break;case 1:l.set(r[i],1),k(t,n,r,i++,i,f<u?t(o[f],1):c);break;case-1:f++}for(h=0;h<s;)switch(e[h++]){case 0:a++;break;case-1:l.has(o[a])?a++:T(t,n,o,a++,a)}},P=function(e,t,n){for(var r=1,i=t;r<i;){var o=(r+i)/2>>>0;n<e[o]?i=o:r=o+1}return r},W=function(e,t,n,r,i,o,a,u,c,l,s,f,h){L(_(n,r,o,a,u,l,f)||O(n,r,i,o,a,u,c,l),e,t,n,r,a,u,s,h)},D=function(e,t,n,r){r||(r={});for(var i=r.compare||C,o=r.node||A,a=null==r.before?null:o(r.before,0),u=t.length,c=u,l=0,s=n.length,f=0;l<c&&f<s&&i(t[l],n[f]);)l++,f++;for(;l<c&&f<s&&i(t[c-1],n[s-1]);)c--,s--;var h=l===c,d=f===s;if(h&&d)return n;if(h&&f<s)return k(o,e,n,f,s,j(o,t,l,u,a)),n;if(d&&l<c)return T(o,e,t,l,c),n;var v=c-l,p=s-f,m=-1;if(v<p){if(-1<(m=S(n,f,s,t,l,c,i)))return k(o,e,n,f,m,o(t[l],0)),k(o,e,n,m+v,s,j(o,t,c,u,a)),n}else if(p<v&&-1<(m=S(t,l,c,n,f,s,i)))return T(o,e,t,l,m),T(o,e,t,m+p,c),n;return v<2||p<2?(k(o,e,n,f,s,o(t[l],0)),T(o,e,t,l,c),n):v===p&&M(n,s,t,l,c,i)?(k(o,e,n,f,s,j(o,t,c,u,a)),n):(W(o,e,n,f,s,p,t,l,c,v,u,i,a),n)},$={};$.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(t){function n(t,n){n||(n={});var r=e.createEvent("CustomEvent");return r.initCustomEvent(t,!!n.bubbles,!!n.cancelable,n.detail),r}return n.prototype=new n("").constructor.prototype,n}();var F=$.CustomEvent,R=function(e,t){var n="_"+e+"$";return{get:function(){return this[n]||H(this,n,t.call(this,e))},set:function(e){H(this,n,e)}}},H=function(e,t,n){return Object.defineProperty(e,t,{configurable:!0,value:"function"==typeof n?function(){return e._wire$=n.apply(this,arguments)}:n})[t]},z={},B={},Z=[],V=B.hasOwnProperty,G=0,I={attributes:z,define:function(e,t){e.indexOf("-")<0?(e in B||(G=Z.push(e)),B[e]=t):z[e]=t},invoke:function(e,t){for(var n=0;n<G;n++){var r=Z[n];if(V.call(e,r))return B[r](e[r],t)}}},q=Array.isArray||function(e){var t=e.call([]);return function(n){return e.call(n)===t}}({}.toString),J=function(e){function t(e,t){for(var n=t.length;n--;)e.appendChild(t[0])}function n(t){return t===i?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",t)}function r(e){var r=n(i),o=n("div");return o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",t(r,o.firstChild.childNodes),r}var i="fragment",o="content"in n("template"),a=o?function(e){var t=n("template");return t.innerHTML=e,t.content}:function(e){var r=n(i),o=n("template"),a=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var u=RegExp.$1;o.innerHTML="<table>"+e+"</table>",a=o.querySelectorAll(u)}else o.innerHTML=e,a=o.childNodes;return t(r,a),r};return function(e,t){return("svg"===t?r:a)(e)}}(e),K=function(e,t,n,r,i){var o="importNode"in e,a=e.createDocumentFragment();return a.appendChild(e.createTextNode("g")),a.appendChild(e.createTextNode("")),(o?e.importNode(a,!0):a.cloneNode(!0)).childNodes.length<2?function u(e,t){for(var n=e.cloneNode(),r=e.childNodes||[],i=r.length,o=0;t&&o<i;o++)n.appendChild(u(r[o],t));return n}:o?e.importNode:function(e,t){return e.cloneNode(!!t)}}(e),Q="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},U="-"+Math.random().toFixed(6)+"%";(function(e,t,n){return"content"in e&&(e.innerHTML='<p tabindex="'+U+'"></p>',e.content.childNodes[0].getAttribute("tabindex")==U)})(e.createElement("template"))||(U="_dt: "+U.slice(1,-1)+";");var X="\x3c!--"+U+"--\x3e",Y=8,ee=1,te=3,ne=/^(?:style|textarea)$/i,re=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,ie=" \\f\\n\\r\\t",oe="[ "+ie+"]+[^ \\f\\n\\r\\t\\/>\"'=]+",ae="<([A-Za-z]+[A-Za-z0-9:_-]*)((?:",ue="(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|<[^>]*?>|[^ \\f\\n\\r\\t\\/>\"'=]+))?)",ce=new RegExp(ae+oe+ue+"+)([ "+ie+"]*/?>)","g"),le=new RegExp(ae+oe+ue+"*)([ "+ie+"]*/>)","g"),se=new RegExp("("+oe+"\\s*=\\s*)(['\"]?)"+X+"\\2","gi"),fe=new w,he=new w,de=function(){function e(e,t,n){return t+"-"+n.toLowerCase()}function t(e,t){var n;return t?n=t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),n=e.getAttributeNode("style")),n.value="",e.setAttributeNode(n),r(n,!0)}function n(t){var n,r=[];for(n in t)r.push(n.replace(o,e),":",t[n],";");return r.join("")}function r(e,t){var r,o;return function(a){var u,c,l,s;switch(typeof a){case"object":if(a){if("object"===r){if(!t&&o!==a)for(c in o)c in a||(e[c]="")}else t?e.value="":e.cssText="";u=t?{}:e;for(c in a)s=a[c],l="number"!=typeof s||i.test(c)?s:s+"px",!t&&/^--/.test(c)?u.setProperty(c,l):u[c]=l;r="object",t?e.value=n(o=u):o=a;break}default:o!=a&&(r="string",o=a,t?e.value=a||"":e.cssText=a||"")}}}var i=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,o=/([^A-Z])([A-Z]+)/g;return function(e,n){return"ownerSVGElement"in e?t(e,n):r(e.style,!1)}}(),ve="ownerSVGElement",pe=function(e,t){function n(t){var n=this.n=e.call(t,0),r=n[0];this.first=r,this.last=n[n.length-1],this.d=r.ownerDocument||r,this.f=null}return t=n.prototype,t.remove=function(e){var t=this.n,n=this.first,r=this.last;if(this.f=null,e&&2===t.length)r.parentNode.removeChild(r);else{var i=this.d.createRange();i.setStartBefore(e?t[1]:n),i.setEndAfter(r),i.deleteContents()}return n},t.valueOf=function(e){var t=this.f,n=null==t;if(n&&(t=this.f=this.d.createDocumentFragment()),n||e)for(var r=this.n,i=0,o=r.length;i<o;i++)t.appendChild(r[i]);return t},n}([].slice),me=function(){var t=!1,n=function(r){if(!("raw"in r)||r.propertyIsEnumerable("raw")||!Object.isFrozen(r.raw)||/Firefox\/(\d+)/.test((e.defaultView.navigator||{}).userAgent)&&parseFloat(RegExp.$1)<55){var i={};return(n=function(e){var t="raw"+e.join("raw");return i[t]||(i[t]=e)})(r)}return t=!0,r};return function(e){return t?e:n(e)}}(),ge=function(e,t){return e.ownerDocument.createTextNode(t)},be=function(e){for(var t=[me(e)],n=1,r=arguments.length;n<r;n++)t[n]=arguments[n];return t},we=[].slice,ye=/*! (c) Andrea Giammarchi */
function(e){function t(e){function t(e){s=new l;for(var t,i=e.length,o=0;o<i;o++)t=e[o],a(t.removedNodes,r,n),a(t.addedNodes,n,r);s=null}function a(e,t,n){for(var r,o=new i(t),a=e.length,u=0;u<a;1===(r=e[u++]).nodeType&&c(r,o,t,n));}function c(e,t,n,r){u.has(e)&&!s[n].has(e)&&(s[r]["delete"](e),s[n].add(e),e.dispatchEvent(t));for(var i=e.children||[],o=i.length,a=0;a<o;c(i[a++],t,n,r));}function l(){this[n]=new o,this[r]=new o}var s=null;try{new MutationObserver(t).observe(e,{subtree:!0,childList:!0})}catch(v){var f=0,h=[],d=function(e){h.push(e),clearTimeout(f),f=setTimeout(function(){t(h.splice(f=0,h.length))},0)};e.addEventListener("DOMNodeRemoved",function(e){d({addedNodes:[],removedNodes:[e.target]})},!0),e.addEventListener("DOMNodeInserted",function(e){d({addedNodes:[e.target],removedNodes:[]})},!0)}}var n="connected",r="dis"+n,i=e.Event,o=e.WeakSet,a=!0,u=new o;return function(e){return a&&(a=!a,t(e.ownerDocument)),u.add(e),e}}({Event:F,WeakSet:N}),Ne=function(e){return{html:e}},xe=function De(e,t){return"ELEMENT_NODE"in e?e:e.constructor===pe?1/t<0?t?e.remove(!0):e.last:t?e.valueOf(!0):e.first:De(e.render(),t)},Ee=function(e){return"ELEMENT_NODE"in e||e instanceof pe||e instanceof t},ke=function(e,t){t(e.placeholder),"text"in e?Promise.resolve(e.text).then(String).then(t):"any"in e?Promise.resolve(e.any).then(t):"html"in e?Promise.resolve(e.html).then(Ne).then(t):Promise.resolve(I.invoke(e,t)).then(t)},Ce=function(e){return null!=e&&"then"in e},Ae=/^(?:form|list)$/i;v.prototype={attribute:function(e,t,n){var r,i=ve in e;if("style"===t)return de(e,n,i);if(/^on/.test(t)){var o=t.slice(2);return"connected"===o||"disconnected"===o?ye(e):t.toLowerCase()in e&&(o=o.toLowerCase()),function(t){r!==t&&(r&&e.removeEventListener(o,r,!1),r=t,t&&e.addEventListener(o,t,!1))}}if("data"===t||!i&&t in e&&!Ae.test(t))return function(n){r!==n&&(r=n,e[t]!==n&&(e[t]=n,null==n&&e.removeAttribute(t)))};if(t in I.attributes)return function(n){var i=I.attributes[t](e,n);r!==i&&(r=i,null==i?e.removeAttribute(t):e.setAttribute(t,i))};var a=!1,u=n.cloneNode(!0);return function(t){r!==t&&(r=t,u.value!==t&&(null==t?(a&&(a=!1,e.removeAttributeNode(u)),u.value=t):(u.value=t,a||(a=!0,e.setAttributeNode(u)))))}},any:function(e,t){var n,r={node:xe,before:e},i=ve in e?"svg":"html",o=!1;return function a(u){switch(typeof u){case"string":case"number":case"boolean":o?n!==u&&(n=u,t[0].textContent=u):(o=!0,n=u,t=D(e.parentNode,t,[ge(e,u)],r));break;case"function":a(u(e));break;case"object":case"undefined":if(null==u){o=!1,t=D(e.parentNode,t,[],r);break}default:if(o=!1,n=u,q(u))if(0===u.length)t.length&&(t=D(e.parentNode,t,[],r));else switch(typeof u[0]){case"string":case"number":case"boolean":a({html:u});break;case"object":if(q(u[0])&&(u=u.concat.apply([],u)),Ce(u[0])){Promise.all(u).then(a);break}default:t=D(e.parentNode,t,u,r)}else Ee(u)?t=D(e.parentNode,t,11===u.nodeType?we.call(u.childNodes):[u],r):Ce(u)?u.then(a):"placeholder"in u?ke(u,a):"text"in u?a(String(u.text)):"any"in u?a(u.any):"html"in u?t=D(e.parentNode,t,we.call(J([].concat(u.html).join(""),i).childNodes),r):a("length"in u?we.call(u):I.invoke(u,a))}}},text:function(e){var t;return function n(r){if(t!==r){t=r;var i=typeof r;"object"===i&&r?Ce(r)?r.then(n):"placeholder"in r?ke(r,n):n("text"in r?String(r.text):"any"in r?r.any:"html"in r?[].concat(r.html).join(""):"length"in r?we.call(r).join(""):I.invoke(r,n)):"function"===i?n(r(e)):e.textContent=null==r?"":r}}}};var Se=new w,Me=function(e,t){return null==e?je(t||"html"):Te(e,t||"html")},je=function(e){var t,n,r;return function(){var i=be.apply(null,arguments);return r!==i[0]?(r=i[0],n=new v(e),t=Oe(n.apply(n,i))):n.apply(n,i),t}},Te=function(e,t){var n=t.indexOf(":"),r=Se.get(e),i=t;return-1<n&&(i=t.slice(n+1),t=t.slice(0,n)||"html"),r||Se.set(e,r={}),r[i]||(r[i]=je(t))},Oe=function(e){var t=e.childNodes,n=t.length;return 1===n?t[0]:n?new pe(t):e},_e=new w,Le=function(e){return p.bind(e)},Pe=I.define,We=v.prototype;return g.Component=t,g.bind=Le,g.define=Pe,g.diff=D,g.hyper=g,g.observe=ye,g.tagger=We,g.wire=Me,g._={WeakMap:w,WeakSet:N},function(e){var n=new w,r=Object.create,i=function(e,t,n){return e.set(t,n),n},o=function(e,t,n,o){var u=t.get(e)||a(e,t);switch(typeof o){case"object":case"function":var c=u.w||(u.w=new w);return c.get(o)||i(c,o,new e(n));default:var l=u.p||(u.p=r(null));return l[o]||(l[o]=new e(n))}},a=function(e,t){var n={w:null,p:null};return t.set(e,n),n},u=function(e){var t=new E;return n.set(e,t),t};Object.defineProperties(t,{"for":{configurable:!0,value:function(e,t){return o(this,n.get(e)||u(e),e,null==t?"default":t)}}}),Object.defineProperties(t.prototype,{handleEvent:{value:function(e){var t=e.currentTarget;this["getAttribute"in t&&t.getAttribute("data-call")||"on"+e.type](e)}},html:R("html",e),svg:R("svg",e),state:R("state",function(){return this.defaultState}),defaultState:{get:function(){return{}}},dispatch:{value:function(e,t){var n=this._wire$;if(n){var r=new F(e,{bubbles:!0,cancelable:!0,detail:t});return r.component=this,(n.dispatchEvent?n:n.n[0]).dispatchEvent(r)}return!1}},setState:{value:function(e,t){var n=this.state,r="function"==typeof e?e.call(this,n):e;for(var i in r)n[i]=r[i];return!1!==t&&this.render(),this}}})}(je),g}(document);