const e=require("../_util/warning.js"),t=require("../_util/props-util/index.js"),n=require("../config-provider/hooks/useConfigInject.js"),r=require("../_util/vue-types/index.js"),i=require("../menu/index.js"),a=require("./BreadcrumbItem.js"),o=require("./style/index.js");let s=require("vue");var c=()=>({prefixCls:String,routes:{type:Array},params:r.default.any,separator:r.default.any,itemRender:{type:Function}});function l(e,t){if(!e.breadcrumbName)return null;let n=Object.keys(t).join(`|`);return e.breadcrumbName.replace(RegExp(`:(${n})`,`g`),(e,n)=>t[n]||e)}function u(e){let{route:t,params:n,routes:r,paths:i}=e,a=r.indexOf(t)===r.length-1,o=l(t,n);return a?(0,s.createVNode)(`span`,null,[o]):(0,s.createVNode)(`a`,{href:`#/${i.join(`/`)}`},[o])}var d=(0,s.defineComponent)({compatConfig:{MODE:3},name:`ABreadcrumb`,inheritAttrs:!1,props:c(),slots:Object,setup(r,{slots:c,attrs:l}){let{prefixCls:d,direction:f}=n.default(`breadcrumb`,r),[p,m]=o.default(d),h=(e,t)=>(e=(e||``).replace(/^\//,``),Object.keys(t).forEach(n=>{e=e.replace(`:${n}`,t[n])}),e),g=(e,t,n)=>{let r=[...e],i=h(t||``,n);return i&&r.push(i),r},_=({routes:e=[],params:t={},separator:n,itemRender:r=u})=>{let o=[];return e.map(c=>{let l=h(c.path,t);l&&o.push(l);let u=[...o],d=null;c.children&&c.children.length&&(d=(0,s.createVNode)(i.default,{items:c.children.map(n=>({key:n.path||n.breadcrumbName,label:r({route:n,params:t,routes:e,paths:g(u,n.path,t)})}))},null));let f={separator:n};return d&&(f.overlay=d),(0,s.createVNode)(a.default,{...f,key:l||c.breadcrumbName},{default:()=>[r({route:c,params:t,routes:e,paths:u})]})})};return()=>{let n,{routes:i,params:a={}}=r,o=t.flattenChildren(t.getPropsSlot(c,r)),h=t.getPropsSlot(c,r,`separator`)??`/`,g=r.itemRender||c.itemRender||u;i&&i.length>0?n=_({routes:i,params:a,separator:h,itemRender:g}):o.length&&(n=o.map((t,n)=>(e.default(typeof t.type==`object`&&(t.type.__ANT_BREADCRUMB_ITEM||t.type.__ANT_BREADCRUMB_SEPARATOR),`Breadcrumb`,`Only accepts Breadcrumb.Item and Breadcrumb.Separator as it's children`),(0,s.cloneVNode)(t,{separator:h,key:n}))));let v={[d.value]:!0,[`${d.value}-rtl`]:f.value===`rtl`,[`${l.class}`]:!!l.class,[m.value]:!0};return p((0,s.createVNode)(`nav`,{...l,class:v},[(0,s.createVNode)(`ol`,null,[n])]))}}});exports.breadcrumbProps=c,exports.default=d;