import{E as e,o as t,pt as n,s as r}from"./vue-vendor-DMUmTARL.js";var i=e=>Array.isArray(e)?e[0]:e;function a(a,o={}){let s=t(),c=r(),l=o.queryKey??`tab`,u=a[0]?.name??``,d=new Set(a.map(e=>e.name)),f=e=>{let t=i(e);return typeof t==`string`&&d.has(t)?t:u},p=e=>{let t=f(e),n=i(s.query[l]);if(t===u&&n==null||n===t)return;let r={...s.query};t===u?delete r[l]:r[l]=t,c.replace({query:r})},m=e({get:()=>f(s.query[l]),set:e=>{u&&p(e)}});return n(()=>s.query[l],e=>{let t=i(e);t!=null&&t!==f(t)&&p(t)},{immediate:!0}),{activeTab:m}}export{a as t};