!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("preact"),require("redux")):"function"==typeof define&&define.amd?define(["preact","redux"],e):t.preactRedux=e(t.preact,t.Redux)}(this,function(t,e){function n(){}function r(){z||(z=!0)}function o(){var t=[],e=[];return{clear:function(){e=et,t=et},notify:function(){for(var n=t=e,r=0;r1&&void 0!==arguments[1]?arguments[1]:{},u=o.getDisplayName,p=void 0===u?function(t){return"ConnectAdvanced("+t+")"}:u,c=o.methodName,a=void 0===c?"connectAdvanced":c,d=o.renderCountProp,f=void 0===d?void 0:d,l=o.shouldHandleStateChanges,h=void 0===l||l,b=o.storeKey,y=void 0===b?"store":b,v=o.withRef,m=void 0!==v&&v,P=k(o,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),O=y+"Subscription",S=ot++,g=(n={},n[y]=H,n[O]=F,n),w=(r={},r[O]=F,r);return function(n){JSON.stringify(n);var r=n.displayName||n.name||"Component",o=p(r),u=_({},P,{getDisplayName:p,methodName:a,renderCountProp:f,shouldHandleStateChanges:h,storeKey:y,withRef:m,displayName:o,wrappedComponentName:r,WrappedComponent:n}),c=function(r){function o(t,e){var n=J(this,r.call(this,t,e));return n.version=S,n.state={},n.renderCount=0,n.store=t[y]||e[y],n.propsMode=!!t[y],n.setWrappedInstance=n.setWrappedInstance.bind(n),n.initSelector(),n.initSubscription(),n}return K(o,r),o.prototype.getChildContext=function(){var t,e=this.propsMode?null:this.subscription;return t={},t[O]=e||this.context[O],t},o.prototype.componentDidMount=function(){h&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},o.prototype.componentWillReceiveProps=function(t){this.selector.run(t)},o.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},o.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=i,this.store=null,this.selector.run=i,this.selector.shouldComponentUpdate=!1},o.prototype.getWrappedInstance=function(){return this.wrappedInstance},o.prototype.setWrappedInstance=function(t){this.wrappedInstance=t},o.prototype.initSelector=function(){this.selector=s(e(this.store.dispatch,u),this.store),this.selector.run(this.props)},o.prototype.initSubscription=function(){if(h){this.subscription=new rt(this.store,(this.propsMode?this.props:this.context)[O],this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},o.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(it)):this.notifyNestedSubs()},o.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},o.prototype.isSubscribed=function(){return!!this.subscription&&this.subscription.isSubscribed()},o.prototype.addExtraProps=function(t){if(!(m||f||this.propsMode&&this.subscription))return t;var e=_({},t);return m&&(e.ref=this.setWrappedInstance),f&&(e[f]=this.renderCount++),this.propsMode&&this.subscription&&(e[O]=this.subscription),e},o.prototype.render=function(){var e=this.selector;if(e.shouldComponentUpdate=!1,e.error)throw e.error;return t.h(n,this.addExtraProps(e.props))},o}(t.Component);return c.WrappedComponent=n,c.displayName=o,c.childContextTypes=w,c.contextTypes=g,c.prototype.componentWillUpdate=function(){var t=this;if(this.version!==S){this.version=S,this.initSelector();var e=[];this.subscription&&(e=this.subscription.listeners.get(),this.subscription.tryUnsubscribe()),this.initSubscription(),h&&(this.subscription.trySubscribe(),e.forEach(function(e){return t.subscription.listeners.subscribe(e)}))}},tt(c,n)}}function p(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!==t&&e!==e}function c(t,e){if(p(t,e))return!0;if("object"!==(void 0===t?"undefined":A(t))||null===t||"object"!==(void 0===e?"undefined":A(e))||null===e)return!1;var n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(var r=0;r=0;r--){var o=e[r](t);if(o)return o}return function(e,r){throw Error("Invalid value of type "+(void 0===t?"undefined":A(t))+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function R(t,e){return t===e}var W={only:function(t){return t&&t[0]||null}};n.isRequired=n;var I={element:n,func:n,shape:function(){return n},instanceOf:function(){return n}},F=I.shape({trySubscribe:I.func.isRequired,tryUnsubscribe:I.func.isRequired,notifyNestedSubs:I.func.isRequired,isSubscribed:I.func.isRequired}),H=I.shape({subscribe:I.func.isRequired,dispatch:I.func.isRequired,getState:I.func.isRequired}),A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},J=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},z=!1,B=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"store",o=arguments[1],i=o||n+"Subscription",s=function(t){function e(e,r){var o=J(this,t.call(this,e,r));return o[n]=e.store,o}return K(e,t),e.prototype.getChildContext=function(){var t;return t={},t[n]=this[n],t[i]=null,t},e.prototype.render=function(){return W.only(this.props.children)},e}(t.Component);return s.prototype.componentWillReceiveProps=function(t){this[n]!==t.store&&r()},s.childContextTypes=(e={},e[n]=H.isRequired,e[i]=F,e),s}(),G={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},L={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Q=Object.defineProperty,V=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,Y=Object.getOwnPropertyDescriptor,Z=Object.getPrototypeOf,$=Z&&Z(Object),tt=function t(e,n,r){if("string"!=typeof n){if($){var o=Z(n);o&&o!==$&&t(e,o,r)}var i=V(n);X&&(i=i.concat(X(n)));for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:{},e=t.connectHOC,n=void 0===e?u:e,r=t.mapStateToPropsFactories,o=void 0===r?qt:r,i=t.mapDispatchToPropsFactories,s=void 0===i?Tt:i,p=t.mergePropsFactories,a=void 0===p?Et:p,d=t.selectorFactory,f=void 0===d?D:d;return function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u=i.pure,p=void 0===u||u,d=i.areStatesEqual,l=void 0===d?R:d,h=i.areOwnPropsEqual,b=void 0===h?c:h,y=i.areStatePropsEqual,v=void 0===y?c:y,m=i.areMergedPropsEqual,P=void 0===m?c:m,O=k(i,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),S=M(t,o,"mapStateToProps"),g=M(e,s,"mapDispatchToProps"),w=M(r,a,"mergeProps");return n(f,_({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:!!t,initMapStateToProps:S,initMapDispatchToProps:g,initMergeProps:w,pure:p,areStatesEqual:l,areOwnPropsEqual:b,areStatePropsEqual:v,areMergedPropsEqual:P},O))}}(),connectAdvanced:u}}); //# sourceMappingURL=preact-redux.min.js.map