import{i as n}from"./_virtual___federation_fn_import-DB-0B1B_.js";import{j as e}from"./jsx-runtime-u17CrQMm.js";import{E as w}from"./error-boundary-DgBD6_Zp.js";import{c as u}from"./clsx-B-dksMZM.js";import{z as b,A as y}from"./index-KpBDpTrU.js";import{N as S}from"./new-enum-dialog-BJIUIL9P.js";import{s as g}from"./sortBy-C9bvycg5.js";import{N as L}from"./new-model-dialog-B_egJqp8.js";function k(i,o){if(i.length===0)return;let a=i[0],r=o(a,0,i);for(let l=1;l<i.length;l++){const s=i[l],c=o(s,l,i);c>r&&(r=c,a=s)}return a}const{modelEnumEntityType:M}=await n("@baseplate-dev/project-builder-lib"),{useProjectDefinition:E}=await n("@baseplate-dev/project-builder-lib/web"),{Button:x,InputField:$,NavigationMenu:C,NavigationMenuItemWithLink:I,NavigationMenuList:T,ScrollArea:A}=await n("@baseplate-dev/ui-components"),{Link:F}=await n("@tanstack/react-router"),{useState:h}=await n("react");function B({className:i}){const{definition:{enums:o=[]}}=E(),[a,r]=h(""),l=o.filter(t=>t.name.toLowerCase().includes(a.toLowerCase())),s=g(l,[t=>t.name]),[c,m]=h(!1);return e.jsxs("div",{className:u(i,"flex flex-1 flex-col space-y-4 overflow-y-auto"),children:[e.jsxs("div",{className:"space-y-4 px-4",children:[e.jsx(S,{trigger:e.jsxs(x,{variant:"secondary",className:"w-full",children:[e.jsx(b,{}),"New Enum"]})}),o.length>0&&e.jsxs("div",{className:"relative",children:[e.jsx($,{value:a,onChange:t=>{r(t)},placeholder:"Search"}),a&&e.jsx(x,{variant:"ghost",className:"absolute top-1/2 right-4 -translate-y-1/2",size:"icon",onClick:()=>{r("")},children:e.jsx(y,{})})]})]}),e.jsxs(A,{className:u("flex-1 px-2",c&&"border-t"),onScrollCapture:t=>{const d=t.currentTarget.scrollTop>0;d!==c&&m(d)},children:[s.length===0&&a&&e.jsx("div",{className:"py-4 text-center text-style-muted",children:"No enums found"}),e.jsx(C,{orientation:"vertical",children:e.jsx(T,{children:s.map(t=>e.jsx("li",{children:e.jsx(I,{render:e.jsx(F,{to:"/data/enums/edit/$key",params:{key:M.keyFromId(t.id)}}),children:t.name})},t.id))})})]})]})}const{modelEntityType:D}=await n("@baseplate-dev/project-builder-lib"),{useProjectDefinition:P}=await n("@baseplate-dev/project-builder-lib/web"),{Button:p,InputField:W,NavigationMenu:Q,NavigationMenuItemWithLink:z,NavigationMenuList:R,ScrollArea:O}=await n("@baseplate-dev/ui-components"),{Link:q}=await n("@tanstack/react-router"),{useState:j}=await n("react");function G({className:i}){const{definition:{models:o}}=P(),[a,r]=j(""),l=o.filter(t=>t.name.toLowerCase().includes(a.toLowerCase())),s=g(l,[t=>t.name]),[c,m]=j(!1);return e.jsxs("div",{className:u(i,"flex flex-1 flex-col space-y-4 overflow-y-auto"),children:[e.jsxs("div",{className:"space-y-4 px-4",children:[e.jsx(L,{trigger:e.jsxs(p,{variant:"secondary",className:"w-full",children:[e.jsx(b,{}),"New Model"]})}),o.length>0&&e.jsxs("div",{className:"relative",children:[e.jsx(W,{value:a,onChange:t=>{r(t)},placeholder:"Search"}),a&&e.jsx(p,{variant:"ghost",className:"absolute top-1/2 right-4 -translate-y-1/2",onClick:()=>{r("")},size:"icon",children:e.jsx(y,{})})]})]}),e.jsxs(O,{className:u("flex-1 px-2",c&&"border-t"),onScrollCapture:t=>{const d=t.currentTarget.scrollTop>0;d!==c&&m(d)},children:[s.length===0&&a&&e.jsx("div",{className:"py-4 text-center text-style-muted",children:"No models found"}),e.jsx(Q,{orientation:"vertical",children:e.jsx(R,{children:s.map(t=>e.jsx(z,{render:e.jsx(q,{to:"/data/models/edit/$key",params:{key:D.keyFromId(t.id)}}),children:t.name},t.id))})})]})]})}const{useProjectDefinition:H}=await n("@baseplate-dev/project-builder-lib/web"),{NavigationTabs:J,NavigationTabsItem:f,SidebarLayout:K,SidebarLayoutContent:U,SidebarLayoutSidebar:X}=await n("@baseplate-dev/ui-components"),{Link:v,Outlet:Y,useRouterState:N}=await n("@tanstack/react-router");function ie(){const{definition:{models:i,enums:o=[]}}=H(),a=k([...i,...o],s=>s.name.length)?.name,r=N({select:s=>s.location.pathname.startsWith("/data/models")}),l=N({select:s=>s.location.pathname.startsWith("/data/enums")});return e.jsxs(K,{className:"flex-1",children:[e.jsxs(X,{className:"flex h-[calc(100vh-var(--topbar-height)-1px)] max-w-sm min-w-[230px] flex-col space-y-4",width:"auto",noPadding:!0,children:[e.jsx("div",{className:"invisible block h-1 overflow-hidden font-semibold text-transparent",children:a}),e.jsx("div",{className:"px-4",children:e.jsxs(J,{className:"w-full",children:[e.jsx(f,{render:e.jsx(v,{to:"/data/models"}),children:"Models"}),e.jsx(f,{render:e.jsx(v,{to:"/data/enums"}),children:"Enums"})]})}),r?e.jsx(G,{}):null,l?e.jsx(B,{}):null]}),e.jsx(U,{className:"h-[calc(100vh-var(--topbar-height)-1px)]",children:e.jsx(w,{children:e.jsx(Y,{})})})]})}export{ie as component};
//# sourceMappingURL=route-Dod6I_qA.js.map
