import{d as N,r as I,a as F,a8 as w,s as H,u as B,Y as V,a2 as j,o as E,F as i,b as U,ab as z,V as Q,a9 as Y,c as q,f as c,g as d,l as C,m as G,h as m,P as J,Q as K,n as p,e as u,k as M,ag as W,x as X}from"./index.2c7321ca.js";import{_ as Z}from"./_plugin-vue_export-helper.cdc0426e.js";const ee={class:"layout-columns-aside"},te=["onClick","onMouseenter","title"],se={class:"columns-vertical-title font12"},ne=["href"],oe={class:"columns-vertical-title font12"},le=N({__name:"columnsAside",setup(ie){const _=I([]),s=F({columnsAsideList:[],liIndex:0,liOldIndex:null,liHoverIndex:null,liOldPath:null,difference:0,routeSplit:[]}),f=w(),{routesList:$,isColumnsMenuHover:b,isColumnsNavHover:k}=H(f),O=B(),{themeConfig:a}=H(O),v=V(),A=j(),g=I(),R=()=>{var n;s.columnsAsideList=y($.value);const e=r(v.path);if(Object.keys(e).length<=0)return!1;S((n=e.item)==null?void 0:n.k),i.emit("setSendColumnsChildren",e)},y=e=>e.filter(n=>{var o;return!((o=n.meta)!=null&&o.isHide)}).map(n=>(n=Object.assign({},n),n.children&&(n.children=y(n.children)),n)),r=e=>{const n=e.split("/");let o={children:[]};return s.columnsAsideList.map((t,l)=>{t.path===`/${n[1]}`&&(t.k=l,o.item={...t},o.children=[{...t}],t.children&&(o.children=t.children))}),o},S=e=>{X(()=>{L(e)})},L=e=>{s.liIndex=e,g.value.style.top=`${_.value[e].offsetTop+s.difference}px`},x=(e,n)=>{L(n);let{path:o,redirect:t}=e;t?A.push(t):A.push(o)},P=(e,n)=>{if(!a.value.isColumnsMenuHoverPreload)return!1;let{path:o}=e;s.liOldPath=o,s.liOldIndex=n,s.liHoverIndex=n,i.emit("setSendColumnsChildren",r(o)),f.setColumnsMenuHover(!1),f.setColumnsNavHover(!0)},T=async()=>{await f.setColumnsNavHover(!1),setTimeout(()=>{!b&&!k&&i.emit("restoreDefault")},100)};E(()=>{R(),i.on("restoreDefault",()=>{s.liOldIndex=null,s.liOldPath=null})}),U(()=>{i.off("restoreDefault",()=>{})}),z(e=>{D(e.path),i.emit("setSendColumnsChildren",r(e.path))});const D=e=>{s.routeSplit=e.split("/"),s.routeSplit.shift();const n=`/${s.routeSplit[0]}`,o=s.columnsAsideList.find(t=>t.path===n);if(!o)return!1;setTimeout(()=>{S(o.k)},0)};return Q(Y.state,e=>{if(e.themeConfig.themeConfig.columnsAsideStyle==="columnsRound"?s.difference=3:s.difference=0,!e.routesList.isColumnsMenuHover&&!e.routesList.isColumnsNavHover)s.liHoverIndex=null,i.emit("setSendColumnsChildren",r(v.path));else{if(s.liHoverIndex=s.liOldIndex,!s.liOldPath)return!1;i.emit("setSendColumnsChildren",r(s.liOldPath))}},{deep:!0}),(e,n)=>{const o=q("SvgIcon");return c(),d("div",ee,[C(u(W),null,{default:G(()=>[m("ul",{onMouseleave:n[0]||(n[0]=t=>T())},[(c(!0),d(J,null,K(s.columnsAsideList,(t,l)=>(c(),d("li",{key:l,onClick:h=>x(t,l),onMouseenter:h=>P(t,l),class:p({"layout-columns-active":s.liIndex===l,"layout-columns-hover":s.liHoverIndex===l}),title:e.$t(t.meta.title),ref_for:!0,ref:h=>{h&&(_.value[l]=h)}},[!t.meta.isLink||t.meta.isLink&&t.meta.isIframe?(c(),d("div",{key:0,class:p(u(a).columnsAsideLayout)},[C(o,{name:t.meta.icon},null,8,["name"]),m("div",se,M(e.$t(t.meta.title)&&e.$t(t.meta.title).length>=4?e.$t(t.meta.title).substr(0,u(a).columnsAsideLayout==="colunmns-vertical"?4:3):e.$t(t.meta.title)),1)],2)):(c(),d("div",{key:1,class:p(u(a).columnsAsideLayout)},[m("a",{href:t.meta.isLink,target:"_blank"},[C(o,{name:t.meta.icon},null,8,["name"]),m("div",oe,M(e.$t(t.meta.title)&&e.$t(t.meta.title).length>=4?e.$t(t.meta.title).substr(0,u(a).columnsAsideLayout==="colunmns-vertical"?4:3):e.$t(t.meta.title)),1)],8,ne)],2))],42,te))),128)),m("div",{ref_key:"columnsAsideActiveRef",ref:g,class:p(u(a).columnsAsideStyle)},null,2)],32)]),_:1})])}}});const re=Z(le,[["__scopeId","data-v-bdaab301"]]);export{re as default};
