preact.min.module.js 11 KB

12
  1. var n,l,t,u,i,r,e,o,f,c,s,a,h,p,v={},d=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,w=Array.isArray;function _(n,l){for(var t in l)n[t]=l[t];return n}function m(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function g(l,t,u){var i,r,e,o={};for(e in t)"key"==e?i=t[e]:"ref"==e?r=t[e]:o[e]=t[e];if(arguments.length>2&&(o.children=arguments.length>3?n.call(arguments,2):u),"function"==typeof l&&null!=l.defaultProps)for(e in l.defaultProps)void 0===o[e]&&(o[e]=l.defaultProps[e]);return b(l,o,i,r,null)}function b(n,u,i,r,e){var o={type:n,props:u,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==e?++t:e,__i:-1,__u:0};return null==e&&null!=l.vnode&&l.vnode(o),o}function k(n){return n.children}function C(n,l){this.props=n,this.context=l}function x(n,l){if(null==l)return n.__?x(n.__,n.__i+1):null;for(var t;l<n.__k.length;l++)if(null!=(t=n.__k[l])&&null!=t.__e)return t.__e;return"function"==typeof n.type?x(n):null}function S(n){var l,t;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(t=n.__k[l])&&null!=t.__e){n.__e=n.__c.base=t.__e;break}return S(n)}}function M(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!P.__r++||r!==l.debounceRendering)&&((r=l.debounceRendering)||e)(P)}function P(){var n,t,u,r,e,f,c,s;for(i.sort(o);n=i.shift();)n.__d&&(t=i.length,r=void 0,f=(e=(u=n).__v).__e,c=[],s=[],u.__P&&((r=_({},e)).__v=e.__v+1,l.vnode&&l.vnode(r),T(u.__P,r,e,u.__n,u.__P.namespaceURI,32&e.__u?[f]:null,c,null==f?x(e):f,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,O(c,r,s),r.__e!=f&&S(r)),i.length>t&&i.sort(o));P.__r=0}function $(n,l,t,u,i,r,e,o,f,c,s){var a,h,p,y,w,_,m=u&&u.__k||d,g=l.length;for(f=A(t,l,m,f,g),a=0;a<g;a++)null!=(p=t.__k[a])&&(h=-1===p.__i?v:m[p.__i]||v,p.__i=a,_=T(n,p,h,i,r,e,o,f,c,s),y=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&j(h.ref,null,p),s.push(p.ref,p.__c||y,p)),null==w&&null!=y&&(w=y),4&p.__u||h.__k===p.__k?f=I(p,f,n):"function"==typeof p.type&&void 0!==_?f=_:y&&(f=y.nextSibling),p.__u&=-7);return t.__e=w,f}function A(n,l,t,u,i){var r,e,o,f,c,s=t.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(e=l[r])&&"boolean"!=typeof e&&"function"!=typeof e?(f=r+h,(e=n.__k[r]="string"==typeof e||"number"==typeof e||"bigint"==typeof e||e.constructor==String?b(null,e,null,null,null):w(e)?b(k,{children:e},null,null,null):void 0===e.constructor&&e.__b>0?b(e.type,e.props,e.key,e.ref?e.ref:null,e.__v):e).__=n,e.__b=n.__b+1,o=null,-1!==(c=e.__i=E(e,t,f,a))&&(a--,(o=t[c])&&(o.__u|=2)),null==o||null===o.__v?(-1==c&&h--,"function"!=typeof e.type&&(e.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,e.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(o=t[r])&&0==(2&o.__u)&&(o.__e==u&&(u=x(o)),z(o,o));return u}function I(n,l,t){var u,i;if("function"==typeof n.type){for(u=n.__k,i=0;u&&i<u.length;i++)u[i]&&(u[i].__=n,l=I(u[i],l,t));return l}n.__e!=l&&(l&&n.type&&!t.contains(l)&&(l=x(n)),t.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling}while(null!=l&&8==l.nodeType);return l}function E(n,l,t,u){var i,r,e=n.key,o=n.type,f=l[t];if(null===f||f&&e==f.key&&o===f.type&&0==(2&f.__u))return t;if(u>(null!=f&&0==(2&f.__u)?1:0))for(i=t-1,r=t+1;i>=0||r<l.length;){if(i>=0){if((f=l[i])&&0==(2&f.__u)&&e==f.key&&o===f.type)return i;i--}if(r<l.length){if((f=l[r])&&0==(2&f.__u)&&e==f.key&&o===f.type)return r;r++}}return-1}function F(n,l,t){"-"==l[0]?n.setProperty(l,null==t?"":t):n[l]=null==t?"":"number"!=typeof t||y.test(l)?t:t+"px"}function H(n,l,t,u,i){var r;n:if("style"==l)if("string"==typeof t)n.style.cssText=t;else{if("string"==typeof u&&(n.style.cssText=u=""),u)for(l in u)t&&l in t||F(n.style,l,"");if(t)for(l in t)u&&t[l]===u[l]||F(n.style,l,t[l])}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f,"$1")),l=l.toLowerCase()in n||"onFocusOut"==l||"onFocusIn"==l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=t,t?u?t.t=u.t:(t.t=c,n.addEventListener(l,r?a:s,r)):n.removeEventListener(l,r?a:s,r);else{if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==t?"":t;break n}catch(n){}"function"==typeof t||(null==t||!1===t&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==t?"":t))}}function L(n){return function(t){if(this.l){var u=this.l[t.type+n];if(null==t.u)t.u=c++;else if(t.u<u.t)return;return u(l.event?l.event(t):t)}}}function T(n,t,u,i,r,e,o,f,c,s){var a,h,p,v,d,y,g,b,x,S,M,P,A,I,E,F,H,L=t.type;if(void 0!==t.constructor)return null;128&u.__u&&(c=!!(32&u.__u),e=[f=t.__e=u.__e]),(a=l.__b)&&a(t);n:if("function"==typeof L)try{if(b=t.props,x="prototype"in L&&L.prototype.render,S=(a=L.contextType)&&i[a.__c],M=a?S?S.props.value:a.__:i,u.__c?g=(h=t.__c=u.__c).__=h.__E:(x?t.__c=h=new L(b,M):(t.__c=h=new C(b,M),h.constructor=L,h.render=N),S&&S.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),x&&null==h.__s&&(h.__s=h.state),x&&null!=L.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=_({},h.__s)),_(h.__s,L.getDerivedStateFromProps(b,h.__s))),v=h.props,d=h.state,h.__v=t,p)x&&null==L.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),x&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(x&&null==L.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)||t.__v==u.__v)){for(t.__v!=u.__v&&(h.props=b,h.state=h.__s,h.__d=!1),t.__e=u.__e,t.__k=u.__k,t.__k.some(function(n){n&&(n.__=t)}),P=0;P<h._sb.length;P++)h.__h.push(h._sb[P]);h._sb=[],h.__h.length&&o.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),x&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,d,y)})}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,A=l.__r,I=0,x){for(h.state=h.__s,h.__d=!1,A&&A(t),a=h.render(h.props,h.state,h.context),E=0;E<h._sb.length;E++)h.__h.push(h._sb[E]);h._sb=[]}else do{h.__d=!1,A&&A(t),a=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++I<25);h.state=h.__s,null!=h.getChildContext&&(i=_(_({},i),h.getChildContext())),x&&!p&&null!=h.getSnapshotBeforeUpdate&&(y=h.getSnapshotBeforeUpdate(v,d)),f=$(n,w(F=null!=a&&a.type===k&&null==a.key?a.props.children:a)?F:[F],t,u,i,r,e,o,f,c,s),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),g&&(h.__E=h.__=null)}catch(n){if(t.__v=null,c||null!=e)if(n.then){for(t.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;e[e.indexOf(f)]=null,t.__e=f}else for(H=e.length;H--;)m(e[H]);else t.__e=u.__e,t.__k=u.__k;l.__e(n,t,u)}else null==e&&t.__v==u.__v?(t.__k=u.__k,t.__e=u.__e):f=t.__e=V(u.__e,t,u,i,r,e,o,c,s);return(a=l.diffed)&&a(t),128&t.__u?void 0:f}function O(n,t,u){for(var i=0;i<u.length;i++)j(u[i],u[++i],u[++i]);l.__c&&l.__c(t,n),n.some(function(t){try{n=t.__h,t.__h=[],n.some(function(n){n.call(t)})}catch(n){l.__e(n,t.__v)}})}function V(t,u,i,r,e,o,f,c,s){var a,h,p,d,y,_,g,b=i.props,k=u.props,C=u.type;if("svg"==C?e="http://www.w3.org/2000/svg":"math"==C?e="http://www.w3.org/1998/Math/MathML":e||(e="http://www.w3.org/1999/xhtml"),null!=o)for(a=0;a<o.length;a++)if((y=o[a])&&"setAttribute"in y==!!C&&(C?y.localName==C:3==y.nodeType)){t=y,o[a]=null;break}if(null==t){if(null==C)return document.createTextNode(k);t=document.createElementNS(e,C,k.is&&k),c&&(l.__m&&l.__m(u,o),c=!1),o=null}if(null===C)b===k||c&&t.data===k||(t.data=k);else{if(o=o&&n.call(t.childNodes),b=i.props||v,!c&&null!=o)for(b={},a=0;a<t.attributes.length;a++)b[(y=t.attributes[a]).name]=y.value;for(a in b)if(y=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)p=y;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;H(t,a,null,y,e)}for(a in k)y=k[a],"children"==a?d=y:"dangerouslySetInnerHTML"==a?h=y:"value"==a?_=y:"checked"==a?g=y:c&&"function"!=typeof y||b[a]===y||H(t,a,y,b[a],e);if(h)c||p&&(h.__html===p.__html||h.__html===t.innerHTML)||(t.innerHTML=h.__html),u.__k=[];else if(p&&(t.innerHTML=""),$(t,w(d)?d:[d],u,i,r,"foreignObject"==C?"http://www.w3.org/1999/xhtml":e,o,f,o?o[0]:i.__k&&x(i,0),c,s),null!=o)for(a=o.length;a--;)m(o[a]);c||(a="value","progress"==C&&null==_?t.removeAttribute("value"):void 0!==_&&(_!==t[a]||"progress"==C&&!_||"option"==C&&_!==b[a])&&H(t,a,_,b[a],e),a="checked",void 0!==g&&g!==t[a]&&H(t,a,g,b[a],e))}return t}function j(n,t,u){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==t||(n.__u=n(t))}else n.current=t}catch(n){l.__e(n,u)}}function z(n,t,u){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||j(i,null,t)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,t)}i.base=i.__P=null}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&z(i[r],t,u||"function"!=typeof n.type);u||m(n.__e),n.__c=n.__=n.__e=void 0}function N(n,l,t){return this.constructor(n,t)}function R(t,u,i){var r,e,o,f;u==document&&(u=document.documentElement),l.__&&l.__(t,u),e=(r="function"==typeof i)?null:i&&i.__k||u.__k,o=[],f=[],T(u,t=(!r&&i||u).__k=g(k,null,[t]),e||v,v,u.namespaceURI,!r&&i?[i]:e?null:u.firstChild?n.call(u.childNodes):null,o,!r&&i?i:e?e.__e:u.firstChild,r,f),O(o,t,f)}n=d.slice,l={__e:function(n,l,t,u){for(var i,r,e;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),e=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,u||{}),e=i.__d),e)return i.__E=i}catch(l){n=l}throw n}},t=0,u=function(n){return null!=n&&null==n.constructor},C.prototype.setState=function(n,l){var t;t=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof n&&(n=n(_({},t),this.props)),n&&_(t,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this))},C.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),M(this))},C.prototype.render=k,i=[],e="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(n,l){return n.__v.__b-l.__v.__b},P.__r=0,f=/(PointerCapture)$|Capture$/i,c=0,s=L(!1),a=L(!0),h=0,p={__proto__:null,render:R,hydrate:function n(l,t){R(l,t,n)},createElement:g,h:g,Fragment:k,createRef:function(){return{current:null}},isValidElement:u,Component:C,cloneElement:function(l,t,u){var i,r,e,o,f=_({},l.props);for(e in l.type&&l.type.defaultProps&&(o=l.type.defaultProps),t)"key"==e?i=t[e]:"ref"==e?r=t[e]:f[e]=void 0===t[e]&&void 0!==o?o[e]:t[e];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):u),b(l.type,f,i||l.key,r||l.ref,null)},createContext:function(n,l){var t={__c:l="__cC"+h++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var t,u;return this.getChildContext||(t=new Set,(u={})[l]=this,this.getChildContext=function(){return u},this.componentWillUnmount=function(){t=null},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&t.forEach(function(n){n.__e=!0,M(n)})},this.sub=function(n){t.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){t&&t.delete(n),l&&l.call(n)}}),n.children}};return t.Provider.__=t.Consumer.contextType=t},toChildArray:function n(l,t){return t=t||[],null==l||"boolean"==typeof l||(w(l)?l.some(function(l){n(l,t)}):t.push(l)),t},options:l},typeof module<"u"?module.exports=p:self.preact=p;
  2. //# sourceMappingURL=preact.min.module.js.map