forked from WebReflection/uce
/
min.js
2 lines (2 loc) · 12.1 KB
/
min.js
1
2
var uce=function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=o(t);if(e){var i=o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return a(this,n)}}var u=function(t){return{get:function(e){return t.get(e)},set:function(e,n){return t.set(e,n),n}}},l=/([^\s\\>"'=]+)\s*=\s*(['"]?)$/,s=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,f=/<[a-z][^>]+$/i,p=/>[^<>]*$/,d=/<([a-z]+[a-z0-9:._-]*)([^>]*?)(\/>)/gi,v=/\s+$/,h=function t(e,n){return 0<n--&&(f.test(e[n])||!p.test(e[n])&&t(e,n))},y=function(t,e,n){return s.test(e)?t:"<".concat(e).concat(n.replace(v,""),"></").concat(e,">")},b=function(t,e,n){for(var r=[],o=t.length,i=function(n){var o=t[n-1];r.push(l.test(o)&&h(t,n)?o.replace(l,(function(t,r,o){return"".concat(e).concat(n-1,"=").concat(o||'"').concat(r).concat(o?"":'"')})):"".concat(o,"\x3c!--").concat(e).concat(n-1,"--\x3e"))},a=1;a<o;a++)i(a);r.push(t[o-1]);var c=r.join("").trim();return n?c:c.replace(d,y)},g=Array.isArray,m=[],w=m.indexOf,k=m.slice,O=function(t,e){return 111===t.nodeType?1/e<0?e?function(t){var e=t.firstChild,n=t.lastChild,r=document.createRange();return r.setStartAfter(e),r.setEndAfter(n),r.deleteContents(),e}(t):t.lastChild:e?t.valueOf():t.firstChild:t},C=function(t,e){var n,r=e.slice(2);return!(e in t)&&e.toLowerCase()in t&&(r=r.toLowerCase()),function(e){var o=g(e)?e:[e,!1];n!==o[0]&&(n&&t.removeEventListener(r,n,o[1]),(n=o[0])&&t.addEventListener(r,n,o[1]))}},x=function(t,e){return t.childNodes[e]},N=function(t,e,n){return function(t,e,n,r,o){for(var i=n.length,a=e.length,c=i,u=0,l=0,s=null;u<a||l<c;)if(a===u)for(var f=c<i?l?r(n[l-1],-0).nextSibling:r(n[c-l],0):o;l<c;)t.insertBefore(r(n[l++],1),f);else if(c===l)for(;u<a;)s&&s.has(e[u])||t.removeChild(r(e[u],-1)),u++;else if(e[u]===n[l])u++,l++;else if(e[a-1]===n[c-1])a--,c--;else if(e[u]===n[c-1]&&n[l]===e[a-1]){var p=r(e[--a],-1).nextSibling;t.insertBefore(r(n[l++],1),r(e[u++],-1).nextSibling),t.insertBefore(r(n[--c],1),p),e[a]=n[c]}else{if(!s){s=new Map;for(var d=l;d<c;)s.set(n[d],d++)}if(s.has(e[u])){var v=s.get(e[u]);if(l<v&&v<c){for(var h=u,y=1;++h<a&&h<c&&s.get(e[h])===v+y;)y++;if(y>v-l)for(var b=r(e[u],0);l<v;)t.insertBefore(r(n[l++],1),b);else t.replaceChild(r(n[l++],1),r(e[u++],-1))}else u++}else t.removeChild(r(e[u++],-1))}return n}(t.parentNode,e,n,O,t)},A=function(t,e){switch(e[0]){case"?":return function(t,e,n){return function(r){n!==!!r&&((n=!!r)?t.setAttribute(e,""):t.removeAttribute(e))}}(t,e.slice(1),!1);case".":return function(t,e){return"dataset"===e?function(t){var e=t.dataset;return function(t){for(var n in t){var r=t[n];null==r?delete e[n]:e[n]=r}}}(t):function(n){t[e]=n}}(t,e.slice(1));case"@":return C(t,"on"+e.slice(1));case"o":if("n"===e[1])return C(t,e)}switch(e){case"ref":return function(t){var e;return function(n){e!==n&&(e=n,"function"==typeof n?n(t):n.current=t)}}(t);case"aria":return function(t){return function(e){for(var n in e){var r="role"===n?n:"aria-".concat(n),o=e[n];null==o?t.removeAttribute(r):t.setAttribute(r,o)}}}(t)}return function(t,e){var n,r=!0,o=document.createAttributeNS(null,e);return function(e){n!==e&&(null==(n=e)?r||(t.removeAttributeNode(o),r=!0):(o.value=e,r&&(t.setAttributeNodeNS(o),r=!1)))}}(t,e)};function E(t){var e=t.type,n=t.path.reduceRight(x,this);return"node"===e?function(t){var e,n,r=[];return function o(i){switch(typeof i){case"string":case"number":case"boolean":e!==i&&(e=i,n||(n=document.createTextNode("")),n.data=i,r=N(t,r,[n]));break;case"object":case"undefined":if(null==i){e!=i&&(e=i,r=N(t,r,[]));break}if(g(i)){e=i,0===i.length?r=N(t,r,[]):"object"==typeof i[0]?r=N(t,r,i):o(String(i));break}e!==i&&"ELEMENT_NODE"in i&&(e=i,r=N(t,r,11===i.nodeType?k.call(i.childNodes):[i]));break;case"function":o(i(t))}}}(n):"attr"===e?A(n,t.name):function(t){var e;return function(n){e!=n&&(e=n,t.textContent=null==n?"":n)}}(n)}
/*! (c) Andrea Giammarchi - ISC */var j=function(t){var e="fragment",n="template",r="content"in i(n)?function(t){var e=i(n);return e.innerHTML=t,e.content}:function(t){var r=i(e),a=i(n),c=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(t)){var u=RegExp.$1;a.innerHTML="<table>"+t+"</table>",c=a.querySelectorAll(u)}else a.innerHTML=t,c=a.childNodes;return o(r,c),r};return function(t,e){return("svg"===e?a:r)(t)};function o(t,e){for(var n=e.length;n--;)t.appendChild(e[0])}function i(n){return n===e?t.createDocumentFragment():t.createElementNS("http://www.w3.org/1999/xhtml",n)}function a(t){var n=i(e),r=i("div");return r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+t+"</svg>",o(n,r.firstChild.childNodes),n}}(document),S=1!=document.importNode.length,T=S?function(t,e,n){return document.importNode(j(t,e,n),!0)}:j,M=S?function(t){return document.createTreeWalker(t,129,null,!1)}:function(t){return document.createTreeWalker(t,129)},L=function(t){for(var e=[],n=t.parentNode;n;)e.push(w.call(n.childNodes,t)),n=(t=n).parentNode;return e},P="isµ",_=u(new WeakMap),R=/^(?:plaintext|script|style|textarea|title|xmp)$/i,$=function(t,e){var n=_.get(e)||_.set(e,function(t,e){for(var n=b(e,P,"svg"===t),r=T(n,t),o=M(r),i=[],a=e.length-1,c=0,u="".concat(P).concat(c);c<a;){var l=o.nextNode();if(!l)throw"bad template: ".concat(n);if(8===l.nodeType)l.data===u&&(i.push({type:"node",path:L(l)}),u="".concat(P).concat(++c));else{for(;l.hasAttribute(u);)i.push({type:"attr",path:L(l),name:l.getAttribute(u)}),l.removeAttribute(u),u="".concat(P).concat(++c);R.test(l.tagName)&&l.textContent.trim()==="\x3c!--".concat(u,"--\x3e")&&(l.textContent="",i.push({type:"text",path:L(l)}),u="".concat(P).concat(++c))}}return{content:r,nodes:i}}(t,e)),r=n.content,o=n.nodes,i=document.importNode(r,!0);return{content:i,updates:o.map(E,i)}},W=function(t,e){var n=e.type,r=e.template,o=e.values,i=o.length;B(t,o,i);var a=t.entry;a&&a.template===r&&a.type===n||(t.entry=a=function(t,e){var n=$(t,e);return{type:t,template:e,content:n.content,updates:n.updates,wire:null}}(n,r));for(var c=a,u=c.content,l=c.updates,s=c.wire,f=0;f<i;f++)l[f](o[f]);return s||(a.wire=function(t){var e=t.childNodes,n=e.length;if(n<2)return n?e[0]:t;var r=k.call(e,0);return{ELEMENT_NODE:1,nodeType:111,firstChild:r[0],lastChild:r[n-1],valueOf:function(){if(e.length!==n)for(var o=0;o<n;)t.appendChild(r[o++]);return t}}}(u))},B=function t(e,n,r){for(var o=e.stack,i=0;i<r;i++){var a=n[i];a instanceof H?n[i]=W(o[i]||(o[i]={stack:[],entry:null,wire:null}),a):g(a)?t(o[i]||(o[i]={stack:[],entry:null,wire:null}),a,a.length):o[i]=null}r<o.length&&o.splice(r)};function H(t,e,n){this.type=t,this.template=e,this.values=n}var D=Object.create,z=Object.defineProperties,J=function(t){var e=u(new WeakMap);return z((function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new H(t,e,r)}),{for:{value:function(n,r){var o=e.get(n)||e.set(n,D(null));return o[r]||(o[r]=function(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return W(e,{type:t,template:n,values:o})}}({stack:[],entry:null,wire:null}))}},node:{value:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return W({stack:[],entry:null,wire:null},{type:t,template:e,values:r}).valueOf()}}})},q=u(new WeakMap),F=function(t,e){var n="function"==typeof e?e():e,r=q.get(t)||q.set(t,{stack:[],entry:null,wire:null}),o=n instanceof H?W(r,n):n;return o!==r.wire&&(r.wire=o,t.textContent="",t.appendChild(o.valueOf())),t},G=J("html"),I=J("svg");function K(t){for(var e=t[0],n=1,r=arguments.length;n<r;n++)e+=arguments[n]+t[n];return e}var Q=Object.defineProperties,U=Object.keys,V=function(t,e,n,r,o){return{configurable:!0,get:function(){return r},set:function(i){(t||i!==r||e&&"object"==typeof i&&i)&&(r=i,n?o.call(this,r):o.call(this))}}},X=function(t,e,n,r,o,i){for(var a={},c=o!==Y,u=[n,r,c],l=U(t),s=0;s<l.length;s++){var f=e(t,l[s]),p=c?o(f):[f,o];i&&(p[1]=i),a[l[s]]=V.apply(null,u.concat(p))}return a},Y=function(){},Z=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.all,n=void 0!==e&&e,r=t.shallow,o=void 0===r||r,i=t.useState,a=void 0===i?Y:i,c=t.getAttribute,u=void 0===c?function(t,e){return t.getAttribute(e)}:c;return function(t,e,r){var i=X(e,(function(e,n){var r=e[n],o=typeof r;return t.hasOwnProperty(n)?(r=t[n],delete t[n]):t.hasAttribute(n)&&(r=u(t,n),"number"==o?r=+r:"boolean"==o&&(r=!/^(?:false|0|)$/.test(r))),r}),n,o,a,r);return Q(t,i)}}({dom:!0}),tt=customElements,et=tt.define,nt=JSON.parse,rt=JSON.stringify,ot=Object.create,it=Object.defineProperties,at=Object.getOwnPropertyDescriptor,ct=Object.keys,ut="element",lt=new WeakMap,st=u(new Map([[ut,{c:HTMLElement,e:ut}]])),ft=function(t){return document.createElement(t)},pt=function(t){return st.get(t)||st.set(t,{c:ft(t).constructor,e:t})},dt=function(t,n){for(var o=n.attachShadow,i=n.attributeChanged,a=n.bound,u=n.connected,l=n.disconnected,s=n.handleEvent,f=n.init,p=n.observedAttributes,d=n.props,v=n.render,h=n.style,y=new WeakMap,b={},g={},m=[],w=ot(null),k=function(t,e,n){if(!y.has(t)){y.set(t,0),it(t,{html:{configurable:!0,value:ht.bind(o?t.attachShadow(o):t)}});for(var r=0;r<S;r++){var i=m[r],c=i.type,u=i.options;t.addEventListener(c,t,u)}if(a&&a.forEach(vt,t),d){for(var l={},s=ct(d),p=0;p<s.length;p++){var h=s[p],b=d[h];l[h]="object"==typeof b?nt(rt(b)):b}lt.set(t,l),Z(t,l,v)}(f||v)&&(f||v).call(t),e&&(t[e]=n)}},O=ct(n),C=0,x=O.length;C<x;C++){var N=O[C];if(/^on./.test(N)&&!/Options$/.test(N)){var A=n[N+"Options"]||!1,E=N.toLowerCase(),j=E.slice(2);m.push({type:j,options:A}),w[j]=N,E!==N&&(j=E.slice(2,3)+N.slice(3),w[j]=N,m.push({type:j,options:A}))}switch(N){case"attachShadow":case"constructor":case"observedAttributes":case"style":break;default:g[N]=at(n,N)}}var S=m.length;if(S&&!s&&(g.handleEvent={value:function(t){this[w[t.type]](t)}}),null!==d)if(d)for(var T=function(t,e){var n=t[e];g[n]={get:function(){return k(this),lt.get(this)[n]},set:function(t){k(this,n,t)}}},M=ct(d),L=0;L<M.length;L++)T(M,L);else g.props={get:function(){for(var t={},e=this.attributes,n=e.length,r=0;r<n;r++){var o=e[r],i=o.name,a=o.value;t[i]=a}return t}};p&&(b.observedAttributes={value:p}),g.attributeChangedCallback={value:function(){k(this),i&&i.apply(this,arguments)}},g.connectedCallback={value:function(){k(this),u&&u.call(this)}},l&&(g.disconnectedCallback={value:l});var P=pt(n.extends||ut),_=P.c,R=P.e,$=function(t){r(o,t);var n=c(o);function o(){return e(this,o),n.apply(this,arguments)}return o}(_);it($,b),it($.prototype,g);var W=[t,$];return R!==ut&&W.push({extends:R}),et.apply(tt,W),st.set(t,{c:$,e:R}),h&&(document.head.appendChild(ft("style")).textContent=h(R===ut?t:R+'[is="'+t+'"]')),$};function vt(t){this[t]=this[t].bind(this)}function ht(){return F(this,G.apply(null,arguments))}return tt.get("uce-lib")||tt.define("uce-lib",function(t){r(l,t);var o,i,a,u=c(l);function l(){return e(this,l),u.apply(this,arguments)}return o=l,a=[{key:"define",get:function(){return dt}},{key:"render",get:function(){return F}},{key:"html",get:function(){return G}},{key:"svg",get:function(){return I}},{key:"css",get:function(){return K}}],(i=null)&&n(o.prototype,i),a&&n(o,a),l}(pt(ut).c)),t.css=K,t.define=dt,t.html=G,t.render=F,t.svg=I,t}({});