import{jsxs as l,jsx as e}from"react/jsx-runtime";import{a as x,k as v,m as S,H as j,J as A,B as g,K as D,e as H,l as I,a4 as y,x as B,y as a,z as m,aD as d,aH as p,aF as o,aI as i,aE as h,aG as s}from"./ui-components-B24mpb8o.js";import{Trash2 as E}from"lucide-react";import{useState as z}from"react";import V from"./index-DTOqaW7s.js";import $ from"./api-copy-DM3xOhFq.js";import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";import"./table-header-DXTJ1r7-.js";import"@tanstack/react-table";import"./blogs-table-columns-R2OpmtLM.js";import"@inertiajs/react";import"./categories-table-columns-CnxipLFz.js";import"./courses-table-columns-BQ4ep6nS.js";import"./instructors-table-columns-NXoZHDYh.js";import"./table-filter-h0ofTU44.js";import"./table-page-size-B94DPeOD.js";import"./route-D0xh7FtZ.js";import"./debounce-CWHP_ANh.js";import"./table-footer-D5myFeWO.js";const De=({data:t,removing:C,courses:N,onRemove:f,onInsert:T})=>{var u;const[n,w]=z("best"),c=(r,b)=>l(o,{children:[e(s,{children:e("img",{src:r.thumbnail||"/placeholder.jpg",alt:r.title,className:"h-12 w-20 rounded object-cover"})}),e(s,{className:"font-medium",children:r.title}),l(s,{children:[r.enrollments_count||0," enrollments"]}),e(s,{children:e(g,{variant:"ghost",size:"icon",onClick:()=>f("courses",b,r.id),disabled:C===`courses-${b}-${r.id}`,children:e(E,{className:"text-destructive h-4 w-4"})})})]},r.id);return l(x,{className:"relative",children:[l(v,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[l("div",{children:[e(S,{className:"text-xl font-bold",children:"Courses"}),e($,{value:`api/collections/courses/${n}`})]}),l(j,{children:[e(A,{children:l(g,{className:"capitalize",children:["Select ",n," Course"]})}),e(D,{className:"p-0",children:e(H,{className:"max-h-[90vh] p-2",children:e(V,{type:"courses",title:"Courses",data:N,selectedIds:n==="best"?[(u=t.best)==null?void 0:u.id]:n==="top"?t.top.map(r=>r.id):t.new.map(r=>r.id),onCourseSelect:r=>T("courses",n,r)})})})]})]}),e(I,{children:l(y,{defaultValue:"best",className:"w-full",value:n,onValueChange:w,children:[l(B,{className:"grid w-full grid-cols-3",children:[e(a,{value:"best",className:"cursor-pointer",children:"Best Course"}),e(a,{value:"top",className:"cursor-pointer",children:"Top Courses"}),e(a,{value:"new",className:"cursor-pointer",children:"New Courses"})]}),e(m,{value:"best",children:l(d,{children:[e(p,{children:l(o,{children:[e(i,{children:"Image"}),e(i,{children:"Title"}),e(i,{children:"Enrollments"}),e(i,{children:"Action"})]})}),e(h,{children:t.best?c(t.best,"best"):e(o,{children:e(s,{colSpan:5,className:"text-muted-foreground text-center",children:"No best course selected"})})})]})}),e(m,{value:"top",children:l(d,{children:[e(p,{children:l(o,{children:[e(i,{children:"Image"}),e(i,{children:"Title"}),e(i,{children:"Enrollments"}),e(i,{children:"Action"})]})}),e(h,{children:t.top&&t.top.length>0?t.top.map(r=>c(r,"top")):e(o,{children:e(s,{colSpan:5,className:"text-muted-foreground text-center",children:"No top courses selected"})})})]})}),e(m,{value:"new",children:l(d,{children:[e(p,{children:l(o,{children:[e(i,{children:"Image"}),e(i,{children:"Title"}),e(i,{children:"Enrollments"}),e(i,{children:"Action"})]})}),e(h,{children:t.new&&t.new.length>0?t.new.map(r=>c(r,"new")):e(o,{children:e(s,{colSpan:5,className:"text-muted-foreground text-center",children:"No new courses selected"})})})]})})]})})]})};export{De as default};
