var x=(o,m,a)=>new Promise((r,s)=>{var t=l=>{try{c(a.next(l))}catch(d){s(d)}},i=l=>{try{c(a.throw(l))}catch(d){s(d)}},c=l=>l.done?r(l.value):Promise.resolve(l.value).then(t,i);c((a=a.apply(o,m)).next())});import{r as p,aT as j,j as e,cO as u,d8 as N,cB as w,bh as f}from"./react-vendor-xYZnmIII.js";import{B as n,a as v}from"./ui-components-CQM92IK3.js";import h from"./resource-form-D8VXwbvl.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";import"./chunked-uploader-input-dQEAsxxf.js";import"./input-error-_LAmvivg.js";import"./loading-button-D7aXR3K4.js";import"./file-metadata-CAFSN-Sn.js";import"./inertia-FIn3q7f1.js";const A=()=>{const[o,m]=p.useState(""),{exam:a}=j().props,r=(s,t)=>x(null,null,function*(){t.preventDefault();try{const i=route("exam-resources.download",s.id);window.open(i,"_blank")}catch(i){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(h,{title:"Add new exam resource",handler:e.jsxs(n,{children:[e.jsx(u,{className:"h-4 w-4"}),"Add Resource"]})})})]}),e.jsx(v,{className:"space-y-4 p-5 shadow-none",children:a.resources.length>0?a.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:t=>r(s,t),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(h,{title:"Update new exam resource",resource:s,handler:e.jsx(n,{size:"icon",variant:"secondary",className:"h-7 w-7",children:e.jsx(N,{className:"h-3 w-3"})})}),s.type!=="link"?e.jsx(n,{asChild:!0,size:"icon",variant:"secondary",className:"h-7 w-7",children:e.jsx("a",{target:"_blank",href:s.resource,children:e.jsx(w,{className:"h-3 w-3"})})}):e.jsx(n,{size:"icon",variant:"secondary",className:"h-7 w-7",onClick:t=>r(s,t),children:e.jsx(f,{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{A as default};
