// 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":{"content-type":"text/typescript","cache-control":"public, max-age=31536000, immutable","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';","x-content-type-options":"nosniff","cross-origin-resource-policy":"cross-origin","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","date":"Mon, 27 Jul 2026 03:21:21 GMT","etag":"\"d15991935c2cb42513547fbca0acb2f2\"","cf-cache-status":"HIT","accept-ranges":"bytes","cf-ray":"a21883762f15d96f-IAD","age":"1535275","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=xBL8M%2FeGBsjBFrg3t%2F653%2Bupdi1Kr5D5Xty2LV%2F1%2FKuzHxy5NeQMn68uTqQ4q2Ie7BLKKpg7JQXWlExyou%2FsZKFKU0cXfAkpMD9F%2BA1vrL%2FxWYIAQ89pvhk%3D\"}]}","server":"cloudflare","access-control-expose-headers":"*","set-cookie":"__cf_bm=JYvpSW9coBrOaVDAcnOL6ZiADa4QtaXohWViMg1u2vQ-1785122481.6272328-1.0.1.1-LeXdhN_J9h_QV0.ansqh.X8MIoGa0O48xgkb0gbIABMqDEefRBbifRR8A6q3k3LIRzrZku0p9u6dgOtNhIjcVMgj.UiG_nsQ3B4vWoAvQ_fl0xCd1X5B0jEVn0umqfhw; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 27 Jul 2026 03:51:21 GMT","access-control-allow-origin":"*","x-jsr-backend":"modules","x-robots-tag":"noindex","content-length":"1055","alt-svc":"h3=\":443\"; ma=86400"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1785122481}