"use strict";
/* Socket Lib - Built with esbuild */
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 globs_exports = {};
__export(globs_exports, {
  defaultIgnore: () => defaultIgnore,
  getGlobMatcher: () => getGlobMatcher,
  glob: () => glob,
  globStreamLicenses: () => globStreamLicenses,
  globSync: () => globSync
});
module.exports = __toCommonJS(globs_exports);
var fastGlob = __toESM(require("./external/fast-glob.js"));
var import_picomatch = __toESM(require("./external/picomatch.js"));
var import_objects = require("./objects");
var import_globs = require("./paths/globs");
const defaultIgnore = (0, import_objects.objectFreeze)([
  // Most of these ignored files can be included specifically if included in the
  // files globs. Exceptions to this are:
  // https://docs.npmjs.com/cli/v10/configuring-npm/package-json#files
  // These can NOT be included.
  // https://github.com/npm/npm-packlist/blob/v10.0.0/lib/index.js#L280
  "**/.git",
  "**/.npmrc",
  // '**/bun.lockb?',
  "**/node_modules",
  // '**/package-lock.json',
  // '**/pnpm-lock.ya?ml',
  // '**/yarn.lock',
  // Include npm-packlist defaults:
  // https://github.com/npm/npm-packlist/blob/v10.0.0/lib/index.js#L15-L38
  "**/.DS_Store",
  "**/.gitignore",
  "**/.hg",
  "**/.lock-wscript",
  "**/.npmignore",
  "**/.svn",
  "**/.wafpickle-*",
  "**/.*.swp",
  "**/._*/**",
  "**/archived-packages/**",
  "**/build/config.gypi",
  "**/CVS",
  "**/npm-debug.log",
  "**/*.orig",
  // Inline generic socket-registry .gitignore entries.
  "**/.env",
  "**/.eslintcache",
  "**/.nvm",
  "**/.tap",
  "**/.vscode",
  "**/*.tsbuildinfo",
  "**/Thumbs.db",
  // Inline additional ignores.
  "**/bower_components"
]);
// @__NO_SIDE_EFFECTS__
function globStreamLicenses(dirname, options) {
  const {
    ignore: ignoreOpt,
    ignoreOriginals,
    recursive,
    ...globOptions
  } = { __proto__: null, ...options };
  const ignore = [
    ...Array.isArray(ignoreOpt) ? ignoreOpt : defaultIgnore,
    "**/*.{cjs,cts,js,json,mjs,mts,ts}"
  ];
  if (ignoreOriginals) {
    ignore.push(import_globs.LICENSE_ORIGINAL_GLOB_RECURSIVE);
  }
  return fastGlob.globStream(
    [recursive ? import_globs.LICENSE_GLOB_RECURSIVE : import_globs.LICENSE_GLOB],
    {
      __proto__: null,
      absolute: true,
      caseSensitiveMatch: false,
      cwd: dirname,
      ...globOptions,
      ...ignore ? { ignore } : {}
    }
  );
}
const matcherCache = /* @__PURE__ */ new Map();
// @__NO_SIDE_EFFECTS__
function getGlobMatcher(glob2, options) {
  const patterns = Array.isArray(glob2) ? glob2 : [glob2];
  const key = JSON.stringify({ patterns, options });
  let matcher = matcherCache.get(key);
  if (matcher) {
    return matcher;
  }
  const positivePatterns = patterns.filter((p) => !p.startsWith("!"));
  const negativePatterns = patterns.filter((p) => p.startsWith("!")).map((p) => p.slice(1));
  const matchOptions = {
    dot: true,
    nocase: true,
    ...options,
    ...negativePatterns.length > 0 ? { ignore: negativePatterns } : {}
  };
  matcher = (0, import_picomatch.default)(
    positivePatterns.length > 0 ? positivePatterns : patterns,
    matchOptions
  );
  matcherCache.set(key, matcher);
  return matcher;
}
// @__NO_SIDE_EFFECTS__
function glob(patterns, options) {
  return fastGlob.glob(patterns, options);
}
// @__NO_SIDE_EFFECTS__
function globSync(patterns, options) {
  return fastGlob.globSync(patterns, options);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  defaultIgnore,
  getGlobMatcher,
  glob,
  globStreamLicenses,
  globSync
});
