text: // This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
  RegExp.prototype.indexOf||(RegExp.indexOf=function(a,b){return a[0].indexOf(a[b])+a.index});RegExp.prototype.escape||(RegExp.escape=function(a){return a.replace(/[\-\[\]{}()*+?.\\\^$|,#\s]/g,"\\$&")});String.prototype.repeat||(String.prototype.repeat=function(a){return Array(a+1).join(this)});Syntax.innerText=function(a){var b;if(!a)return"";if("BR"==a.nodeName)return"\n";a.textContent?b=a.textContent:document.body.innerText&&(b=a.innerText);return b.replace(/\r\n?/g,"\n")};
  Syntax.extractTextFromSelection=function(a){for(var b="",c=0;c<a.rangeCount;c+=1)var d=a.getRangeAt(c).toString(),b=b+d;return b};Syntax.copyCode=function(a){var b=window.getSelection(),b=Syntax.extractTextFromSelection(b);a.clipboardData.setData("text/plain",b);return!1};
  Syntax.extractElementMatches=function(a,b){var c=[];b=b||0;(function(a){for(var e=0;a[e];e++){var f=null,g=a[e];3===g.nodeType||4===g.nodeType?b+=g.nodeValue.length:1===g.nodeType&&(f=Syntax.innerText(g),c.push(new Syntax.Match(b,f.length,{klass:g.className,force:!0,element:g,allow:"*"},f)));8!==g.nodeType&&g.children&&arguments.callee(g.childNodes,b)}})(a);c.shift();return c};
  Syntax.extractMatches=function(){var a=arguments;return function(b,c){for(var d=[],e=0;e<a.length;e+=1){var f=a[e],g=e+1;null!=f&&("undefined"!=typeof f.index&&(g=f.index),f.debug&&console.log("extractMatches",f,g,b[g],b),0<b[g].length&&(f.brush?d.push(Syntax.Brush.buildTree(f,b[g],RegExp.indexOf(b,g))):(f=jQuery.extend({owner:c.owner},f),d.push(new Syntax.Match(RegExp.indexOf(b,g),b[g].length,f,b[g])))))}return d}};
  Syntax.lib.webLinkProcess=function(a,b){b&&(a="http://www.google.com/search?btnI=I&q="+encodeURIComponent(a+" "));return function(b,d,e){if(!1===e.linkify)return b;d=document.createElement("a");d.href=a+encodeURIComponent(Syntax.innerText(b));for(d.className=b.className;0<b.childNodes.length;)d.appendChild(b.childNodes[0]);return d}};Syntax.register=function(a,b){var c=Syntax.brushes[a]=new Syntax.Brush;c.klass=a;b(c)};Syntax.lib.cStyleComment={pattern:/\/\*[\s\S]*?\*\//gm,klass:"comment",allow:["href"]};
  Syntax.lib.cppStyleComment={pattern:/\/\/.*$/gm,klass:"comment",allow:["href"]};Syntax.lib.perlStyleComment={pattern:/#.*$/gm,klass:"comment",allow:["href"]};Syntax.lib.perlStyleRegularExpression={pattern:/\B\/([^\\\/]|\\.)*\/[a-z]*(?=\s*($|[^\w\s'"\(]))/gm,klass:"constant",incremental:!0};Syntax.lib.rubyStyleRegularExpression={pattern:/\B\/([^\\\/]|\\.)*\/[a-z]*(?=\s*($|[^\w\s'"\(]|do))/gm,klass:"constant",incremental:!0};Syntax.lib.cStyleFunction={pattern:/([a-z_][a-z0-9_]*)\s*\(/gi,matches:Syntax.extractMatches({klass:"function"})};
  Syntax.lib.camelCaseType={pattern:/\b_*[A-Z][\w]*\b/g,klass:"type"};Syntax.lib.cStyleType={pattern:/\b[_a-z][_\w]*_t\b/gi,klass:"type"};Syntax.lib.xmlComment={pattern:/(&lt;|<)!--[\s\S]*?--(&gt;|>)/gm,klass:"comment"};Syntax.lib.webLink={pattern:/\w+:\/\/[\w\-.\/?%&=@:;#]*/g,klass:"href"};Syntax.lib.hexNumber={pattern:/\b0x[0-9a-fA-F]+/g,klass:"constant"};Syntax.lib.decimalNumber={pattern:/\b[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/g,klass:"constant"};
  Syntax.lib.doubleQuotedString={pattern:/"([^\\"\n]|\\.)*"/g,klass:"string"};Syntax.lib.singleQuotedString={pattern:/'([^\\'\n]|\\.)*'/g,klass:"string"};Syntax.lib.multiLineDoubleQuotedString={pattern:/"([^\\"]|\\.)*"/g,klass:"string"};Syntax.lib.multiLineSingleQuotedString={pattern:/'([^\\']|\\.)*'/g,klass:"string"};Syntax.lib.stringEscape={pattern:/\\./g,klass:"escape",only:["string"]};
  Syntax.Match=function(a,b,c,d){this.offset=a;this.endOffset=a+b;this.length=b;this.expression=c;this.value=d;this.children=[];this.next=this.parent=null};Syntax.Match.prototype.shift=function(a,b){this.adjust(a,null,b);for(var c=0;c<this.children.length;c++)this.children[c].shift(a,b)};Syntax.Match.prototype.adjust=function(a,b,c){this.offset+=a;this.endOffset+=a;b&&(this.length=b,this.endOffset=this.offset+b);c&&(this.value=c.substr(this.offset,this.length))};
  Syntax.Match.sort=function(a,b){return a.offset-b.offset||b.length-a.length};Syntax.Match.prototype.contains=function(a){return a.offset>=this.offset&&a.endOffset<=this.endOffset};Syntax.Match.defaultReduceCallback=function(a,b){"string"===typeof a&&(a=document.createTextNode(a));b.appendChild(a)};
  Syntax.Match.prototype.reduce=function(a,b){var c=this.offset,d=document.createElement("span");a=a||Syntax.Match.defaultReduceCallback;this.expression&&this.expression.klass&&(0<d.className.length&&(d.className+=" "),d.className+=this.expression.klass);this.className&&(d.className+=" ",d.className+=this.className);for(var e=0;e<this.children.length;e+=1){var f=this.children[e],g=f.offset;f.offset<this.offset&&console.log("Syntax Warning: Offset of child",f,"is before offset of parent",this);c=this.value.substr(c-
  this.offset,g-c);a(c,d);a(f.reduce(a,b),d);c=f.endOffset}c===this.offset?a(this.value,d):c<this.endOffset?a(this.value.substr(c-this.offset,this.endOffset-c),d):c>this.endOffset&&console.log("Syntax Warning: Start position "+c+" exceeds end of value "+this.endOffset);b&&(d=b(d,this));return d};
  Syntax.Match.prototype.canContain=function(a){return a.expression.force?!0:this.complete?!1:a.expression.only?!0:"undefined"===typeof this.expression.allow||jQuery.isArray(this.expression.disallow)&&-1!==jQuery.inArray(a.expression.klass,this.expression.disallow)?!1:"*"===this.expression.allow||jQuery.isArray(this.expression.allow)&&-1!==jQuery.inArray(a.expression.klass,this.expression.allow)?!0:!1};
  Syntax.Match.prototype.canHaveChild=function(a){if(a=a.expression.only){for(var b=this;null!==b;){if(-1!==jQuery.inArray(b.expression.klass,a))return!0;if((b=b.parent)&&b.complete)break}return!1}return!0};Syntax.Match.prototype._splice=function(a,b){return this.canHaveChild(b)?(this.children.splice(a,0,b),b.parent=this,b.expression.owner||(b.expression.owner=this.expression.owner),this):null};
  Syntax.Match.prototype.insert=function(a,b){if(!this.contains(a))return null;if(b){for(var c=this,d=0;d<c.children.length;)c.children[d].contains(a)?(c=c.children[d],d=0):d+=1;return c._insertWhole(a)}return this._insert(a)};
  Syntax.Match.prototype._insertWhole=function(a){var b=this.bisectAtOffsets([a.offset,a.endOffset]);this.children=[];b[0]&&(this.children=this.children.concat(b[0].children));if(b[1]){a.children=[];this.expression&&this.expression.owner&&(a.expression=this.expression.owner.getRuleForKlass(a.expression.klass)||a.expression);for(var c=0;c<b[1].children.length;c+=1){var d=b[1].children[c];a.canContain(d)&&a.children.push(d)}this.children.push(a)}b[2]&&(this.children=this.children.concat(b[2].children));
  return this};Syntax.Match.prototype.insertAtEnd=function(a){if(!this.contains(a))return console.log("Syntax Error: Child is not contained in parent node!"),null;if(!this.canContain(a))return null;if(0<this.children.length){var b=this.children.length-1,c=this.children[b];return a.offset<c.offset?a.force?this._insert(a):null:a.offset<c.endOffset?a.endOffset<=c.endOffset?c.insertAtEnd(a):a.force?this._insert(a):null:this._splice(b+1,a)}return this._splice(0,a)};
  Syntax.Match.prototype._insert=function(a){if(0==this.children.length)return this._splice(0,a);for(var b=0;b<this.children.length;b+=1){var c=this.children[b];if(a.endOffset<=c.offset)return this._splice(b,a);if(!(a.offset>=c.endOffset)){if(c.contains(a))return c._insert(a);a=a.bisectAtOffsets([c.offset,c.endOffset]);a[0]&&this._splice(b,a[0]);a[1]&&c.insert(a[1]);if(a[2])a=a[2];else return this}}this._splice(this.children.length,a)};
  Syntax.Match.prototype.bisectAtOffsets=function(a){var b=[],c=this.offset,d=null,e=jQuery.merge([],this.children);a=a.slice(0);a.push(this.endOffset);a.sort(function(a,b){return a-b});for(var f=0;f<a.length;f+=1){var g=a[f];if(g>this.endOffset)break;g<this.offset||0==g-c?(b.push(null),c=g):(c<this.offset&&(c=this.offset),g=new Syntax.Match(c,g-c,this.expression),g.value=this.value.substr(c-this.offset,g.length),d&&(d.next=g),d=g,c=g.endOffset,b.push(g))}a.length=b.length;for(f=0;f<b.length;f+=1)if(null!=
  b[f]){for(g=a[0];0<e.length;)if(e[0].endOffset<=b[f].endOffset)b[f].children.push(e.shift());else break;if(e.length&&e[0].offset<b[f].endOffset){c=e.shift().bisectAtOffsets(a);for(d=0;d<c.length;d+=1)null!=c[d]&&b[f+d].children.push(c[d]);f+=c.length-2;a.splice(0,c.length-2)}a.shift()}e.length&&console.log("Syntax Error: Children nodes not consumed",e.length," remaining!");return b};
  Syntax.Match.prototype.split=function(a){for(var b=[];null!==a.exec(this.value);)b.push(a.lastIndex);a=this.bisectAtOffsets(b);return jQuery.grep(a,function(a,b){return a})};
  Syntax.Match.prototype.splitLines=function(){for(var a=this.split(/\n/g),b=0;b<a.length;b+=1){var c=a[b],d=c.value.search(/\S/),e=new Syntax.Match(c.offset,c.length,c.expression,c.value);0<d?(c=c.bisectAtOffsets([c.offset+d]),e.children=c,c[0].expression={klass:"indent"},c[1].expression={klass:"text"}):(c.expression={klass:"text"},e.children=[c]);a[b]=e}return a};Syntax.Brush=function(){this.klass=null;this.rules=[];this.parents=[];this.processes={}};
  Syntax.Brush.prototype.derives=function(a){this.parents.push(a);this.rules.push({apply:function(b,c){return Syntax.brushes[a].getMatches(b)}})};Syntax.Brush.prototype.allKlasses=function(){for(var a=[this.klass],b=0;b<this.parents.length;b+=1)a=a.concat(Syntax.brushes[this.parents[b]].allKlasses());return a};Syntax.Brush.convertStringToTokenPattern=function(a,b){var c="\\b",d="\\b";a.match(/^\w/)?a.match(/\w$/)||(d="\\B"):c=a.match(/\w$/)?"\\B":d="";b&&(a=RegExp.escape(a));return c+a+d};
  Syntax.Brush.MatchPattern=function(a,b){if(!b.pattern)return[];var c=[],d=RegExp();for(d.compile(b.pattern);null!==(match=d.exec(a));)b.matches?c=c.concat(b.matches(match,b)):b.brush?c.push(Syntax.Brush.buildTree(b,match[0],match.index)):c.push(new Syntax.Match(match.index,match[0].length,b,match[0])),b.incremental&&(d.lastIndex=match.index+1);return c};
  Syntax.Brush.prototype.push=function(a,b){if(jQuery.isArray(a)){for(var c=b,d="(",e=0;e<a.length;e+=1){0<e&&(d+="|");var f=a[e],d=f instanceof RegExp?d+f.source:d+Syntax.Brush.convertStringToTokenPattern(f,!0)}this.push(jQuery.extend({pattern:RegExp(d+")",c.options||"g")},c))}else c=a,"string"===typeof c.pattern&&(c.string=c.pattern,c.pattern=RegExp(Syntax.Brush.convertStringToTokenPattern(c.string,!0),c.options||"g")),"undefined"!==typeof XRegExp&&(c.pattern=new XRegExp(c.pattern)),c.apply=c.apply||
  Syntax.Brush.MatchPattern,c.pattern&&c.pattern.global||"undefined"==typeof c.pattern?this.rules.push(jQuery.extend({owner:this},c)):console.log("Syntax Error: Malformed rule: ",c)};Syntax.Brush.prototype.getMatchesForRule=function(a,b){var c=[];"undefined"!=typeof b.apply&&(c=b.apply(a,b));b.debug&&console.log("Syntax matches:",b,a,c);return c};Syntax.Brush.prototype.getRuleForKlass=function(a){for(var b=0;b<this.rules.length;b+=1)if(this.rules[b].klass==a)return this.rules[b];return null};
  Syntax.Brush.prototype.getMatches=function(a){for(var b=[],c=0;c<this.rules.length;c+=1)b=b.concat(this.getMatchesForRule(a,this.rules[c]));return b};Syntax.Brush.buildTree=function(a,b,c,d){b=Syntax.brushes[a.brush].buildTree(b,c,d);jQuery.extend(b.expression,a);return b};
  Syntax.Brush.prototype.buildTree=function(a,b,c){b=b||0;a=a.replace(/\r/g,"");var d=this.getMatches(a);if(b&&0<b)for(var e=0;e<d.length;e+=1)d[e].shift(b);a=new Syntax.Match(b,a.length,{klass:this.allKlasses().join(" "),allow:"*",owner:this},a);d.sort(Syntax.Match.sort);for(e=0;e<d.length;e+=1)a.insertAtEnd(d[e]);if(c)for(e=0;e<c.length;e+=1)a.insert(c[e],!0);a.complete=!0;return a};
  Syntax.Brush.prototype.process=function(a,b,c){a=this.buildTree(a,0,b).splitLines();b=document.createElement("code");b.className="syntax highlighted";for(var d=0;d<a.length;d+=1){var e=a[d].reduce(null,function(a,b){if(b.expression&&(b.expression.process&&(a=b.expression.process(a,b,c)),b.expression.owner)){var d=b.expression.owner.processes[b.expression.klass];d&&(a=d(a,b,c))}return a});b.appendChild(e)}return b};
  Syntax.highlightText=function(a,b,c,d,e){b=(b||"plain").toLowerCase();b=Syntax.aliases[b]||b;Syntax.brushes.get(b,function(b){var g=b.process(a,c,d);d.linkify&&jQuery("span.href",g).each(function(){jQuery(this).replaceWith(jQuery("<a>").attr("href",this.innerHTML).text(this.innerHTML))});e(g,b,a,d)})};
  Syntax.extractBrushName=function(a){a=a.toLowerCase();var b=a.match(/(brush|language)-([\S]+)/);if(b)return b[2];a=a.split(/ /);if(-1!==jQuery.inArray("syntax",a))for(b=0;b<a.length;b+=1){var c=Syntax.aliases[a[b]];if(c)return c}return null};
  Syntax.highlight=function(a,b,c){a.each(function(){var a=jQuery(this),e=b.brush||Syntax.extractBrushName(this.className),f=Syntax.innerText(this),g=Syntax.extractElementMatches(a);b.matches&&Array.prototype.push(g,b.matches);Syntax.highlightText(f,e,g,b,function(e,f){e.oncopy=Syntax.copyCode;e=jQuery(e);if(b.theme){for(var g=Syntax.themes[b.theme],h=0;h<g.length;h+=1)e.addClass("syntax-theme-"+g[h]);e.addClass("syntax-theme-"+b.theme)}f.postprocess&&(e=f.postprocess(b,e,a));c&&(e=c(b,e,a));e&&!0===
  b.replace&&a.replaceWith(e)})})};Syntax.loader.core=!0;
  