"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[717],{94935:function(we,Z,t){t.r(Z),t.d(Z,{default:function(){return me}});var k=t(26068),x=t.n(k),b=t(15558),g=t.n(b),w=t(335),A=t.n(w),q=t(90228),C=t.n(q),_=t(87999),I=t.n(_),ee=t(48305),v=t.n(ee),d=t(75271),h=t(97529),te=t(31102),ne=t(32768),ae=t(17988),re=t(92804),oe=t(16483),se=t.n(oe),qe=t(81414),ue=t(69037),le=t(25403),L=t(9224),ie=t(66949),E=t(25368),T=t(11784),de=t(66656),fe=t(21911),ve=1,ce=4;function he(U){return(0,fe.Z)(U,ve|ce)}var pe=he,ge=t(27718),l=t(52676),ye=function(Se){var O,Ce=(0,h.useModel)("pageLoading"),Le=Ce.pageLoading,je=(0,d.useState)({}),D=v()(je,2),u=D[0],Me=D[1],Oe=(0,d.useState)({}),K=v()(Oe,2),z=K[0],R=K[1],Re=(0,h.useModel)("pageLoading"),j=Re.setPageLoading,Pe=(0,h.useModel)("@@initialState"),P=Pe.initialState,i=P==null?void 0:P.accountInfo,y=(0,h.useLocation)(),p=le.Z.parse(y.search),Fe=(0,d.useState)(""),G=v()(Fe,2),Ze=G[0],H=G[1],xe=(0,d.useState)([]),N=v()(xe,2),Ae=N[0],M=N[1],Ie=(0,d.useState)([""]),$=v()(Ie,2),B=$[0],F=$[1],Ee=(0,d.useState)(!1),W=v()(Ee,2),Te=W[0],Ue=W[1],De=(0,d.useState)([]),Y=v()(De,2),m=Y[0],Ke=Y[1],ze=(0,d.useState)([]),J=v()(ze,2),Ge=J[0],He=J[1];se().locale("zh-cn");var Ne=function(){var o=I()(C()().mark(function a(){var e,n,s;return C()().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(e="/api/admin/layout/index/index",e){r.next=4;break}return R("The layout API cannot be null!"),r.abrupt("return");case 4:return j(!0),r.next=7,(0,T.U)({url:e});case 7:n=r.sent,Me(n),n.menu&&(Ke(Ve(n.menu)),He(ke(pe(n.menu)))),s=(0,E.Ah)(n.menu,y.pathname,decodeURIComponent(S)),H(s),j(!1);case 13:case"end":return r.stop()}},a)}));return function(){return o.apply(this,arguments)}}(),$e=function(){var o=I()(C()().mark(function a(){var e,n,s;return C()().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(e=(0,E.Ah)(u.menu,y.pathname,decodeURIComponent(S)),H(e),S){r.next=5;break}return R(null),r.abrupt("return");case 5:return n={},Object.keys(p).forEach(function(c){c!=="api"&&(n[c]=p[c])}),j(!0),r.next=10,(0,T.U)({url:S,data:n});case 10:s=r.sent,R(s),j(!1);case 13:case"end":return r.stop()}},a)}));return function(){return o.apply(this,arguments)}}(),S="";p!=null&&p.api&&(S=p.api),(0,d.useEffect)(function(){Ne()},[]),(0,d.useEffect)(function(){$e()},[p.api,p.timestamp]);var Be=function o(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.menu,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],s=A()(e),f;try{for(s.s();!(f=s.n()).done;){var r=f.value,c=r.key;if(a===c)return M(g()(new Set(n))),n.push(c),F(g()(new Set(n))),r;if(r.routes&&r.routes.length>0){n.push(c);var V=o(a,r.routes,n);if(V)return M(g()(new Set(n))),F(g()(new Set(n))),V;n.pop()}}}catch(be){s.e(be)}finally{s.f()}},We=function o(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(a.type===2)return a;if(!(!a.routes||!a.routes.length)){var n=A()(a.routes),s;try{for(n.s();!(s=n.n()).done;){var f=s.value;if(f.type===2)return f;if(f.routes&&f.routes.length>0){e.push(f.key);var r=o(f.routes[0]);if(r)return M(e),r;e.pop()}}}catch(c){n.e(c)}finally{n.f()}}},Ye=function(a){var e=m.find(function(s){return s.key===a.key});if(e&&e.type!==3){if(e.type===1&&e.routes&&e.routes.length){var n=We(e);if(!n)return;F(g()(new Set([].concat(g()(B),[n.key])))),h.history.push(n.path)}else if(e.type===2){if(e.is_link===1||e.isLink===1)return window.open(e.path,"_blank"),!1;h.history.push(e.path)}}},Je=function(a){M(a)},Qe=u==null||(O=u.rightMenus)===null||O===void 0?void 0:O.map(function(o,a){return{key:a,label:(0,l.jsx)(L.Z,{body:o})}}),Xe=(0,ge.lr)(),Q=v()(Xe,2),X=Q[0],_e=Q[1];(0,d.useEffect)(function(){if(m&&m.length>0){var o=m.find(function(a){return a.path.startsWith(y.pathname+(X.get("api")?"?api="+X.get("api"):""))});if(!o)return;Be(o.key)}},[y,m]);var Ve=function o(a){return a.reduce(function(e,n){return e.push(n),n.routes&&n.routes.length>0&&(e=e.concat(o(n.routes))),e},[])},ke=function o(a){return a.filter(function(e){return e.routes&&e.routes.length&&(e.routes=o(e.routes)),e.show})};return(0,l.jsx)(te.ZP,{locale:re.Z,children:(0,l.jsxs)(ne.Z,{children:[(0,l.jsxs)(h.Helmet,{children:[(0,l.jsx)("meta",{charSet:"utf-8"}),(0,l.jsx)("title",{children:Ze})]}),(u==null?void 0:u.title)&&(0,l.jsx)(ue.f,x()(x()({},u),{},{loading:Le,logo:u.logo?u.logo:ie,iconfontUrl:u.iconfontUrl,openKeys:Ae,selectedKeys:B,menuProps:{onOpenChange:Je,onClick:Ye},onCollapse:function(a){Ue(a)},menuDataRender:function(){return Ge},actionsRender:function(){return[(0,l.jsx)(L.Z,{body:u.actions},"action")]},avatarProps:{src:i!=null&&i.avatar?i==null?void 0:i.avatar:(0,l.jsx)(de.Z,{style:{color:"rgb(22, 119, 255)"}}),size:"small",title:Se.layout==="side"?Te||i==null?void 0:i.nickname:i==null?void 0:i.nickname,render:function(a,e){return(0,l.jsx)(ae.Z,{menu:{items:Qe},children:e})}},footerRender:function(){return(0,l.jsx)(L.Z,{body:u.footer})},children:z?(0,l.jsx)(L.Z,{body:z}):(0,l.jsx)(h.Outlet,{})}))]})})},me=ye}}]);
