import{j as t}from"./jsx-runtime.D_zvdyIk.js";import{u as R}from"./useControlledState.CrC8i7sw.js";import{c as a}from"./utils.BZbvJs_N.js";import{R as u}from"./index.BIRwh3HZ.js";import{u as j}from"./use-reduced-motion.IwM_xNQk.js";import{m}from"./proxy.D9st1TsE.js";import{A as N}from"./index.BbbUxuaI.js";import{a as c,h as k}from"./app.Bk0M9xuT.js";import{u as I}from"./useTranslation.Dg7DwAC5.js";import{e as C,f as E,g as O}from"./index.DdUPy29j.js";import"./_commonjsHelpers.CqkleIqs.js";import"./index.3whys8t3.js";import"./index.RTTH55m1.js";import"./utils.D6Ui05B2.js";import"./site-config.CgQ_bxrG.js";import"./site.Deo0TYgJ.js";const x=({options:s,defaultValue:r,onChange:o,className:n,id:l,indicateClass:b,itemClass:v,value:y})=>{const[S,w]=R({value:y,defaultValue:r??s[0]?.value??"",onChange:o}),e=j();return t.jsx("div",{className:a("flex w-fit cursor-pointer select-none rounded-sm bg-muted p-1 font-semibold text-xs backdrop-blur-lg",n),children:s.map(p=>{if(!p)return null;const{label:f,value:d,icon:g}=p,i=S===d;return t.jsxs(m.div,{className:a("relative flex-center cursor-pointer gap-1.5 px-3 py-1 first:rounded-l-xs last:rounded-r-xs",{"text-primary-foreground":i},{"opacity-50":!i},v),onClick:()=>w(d),layout:!e,transition:e?{duration:0}:{type:"spring",stiffness:400,damping:30},children:[g&&t.jsx("span",{className:"flex-center shrink-0",children:u.createElement(g,{className:"w-4 h-4"})}),t.jsx(N,{initial:!1,mode:"wait",children:i&&f&&t.jsx(m.span,{initial:e?void 0:{width:0,opacity:0},animate:{width:"auto",opacity:1},exit:e?void 0:{width:0,opacity:0},transition:e?{duration:0}:{width:{duration:.2,ease:"easeInOut"},opacity:{duration:.15,ease:"easeInOut"}},className:"overflow-hidden whitespace-nowrap",children:f})}),i&&t.jsx(m.div,{layoutId:`segmented_selected_bg_${l??"default"}`,className:a("absolute inset-0 -z-10 rounded-sm bg-gradient-shoka-button",b),transition:e?{duration:0}:{type:"spring",stiffness:400,damping:30},style:{willChange:e?"auto":"transform"}})]},d)})})};u.memo(x);const h=({className:s,...r})=>{const{t:o}=I(),n=[{label:o("sider.overview"),value:c.INFO,icon:C},{label:o("sider.toc"),value:c.DIRECTORY,icon:E},{label:o("sider.series"),value:c.SERIES,icon:O}];return t.jsx(x,{...r,options:n,className:a("flex w-fit cursor-pointer select-none rounded-sm bg-black/8 p-1 font-semibold text-xs backdrop-blur-lg",s),onChange:l=>k.set(l)})};h.displayName="HomeSiderSegmented";const J=u.memo(h);export{J as default};
