import{parse as d}from"path";function N(p){const a=p.split("/");let i=-1;for(let t=0;t<a.length;t++)if(a[t]==="@api"){i=t;break}let e="",r=p;i!==-1&&(e=a.slice(0,i).join("/"),r=a.slice(i+1).join("/"),e=e?`/${e}/api`:"/api");const{dir:c,name:o}=d(r),s=o.match(/\.(get|post|put|delete|patch)$/i),h=s?s[1]:"all",l=o.replace(/\.(get|post|put|delete|patch)$/,"");let n=c.split("/");l!=="index"&&n.push(l);const m=n.map(t=>t.startsWith("[...")&&t.endsWith("]")?`:${t.slice(4,-1)}{.+}`:t.startsWith("[")&&t.endsWith("]")?`:${t.slice(1,-1)}`:t).join("/");return{path:`${e}/${m}`.replace(/\/+/g,"/").replace(/\/$/,""),method:h,handler:p}}export{N as parseRouteFsPathForHono};
