!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("jinja2",function(){var e=["and","as","block","endblock","by","cycle","debug","else","elif","extends","filter","endfilter","firstof","do","for","endfor","if","endif","ifchanged","endifchanged","ifequal","endifequal","ifnotequal","set","raw","endraw","endifnotequal","in","include","load","not","now","or","parsed","regroup","reversed","spaceless","call","endcall","macro","endmacro","endspaceless","ssi","templatetag","openblock","closeblock","openvariable","closevariable","without","context","openbrace","closebrace","opencomment","closecomment","widthratio","url","with","endwith","get_current_language","trans","endtrans","noop","blocktrans","endblocktrans","get_available_languages","get_current_language_bidi","pluralize","autoescape","endautoescape"],n=/^[+\-*&%=<>!?|~^]/,t=/^[:\[\(\{]/,i=["true","false"],r=/^(\d[+\-\*\/])?\d+(\.\d+)?/;function a(a,o){var c=a.peek();if(o.incomment)return a.skipTo("#}")?(a.eatWhile(/\#|}/),o.incomment=!1):a.skipToEnd(),"comment";if(o.intag){if(o.operator){if(o.operator=!1,a.match(i))return"atom";if(a.match(r))return"number"}if(o.sign){if(o.sign=!1,a.match(i))return"atom";if(a.match(r))return"number"}if(o.instring)return c==o.instring&&(o.instring=!1),a.next(),"string";if("'"==c||'"'==c)return o.instring=c,a.next(),"string";if(o.inbraces>0&&")"==c)a.next(),o.inbraces--;else if("("==c)a.next(),o.inbraces++;else if(o.inbrackets>0&&"]"==c)a.next(),o.inbrackets--;else if("["==c)a.next(),o.inbrackets++;else{if(!o.lineTag&&(a.match(o.intag+"}")||a.eat("-")&&a.match(o.intag+"}")))return o.intag=!1,"tag";if(a.match(n))return o.operator=!0,"operator";if(a.match(t))o.sign=!0;else{if(1==a.column()&&o.lineTag&&a.match(e))return"keyword";if(a.eat(" ")||a.sol()){if(a.match(e))return"keyword";if(a.match(i))return"atom";if(a.match(r))return"number";a.sol()&&a.next()}else a.next()}}return"variable"}if(a.eat("{")){if(a.eat("#"))return o.incomment=!0,a.skipTo("#}")?(a.eatWhile(/\#|}/),o.incomment=!1):a.skipToEnd(),"comment";if(c=a.eat(/\{|%/))return o.intag=c,o.inbraces=0,o.inbrackets=0,"{"==c&&(o.intag="}"),a.eat("-"),"tag"}else if(a.eat("#")){if("#"==a.peek())return a.skipToEnd(),"comment";if(!a.eol())return o.intag=!0,o.lineTag=!0,o.inbraces=0,o.inbrackets=0,"tag"}a.next()}return e=new RegExp("(("+e.join(")|(")+"))\\b"),i=new RegExp("(("+i.join(")|(")+"))\\b"),{startState:function(){return{tokenize:a,inbrackets:0,inbraces:0}},token:function(e,n){var t=n.tokenize(e,n);return e.eol()&&n.lineTag&&!n.instring&&0==n.inbraces&&0==n.inbrackets&&(n.intag=!1,n.lineTag=!1),t},blockCommentStart:"{#",blockCommentEnd:"#}",lineComment:"##"}}),e.defineMIME("text/jinja2","jinja2")});