(function(){function l(b){function e(a,c,d){if(a.text){var g=j?0:a.text.length-1,f=j?a.text.length:-1;for(null!=d&&(g=d+h);g!=f;g+=h)if(d=a.text.charAt(g),m.test(d)&&b.getTokenAt(i(c,g+1)).type==l){var e=o[d];if(">"==e.charAt(1)==j)p.push(d);else{if(p.pop()!=e.charAt(0))return{pos:g,match:!1};if(!p.length)return{pos:g,match:!0}}}}}var a=b.getCursor(),f=b.getLineHandle(a.line),d=a.ch-1,c=0<=d&&o[f.text.charAt(d)]||o[f.text.charAt(++d)];if(!c)return null;for(var j=">"==c.charAt(1),h=j?1:-1,l=b.getTokenAt(i(a.line, d+1)).type,p=[f.text.charAt(d)],m=/[(){}[\]]/,c=a.line,k,n=j?Math.min(c+100,b.lineCount()):Math.max(-1,c-100);c!=n&&!(k=c==a.line?e(f,c,d):e(b.getLineHandle(c),c));c+=h);return{from:i(a.line,d),to:k&&i(c,k.pos),match:k&&k.match}}function m(b,e){var a=l(b);if(a&&!(b.getLine(a.from.line).length>n||a.to&&b.getLine(a.to.line).length>n)){var f=a.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",d=b.markText(a.from,i(a.from.line,a.from.ch+1),{className:f}),c=a.to&&b.markText(a.to,i(a.to.line, a.to.ch+1),{className:f});r&&b.state.focused&&b.display.input.focus();a=function(){b.operation(function(){d.clear();c&&c.clear()})};if(e)setTimeout(a,800);else return a}}function q(b){b.operation(function(){h&&(h(),h=null);b.somethingSelected()||(h=m(b,!1))})}var r=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||8>document.documentMode),i=CodeMirror.Pos,n=1E3,o={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},h=null;CodeMirror.defineOption("matchBrackets",!1,function(b,e){if(e)b.on("cursorActivity", q);else b.off("cursorActivity",q)});CodeMirror.defineExtension("matchBrackets",function(){m(this,!0)});CodeMirror.defineExtension("findMatchingBracket",function(){return l(this)})})();