import { HighlightStyle as d, LRLanguage as m, LanguageSupport as n, syntaxHighlighting as o } from "@codemirror/language";
import { Compartment as p } from "@codemirror/state";
import { styleTags as s, tags as e } from "@lezer/highlight";
import { parser as y } from "../grammar/zenuml-parser.js";
const f = s({
  TitleKeyword: e.heading,
  LineContent: e.content,
  // Control flow keywords
  "IfKeyword ElseKeyword WhileKeyword ReturnKeyword NewKeyword TryKeyword CatchKeyword FinallyKeyword ParKeyword AsyncKeyword": e.controlKeyword,
  "NullKeyword TrueKeyword FalseKeyword UndefinedKeyword": e.bool,
  // Participant keywords
  "ParticipantKeyword ActorKeyword StereotypeKeyword StarterAnnotation": e.heading,
  //Structural keywords
  "GroupKeyword OptKeyword CriticalKeyword SectionKeyword FrameKeyword": e.heading,
  // Action keywords
  "MessageKeyword AsyncMessageKeyword CreationKeyword": e.heading,
  // Literals
  String: e.string,
  Number: e.number,
  // Identifiers
  Type: e.typeName,
  // --- Context-Specific Identifiers ---
  // Style Identifier when it's directly under nodes where it represents a 'Name'
  "Participant/Name/Identifier": e.variableName,
  // Participant declaration Name
  "Stereotype/Name/Identifier": e.annotation,
  // Name inside a Stereotype
  "Label/Name/Identifier": e.variableName,
  // Name used as a Label
  // Style other specific identifier uses
  "Type/Identifier": e.typeName,
  // Identifier used as a Type
  "Assignee/Identifier": e.variableName,
  // Identifier used as an Assignee (LHS of '=')
  "Construct/Identifier": e.typeName,
  // Identifier used in 'new Construct(...)'
  "MethodName/Identifier": e.propertyName,
  // Punctuation
  "OpenBrace CloseBrace": e.brace,
  "OpenParen CloseParen": e.paren,
  Arrow: e.operator,
  Dot: e.operator,
  Comma: e.separator,
  SemiColon: e.separator,
  // Comments
  Comment: e.lineComment,
  // Special syntax
  Annotation: e.meta,
  Color: e.color,
  Stereotype: e.className,
  Label: e.labelName,
  // Expressions
  UnaryExpression: e.operator,
  BinaryExpression: e.operator,
  FunctionExpression: e.operator,
  InvocationExp: e.operator,
  Parameters: e.operator,
  Parameter: e.operator,
  Declaration: e.operator,
  ArrowOp: e.operator,
  Function: e.operator
}), l = d.define([
  { tag: e.heading, color: "#0d47a1", fontWeight: "bold" },
  { tag: e.content, color: "#1976d2" },
  { tag: e.keyword, color: "#d32f2f" },
  { tag: e.string, color: "#2e7d32" },
  { tag: e.number, color: "#1976d2" },
  { tag: e.bool, color: "#d32f2f" },
  { tag: e.variableName, color: "#0288d1" },
  { tag: e.typeName, color: "#7b1fa2" },
  { tag: e.propertyName, color: "#1565c0" },
  { tag: e.operator, color: "#ed6c02" },
  { tag: e.separator, color: "#757575" },
  { tag: e.lineComment, color: "#757575", fontStyle: "italic" },
  { tag: e.meta, color: "#9c27b0" },
  { tag: e.color, color: "#d32f2f" },
  { tag: e.className, color: "#2e7d32" },
  { tag: e.labelName, color: "#0288d1" },
  { tag: e.brace, color: "#9c27b0" }
]), c = d.define([
  { tag: e.heading, color: "#2cabf5", fontWeight: "bold" },
  { tag: e.content, color: "#81c784" },
  { tag: e.keyword, color: "#ff79c6" },
  { tag: e.string, color: "#81c784" },
  { tag: e.number, color: "#64b5f6" },
  { tag: e.bool, color: "#bd93f9" },
  { tag: e.variableName, color: "#99e6ff" },
  { tag: e.typeName, color: "#ce93d8" },
  { tag: e.propertyName, color: "#ffb74d" },
  { tag: e.operator, color: "#ffb74d" },
  { tag: e.separator, color: "#ffb74d" },
  { tag: e.lineComment, color: "#6272a4", fontStyle: "italic" },
  { tag: e.meta, color: "#e1bee7" },
  { tag: e.color, color: "#bd93f9" },
  { tag: e.className, color: "#81c784" },
  { tag: e.labelName, color: "#ffb74d" },
  { tag: e.brace, color: "#bd93f9" },
  { tag: e.paren, color: "#e4f52c" }
]), r = new p(), i = m.define({
  parser: y.configure({
    props: [f]
  }),
  languageData: {
    commentTokens: { line: "//" },
    closeBrackets: { brackets: ["(", "[", "{", "'", '"'] },
    indentOnInput: /^\s*[{}]$/
  }
});
function K(t) {
  switch (t) {
    case "dark":
      return new n(i, [
        r.of(o(c))
      ]);
    case "light":
      return new n(i, [
        r.of(o(l))
      ]);
  }
  const a = document.documentElement.getAttribute("data-theme") === "dark" ? c : l;
  return new n(i, [
    r.of(o(a))
  ]);
}
function N(t, g) {
  const a = g ? c : l;
  t.dispatch({
    effects: r.reconfigure(o(a))
  });
}
export {
  N as updateHighlightStyle,
  K as zenumlHighlighter,
  i as zenumlLanguage
};
//# sourceMappingURL=zenuml-highlighter.js.map
