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