var f = Object.defineProperty;
var m = (n, i) => f(n, "name", { value: i, configurable: !0 });
import g from "../../../../../../typescript@5.5.4/node_modules/typescript/lib/typescript.js";
import { DEFAULT_CODEMIRROR_TYPE_ICONS as C } from "./icons.js";
import { matchBefore as u } from "./matchBefore.js";
const S = [
  g.ScriptElementKind.warning
];
async function F({ env: n, path: i, context: a }) {
  const { pos: r, explicit: d } = a, s = n.getSourceFile(i)?.getFullText();
  if (!s)
    return null;
  let e = u(s, r, /\w*/);
  if (e?.text || (e = u(s, r, /\./)), !e?.text && !d)
    return null;
  const c = n.languageService.getCompletionsAtPosition(i, r, {
    includeCompletionsForModuleExports: !0,
    includeCompletionsForImportStatements: !0
  }, {});
  if (!c)
    return null;
  const p = c.entries.filter((t) => !S.includes(t.kind)).map((t) => {
    let o = t.kind ? String(t.kind) : void 0;
    o === "member" && (o = "property"), o && !C.has(o) && (o = void 0);
    const l = n.languageService.getCompletionEntryDetails(i, r, t.name, {}, t.source, {}, t.data);
    return {
      label: t.name,
      codeActions: l?.codeActions,
      displayParts: l?.displayParts ?? [],
      documentation: l?.documentation,
      tags: l?.tags,
      type: o
    };
  });
  return {
    from: e ? e.text === "." ? e.to : e.from : r,
    options: p
  };
}
m(F, "getAutocompletion");
export {
  F as getAutocompletion
};
