"use strict";const o=require("react/jsx-runtime"),a=require("react"),u=require("../tools/tools.cjs"),L=require("./nav-item.cjs"),p=require("./nav-link.cjs"),_=require("./nav-tab-content.cjs"),I=require("./nav-tab-pane.cjs"),i=function(O){const{as:m="ul",className:k,contentProps:E,dropOldClass:b,fill:f,horizontal:c,justified:N,onChange:l,options:R,pills:C,skipItem:S,style:y,tabs:P,underline:T,variables:h,vertical:j,...K}=O,M=(R??[]).map((n,e)=>({...n,id:n.id??e})),[r,g]=a.useState(M),[s,z]=a.useState(null),v=a.useMemo(()=>r.some(n=>n.pane),[r]),B=a.useMemo(()=>{const n=u.classx(!b&&"nav",c&&`justify-content-${c}`,j&&"flex-column",P&&"nav-tabs",C&&"nav-pills",T&&"nav-underline",f&&"nav-fill",N&&"nav-justified",k),e=u.stylex((t,d)=>({tKey:u.convertBsKeyToVar(d)}),h,y);return{className:n,style:e}},[k,b,f,c,N,C,y,P,T,h,j]),q=a.useCallback((n,e,t)=>{if(v){if((s==null?void 0:s.id)===n.id)return;g(d=>{const x=d.map((F,V)=>({...F,active:V===e}));return z(x[e]),x})}l==null||l(n.id,t)},[s==null?void 0:s.id,v,l]);return o.jsxs(o.Fragment,{children:[o.jsx(m,{...K,...B,children:r.map((n,e)=>S?a.createElement(p.NavLink,{active:n.active,disabled:n.disabled,href:n.href,...n.linkProps,key:n.id,onClick:t=>q(n,e,t)},n.link):a.createElement(L.NavItem,{...n.itemProps,key:n.id},o.jsx(p.NavLink,{active:n.active,disabled:n.disabled,href:n.href,...n.linkProps,onClick:t=>q(n,e,t),children:n.link}),n.item&&n.item))}),v&&o.jsx(_.NavTabContent,{...E,children:r.map(n=>a.createElement(I.NavTabPane,{active:n.active,fade:n.fade,...n.paneProps,key:n.id},n.pane))})]})};i.Item=L.NavItem;i.Link=p.NavLink;i.TabContent=_.NavTabContent;i.TabPane=I.NavTabPane;i.displayName="BRL.Nav";exports.Nav=i;
//# sourceMappingURL=nav.cjs.map
