import CJS_COMPAT_NODE_URL_rqth4iav4b from 'node:url';
import CJS_COMPAT_NODE_PATH_rqth4iav4b from 'node:path';
import CJS_COMPAT_NODE_MODULE_rqth4iav4b from "node:module";

var __filename = CJS_COMPAT_NODE_URL_rqth4iav4b.fileURLToPath(import.meta.url);
var __dirname = CJS_COMPAT_NODE_PATH_rqth4iav4b.dirname(__filename);
var require = CJS_COMPAT_NODE_MODULE_rqth4iav4b.createRequire(import.meta.url);

// ------------------------------------------------------------
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
// ------------------------------------------------------------
import {
  __name
} from "./chunk-Q5HJHFF2.js";

// ../node_modules/empathic/resolve.mjs
import { createRequire } from "node:module";
import { isAbsolute, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
function absolute(input, root) {
  return isAbsolute(input) ? input : resolve(root || ".", input);
}
__name(absolute, "absolute");
function from(root, ident, silent) {
  try {
    let r = root instanceof URL || root.startsWith("file://") ? join(fileURLToPath(root), "noop.js") : join(absolute(root), "noop.js");
    return createRequire(r).resolve(ident);
  } catch (err) {
    if (!silent) throw err;
  }
}
__name(from, "from");

// ../node_modules/empathic/walk.mjs
import { dirname } from "node:path";
function up(base, options) {
  let { last, cwd } = options || {};
  let tmp = absolute(base, cwd);
  let root = absolute(last || "/", cwd);
  let prev, arr = [];
  while (prev !== root) {
    arr.push(tmp);
    tmp = dirname(prev = tmp);
    if (tmp === prev) break;
  }
  return arr;
}
__name(up, "up");

// ../node_modules/empathic/find.mjs
import { join as join2 } from "node:path";
import { existsSync, statSync } from "node:fs";
function up2(name, options) {
  let dir, tmp;
  let start = options && options.cwd || "";
  for (dir of up(start, options)) {
    tmp = join2(dir, name);
    if (existsSync(tmp)) return tmp;
  }
}
__name(up2, "up");
function any(names, options) {
  let dir, start = options && options.cwd || "";
  let j = 0, len = names.length, tmp;
  for (dir of up(start, options)) {
    for (j = 0; j < len; j++) {
      tmp = join2(dir, names[j]);
      if (existsSync(tmp)) return tmp;
    }
  }
}
__name(any, "any");

export {
  from,
  up,
  up2,
  any
};
