import{a1 as b,f as C,s as I,d as M,an as L,l as S,at as T,k as P,V as k,a8 as N,a2 as V,a5 as d,aa as x,m as O,u as v,a9 as w,au as E,ai as A}from"./vue-DApy1uhY.js";import{f as R,u as j,k as y,i as B}from"./index-CL6hUm94.js";const K=["/login","/404","/403"],W=b("multi-tab",()=>{const n=C([]),u=I(),l=C(null),f=R(),a=C([]),o=j(),r=e=>{if(!e||e.path.startsWith("/redirect")||e.path.startsWith("/common")||e.path==="/"||K.includes(e.path))return;if(l.value&&setTimeout(()=>{l.value&&(l.value.loading=!1,l.value=null)},500),n.value.some(m=>m.fullPath===e.fullPath)){!a.value.includes(e==null?void 0:e.name)&&f.layoutSetting.keepAlive&&e.meta.keepAlive&&e.name&&a.value.push(e.name);return}const t={path:e.path,fullPath:e.fullPath,title:e.meta.title,name:e.name,icon:e.meta.icon,affix:e.meta.affix,locale:e.meta.locale};!a.value.includes(t==null?void 0:t.name)&&f.layoutSetting.keepAlive&&e.meta.keepAlive&&e.name&&a.value.push(e.name),n.value.push(t)},c=e=>{if(n.value.length<=1){o.error("不能关闭最后一个标签页");return}const t=n.value.findIndex(s=>s.fullPath===e);if(t<0){o.error("当前页签不存在无法关闭");return}const m=n.value[t];if(m.fullPath===u.value){const s=t===0?n.value[t+1]:n.value[t-1];u.value=s.fullPath,y.push(s.fullPath)}f.layoutSetting.keepAlive&&m.name&&(a.value=a.value.filter(s=>s!==m.name)),n.value=n.value.filter(s=>s.fullPath!==e)},h=e=>{const t=n.value.find(m=>m.fullPath===e);t&&(a.value=a.value.filter(m=>m!==t.name),t.loading=!0,l.value=t,y.replace(`/redirect/${encodeURIComponent(t.fullPath)}`))},i=e=>{e!==u.value&&y.push(e)};return{list:n,activeKey:u,cacheList:a,close:c,clear:()=>{n.value=[],a.value=[],u.value=void 0,l.value=null},closeLeft:e=>{i(e);const t=n.value.findIndex(s=>s.fullPath===e);n.value.slice(0,t).forEach(s=>{s.affix||c(s.fullPath)})},closeRight:e=>{i(e);const t=n.value.findIndex(s=>s.fullPath===e);n.value.slice(t+1).forEach(s=>{s.affix||c(s.fullPath)})},closeOther:e=>{i(e),n.value.forEach(t=>{t.affix||t.fullPath!==e&&c(t.fullPath)})},refresh:h,switchTab:i,addItem:r}}),z=M({name:"ParentCompConsumer",setup(n,{slots:u}){const l=L(),f=new Map;return()=>{var r,c,h;const a=(r=l.meta)==null?void 0:r.parentName,o=(c=l.meta)==null?void 0:c.parentComps;if(a){if(f.has(a))return f.get(a);if(o!=null&&o.length){let i;for(const p of[...o].reverse()){const _=B(p)?T(p):p;i?i=S(_,null,{default:()=>i}):i=S(_,null,u)}if(i)return f.set(a,i),i}}return(h=u==null?void 0:u.default)==null?void 0:h.call(u)}}}),g=new Map;function D(){const n=L();return{getComp:l=>{var c;if(!n.name)return l;const f=(c=l==null?void 0:l.type)==null?void 0:c.name,a=n.name;if(g.has(a))return g.get(a);const o=l;if(f&&f===a)return g.set(a,o),o;const r=P(o);return r.type||(r.type={}),r.type.name=a,g.set(a,r),r}}}const F={class:"flex flex-col h-full"},U=Object.assign({name:"CustomRouteView"},{__name:"route-view",setup(n){const u=R(),{layoutSetting:l}=k(u),f=W(),{cacheList:a}=k(f),{getComp:o}=D();return(r,c)=>{const h=N("RouterView");return d(),V("div",F,[P(v(z),null,{default:x(()=>[P(h,null,{default:x(({Component:i,route:p})=>[P(O,{appear:"",name:v(l).animationName,mode:"out-in"},{default:x(()=>[v(l).keepAlive?(d(),w(E,{key:0,include:[...v(a)]},[(d(),w(A(v(o)(i)),{key:p.fullPath}))],1032,["include"])):(d(),w(A(i),{key:p.fullPath}))]),_:2},1032,["name"])]),_:1})]),_:1})])}}}),J=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"}));export{U as _,J as r,W as u};
