var tokenizeJavaScript=function(){function A(a,d){for(var b=false;!a.endOfLine();){var e=a.next();if(e==d&&!b)return false;b=!b&&e=="\\"}return b}function y(a,d){return function(b,e){var h=a,g=m(a,d,b,function(n){h=n}),i=g.type=="operator"||g.type=="keyword c"||g.type.match(/^[\[{}\(,;:]$/);if(i!=d||h!=a)e(y(h,i));return g}}function m(a,d,b,e){function h(){b.nextWhileMatches(f);var s=b.get(),t=q.hasOwnProperty(s)&&q.propertyIsEnumerable(s)&&q[s];return t?{type:t.type,style:t.style,content:s}:{type:"variable",
style:"js-variable",content:s}}function g(s){var t="/*";for(s=s=="*";;){if(b.endOfLine())break;var r=b.next();if(r=="/"&&s){t=null;break}s=r=="*"}e(t);return{type:"comment",style:"js-comment"}}function i(){b.nextWhileMatches(k);return{type:"operator",style:"js-operator"}}function n(s){var t=A(b,s);e(t?s:null);return{type:"string",style:"js-string"}}if(a=='"'||a=="'")return n(a);var u=b.next();if(a=="/*")return g(u);else if(u=='"'||u=="'")return n(u);else if(/[\[\]{}\(\),;\:\.]/.test(u))return{type:u,
style:"js-punctuation"};else if(u=="0"&&(b.equals("x")||b.equals("X"))){b.next();b.nextWhileMatches(j);return{type:"number",style:"js-atom"}}else if(/[0-9]/.test(u)){b.nextWhileMatches(/[0-9]/);if(b.equals(".")){b.next();b.nextWhileMatches(/[0-9]/)}if(b.equals("e")||b.equals("E")){b.next();b.equals("-")&&b.next();b.nextWhileMatches(/[0-9]/)}return{type:"number",style:"js-atom"}}else if(u=="/")if(b.equals("*")){b.next();return g(u)}else if(b.equals("/")){A(b,null);return{type:"comment",style:"js-comment"}}else{if(d){A(b,
"/");b.nextWhileMatches(/[gimy]/);a={type:"regexp",style:"js-string"}}else a=i();return a}else return k.test(u)?i():h()}var q=function(){function a(i,n){return{type:i,style:"js-"+n}}var d=a("keyword a","keyword"),b=a("keyword b","keyword"),e=a("keyword c","keyword"),h=a("operator","keyword"),g=a("atom","atom");return{"if":d,"while":d,"with":d,"else":b,"do":b,"try":b,"finally":b,"return":e,"break":e,"continue":e,"new":e,"delete":e,"throw":e,"in":h,"typeof":h,"instanceof":h,"var":a("var","keyword"),
"function":a("function","keyword"),"catch":a("catch","keyword"),"for":a("for","keyword"),"switch":a("switch","keyword"),"case":a("case","keyword"),"default":a("default","keyword"),"true":g,"false":g,"null":g,undefined:g,NaN:g,Infinity:g}}(),k=/[+\-*&%=<>!?|]/,j=/[0-9A-Fa-f]/,f=/[\w\$_]/;return function(a,d){return tokenizer(a,d||y(false,true))}}();var JSParser=Editor.Parser=function(){function A(k,j,f,a,d,b){this.indented=k;this.column=j;this.type=f;if(a!=null)this.align=a;this.prev=d;this.info=b}function y(k){return function(j){var f=j&&j.charAt(0),a=k.type,d=f==a;return a=="vardef"?k.indented+4:a=="form"&&f=="{"?k.indented:a=="stat"||a=="form"?k.indented+indentUnit:k.info=="switch"&&!d?k.indented+(/^(?:case|default)\b/.test(j)?indentUnit:2*indentUnit):k.align?k.column-(d?1:0):k.indented+(d?0:indentUnit)}}var m={atom:true,number:true,variable:true,
string:true,regexp:true},q=false;return{make:function(k,j){function f(c){for(var l=c.length-1;l>=0;l--)D.push(c[l])}function a(){f(arguments);R=true}function d(){f(arguments);R=false}function b(){E={prev:E,vars:{"this":true,arguments:true}}}function e(){E=E.prev}function h(c){if(E){K="js-variabledef";E.vars[c]=true}}function g(c,l){var I=function(){B=new A(O,P,c,null,B,l)};I.lex=true;return I}function i(){if(B.type==")")O=B.indented;B=B.prev}function n(c){return function(l){if(l==c)a();else c==";"?
d():a(arguments.callee)}}function u(){return d(t,u)}function s(){return d(r,s)}function t(c){if(c=="var")a(g("vardef"),F,n(";"),i);else if(c=="keyword a")a(g("form"),r,t,i);else if(c=="keyword b")a(g("form"),t,i);else if(c=="{")a(g("}"),G,i);else if(c==";")a();else if(c=="function")a(o);else if(c=="for")a(g("form"),n("("),g(")"),v,n(")"),i,t,i);else if(c=="variable")a(g("stat"),S);else if(c=="switch")a(g("form"),r,g("}","switch"),n("{"),G,i,i);else if(c=="case")a(r,n(":"));else if(c=="default")a(n(":"));
else c=="catch"?a(g("form"),b,n("("),z,n(")"),t,i,e):d(g("stat"),r,n(";"),i)}function r(c){if(m.hasOwnProperty(c))a(C);else if(c=="function")a(o);else if(c=="keyword c")a(r);else if(c=="(")a(g(")"),r,n(")"),i,C);else if(c=="operator")a(r);else if(c=="[")a(g("]"),H(r,"]"),i,C);else c=="{"?a(g("}"),H(w,"}"),i,C):a()}function C(c,l){if(c=="operator"&&/\+\+|--/.test(l))a(C);else if(c=="operator")a(r);else if(c==";")d();else if(c=="(")a(g(")"),H(r,")"),i,C);else if(c==".")a(Q,C);else c=="["&&a(g("]"),
r,n("]"),i,C)}function S(c){c==":"?a(i,t):d(C,n(";"),i)}function Q(c){if(c=="variable"){K="js-property";a()}}function w(c){if(c=="variable")K="js-property";m.hasOwnProperty(c)&&a(n(":"),r)}function H(c,l){function I(L){if(L==",")a(c,I);else L==l?a():a(n(l))}return function(L){L==l?a():d(c,I)}}function G(c){c=="}"?a():d(t,G)}function F(c,l){if(c=="variable"){h(l);a(J)}else a()}function J(c,l){if(l=="=")a(r,J);else c==","&&a(F)}function v(c){if(c=="var")a(F,M);else if(c==";")d(M);else c=="variable"?
a(N):d(M)}function N(c,l){l=="in"?a(r):a(C,M)}function M(c,l){if(c==";")a(p);else l=="in"?a(r):a(r,n(";"),p)}function p(c){c==")"?d():a(r)}function o(c,l){if(c=="variable"){h(l);a(o)}else c=="("&&a(g(")"),b,H(z,")"),i,t,e)}function z(c,l){if(c=="variable"){h(l);a()}}var x=tokenizeJavaScript(k),D=[q?s:u],E=null,B=new A((j||0)-indentUnit,0,"block",false),P=0,O=0,R,K,T={next:function(){for(;D[D.length-1].lex;)D.pop()();var c=x.next();if(c.type=="whitespace"&&P==0)O=c.value.length;P+=c.value.length;if(c.content==
"\n"){O=P=0;if(!("align"in B))B.align=false;c.indentation=y(B)}if(c.type=="whitespace"||c.type=="comment")return c;if(!("align"in B))B.align=true;for(;;){R=K=false;D.pop()(c.type,c.content);if(R){if(K)c.style=K;else{var l;if(l=c.type=="variable")a:{for(l=E;l;){if(l.vars[c.content]){l=true;break a}l=l.prev}l=false}if(l)c.style="js-localvariable"}return c}}},copy:function(){var c=E,l=B,I=D.concat([]),L=x.state;return function(U){E=c;B=l;D=I.concat([]);P=O=0;x=tokenizeJavaScript(U,L);return T}}};i.lex=
true;return T},electricChars:"{}:",configure:function(k){if(k.json!=null)q=k.json}}}();var XMLParser=Editor.Parser=function(){var A={autoSelfClosers:{br:true,img:true,hr:true,link:true,input:true,meta:true,col:true,frame:true,base:true,area:true},doNotIndent:{pre:true,"!cdata":true}},y={autoSelfClosers:{},doNotIndent:{"!cdata":true}},m=A,q=false,k=function(){function j(b,e){var h=b.next();if(h=="<")if(b.equals("!")){b.next();if(b.equals("["))if(b.lookAhead("[CDATA[",true)){e(d("xml-cdata","]]\>"));return null}else return"xml-text";else if(b.lookAhead("--",true)){e(d("xml-comment","--\>"));
return null}else if(b.lookAhead("DOCTYPE",true)){b.nextWhileMatches(/[\w\._\-]/);e(d("xml-doctype",">"));return"xml-doctype"}else return"xml-text"}else if(b.equals("?")){b.next();b.nextWhileMatches(/[\w\._\-]/);e(d("xml-processing","?>"));return"xml-processing"}else{b.equals("/")&&b.next();e(f);return"xml-punctuation"}else if(h=="&"){for(;!b.endOfLine();)if(b.next()==";")break;return"xml-entity"}else{b.nextWhileMatches(/[^&<\n]/);return"xml-text"}}function f(b,e){var h=b.next();if(h==">"){e(j);return"xml-punctuation"}else if(/[?\/]/.test(h)&&
b.equals(">")){b.next();e(j);return"xml-punctuation"}else if(h=="=")return"xml-punctuation";else if(/[\'\"]/.test(h)){e(a(h));return null}else{b.nextWhileMatches(/[^\s\u00a0=<>\"\'\/?]/);return"xml-name"}}function a(b){return function(e,h){for(;!e.endOfLine();)if(e.next()==b){h(f);break}return"xml-attribute"}}function d(b,e){return function(h,g){for(;!h.endOfLine();){if(h.lookAhead(e,true)){g(j);break}h.next()}return b}}return function(b,e){return tokenizer(b,e||j)}}();return{make:function(j){function f(p){for(var o=
p.length-1;o>=0;o--)H.push(p[o])}function a(){f(arguments);N=true}function d(){f(arguments);N=false}function b(){w.style+=" xml-error"}function e(p){return function(o,z){if(z==p)a();else{b();a(arguments.callee)}}}function h(p,o){var z=m.doNotIndent.hasOwnProperty(p)||v&&v.noIndent;v={prev:v,name:p,indent:F,startOfLine:o,noIndent:z}}function g(p){return function(o,z){var x=p;if(x&&x.noIndent)return z;if(q&&/<!\[CDATA\[/.test(o))return 0;if(x&&/^<\//.test(o))x=x.prev;for(;x&&!x.startOfLine;)x=x.prev;
return x?x.indent+indentUnit:0}}function i(){return d(n,i)}function n(p,o){if(o=="<")a(u,r,t(G==1));else if(o=="</")a(s,e(">"));else{if(p=="xml-cdata"){if(!v||v.name!="!cdata")h("!cdata");if(/\]\]>$/.test(o))v=v.prev}else M.hasOwnProperty(p)||b();a()}}function u(p,o){if(p=="xml-name"){J=o.toLowerCase();w.style="xml-tagname";a()}else{J=null;d()}}function s(p,o){if(p=="xml-name"){w.style="xml-tagname";if(v&&o.toLowerCase()==v.name)v=v.prev;else b()}a()}function t(p){return function(o,z){if(z=="/>"||
z==">"&&m.autoSelfClosers.hasOwnProperty(J))a();else if(z==">"){h(J,p);a()}else{b();a(arguments.callee)}}}function r(p){if(p=="xml-name"){w.style="xml-attname";a(C,r)}else d()}function C(p,o){if(o=="=")a(S);else o==">"||o=="/>"?d(t):d()}function S(p){p=="xml-attribute"?a(S):d()}var Q=k(j),w,H=[i],G=0,F=0,J=null,v=null,N,M={"xml-text":true,"xml-entity":true,"xml-comment":true,"xml-processing":true,"xml-doctype":true};return{indentation:function(){return F},next:function(){w=Q.next();if(w.style=="whitespace"&&
G==0)F=w.value.length;else G++;if(w.content=="\n"){F=G=0;w.indentation=g(v)}if(w.style=="whitespace"||w.type=="xml-comment")return w;for(;;){N=false;H.pop()(w.style,w.content);if(N)return w}},copy:function(){var p=H.concat([]),o=Q.state,z=v,x=this;return function(D){H=p.concat([]);G=F=0;v=z;Q=k(D,o);return x}}}},electricChars:"/",configure:function(j){if(j.useHTMLKludges!=null)m=j.useHTMLKludges?A:y;if(j.alignCDATA)q=j.alignCDATA}}}();var CSSParser=Editor.Parser=function(){function A(m,q,k){return function(j){return!m||/^\}/.test(j)?k:q?k+indentUnit*2:k+indentUnit}}var y=function(){function m(f,a){var d=f.next();if(d=="@"){f.nextWhileMatches(/\w/);return"css-at"}else if(d=="/"&&f.equals("*")){a(q);return null}else if(d=="<"&&f.equals("!")){a(k);return null}else if(d=="=")return"css-compare";else if(f.equals("=")&&(d=="~"||d=="|")){f.next();return"css-compare"}else if(d=='"'||d=="'"){a(j(d));return null}else if(d=="#"){f.nextWhileMatches(/\w/);
return"css-hash"}else if(d=="!"){f.nextWhileMatches(/[ \t]/);f.nextWhileMatches(/\w/);return"css-important"}else if(/\d/.test(d)){f.nextWhileMatches(/[\w.%]/);return"css-unit"}else if(/[,.+>*\/]/.test(d))return"css-select-op";else if(/[;{}:\[\]]/.test(d))return"css-punctuation";else{f.nextWhileMatches(/[\w\\\-_]/);return"css-identifier"}}function q(f,a){for(var d=false;!f.endOfLine();){var b=f.next();if(d&&b=="/"){a(m);break}d=b=="*"}return"css-comment"}function k(f,a){for(var d=0;!f.endOfLine();){var b=
f.next();if(d>=2&&b==">"){a(m);break}d=b=="-"?d+1:0}return"css-comment"}function j(f){return function(a,d){for(var b=false;!a.endOfLine();){var e=a.next();if(e==f&&!b)break;b=!b&&e=="\\"}b||d(m);return"css-string"}}return function(f,a){return tokenizer(f,a||m)}}();return{make:function(m,q){q=q||0;var k=y(m),j=false,f=false,a=false,d={next:function(){var b=k.next(),e=b.style,h=b.content;if(e=="css-hash")e=b.style=f?"css-colorcode":"css-identifier";if(e=="css-identifier")if(f)b.style="css-value";else if(!j&&
!a)b.style="css-selector";if(h=="\n")b.indentation=A(j,f,q);if(h=="{"&&a=="@media")a=false;else if(h=="{")j=true;else if(h=="}")j=f=a=false;else if(h==";")f=a=false;else if(j&&e!="css-comment"&&e!="whitespace")f=true;else if(!j&&e=="css-at")a=h;return b},copy:function(){var b=j,e=f,h=k.state;return function(g){k=y(g,h);j=b;f=e;return d}}};return d},electricChars:"}"}}();var HTMLMixedParser=Editor.Parser=function(){function A(){var m=["XMLParser"],q;for(q in y)m.push(y[q]);for(var k in m)if(!window[m[k]])throw Error(m[k]+" parser must be loaded for HTML mixed mode to work.");XMLParser.configure({useHTMLKludges:true})}var y={script:"JSParser",style:"CSSParser"};return{make:function(m){function q(){var b=j.next();if(b.content=="<")a=true;else if(b.style=="xml-tagname"&&a===true)a=b.content.toLowerCase();else if(b.content==">"){if(y[a])d.next=k(window[y[a]],"</"+a);
a=false}return b}function k(b,e){var h=j.indentation();f=b.make(m,h+indentUnit);return function(){if(m.lookAhead(e,false,false,true)){f=null;d.next=q;return q()}var g=f.next(),i=g.value.lastIndexOf("<"),n=Math.min(g.value.length-i,e.length);if(i!=-1&&g.value.slice(i,i+n).toLowerCase()==e.slice(0,n)&&m.lookAhead(e.slice(n),false,false,true)){m.push(g.value.slice(i));g.value=g.value.slice(0,i)}if(g.indentation){var u=g.indentation;g.indentation=function(s){return s=="</"?h:u(s)}}return g}}A();var j=
XMLParser.make(m),f=null,a=false,d={next:q,copy:function(){var b=j.copy(),e=f&&f.copy(),h=d.next,g=a;return function(i){m=i;j=b(i);f=e&&e(i);d.next=h;a=g;return d}}};return d},electricChars:"{}/:",configure:function(m){if(m.triggers)y=m.triggers}}}();