import{q as f,j as s,J as w}from"./app-Bup04Qnx.js";import{u as g}from"./format-CisCU4Rs.js";const j=({links:a,pageUrl:u,defaultActive:c=null})=>{var d,p;const{props:o,url:h}=f(),{params:i}=g(o.location),m=a.find(t=>t.isDefault===!0),l=m?m.name:a.length>0?a[0].name:null;let r=i.get("show");if(!r){let t=h.split(u);t.length>0&&(r=((p=(d=t[0])==null?void 0:d.split("/"))==null?void 0:p[0])??l)}r||(r=c);let e=a.find(t=>t.name===r);e||(r=l,e=a.find(t=>t.name===r));const n=e!=null&&e.Component?e==null?void 0:e.Component:()=>s.jsx("div",{className:"text-red-500 p-4",children:"Menu tidak ditemukan."}),x=e!=null&&e.wrapperClassName?e==null?void 0:e.wrapperClassName:"mt-2 p-4 border rounded";return s.jsxs("div",{className:"w-full mt-2 relative max-h-[calc(100vh-5rem)] overflow-auto scrollbar-thin",children:[s.jsx("div",{className:"flex items-center space-x-1 border-b p-2 rounded-t-md sticky top-0 bg-white z-10",children:a.map(t=>s.jsx(w,{href:t.url,preserveState:!0,preserveScroll:!0,className:`px-4 py-2 rounded-md text-sm font-medium transition-colors duration-150 ease-in-out ${t.name===r?"bg-blue-600 text-white shadow-sm":"text-gray-700 hover:bg-gray-200 hover:text-gray-900"}`,children:t.label},t.name))}),s.jsx("div",{className:x,children:n&&s.jsx(n,{...o})})]})};export{j as S};
