import{c as e,s as t,z as n}from"./useRouterState-DkU0JPAO.js";import{Vt as r,a as i,r as a}from"./button-cdxnqcgzwko8ooha-DW4HgSd6.js";import{t as o}from"./Copy.es-Bz99FhyZ.js";import{t as s}from"./skeleton-line-epxenksfesr2fkcv-coLjV5E9.js";import{Nt as c}from"./index-CkemaNd1.js";var l=e(),u=n(t(),1),d={size:{sm:{classes:`text-sm h-10 gap-0.5`,description:`Compact breadcrumbs for dense UIs`},base:{classes:`text-base h-12 gap-1`,description:`Default breadcrumbs size`}}},f={size:`base`};function p({size:e=f.size}={}){return r(`group mr-4 flex min-w-0 grow items-center overflow-hidden whitespace-nowrap`,d.size[e].classes)}var m=({href:e,icon:t,children:n})=>(0,l.jsxs)(i(),{to:e,className:`flex min-w-0 max-w-full items-center gap-1 text-kumo-subtle no-underline`,children:[!!t&&(0,l.jsx)(`span`,{className:`flex shrink-0 items-center`,children:t}),(0,l.jsx)(`span`,{className:`truncate`,children:n})]});function h({children:e,icon:t,loading:n}){return n?(0,l.jsxs)(`div`,{className:`flex w-[125px] min-w-0 items-center gap-1`,children:[t&&(0,l.jsx)(`span`,{className:`flex shrink-0 items-center`,children:t}),(0,l.jsx)(s,{})]}):(0,l.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-1 font-medium`,"aria-current":`page`,children:[t&&(0,l.jsx)(`span`,{className:`flex shrink-0 items-center`,children:t}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}function g(){return(0,l.jsx)(`span`,{className:`flex shrink-0 items-center text-kumo-inactive`,"aria-hidden":`true`,children:(0,l.jsx)(`svg`,{width:`24`,height:`24`,fill:`none`,viewBox:`0 0 24 24`,children:(0,l.jsx)(`path`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,d:`M10.75 8.75L14.25 12L10.75 15.25`})})})}function _(){return(0,l.jsx)(`span`,{className:`flex shrink-0 items-center text-kumo-subtle`,"aria-hidden":!0,children:`...`})}function v({text:e}){let[t,n]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),2e3);return()=>clearTimeout(e)},[t]),(0,l.jsx)(a,{variant:`ghost`,shape:`square`,size:`sm`,className:`opacity-0 transition-[opacity] group-hover:opacity-100`,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),n(!0)}catch(e){console.error(`Failed to copy deeplink:`,e)}},title:`Click to copy`,"aria-label":`Copy`,children:t?(0,l.jsx)(c,{weight:`bold`,className:`text-kumo-success`}):(0,l.jsx)(o,{weight:`regular`})})}function y({children:e,size:t=`base`,className:n}){let i=u.Children.toArray(e),a=x(i);return(0,l.jsxs)(`nav`,{className:r(p({size:t}),n),"aria-label":`breadcrumb`,children:[(0,l.jsx)(`div`,{className:`contents sm:hidden`,children:a}),(0,l.jsx)(`div`,{className:`hidden sm:contents`,children:i})]})}function b(e,t){return(0,u.isValidElement)(e)&&e.type===t}function x(e){let t=e.filter(e=>b(e,m)||b(e,h));if(t.length<=2)return e;let[n,r]=t.slice(-2),i=[(0,l.jsx)(_,{},`kumo-breadcrumb-mobile-ellipsis`),(0,l.jsx)(g,{},`kumo-breadcrumb-mobile-separator-leading`),(0,u.cloneElement)(n,{key:`kumo-breadcrumb-mobile-parent`}),(0,l.jsx)(g,{},`kumo-breadcrumb-mobile-separator-trailing`),(0,u.cloneElement)(r,{key:`kumo-breadcrumb-mobile-current`})],a=e.filter(e=>!b(e,m)&&!b(e,h)&&!b(e,g));return[...i,...a]}y.Link=m,y.Current=h,y.Separator=g,y.Clipboard=v;function S({children:e,icon:t,items:n,title:r}){return(0,l.jsxs)(`div`,{className:`box-border flex min-h-14.5 shrink-0 items-center gap-2 border-b border-kumo-fill bg-kumo-elevated px-6 text-sm`,children:[(0,l.jsxs)(y,{children:[(0,l.jsx)(y.Current,{icon:(0,l.jsx)(t,{className:`h-4 w-4`}),children:r}),n.map((e,t)=>(0,l.jsxs)(u.Fragment,{children:[(0,l.jsx)(y.Separator,{}),e]},t))]}),e]})}export{y as n,S as t};