-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathes.js
5 lines (5 loc) · 10.4 KB
/
es.js
1
2
3
4
5
self.uland=function(e){"use strict";function t(e){this.observe(e,{subtree:!0,childList:!0})}function n(e){e.type in this&&this[e.type](e)}let r=null,s=new Set;const o=e=>{const{$:t,r:n,h:r}=e;p(n)&&(c.get(r).delete(e),n()),p(e.r=t())&&c.get(r).add(e)},l=()=>{const e=s;s=new Set,e.forEach((({h:e,c:t,a:n,e:r})=>{r&&e.apply(t,n)}))},c=new WeakMap,a=[],i=[];function u(e,t){return e!==this[t]}const d=e=>{const t=c.get(e);t&&m.then((()=>{t.forEach((e=>{e.r(),e.r=null,e.d=!0})),t.clear()}))},h=()=>r,f=e=>c.has(e),p=e=>"function"==typeof e,g=e=>{const t={h:n,c:null,a:null,e:0,i:0,s:[]};return n;function n(){const n=r;r=t,t.e=t.i=0;try{return e.apply(t.c=this,t.a=arguments)}finally{r=n,a.length&&m.then(a.forEach.bind(a.splice(0),o)),i.length&&i.splice(0).forEach(o)}}},m=Promise.resolve();function y(e){const{_:t,value:n}=this;n!==e&&(this._=new Set,this.value=e,t.forEach((({h:e,c:t,a:n})=>{e.apply(t,n)})))}const v=(e,t)=>{const n=h(),{i:r,s:s}=n;return r!==s.length&&t&&!t.some(u,s[r]._)||(s[r]={$:e(),_:t}),s[n.i++].$},w=e=>(t,n)=>{const r=h(),{i:s,s:o,h:l}=r,a=s===o.length;r.i++,a&&(c.has(l)||c.set(l,new Set),o[s]={$:t,_:n,r:null,d:!1,h:l}),(a||!n||o[s].d||n.some(u,o[s]._))&&e.push(o[s]),o[s].$=t,o[s]._=n,o[s].d=!1},b=w(a),E=w(i),x=(e,t)=>p(t)?t(e):t,k=(e,t,n)=>{const r=h(),{i:o,s:c}=r;o===c.length&&c.push({$:p(n)?n(t):x(void 0,t),set:t=>{c[o].$=e(c[o].$,t),(e=>{s.has(e)||(e.e=1,s.add(e),m.then(l))})(r)}});const{$:a,set:i}=c[r.i++];return[a,i]};
/*! (c) Andrea Giammarchi - ISC */
let C=null,N=null,$=null;const A=new WeakMap,M=new WeakMap,S=(e,t,n,r)=>{const s=s=>{A.has(e)||(A.set(e,0),m.then((()=>{A.delete(e),e.apply(t,n)}))),r(s)};return M.set(r,s),s},T=(e,t,n,r)=>e?[r[0],M.get(r[1])||S(e,t,n,r[1])]:r,_=(e,t)=>{const n=g(t?function(){const[t,r,s]=[C,N,$];[C,N,$]=[n,this,arguments];try{return e.apply(N,$)}finally{[C,N,$]=[t,r,s]}}:e);return n},L=((e,r,s,o)=>{const l=new WeakMap,c=new WeakMap,a=new WeakMap,i=e=>l.has(e),u=e=>{i(e)&&(d(e,e.removeEventListener,l.get(e)),l.delete(e))},d=(e,t,n)=>{t.call(e,"disconnected",n),t.call(e,"connected",n)},h=(e,t,n,r)=>{for(let{length:s}=e,o=0;o<s;o++)f(e[o],t,n,r)},f=(e,t,n,o)=>{i(e)&&!n.has(e)&&(o.delete(e),n.set(e,0),e.dispatchEvent(new(s||CustomEvent)(t))),h(e[r||"children"]||[],t,n,o)},p=new(o||MutationObserver)((e=>{for(let{length:t}=e,n=0;n<t;n++){const{removedNodes:t,addedNodes:r}=e[n];h(t,"disconnected",a,c),h(r,"connected",c,a)}}));p.add=t,p.add(e||document);const{attachShadow:g}=Element.prototype;return g&&(Element.prototype.attachShadow=function(e){const t=g.call(this,e);return p.add(t),t}),{has:i,connect:(e,t)=>{u(e),(t||(t={})).handleEvent||(t.handleEvent=n),d(e,e.addEventListener,t),l.set(e,t)},disconnect:u,kill(){p.disconnect()}}})(document,"children",CustomEvent),O=({firstChild:e})=>{if(e&&1!==e.nodeType&&!(e=e.nextElementSibling))throw"unobservable";return e},W=e=>{const{nodeType:t}=e;if(t)return 1===t?e:O(e);{const t=e.valueOf();return t!==e?W(t):O(t)}},j=(e,t)=>{const n=_(e,t);return function(){const e=n.apply(this,arguments);if(f(n)){const t=W(e);L.has(t)||L.connect(t,{disconnected(){d(n)}})}return e}};var B=e=>({get:t=>e.get(t),set:(t,n)=>(e.set(t,n),n)});const{isArray:R}=Array;class D extends Map{set(e,t){return super.set(e,t),t}}class z extends WeakMap{set(e,t){return super.set(e,t),t}}
/*! (c) Andrea Giammarchi - ISC */const H=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,P=/<([a-z]+[a-z0-9:._-]*)([^>]*?)(\/?)>/g,F=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,q=/[\x01\x02]/g;const G=(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,I=(e,t)=>{let n,r,s=t.slice(2);return!(t in e)&&(r=t.toLowerCase())in e&&(s=r.slice(2)),t=>{const r=R(t)?t:[t,!1];n!==r[0]&&(n&&e.removeEventListener(s,n,r[1]),(n=r[0])&&e.addEventListener(s,n,r[1]))}};const{isArray:J,prototype:K}=Array,{indexOf:Q}=K,{createDocumentFragment:U,createElement:V,createElementNS:X,createTextNode:Y,createTreeWalker:Z,importNode:ee}=new Proxy(document,{get:(e,t)=>e[t].bind(e)});let te;const ne=(e,t)=>t?(e=>{te||(te=X("http://www.w3.org/2000/svg","svg")),te.innerHTML=e;const t=U();return t.append(...te.childNodes),t})(e):(e=>{const t=V("template");return t.innerHTML=e,t.content})(e),re=({childNodes:e},t)=>e[t],se=(e,t,n)=>((e,t,n,r,s)=>{const o=n.length;let l=t.length,c=o,a=0,i=0,u=null;for(;a<l||i<c;)if(l===a){const t=c<o?i?r(n[i-1],-0).nextSibling:r(n[c-i],0):s;for(;i<c;)e.insertBefore(r(n[i++],1),t)}else if(c===i)for(;a<l;)u&&u.has(t[a])||e.removeChild(r(t[a],-1)),a++;else if(t[a]===n[i])a++,i++;else if(t[l-1]===n[c-1])l--,c--;else if(t[a]===n[c-1]&&n[i]===t[l-1]){const s=r(t[--l],-1).nextSibling;e.insertBefore(r(n[i++],1),r(t[a++],-1).nextSibling),e.insertBefore(r(n[--c],1),s),t[l]=n[c]}else{if(!u){u=new Map;let e=i;for(;e<c;)u.set(n[e],e++)}if(u.has(t[a])){const s=u.get(t[a]);if(i<s&&s<c){let o=a,d=1;for(;++o<l&&o<c&&u.get(t[o])===s+d;)d++;if(d>s-i){const o=r(t[a],0);for(;i<s;)e.insertBefore(r(n[i++],1),o)}else e.replaceChild(r(n[i++],1),r(t[a++],-1))}else a++}else e.removeChild(r(t[a++],-1))}return n})(e.parentNode,t,n,G,e),oe=(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 I(e,"on"+t.slice(1));case"o":if("n"===t[1])return I(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}`,s=t[n];null==s?e.removeAttribute(r):e.setAttribute(r,s)}})(e)}return((e,t)=>{let n,r=!0;const s=document.createAttributeNS(null,t);return t=>{if(n!==t)if(n=t,null==n)r||(e.removeAttributeNode(s),r=!0);else{const n=t;null==n?(r||e.removeAttributeNode(s),r=!0):(s.value=n,r&&(e.setAttributeNodeNS(s),r=!1))}}})(e,t)};function le(e){const{type:t,path:n}=e,r=n.reduceRight(re,this);return"node"===t?(e=>{let t,n,r=[];const s=o=>{switch(typeof o){case"string":case"number":case"boolean":t!==o&&(t=o,n||(n=Y("")),n.data=o,r=se(e,r,[n]));break;case"object":case"undefined":if(null==o){t!=o&&(t=o,r=se(e,r,[]));break}if(J(o)){t=o,0===o.length?r=se(e,r,[]):"object"==typeof o[0]?r=se(e,r,o):s(String(o));break}t!==o&&"ELEMENT_NODE"in o&&(t=o,r=se(e,r,11===o.nodeType?[...o.childNodes]:[o]));break;case"function":s(o(e))}};return s})(r):"attr"===t?oe(r,e.name):(e=>{let t;return n=>{t!=n&&(t=n,e.textContent=null==n?"":n)}})(r)}const ce=e=>{const t=[];let{parentNode:n}=e;for(;n;)t.push(Q.call(n.childNodes,e)),e=n,({parentNode:n}=e);return t},ae="isµ",ie=new z,ue=/^(?:textarea|script|style|title|plaintext|xmp)$/,de=(e,t)=>{const n="svg"===e,r=((e,t,n)=>{let r=0;return e.join("").trim().replace(P,((e,t,r,s)=>{let o=t+r.replace(F,"=$2$1").trimEnd();return s.length&&(o+=n||H.test(t)?" /":"></"+t),"<"+o+">"})).replace(q,(e=>""===e?"\x3c!--"+t+r+++"--\x3e":t+r++))})(t,ae,n),s=ne(r,n),o=Z(s,129),l=[],c=t.length-1;let a=0,i=`isµ${a}`;for(;a<c;){const e=o.nextNode();if(!e)throw`bad template: ${r}`;if(8===e.nodeType)e.data===i&&(l.push({type:"node",path:ce(e)}),i="isµ"+ ++a);else{for(;e.hasAttribute(i);)l.push({type:"attr",path:ce(e),name:e.getAttribute(i)}),e.removeAttribute(i),i="isµ"+ ++a;ue.test(e.localName)&&e.textContent.trim()===`\x3c!--${i}--\x3e`&&(e.textContent="",l.push({type:"text",path:ce(e)}),i="isµ"+ ++a)}}return{content:s,nodes:l}},he=(e,t)=>{const{content:n,nodes:r}=ie.get(t)||ie.set(t,de(e,t)),s=ee(n,!0);return{content:s,updates:r.map(le,s)}},fe=(e,{type:t,template:n,values:r})=>{const s=pe(e,r);let{entry:o}=e;o&&o.template===n&&o.type===t||(e.entry=o=((e,t)=>{const{content:n,updates:r}=he(e,t);return{type:e,template:t,content:n,updates:r,wire:null}})(t,n));const{content:l,updates:c,wire:a}=o;for(let e=0;e<s;e++)c[e](r[e]);return a||(o.wire=(e=>{const{firstChild:t,lastChild:n}=e;if(t===n)return n||e;const{childNodes:r}=e,s=[...r];return{ELEMENT_NODE:1,nodeType:111,firstChild:t,lastChild:n,valueOf:()=>(r.length!==s.length&&e.append(...s),e)}})(l))},pe=({stack:e},t)=>{const{length:n}=t;for(let r=0;r<n;r++){const n=t[r];n instanceof ge?t[r]=fe(e[r]||(e[r]={stack:[],entry:null,wire:null}),n):J(n)?pe(e[r]||(e[r]={stack:[],entry:null,wire:null}),n):e[r]=null}return n<e.length&&e.splice(n),n};class ge{constructor(e,t,n){this.type=e,this.template=t,this.values=n}}const me=e=>{const t=new z;return Object.assign(((t,...n)=>new ge(e,t,n)),{for(n,r){const s=t.get(n)||t.set(n,new D);return s.get(r)||s.set(r,(t=>(n,...r)=>fe(t,{type:e,template:n,values:r}))({stack:[],entry:null,wire:null}))},node:(t,...n)=>fe({stack:[],entry:null,wire:null},new ge(e,t,n)).valueOf()})},ye=new z,ve=me("html"),we=me("svg"),{create:be}=Object,Ee=(e,...t)=>new ge("html",e,t);Ee.for=_e(ve);const xe=(e,...t)=>new ge("svg",e,t);xe.for=_e(we);const ke=B(new WeakMap),Ce=(e,t)=>j((function(){const n=t.f.apply(this,arguments);return n instanceof ge?(Ae(e,n),t.$=Se(t,n)):t.$=n,t.$})),Ne=()=>({s:[],e:null}),$e=(e,{f:t,c:n,a:r})=>{let{e:s}=e;return s&&s.f===t||(e.e=s={f:t,h:null,$:null},s.h=Ce(Ne(),s)),s.h.apply(n,r)},Ae=(e,{values:t})=>{Me(e,t)},Me=(e,t)=>{const{s:n}=e,{length:r}=t;for(let e=0;e<r;e++){const r=t[e];r instanceof Te?t[e]=$e(n[e]||(n[e]=Ne()),r):r instanceof ge?Ae(n[e]||(n[e]=Ne()),r):R(r)?Me(n[e]||(n[e]=Ne()),r):n[e]=null}r<n.length&&n.splice(r)},Se=(e,{type:t,template:n,values:r})=>("svg"===t?we:ve).for(e,t)(n,...r);function Te(e,t,n){this.f=e,this.c=t,this.a=n}function _e(e){const t=B(new WeakMap);return(n,r)=>{const s=t.get(n)||t.set(n,be(null)),o=s[r]||(s[r]=Ne());return(t,...s)=>(Me(o,s),e.for(n,r)(t,...s))}}return e.Component=function(e){return function(){return new Te(e,this,arguments)}},e.createContext=e=>({_:new Set,provide:y,value:e}),e.html=Ee,e.render=(e,t)=>(ke.get(e)||ke.set(e,{c:Ne(),h:j((function(t){const n="function"==typeof t?t():t;return((e,t)=>{const n="function"==typeof t?t():t,r=ye.get(e)||ye.set(e,{stack:[],entry:null,wire:null}),s=n instanceof ge?fe(r,n):n;return s!==r.wire&&(r.wire=s,e.replaceChildren(s.valueOf())),e})(e,n instanceof Te?$e(this.c,n):(Ae(this.c,n),n))}),e)})).h(t),e.svg=xe,e.useCallback=(e,t)=>v((()=>e),t),e.useContext=({_:e,value:t})=>(e.add(h()),t),e.useEffect=b,e.useLayoutEffect=E,e.useMemo=v,e.useReducer=(e,t,n)=>T(C,N,$,k(e,t,n)),e.useRef=e=>{const t=h(),{i:n,s:r}=t;return n===r.length&&r.push({current:e}),r[t.i++]},e.useState=e=>T(C,N,$,(e=>k(x,e))(e))
/*! (c) Andrea Giammarchi - ISC */,e}({});