import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{l as t}from"./vendor-vue-core-CvBSzfTV.js";import{n}from"./vendor-i18n-B2MApQxA.js";import{Ir as r,Xn as i,t as a}from"./dialogService-Dp405gae.js";function useWorkspaceSwitch(){let{t:e}=n(),o=i(),{activeWorkspace:s}=t(o),c=r(),l=a();function hasUnsavedChanges(){return c.modifiedWorkflows.length>0}async function switchWithConfirmation(t){if(s.value?.id===t)return!0;if(hasUnsavedChanges()&&!await l.confirm({title:e(`workspace.unsavedChanges.title`),message:e(`workspace.unsavedChanges.message`),type:`dirtyClose`}))return!1;try{return await o.switchWorkspace(t),!0}catch{return!1}}return{hasUnsavedChanges,switchWithConfirmation}}export{useWorkspaceSwitch as t};
//# sourceMappingURL=useWorkspaceSwitch-BJlFrCTK.js.map