// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

/**
 * A parsed path object generated by path.parse() or consumed by path.format().
 *
 * @example
 * ```ts
 * import { parse } from "@std/path";
 *
 * const parsedPathObj = parse("c:\\path\\dir\\index.html");
 * parsedPathObj.root; // "c:\\"
 * parsedPathObj.dir; // "c:\\path\\dir"
 * parsedPathObj.base; // "index.html"
 * parsedPathObj.ext; // ".html"
 * parsedPathObj.name; // "index"
 * ```
 */
export interface ParsedPath {
  /**
   * The root of the path such as '/' or 'c:\'
   */
  root: string;
  /**
   * The full directory path of the parent such as '/home/user/dir' or 'c:\path\dir'
   */
  dir: string;
  /**
   * The file name including extension (if any) such as 'index.html'
   */
  base: string;
  /**
   * The file extension (if any) such as '.html'
   */
  ext: string;
  /**
   * The file name without extension (if any) such as 'index'
   */
  name: string;
}

export type FormatInputPathObject = Partial<ParsedPath>;

// denoCacheMetadata={"headers":{"etag":"\"d15991935c2cb42513547fbca0acb2f2\"","x-jsr-backend":"modules","content-length":"1055","age":"3435554","cache-control":"public, max-age=31536000, immutable","content-type":"text/typescript","x-content-type-options":"nosniff","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=xUVsZwFpRC%2FXZCXP5BCIgqmZMaz2OxDm5c64m6t0yEftLE6jBCiGZkSvaoNTf2qRH%2F7%2F4%2FQ550jyeJv7eTc0OA0iIUKBDbsC6%2FWt1SxPOdBRn2sN3dehsaU%3D\"}]}","cf-ray":"a4636f5efd1ce5b8-IAD","server":"cloudflare","cross-origin-resource-policy":"cross-origin","set-cookie":"__cf_bm=OuaMEdCIPOHk2U8ckiHKurZgEPBGeQ8RvRoXhnOGvCE-1791276799.8421662-1.0.1.1-rjAuyjR8d6BYFuG1GayIu5ARFICiDqU.3enttjGQN0xjKC37r07d6gufm8PdkAhA9UeT8mmJDv9wOjYNCaS2fr5aOEkm_xfRw8.mT18vF6C.bW2H7vaUg8WHg0sP1tTT; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 06 Oct 2026 09:23:19 GMT","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","alt-svc":"h3=\":443\"; ma=86400","accept-ranges":"bytes","access-control-expose-headers":"*","x-robots-tag":"noindex","access-control-allow-origin":"*","date":"Tue, 06 Oct 2026 08:53:19 GMT","vary":"Origin","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","cf-cache-status":"HIT"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1791276799}