import{co as h,au as u,S as m,cp as g}from"./Bxv1kRJt.js";const $=t=>t,x=/^(\d+)(\.\d+)*(\.x)?$/,P=t=>{const[e,...s]=t.split(":"),[,a,r]=s[s.length-1]?.match(/(.*)\.([^.]+)$/)||[];a&&(s[s.length-1]=a);const i=(s||[]).join("/");return{_source:e,_path:i,_extension:r,_file:r?`${i}.${r}`:i,_basename:a||""}},T=$({name:"path-meta",extensions:[".*"],transform(t,e={}){const{locales:s=[],defaultLocale:a="en",respectPathCase:r=!1}=e,{_source:i,_file:p,_path:n,_extension:f,_basename:_}=P(t._id),l=n.split("/"),d=s.includes(l[0])?l.shift():a,o=E(l.join("/"),{respectPathCase:r});return{_path:o,_dir:o.split("/").slice(-2)[0],_draft:t._draft||t.draft||b(n),_partial:j(n),_locale:d,...t,title:t.title||S(c(_)),_source:i,_file:p,_stem:n,_extension:f}}}),b=t=>!!t.match(/\.draft(\/|\.|$)/),j=t=>t.split(/[:/]/).some(e=>e.match(/^_.*/)),E=(t,{forceLeadingSlash:e=!0,respectPathCase:s=!1}={})=>(t=t.split("/").map(a=>h(c(a),{lower:!s})).join("/"),e?u(m(t)):t),S=t=>t.split(/[\s-]/g).map(g).join(" ");function c(t){return t=t.split(/[/:]/).pop(),x.test(t)?t:t.replace(/(\d+\.)?(.*)/,"$2").replace(/^index(\.draft)?$/,"").replace(/\.draft$/,"")}export{E as a,$ as d,S as g,T as p};
