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

// ../node_modules/highlight.js/lib/languages/handlebars.js
var L = P((f, m) => {
  function T(e) {
    return e ? typeof e == "string" ? e : e.source : null;
  }
  n(T, "source");
  function H(e) {
    return E("(", e, ")*");
  }
  n(H, "anyNumberOfTimes");
  function M(e) {
    return E("(", e, ")?");
  }
  n(M, "optional");
  function E(...e) {
    return e.map((a) => T(a)).join("");
  }
  n(E, "concat");
  function p(...e) {
    return "(" + e.map((a) => T(a)).join("|") + ")";
  }
  n(p, "either");
  function D(e) {
    let t = {
      "builtin-name": [
        "action",
        "bindattr",
        "collection",
        "component",
        "concat",
        "debugger",
        "each",
        "each-in",
        "get",
        "hash",
        "if",
        "in",
        "input",
        "link-to",
        "loc",
        "log",
        "lookup",
        "mut",
        "outlet",
        "partial",
        "query-params",
        "render",
        "template",
        "textarea",
        "unbound",
        "unless",
        "view",
        "with",
        "yield"
      ]
    }, a = {
      literal: [
        "true",
        "false",
        "undefined",
        "null"
      ]
    }, d = /""|"[^"]+"/, A = /''|'[^']+'/, c = /\[\]|\[[^\]]+\]/, r = /[^\s!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/, R = /(\.|\/)/, _ = p(
      d,
      A,
      c,
      r
    ), I = E(
      M(/\.|\.\/|\//),
      // relative or absolute path
      _,
      H(E(
        R,
        _
      ))
    ), O = E(
      "(",
      c,
      "|",
      r,
      ")(?==)"
    ), s = {
      begin: I,
      lexemes: /[\w.\/]+/
    }, N = e.inherit(s, {
      keywords: a
    }), i = {
      begin: /\(/,
      end: /\)/
      // the "contains" is added below when all necessary sub-modes are defined
    }, b = {
      // fka "attribute-assignment", parameters of the form 'key=value'
      className: "attr",
      begin: O,
      relevance: 0,
      starts: {
        begin: /=/,
        end: /=/,
        starts: {
          contains: [
            e.NUMBER_MODE,
            e.QUOTE_STRING_MODE,
            e.APOS_STRING_MODE,
            N,
            i
          ]
        }
      }
    }, g = {
      // parameters of the form '{{#with x as | y |}}...{{/with}}'
      begin: /as\s+\|/,
      keywords: {
        keyword: "as"
      },
      end: /\|/,
      contains: [
        {
          // define sub-mode in order to prevent highlighting of block-parameter named "as"
          begin: /\w+/
        }
      ]
    }, o = {
      contains: [
        e.NUMBER_MODE,
        e.QUOTE_STRING_MODE,
        e.APOS_STRING_MODE,
        g,
        b,
        N,
        i
      ],
      returnEnd: !0
      // the property "end" is defined through inheritance when the mode is used. If depends
      // on the surrounding mode, but "endsWithParent" does not work here (i.e. it includes the
      // end-token of the surrounding mode)
    }, C = e.inherit(s, {
      className: "name",
      keywords: t,
      starts: e.inherit(o, {
        end: /\)/
      })
    });
    i.contains = [C];
    let S = e.inherit(s, {
      keywords: t,
      className: "name",
      starts: e.inherit(o, {
        end: /\}\}/
      })
    }), l = e.inherit(s, {
      keywords: t,
      className: "name"
    }), u = e.inherit(s, {
      className: "name",
      keywords: t,
      starts: e.inherit(o, {
        end: /\}\}/
      })
    });
    return {
      name: "Handlebars",
      aliases: [
        "hbs",
        "html.hbs",
        "html.handlebars",
        "htmlbars"
      ],
      case_insensitive: !0,
      subLanguage: "xml",
      contains: [
        {
          begin: /\\\{\{/,
          skip: !0
        },
        {
          begin: /\\\\(?=\{\{)/,
          skip: !0
        },
        e.COMMENT(/\{\{!--/, /--\}\}/),
        e.COMMENT(/\{\{!/, /\}\}/),
        {
          // open raw block "{{{{raw}}}} content not evaluated {{{{/raw}}}}"
          className: "template-tag",
          begin: /\{\{\{\{(?!\/)/,
          end: /\}\}\}\}/,
          contains: [S],
          starts: {
            end: /\{\{\{\{\//,
            returnEnd: !0,
            subLanguage: "xml"
          }
        },
        {
          // close raw block
          className: "template-tag",
          begin: /\{\{\{\{\//,
          end: /\}\}\}\}/,
          contains: [l]
        },
        {
          // open block statement
          className: "template-tag",
          begin: /\{\{#/,
          end: /\}\}/,
          contains: [S]
        },
        {
          className: "template-tag",
          begin: /\{\{(?=else\}\})/,
          end: /\}\}/,
          keywords: "else"
        },
        {
          className: "template-tag",
          begin: /\{\{(?=else if)/,
          end: /\}\}/,
          keywords: "else if"
        },
        {
          // closing block statement
          className: "template-tag",
          begin: /\{\{\//,
          end: /\}\}/,
          contains: [l]
        },
        {
          // template variable or helper-call that is NOT html-escaped
          className: "template-variable",
          begin: /\{\{\{/,
          end: /\}\}\}/,
          contains: [u]
        },
        {
          // template variable or helper-call that is html-escaped
          className: "template-variable",
          begin: /\{\{/,
          end: /\}\}/,
          contains: [u]
        }
      ]
    };
  }
  n(D, "handlebars");
  m.exports = D;
});

export {
  L as a
};
