!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t(n.preactHooks={},n.preact)}(this,function(n,t){var u,r,o,i=0,c=[],e=t.options.__r,f=t.options.diffed,a=t.options.__c,v=t.options.unmount;function p(n,u){t.options.__h&&t.options.__h(r,n,i||u),i=0;var o=r.__H||(r.__H={__:[],__h:[]});return n>=o.__.length&&o.__.push({}),o.__[n]}function m(n){return i=1,y(A,n)}function y(n,t,o){var i=p(u++,2);return i.t=n,i.__c||(i.__c=r,i.__=[o?o(t):A(void 0,t),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}))}]),i.__}function d(n,o){var i=p(u++,4);!t.options.__s&&x(i.__H,o)&&(i.__=n,i.__H=o,r.__h.push(i))}function s(n,t){var r=p(u++,7);return x(r.__H,t)?(r.__H=t,r.__h=n,r.__=n()):r.__}function l(){c.some(function(n){if(n.__P)try{n.__H.__h.forEach(_),n.__H.__h.forEach(q),n.__H.__h=[]}catch(u){return n.__H.__h=[],t.options.__e(u,n.__v),!0}}),c=[]}t.options.__r=function(n){e&&e(n),u=0;var t=(r=n.__c).__H;t&&(t.__h.forEach(_),t.__h.forEach(q),t.__h=[])},t.options.diffed=function(n){f&&f(n);var u=n.__c;u&&u.__H&&u.__H.__h.length&&(1!==c.push(u)&&o===t.options.requestAnimationFrame||((o=t.options.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(r),h&&cancelAnimationFrame(t),setTimeout(n)},r=setTimeout(u,100);h&&(t=requestAnimationFrame(u))})(l))},t.options.__c=function(n,u){u.some(function(n){try{n.__h.forEach(_),n.__h=n.__h.filter(function(n){return!n.__||q(n)})}catch(r){u.some(function(n){n.__h&&(n.__h=[])}),u=[],t.options.__e(r,n.__v)}}),a&&a(n,u)},t.options.unmount=function(n){v&&v(n);var u=n.__c;if(u&&u.__H)try{u.__H.__.forEach(_)}catch(n){t.options.__e(n,u.__v)}};var h="function"==typeof requestAnimationFrame;function _(n){"function"==typeof n.u&&n.u()}function q(n){n.u=n.__()}function x(n,t){return!n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function A(n,t){return"function"==typeof t?t(n):t}n.useState=m,n.useReducer=y,n.useEffect=function(n,o){var i=p(u++,3);!t.options.__s&&x(i.__H,o)&&(i.__=n,i.__H=o,r.__H.__h.push(i))},n.useLayoutEffect=d,n.useRef=function(n){return i=5,s(function(){return{current:n}},[])},n.useImperativeHandle=function(n,t,u){i=6,d(function(){"function"==typeof n?n(t()):n&&(n.current=t())},null==u?u:u.concat(n))},n.useMemo=s,n.useCallback=function(n,t){return i=8,s(function(){return n},t)},n.useContext=function(n){var t=r.context[n.__c],o=p(u++,9);return o.__c=n,t?(null==o.__&&(o.__=!0,t.sub(r)),t.props.value):n.__},n.useDebugValue=function(n,u){t.options.useDebugValue&&t.options.useDebugValue(u?u(n):n)},n.useErrorBoundary=function(n){var t=p(u++,10),o=m();return t.__=n,r.componentDidCatch||(r.componentDidCatch=function(n){t.__&&t.__(n),o[1](n)}),[o[0],function(){o[1](void 0)}]}});
