import {
  a as n,
  c as k
} from "./chunk-IO47FP3U.js";

// ../node_modules/refractor/lang/qsharp.js
var v = k((x, f) => {
  f.exports = u;
  u.displayName = "qsharp";
  u.aliases = ["qs"];
  function u(o) {
    (function(r) {
      function s(e, a) {
        return e.replace(/<<(\d+)>>/g, function(i, q) {
          return "(?:" + a[+q] + ")";
        });
      }
      n(s, "replace");
      function t(e, a, i) {
        return RegExp(s(e, a), i || "");
      }
      n(t, "re");
      function h(e, a) {
        for (var i = 0; i < a; i++)
          e = e.replace(/<<self>>/g, function() {
            return "(?:" + e + ")";
          });
        return e.replace(/<<self>>/g, "[^\\s\\S]");
      }
      n(h, "nested");
      var l = {
        // keywords which represent a return or variable type
        type: "Adj BigInt Bool Ctl Double false Int One Pauli PauliI PauliX PauliY PauliZ Qubit Range Result String true Unit Zero",
        // all other keywords
        other: "Adjoint adjoint apply as auto body borrow borrowing Controlled controlled distribute elif else fail fixup for function if in internal intrinsic invert is let mutable namespace new newtype open operation repeat return self set until use using while within"
      };
      function y(e) {
        return "\\b(?:" + e.trim().replace(/ /g, "|") + ")\\b";
      }
      n(y, "keywordsToPattern");
      var p = RegExp(
        y(l.type + " " + l.other)
      ), w = /\b[A-Za-z_]\w*\b/.source, d = s(/<<0>>(?:\s*\.\s*<<0>>)*/.source, [w]), g = {
        keyword: p,
        punctuation: /[<>()?,.:[\]]/
      }, c = /"(?:\\.|[^\\"])*"/.source;
      r.languages.qsharp = r.languages.extend("clike", {
        comment: /\/\/.*/,
        string: [
          {
            pattern: t(/(^|[^$\\])<<0>>/.source, [c]),
            lookbehind: !0,
            greedy: !0
          }
        ],
        "class-name": [
          {
            // open Microsoft.Quantum.Canon;
            // open Microsoft.Quantum.Canon as CN;
            pattern: t(/(\b(?:as|open)\s+)<<0>>(?=\s*(?:;|as\b))/.source, [
              d
            ]),
            lookbehind: !0,
            inside: g
          },
          {
            // namespace Quantum.App1;
            pattern: t(/(\bnamespace\s+)<<0>>(?=\s*\{)/.source, [d]),
            lookbehind: !0,
            inside: g
          }
        ],
        keyword: p,
        number: /(?:\b0(?:x[\da-f]+|b[01]+|o[0-7]+)|(?:\B\.\d+|\b\d+(?:\.\d*)?)(?:e[-+]?\d+)?)l?\b/i,
        operator: /\band=|\bor=|\band\b|\bnot\b|\bor\b|<[-=]|[-=]>|>>>=?|<<<=?|\^\^\^=?|\|\|\|=?|&&&=?|w\/=?|~~~|[*\/+\-^=!%]=?/,
        punctuation: /::|[{}[\];(),.:]/
      }), r.languages.insertBefore("qsharp", "number", {
        range: {
          pattern: /\.\./,
          alias: "operator"
        }
      });
      var b = h(
        s(/\{(?:[^"{}]|<<0>>|<<self>>)*\}/.source, [c]),
        2
      );
      r.languages.insertBefore("qsharp", "string", {
        "interpolation-string": {
          pattern: t(/\$"(?:\\.|<<0>>|[^\\"{])*"/.source, [b]),
          greedy: !0,
          inside: {
            interpolation: {
              pattern: t(/((?:^|[^\\])(?:\\\\)*)<<0>>/.source, [
                b
              ]),
              lookbehind: !0,
              inside: {
                punctuation: /^\{|\}$/,
                expression: {
                  pattern: /[\s\S]+/,
                  alias: "language-qsharp",
                  inside: r.languages.qsharp
                }
              }
            },
            string: /[\s\S]+/
          }
        }
      });
    })(o), o.languages.qs = o.languages.qsharp;
  }
  n(u, "qsharp");
});

export {
  v as a
};
