import{j as t}from"./jsx-runtime.D_zvdyIk.js";import{u as m}from"./useTranslation.Dg7DwAC5.js";import{I as p}from"./iconify.pctX9hd_.js";import{r as l}from"./index.BIRwh3HZ.js";import{e as d}from"./route.D5BPSNZk.js";import{l as x}from"./utils.D6Ui05B2.js";import"./index.RTTH55m1.js";import"./index.3whys8t3.js";import"./_commonjsHelpers.CqkleIqs.js";import"./router.B9yJslVs.js";import"./site.Deo0TYgJ.js";import"./site-config.CgQ_bxrG.js";const c=e=>e.toLowerCase(),u=e=>d(c(e).replace(/\//g,"-")),h=e=>`/tags/${u(e)}`,f=["from-blue-400/10 to-indigo-300/10 hover:from-blue-400/80 hover:to-indigo-300/80 text-blue-400/70 hover:text-blue-50","from-pink-300/10 to-rose-200/10 hover:from-pink-300/80 hover:to-rose-200/80 text-pink-400/70 hover:text-pink-50","from-violet-400/10 to-purple-300/10 hover:from-violet-400/80 hover:to-purple-300/80 text-violet-400/70 hover:text-violet-50","from-sky-400/10 to-blue-300/10 hover:from-sky-400/80 hover:to-blue-300/80 text-sky-400/70 hover:text-sky-50"];function g({tag:e,count:r,colorIndex:o,locale:a}){const{t:s}=m();return t.jsxs("a",{href:x(h(e),a),"aria-label":s("tag.viewTagPosts",{tag:e,count:r}),className:`relative flex items-center rounded-lg bg-linear-to-r px-3 py-1.5 text-sm transition-all duration-300 hover:-translate-y-0.5 hover:shadow-lg ${f[o]}`,children:[t.jsx("span",{className:"font-medium",children:e}),t.jsx("span",{className:"ml-1.5 truncate rounded-full bg-white/10 px-1.5 text-xs",children:r})]})}function P({tags:e,locale:r}){const[o,a]=l.useState(!1),s=l.useId(),{t:n}=m();return e.length===0?null:t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button","aria-expanded":o,"aria-controls":s,onClick:()=>a(!o),className:"mx-4 mt-4 flex cursor-pointer items-center gap-1 text-muted-foreground text-sm transition-colors hover:text-blue md:mx-0",children:[t.jsx("span",{children:n(o?"common.collapse":"tag.expandAll")}),t.jsx("span",{className:"rounded-full bg-white/10 px-1.5 text-xs",children:e.length}),t.jsx(p,{icon:"ri:arrow-down-s-line",className:`h-4 w-4 transition-transform ${o?"rotate-180":""}`})]}),t.jsx("div",{id:s,className:"grid transition-[grid-template-rows] duration-300 ease-out",style:{gridTemplateRows:o?"1fr":"0fr"},children:t.jsx("div",{className:"flex flex-wrap gap-3 overflow-hidden px-4 pt-3 md:px-0",style:{minHeight:0},children:e.map(i=>t.jsx(g,{...i,locale:r},i.tag))})})]})}export{P as CollapsibleTags};
