-
Notifications
You must be signed in to change notification settings - Fork 1
/
min.js
2 lines (2 loc) · 11 KB
/
min.js
1
2
self.ube=function(e){"use strict";
/*! (c) Andrea Giammarchi - ISC */"isConnected"in Node.prototype||Object.defineProperty(Node.prototype,"isConnected",{configurable:!0,get:function(){return!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}});var t=!0,n=!1,r="querySelectorAll";function a(e){this.observe(e,{subtree:t,childList:t})}var o,i,c,u="Element",l="attributeChangedCallback",f="connectedCallback",s="disconnectedCallback",d="upgradedCallback",v="downgradedCallback",p=(c=["Article","Aside","Footer","Header","Main","Nav","Section",u],(i=u)in(o={Anchor:"A",DList:"DL",Directory:"Dir",Heading:["H6","H5","H4","H3","H2","H1"],Image:"Img",OList:"OL",Paragraph:"P",TableCaption:"Caption",TableCell:["TH","TD"],TableRow:"TR",UList:"UL"})?Object.defineProperty(o,i,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[i]=c,o),h=Object.getOwnPropertyNames,g=Object.setPrototypeOf,b=new WeakMap,m=new WeakMap,w=new Set,y=function(e,t){return document.createElementNS(t?"http://www.w3.org/2000/svg":"",e)},C=new MutationObserver((function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n.target,a=n.attributeName,o=n.oldValue;b.has(r)&&r.attributeChangedCallback(a,o,r.getAttribute(a))}})),N=function(e){w.has(e.constructor)||(b.delete(e),m.delete(e),v in e&&e.downgradedCallback(),g(e,y(e.tagName,"ownerSVGElement"in e).constructor.prototype))},k=function(e,t){if(!(e instanceof t)){N(e),g(e,t.prototype),d in e&&e.upgradedCallback();var n=t.observedAttributes;if(n&&l in e){b.set(e,0),C.observe(e,{attributeFilter:n,attributeOldValue:!0,attributes:!0});for(var r=0;r<n.length;r++){var a=n[r],o=e.getAttribute(a);null!=o&&e.attributeChangedCallback(a,null,o)}}(f in e||s in e)&&(m.set(e,0),e.isConnected&&f in e&&e.connectedCallback())}return e},A={},O={};h(window).forEach((function(e){if(/^(HTML|SVG)/.test(e)){var t=RegExp.$1,n="SVG"==t,r=e.slice(t.length,-7)||u,a=n?A:O,o=window[e];w.add(o),[].concat(p[r]||r).forEach((function(e){var t=e.toLowerCase();function i(){return k(y(t,n),this.constructor)}i.tagName=t,i.prototype=o.prototype,a[r]=a[e]=i}))}}));var S=function(e,o,i){var c=function n(a,o,i,c,u){for(var l=0,f=a.length;l<f;l++){var s=a[l];(u||r in s)&&(c?o.has(s)||(o.add(s),i.delete(s),e(s,c)):i.has(s)||(i.add(s),o.delete(s),e(s,c)),u||n(s[r]("*"),o,i,c,t))}},u=new(i||MutationObserver)((function(e){for(var r=new Set,a=new Set,o=0,i=e.length;o<i;o++){var u=e[o],l=u.addedNodes,f=u.removedNodes;c(f,r,a,n,n),c(l,r,a,t,n)}}));return u.add=a,u.add(o||document),u}((function(e,t){if(m.has(e)){var n=t?f:s;n in e&&e[n]()}})),x=new WeakMap;function T(e){var t=arguments,n=x.get(e);return n||x.set(e,n=E.apply(null,arguments)),[n.t].concat(n.v.map((function(e){return t[e]})))}function E(e){for(var t=[e[0]],n=[],r=0,a=0,o=1,i=arguments.length;o<i;o++)arguments[o]instanceof String?t[r]+=arguments[o]+e[o]:(n[a++]=o,t[++r]=e[o]);return{t:t,v:n}}var L=function(e){return new String(e)},M=function(e){return{get:function(t){return e.get(t)},set:function(t,n){return e.set(t,n),n}}},H=/([^\s\\>"'=]+)\s*=\s*(['"]?)$/,D=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,j=/<[a-z][^>]+$/i,P=/>[^<>]*$/,W=/<([a-z]+[a-z0-9:._-]*)([^>]*?)(\/>)/gi,$=/\s+$/,R=function e(t,n){return 0<n--&&(j.test(t[n])||!P.test(t[n])&&e(t,n))},V=function(e,t,n){return D.test(t)?e:"<".concat(t).concat(n.replace($,""),"></").concat(t,">")},I=function(e,t,n){for(var r=[],a=e.length,o=function(n){var a=e[n-1];r.push(H.test(a)&&R(e,n)?a.replace(H,(function(e,r,a){return"".concat(t).concat(n-1,"=").concat(a||'"').concat(r).concat(a?"":'"')})):"".concat(a,"\x3c!--").concat(t).concat(n-1,"--\x3e"))},i=1;i<a;i++)o(i);r.push(e[a-1]);var c=r.join("").trim();return n?c:c.replace(W,V)},_=Array.isArray,B=[],G=B.indexOf,q=B.slice,z=function(e,t){return 111===e.nodeType?1/t<0?t?function(e){var t=e.firstChild,n=e.lastChild,r=document.createRange();return r.setStartAfter(t),r.setEndAfter(n),r.deleteContents(),t}(e):e.lastChild:t?e.valueOf():e.firstChild:e},F=function(e,t){var n,r=t.slice(2);return!(t in e)&&t.toLowerCase()in e&&(r=r.toLowerCase()),function(t){var a=_(t)?t:[t,!1];n!==a[0]&&(n&&e.removeEventListener(r,n,a[1]),(n=a[0])&&e.addEventListener(r,n,a[1]))}},U=function(e){var t="fragment",n="template",r="content"in o(n)?function(e){var t=o(n);return t.innerHTML=e,t.content}:function(e){var r=o(t),i=o(n),c=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var u=RegExp.$1;i.innerHTML="<table>"+e+"</table>",c=i.querySelectorAll(u)}else i.innerHTML=e,c=i.childNodes;return a(r,c),r};return function(e,t){return("svg"===t?i:r)(e)};function a(e,t){for(var n=t.length;n--;)e.appendChild(t[0])}function o(n){return n===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",n)}function i(e){var n=o(t),r=o("div");return r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",a(n,r.firstChild.childNodes),n}}(document),J=function(e,t){return e.childNodes[t]},K=function(e){for(var t=[],n=e.parentNode;n;)t.push(G.call(n.childNodes,e)),n=(e=n).parentNode;return t},Q=document,X=Q.createTreeWalker,Y=Q.importNode,Z=1!=Y.length,ee=Z?function(e,t,n){return Y.call(document,U(e,t,n),!0)}:U,te=Z?function(e){return X.call(document,e,129,null,!1)}:function(e){return X.call(document,e,129)},ne=function(e,t,n){return function(e,t,n,r,a){for(var o=n.length,i=t.length,c=o,u=0,l=0,f=null;u<i||l<c;)if(i===u)for(var s=c<o?l?r(n[l-1],-0).nextSibling:r(n[c-l],0):a;l<c;)e.insertBefore(r(n[l++],1),s);else if(c===l)for(;u<i;)f&&f.has(t[u])||e.removeChild(r(t[u],-1)),u++;else if(t[u]===n[l])u++,l++;else if(t[i-1]===n[c-1])i--,c--;else if(t[u]===n[c-1]&&n[l]===t[i-1]){var d=r(t[--i],-1).nextSibling;e.insertBefore(r(n[l++],1),r(t[u++],-1).nextSibling),e.insertBefore(r(n[--c],1),d),t[i]=n[c]}else{if(!f){f=new Map;for(var v=l;v<c;)f.set(n[v],v++)}if(f.has(t[u])){var p=f.get(t[u]);if(l<p&&p<c){for(var h=u,g=1;++h<i&&h<c&&f.get(t[h])===p+g;)g++;if(g>p-l)for(var b=r(t[u],0);l<p;)e.insertBefore(r(n[l++],1),b);else e.replaceChild(r(n[l++],1),r(t[u++],-1))}else u++}else e.removeChild(r(t[u++],-1))}return n}(e.parentNode,t,n,z,e)},re=function(e,t){switch(t[0]){case"?":return function(e,t,n){return function(r){n!==!!r&&((n=!!r)?e.setAttribute(t,""):e.removeAttribute(t))}}(e,t.slice(1),!1);case".":return function(e,t){return"dataset"===t?function(e){var t=e.dataset;return function(e){for(var n in e){var r=e[n];null==r?delete t[n]:t[n]=r}}}(e):function(n){e[t]=n}}(e,t.slice(1));case"@":return F(e,"on"+t.slice(1));case"o":if("n"===t[1])return F(e,t)}switch(t){case"ref":return function(e){var t;return function(n){t!==n&&(t=n,"function"==typeof n?n(e):n.current=e)}}(e);case"aria":return function(e){return function(t){for(var n in t){var r="role"===n?n:"aria-".concat(n),a=t[n];null==a?e.removeAttribute(r):e.setAttribute(r,a)}}}(e)}return function(e,t){var n,r=!0,a=document.createAttributeNS(null,t);return function(t){n!==t&&(null==(n=t)?r||(e.removeAttributeNode(a),r=!0):(a.value=t,r&&(e.setAttributeNodeNS(a),r=!1)))}}(e,t)};function ae(e){var t=e.type,n=e.path.reduceRight(J,this);return"node"===t?function(e){var t,n,r=[];return function a(o){switch(typeof o){case"string":case"number":case"boolean":t!==o&&(t=o,n||(n=document.createTextNode("")),n.data=o,r=ne(e,r,[n]));break;case"object":case"undefined":if(null==o){t!=o&&(t=o,r=ne(e,r,[]));break}if(_(o)){t=o,0===o.length?r=ne(e,r,[]):"object"==typeof o[0]?r=ne(e,r,o):a(String(o));break}t!==o&&"ELEMENT_NODE"in o&&(t=o,r=ne(e,r,11===o.nodeType?q.call(o.childNodes):[o]));break;case"function":a(o(e))}}}(n):"attr"===t?re(n,e.name):function(e){var t;return function(n){t!=n&&(t=n,e.textContent=null==n?"":n)}}(n)}var oe="isµ",ie=M(new WeakMap),ce=/^(?:plaintext|script|style|textarea|title|xmp)$/i,ue=function(e,t){var n=ie.get(t)||ie.set(t,function(e,t){for(var n=I(t,oe,"svg"===e),r=ee(n,e),a=te(r),o=[],i=t.length-1,c=0,u="".concat(oe).concat(c);c<i;){var l=a.nextNode();if(!l)throw"bad template: ".concat(n);if(8===l.nodeType)l.data===u&&(o.push({type:"node",path:K(l)}),u="".concat(oe).concat(++c));else{for(;l.hasAttribute(u);)o.push({type:"attr",path:K(l),name:l.getAttribute(u)}),l.removeAttribute(u),u="".concat(oe).concat(++c);ce.test(l.tagName)&&l.textContent.trim()==="\x3c!--".concat(u,"--\x3e")&&(l.textContent="",o.push({type:"text",path:K(l)}),u="".concat(oe).concat(++c))}}return{content:r,nodes:o}}(e,t)),r=n.content,a=n.nodes,o=Y.call(document,r,!0);return{content:o,updates:a.map(ae,o)}},le=function(e,t){var n=t.type,r=t.template,a=t.values,o=a.length;fe(e,a,o);var i=e.entry;i&&i.template===r&&i.type===n||(e.entry=i=function(e,t){var n=ue(e,t);return{type:e,template:t,content:n.content,updates:n.updates,wire:null}}(n,r));for(var c=i,u=c.content,l=c.updates,f=c.wire,s=0;s<o;s++)l[s](a[s]);return f||(i.wire=function(e){var t=e.childNodes,n=t.length;if(n<2)return n?t[0]:e;var r=q.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}}}(u))},fe=function e(t,n,r){for(var a=t.stack,o=0;o<r;o++){var i=n[o];i instanceof se?n[o]=le(a[o]||(a[o]={stack:[],entry:null,wire:null}),i):_(i)?e(a[o]||(a[o]={stack:[],entry:null,wire:null}),i,i.length):a[o]=null}r<a.length&&a.splice(r)};function se(e,t,n){this.type=e,this.template=t,this.values=n}var de=Object.create,ve=Object.defineProperties,pe=function(e){var t=M(new WeakMap);return ve((function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new se(e,t,r)}),{for:{value:function(n,r){var a=t.get(n)||t.set(n,de(null));return a[r]||(a[r]=function(t){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return le(t,{type:e,template:n,values:a})}}({stack:[],entry:null,wire:null}))}},node:{value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return le({stack:[],entry:null,wire:null},{type:e,template:t,values:r}).valueOf()}}})},he=M(new WeakMap),ge=function(e,t){var n="function"==typeof t?t():t,r=he.get(e)||he.set(e,{stack:[],entry:null,wire:null}),a=n instanceof se?le(r,n):n;return a!==r.wire&&(r.wire=a,e.textContent="",e.appendChild(a.valueOf())),e},be=pe("html"),me=pe("svg"),we="data-ube",ye=new WeakMap,Ce=[],Ne=function(e){var t=Ce.indexOf(e);return t<0?Ce.push(e)-1:t},ke=function(e){function t(){return Se.apply(e,arguments)}return t.for=function(t,n){return function(){return Se.apply(e.for(t,n),arguments)}},t};var Ae=ke(be),Oe=ke(me);function Se(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0],a=ye.get(r);if(a)for(var o=0,i=a,c=i.length;o<c;o++)t[a[o].i]=a[o].v;else{ye.set(r,a=[]);for(var u=1,l=t.length;u<l;u++){var f=t[u];if("function"==typeof f&&"tagName"in f){var s=f,d=s.tagName,v=r[u-1];switch(v[v.length-1]){case"<":f=L("".concat(d," ").concat(we,"=").concat(Ne(f)));break;case"/":f=L(d)}a.push({i:u,v:f}),t[u]=f}}}return this.apply(null,T.apply(null,t))}return e.HTML=O,e.SVG=A,e.downgrade=N,e.html=Ae,e.observer=S,e.render=function(e){for(var t=ge.apply(this,arguments),n=e.querySelectorAll("[".concat(we,"]")),r=0,a=n.length;r<a;r++){var o=Ce[n[r].getAttribute(we)];n[r].removeAttribute(we),k(n[r],o)}return t},e.svg=Oe,e.upgrade=k,e}({});