text: !function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/comment/continuecomment.js",["../../lib/codemirror"],a):a(CodeMirror)}(function(a){function k(f){if(f.getOption("disableInput"))return a.Pass;for(var c,b=f.listSelections(),d=[],g=0;g<b.length;g++){var q=b[g].head;if(!/\bcomment\b/.test(f.getTokenTypeAt(q)))return a.Pass;var l=f.getModeAt(q);if(c){if(c!=l)return a.Pass}else c=l;l=null;if(c.blockCommentStart&&
  c.blockCommentContinue){var m,r=f.getLine(q.line).slice(0,q.ch),e=r.lastIndexOf(c.blockCommentEnd);if(-1==e||e!=q.ch-c.blockCommentEnd.length)if(-1<(m=r.lastIndexOf(c.blockCommentStart))&&m>e){if(l=r.slice(0,m),/\S/.test(l))for(l="",r=0;r<m;++r)l+=" "}else-1<(m=r.indexOf(c.blockCommentContinue))&&!/\S/.test(r.slice(0,m))&&(l=r.slice(0,m));null!=l&&(l+=c.blockCommentContinue)}null==l&&c.lineComment&&p(f)&&(r=f.getLine(q.line),m=r.indexOf(c.lineComment),-1<m&&(l=r.slice(0,m),/\S/.test(l)?l=null:l+=
  c.lineComment+r.slice(m+c.lineComment.length).match(/^\s*/)[0]));if(null==l)return a.Pass;d[g]="\n"+l}f.operation(function(){for(var e=b.length-1;0<=e;e--)f.replaceRange(d[e],b[e].from(),b[e].to(),"+insert")})}function p(a){a=a.getOption("continueComments");return!a||"object"!=typeof a||!1!==a.continueLineComment}a.defineOption("continueComments",null,function(f,c,b){if(b&&b!=a.Init&&f.removeKeyMap("continueComment"),c)b="Enter","string"==typeof c?b=c:"object"==typeof c&&c.key&&(b=c.key),c={name:"continueComment"},
  c[b]=k,f.addKeyMap(c)})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/edit/closebrackets.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function k(b,e){return"pairs"==e&&"string"==typeof b?b:"object"==typeof b&&null!=b[e]?b[e]:q[e]}function p(b){for(var e=0;e<b.length;e++){var a=b.charAt(e),h="'"+a+"'";m[h]||(m[h]=f(a))}}function f(a){return function(e){return b(e,a)}}function c(b){var e=b.state.closeBrackets;
  return!e||e.override?e:b.getModeAt(b.getCursor()).closeBrackets||e}function b(b,e){var n=c(b);if(!n||b.getOption("disableInput"))return a.Pass;var h=k(n,"pairs"),t=h.indexOf(e);if(-1==t)return a.Pass;for(var d,n=k(n,"triples"),q=h.charAt(t+1)==e,m=b.listSelections(),f=0==t%2,p=0;p<m.length;p++){var x,A=m[p],v=A.head;x=b.getRange(v,l(v.line,v.ch+1));if(f&&!A.empty())x="surround";else if(!q&&f||x!=e)if(q&&1<v.ch&&0<=n.indexOf(e)&&b.getRange(l(v.line,v.ch-2),v)==e+e){if(2<v.ch&&/\bstring/.test(b.getTokenTypeAt(l(v.line,
  v.ch-2))))return a.Pass;x="addFour"}else{if(q){if(A=0==v.ch?" ":b.getRange(l(v.line,v.ch-1),v),a.isWordChar(x)||A==e||a.isWordChar(A))return a.Pass}else if(!f)return a.Pass;x="both"}else x=q&&g(b,v)?"both":0<=n.indexOf(e)&&b.getRange(v,l(v.line,v.ch+3))==e+e+e?"skipThree":"skip";if(d){if(d!=x)return a.Pass}else d=x}var w=t%2?h.charAt(t-1):e,z=t%2?e:h.charAt(t+1);b.operation(function(){if("skip"==d)b.execCommand("goCharRight");else if("skipThree"==d)for(var e=0;3>e;e++)b.execCommand("goCharRight");
  else if("surround"==d){for(var h=b.getSelections(),e=0;e<h.length;e++)h[e]=w+h[e]+z;b.replaceSelections(h,"around");h=b.listSelections().slice();for(e=0;e<h.length;e++){var n=h,t=e,c;c=h[e];var q=0<a.cmpPos(c.anchor,c.head);c={anchor:new l(c.anchor.line,c.anchor.ch+(q?-1:1)),head:new l(c.head.line,c.head.ch+(q?1:-1))};n[t]=c}b.setSelections(h)}else"both"==d?(b.replaceSelection(w+z,null),b.triggerElectric(w+z),b.execCommand("goCharLeft")):"addFour"==d&&(b.replaceSelection(w+w+w+w,"before"),b.execCommand("goCharRight"))})}
  function d(b,e){var a=b.getRange(l(e.line,e.ch-1),l(e.line,e.ch+1));return 2==a.length?a:null}function g(b,e){var a=b.getTokenAt(l(e.line,e.ch+1));return/\bstring/.test(a.type)&&a.start==e.ch&&(0==e.ch||!/\bstring/.test(b.getTokenTypeAt(e)))}var q={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},l=a.Pos;a.defineOption("autoCloseBrackets",!1,function(b,e,c){c&&c!=a.Init&&(b.removeKeyMap(m),b.state.closeBrackets=null);e&&(p(k(e,"pairs")),b.state.closeBrackets=e,b.addKeyMap(m))});var m={Backspace:function(b){var e=
  c(b);if(!e||b.getOption("disableInput"))return a.Pass;for(var n=k(e,"pairs"),e=b.listSelections(),h=0;h<e.length;h++){if(!e[h].empty())return a.Pass;var t=d(b,e[h].head);if(!t||0!=n.indexOf(t)%2)return a.Pass}for(h=e.length-1;0<=h;h--)n=e[h].head,b.replaceRange("",l(n.line,n.ch-1),l(n.line,n.ch+1),"+delete")},Enter:function(b){var e=c(b),e=e&&k(e,"explode");if(!e||b.getOption("disableInput"))return a.Pass;for(var n=b.listSelections(),h=0;h<n.length;h++){if(!n[h].empty())return a.Pass;var t=d(b,n[h].head);
  if(!t||0!=e.indexOf(t)%2)return a.Pass}b.operation(function(){var e=b.lineSeparator()||"\n";b.replaceSelection(e+e,null);b.execCommand("goCharLeft");n=b.listSelections();for(e=0;e<n.length;e++){var h=n[e].head.line;b.indentLine(h,null,!0);b.indentLine(h+1,null,!0)}})}};p(q.pairs+"`")});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/xml-fold",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function k(e,b,h,a){this.line=b;this.ch=h;this.cm=e;this.text=e.getLine(b);this.min=a?Math.max(a.from,e.firstLine()):e.firstLine();this.max=a?Math.min(a.to-1,e.lastLine()):e.lastLine()}function p(e,b){var h=e.cm.getTokenTypeAt(m(e.line,b));return h&&/\btag\b/.test(h)}function f(e){if(!(e.line>=
  e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function c(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function b(e){for(;;){var b=e.text.indexOf("\x3e",e.ch);if(-1==b){if(f(e))continue;break}if(p(e,b+1)){var h=e.text.lastIndexOf("/",b),h=-1<h&&!/\S/.test(e.text.slice(h+1,b));return e.ch=b+1,h?"selfClose":"regular"}e.ch=b+1}}function d(b){for(;;){var a=b.ch?b.text.lastIndexOf("\x3c",b.ch-1):-1;if(-1==a){if(c(b))continue;break}if(p(b,a+1)){r.lastIndex=a;
  b.ch=a;var h=r.exec(b.text);if(h&&h.index==a)return h}else b.ch=a}}function g(b){for(;;){r.lastIndex=b.ch;var a=r.exec(b.text);if(!a){if(f(b))continue;break}if(p(b,a.index+1))return b.ch=a.index+a[0].length,a;b.ch=a.index+1}}function q(e,a){for(var h=[];;){var c,d=g(e),q=e.line,r=e.ch-(d?d[0].length:0);if(!d||!(c=b(e)))break;if("selfClose"!=c)if(d[1]){for(var l=h.length-1;0<=l;--l)if(h[l]==d[2]){h.length=l;break}if(0>l&&(!a||a==d[2]))return{tag:d[2],from:m(q,r),to:m(e.line,e.ch)}}else h.push(d[2])}}
  function l(b,a){for(var h=[];;){var t;a:for(t=b;;){var q=t.ch?t.text.lastIndexOf("\x3e",t.ch-1):-1;if(-1==q){if(c(t))continue;t=void 0;break a}if(p(t,q+1)){var g=t.text.lastIndexOf("/",q),g=-1<g&&!/\S/.test(t.text.slice(g+1,q));t=(t.ch=q+1,g?"selfClose":"regular");break a}t.ch=q}if(!t)break;if("selfClose"!=t){t=b.line;q=b.ch;g=d(b);if(!g)break;if(g[1])h.push(g[2]);else{for(var r=h.length-1;0<=r;--r)if(h[r]==g[2]){h.length=r;break}if(0>r&&(!a||a==g[2]))return{tag:g[2],from:m(b.line,b.ch),to:m(t,q)}}}else d(b)}}
  var m=a.Pos,r=RegExp("\x3c(/?)([A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");a.registerHelper("fold","xml",function(e,a){for(var h=new k(e,a.line,0);;){var c=
  g(h);if(!c||h.line!=a.line)break;var d=b(h);if(!d)break;if(!c[1]&&"selfClose"!=d){d=m(h.line,h.ch);if(c=h=q(h,c[2]))c=h.from,c=0<(c.line-d.line||c.ch-d.ch);return c?{from:d,to:h.from}:null}}});a.findMatchingTag=function(e,a,h){var c=new k(e,a.line,a.ch,h);if(-1!=c.text.indexOf("\x3e")||-1!=c.text.indexOf("\x3c")){var g=b(c),r=g&&m(c.line,c.ch),f=g&&d(c);if(g&&f&&!(0<(c.line-a.line||c.ch-a.ch)))return a={from:m(c.line,c.ch),to:r,tag:f[2]},"selfClose"==g?{open:a,close:null,at:"open"}:f[1]?{open:l(c,
  f[2]),close:a,at:"close"}:(c=new k(e,r.line,r.ch,h),{open:a,close:q(c,f[2]),at:"open"})}};a.findEnclosingTag=function(b,a,c,d){for(var g=new k(b,a.line,a.ch,c);;){var r=l(g,d);if(!r)break;var m=new k(b,a.line,a.ch,c);if(m=q(m,r.tag))return{open:r,close:m}}};a.scanForClosingTag=function(b,a,c,d){return q(new k(b,a.line,a.ch,d?{from:0,to:d}:null),c)}});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define("addon/edit/closetag.js",["../../lib/codemirror","../fold/xml-fold"],a):a(CodeMirror)})(function(a){function k(g){if(g.getOption("disableInput"))return a.Pass;for(var q=g.listSelections(),l=[],m=g.getOption("autoCloseTags"),r=0;r<q.length;r++){if(!q[r].empty())return a.Pass;var e=q[r].head,n=g.getTokenAt(e),h=a.innerMode(g.getMode(),
  n.state),t=h.state;if("xml"!=h.mode.name||!t.tagName)return a.Pass;var u="html"==h.mode.configuration,h="object"==typeof m&&m.dontCloseTags||u&&b,p="object"==typeof m&&m.indentTags||u&&d,u=t.tagName;n.end>e.ch&&(u=u.slice(0,u.length-n.end+e.ch));var k=u.toLowerCase();if(!u||"string"==n.type&&(n.end!=e.ch||!/[\"\']/.test(n.string.charAt(n.string.length-1))||1==n.string.length)||"tag"==n.type&&"closeTag"==t.type||n.string.indexOf("/")==n.string.length-1||h&&-1<f(h,k)||c(g,u,e,t,!0))return a.Pass;n=
  p&&-1<f(p,k);l[r]={indent:n,text:"\x3e"+(n?"\n\n":"")+"\x3c/"+u+"\x3e",newPos:n?a.Pos(e.line+1,0):a.Pos(e.line,e.ch+1)}}m="object"==typeof m&&m.dontIndentOnAutoClose;for(r=q.length-1;0<=r;r--)e=l[r],g.replaceRange(e.text,q[r].head,q[r].anchor,"+insert"),n=g.listSelections().slice(0),n[r]={head:e.newPos,anchor:e.newPos},g.setSelections(n),!m&&e.indent&&(g.indentLine(e.newPos.line,null,!0),g.indentLine(e.newPos.line+1,null,!0))}function p(b,d){for(var l=b.listSelections(),m=[],r=d?"/":"\x3c/",e=b.getOption("autoCloseTags"),
  e="object"==typeof e&&e.dontIndentOnSlash,n=0;n<l.length;n++){if(!l[n].empty())return a.Pass;var h=l[n].head,t=b.getTokenAt(h),f=a.innerMode(b.getMode(),t.state),p=f.state;if(d&&("string"==t.type||"\x3c"!=t.string.charAt(0)||t.start!=h.ch-1))return a.Pass;if("xml"!=f.mode.name)if("htmlmixed"==b.getMode().name&&"javascript"==f.mode.name)f=r+"script";else{if("htmlmixed"!=b.getMode().name||"css"!=f.mode.name)return a.Pass;f=r+"style"}else{if(!p.context||!p.context.tagName||c(b,p.context.tagName,h,p))return a.Pass;
  f=r+p.context.tagName}"\x3e"!=b.getLine(h.line).charAt(t.end)&&(f+="\x3e");m[n]=f}if(b.replaceSelections(m),l=b.listSelections(),!e)for(n=0;n<l.length;n++)(n==l.length-1||l[n].head.line<l[n+1].head.line)&&b.indentLine(l[n].head.line)}function f(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;++c)if(b[c]==a)return c;return-1}function c(b,c,d,m,r){if(!a.scanForClosingTag)return!1;var e=Math.min(b.lastLine()+1,d.line+500);d=a.scanForClosingTag(b,d,null,e);if(!d||d.tag!=c)return!1;m=
  m.context;for(r=r?1:0;m&&m.tagName==c;m=m.prev)++r;d=d.to;for(m=1;m<r;m++){d=a.scanForClosingTag(b,d,null,e);if(!d||d.tag!=c)return!1;d=d.to}return!0}a.defineOption("autoCloseTags",!1,function(b,c,d){if(d!=a.Init&&d&&b.removeKeyMap("autoCloseTags"),c)d={name:"autoCloseTags"},("object"!=typeof c||c.whenClosing)&&(d["'/'"]=function(b){return b.getOption("disableInput")?a.Pass:p(b,!0)}),("object"!=typeof c||c.whenOpening)&&(d["'\x3e'"]=function(b){return k(b)}),b.addKeyMap(d)});var b="area base br col command embed hr img input keygen link meta param source track wbr".split(" "),
  d="applet blockquote body button div dl fieldset form frameset h1 h2 h3 h4 h5 h6 head html iframe layer legend object ol p select table ul".split(" ");a.commands.closeTag=function(b){return p(b)}});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/edit/matchbrackets.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function k(b,a,c){var r=b.getLineHandle(a.line),e=a.ch-1,n=c&&c.afterCursor;null==n&&(n=/(^| )cm-fat-cursor($| )/.test(b.getWrapperElement().className));var h=c&&c.bracketRegex||/[(){}[\]]/,r=!n&&0<=e&&h.test(r.text.charAt(e))&&g[r.text.charAt(e)]||h.test(r.text.charAt(e+
  1))&&g[r.text.charAt(++e)];if(!r)return null;n="\x3e"==r.charAt(1)?1:-1;if(c&&c.strict&&0<n!=(e==a.ch))return null;h=b.getTokenTypeAt(d(a.line,e+1));b=p(b,d(a.line,e+(0<n?1:0)),n,h||null,c);return null==b?null:{from:d(a.line,e),to:b&&b.pos,match:b&&b.ch==r.charAt(0),forward:0<n}}function p(b,a,c,r,e){var n=e&&e.maxScanLineLength||1E4,h=e&&e.maxScanLines||1E3,t=[];e=e&&e.bracketRegex||/[(){}[\]]/;for(var h=0<c?Math.min(a.line+h,b.lastLine()+1):Math.max(b.firstLine()-1,a.line-h),f=a.line;f!=h;f+=c){var p=
  b.getLine(f);if(p){var k=0<c?0:p.length-1,D=0<c?p.length:-1;if(!(p.length>n))for(f==a.line&&(k=a.ch-(0>c?1:0));k!=D;k+=c){var B=p.charAt(k);if(e.test(B)&&(void 0===r||b.getTokenTypeAt(d(f,k+1))==r))if("\x3e"==g[B].charAt(1)==0<c)t.push(B);else{if(!t.length)return{pos:d(f,k),ch:B};t.pop()}}}}return f-c!=(0<c?b.lastLine():b.firstLine())&&null}function f(a,c,g){for(var r=a.state.matchBrackets.maxHighlightLineLength||1E3,e=[],f=a.listSelections(),h=0;h<f.length;h++){var t=f[h].empty()&&k(a,f[h].head,
  g);if(t&&a.getLine(t.from.line).length<=r){var p=t.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";e.push(a.markText(t.from,d(t.from.line,t.from.ch+1),{className:p}));t.to&&a.getLine(t.to.line).length<=r&&e.push(a.markText(t.to,d(t.to.line,t.to.ch+1),{className:p}))}}if(e.length){b&&a.state.focused&&a.focus();g=function(){a.operation(function(){for(var b=0;b<e.length;b++)e[b].clear()})};if(!c)return g;setTimeout(g,800)}}function c(b){b.operation(function(){b.state.matchBrackets.currentlyHighlighted&&
  (b.state.matchBrackets.currentlyHighlighted(),b.state.matchBrackets.currentlyHighlighted=null);b.state.matchBrackets.currentlyHighlighted=f(b,!1,b.state.matchBrackets)})}var b=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||8>document.documentMode),d=a.Pos,g={"(":")\x3e",")":"(\x3c","[":"]\x3e","]":"[\x3c","{":"}\x3e","}":"{\x3c","\x3c":"\x3e\x3e","\x3e":"\x3c\x3c"};a.defineOption("matchBrackets",!1,function(b,d,g){g&&g!=a.Init&&(b.off("cursorActivity",c),b.state.matchBrackets&&
  b.state.matchBrackets.currentlyHighlighted&&(b.state.matchBrackets.currentlyHighlighted(),b.state.matchBrackets.currentlyHighlighted=null));d&&(b.state.matchBrackets="object"==typeof d?d:{},b.on("cursorActivity",c))});a.defineExtension("matchBrackets",function(){f(this,!0)});a.defineExtension("findMatchingBracket",function(b,a,c){return(c||"boolean"==typeof a)&&(c?(c.strict=a,a=c):a=a?{strict:!0}:null),k(this,b,a)});a.defineExtension("scanForBracket",function(b,a,c,d){return p(this,b,a,c,d)})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define("addon/edit/matchtags.js",["../../lib/codemirror","../fold/xml-fold"],a):a(CodeMirror)})(function(a){function k(a){a.state.tagHit&&a.state.tagHit.clear();a.state.tagOther&&a.state.tagOther.clear();a.state.tagHit=a.state.tagOther=null}function p(c){c.state.failedTagMatch=!1;c.operation(function(){if(k(c),!c.somethingSelected()){var b=
  c.getCursor(),d=c.getViewport();d.from=Math.min(d.from,b.line);d.to=Math.max(b.line+1,d.to);if(b=a.findMatchingTag(c,b,d))c.state.matchBothTags&&(d="open"==b.at?b.open:b.close)&&(c.state.tagHit=c.markText(d.from,d.to,{className:"CodeMirror-matchingtag"})),(b="close"==b.at?b.open:b.close)?c.state.tagOther=c.markText(b.from,b.to,{className:"CodeMirror-matchingtag"}):c.state.failedTagMatch=!0}})}function f(a){a.state.failedTagMatch&&p(a)}a.defineOption("matchTags",!1,function(c,b,d){d&&d!=a.Init&&(c.off("cursorActivity",
  p),c.off("viewportChange",f),k(c));b&&(c.state.matchBothTags="object"==typeof b&&b.bothTags,c.on("cursorActivity",p),c.on("viewportChange",f),p(c))});a.commands.toMatchingTag=function(c){var b=a.findMatchingTag(c,c.getCursor());b&&(b="close"==b.at?b.open:b.close)&&c.extendSelection(b.to,b.from)}});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/edit/trailingspace.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){a.defineOption("showTrailingSpace",!1,function(k,p,f){f==a.Init&&(f=!1);f&&!p?k.removeOverlay("trailingspace"):!f&&p&&k.addOverlay({token:function(a){for(var b=a.string.length,d=b;d&&/\s/.test(a.string.charAt(d-1));--d);return d>a.pos?(a.pos=d,null):(a.pos=b,"trailingspace")},
  name:"trailingspace"})})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/foldcode",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function k(b,c,g,q){function l(a){var e=m(b,c);if(!e||e.to.line-e.from.line<r)return null;for(var h=b.findMarksAt(e.from),g=0;g<h.length;++g)if(h[g].__isFold&&"fold"!==q){if(!a)return null;e.cleared=!0;h[g].clear()}return e}if(g&&g.call){var m=g;g=null}else m=f(b,g,"rangeFinder");
  "number"==typeof c&&(c=a.Pos(c,0));var r=f(b,g,"minFoldSize"),e=l(!0);if(f(b,g,"scanUp"))for(;!e&&c.line>b.firstLine();)c=a.Pos(c.line-1,0),e=l(!1);if(e&&!e.cleared&&"unfold"!==q){var n=p(b,g);a.on(n,"mousedown",function(b){h.clear();a.e_preventDefault(b)});var h=b.markText(e.from,e.to,{replacedWith:n,clearOnEnter:f(b,g,"clearOnEnter"),__isFold:!0});h.on("clear",function(c,e){a.signal(b,"unfold",b,c,e)});a.signal(b,"fold",b,e.from,e.to)}}function p(b,a){var c=f(b,a,"widget");if("string"==typeof c){var q=
  document.createTextNode(c),c=document.createElement("span");c.appendChild(q);c.className="CodeMirror-foldmarker"}else c&&(c=c.cloneNode(!0));return c}function f(b,a,g){return a&&void 0!==a[g]?a[g]:(b=b.options.foldOptions)&&void 0!==b[g]?b[g]:c[g]}a.newFoldFunction=function(b,a){return function(c,f){k(c,f,{rangeFinder:b,widget:a})}};a.defineExtension("foldCode",function(b,a,c){k(this,b,a,c)});a.defineExtension("isFolded",function(b){b=this.findMarksAt(b);for(var a=0;a<b.length;++a)if(b[a].__isFold)return!0});
  a.commands.toggleFold=function(b){b.foldCode(b.getCursor())};a.commands.fold=function(b){b.foldCode(b.getCursor(),null,"fold")};a.commands.unfold=function(b){b.foldCode(b.getCursor(),null,"unfold")};a.commands.foldAll=function(b){b.operation(function(){for(var c=b.firstLine(),g=b.lastLine();c<=g;c++)b.foldCode(a.Pos(c,0),null,"fold")})};a.commands.unfoldAll=function(b){b.operation(function(){for(var c=b.firstLine(),g=b.lastLine();c<=g;c++)b.foldCode(a.Pos(c,0),null,"unfold")})};a.registerHelper("fold",
  "combine",function(){var b=Array.prototype.slice.call(arguments,0);return function(a,c){for(var f=0;f<b.length;++f){var p=b[f](a,c);if(p)return p}}});a.registerHelper("fold","auto",function(b,a){for(var c=b.getHelpers(a,"fold"),f=0;f<c.length;f++){var p=c[f](b,a);if(p)return p}});var c={rangeFinder:a.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};a.defineOption("foldOptions",null);a.defineExtension("foldOption",function(b,a){return f(this,b,a)})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define("addon/fold/foldgutter.js",["../../lib/codemirror","./foldcode"],a):a(CodeMirror)})(function(a){function k(b){this.options=b;this.from=this.to=0}function p(b,a){for(var c=b.findMarks(m(a,0),m(a+1,0)),h=0;h<c.length;++h)if(c[h].__isFold&&c[h].find().from.line==a)return c[h]}function f(b){if("string"==typeof b){var a=document.createElement("div");
  return a.className=b+" CodeMirror-guttermarker-subtle",a}return b.cloneNode(!0)}function c(b,a,c){var h=b.state.foldGutter.options,d=a,g=b.foldOption(h,"minFoldSize"),q=b.foldOption(h,"rangeFinder");b.eachLine(a,c,function(a){var c=null;if(p(b,d))c=f(h.indicatorFolded);else{var e=m(d,0);(e=q&&q(b,e))&&e.to.line-e.from.line>=g&&(c=f(h.indicatorOpen))}b.setGutterMarker(a,h.gutter,c);++d})}function b(b){var a=b.getViewport(),d=b.state.foldGutter;d&&(b.operation(function(){c(b,a.from,a.to)}),d.from=a.from,
  d.to=a.to)}function d(b,a,c){var h=b.state.foldGutter;h&&(h=h.options,c==h.gutter&&((c=p(b,a))?c.clear():b.foldCode(m(a,0),h.rangeFinder)))}function g(a){var c=a.state.foldGutter;if(c){var d=c.options;c.from=c.to=0;clearTimeout(c.changeUpdate);c.changeUpdate=setTimeout(function(){b(a)},d.foldOnChangeTimeSpan||600)}}function q(a){var e=a.state.foldGutter;if(e){var d=e.options;clearTimeout(e.changeUpdate);e.changeUpdate=setTimeout(function(){var h=a.getViewport();e.from==e.to||20<h.from-e.to||20<e.from-
  h.to?b(a):a.operation(function(){h.from<e.from&&(c(a,h.from,e.from),e.from=h.from);h.to>e.to&&(c(a,e.to,h.to),e.to=h.to)})},d.updateViewportTimeSpan||400)}}function l(b,a){var d=b.state.foldGutter;if(d){var h=a.line;h>=d.from&&h<d.to&&c(b,h,h+1)}}a.defineOption("foldGutter",!1,function(c,e,f){f&&f!=a.Init&&(c.clearGutter(c.state.foldGutter.options.gutter),c.state.foldGutter=null,c.off("gutterClick",d),c.off("change",g),c.off("viewportChange",q),c.off("fold",l),c.off("unfold",l),c.off("swapDoc",g));
  if(e){f=c.state;var h=e;e=(!0===h&&(h={}),null==h.gutter&&(h.gutter="CodeMirror-foldgutter"),null==h.indicatorOpen&&(h.indicatorOpen="CodeMirror-foldgutter-open"),null==h.indicatorFolded&&(h.indicatorFolded="CodeMirror-foldgutter-folded"),h);f.foldGutter=new k(e);b(c);c.on("gutterClick",d);c.on("change",g);c.on("viewportChange",q);c.on("fold",l);c.on("unfold",l);c.on("swapDoc",g)}});var m=a.Pos});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/brace-fold.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){a.registerHelper("fold","brace",function(k,p){function f(e){for(var h=p.ch,f=0;;)if(h=0>=h?-1:d.lastIndexOf(e,h-1),-1!=h){if(1==f&&h<p.ch)break;if(c=k.getTokenTypeAt(a.Pos(b,h+1)),!/^(comment|string)/.test(c))return h+1;--h}else{if(1==f)break;f=1;h=d.length}}var c,b=p.line,d=
  k.getLine(b),g="{",q="}",l=f("{");if(null==l&&(g="[",q="]",l=f("[")),null!=l){var m,r,e=1,n=k.lastLine(),h=b;a:for(;h<=n;++h)for(var t=k.getLine(h),u=h==b?l:0;;){var y=t.indexOf(g,u),C=t.indexOf(q,u);if(0>y&&(y=t.length),0>C&&(C=t.length),(u=Math.min(y,C))==t.length)break;if(k.getTokenTypeAt(a.Pos(h,u+1))==c)if(u==y)++e;else if(!--e){m=h;r=u;break a}++u}if(null!=m&&b!=m)return{from:a.Pos(b,l),to:a.Pos(m,r)}}});a.registerHelper("fold","import",function(k,p){function f(b){if(b<k.firstLine()||b>k.lastLine())return null;
  var c=k.getTokenAt(a.Pos(b,1));if(/\S/.test(c.string)||(c=k.getTokenAt(a.Pos(b,c.end+1))),"keyword"!=c.type||"import"!=c.string)return null;var d=b;for(b=Math.min(k.lastLine(),b+10);d<=b;++d){var f=k.getLine(d).indexOf(";");if(-1!=f)return{startCh:c.end,end:a.Pos(d,f)}}}var c,b=p.line,d=f(b);if(!d||f(b-1)||(c=f(b-2))&&c.end.line==b-1)return null;for(c=d.end;;){var g=f(c.line+1);if(null==g)break;c=g.end}return{from:k.clipPos(a.Pos(b,d.startCh+1)),to:c}});a.registerHelper("fold","include",function(k,
  p){function f(b){if(b<k.firstLine()||b>k.lastLine())return null;var c=k.getTokenAt(a.Pos(b,1));return/\S/.test(c.string)||(c=k.getTokenAt(a.Pos(b,c.end+1))),"meta"==c.type&&"#include"==c.string.slice(0,8)?c.start+8:void 0}var c=p.line,b=f(c);if(null==b||null!=f(c-1))return null;for(var d=c;null!=f(d+1);)++d;return{from:a.Pos(c,b+1),to:k.clipPos(a.Pos(d))}})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/comment-fold.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){a.registerGlobalHelper("fold","comment",function(a){return a.blockCommentStart&&a.blockCommentEnd},function(k,p){var f=k.getModeAt(p),c=f.blockCommentStart,f=f.blockCommentEnd;if(c&&f){var b,d=p.line;b=k.getLine(d);for(var g=p.ch,q=0;;)if(g=0>=g?-1:b.lastIndexOf(c,g-1),-1!=
  g){if(1==q&&g<p.ch)return;if(/comment/.test(k.getTokenTypeAt(a.Pos(d,g+1)))&&(0==g||b.slice(g-f.length,g)==f||!/comment/.test(k.getTokenTypeAt(a.Pos(d,g))))){b=g+c.length;break}--g}else{if(1==q)return;q=1;g=b.length}var l,m,q=1,g=k.lastLine(),r=d;a:for(;r<=g;++r)for(var e=k.getLine(r),n=r==d?b:0;;){var h=e.indexOf(c,n),t=e.indexOf(f,n);if(0>h&&(h=e.length),0>t&&(t=e.length),(n=Math.min(h,t))==e.length)break;if(n==h)++q;else if(!--q){l=r;m=n;break a}++n}if(null!=l&&(d!=l||m!=b))return{from:a.Pos(d,
  b),to:a.Pos(l,m)}}})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/fold/indent-fold.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function k(p,f){var c=p.getLine(f),b=c.search(/\S/);return-1==b||/\bcomment\b/.test(p.getTokenTypeAt(a.Pos(f,b+1)))?-1:a.countColumn(c,null,p.getOption("tabSize"))}a.registerHelper("fold","indent",function(p,f){var c=k(p,f.line);if(!(0>c)){for(var b=null,d=f.line+1,g=p.lastLine();d<=
  g;++d){var q=k(p,d);if(-1!=q){if(!(q>c))break;b=d}}return b?{from:a.Pos(f.line,p.getLine(f.line).length),to:a.Pos(b,p.getLine(b).length)}:void 0}})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/format/autoFormatAll.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){a.defineExtension("autoFormatAll",function(k,p){for(var f=this,c=f.getMode(),b=f.getRange(k,p).split("\n"),d=a.copyState(c,f.getTokenAt(k).state),g=f.getOption("tabSize"),q="",l=0,m=0==k.ch,r=0;r<b.length;++r){for(var e=new a.StringStream(b[r],g);!e.eol();){var n=a.innerMode(c,
  d),h=c.token(e,d),t=e.current();e.start=e.pos;m&&!/\S/.test(t)||(q+=t,m=!1);!m&&n.mode.newlineAfterToken&&n.mode.newlineAfterToken(h,t,e.string.slice(e.pos)||b[r+1]||"",n.state)&&(q+="\n",m=!0,++l)}!e.pos&&c.blankLine&&c.blankLine(d);!m&&r<b.length-1&&(q+="\n",m=!0,++l)}f.operation(function(){f.replaceRange(q,k,p);for(var b=k.line+1,a=k.line+l;b<=a;++b)f.indentLine(b,"smart");f.setCursor({line:0,ch:0})})})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/format/formatting.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function k(a){for(var f=[/for\s*?\((.*?)\)/g,/&#?[a-z0-9]+;[\s\S]/g,/\"(.*?)((\")|$)/g,/\/\*(.*?)(\*\/|$)/g,/^\/\/.*/g],c=[],b=0;b<f.length;b++)for(var d=0;d<a.length;){var g=a.substr(d).match(f[b]);if(null==g)break;c.push({start:d+g.index,end:d+g.index+g[0].length});d+=g.index+
  Math.max(1,g[0].length)}return c.sort(function(b,a){return b.start-a.start}),c}a.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(a,f){return/^[;{}]$/.test(f)}});a.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",wordWrapChars:[";","\\{","\\}"],autoFormatLineBreaks:function(a){var f=0,c=this.jsonMode?function(b){return b.replace(/([,{])/g,"$1\n").replace(/}/g,"\n}")}:function(b){return b.replace(/(;|\{|\})([^\r\n;])/g,"$1\n$2")},b=k(a),d="";if(null!=b){for(var g=
  0;g<b.length;g++)b[g].start>f&&(d+=c(a.substring(f,b[g].start)),f=b[g].start),b[g].start<=f&&b[g].end>=f&&(d+=a.substring(f,b[g].end),f=b[g].end);f<a.length&&(d+=c(a.substr(f)))}else d=c(a);return d.replace(/^\n*|\n*$/,"")}});a.extendMode("xml",{commentStart:"\x3c!--",commentEnd:"--\x3e",noBreak:!1,noBreakEmpty:null,tagType:"",tagName:"",isXML:!1,newlineAfterToken:function(a,f,c,b){b=!1;var d=null,g="";if(this.isXML="xml"==this.configuration,"comment"==a||/\x3c!--/.test(c))return!1;if("tag"==a){0==
  f.indexOf("\x3c")&&0==!f.indexOf("\x3c/")&&(this.tagType="open",d=f.match(/^<\s*?([\w]+?)$/i),this.tagName=null!=d?d[1]:"",g=this.tagName.toLowerCase(),-1!="|label|li|option|textarea|title|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+g+"|")&&(this.noBreak=!0));if(0==f.indexOf("\x3e")&&"open"==this.tagType)return this.tagType="",RegExp("^"+(this.isXML?"[^\x3c]*?":"")+"\x3c/s*?"+this.tagName+"s*?\x3e","i").test(c)?(this.noBreak=!1,this.isXML||
  (this.tagName=""),!1):(b=this.noBreak,this.noBreak=!1,!b);if(0==f.indexOf("\x3c/")&&(this.tagType="close",d=f.match(/^<\/\s*?([\w]+?)$/i),null!=d&&(g=d[1].toLowerCase()),-1!="|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+g+"|")&&(this.noBreak=!0)),0==f.indexOf("\x3e")&&"close"==this.tagType)return this.tagType="",0==c.indexOf("\x3c")&&(d=c.match(/^<\/?\s*?([\w]+?)(\s|>)/i),g=null!=d?d[1].toLowerCase():"",-1=="|label|li|option|textarea|title|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+
  g+"|"))?(this.noBreak=!1,!0):(b=this.noBreak,this.noBreak=!1,!b)}return 0==c.indexOf("\x3c")&&(this.noBreak=!1,this.isXML&&""!=this.tagName?(this.tagName="",!1):(d=c.match(/^<\/?\s*?([\w]+?)(\s|>)/i),g=null!=d?d[1].toLowerCase():"",-1=="|label|li|option|textarea|title|a|b|bdi|bdo|big|center|cite|del|em|font|i|img|ins|s|small|span|strike|strong|sub|sup|u|".indexOf("|"+g+"|")))}});a.defineExtension("commentRange",function(p,f,c){var b=this,d=a.innerMode(b.getMode(),b.getTokenAt(f).state).mode;b.operation(function(){if(p)b.replaceRange(d.commentEnd,
  c),b.replaceRange(d.commentStart,f),b.setSelection(f,{line:c.line,ch:c.ch+d.commentStart.length+d.commentEnd.length}),f.line==c.line&&f.ch==c.ch&&b.setCursor(f.line,f.ch+d.commentStart.length);else{var a=b.getRange(f,c),q=a.indexOf(d.commentStart),l=a.lastIndexOf(d.commentEnd);-1<q&&-1<l&&l>q&&(a=a.substr(0,q)+a.substring(q+d.commentStart.length,l)+a.substr(l+d.commentEnd.length));b.replaceRange(a,f,c);b.setSelection(f,{line:c.line,ch:c.ch-d.commentStart.length-d.commentEnd.length})}})});a.defineExtension("autoIndentRange",
  function(a,f){var c=this;this.operation(function(){for(var b=a.line;b<=f.line;b++)c.indentLine(b,"smart")})});a.defineExtension("autoFormatRange",function(p,f){for(var c=this,b=c.getMode(),d=c.getRange(p,f).split("\n"),g=a.copyState(b,c.getTokenAt(p).state),q=c.getOption("tabSize"),l="",m=0,r=0==p.ch,e=0;e<d.length;++e){for(var n=new a.StringStream(d[e],q);!n.eol();){var h=a.innerMode(b,g),t=b.token(n,g),k=n.current();n.start=n.pos;r&&!/\S/.test(k)||(l+=k,r=!1);!r&&h.mode.newlineAfterToken&&h.mode.newlineAfterToken(t,
  k,n.string.slice(n.pos)||d[e+1]||"",h.state)&&(l+="\n",r=!0,++m)}!n.pos&&b.blankLine&&b.blankLine(g);!r&&e<d.length-1&&(l+="\n",r=!0,++m)}c.operation(function(){c.replaceRange(l,p,f);for(var b=p.line+1,a=p.line+m;b<=a;++b)c.indentLine(b,"smart");c.setSelection(p,c.getCursor(!1))})})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/selection/active-line.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function k(a){for(var c=0;c<a.state.activeLines.length;c++)a.removeLineClass(a.state.activeLines[c],"wrap",b),a.removeLineClass(a.state.activeLines[c],"background",d),a.removeLineClass(a.state.activeLines[c],"gutter",g)}function p(b,a){if(b.length!=a.length)return!1;for(var c=
  0;c<b.length;c++)if(b[c]!=a[c])return!1;return!0}function f(a,c){for(var f=[],r=0;r<c.length;r++){var e=c[r],n=a.getOption("styleActiveLine");if("object"==typeof n&&n.nonEmpty?e.anchor.line==e.head.line:e.empty())e=a.getLineHandleVisualStart(e.head.line),f[f.length-1]!=e&&f.push(e)}p(a.state.activeLines,f)||a.operation(function(){k(a);for(var c=0;c<f.length;c++)a.addLineClass(f[c],"wrap",b),a.addLineClass(f[c],"background",d),a.addLineClass(f[c],"gutter",g);a.state.activeLines=f})}function c(b,a){f(b,
  a.ranges)}var b="CodeMirror-activeline",d="CodeMirror-activeline-background",g="CodeMirror-activeline-gutter";a.defineOption("styleActiveLine",!1,function(b,d,g){g=g!=a.Init&&g;d!=g&&(g&&(b.off("beforeSelectionChange",c),k(b),delete b.state.activeLines),d&&(b.state.activeLines=[],f(b,b.listSelections()),b.on("beforeSelectionChange",c)))})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/search/searchcursor",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function k(b,a){var c;c=b.flags;for(var e=c=null!=c?c:(b.ignoreCase?"i":"")+(b.global?"g":"")+(b.multiline?"m":""),d=0;d<a.length;d++)-1==e.indexOf(a.charAt(d))&&(e+=a.charAt(d));return c==e?b:new RegExp(b.source,e)}function p(b,a,c){a=k(a,"g");var e=c.line,d=c.ch;for(c=b.lastLine();e<=
  c;e++,d=0)if(a.lastIndex=d,d=b.getLine(e),d=a.exec(d))return{from:n(e,d.index),to:n(e,d.index+d[0].length),match:d}}function f(b,a,c){if(!/\\s|\\n|\n|\\W|\\D|\[\^/.test(a.source))return p(b,a,c);a=k(a,"gm");for(var e,d=1,f=c.line,g=b.lastLine();f<=g;){for(var r=0;r<d&&!(f>g);r++){var m=b.getLine(f++);e=null==e?m:e+"\n"+m}d*=2;a.lastIndex=c.ch;if(r=a.exec(e))return a=e.slice(0,r.index).split("\n"),b=r[0].split("\n"),c=c.line+a.length-1,a=a[a.length-1].length,{from:n(c,a),to:n(c+b.length-1,1==b.length?
  a+b[0].length:b[b.length-1].length),match:r}}}function c(b,a){for(var c,e=0;;){a.lastIndex=e;var d=a.exec(b);if(!d||(c=d,(e=c.index+(c[0].length||1))==b.length))return c}}function b(b,a,e){a=k(a,"g");var d=e.line,f=e.ch;for(e=b.firstLine();d>=e;d--,f=-1){var g=b.getLine(d);-1<f&&(g=g.slice(0,f));if(f=c(g,a))return{from:n(d,f.index),to:n(d,f.index+f[0].length),match:f}}}function d(b,a,e){a=k(a,"gm");for(var d,f=1,g=e.line,r=b.firstLine();g>=r;){for(var m=0;m<f;m++){var p=b.getLine(g--);d=null==d?p.slice(0,
  e.ch):p+"\n"+d}f*=2;if(m=c(d,a))return a=d.slice(0,m.index).split("\n"),b=m[0].split("\n"),g+=a.length,a=a[a.length-1].length,{from:n(g,a),to:n(g+b.length-1,1==b.length?a+b[0].length:b[b.length-1].length),match:m}}}function g(b,a,c,e){if(b.length==a.length)return c;var d=0;for(a=c+Math.max(0,b.length-a.length);;){if(d==a)return d;var f=d+a>>1,g=e(b.slice(0,f)).length;if(g==c)return f;g>c?a=f:d=f+1}}function q(b,a,c,d){if(!a.length)return null;d=d?r:e;a=d(a).split(/\r|\n\r?/);var f=c.line;c=c.ch;var m=
  b.lastLine()+1-a.length;a:for(;f<=m;f++,c=0){var p=b.getLine(f).slice(c),k=d(p);if(1==a.length){var l=k.indexOf(a[0]);if(-1==l)continue a;g(p,k,l,d);return{from:n(f,g(p,k,l,d)+c),to:n(f,g(p,k,l+a[0].length,d)+c)}}l=k.length-a[0].length;if(k.slice(l)==a[0]){for(var q=1;q<a.length-1;q++)if(d(b.getLine(f+q))!=a[q])continue a;var q=b.getLine(f+a.length-1),w=d(q),z=a[a.length-1];if(w.slice(0,z.length)==z)return{from:n(f,g(p,k,l,d)+c),to:n(f+a.length-1,g(q,w,z.length,d))}}}}function l(b,a,c,d){if(!a.length)return null;
  d=d?r:e;a=d(a).split(/\r|\n\r?/);var f=c.line,m=c.ch,p=b.firstLine()-1+a.length;a:for(;f>=p;f--,m=-1){var k=b.getLine(f);-1<m&&(k=k.slice(0,m));m=d(k);if(1==a.length){c=m.lastIndexOf(a[0]);if(-1==c)continue a;return{from:n(f,g(k,m,c,d)),to:n(f,g(k,m,c+a[0].length,d))}}var l=a[a.length-1];if(m.slice(0,l.length)==l){var q=1;for(c=f-a.length+1;q<a.length-1;q++)if(d(b.getLine(c+q))!=a[q])continue a;c=b.getLine(f+1-a.length);q=d(c);if(q.slice(q.length-a[0].length)==a[0])return{from:n(f+1-a.length,g(c,
  q,c.length-a[0].length,d)),to:n(f,g(k,m,l.length,d))}}}}function m(a,c,e,g){this.atOccurrence=!1;this.doc=a;e=e?a.clipPos(e):n(0,0);this.pos={from:e,to:e};var m;"object"==typeof g?m=g.caseFold:(m=g,g=null);"string"==typeof c?(null==m&&(m=!1),this.matches=function(b,e){return(b?l:q)(a,c,e,m)}):(c=k(c,"gm"),g&&!1===g.multiline?this.matches=function(e,d){return(e?b:p)(a,c,d)}:this.matches=function(b,e){return(b?d:f)(a,c,e)})}var r,e,n=a.Pos;String.prototype.normalize?(r=function(b){return b.normalize("NFD").toLowerCase()},
  e=function(b){return b.normalize("NFD")}):(r=function(b){return b.toLowerCase()},e=function(b){return b});m.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(b){for(var c=this.matches(b,this.doc.clipPos(b?this.pos.from:this.pos.to));c&&0==a.cmpPos(c.from,c.to);)b?c.from.ch?c.from=n(c.from.line,c.from.ch-1):c=c.from.line==this.doc.firstLine()?null:this.matches(b,this.doc.clipPos(n(c.from.line-1))):c.to.ch<this.doc.getLine(c.to.line).length?
  c.to=n(c.to.line,c.to.ch+1):c=c.to.line==this.doc.lastLine()?null:this.matches(b,n(c.to.line+1,0));if(c)return this.pos=c,this.atOccurrence=!0,this.pos.match||!0;b=n(b?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:b,to:b},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(b,c){if(this.atOccurrence){var e=a.splitLines(b);this.doc.replaceRange(e,this.pos.from,this.pos.to,c);this.pos.to=
  n(this.pos.from.line+e.length-1,e[e.length-1].length+(1==e.length?this.pos.from.ch:0))}}};a.defineExtension("getSearchCursor",function(b,a,c){return new m(this.doc,b,a,c)});a.defineDocExtension("getSearchCursor",function(b,a,c){return new m(this,b,a,c)});a.defineExtension("selectMatches",function(b,c){for(var e=[],d=this.getSearchCursor(b,this.getCursor("from"),c);d.findNext()&&!(0<a.cmpPos(d.to(),this.getCursor("to")));)e.push({anchor:d.from(),head:d.to()});e.length&&this.setSelections(e,0)})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/scroll/annotatescrollbar",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function k(a,f){function c(a){clearTimeout(b.doRedraw);b.doRedraw=setTimeout(function(){b.redraw()},a)}this.cm=a;this.options=f;this.buttonHeight=f.scrollButtonHeight||a.getOption("scrollButtonHeight");this.annotations=[];this.doRedraw=this.doUpdate=null;this.div=a.getWrapperElement().appendChild(document.createElement("div"));
  this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none";this.computeScale();var b=this;a.on("refresh",this.resizeHandler=function(){clearTimeout(b.doUpdate);b.doUpdate=setTimeout(function(){b.computeScale()&&c(20)},100)});a.on("markerAdded",this.resizeHandler);a.on("markerCleared",this.resizeHandler);!1!==f.listenForChanges&&a.on("change",this.changeHandler=function(){c(250)})}a.defineExtension("annotateScrollbar",function(a){return"string"==typeof a&&(a={className:a}),
  new k(this,a)});a.defineOption("scrollButtonHeight",0);k.prototype.computeScale=function(){var a=this.cm,a=(a.getWrapperElement().clientHeight-a.display.barHeight-2*this.buttonHeight)/a.getScrollerElement().scrollHeight;if(a!=this.hScale)return this.hScale=a,!0};k.prototype.update=function(a){this.annotations=a;this.redraw()};k.prototype.redraw=function(a){function f(a,b){return l!=a.line&&(l=a.line,m=c.getLineHandle(l)),m.widgets&&m.widgets.length||g&&m.height>k?c.charCoords(a,"local")[b?"top":"bottom"]:
  c.heightAtLine(m,"local")+(b?0:m.height)}!1!==a&&this.computeScale();var c=this.cm;a=this.hScale;var b=document.createDocumentFragment(),d=this.annotations,g=c.getOption("lineWrapping"),k=g&&1.5*c.defaultTextHeight(),l=null,m=null,r=c.lastLine();if(c.display.barWidth)for(var e,n=0;n<d.length;n++){var h=d[n];if(!(h.to.line>r)){for(var t=e||f(h.from,!0)*a,u=f(h.to,!1)*a;n<d.length-1&&!(d[n+1].to.line>r)&&!((e=f(d[n+1].from,!0)*a)>u+.9);)h=d[++n],u=f(h.to,!1)*a;if(u!=t){var u=Math.max(u-t,3),y=b.appendChild(document.createElement("div"));
  y.style.cssText="position: absolute; right: 0px; width: "+Math.max(c.display.barWidth-1,2)+"px; top: "+(t+this.buttonHeight)+"px; height: "+u+"px";y.className=this.options.className;h.id&&y.setAttribute("annotation-id",h.id)}}}this.div.textContent="";this.div.appendChild(b)};k.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler);this.cm.off("markerAdded",this.resizeHandler);this.cm.off("markerCleared",this.resizeHandler);this.changeHandler&&this.cm.off("change",this.changeHandler);
  this.div.parentNode.removeChild(this.div)}});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define("addon/search/matchesonscrollbar",["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],a):a(CodeMirror)})(function(a){function k(a,c,b,d){this.cm=a;this.options=d;var g={listenForChanges:!1},k;for(k in d)g[k]=d[k];g.className||(g.className="CodeMirror-search-match");this.annotation=
  a.annotateScrollbar(g);this.query=c;this.caseFold=b;this.gap={from:a.firstLine(),to:a.lastLine()+1};this.matches=[];this.update=null;this.findMatches();this.annotation.update(this.matches);var l=this;a.on("change",this.changeHandler=function(a,b){l.onChange(b)})}function p(a,c,b){return a<=c?a:Math.max(c,a+b)}a.defineExtension("showMatchesOnScrollbar",function(a,c,b){return"string"==typeof b&&(b={className:b}),b||(b={}),new k(this,a,c,b)});k.prototype.findMatches=function(){if(this.gap){for(var f=
  0;f<this.matches.length;f++){var c=this.matches[f];if(c.from.line>=this.gap.to)break;c.to.line>=this.gap.from&&this.matches.splice(f--,1)}for(var b=this.cm.getSearchCursor(this.query,a.Pos(this.gap.from,0),this.caseFold),d=this.options&&this.options.maxMatches||1E3;b.findNext();){c={from:b.from(),to:b.to()};if(c.from.line>=this.gap.to)break;if(this.matches.splice(f++,0,c),this.matches.length>d)break}this.gap=null}};k.prototype.onChange=function(f){var c=f.from.line,b=a.changeEnd(f).line,d=b-f.to.line;
  if(this.gap?(this.gap.from=Math.min(p(this.gap.from,c,d),f.from.line),this.gap.to=Math.max(p(this.gap.to,c,d),f.from.line)):this.gap={from:f.from.line,to:b+1},d)for(f=0;f<this.matches.length;f++){var b=this.matches[f],g=p(b.from.line,c,d);g!=b.from.line&&(b.from=a.Pos(g,b.from.ch));g=p(b.to.line,c,d);g!=b.to.line&&(b.to=a.Pos(g,b.to.ch))}clearTimeout(this.update);var k=this;this.update=setTimeout(function(){k.updateAfterChange()},250)};k.prototype.updateAfterChange=function(){this.findMatches();this.annotation.update(this.matches)};
  k.prototype.clear=function(){this.cm.off("change",this.changeHandler);this.annotation.clear()}});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define("addon/search/match-highlighter.js",["../../lib/codemirror","./matchesonscrollbar"],a):a(CodeMirror)})(function(a){function k(a){this.options={};for(var b in l)this.options[b]=(a&&a.hasOwnProperty(b)?a:l)[b];this.matchesonscroll=this.overlay=this.timeout=null;this.active=!1}function p(a){var b=a.state.matchHighlighter;(b.active||
  a.hasFocus())&&c(a,b)}function f(a){var b=a.state.matchHighlighter;b.active||(b.active=!0,c(a,b))}function c(a,b){clearTimeout(b.timeout);b.timeout=setTimeout(function(){g(a)},b.options.delay)}function b(a,b,c,d){var f=a.state.matchHighlighter;if(a.addOverlay(f.overlay=q(b,c,d)),f.options.annotateScrollbar&&a.showMatchesOnScrollbar)b=c?new RegExp("\\b"+b.replace(/[\\\[.+*?(){|^$]/g,"\\$\x26")+"\\b"):b,f.matchesonscroll=a.showMatchesOnScrollbar(b,!1,{className:"CodeMirror-selection-highlight-scrollbar"})}
  function d(a){var b=a.state.matchHighlighter;b.overlay&&(a.removeOverlay(b.overlay),b.overlay=null,b.matchesonscroll&&(b.matchesonscroll.clear(),b.matchesonscroll=null))}function g(a){a.operation(function(){var c=a.state.matchHighlighter;if(d(a),!a.somethingSelected()&&c.options.showToken){for(var e=!0===c.options.showToken?/[\w$]/:c.options.showToken,f=a.getCursor(),g=a.getLine(f.line),k=f=f.ch;f&&e.test(g.charAt(f-1));)--f;for(;k<g.length&&e.test(g.charAt(k));)++k;return void(f<k&&b(a,g.slice(f,
  k),e,c.options.style))}e=a.getCursor("from");g=a.getCursor("to");if((f=e.line==g.line)&&!(f=!c.options.wordsOnly))a:if(null!==a.getRange(e,g).match(/^\w+$/)){if(0<e.ch&&(f={line:e.line,ch:e.ch-1},f=a.getRange(f,e),null===f.match(/\W/))){f=!1;break a}if(g.ch<a.getLine(e.line).length&&(f={line:g.line,ch:g.ch+1},f=a.getRange(g,f),null===f.match(/\W/))){f=!1;break a}f=!0}else f=!1;f&&(e=a.getRange(e,g),c.options.trim&&(e=e.replace(/^\s+|\s+$/g,"")),e.length>=c.options.minChars&&b(a,e,!1,c.options.style))})}
  function q(a,b,c){return{token:function(d){var f;if(f=d.match(a))(f=!b)||(f=!(d.start&&b.test(d.string.charAt(d.start-1))||d.pos!=d.string.length&&b.test(d.string.charAt(d.pos))));if(f)return c;d.next();d.skipTo(a.charAt(0))||d.skipToEnd()}}}var l={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};a.defineOption("highlightSelectionMatches",!1,function(b,c,e){if(e&&e!=a.Init&&(d(b),clearTimeout(b.state.matchHighlighter.timeout),b.state.matchHighlighter=
  null,b.off("cursorActivity",p),b.off("focus",f)),c)c=b.state.matchHighlighter=new k(c),b.hasFocus()?(c.active=!0,g(b)):b.on("focus",f),b.on("cursorActivity",p)})});
  (function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/mode/multiplex.js",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){a.multiplexingMode=function(k){function p(a,b,d,f){return"string"==typeof b?(d=a.indexOf(b,d),f&&-1<d?d+b.length:d):(b=b.exec(d?a.slice(d):a))?b.index+d+(f?b[0].length:0):-1}var f=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:a.startState(k),
  innerActive:null,inner:null}},copyState:function(c){return{outer:a.copyState(k,c.outer),innerActive:c.innerActive,inner:c.innerActive&&a.copyState(c.innerActive.mode,c.inner)}},token:function(c,b){if(b.innerActive){var d=b.innerActive,g=c.string;if(!d.close&&c.sol())return b.innerActive=b.inner=null,this.token(c,b);var q=d.close?p(g,d.close,c.pos,d.parseDelimiters):-1;if(q==c.pos&&!d.parseDelimiters)return c.match(d.close),b.innerActive=b.inner=null,d.delimStyle&&d.delimStyle+" "+d.delimStyle+"-close";
  -1<q&&(c.string=g.slice(0,q));var l=d.mode.token(c,b.inner);return-1<q&&(c.string=g),q==c.pos&&d.parseDelimiters&&(b.innerActive=b.inner=null),d.innerStyle&&(l=l?l+" "+d.innerStyle:d.innerStyle),l}for(var l=1/0,g=c.string,m=0;m<f.length;++m){d=f[m];q=p(g,d.open,c.pos);if(q==c.pos)return d.parseDelimiters||c.match(d.open),b.innerActive=d,g=0,k.indent&&(q=k.indent(b.outer,"",""),q!==a.Pass&&(g=q)),b.inner=a.startState(d.mode,g),d.delimStyle&&d.delimStyle+" "+d.delimStyle+"-open";-1!=q&&q<l&&(l=q)}l!=
  1/0&&(c.string=g.slice(0,l));q=k.token(c,b.outer);return l!=1/0&&(c.string=g),q},indent:function(c,b,d){var f=c.innerActive?c.innerActive.mode:k;return f.indent?f.indent(c.innerActive?c.inner:c.outer,b,d):a.Pass},blankLine:function(c){var b=c.innerActive?c.innerActive.mode:k;if(b.blankLine&&b.blankLine(c.innerActive?c.inner:c.outer),c.innerActive)"\n"===c.innerActive.close&&(c.innerActive=c.inner=null);else for(var d=0;d<f.length;++d){var g=f[d];"\n"===g.open&&(c.innerActive=g,c.inner=a.startState(g.mode,
  b.indent?b.indent(c.outer,"",""):0))}},electricChars:k.electricChars,innerMode:function(a){return a.inner?{state:a.inner,mode:a.innerActive.mode}:{state:a.outer,mode:k}}}}});
  (function(a){"function"==typeof a.define&&a.define("addons","addon/comment/continuecomment.js addon/edit/closebrackets.js addon/edit/closetag.js addon/edit/matchbrackets.js addon/edit/matchtags.js addon/edit/trailingspace.js addon/fold/foldgutter.js addon/fold/brace-fold.js addon/fold/comment-fold.js addon/fold/indent-fold.js addon/format/autoFormatAll.js addon/format/formatting.js addon/selection/active-line.js addon/search/match-highlighter.js addon/mode/multiplex.js".split(" "),function(){})})(this);
  