var h=(d,p,r)=>new Promise((o,t)=>{var i=s=>{try{n(r.next(s))}catch(c){t(c)}},l=s=>{try{n(r.throw(s))}catch(c){t(c)}},n=s=>s.done?o(s.value):Promise.resolve(s.value).then(i,l);n((r=r.apply(d,p)).next())});import{jsxs as a,jsx as e}from"react/jsx-runtime";import{B as m,a as x}from"./ui-components-B24mpb8o.js";import{usePage as N}from"@inertiajs/react";import{Plus as w,Pencil as f,Eye as v,Download as y}from"lucide-react";import{useState as b}from"react";import u from"./resource-form-BXd6v0p6.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"./chunked-uploader-input-WemAY1Qi.js";import"axios";import"./input-error-BbsDx4-P.js";import"./loading-button-B_LaGOAp.js";import"./file-metadata-CAFSN-Sn.js";import"./inertia-FIn3q7f1.js";const me=()=>{const[d,p]=b(""),{exam:r}=N().props,o=(t,i)=>h(null,null,function*(){i.preventDefault();try{const l=route("exam-resources.download",t.id);window.open(l,"_blank")}catch(l){window.open(t.resource,"_blank")}});return a("div",{className:"space-y-4 py-3",children:[a("div",{className:"flex items-center justify-between",children:[a("div",{children:[e("h3",{className:"text-lg font-semibold",children:"Exam Resources"}),e("p",{className:"text-sm text-gray-600",children:"Exam Resources List"})]}),e("div",{className:"flex items-center gap-2",children:e(u,{title:"Add new exam resource",handler:a(m,{children:[e(w,{className:"h-4 w-4"}),"Add Resource"]})})})]}),e(x,{className:"space-y-4 p-5 shadow-none",children:r.resources.length>0?r.resources.map(t=>e("div",{className:"border-border rounded-md border p-2",children:a("div",{className:"flex items-center justify-between gap-2",children:[e("div",{className:"w-full px-1",children:t.type==="link"?e("a",{target:"_blank",href:t.resource,className:"cursor-pointer text-sm hover:underline",children:t.title.slice(0,50)+(t.title.length>50?"...":"")}):e("span",{className:"cursor-pointer text-sm hover:underline",onClick:i=>o(t,i),children:t.title.slice(0,50)+(t.title.length>50?"...":"")})}),a("div",{className:"flex items-center justify-end space-x-2",children:[e(u,{title:"Update new exam resource",resource:t,handler:e(m,{size:"icon",variant:"secondary",className:"h-7 w-7",children:e(f,{className:"h-3 w-3"})})}),t.type!=="link"?e(m,{asChild:!0,size:"icon",variant:"secondary",className:"h-7 w-7",children:e("a",{target:"_blank",href:t.resource,children:e(v,{className:"h-3 w-3"})})}):e(m,{size:"icon",variant:"secondary",className:"h-7 w-7",onClick:i=>o(t,i),children:e(y,{className:"h-3 w-3"})})]})]},t.id)})):e("div",{className:"rounded-md p-1.5",children:e("div",{className:"w-full px-1 py-6 text-center",children:e("p",{className:"text-sm",children:"No resources available"})})})})]})};export{me as default};
