"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),y=require("../_util/props-util/index.js"),P=require("../_util/vue-types/index.js"),A=require("../_util/warning.js"),j=require("../config-provider/hooks/useConfigInject.js");require("../menu/index.js");const B=require("./BreadcrumbItem.js"),S=require("./style/index.js"),x=require("../menu/src/Menu.js"),C=()=>({prefixCls:String,routes:{type:Array},params:P.default.any,separator:P.default.any,itemRender:{type:Function}});function E(r,n){if(!r.breadcrumbName)return null;const l=Object.keys(n).join("|");return r.breadcrumbName.replace(new RegExp(`:(${l})`,"g"),(m,f)=>n[f]||m)}function v(r){const{route:n,params:l,routes:i,paths:m}=r,f=i.indexOf(n)===i.length-1,h=E(n,l);return f?u.createVNode("span",null,[h]):u.createVNode("a",{href:`#/${m.join("/")}`},[h])}const M=u.defineComponent({compatConfig:{MODE:3},name:"ABreadcrumb",inheritAttrs:!1,props:C(),slots:Object,setup(r,{slots:n,attrs:l}){const{prefixCls:i,direction:m}=j.default("breadcrumb",r),[f,h]=S.default(i),N=(e,t)=>(e=(e||"").replace(/^\//,""),Object.keys(t).forEach(a=>{e=e.replace(`:${a}`,t[a])}),e),_=(e,t,a)=>{const c=[...e],s=N(t||"",a);return s&&c.push(s),c},q=({routes:e=[],params:t={},separator:a,itemRender:c=v})=>{const s=[];return e.map(o=>{const p=N(o.path,t);p&&s.push(p);const d=[...s];let b=null;o.children&&o.children.length&&(b=u.createVNode(x.default,{items:o.children.map(g=>({key:g.path||g.breadcrumbName,label:c({route:g,params:t,routes:e,paths:_(d,g.path,t)})}))},null));const R={separator:a};return b&&(R.overlay=b),u.createVNode(B.default,{...R,key:p||o.breadcrumbName},{default:()=>[c({route:o,params:t,routes:e,paths:d})]})})};return()=>{let e;const{routes:t,params:a={}}=r,c=y.flattenChildren(y.getPropsSlot(n,r)),s=y.getPropsSlot(n,r,"separator")??"/",o=r.itemRender||n.itemRender||v;t&&t.length>0?e=q({routes:t,params:a,separator:s,itemRender:o}):c.length&&(e=c.map((d,b)=>(A.default(typeof d.type=="object"&&(d.type.__ANT_BREADCRUMB_ITEM||d.type.__ANT_BREADCRUMB_SEPARATOR)),u.cloneVNode(d,{separator:s,key:b}))));const p={[i.value]:!0,[`${i.value}-rtl`]:m.value==="rtl",[`${l.class}`]:!!l.class,[h.value]:!0};return f(u.createVNode("nav",{...l,class:p},[u.createVNode("ol",null,[e])]))}}});exports.breadcrumbProps=C;exports.default=M;
