"use strict";
/* Socket Lib - Built with esbuild */
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var dir_exports = {};
__export(dir_exports, {
  clearDlx: () => clearDlx,
  clearDlxSync: () => clearDlxSync,
  dlxDirExists: () => dlxDirExists,
  ensureDlxDir: () => ensureDlxDir,
  ensureDlxDirSync: () => ensureDlxDirSync
});
module.exports = __toCommonJS(dir_exports);
var import_safe = require("../fs/safe");
var import_socket = require("../paths/socket");
var import_iterate = require("../promises/iterate");
var import_fs = require("../node/fs");
var import_packages = require("./packages");
async function clearDlx() {
  const packages = await (0, import_packages.listDlxPackagesAsync)();
  await (0, import_iterate.pEach)(packages, (pkg) => (0, import_packages.removeDlxPackage)(pkg));
}
function clearDlxSync() {
  const packages = (0, import_packages.listDlxPackages)();
  for (const pkg of packages) {
    (0, import_packages.removeDlxPackageSync)(pkg);
  }
}
function dlxDirExists() {
  const fs = (0, import_fs.getNodeFs)();
  return fs.existsSync((0, import_socket.getSocketDlxDir)());
}
async function ensureDlxDir() {
  await (0, import_safe.safeMkdir)((0, import_socket.getSocketDlxDir)());
}
function ensureDlxDirSync() {
  (0, import_safe.safeMkdirSync)((0, import_socket.getSocketDlxDir)());
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  clearDlx,
  clearDlxSync,
  dlxDirExists,
  ensureDlxDir,
  ensureDlxDirSync
});
