"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var path_utils_exports = {};
__export(path_utils_exports, {
  PathStore: () => PathStore,
  absoluteFrom: () => absoluteFrom,
  cwd: () => cwd,
  isPath: () => isPath,
  isPlatformSpecificAbsolutePath: () => isPlatformSpecificAbsolutePath,
  isPlatformSpecificPath: () => isPlatformSpecificPath,
  join: () => join,
  posix: () => posix,
  relativeFrom: () => relativeFrom,
  rmExtension: () => rmExtension,
  toNormalizedPosixPath: () => toNormalizedPosixPath,
  toUnix: () => toUnix,
  win32: () => win32
});
module.exports = __toCommonJS(path_utils_exports);
var import_lodash = __toESM(require("lodash"));
var import_os = __toESM(require("os"));
var import_path = __toESM(require("path"));
var posix;
((posix2) => {
  posix2.isPath = (path) => (0, posix2.isAbsolutePath)(path) || (0, posix2.isRelativePath)(path);
  posix2.isRelativePath = (path) => path.startsWith("./") || path.startsWith("../");
  posix2.isAbsolutePath = (path) => import_path.default.posix.isAbsolute(path);
})(posix || (posix = {}));
var win32;
((win322) => {
  win322.isPath = (path) => (0, win322.isAbsolutePath)(path) || (0, win322.isRelativePath)(path);
  win322.isRelativePath = (path) => path.startsWith(".\\") || path.startsWith("..\\");
  win322.isAbsolutePath = (path) => /^[a-zA-Z]:\\/.test(path);
})(win32 || (win32 = {}));
const isPath = (path) => win32.isPath(path) || posix.isPath(path);
const isPlatformSpecificPath = (path) => import_os.default.platform() === "win32" ? win32.isPath(path) : posix.isPath(path);
const isPlatformSpecificAbsolutePath = (path) => import_os.default.platform() === "win32" ? win32.isAbsolutePath(path) : posix.isAbsolutePath(path);
const cwd = () => process.cwd();
const join = (abs, ...paths) => {
  const joined = import_path.default.join(abs, ...paths);
  return import_path.default.normalize(joined);
};
const rmExtension = (filename) => filename.replace(/\.[^/.]+$/, "");
const toUnix = (path) => path.split(import_path.default.sep).join(import_path.default.posix.sep);
const toNormalizedPosixPath = (path) => (path.startsWith("./") ? "./" : "") + import_path.default.posix.normalize(path.replaceAll(/\\/g, "/")).replace(/\/\.$/, "");
const absoluteFrom = (rootdir, target) => {
  if (isPlatformSpecificAbsolutePath(target)) {
    return target;
  }
  return import_path.default.join(rootdir, target);
};
const relativeFrom = (rootdir, target) => {
  let absPath;
  if (isPlatformSpecificAbsolutePath(target)) {
    absPath = target;
  } else {
    absPath = import_path.default.resolve(import_path.default.join(rootdir, target));
  }
  return import_path.default.relative(rootdir, absPath);
};
class PathStore {
  constructor(abs) {
    this.abs = abs;
  }
  rel(from) {
    return import_lodash.default.mapValues(this.abs, (to) => relativeFrom(this.abs[from], to));
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  PathStore,
  absoluteFrom,
  cwd,
  isPath,
  isPlatformSpecificAbsolutePath,
  isPlatformSpecificPath,
  join,
  posix,
  relativeFrom,
  rmExtension,
  toNormalizedPosixPath,
  toUnix,
  win32
});
//# sourceMappingURL=path-utils.js.map
