var ie = Object.defineProperty;
var i = (t, e) => ie(t, "name", { value: e, configurable: !0 });
import { LRLanguage as se, LanguageSupport as oe, indentNodeProp as le, continuedIndent as ce, foldNodeProp as de, styleTags as me, tags as s, ExternalTokenizer as ue, ifNotIn as pe, completeFromList as fe, LRParser as _e, syntaxTree as ge } from "../../../editor-CpzUWoVG.js";
const he = 36, D = 1, ye = 2, v = 3, P = 4, be = 5, ve = 6, ke = 7, xe = 8, Oe = 9, we = 10, Qe = 11, Ce = 12, Se = 13, qe = 14, Pe = 15, Te = 16, ze = 17, Z = 18, je = 19, F = 20, K = 21, N = 22, Ue = 23, Be = 24;
function z(t) {
  return t >= 65 && t <= 90 || t >= 97 && t <= 122 || t >= 48 && t <= 57;
}
i(z, "isAlpha");
function Le(t) {
  return t >= 48 && t <= 57 || t >= 97 && t <= 102 || t >= 65 && t <= 70;
}
i(Le, "isHexDigit");
function h(t, e, a) {
  for (let r = !1; ; ) {
    if (t.next < 0)
      return;
    if (t.next == e && !r) {
      t.advance();
      return;
    }
    r = a && !r && t.next == 92, t.advance();
  }
}
i(h, "readLiteral");
function Xe(t, e) {
  e: for (; ; ) {
    if (t.next < 0)
      return;
    if (t.next == 36) {
      t.advance();
      for (let a = 0; a < e.length; a++) {
        if (t.next != e.charCodeAt(a))
          continue e;
        t.advance();
      }
      if (t.next == 36) {
        t.advance();
        return;
      }
    } else
      t.advance();
  }
}
i(Xe, "readDoubleDollarLiteral");
function Ie(t, e) {
  let a = "[{<(".indexOf(String.fromCharCode(e)), r = a < 0 ? e : "]}>)".charCodeAt(a);
  for (; ; ) {
    if (t.next < 0)
      return;
    if (t.next == r && t.peek(1) == 39) {
      t.advance(2);
      return;
    }
    t.advance();
  }
}
i(Ie, "readPLSQLQuotedLiteral");
function j(t, e) {
  for (; !(t.next != 95 && !z(t.next)); )
    e != null && (e += String.fromCharCode(t.next)), t.advance();
  return e;
}
i(j, "readWord");
function Re(t) {
  if (t.next == 39 || t.next == 34 || t.next == 96) {
    let e = t.next;
    t.advance(), h(t, e, !1);
  } else
    j(t);
}
i(Re, "readWordOrQuoted");
function V(t, e) {
  for (; t.next == 48 || t.next == 49; )
    t.advance();
  e && t.next == e && t.advance();
}
i(V, "readBits");
function A(t, e) {
  for (; ; ) {
    if (t.next == 46) {
      if (e)
        break;
      e = !0;
    } else if (t.next < 48 || t.next > 57)
      break;
    t.advance();
  }
  if (t.next == 69 || t.next == 101)
    for (t.advance(), (t.next == 43 || t.next == 45) && t.advance(); t.next >= 48 && t.next <= 57; )
      t.advance();
}
i(A, "readNumber");
function $(t) {
  for (; !(t.next < 0 || t.next == 10); )
    t.advance();
}
i($, "eol");
function g(t, e) {
  for (let a = 0; a < e.length; a++)
    if (e.charCodeAt(a) == t)
      return !0;
  return !1;
}
i(g, "inString");
const T = ` 	\r
`;
function G(t, e, a) {
  let r = /* @__PURE__ */ Object.create(null);
  r.true = r.false = be, r.null = r.unknown = ve;
  for (let n of t.split(" "))
    n && (r[n] = F);
  for (let n of e.split(" "))
    n && (r[n] = K);
  for (let n of (a || "").split(" "))
    n && (r[n] = Be);
  return r;
}
i(G, "keywords");
const y = "array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ", b = "absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ", U = {
  backslashEscapes: !1,
  hashComments: !1,
  spaceAfterDashes: !1,
  slashComments: !1,
  doubleQuotedStrings: !1,
  doubleDollarQuotedStrings: !1,
  unquotedBitLiterals: !1,
  treatBitsAsBytes: !1,
  charSetCasts: !1,
  plsqlQuotingMechanism: !1,
  operatorChars: "*+-%<>!=&|~^/",
  specialVar: "?",
  identifierQuotes: '"',
  caseInsensitiveIdentifiers: !1,
  words: /* @__PURE__ */ G(b, y)
};
function De(t, e, a, r) {
  let n = {};
  for (let o in U)
    n[o] = (t.hasOwnProperty(o) ? t : U)[o];
  return e && (n.words = G(e, a || "", r)), n;
}
i(De, "dialect");
function Y(t) {
  return new ue((e) => {
    var a;
    let { next: r } = e;
    if (e.advance(), g(r, T)) {
      for (; g(e.next, T); )
        e.advance();
      e.acceptToken(he);
    } else if (r == 36 && t.doubleDollarQuotedStrings) {
      let n = j(e, "");
      e.next == 36 && (e.advance(), Xe(e, n), e.acceptToken(v));
    } else if (r == 39 || r == 34 && t.doubleQuotedStrings)
      h(e, r, t.backslashEscapes), e.acceptToken(v);
    else if (r == 35 && t.hashComments || r == 47 && e.next == 47 && t.slashComments)
      $(e), e.acceptToken(D);
    else if (r == 45 && e.next == 45 && (!t.spaceAfterDashes || e.peek(1) == 32))
      $(e), e.acceptToken(D);
    else if (r == 47 && e.next == 42) {
      e.advance();
      for (let n = 1; ; ) {
        let o = e.next;
        if (e.next < 0)
          break;
        if (e.advance(), o == 42 && e.next == 47) {
          if (n--, e.advance(), !n)
            break;
        } else o == 47 && e.next == 42 && (n++, e.advance());
      }
      e.acceptToken(ye);
    } else if ((r == 101 || r == 69) && e.next == 39)
      e.advance(), h(e, 39, !0), e.acceptToken(v);
    else if ((r == 110 || r == 78) && e.next == 39 && t.charSetCasts)
      e.advance(), h(e, 39, t.backslashEscapes), e.acceptToken(v);
    else if (r == 95 && t.charSetCasts)
      for (let n = 0; ; n++) {
        if (e.next == 39 && n > 1) {
          e.advance(), h(e, 39, t.backslashEscapes), e.acceptToken(v);
          break;
        }
        if (!z(e.next))
          break;
        e.advance();
      }
    else if (t.plsqlQuotingMechanism && (r == 113 || r == 81) && e.next == 39 && e.peek(1) > 0 && !g(e.peek(1), T)) {
      let n = e.peek(1);
      e.advance(2), Ie(e, n), e.acceptToken(v);
    } else if (g(r, t.identifierQuotes)) {
      const n = r == 91 ? 93 : r;
      h(e, n, !1), e.acceptToken(je);
    } else if (r == 40)
      e.acceptToken(ke);
    else if (r == 41)
      e.acceptToken(xe);
    else if (r == 123)
      e.acceptToken(Oe);
    else if (r == 125)
      e.acceptToken(we);
    else if (r == 91)
      e.acceptToken(Qe);
    else if (r == 93)
      e.acceptToken(Ce);
    else if (r == 59)
      e.acceptToken(Se);
    else if (t.unquotedBitLiterals && r == 48 && e.next == 98)
      e.advance(), V(e), e.acceptToken(N);
    else if ((r == 98 || r == 66) && (e.next == 39 || e.next == 34)) {
      const n = e.next;
      e.advance(), t.treatBitsAsBytes ? (h(e, n, t.backslashEscapes), e.acceptToken(Ue)) : (V(e, n), e.acceptToken(N));
    } else if (r == 48 && (e.next == 120 || e.next == 88) || (r == 120 || r == 88) && e.next == 39) {
      let n = e.next == 39;
      for (e.advance(); Le(e.next); )
        e.advance();
      n && e.next == 39 && e.advance(), e.acceptToken(P);
    } else if (r == 46 && e.next >= 48 && e.next <= 57)
      A(e, !0), e.acceptToken(P);
    else if (r == 46)
      e.acceptToken(qe);
    else if (r >= 48 && r <= 57)
      A(e, !1), e.acceptToken(P);
    else if (g(r, t.operatorChars)) {
      for (; g(e.next, t.operatorChars); )
        e.advance();
      e.acceptToken(Pe);
    } else if (g(r, t.specialVar))
      e.next == r && e.advance(), Re(e), e.acceptToken(ze);
    else if (r == 58 || r == 44)
      e.acceptToken(Te);
    else if (z(r)) {
      let n = j(e, String.fromCharCode(r));
      e.acceptToken(e.next == 46 || e.peek(-n.length - 1) == 46 ? Z : (a = t.words[n.toLowerCase()]) !== null && a !== void 0 ? a : Z);
    }
  });
}
i(Y, "tokensFor");
const H = /* @__PURE__ */ Y(U), Ze = /* @__PURE__ */ _e.deserialize({
  version: 14,
  states: "%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",
  stateData: ",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",
  goto: "#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",
  nodeNames: "⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",
  maxTerm: 38,
  nodeProps: [
    ["isolate", -4, 1, 2, 3, 19, ""]
  ],
  skippedNodes: [0, 1, 2],
  repeatNodeCount: 3,
  tokenData: "RORO",
  tokenizers: [0, H],
  topRules: { Script: [0, 25] },
  tokenPrec: 0
});
function B(t) {
  let e = t.cursor().moveTo(t.from, -1);
  for (; /Comment/.test(e.name); )
    e.moveTo(e.from, -1);
  return e.node;
}
i(B, "tokenBefore");
function w(t, e) {
  let a = t.sliceString(e.from, e.to), r = /^([`'"\[])(.*)([`'"\]])$/.exec(a);
  return r ? r[2] : a;
}
i(w, "idName");
function S(t) {
  return t && (t.name == "Identifier" || t.name == "QuotedIdentifier");
}
i(S, "plainID");
function Ne(t, e) {
  if (e.name == "CompositeIdentifier") {
    let a = [];
    for (let r = e.firstChild; r; r = r.nextSibling)
      S(r) && a.push(w(t, r));
    return a;
  }
  return [w(t, e)];
}
i(Ne, "pathFor");
function E(t, e) {
  for (let a = []; ; ) {
    if (!e || e.name != ".")
      return a;
    let r = B(e);
    if (!S(r))
      return a;
    a.unshift(w(t, r)), e = B(r);
  }
}
i(E, "parentsFor");
function Ve(t, e) {
  let a = ge(t).resolveInner(e, -1), r = $e(t.doc, a);
  return a.name == "Identifier" || a.name == "QuotedIdentifier" || a.name == "Keyword" ? {
    from: a.from,
    quoted: a.name == "QuotedIdentifier" ? t.doc.sliceString(a.from, a.from + 1) : null,
    parents: E(t.doc, B(a)),
    aliases: r
  } : a.name == "." ? { from: e, quoted: null, parents: E(t.doc, a), aliases: r } : { from: e, quoted: null, parents: [], empty: !0, aliases: r };
}
i(Ve, "sourceContext");
const Ae = /* @__PURE__ */ new Set(/* @__PURE__ */ "where group having order union intersect except all distinct limit offset fetch for".split(" "));
function $e(t, e) {
  let a;
  for (let n = e; !a; n = n.parent) {
    if (!n)
      return null;
    n.name == "Statement" && (a = n);
  }
  let r = null;
  for (let n = a.firstChild, o = !1, d = null; n; n = n.nextSibling) {
    let c = n.name == "Keyword" ? t.sliceString(n.from, n.to).toLowerCase() : null, l = null;
    if (!o)
      o = c == "from";
    else if (c == "as" && d && S(n.nextSibling))
      l = w(t, n.nextSibling);
    else {
      if (c && Ae.has(c))
        break;
      d && S(n) && (l = w(t, n));
    }
    l && (r || (r = /* @__PURE__ */ Object.create(null)), r[l] = Ne(t, d)), d = /Identifier$/.test(n.name) ? n : null;
  }
  return r;
}
i($e, "getAliases");
function Ee(t, e, a) {
  return a.map((r) => ({ ...r, label: r.label[0] == t ? r.label : t + r.label + e, apply: void 0 }));
}
i(Ee, "maybeQuoteCompletions");
const We = /^\w*$/, Me = /^[`'"\[]?\w*[`'"\]]?$/;
function W(t) {
  return t.self && typeof t.self.label == "string";
}
i(W, "isSelfTag");
const q = class q {
  constructor(e, a) {
    this.idQuote = e, this.idCaseInsensitive = a, this.list = [], this.children = void 0;
  }
  child(e) {
    let a = this.children || (this.children = /* @__PURE__ */ Object.create(null)), r = a[e];
    return r || (e && !this.list.some((n) => n.label == e) && this.list.push(M(e, "type", this.idQuote, this.idCaseInsensitive)), a[e] = new q(this.idQuote, this.idCaseInsensitive));
  }
  maybeChild(e) {
    return this.children ? this.children[e] : null;
  }
  addCompletion(e) {
    let a = this.list.findIndex((r) => r.label == e.label);
    a > -1 ? this.list[a] = e : this.list.push(e);
  }
  addCompletions(e) {
    for (let a of e)
      this.addCompletion(typeof a == "string" ? M(a, "property", this.idQuote, this.idCaseInsensitive) : a);
  }
  addNamespace(e) {
    Array.isArray(e) ? this.addCompletions(e) : W(e) ? this.addNamespace(e.children) : this.addNamespaceObject(e);
  }
  addNamespaceObject(e) {
    for (let a of Object.keys(e)) {
      let r = e[a], n = null, o = a.replace(/\\?\./g, (c) => c == "." ? "\0" : c).split("\0"), d = this;
      W(r) && (n = r.self, r = r.children);
      for (let c = 0; c < o.length; c++)
        n && c == o.length - 1 && d.addCompletion(n), d = d.child(o[c].replace(/\\\./g, "."));
      d.addNamespace(r);
    }
  }
};
i(q, "CompletionLevel");
let L = q;
function M(t, e, a, r) {
  return new RegExp("^[a-z_][a-z_\\d]*$", r ? "i" : "").test(t) ? { label: t, type: e } : { label: t, type: e, apply: a + t + J(a) };
}
i(M, "nameCompletion");
function J(t) {
  return t === "[" ? "]" : t;
}
i(J, "getClosingQuote");
function Fe(t, e, a, r, n, o) {
  var d;
  let c = ((d = o?.spec.identifierQuotes) === null || d === void 0 ? void 0 : d[0]) || '"', l = new L(c, !!o?.spec.caseInsensitiveIdentifiers), p = n ? l.child(n) : null;
  return l.addNamespace(t), e && (p || l).addCompletions(e), a && l.addCompletions(a), p && l.addCompletions(p.list), r && l.addCompletions((p || l).child(r).list), (f) => {
    let { parents: k, from: I, quoted: R, empty: ae, aliases: Q } = Ve(f.state, f.pos);
    if (ae && !f.explicit)
      return null;
    Q && k.length == 1 && (k = Q[k[0]] || k);
    let m = l;
    for (let _ of k) {
      for (; !m.children || !m.children[_]; )
        if (m == l && p)
          m = p;
        else if (m == p && r)
          m = m.child(r);
        else
          return null;
      let x = m.maybeChild(_);
      if (!x)
        return null;
      m = x;
    }
    let C = m.list;
    if (m == l && Q && (C = C.concat(Object.keys(Q).map((_) => ({ label: _, type: "constant" })))), R) {
      let _ = R[0], x = J(_), ne = f.state.sliceDoc(f.pos, f.pos + 1) == x;
      return {
        from: I,
        to: ne ? f.pos + 1 : void 0,
        options: Ee(_, x, C),
        validFor: Me
      };
    } else
      return {
        from: I,
        options: C,
        validFor: We
      };
  };
}
i(Fe, "completeFromSchema");
function Ke(t) {
  return t == K ? "type" : t == F ? "keyword" : "variable";
}
i(Ke, "completionType");
function Ge(t, e, a) {
  let r = Object.keys(t).map((n) => a(e ? n.toUpperCase() : n, Ke(t[n])));
  return pe(["QuotedIdentifier", "String", "LineComment", "BlockComment", "."], fe(r));
}
i(Ge, "completeKeywords");
let Ye = /* @__PURE__ */ Ze.configure({
  props: [
    /* @__PURE__ */ le.add({
      Statement: /* @__PURE__ */ ce()
    }),
    /* @__PURE__ */ de.add({
      Statement(t, e) {
        return { from: Math.min(t.from + 100, e.doc.lineAt(t.from).to), to: t.to };
      },
      BlockComment(t) {
        return { from: t.from + 2, to: t.to - 2 };
      }
    }),
    /* @__PURE__ */ me({
      Keyword: s.keyword,
      Type: s.typeName,
      Builtin: /* @__PURE__ */ s.standard(s.name),
      Bits: s.number,
      Bytes: s.string,
      Bool: s.bool,
      Null: s.null,
      Number: s.number,
      String: s.string,
      Identifier: s.name,
      QuotedIdentifier: /* @__PURE__ */ s.special(s.string),
      SpecialVar: /* @__PURE__ */ s.special(s.name),
      LineComment: s.lineComment,
      BlockComment: s.blockComment,
      Operator: s.operator,
      "Semi Punctuation": s.punctuation,
      "( )": s.paren,
      "{ }": s.brace,
      "[ ]": s.squareBracket
    })
  ]
});
const O = class O {
  constructor(e, a, r) {
    this.dialect = e, this.language = a, this.spec = r;
  }
  /**
  Returns the language for this dialect as an extension.
  */
  get extension() {
    return this.language.extension;
  }
  /**
  Reconfigure the parser used by this dialect. Returns a new
  dialect object.
  */
  configureLanguage(e, a) {
    return new O(this.dialect, this.language.configure(e, a), this.spec);
  }
  /**
  Define a new dialect.
  */
  static define(e) {
    let a = De(e, e.keywords, e.types, e.builtin), r = se.define({
      name: "sql",
      parser: Ye.configure({
        tokenizers: [{ from: H, to: Y(a) }]
      }),
      languageData: {
        commentTokens: { line: "--", block: { open: "/*", close: "*/" } },
        closeBrackets: { brackets: ["(", "[", "{", "'", '"', "`"] }
      }
    });
    return new O(a, r, e);
  }
};
i(O, "SQLDialect");
let u = O;
function He(t, e) {
  return { label: t, type: e, boost: -1 };
}
i(He, "defaultKeyword");
function Je(t, e = !1, a) {
  return Ge(t.dialect.words, e, a || He);
}
i(Je, "keywordCompletionSource");
function et(t) {
  return t.schema ? Fe(t.schema, t.tables, t.schemas, t.defaultTable, t.defaultSchema, t.dialect || X) : () => null;
}
i(et, "schemaCompletionSource");
function tt(t) {
  return t.schema ? (t.dialect || X).language.data.of({
    autocomplete: et(t)
  }) : [];
}
i(tt, "schemaCompletion");
function it(t = {}) {
  let e = t.dialect || X;
  return new oe(e.language, [
    tt(t),
    e.language.data.of({
      autocomplete: Je(e, t.upperCaseKeywords, t.keywordCompletion)
    })
  ]);
}
i(it, "sql");
const X = /* @__PURE__ */ u.define({}), st = /* @__PURE__ */ u.define({
  charSetCasts: !0,
  doubleDollarQuotedStrings: !0,
  operatorChars: "+-*/<>=~!@#%^&|`?",
  specialVar: "",
  keywords: b + "abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes",
  types: y + "bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml"
}), ee = "accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill", te = y + "bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed", re = "charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee", ot = /* @__PURE__ */ u.define({
  operatorChars: "*+-%<>!=&|^",
  charSetCasts: !0,
  doubleQuotedStrings: !0,
  unquotedBitLiterals: !0,
  hashComments: !0,
  spaceAfterDashes: !0,
  specialVar: "@?",
  identifierQuotes: "`",
  keywords: b + "group_concat " + ee,
  types: te,
  builtin: re
}), lt = /* @__PURE__ */ u.define({
  operatorChars: "*+-%<>!=&|^",
  charSetCasts: !0,
  doubleQuotedStrings: !0,
  unquotedBitLiterals: !0,
  hashComments: !0,
  spaceAfterDashes: !0,
  specialVar: "@?",
  identifierQuotes: "`",
  keywords: b + "always generated groupby_concat hard persistent shutdown soft virtual " + ee,
  types: te,
  builtin: re
});
let rt = (
  // Aggregate https://msdn.microsoft.com/en-us/library/ms173454.aspx
  "approx_count_distinct approx_percentile_cont approx_percentile_disc avg checksum_agg count count_big grouping grouping_id max min product stdev stdevp sum var varp ai_generate_embeddings ai_generate_chunks cume_dist first_value lag last_value lead percentile_cont percentile_disc percent_rank left_shift right_shift bit_count get_bit set_bit collationproperty tertiary_weights @@datefirst @@dbts @@langid @@language @@lock_timeout @@max_connections @@max_precision @@nestlevel @@options @@remserver @@servername @@servicename @@spid @@textsize @@version cast convert parse try_cast try_convert try_parse asymkey_id asymkeyproperty certproperty cert_id crypt_gen_random decryptbyasymkey decryptbycert decryptbykey decryptbykeyautoasymkey decryptbykeyautocert decryptbypassphrase encryptbyasymkey encryptbycert encryptbykey encryptbypassphrase hashbytes is_objectsigned key_guid key_id key_name signbyasymkey signbycert symkeyproperty verifysignedbycert verifysignedbyasymkey @@cursor_rows @@fetch_status cursor_status datalength ident_current ident_incr ident_seed identity sql_variant_property @@datefirst current_timestamp current_timezone current_timezone_id date_bucket dateadd datediff datediff_big datefromparts datename datepart datetime2fromparts datetimefromparts datetimeoffsetfromparts datetrunc day eomonth getdate getutcdate isdate month smalldatetimefromparts switchoffset sysdatetime sysdatetimeoffset sysutcdatetime timefromparts todatetimeoffset year edit_distance edit_distance_similarity jaro_winkler_distance jaro_winkler_similarity edge_id_from_parts graph_id_from_edge_id graph_id_from_node_id node_id_from_parts object_id_from_edge_id object_id_from_node_id json isjson json_array json_contains json_modify json_object json_path_exists json_query json_value regexp_like regexp_replace regexp_substr regexp_instr regexp_count regexp_matches regexp_split_to_table abs acos asin atan atn2 ceiling cos cot degrees exp floor log log10 pi power radians rand round sign sin sqrt square tan choose greatest iif least @@procid app_name applock_mode applock_test assemblyproperty col_length col_name columnproperty databasepropertyex db_id db_name file_id file_idex file_name filegroup_id filegroup_name filegroupproperty fileproperty filepropertyex fulltextcatalogproperty fulltextserviceproperty index_col indexkey_property indexproperty next value for object_definition object_id object_name object_schema_name objectproperty objectpropertyex original_db_name parsename schema_id schema_name scope_identity serverproperty stats_date type_id type_name typeproperty dense_rank ntile rank row_number publishingservername certenclosed certprivatekey current_user database_principal_id has_dbaccess has_perms_by_name is_member is_rolemember is_srvrolemember loginproperty original_login permissions pwdencrypt pwdcompare session_user sessionproperty suser_id suser_name suser_sid suser_sname system_user user user_id user_name ascii char charindex concat concat_ws difference format left len lower ltrim nchar patindex quotename replace replicate reverse right rtrim soundex space str string_agg string_escape stuff substring translate trim unicode upper $partition @@error @@identity @@pack_received @@rowcount @@trancount binary_checksum checksum compress connectionproperty context_info current_request_id current_transaction_id decompress error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big session_context xact_state @@connections @@cpu_busy @@idle @@io_busy @@pack_sent @@packet_errors @@timeticks @@total_errors @@total_read @@total_write textptr textvalid columns_updated eventdata trigger_nestlevel vector_distance vectorproperty vector_search generate_series opendatasource openjson openquery openrowset openxml predict string_split coalesce nullif apply catch filter force include keep keepfixed modify optimize parameterization parameters partition recompile sequence set"
);
const ct = /* @__PURE__ */ u.define({
  keywords: b + // Reserved Keywords https://learn.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql?view=sql-server-ver17
  "add external procedure all fetch public alter file raiserror and fillfactor read any for readtext as foreign reconfigure asc freetext references authorization freetexttable replication backup from restore begin full restrict between function return break goto revert browse grant revoke bulk group right by having rollback cascade holdlock rowcount case identity rowguidcol check identity_insert rule checkpoint identitycol save close if schema clustered in securityaudit coalesce index select collate inner semantickeyphrasetable column insert semanticsimilaritydetailstable commit intersect semanticsimilaritytable compute into session_user constraint is set contains join setuser containstable key shutdown continue kill some convert left statistics create like system_user cross lineno table current load tablesample current_date merge textsize current_time national then current_timestamp nocheck to current_user nonclustered top cursor not tran database null transaction dbcc nullif trigger deallocate of truncate declare off try_convert default offsets tsequal delete on union deny open unique desc opendatasource unpivot disk openquery update distinct openrowset updatetext distributed openxml use double option user drop or values dump order varying else outer view end over waitfor errlvl percent when escape pivot where except plan while exec precision with execute primary within group exists print writetext exit proc noexpand index forceseek forcescan holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot spatial_window_max_cells tablock tablockx updlock xlock keepidentity keepdefaults ignore_constraints ignore_triggers",
  types: y + "smalldatetime datetimeoffset datetime2 datetime bigint smallint smallmoney tinyint money real text nvarchar ntext varbinary image hierarchyid uniqueidentifier sql_variant xml",
  builtin: rt,
  operatorChars: "*+-%<>!=^&|/",
  specialVar: "@",
  identifierQuotes: '"['
}), dt = /* @__PURE__ */ u.define({
  keywords: b + "abort analyze attach autoincrement conflict database detach exclusive fail glob ignore index indexed instead isnull notnull offset plan pragma query raise regexp reindex rename replace temp vacuum virtual",
  types: y + "bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int2 int8 unsigned signed real",
  builtin: "auth backup bail changes clone databases dbinfo dump echo eqp explain fullschema headers help import imposter indexes iotrace lint load log mode nullvalue once print prompt quit restore save scanstats separator shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width",
  operatorChars: "*+-%<>!=&|/~",
  identifierQuotes: '`"',
  specialVar: "@:?$"
}), mt = /* @__PURE__ */ u.define({
  keywords: "add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime infinity NaN",
  types: y + "ascii bigint blob counter frozen inet list map static text timeuuid tuple uuid varint",
  slashComments: !0
}), ut = /* @__PURE__ */ u.define({
  keywords: b + "abort accept access add all alter and any arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body by case cast char_base check close cluster clusters colauth column comment commit compress connected constant constraint crash create current currval cursor data_base database dba deallocate debugoff debugon declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry exception exception_init exchange exclusive exists external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base of off offline on online only option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw rebuild record ref references refresh rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work",
  builtin: "appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define echo editfile embedded feedback flagger flush heading headsep instance linesize lno loboffset logsource longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar repfooter repheader serveroutput shiftinout show showmode spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout timing trimout trimspool ttitle underline verify version wrap",
  types: y + "ascii bfile bfilename bigserial bit blob dec long number nvarchar nvarchar2 serial smallint string text uid varchar2 xml",
  operatorChars: "*/+-%<>!=~",
  doubleQuotedStrings: !0,
  charSetCasts: !0,
  plsqlQuotingMechanism: !0
});
export {
  mt as Cassandra,
  ct as MSSQL,
  lt as MariaSQL,
  ot as MySQL,
  ut as PLSQL,
  st as PostgreSQL,
  u as SQLDialect,
  dt as SQLite,
  X as StandardSQL,
  Je as keywordCompletionSource,
  et as schemaCompletionSource,
  it as sql
};
