// 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":{"x-robots-tag":"noindex","etag":"\"d15991935c2cb42513547fbca0acb2f2\"","x-jsr-backend":"modules","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","vary":"Origin","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=LPVKrreQcPdI5clxdJB5X36Z67qMS5cQojT3vbfIpVNCONQyS4HvW7NUYUf3WzqpGIzDdOlagYw3CEDIeTetHJHaC6EtIPWoGgz0FlqfQ0iYCv4nGwIoWZY%3D\"}]}","content-length":"1055","accept-ranges":"bytes","cf-ray":"a3c841e3490e9bcc-ORD","access-control-expose-headers":"*","access-control-allow-origin":"*","age":"1808150","alt-svc":"h3=\":443\"; ma=86400","cross-origin-resource-policy":"cross-origin","server":"cloudflare","date":"Thu, 17 Sep 2026 12:54:04 GMT","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","x-content-type-options":"nosniff","set-cookie":"__cf_bm=GMbVsVYJ_PQe0ViG2EFplHhR9dAXR5YPL.I3jTvhfUU-1789649644.0679228-1.0.1.1-_fW5jGlHJgzCKx6A48kzylrIeZlUif6Tc7sP3sWgwNxV49.WVFrYY.vLqE7CqjWe2Hy0jxsFDS_1AqO0K7oaazekb1sjY935A_klpBhnAmlCc3E0h784gu9uEGxjd8My; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Thu, 17 Sep 2026 13:24:04 GMT","cache-control":"public, max-age=31536000, immutable","content-type":"text/typescript"},"url":"https://jsr.io/@std/path/0.224.0/_interface.ts","time":1789649644}