import{A as r,B as j,p as v,i as m,v as C,j as e,w as d,C as N}from"./index-D_dwqv5X.js";import{A as p}from"./AdsBanner-BgPJ8Ox4.js";import{C as P}from"./CollectionTabs-DE6HUYiP.js";import{C as y}from"./comicTile-D3iy2tgG.js";import{E as B}from"./EmptyState-C_1iVQ2H.js";import{H as R}from"./HilltopAd-BAeNxKis.js";import{P as b}from"./PageHeading-DYJiS6hm.js";import{P as A}from"./pagination-CZeWne2U.js";import"./runtime-omRR9KF1.js";function D(){const u=r.useParams(),i=r.useSearch(),{ads:o,books:c,total:l}=r.useLoaderData(),n=j(u.tag),h=v(m(i.page)),a=C(m(i.continued)),g=Math.ceil(l/N),x=`/tags/${encodeURIComponent(n)}`,t=s=>d(x,{continued:s}),f=[{name:"連載中",href:t(!0),current:a===!0},{name:"已完結",href:t(!1),current:a===!1},{name:"全部",href:t(),current:a===void 0}];return e.jsxs("div",{className:"site-collection px-1",children:[e.jsx(b,{title:n,eyebrow:"BROWSE BY TAG",children:e.jsxs("span",{className:"site-chip",children:[l," 部作品"]})}),e.jsx(P,{tabs:f}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 my-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx(p,{bundle:o,name:"homeBannerA",eager:!0})}),e.jsx("div",{className:"flex justify-center",children:e.jsx(p,{bundle:o,name:"homeBannerB",eager:!0})})]}),c.length===0?e.jsx(B,{title:"這個分類還沒有作品",description:"試試其他狀態，或回到全部漫畫。",href:t(),label:"查看全部"}):e.jsx("div",{className:"site-comic-grid",children:c.map(s=>e.jsx(y,{book:s,lastChapter:s.activeResource?.chapters?.at(-1)??null,lastRead:null},s.id))}),e.jsx("div",{className:"flex justify-center my-6",children:e.jsx(R,{zone:"hilltop"})}),e.jsx("div",{className:"my-8",children:e.jsx(A,{path:d(`tags/${encodeURIComponent(n)}`,{continued:a}),current:h,total:g})})]})}export{D as component};
