import{_ as R,s as M,b,n as w,W as A,V as N,c as U,d as V,f as _,K as W,h as H}from"./OdysseyThemeProvider-Bh0Bu-2o.js";import{r as a}from"./index-NdkWRN8K.js";import{c as z}from"./Typography-Cz6D417Y.js";import{j as r}from"./jsx-runtime-CnH95YSl.js";import{M as O}from"./Group-mTVRC79V.js";import{M as D}from"./User-CyxEAfVT.js";import{M as F}from"./MenuItem-vhp8G-Nb.js";import{B as j}from"./ButtonBase-BNqa2TMD.js";import{c as q}from"./createSvgIcon-ClUWwDzL.js";import{u as G}from"./getReactElementRef-DsIevm5t.js";import{T as K}from"./Typography-ClQ35Rr-.js";import{M as J}from"./Home-la7Lmt_L.js";import{M as Q}from"./Menu-K9lpVvDG.js";const X=q(r.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz"),Y=["slots","slotProps"],Z=M(j,{name:"MuiBreadcrumbCollapsed"})(({theme:e})=>b({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`},e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},{borderRadius:2,"&:hover, &:focus":b({},e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}),"&:active":b({boxShadow:e.shadows[0]},e.palette.mode==="light"?{backgroundColor:w.emphasize(e.palette.grey[200],.12)}:{backgroundColor:w.emphasize(e.palette.grey[600],.12)})})),ee=M(X)({width:24,height:16});function re(e){const{slots:s={},slotProps:c={}}=e,n=R(e,Y),t=e;return r.jsx("li",{children:r.jsx(Z,b({focusRipple:!0},n,{ownerState:t,children:r.jsx(ee,b({as:s.CollapsedIcon,ownerState:t},c.collapsedIcon))}))})}function se(e){return N("MuiBreadcrumbs",e)}const oe=A("MuiBreadcrumbs",["root","ol","li","separator"]),te=["children","className","component","slots","slotProps","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],ae=e=>{const{classes:s}=e;return _({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},se,s)},ne=M(K,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,s)=>[{[`& .${oe.li}`]:s.li},s.root]})({}),le=M("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:(e,s)=>s.ol})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),ce=M("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:(e,s)=>s.separator})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ie(e,s,c,n){return e.reduce((t,u,l)=>(l<e.length-1?t=t.concat(u,r.jsx(ce,{"aria-hidden":!0,className:s,ownerState:n,children:c},`separator-${l}`)):t.push(u),t),[])}const ue=a.forwardRef(function(s,c){const n=U({props:s,name:"MuiBreadcrumbs"}),{children:t,className:u,component:l="nav",slots:m={},slotProps:x={},expandText:p="Show path",itemsAfterCollapse:f=1,itemsBeforeCollapse:g=1,maxItems:o=8,separator:i="/"}=n,T=R(n,te),[v,E]=a.useState(!1),h=b({},n,{component:l,expanded:v,expandText:p,itemsAfterCollapse:f,itemsBeforeCollapse:g,maxItems:o,separator:i}),B=ae(h),L=G({elementType:m.CollapsedIcon,externalSlotProps:x.collapsedIcon,ownerState:h}),S=a.useRef(null),$=d=>{const P=()=>{E(!0);const k=S.current.querySelector("a[href],button,[tabindex]");k&&k.focus()};return g+f>=d.length?d:[...d.slice(0,g),r.jsx(re,{"aria-label":p,slots:{CollapsedIcon:m.CollapsedIcon},slotProps:{collapsedIcon:L},onClick:P},"ellipsis"),...d.slice(d.length-f,d.length)]},I=a.Children.toArray(t).filter(d=>a.isValidElement(d)).map((d,P)=>r.jsx("li",{className:B.li,children:d},`child-${P}`));return r.jsx(ne,b({ref:c,component:l,color:"text.secondary",className:V(B.root,u),ownerState:h},T,{children:r.jsx(le,{className:B.ol,ref:S,ownerState:h,children:ie(v||o&&I.length<=o?I:$(I),B.separator,i,h)})}))}),C=a.createContext({breadcrumbType:"listItem"}),de=H.span`
  white-space: nowrap;
  overflow: hidden;
  max-width: 10rem;
  text-overflow: ellipsis;
`,ke=({children:e,href:s,iconName:c,onClick:n})=>{const{breadcrumbType:t}=a.useContext(C),u=a.useCallback(m=>{n&&(m.preventDefault(),m.stopPropagation(),n(m))},[n]),l=r.jsxs(r.Fragment,{children:[c==="group"?r.jsx(O,{}):c==="user"?r.jsx(D,{}):null,r.jsx(de,{children:e})]});return s?t==="menuItem"?r.jsx(F,{component:"a",href:s,onClick:u,children:l}):t==="currentPage"?r.jsx(z,{ariaCurrent:"page",color:"textPrimary",children:l}):r.jsx(j,{href:s,onClick:u,children:l}):r.jsx(z,{color:"textPrimary",children:l})},y={currentPage:{breadcrumbType:"currentPage"},listItem:{breadcrumbType:"listItem"},menuItem:{breadcrumbType:"menuItem"}},me=5,pe=({children:e,homeHref:s,maxVisibleItems:c=me,testId:n,translate:t})=>{const{t:u}=W(),[l,m]=a.useState(null),x=a.useMemo(()=>Math.min(Math.max(c,0),e.length),[c,e]),p=a.useMemo(()=>{if(e.length<=x)return{beforeMenu:[],insideMenu:[],remainingBreadcrumbs:e};{const o=Math.floor(x/2),i=e.length-x;return{beforeMenu:e.slice(0,o),insideMenu:e.slice(o,o+i),remainingBreadcrumbs:e.slice(o+i)}}},[e,x]),f=a.useCallback(o=>m(o.currentTarget),[]),g=a.useCallback(()=>{m(null)},[]);return r.jsxs(ue,{"aria-label":u("breadcrumbs.label.text"),"data-se":n,maxItems:e.length+1,translate:t,children:[s&&r.jsx(j,{"aria-label":u("breadcrumbs.home.text"),href:s,children:r.jsx(J,{})}),p.beforeMenu.map((o,i)=>r.jsx(C.Provider,{value:y.listItem,children:o},i)),p.insideMenu.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(j,{onClick:f,children:"..."}),r.jsx(Q,{anchorEl:l,anchorOrigin:{horizontal:"left",vertical:"bottom"},MenuListProps:{sx:{minWidth:180}},onClose:g,open:!!l,children:r.jsx(C.Provider,{value:y.menuItem,children:p.insideMenu})})]}),p.remainingBreadcrumbs.map((o,i)=>i===p.remainingBreadcrumbs.length-1?r.jsx(C.Provider,{value:y.currentPage,children:o},i):r.jsx(C.Provider,{value:y.listItem,children:o},i))]})},be=a.memo(pe);be.displayName="BreadcrumbList";export{ke as B,be as M,ue as a};
