// 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":{"accept-ranges":"bytes","cache-control":"public, max-age=31536000, immutable","cf-ray":"a493806faa7934a5-IAD","content-type":"text/typescript","access-control-expose-headers":"*","cross-origin-resource-policy":"cross-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';","date":"Mon, 12 Oct 2026 04:53:35 GMT","content-length":"1055","cf-cache-status":"HIT","etag":"\"d15991935c2cb42513547fbca0acb2f2\"","x-content-type-options":"nosniff","set-cookie":"__cf_bm=r2KrAfBuL9Zm0og2mKgVNdteAP1p.QW95gT8g8w7QdM-1791780815.3146749-1.0.1.1-rKfEJoTIDY_ga8eFE2Uw9Xlf7OHvOn4a6qynuKUk0nYUoi_hdafqEVFmJE9Z0i4016u2xUxRMsqtyHQFKSAjWwux6h2k9fQqF02Aml3ktp98b9ci6sl8RdlkFh7C_mkn; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 12 Oct 2026 05:23:35 GMT","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=Re%2FfjmBjFLJm%2F7ET%2BOjoMzU7264ciGA66djGRScwVz6nFofLvh35630pStCr5T4OMO2qCS8uJVHqVGpgnYt0K9E683S48BlU1aYwPwr623ldits01QcJY%2Bw%3D\"}]}","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","alt-svc":"h3=\":443\"; ma=86400","x-robots-tag":"noindex","access-control-allow-origin":"*","x-jsr-backend":"modules","age":"3939569","vary":"Origin","server":"cloudflare"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1791780815}