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