/* esm.sh - @jsr/std__path@1.1.4/windows/parse */ import{CHAR_COLON as m,CHAR_DOT as A}from"../_common/constants.mjs";import{assertPath as u}from"../_common/assert_path.mjs";import{isPathSeparator as c,isWindowsDeviceRoot as k}from"./_util.mjs";function P(r){u(r);let e={root:"",dir:"",base:"",ext:"",name:""},o=r.length;if(o===0)return e;let t=0,n=r.charCodeAt(0);if(o>1){if(c(n)){if(t=1,c(r.charCodeAt(1))){let i=2,b=i;for(;i2){if(c(r.charCodeAt(2))){if(o===3)return e.root=e.dir=r,e.base="\\",e;t=3}}else return e.root=e.dir=r,e}else if(c(n))return e.root=e.dir=r,e.base="\\",e;t>0&&(e.root=r.slice(0,t));let f=-1,s=t,l=-1,C=!0,d=r.length-1,a=0;for(;d>=t;--d){if(n=r.charCodeAt(d),c(n)){if(!C){s=d+1;break}continue}l===-1&&(C=!1,l=d+1),n===A?f===-1?f=d:a!==1&&(a=1):f!==-1&&(a=-1)}return f===-1||l===-1||a===0||a===1&&f===l-1&&f===s+1?l!==-1&&(e.base=e.name=r.slice(s,l)):(e.name=r.slice(s,f),e.base=r.slice(s,l),e.ext=r.slice(f,l)),e.base=e.base||"\\",s>0&&s!==t?e.dir=r.slice(0,s-1):e.dir=e.root,e}export{P as parse}; //parse.mjs.map