var e=function(e,t){var n=t.next||`start`;if(n){t.next=t.next;var r=a[n];if(r.splice){for(var i=0;i<r.length;++i){var o=r[i];if(o.regex&&e.match(o.regex))return t.next=o.next||t.next,o.token}return e.next(),`error`}if(e.match(o=a[n]))return o.regex&&e.match(o.regex)?(t.next=o.next,o.token):(e.next(),`error`)}return e.next(),`error`},t=`(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*`,n=RegExp(`(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*`+t+`)?))\\s*$`),r=`(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))`,i={token:`string`,regex:`.+`},a={start:[{token:`docComment`,regex:`/\\*`,next:`comment`},{token:`comment`,regex:`#.*`},{token:`keyword`,regex:`(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)`+r},{token:`atom`,regex:`(?:true|false|yes|no|on|off|null|void|undefined)`+r},{token:`invalid`,regex:`(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)`+r},{token:`className.standard`,regex:`(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)`+r},{token:`variableName.function.standard`,regex:`(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)`+r},{token:`variableName.standard`,regex:`(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)`+r},{token:`variableName`,regex:t+`\\s*:(?![:=])`},{token:`variableName`,regex:t},{token:`operatorKeyword`,regex:`(?:\\.{3}|\\s+\\?)`},{token:`keyword`,regex:`(?:@+|::|\\.\\.)`,next:`key`},{token:`operatorKeyword`,regex:`\\.\\s*`,next:`key`},{token:`string`,regex:`\\\\\\S[^\\s,;)}\\]]*`},{token:`docString`,regex:`'''`,next:`qdoc`},{token:`docString`,regex:`"""`,next:`qqdoc`},{token:`string`,regex:`'`,next:`qstring`},{token:`string`,regex:`"`,next:`qqstring`},{token:`string`,regex:"`",next:`js`},{token:`string`,regex:`<\\[`,next:`words`},{token:`regexp`,regex:`//`,next:`heregex`},{token:`regexp`,regex:`\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}`,next:`key`},{token:`number`,regex:`(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)`},{token:`paren`,regex:`[({[]`},{token:`paren`,regex:`[)}\\]]`,next:`key`},{token:`operatorKeyword`,regex:`\\S+`},{token:`content`,regex:`\\s+`}],heregex:[{token:`regexp`,regex:`.*?//[gimy$?]{0,4}`,next:`start`},{token:`regexp`,regex:`\\s*#{`},{token:`comment`,regex:`\\s+(?:#.*)?`},{token:`regexp`,regex:`\\S+`}],key:[{token:`operatorKeyword`,regex:`[.?@!]+`},{token:`variableName`,regex:t,next:`start`},{token:`content`,regex:``,next:`start`}],comment:[{token:`docComment`,regex:`.*?\\*/`,next:`start`},{token:`docComment`,regex:`.+`}],qdoc:[{token:`string`,regex:`.*?'''`,next:`key`},i],qqdoc:[{token:`string`,regex:`.*?"""`,next:`key`},i],qstring:[{token:`string`,regex:`[^\\\\']*(?:\\\\.[^\\\\']*)*'`,next:`key`},i],qqstring:[{token:`string`,regex:`[^\\\\"]*(?:\\\\.[^\\\\"]*)*"`,next:`key`},i],js:[{token:`string`,regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:`key`},i],words:[{token:`string`,regex:`.*?\\]>`,next:`key`},i]};for(var o in a){var s=a[o];if(s.splice)for(var c=0,l=s.length;c<l;++c){var u=s[c];typeof u.regex==`string`&&(a[o][c].regex=RegExp(`^`+u.regex))}else typeof u.regex==`string`&&(a[o].regex=RegExp(`^`+s.regex))}const d={name:`livescript`,startState:function(){return{next:`start`,lastToken:{style:null,indent:0,content:``}}},token:function(t,n){for(;t.pos==t.start;)var r=e(t,n);return n.lastToken={style:r,indent:t.indentation(),content:t.current()},r.replace(/\./g,` `)},indent:function(e){var t=e.lastToken.indent;return e.lastToken.content.match(n)&&(t+=2),t}};export{d as liveScript};