"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }


var _chunkDFJNOFN2cjs = require('./chunk-DFJNOFN2.cjs');

// src/utilities/find-up.ts
_chunkDFJNOFN2cjs.init_cjs_shims.call(void 0, );
var _fs = require('fs');
var _path = require('path');
var MAX_PATH_SEARCH_DEPTH = 30;
var depth = 0;
function findFolderUp(startPath, endFileNames) {
  const _startPath = _nullishCoalesce(startPath, () => ( process.cwd()));
  if (endFileNames.some((endFileName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endFileName)))) {
    return _startPath;
  }
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
    const parent = _path.join.call(void 0, _startPath, "..");
    return findFolderUp(parent, endFileNames);
  }
  return void 0;
}
_chunkDFJNOFN2cjs.__name.call(void 0, findFolderUp, "findFolderUp");



exports.findFolderUp = findFolderUp;
