/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/react-universal-component@4.5.0/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setHasBabelPlugin=exports.ReportChunks=exports.MODULE_IDS=exports.CHUNK_NAMES=void 0;var _extends=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},_createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),_requireUniversalModule=require("./requireUniversalModule");Object.defineProperty(exports,"CHUNK_NAMES",{enumerable:!0,get:function(){return _requireUniversalModule.CHUNK_NAMES}}),Object.defineProperty(exports,"MODULE_IDS",{enumerable:!0,get:function(){return _requireUniversalModule.MODULE_IDS}});var _reportChunks=require("./report-chunks");Object.defineProperty(exports,"ReportChunks",{enumerable:!0,get:function(){return _interopRequireDefault(_reportChunks).default}}),exports.default=universal;var _react=require("react"),_react2=_interopRequireDefault(_react),_propTypes=require("prop-types"),_propTypes2=_interopRequireDefault(_propTypes),_hoistNonReactStatics=require("hoist-non-react-statics"),_hoistNonReactStatics2=_interopRequireDefault(_hoistNonReactStatics),_requireUniversalModule2=_interopRequireDefault(_requireUniversalModule),_context=require("./context"),_context2=_interopRequireDefault(_context),_utils=require("./utils"),_helpers=require("./helpers");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function _inherits(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}function _objectWithoutProperties(e,r){var t={};for(var n in e)r.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}var hasBabelPlugin=!1,isHMR=function(){return module.hot&&(module.hot.data||"apply"===module.hot.status())},setHasBabelPlugin=exports.setHasBabelPlugin=function(){hasBabelPlugin=!0};function universal(e){var r,t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.render,i=n.loading,a=void 0===i?_utils.DefaultLoading:i,u=n.error,s=void 0===u?_utils.DefaultError:u,l=n.minDelay,p=void 0===l?0:l,c=n.alwaysDelay,d=void 0!==c&&c,f=n.testBabelPlugin,h=void 0!==f&&f,_=n.loadingTransition,v=void 0===_||_,y=_objectWithoutProperties(n,["render","loading","error","minDelay","alwaysDelay","testBabelPlugin","loadingTransition"]),b=o||(0,_utils.createDefaultRender)(a,s),m=hasBabelPlugin||h;return y.isDynamic=m,y.usesBabelPlugin=hasBabelPlugin,y.modCache={},y.promCache={},t=r=function(){function r(e,t){_classCallCheck(this,r);var n=_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t));return n.update=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n._initialized&&(e.error||(e.error=null),n.handleAfter(e,r,t,o))},n.state=n.init(n.props),n.state.error=null,n}return _inherits(r,_react2.default.Component),_createClass(r,[{key:"requireAsyncInner",value:function(e,r,t,n){var o=this;!t.mod&&v&&this.update({mod:null,props:r});var i=new Date;e(r).then((function(e){var t={mod:e,props:r},a=new Date-i;if(a<p)return setTimeout((function(){return o.update(t,n)}),p-a);o.update(t,n)})).catch((function(e){return o.update({error:e,props:r})}))}},{key:"handleBefore",value:function(e,r){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.props.onBefore&&(0,this.props.onBefore)({isMount:e,isSync:r,isServer:t})}},{key:"handleAfter",value:function(e,t,n,o){var i=e.mod,a=e.error;i&&!a?((0,_hoistNonReactStatics2.default)(r,i,{preload:!0,preloadWeak:!0}),this.props.onAfter&&(0,this.props.onAfter)({isMount:t,isSync:n,isServer:o},i)):a&&this.props.onError&&this.props.onError(a);this.setState(e)}},{key:"init",value:function(r){var t=(0,_requireUniversalModule2.default)(e,y,r),n=t.addModule,o=t.requireSync,i=t.requireAsync,a=t.asyncOnly,u=void 0;try{u=o(r)}catch(e){return(0,_helpers.__update)(r,{error:e,props:r},this._initialized)}this._asyncOnly=a;var s=n(r);return this.context&&this.context.report&&this.context.report(s),u||_utils.isServer?(this.handleBefore(!0,!0,_utils.isServer),(0,_helpers.__update)(r,{asyncOnly:a,props:r,mod:u},this._initialized,!0,!0,_utils.isServer)):(this.handleBefore(!0,!1),this.requireAsyncInner(i,r,{props:r,asyncOnly:a,mod:u},!0),{mod:u,asyncOnly:a,props:r})}}],[{key:"preload",value:function(t){t=t||{};var n=(0,_requireUniversalModule2.default)(e,y,t),o=n.requireAsync,i=n.requireSync,a=void 0;try{a=i(t)}catch(e){return Promise.reject(e)}return Promise.resolve().then((function(){return a||o(t)})).then((function(e){return(0,_hoistNonReactStatics2.default)(r,e,{preload:!0,preloadWeak:!0}),e}))}},{key:"preloadWeak",value:function(t){t=t||{};var n=(0,(0,_requireUniversalModule2.default)(e,y,t).requireSync)(t);return n&&(0,_hoistNonReactStatics2.default)(r,n,{preload:!0,preloadWeak:!0}),n}}]),_createClass(r,[{key:"componentDidMount",value:function(){this._initialized=!0}},{key:"componentDidUpdate",value:function(r){var t=this;if(m||this._asyncOnly){var n=(0,_requireUniversalModule2.default)(e,y,this.props,r),o=n.requireSync,i=n.requireAsync;if((0,n.shouldUpdate)(this.props,r)){var a=void 0;try{a=o(this.props)}catch(e){return this.update({error:e})}if(this.handleBefore(!1,!!a),!a)return this.requireAsyncInner(i,this.props,{mod:a});var u={mod:a};if(d)return v&&this.update({mod:null}),void setTimeout((function(){return t.update(u,!1,!0)}),p);this.update(u,!1,!0)}}}},{key:"componentWillUnmount",value:function(){this._initialized=!1}},{key:"render",value:function(){var e=this.props,r=e.isLoading,t=e.error,n=_objectWithoutProperties(e,["isLoading","error"]),o=this.state,i=o.mod,a=o.error;return b(n,i,r,t||a)}}],[{key:"getDerivedStateFromProps",value:function(r,t){var n=(0,_requireUniversalModule2.default)(e,y,r,t.props),o=n.requireSync,i=n.shouldUpdate;if(isHMR()&&i(t.props,r)){var a=o(r);return _extends({},t,{mod:a})}return null}}]),r}(),r.contextType=_context2.default,t}
//# sourceMappingURL=/sm/959b656dbd7d23e2a50fef34698f6d956bdd73b3754833b80b9d005f4d83403b.map