import{r as c,u as d,j as e,ch as o,cX as m,c3 as x,t as p}from"./vendor-rThclpOQ.js";import{B as t}from"./button-ZcsoqUQn.js";import{C as h}from"./card-HXna_7vU.js";import n from"./resource-form-BxkSLe1Z.js";import"./index-DquVdLUg.js";import"./utils-8KAaAB9H.js";import"./chunked-uploader-input-rUbaF7V3.js";import"./input-BeqyurrI.js";import"./index-CWNIUFqh.js";import"./input-error-Br4ngfdE.js";import"./loading-button-DKhpmf6V.js";import"./dialog-CDEDwQhm.js";import"./label-CtY1vfZY.js";import"./scroll-area-BCwyUKIK.js";import"./select-u0okJC03.js";import"./file-metadata-CAFSN-Sn.js";import"./inertia-SZXqLvQm.js";const I=()=>{const[j,u]=c.useState(""),{exam:r}=d().props,i=async(s,a)=>{a.preventDefault();try{const l=route("exam-resources.download",s.id);window.open(l,"_blank")}catch{window.open(s.resource,"_blank")}};return e.jsxs("div",{className:"space-y-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Exam Resources"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Exam Resources List"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{title:"Add new exam resource",handler:e.jsxs(t,{children:[e.jsx(o,{className:"h-4 w-4"}),"Add Resource"]})})})]}),e.jsx(h,{className:"space-y-4 p-5 shadow-none",children:r.resources.length>0?r.resources.map(s=>e.jsx("div",{className:"border-border rounded-md border p-2",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"w-full px-1",children:s.type==="link"?e.jsx("a",{target:"_blank",href:s.resource,className:"cursor-pointer text-sm hover:underline",children:s.title.slice(0,50)+(s.title.length>50?"...":"")}):e.jsx("span",{className:"cursor-pointer text-sm hover:underline",onClick:a=>i(s,a),children:s.title.slice(0,50)+(s.title.length>50?"...":"")})}),e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(n,{title:"Update new exam resource",resource:s,handler:e.jsx(t,{size:"icon",variant:"secondary",className:"h-7 w-7",children:e.jsx(m,{className:"h-3 w-3"})})}),s.type!=="link"?e.jsx(t,{asChild:!0,size:"icon",variant:"secondary",className:"h-7 w-7",children:e.jsx("a",{target:"_blank",href:s.resource,children:e.jsx(x,{className:"h-3 w-3"})})}):e.jsx(t,{size:"icon",variant:"secondary",className:"h-7 w-7",onClick:a=>i(s,a),children:e.jsx(p,{className:"h-3 w-3"})})]})]},s.id)})):e.jsx("div",{className:"rounded-md p-1.5",children:e.jsx("div",{className:"w-full px-1 py-6 text-center",children:e.jsx("p",{className:"text-sm",children:"No resources available"})})})})]})};export{I as default};
