1import{E as x,G as h,t as n,s as p,r as m,j as e,B as c,H as u,J as g,L as o}from"./index-DdnE4bk1.js";import{B as d,E as f}from"./icons-D6r0l9s8.js";import{u as j}from"./useSeriesThumbnail-B6aPVBMt.js";import{D as w,a as b,b as v,c as N}from"./dropdown-menu-CbBiW10c.js";import{D,b as S,c as y,d as C}from"./dialog-SkW4YuQN.js";import"./index-B_qAh-FV.js";import"./Combination-DNeAQX7b.js";import"./index-BsPNCj4-.js";const k="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='512'%20height='512'%20x='0'%20y='0'%20viewBox='0%200%20512%20512'%20style='enable-background:new%200%200%20512%20512'%20xml:space='preserve'%20class=''%3e%3cg%3e%3cpath%20d='M368%20512H101.332c-32.363%200-58.664-26.305-58.664-58.668V176c0-8.832%207.168-16%2016-16s16%207.168%2016%2016v277.332c0%2014.7%2011.965%2026.668%2026.664%2026.668H368c14.7%200%2026.668-11.969%2026.668-26.668V176c0-8.832%207.168-16%2016-16s16%207.168%2016%2016v277.332C426.668%20485.695%20400.363%20512%20368%20512zm0%200'%20fill='%23dc2626'%20opacity='1'%20data-original='%23000000'%20class=''%3e%3c/path%3e%3cpath%20d='M453.332%20192H16c-8.832%200-16-7.168-16-16v-53.332C0%2090.305%2026.305%2064%2058.668%2064h352c32.363%200%2058.664%2026.305%2058.664%2058.668V176c0%208.832-7.168%2016-16%2016zM32%20160h405.332v-37.332c0-14.7-11.965-26.668-26.664-26.668h-352C43.968%2096%2032%20107.969%2032%20122.668zm0%200'%20fill='%23dc2626'%20opacity='1'%20data-original='%23000000'%20class=''%3e%3c/path%3e%3cpath%20d='M325.332%2096c-8.832%200-16-7.168-16-16V37.332A5.334%205.334%200%200%200%20304%2032H165.332A5.336%205.336%200%200%200%20160%2037.332V80c0%208.832-7.168%2016-16%2016s-16-7.168-16-16V37.332C128%2016.746%20144.746%200%20165.332%200H304c20.586%200%2037.332%2016.746%2037.332%2037.332V80c0%208.832-7.168%2016-16%2016zM234.668%20426.668c-8.832%200-16-7.168-16-16V272c0-8.832%207.168-16%2016-16s16%207.168%2016%2016v138.668c0%208.832-7.168%2016-16%2016zM144%20426.668c-8.832%200-16-7.168-16-16V272c0-8.832%207.168-16%2016-16s16%207.168%2016%2016v138.668c0%208.832-7.168%2016-16%2016zM325.332%20426.668c-8.832%200-16-7.168-16-16V272c0-8.832%207.168-16%2016-16s16%207.168%2016%2016v138.668c0%208.832-7.168%2016-16%2016zm0%200'%20fill='%23dc2626'%20opacity='1'%20data-original='%23000000'%20class=''%3e%3c/path%3e%3c/g%3e%3c/svg%3e",M=s=>{const t=x(),i=h({mutationFn:async()=>{if(s)return await p.from("series").delete().eq("id",s.id).select().single().throwOnError().then(l=>l.data)},onSuccess:()=>{n.info("Series Deleted",{description:`'${s==null?void 0:s.title}' has been deleted along with all its comics.`}),t.invalidateQueries({queryKey:["series"]})},onError:l=>{n.error("Failed to Delete Series",{description:l.message})}});return{deleteSeries:m.useCallback(()=>{i.mutate()},[i])}},V=({title:s,description:t,isOpen:i,onClose:a,onDeleteConfirmed:l})=>e.jsx(D,{open:i,onOpenChange:a,children:e.jsxs(S,{className:"max-w-xl border-2 p-8",children:[e.jsx(y,{className:"text-xl",children:s}),e.jsx(C,{className:"text-base",children:t}),e.jsxs("div",{className:"mt-2 flex justify-end gap-4",children:[e.jsx(c,{onClick:r=>{r.stopPropagation(),a()},variant:"outline",children:"Cancel"}),e.jsx(c,{onClick:r=>{r.stopPropagation(),l()},children:"Yes, delete"})]})]})}),z=({series:s,trigger:t})=>{const[i,a]=m.useState(!1),{deleteSeries:l}=M(s);return e.jsxs(e.Fragment,{children:[e.jsxs(w,{children:[e.jsx(b,{asChild:!0,children:t}),e.jsxs(v,{onCloseAutoFocus:r=>r.preventDefault(),align:"end",children:[e.jsxs(N,{onSelect:()=>a(!0),className:"flex justify-between py-2 hover:cursor-pointer",children:[e.jsx("span",{className:"text-sm text-red-600",children:"Delete"}),e.jsx("img",{src:k,alt:"Trash icon",className:"w-[18px]"})]})," "]})]}),e.jsx(V,{title:"Delete Series",description:"Are you sure you want to delete this Series? All comics in this series will also be deleted. This action cannot be undone.",isOpen:i,onClose:()=>a(!1),onDeleteConfirmed:()=>{l(),a(!1)}})]})},E=s=>{var l;const{data:t,isLoading:i}=j(s.series.id),{numComics:a}=g(s.series.id);return e.jsxs("li",{className:"flex gap-3 rounded-lg border border-slate-100 bg-slate-50 p-3 shadow-sm sm:gap-4 sm:p-6",children:[e.jsx(o,{to:`/dashboard/series/${s.series.id}`,className:"w-[80px] flex-shrink-0 sm:w-[90px] xl:w-[100px]",children:e.jsxs("div",{className:"relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-slate-200",children:[!i&&e.jsx("img",{className:"h-full w-full rounded-lg object-cover shadow-sm brightness-100",src:t,alt:`Series '${s.series.title}' Thumbnail`}),e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-t from-black/70 via-black/5 to-transparent"}),e.jsxs("div",{className:"absolute bottom-[4px] left-1/2 flex -translate-x-1/2 items-end gap-[1px]",children:[e.jsx(d,{className:"h-5 w-5 -translate-x-[3px] -translate-y-[3px] fill-slate-100 stroke-none stroke-[1px] opacity-100"}),e.jsx("span",{className:"font-bold text-slate-200",children:"Series"})]})]})}),e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(o,{to:`/dashboard/series/${s.series.id}`,onClick:()=>{window.scrollTo(0,0)},className:"flex flex-col",children:e.jsx("h1",{className:"line-clamp-1 text-xl font-semibold text-slate-600",children:s.series.title})}),e.jsx("div",{className:"flex gap-2",children:e.jsx(z,{series:s.series,trigger:e.jsx("button",{className:"rounded-lg p-2 transition-all hover:bg-slate-100","aria-label":"Show More",children:e.jsx(f,{className:"h-4 w-4 fill-slate-500"})})})})]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-600",children:[e.jsx(d,{className:"h-4 w-4 fill-slate-500"}),a," Chapter",a===1?"":"s"]}),e.jsxs("p",{className:"mt-2",children:[e.jsx("span",{className:"text-sm font-medium text-slate-500",children:"Description:"}),e.jsx("span",{className:"ml-2 text-sm text-slate-500",children:((l=s.series)==null?void 0:l.description)||"N/A"})]})]})]})},q=()=>{const{recentSeries:s}=u();return e.jsx("div",{className:"container mx-auto my-4 px-3 sm:my-10 sm:px-8",children:e.jsx("ul",{className:"mt-6 grid grid-cols-1 gap-4 sm:mt-8 sm:gap-8 xl:grid-cols-2",children:s==null?void 0:s.map(t=>e.jsx(E,{series:t},t.id))})})};export{q as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.