var atoms = [
  "exten",
  "same",
  "include",
  "ignorepat",
  "switch"
], dpcmd = ["#include", "#exec"], apps = /* @__PURE__ */ "addqueuemember.adsiprog.aelsub.agentlogin.agentmonitoroutgoing.agi.alarmreceiver.amd.answer.authenticate.background.backgrounddetect.bridge.busy.callcompletioncancel.callcompletionrequest.celgenuserevent.changemonitor.chanisavail.channelredirect.chanspy.clearhash.confbridge.congestion.continuewhile.controlplayback.dahdiacceptr2call.dahdibarge.dahdiras.dahdiscan.dahdisendcallreroutingfacility.dahdisendkeypadfacility.datetime.dbdel.dbdeltree.deadagi.dial.dictate.directory.disa.dumpchan.eagi.echo.endwhile.exec.execif.execiftime.exitwhile.extenspy.externalivr.festival.flash.followme.forkcdr.getcpeid.gosub.gosubif.goto.gotoif.gotoiftime.hangup.iax2provision.ices.importvar.incomplete.ivrdemo.jabberjoin.jabberleave.jabbersend.jabbersendgroup.jabberstatus.jack.log.macro.macroexclusive.macroexit.macroif.mailboxexists.meetme.meetmeadmin.meetmechanneladmin.meetmecount.milliwatt.minivmaccmess.minivmdelete.minivmgreet.minivmmwi.minivmnotify.minivmrecord.mixmonitor.monitor.morsecode.mp3player.mset.musiconhold.nbscat.nocdr.noop.odbc.odbc.odbcfinish.originate.ospauth.ospfinish.osplookup.ospnext.page.park.parkandannounce.parkedcall.pausemonitor.pausequeuemember.pickup.pickupchan.playback.playtones.privacymanager.proceeding.progress.queue.queuelog.raiseexception.read.readexten.readfile.receivefax.receivefax.receivefax.record.removequeuemember.resetcdr.retrydial.return.ringing.sayalpha.saycountedadj.saycountednoun.saycountpl.saydigits.saynumber.sayphonetic.sayunixtime.senddtmf.sendfax.sendfax.sendfax.sendimage.sendtext.sendurl.set.setamaflags.setcallerpres.setmusiconhold.sipaddheader.sipdtmfmode.sipremoveheader.skel.slastation.slatrunk.sms.softhangup.speechactivategrammar.speechbackground.speechcreate.speechdeactivategrammar.speechdestroy.speechloadgrammar.speechprocessingsound.speechstart.speechunloadgrammar.stackpop.startmusiconhold.stopmixmonitor.stopmonitor.stopmusiconhold.stopplaytones.system.testclient.testserver.transfer.tryexec.trysystem.unpausemonitor.unpausequeuemember.userevent.verbose.vmauthenticate.vmsayname.voicemail.voicemailmain.wait.waitexten.waitfornoise.waitforring.waitforsilence.waitmusiconhold.waituntil.while.zapateller".split(".");
function basicToken(n, r) {
  var i = "", a = n.next();
  if (r.blockComment) return a == "-" && n.match("-;", true) ? r.blockComment = false : n.skipTo("--;") ? (n.next(), n.next(), n.next(), r.blockComment = false) : n.skipToEnd(), "comment";
  if (a == ";") return n.match("--", true) && !n.match("-", false) ? (r.blockComment = true, "comment") : (n.skipToEnd(), "comment");
  if (a == "[") return n.skipTo("]"), n.eat("]"), "header";
  if (a == '"') return n.skipTo('"'), "string";
  if (a == "'") return n.skipTo("'"), "string.special";
  if (a == "#" && (n.eatWhile(/\w/), i = n.current(), dpcmd.indexOf(i) !== -1)) return n.skipToEnd(), "strong";
  if (a == "$" && n.peek() == "{") return n.skipTo("}"), n.eat("}"), "variableName.special";
  if (n.eatWhile(/\w/), i = n.current(), atoms.indexOf(i) !== -1) {
    switch (r.extenStart = true, i) {
      case "same":
        r.extenSame = true;
        break;
      case "include":
      case "switch":
      case "ignorepat":
        r.extenInclude = true;
        break;
      default:
        break;
    }
    return "atom";
  }
}
const asterisk = {
  name: "asterisk",
  startState: function() {
    return {
      blockComment: false,
      extenStart: false,
      extenSame: false,
      extenInclude: false,
      extenExten: false,
      extenPriority: false,
      extenApplication: false
    };
  },
  token: function(e, t) {
    var i = "";
    if (e.eatSpace()) return null;
    if (t.extenStart) return e.eatWhile(/[^\s]/), i = e.current(), /^=>?$/.test(i) ? (t.extenExten = true, t.extenStart = false, "strong") : (t.extenStart = false, e.skipToEnd(), "error");
    if (t.extenExten) return t.extenExten = false, t.extenPriority = true, e.eatWhile(/[^,]/), t.extenInclude && (t.extenInclude = (e.skipToEnd(), t.extenPriority = false, false)), t.extenSame && (t.extenPriority = false, t.extenSame = false, t.extenApplication = true), "tag";
    if (t.extenPriority) return t.extenPriority = false, t.extenApplication = true, e.next(), t.extenSame ? null : (e.eatWhile(/[^,]/), "number");
    if (t.extenApplication) {
      if (e.eatWhile(/,/), i = e.current(), i === ",") return null;
      if (e.eatWhile(/\w/), i = e.current().toLowerCase(), t.extenApplication = false, apps.indexOf(i) !== -1) return "def";
    } else return basicToken(e, t);
    return null;
  },
  languageData: { commentTokens: {
    line: ";",
    block: {
      open: ";--",
      close: "--;"
    }
  } }
};
export {
  asterisk
};
