import { toRegExp as a } from "../../../../../oniguruma-to-es@4.3.4/node_modules/oniguruma-to-es/dist/esm/index.js";
import { J as n } from "./shared/engine-javascript.hzpS1_41.js";
function c(t, e) {
  return a(
    t,
    {
      global: !0,
      hasIndices: !0,
      // This has no benefit for the standard JS engine, but it avoids a perf penalty for
      // precompiled grammars when constructing extremely long patterns that aren't always used
      lazyCompileLength: 3e3,
      rules: {
        // Needed since TextMate grammars merge backrefs across patterns
        allowOrphanBackrefs: !0,
        // Improves search performance for generated regexes
        asciiWordBoundaries: !0,
        // Follow `vscode-oniguruma` which enables this Oniguruma option by default
        captureGroup: !0,
        // Oniguruma uses depth limit `20`; lowered here to keep regexes shorter and maybe
        // sometimes faster, but can be increased if issues reported due to low limit
        recursionLimit: 5,
        // Oniguruma option for `^`->`\A`, `$`->`\Z`; improves search performance without any
        // change in meaning since TM grammars search line by line
        singleline: !0
      },
      ...e
    }
  );
}
function i(t = {}) {
  const e = Object.assign(
    {
      target: "auto",
      cache: /* @__PURE__ */ new Map()
    },
    t
  );
  return e.regexConstructor || (e.regexConstructor = (r) => c(r, { target: e.target })), {
    createScanner(r) {
      return new n(r, e);
    },
    createString(r) {
      return {
        content: r
      };
    }
  };
}
export {
  i as createJavaScriptRegexEngine,
  c as defaultJavaScriptRegexConstructor
};
