(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[12],{"0jlH":function(e,t,n){"use strict";var r=n("g09b");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n("qIgq")),u=g(n("q1tI")),i=n("Hg0r"),c=n("Hx5s"),a=n("ArA+"),f=n("s4NR"),l=n("N8P2"),s=n("xKgJ");function d(e){if("function"!==typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function g(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==typeof e&&"function"!==typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=o?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(r,u,i):r[u]=e[u]}return r.default=e,n&&n.set(e,r),r}var p=function(e){var t=e.dispatch,n=e.settings,r=(0,u.useState)(!1),i=(0,o.default)(r,2),d=i[0],g=i[1],p=e.children,y=e.loading,v=!!localStorage.getItem("x-access-token"),w=(0,s.getAccessToken)();(0,f.stringify)({redirect:window.location.href});(0,u.useEffect)(function(){g(!0),t&&("null"!==w?t({type:"user/fetchCurrent"}):a.router.push("/user/login"))},[]),(0,u.useEffect)(function(){t&&t({type:"settings/fetchConfig",callback:function(){document.getElementById("title-icon").href=n.titleIcon,g(!0)}})},[n.title]);var b=function(){return v&&(0,l.initWebSocket)(),!v&&y||!d?u.default.createElement(c.PageLoading,null):v?p:u.default.createElement(a.Redirect,{to:"/user/login"})};return b()},y=(0,i.connect)(function(e){var t=e.user,n=e.settings,r=e.loading;return{currentUser:t.currentUser,settings:n,loading:r.models.user}})(p);t.default=y}}]);