import{l as O,p as d,e as B,c as $,a as A,s as Q,t as X,f as ft}from"./C5OrMAnU.js";import{o as ht,m as H,c as yt,e as pt,b as L,h as U,z as Ct,k as K,v as ct,g as dt,i as F,a as D,q as Y,s as Z}from"./B-4V-jI8.js";import{a5 as Tt,D as xt,h as Et,p as M,ah as k,ai as j,e as tt,W as et,g as i,aj as at,f as w,b as R,d as st,r as nt,t as rt,au as G,i as vt}from"./c625DOTJ.js";import{i as ot,j as lt,e as J}from"./flAd0kFy.js";import{c as gt}from"./zO0CuF4M.js";import{b as kt}from"./BiEgxckG.js";import{c as At}from"./DD2Fa8hh.js";import{n as Vt,p as Ot,l as St}from"./DkGSCXZX.js";import{o as Pt}from"./C9nuju27.js";import{t as $t,r as Dt,g as wt}from"./CL9tgVpD.js";import{c as Nt}from"./B9zgB7jn.js";function jt(c){return window.getComputedStyle(c).getPropertyValue("direction")}const zt={orientation:"horizontal",activateOnFocus:!0,loop:!0,autoSet:!0},{name:W,selector:Ft}=yt("tabs");function Mt(c){const t={...zt,...c},y=$t(ht(t,"defaultValue","value","onValueChange","autoSet")),{orientation:f,activateOnFocus:v,loop:x}=y,p=t.value??Tt(t.defaultValue),a=Pt(p,t==null?void 0:t.onValueChange);let l=t.defaultValue??a.get();const g=H(W(),{stores:f,returned:e=>({"data-orientation":e})}),E=H(W("list"),{stores:f,returned:e=>({role:"tablist","aria-orientation":e,"data-orientation":e})}),V=e=>typeof e=="string"?{value:e}:e,S=H(W("trigger"),{stores:[a,f],returned:([e,T])=>s=>{const{value:n,disabled:r}=V(s);!e&&!l&&t.autoSet&&(l=n,e=n,a.set(n));const m=(dt?e:l)===n;return{type:"button",role:"tab","data-state":m?"active":"inactive",tabindex:m?0:-1,"data-value":n,"data-orientation":T,"data-disabled":ct(r),disabled:ct(r)}},action:e=>({destroy:pt(L(e,"focus",()=>{const s=e.dataset.disabled==="true",n=e.dataset.value;v.get()&&!s&&n!==void 0&&a.set(n)}),L(e,"click",s=>{if(e.focus(),s.preventDefault(),e.dataset.disabled==="true")return;const r=e.dataset.value;e.focus(),r!==void 0&&a.set(r)}),L(e,"keydown",s=>{const n=e.dataset.value;if(!n)return;const r=s.currentTarget;if(!U(r))return;const b=r.closest(Ft());if(!U(b))return;const m=x.get(),_=Array.from(b.querySelectorAll('[role="tab"]')).filter(o=>U(o)).filter(o=>!o.hasAttribute("data-disabled")),P=_.findIndex(o=>o===s.target),N=jt(b),{nextKey:z,prevKey:h}=Ct(N,f.get());s.key===z?(s.preventDefault(),Vt(_,P,m).focus()):s.key===h?(s.preventDefault(),Ot(_,P,m).focus()):s.key===K.ENTER||s.key===K.SPACE?(s.preventDefault(),a.set(n)):s.key===K.HOME?(s.preventDefault(),_[0].focus()):s.key===K.END&&(s.preventDefault(),St(_).focus())}))})}),C=H(W("content"),{stores:a,returned:e=>T=>({role:"tabpanel","aria-labelledby":T,hidden:dt?e===T?void 0:!0:l===T?void 0:!0,tabindex:0})});return{elements:{root:g,list:E,trigger:S,content:C},states:{value:a},options:y}}function bt(){return{NAME:"tabs",PARTS:["root","content","list","trigger"]}}function Rt(c){const{NAME:t,PARTS:y}=bt(),f=Nt(t,y),v={...Mt(Dt(c)),getAttrs:f};return xt(t,v),{...v,updateOption:wt(v.options)}}function mt(){const{NAME:c}=bt();return Et(c)}var qt=X("
");function Ht(c,t){const y=O(t,["children","$$slots","$$events","$$legacy"]),f=O(y,["orientation","activateOnFocus","loop","autoSet","value","onValueChange","asChild","el"]);M(t,!1);const[v,x]=Q(),p=()=>B(n,"$root",v),a=()=>B(r,"$localValue",v),l=et();let g=d(t,"orientation",24,()=>{}),E=d(t,"activateOnFocus",24,()=>{}),V=d(t,"loop",24,()=>{}),S=d(t,"autoSet",24,()=>{}),C=d(t,"value",28,()=>{}),e=d(t,"onValueChange",24,()=>{}),T=d(t,"asChild",8,!1),s=d(t,"el",28,()=>{});const{elements:{root:n},states:{value:r},updateOption:b,getAttrs:m}=Rt({orientation:g(),activateOnFocus:E(),loop:V(),autoSet:S(),defaultValue:C(),onValueChange:({next:h})=>{var o;return C()!==h&&((o=e())==null||o(h),C(h)),h}}),u=m("root");k(()=>j(C()),()=>{C()!==void 0&&r.set(C())}),k(()=>j(g()),()=>{b("orientation",g())}),k(()=>j(E()),()=>{b("activateOnFocus",E())}),k(()=>j(V()),()=>{b("loop",V())}),k(()=>j(S()),()=>{b("autoSet",S())}),k(()=>p(),()=>{tt(l,p())}),k(()=>i(l),()=>{Object.assign(i(l),u)}),at(),F();var _=$(),P=w(_);{var N=h=>{var o=$(),q=w(o);D(q,t,"default",{get builder(){return i(l)},get value(){return a()}},null),A(h,o)},z=h=>{var o=qt();let q;var _t=st(o);D(_t,t,"default",{get builder(){return i(l)},get value(){return a()}},null),nt(o),lt(o,I=>s(I),()=>s()),Y(o,I=>{var it,ut;return(ut=(it=i(l)).action)==null?void 0:ut.call(it,I)}),rt(()=>q=Z(o,q,{...i(l),...f})),A(h,o)};ot(P,h=>{T()?h(N):h(z,!1)})}A(c,_),R(),x()}var Kt=X("
");function Wt(c,t){const y=O(t,["children","$$slots","$$events","$$legacy"]),f=O(y,["asChild","el"]);M(t,!1);const[v,x]=Q(),p=()=>B(E,"$list",v),a=et();let l=d(t,"asChild",8,!1),g=d(t,"el",28,()=>{});const{elements:{list:E},getAttrs:V}=mt(),S=V("list");k(()=>p(),()=>{tt(a,p())}),k(()=>i(a),()=>{Object.assign(i(a),S)}),at(),F();var C=$(),e=w(C);{var T=n=>{var r=$(),b=w(r);D(b,t,"default",{get builder(){return i(a)}},null),A(n,r)},s=n=>{var r=Kt();let b;var m=st(r);D(m,t,"default",{get builder(){return i(a)}},null),nt(r),lt(r,u=>g(u),()=>g()),Y(r,u=>{var _,P;return(P=(_=i(a)).action)==null?void 0:P.call(_,u)}),rt(()=>b=Z(r,b,{...i(a),...f})),A(n,r)};ot(e,n=>{l()?n(T):n(s,!1)})}A(c,C),R(),x()}var Bt=X("");function It(c,t){const y=O(t,["children","$$slots","$$events","$$legacy"]),f=O(y,["value","disabled","asChild","el"]);M(t,!1);const[v,x]=Q(),p=()=>B(S,"$trigger",v),a=et();let l=d(t,"value",8),g=d(t,"disabled",24,()=>{}),E=d(t,"asChild",8,!1),V=d(t,"el",28,()=>{});const{elements:{trigger:S},getAttrs:C}=mt(),e=At(),T=C("trigger");k(()=>(p(),j(l()),j(g())),()=>{tt(a,p()({value:l(),disabled:g()}))}),k(()=>i(a),()=>{Object.assign(i(a),T)}),at(),F();var s=$(),n=w(s);{var r=m=>{var u=$(),_=w(u);D(_,t,"default",{get builder(){return i(a)}},null),A(m,u)},b=m=>{var u=Bt();let _;var P=st(u);D(P,t,"default",{get builder(){return i(a)}},null),nt(u),lt(u,N=>V(N),()=>V()),Y(u,N=>{var z,h;return(h=(z=i(a)).action)==null?void 0:h.call(z,N)}),G(()=>J("m-click",u,e)),G(()=>J("m-focus",u,e)),G(()=>J("m-keydown",u,e)),rt(()=>_=Z(u,_,{...i(a),type:"button",...f})),A(m,u)};ot(n,m=>{E()?m(r):m(b,!1)})}A(c,s),R(),x()}function se(c,t){const y=O(t,["children","$$slots","$$events","$$legacy"]),f=O(y,["class"]);M(t,!1);let v=d(t,"class",8,void 0);F();const x=vt(()=>gt("bg-muted text-muted-foreground inline-flex h-10 items-center justify-center rounded-md p-1",v()));Wt(c,ft({get class(){return i(x)}},()=>f,{children:(p,a)=>{var l=$(),g=w(l);D(g,t,"default",{},null),A(p,l)},$$slots:{default:!0}})),R()}function ne(c,t){const y=O(t,["children","$$slots","$$events","$$legacy"]),f=O(y,["class","value"]);M(t,!1);let v=d(t,"class",8,void 0),x=d(t,"value",8);F();const p=vt(()=>gt("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm",v()));It(c,ft({get class(){return i(p)},get value(){return x()}},()=>f,{$$events:{click(a){kt.call(this,t,a)}},children:(a,l)=>{var g=$(),E=w(g);D(E,t,"default",{},null),A(a,g)},$$slots:{default:!0}})),R()}const re=Ht;export{re as R,se as T,ne as a,mt as g};