import{cQ as x,e as y,V as A,c_ as S,l as w}from"./index-9PRMimni.js";import{u as R}from"./tabsView-BXskTdVh.js";function L(d){const r=x(),o=R(),n=y(),m=S(),{t:s}=A(),{currentRoute:a}=n;function i(){const e=w(a);return o.getTabList.find(t=>t.fullPath===e.fullPath)}async function b(e,t){const c=t||i();await o.setTabTitle(e,c)}function u(){o.closeCurrentTab(a),r.removeKeepAliveComponents([a.value.name]);const e=o.getTabList[Math.max(0,o.getTabList.length-1)];n&&n.push(e)}function f(){o.closeCurrentTab(a),n&&n.back(),r.removeKeepAliveComponents([a.value.name])}function l(e){o.closeCurrentTab(a),r.removeKeepAliveComponents([a.value.name]),e({router:n})}async function p(e){const t=i();await o.setTabState(e,t)}async function C(e){const{title:t,message:c,positiveText:g,negativeText:v,callback:T}=e??{};m.warning({title:t??s("common.tipsText"),content:c??s("common.unfinishedOperationConfirmClose"),positiveText:g??s("common.confirmText"),negativeText:v??s("common.cancelText"),onPositiveClick:()=>{if(T)l(T);else try{u()}catch(h){console.log("Error closing tab:",h),n.push("/")}}})}return{closeCurrentAfterAction:l,closeCurrentTabToBack:f,closeCurrentTabWithConfirm:C,closeCurrent:()=>u(),setTitle:(e,t)=>b(e,t),setTabState:p}}export{L as u};
