import{r as c,u as d,j as e,bm as o,c1 as m,b8 as x,v as p}from"./vendor-BKmmeuxg.js";import{B as t}from"./button-BpNwv2aE.js";import{C as h}from"./card-D9_SJYq6.js";import n from"./resource-form-DMd6KRIv.js";import"./index-WW_1X1qx.js";import"./utils-DxSsnXxD.js";import"./chunked-uploader-input-D0XPVOTS.js";import"./input-DM0goJrn.js";import"./index-D9-QKOod.js";import"./input-error-LaPr_4wd.js";import"./loading-button-BnTVAMJ7.js";import"./dialog-B2gN9MvT.js";import"./label-HmIcv5Yx.js";import"./scroll-area-C8HGru-R.js";import"./select-CD9o3HN1.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};
