玛氪宕·梦魔(Markdown Memo),使用Markdown的云端备忘录,百度IFE的RIA启航班的不合格的作业,才……才没有什么阴谋呢! 源gitee链接https://gitee.com/arathi/MarkdownMemo?_from=gitee_search
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

4 lines
38 KiB

/*! Editor.md v1.4.5 | addons.min.js | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-02 */
!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){e.defineOption("showTrailingSpace",!1,function(t,i,o){o==e.Init&&(o=!1),o&&!i?t.removeOverlay("trailingspace"):!o&&i&&t.addOverlay({token:function(e){for(var t=e.string.length,i=t;i&&/\s/.test(e.string.charAt(i-1));--i);return i>e.pos?(e.pos=i,null):(e.pos=t,"trailingspace")},name:"trailingspace"})})}),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){function t(e,t,i){var o,n=e.getWrapperElement();return o=n.appendChild(document.createElement("div")),i?o.className="CodeMirror-dialog CodeMirror-dialog-bottom":o.className="CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?o.innerHTML=t:o.appendChild(t),o}function i(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(o,n,r){function a(e){if("string"==typeof e)h.value=e;else{if(c)return;c=!0,l.parentNode.removeChild(l),d.focus(),r.onClose&&r.onClose(l)}}r||(r={}),i(this,null);var s,l=t(this,o,r.bottom),c=!1,d=this,h=l.getElementsByTagName("input")[0];return h?(r.value&&(h.value=r.value,h.select()),r.onInput&&e.on(h,"input",function(e){r.onInput(e,h.value,a)}),r.onKeyUp&&e.on(h,"keyup",function(e){r.onKeyUp(e,h.value,a)}),e.on(h,"keydown",function(t){r&&r.onKeyDown&&r.onKeyDown(t,h.value,a)||((27==t.keyCode||r.closeOnEnter!==!1&&13==t.keyCode)&&(h.blur(),e.e_stop(t),a()),13==t.keyCode&&n(h.value,t))}),r.closeOnBlur!==!1&&e.on(h,"blur",a),h.focus()):(s=l.getElementsByTagName("button")[0])&&(e.on(s,"click",function(){a(),d.focus()}),r.closeOnBlur!==!1&&e.on(s,"blur",a),s.focus()),a}),e.defineExtension("openConfirm",function(o,n,r){function a(){c||(c=!0,s.parentNode.removeChild(s),d.focus())}i(this,null);var s=t(this,o,r&&r.bottom),l=s.getElementsByTagName("button"),c=!1,d=this,h=1;l[0].focus();for(var u=0;u<l.length;++u){var f=l[u];!function(t){e.on(f,"click",function(i){e.e_preventDefault(i),a(),t&&t(d)})}(n[u]),e.on(f,"blur",function(){--h,setTimeout(function(){0>=h&&a()},200)}),e.on(f,"focus",function(){++h})}}),e.defineExtension("openNotification",function(o,n){function r(){l||(l=!0,clearTimeout(a),s.parentNode.removeChild(s))}i(this,r);var a,s=t(this,o,n&&n.bottom),l=!1,c=n&&"undefined"!=typeof n.duration?n.duration:5e3;return e.on(s,"click",function(t){e.e_preventDefault(t),r()}),c&&(a=setTimeout(r,c)),r})}),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";function t(e,t,n,r){if(this.atOccurrence=!1,this.doc=e,null==r&&"string"==typeof t&&(r=!1),n=n?e.clipPos(n):o(0,0),this.pos={from:n,to:n},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(i,n){if(i){t.lastIndex=0;for(var r,a,s=e.getLine(n.line).slice(0,n.ch),l=0;;){t.lastIndex=l;var c=t.exec(s);if(!c)break;if(r=c,a=r.index,l=r.index+(r[0].length||1),l==s.length)break}var d=r&&r[0].length||0;d||(0==a&&0==s.length?r=void 0:a!=e.getLine(n.line).length&&d++)}else{t.lastIndex=n.ch;var s=e.getLine(n.line),r=t.exec(s),d=r&&r[0].length||0,a=r&&r.index;a+d==s.length||d||(d=1)}return r&&d?{from:o(n.line,a),to:o(n.line,a+d),match:r}:void 0};else{var a=t;r&&(t=t.toLowerCase());var s=r?function(e){return e.toLowerCase()}:function(e){return e},l=t.split("\n");if(1==l.length)t.length?this.matches=function(n,r){if(n){var l=e.getLine(r.line).slice(0,r.ch),c=s(l),d=c.lastIndexOf(t);if(d>-1)return d=i(l,c,d),{from:o(r.line,d),to:o(r.line,d+a.length)}}else{var l=e.getLine(r.line).slice(r.ch),c=s(l),d=c.indexOf(t);if(d>-1)return d=i(l,c,d)+r.ch,{from:o(r.line,d),to:o(r.line,d+a.length)}}}:this.matches=function(){};else{var c=a.split("\n");this.matches=function(t,i){var n=l.length-1;if(t){if(i.line-(l.length-1)<e.firstLine())return;if(s(e.getLine(i.line).slice(0,c[n].length))!=l[l.length-1])return;for(var r=o(i.line,c[n].length),a=i.line-1,d=n-1;d>=1;--d,--a)if(l[d]!=s(e.getLine(a)))return;var h=e.getLine(a),u=h.length-c[0].length;if(s(h.slice(u))!=l[0])return;return{from:o(a,u),to:r}}if(!(i.line+(l.length-1)>e.lastLine())){var h=e.getLine(i.line),u=h.length-c[0].length;if(s(h.slice(u))==l[0]){for(var f=o(i.line,u),a=i.line+1,d=1;n>d;++d,++a)if(l[d]!=s(e.getLine(a)))return;if(s(e.getLine(a).slice(0,c[n].length))==l[n])return{from:f,to:o(a,c[n].length)}}}}}}}function i(e,t,i){if(e.length==t.length)return i;for(var o=Math.min(i,e.length);;){var n=e.slice(0,o).toLowerCase().length;if(i>n)++o;else{if(!(n>i))return o;--o}}}var o=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=o(e,0);return i.pos={from:t,to:t},i.atOccurrence=!1,!1}for(var i=this,n=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,n))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!n.line)return t(0);n=o(n.line-1,this.doc.getLine(n.line-1).length)}else{var r=this.doc.lineCount();if(n.line==r-1)return t(r);n=o(n.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to),this.pos.to=o(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,i,o){return new t(this.doc,e,i,o)}),e.defineDocExtension("getSearchCursor",function(e,i,o){return new t(this,e,i,o)}),e.defineExtension("selectMatches",function(t,i){for(var o,n=[],r=this.getSearchCursor(t,this.getCursor("from"),i);(o=r.findNext())&&!(e.cmpPos(r.to(),this.getCursor("to"))>0);)n.push({anchor:r.from(),head:r.to()});n.length&&this.setSelections(n,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var i=e.exec(t.string);return i&&i.index==t.pos?(t.pos+=i[0].length,"searching"):void(i?t.pos=i.index:t.skipToEnd())}}}function i(){this.posFrom=this.posTo=this.query=null,this.overlay=null}function o(e){return e.state.search||(e.state.search=new i)}function n(e){return"string"==typeof e&&e==e.toLowerCase()}function r(e,t,i){return e.getSearchCursor(t,i,n(t))}function a(e,t,i,o,n){e.openDialog?e.openDialog(t,n,{value:o}):n(prompt(i,o))}function s(e,t,i,o){e.openConfirm?e.openConfirm(t,o):confirm(i)&&o[0]()}function l(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(i){}return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function c(e,i){var r=o(e);return r.query?d(e,i):void a(e,f,"Search for:",e.getSelection(),function(o){e.operation(function(){o&&!r.query&&(r.query=l(o),e.removeOverlay(r.overlay,n(r.query)),r.overlay=t(r.query,n(r.query)),e.addOverlay(r.overlay),e.showMatchesOnScrollbar&&(r.annotate&&(r.annotate.clear(),r.annotate=null),r.annotate=e.showMatchesOnScrollbar(r.query,n(r.query))),r.posFrom=r.posTo=e.getCursor(),d(e,i))})})}function d(t,i){t.operation(function(){var n=o(t),a=r(t,n.query,i?n.posFrom:n.posTo);(a.find(i)||(a=r(t,n.query,i?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),a.find(i)))&&(t.setSelection(a.from(),a.to()),t.scrollIntoView({from:a.from(),to:a.to()}),n.posFrom=a.from(),n.posTo=a.to())})}function h(e){e.operation(function(){var t=o(e);t.query&&(t.query=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function u(e,t){e.getOption("readOnly")||a(e,g,"Replace:",e.getSelection(),function(i){i&&(i=l(i),a(e,p,"Replace with:","",function(o){if(t)e.operation(function(){for(var t=r(e,i);t.findNext();)if("string"!=typeof i){var n=e.getRange(t.from(),t.to()).match(i);t.replace(o.replace(/\$(\d)/g,function(e,t){return n[t]}))}else t.replace(o)});else{h(e);var n=r(e,i,e.getCursor()),a=function(){var t,o=n.from();!(t=n.findNext())&&(n=r(e,i),!(t=n.findNext())||o&&n.from().line==o.line&&n.from().ch==o.ch)||(e.setSelection(n.from(),n.to()),e.scrollIntoView({from:n.from(),to:n.to()}),s(e,m,"Replace?",[function(){l(t)},a]))},l=function(e){n.replace("string"==typeof i?o:o.replace(/\$(\d)/g,function(t,i){return e[i]})),a()};a()}}))})}var f='Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',g='Replace: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',p='With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',m="Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";e.commands.find=function(e){h(e),c(e)},e.commands.findNext=c,e.commands.findPrev=function(e){c(e,!0)},e.commands.clearSearch=h,e.commands.replace=u,e.commands.replaceAll=function(e){u(e,!0)}}),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";function t(e,t){function i(e){clearTimeout(o.doRedraw),o.doRedraw=setTimeout(function(){o.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var o=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(o.doUpdate),o.doUpdate=setTimeout(function(){o.computeScale()&&i(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){i(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.heightAtLine(e.lastLine()+1,"local");return t!=this.hScale?(this.hScale=t,!0):void 0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){e!==!1&&this.computeScale();var t=this.cm,i=this.hScale,o=document.createDocumentFragment(),n=this.annotations;if(t.display.barWidth)for(var r,a=0;a<n.length;a++){for(var s=n[a],l=r||t.charCoords(s.from,"local").top*i,c=t.charCoords(s.to,"local").bottom*i;a<n.length-1&&(r=t.charCoords(n[a+1].from,"local").top*i,!(r>c+.9));)s=n[++a],c=t.charCoords(s.to,"local").bottom*i;if(c!=l){var d=Math.max(c-l,3),h=o.appendChild(document.createElement("div"));h.style.cssText="position: absolute; right: 0px; width: "+Math.max(t.display.barWidth-1,2)+"px; top: "+(l+this.buttonHeight)+"px; height: "+d+"px",h.className=this.options.className}}this.div.textContent="",this.div.appendChild(o)},t.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(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,i,o){this.cm=e;var n={listenForChanges:!1};for(var r in o)n[r]=o[r];n.className||(n.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(n),this.query=t,this.caseFold=i,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function i(e,t,i){return t>=e?e:Math.max(t,e+i)}e.defineExtension("showMatchesOnScrollbar",function(e,i,o){return"string"==typeof o&&(o={className:o}),o||(o={}),new t(this,e,i,o)});var o=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t<this.matches.length;t++){var i=this.matches[t];if(i.from.line>=this.gap.to)break;i.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var n=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold);n.findNext();){var i={from:n.from(),to:n.to()};if(i.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,i),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var o=t.from.line,n=e.changeEnd(t).line,r=n-t.to.line;if(this.gap?(this.gap.from=Math.min(i(this.gap.from,o,r),t.from.line),this.gap.to=Math.max(i(this.gap.to,o,r),t.from.line)):this.gap={from:t.from.line,to:n+1},r)for(var a=0;a<this.matches.length;a++){var s=this.matches[a],l=i(s.from.line,o,r);l!=s.from.line&&(s.from=e.Pos(l,s.from.ch));var c=i(s.to.line,o,r);c!=s.to.line&&(s.to=e.Pos(c,s.to.ch))}clearTimeout(this.update);var d=this;this.update=setTimeout(function(){d.updateAfterChange()},250)},t.prototype.updateAfterChange=function(){this.findMatches(),this.annotation.update(this.matches)},t.prototype.clear=function(){this.cm.off("change",this.changeHandler),this.annotation.clear()}}),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){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function i(e){t(e);var i=e.state.placeholder=document.createElement("pre");i.style.cssText="height: 0; overflow: visible",i.className="CodeMirror-placeholder",i.appendChild(document.createTextNode(e.getOption("placeholder"))),e.display.lineSpace.insertBefore(i,e.display.lineSpace.firstChild)}function o(e){r(e)&&i(e)}function n(e){var o=e.getWrapperElement(),n=r(e);o.className=o.className.replace(" CodeMirror-empty","")+(n?" CodeMirror-empty":""),n?i(e):t(e)}function r(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(i,r,a){var s=a&&a!=e.Init;if(r&&!s)i.on("blur",o),i.on("change",n),n(i);else if(!r&&s){i.off("blur",o),i.off("change",n),t(i);var l=i.getWrapperElement();l.className=l.className.replace(" CodeMirror-empty","")}r&&!i.hasFocus()&&o(i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var i=t.listSelections(),o=[],l=0;l<i.length;l++){if(!i[l].empty())return e.Pass;var c=i[l].head,d=t.getTokenAt(c),h=e.innerMode(t.getMode(),d.state),u=h.state;if("xml"!=h.mode.name||!u.tagName)return e.Pass;var f=t.getOption("autoCloseTags"),g="html"==h.mode.configuration,p="object"==typeof f&&f.dontCloseTags||g&&a,m="object"==typeof f&&f.indentTags||g&&s,v=u.tagName;d.end>c.ch&&(v=v.slice(0,v.length-d.end+c.ch));var w=v.toLowerCase();if(!v||"string"==d.type&&(d.end!=c.ch||!/[\"\']/.test(d.string.charAt(d.string.length-1))||1==d.string.length)||"tag"==d.type&&"closeTag"==u.type||d.string.indexOf("/")==d.string.length-1||p&&n(p,w)>-1||r(t,v,c,u,!0))return e.Pass;var b=m&&n(m,w)>-1;o[l]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var l=i.length-1;l>=0;l--){var y=o[l];t.replaceRange(y.text,i[l].head,i[l].anchor,"+insert");var k=t.listSelections().slice(0);k[l]={head:y.newPos,anchor:y.newPos},t.setSelections(k),y.indent&&(t.indentLine(y.newPos.line,null,!0),t.indentLine(y.newPos.line+1,null,!0))}}function i(t,i){for(var o=t.listSelections(),n=[],a=i?"/":"</",s=0;s<o.length;s++){if(!o[s].empty())return e.Pass;var l=o[s].head,c=t.getTokenAt(l),d=e.innerMode(t.getMode(),c.state),h=d.state;if(i&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=l.ch-1))return e.Pass;if("xml"!=d.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==d.mode.name)n[s]=a+"script>";else{if("htmlmixed"!=t.getMode().name||"css"!=d.mode.name)return e.Pass;n[s]=a+"style>"}else{if(!h.context||!h.context.tagName||r(t,h.context.tagName,l,h))return e.Pass;n[s]=a+h.context.tagName+">"}}t.replaceSelections(n),o=t.listSelections();for(var s=0;s<o.length;s++)(s==o.length-1||o[s].head.line<o[s+1].head.line)&&t.indentLine(o[s].head.line)}function o(t){return t.getOption("disableInput")?e.Pass:i(t,!0)}function n(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0,o=e.length;o>i;++i)if(e[i]==t)return i;return-1}function r(t,i,o,n,r){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,o.line+500),s=e.scanForClosingTag(t,o,null,a);if(!s||s.tag!=i)return!1;for(var l=n.context,c=r?1:0;l&&l.tagName==i;l=l.prev)++c;o=s.to;for(var d=1;c>d;d++){var h=e.scanForClosingTag(t,o,null,a);if(!h||h.tag!=i)return!1;o=h.to}return!0}e.defineOption("autoCloseTags",!1,function(i,n,r){if(r!=e.Init&&r&&i.removeKeyMap("autoCloseTags"),n){var a={name:"autoCloseTags"};("object"!=typeof n||n.whenClosing)&&(a["'/'"]=function(e){return o(e)}),("object"!=typeof n||n.whenOpening)&&(a["'>'"]=function(e){return t(e)}),i.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],s=["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"];e.commands.closeTag=function(e){return i(e)}}),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";function t(t,n,r,a){function s(e){var i=l(t,n);if(!i||i.to.line-i.from.line<c)return null;for(var o=t.findMarksAt(i.from),r=0;r<o.length;++r)if(o[r].__isFold&&"fold"!==a){if(!e)return null;i.cleared=!0,o[r].clear()}return i}if(r&&r.call){var l=r;r=null}else var l=o(t,r,"rangeFinder");"number"==typeof n&&(n=e.Pos(n,0));var c=o(t,r,"minFoldSize"),d=s(!0);if(o(t,r,"scanUp"))for(;!d&&n.line>t.firstLine();)n=e.Pos(n.line-1,0),d=s(!1);if(d&&!d.cleared&&"unfold"!==a){var h=i(t,r);e.on(h,"mousedown",function(t){u.clear(),e.e_preventDefault(t)});var u=t.markText(d.from,d.to,{replacedWith:h,clearOnEnter:!0,__isFold:!0});u.on("clear",function(i,o){e.signal(t,"unfold",t,i,o)}),e.signal(t,"fold",t,d.from,d.to)}}function i(e,t){var i=o(e,t,"widget");if("string"==typeof i){var n=document.createTextNode(i);i=document.createElement("span"),i.appendChild(n),i.className="CodeMirror-foldmarker"}return i}function o(e,t,i){if(t&&void 0!==t[i])return t[i];var o=e.options.foldOptions;return o&&void 0!==o[i]?o[i]:n[i]}e.newFoldFunction=function(e,i){return function(o,n){t(o,n,{rangeFinder:e,widget:i})}},e.defineExtension("foldCode",function(e,i,o){t(this,e,i,o)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),i=0;i<t.length;++i)if(t[i].__isFold)return!0}),e.commands.toggleFold=function(e){e.foldCode(e.getCursor())},e.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},e.commands.unfold=function(e){e.foldCode(e.getCursor(),null,"unfold")},e.commands.foldAll=function(t){t.operation(function(){for(var i=t.firstLine(),o=t.lastLine();o>=i;i++)t.foldCode(e.Pos(i,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var i=t.firstLine(),o=t.lastLine();o>=i;i++)t.foldCode(e.Pos(i,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,i){for(var o=0;o<e.length;++o){var n=e[o](t,i);if(n)return n}}}),e.registerHelper("fold","auto",function(e,t){for(var i=e.getHelpers(t,"fold"),o=0;o<i.length;o++){var n=i[o](e,t);if(n)return n}});var n={rangeFinder:e.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1};e.defineOption("foldOptions",null),e.defineExtension("foldOption",function(e,t){return o(this,e,t)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options=e,this.from=this.to=0}function i(e){return e===!0&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function o(e,t){for(var i=e.findMarksAt(h(t)),o=0;o<i.length;++o)if(i[o].__isFold&&i[o].find().from.line==t)return!0}function n(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}return e.cloneNode(!0)}function r(e,t,i){var r=e.state.foldGutter.options,a=t,s=e.foldOption(r,"minFoldSize"),l=e.foldOption(r,"rangeFinder");e.eachLine(t,i,function(t){var i=null;if(o(e,a))i=n(r.indicatorFolded);else{var c=h(a,0),d=l&&l(e,c);d&&d.to.line-d.from.line>=s&&(i=n(r.indicatorOpen))}e.setGutterMarker(t,r.gutter,i),++a})}function a(e){var t=e.getViewport(),i=e.state.foldGutter;i&&(e.operation(function(){r(e,t.from,t.to)}),i.from=t.from,i.to=t.to)}function s(e,t,i){var o=e.state.foldGutter;if(o){var n=o.options;i==n.gutter&&e.foldCode(h(t,0),n.rangeFinder)}}function l(e){var t=e.state.foldGutter;if(t){var i=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},i.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var i=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var i=e.getViewport();t.from==t.to||i.from-t.to>20||t.from-i.to>20?a(e):e.operation(function(){i.from<t.from&&(r(e,i.from,t.from),t.from=i.from),i.to>t.to&&(r(e,t.to,i.to),t.to=i.to)})},i.updateViewportTimeSpan||400)}}function d(e,t){var i=e.state.foldGutter;if(i){var o=t.line;o>=i.from&&o<i.to&&r(e,o,o+1)}}e.defineOption("foldGutter",!1,function(o,n,r){r&&r!=e.Init&&(o.clearGutter(o.state.foldGutter.options.gutter),o.state.foldGutter=null,o.off("gutterClick",s),o.off("change",l),o.off("viewportChange",c),o.off("fold",d),o.off("unfold",d),o.off("swapDoc",a)),n&&(o.state.foldGutter=new t(i(n)),a(o),o.on("gutterClick",s),o.on("change",l),o.on("viewportChange",c),o.on("fold",d),o.on("unfold",d),o.on("swapDoc",a))});var h=e.Pos}),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.registerHelper("fold","indent",function(t,i){var o=t.getOption("tabSize"),n=t.getLine(i.line);if(/\S/.test(n)){for(var r=function(t){return e.countColumn(t,null,o)},a=r(n),s=null,l=i.line+1,c=t.lastLine();c>=l;++l){var d=t.getLine(l),h=r(d);if(h>a)s=l;else if(/\S/.test(d))break}return s?{from:e.Pos(i.line,n.length),to:e.Pos(s,t.getLine(s).length)}:void 0}})}),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.registerHelper("fold","brace",function(t,i){function o(o){for(var n=i.ch,l=0;;){var c=0>=n?-1:s.lastIndexOf(o,n-1);if(-1!=c){if(1==l&&c<i.ch)break;if(r=t.getTokenTypeAt(e.Pos(a,c+1)),!/^(comment|string)/.test(r))return c+1;n=c-1}else{if(1==l)break;l=1,n=s.length}}}var n,r,a=i.line,s=t.getLine(a),l="{",c="}",n=o("{");if(null==n&&(l="[",c="]",n=o("[")),null!=n){var d,h,u=1,f=t.lastLine();e:for(var g=a;f>=g;++g)for(var p=t.getLine(g),m=g==a?n:0;;){var v=p.indexOf(l,m),w=p.indexOf(c,m);if(0>v&&(v=p.length),0>w&&(w=p.length),m=Math.min(v,w),m==p.length)break;if(t.getTokenTypeAt(e.Pos(g,m+1))==r)if(m==v)++u;else if(!--u){d=g,h=m;break e}++m}if(null!=d&&(a!=d||h!=n))return{from:e.Pos(a,n),to:e.Pos(d,h)}}}),e.registerHelper("fold","import",function(t,i){function o(i){if(i<t.firstLine()||i>t.lastLine())return null;var o=t.getTokenAt(e.Pos(i,1));if(/\S/.test(o.string)||(o=t.getTokenAt(e.Pos(i,o.end+1))),"keyword"!=o.type||"import"!=o.string)return null;for(var n=i,r=Math.min(t.lastLine(),i+10);r>=n;++n){var a=t.getLine(n),s=a.indexOf(";");if(-1!=s)return{startCh:o.end,end:e.Pos(n,s)}}}var n,i=i.line,r=o(i);if(!r||o(i-1)||(n=o(i-2))&&n.end.line==i-1)return null;for(var a=r.end;;){var s=o(a.line+1);if(null==s)break;a=s.end}return{from:t.clipPos(e.Pos(i,r.startCh+1)),to:a}}),e.registerHelper("fold","include",function(t,i){function o(i){if(i<t.firstLine()||i>t.lastLine())return null;var o=t.getTokenAt(e.Pos(i,1));return/\S/.test(o.string)||(o=t.getTokenAt(e.Pos(i,o.end+1))),"meta"==o.type&&"#include"==o.string.slice(0,8)?o.start+8:void 0}var i=i.line,n=o(i);if(null==n||null!=o(i-1))return null;for(var r=i;;){var a=o(r+1);if(null==a)break;++r}return{from:e.Pos(i,n+1),to:t.clipPos(e.Pos(r))}})}),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";function t(e,t){return e.line-t.line||e.ch-t.ch}function i(e,t,i,o){this.line=t,this.ch=i,this.cm=e,this.text=e.getLine(t),this.min=o?o.from:e.firstLine(),this.max=o?o.to-1:e.lastLine()}function o(e,t){var i=e.cm.getTokenTypeAt(u(e.line,t));return i&&/\btag\b/.test(i)}function n(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function r(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(n(e))continue;return}{if(o(e,t+1)){var i=e.text.lastIndexOf("/",t),r=i>-1&&!/\S/.test(e.text.slice(i+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t+1}}}function s(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(r(e))continue;return}if(o(e,t+1)){p.lastIndex=t,e.ch=t;var i=p.exec(e.text);if(i&&i.index==t)return i}else e.ch=t}}function l(e){for(;;){p.lastIndex=e.ch;var t=p.exec(e.text);if(!t){if(n(e))continue;return}{if(o(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(r(e))continue;return}{if(o(e,t+1)){var i=e.text.lastIndexOf("/",t),n=i>-1&&!/\S/.test(e.text.slice(i+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t}}}function d(e,t){for(var i=[];;){var o,n=l(e),r=e.line,s=e.ch-(n?n[0].length:0);if(!n||!(o=a(e)))return;if("selfClose"!=o)if(n[1]){for(var c=i.length-1;c>=0;--c)if(i[c]==n[2]){i.length=c;break}if(0>c&&(!t||t==n[2]))return{tag:n[2],from:u(r,s),to:u(e.line,e.ch)}}else i.push(n[2])}}function h(e,t){for(var i=[];;){var o=c(e);if(!o)return;if("selfClose"!=o){var n=e.line,r=e.ch,a=s(e);if(!a)return;if(a[1])i.push(a[2]);else{for(var l=i.length-1;l>=0;--l)if(i[l]==a[2]){i.length=l;break}if(0>l&&(!t||t==a[2]))return{tag:a[2],from:u(e.line,e.ch),to:u(n,r)}}}else s(e)}}var u=e.Pos,f="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",g=f+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",p=new RegExp("<(/?)(["+f+"]["+g+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var o=new i(e,t.line,0);;){var n,r=l(o);if(!r||o.line!=t.line||!(n=a(o)))return;if(!r[1]&&"selfClose"!=n){var t=u(o.line,o.ch),s=d(o,r[2]);return s&&{from:t,to:s.from}}}}),e.findMatchingTag=function(e,o,n){var r=new i(e,o.line,o.ch,n);if(-1!=r.text.indexOf(">")||-1!=r.text.indexOf("<")){var l=a(r),c=l&&u(r.line,r.ch),f=l&&s(r);if(l&&f&&!(t(r,o)>0)){var g={from:u(r.line,r.ch),to:c,tag:f[2]};return"selfClose"==l?{open:g,close:null,at:"open"}:f[1]?{open:h(r,f[2]),close:g,at:"close"}:(r=new i(e,c.line,c.ch,n),{open:g,close:d(r,f[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,o){for(var n=new i(e,t.line,t.ch,o);;){var r=h(n);if(!r)break;var a=new i(e,t.line,t.ch,o),s=d(a,r.tag);if(s)return{open:r,close:s}}},e.scanForClosingTag=function(e,t,o,n){var r=new i(e,t.line,t.ch,n?{from:0,to:n}:null);return d(r,o)}}),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.registerHelper("fold","markdown",function(t,i){function o(i){var o=t.getTokenTypeAt(e.Pos(i,0));return o&&/\bheader\b/.test(o)}function n(e,t,i){var n=t&&t.match(/^#+/);return n&&o(e)?n[0].length:(n=i&&i.match(/^[=\-]+\s*$/),n&&o(e+1)?"="==i[0]?1:2:r)}var r=100,a=t.getLine(i.line),s=t.getLine(i.line+1),l=n(i.line,a,s);if(l===r)return void 0;for(var c=t.lastLine(),d=i.line,h=t.getLine(d+2);c>d&&!(n(d+1,s,h)<=l);)++d,s=h,h=t.getLine(d+2);return{from:e.Pos(i.line,a.length),to:e.Pos(d,t.getLine(d).length)}})}),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.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,i){var o=t.getModeAt(i),n=o.blockCommentStart,r=o.blockCommentEnd;if(n&&r){for(var a,s=i.line,l=t.getLine(s),c=i.ch,d=0;;){var h=0>=c?-1:l.lastIndexOf(n,c-1);if(-1!=h){if(1==d&&h<i.ch)return;if(/comment/.test(t.getTokenTypeAt(e.Pos(s,h+1)))){a=h+n.length;break}c=h-1}else{if(1==d)return;d=1,c=l.length}}var u,f,g=1,p=t.lastLine();e:for(var m=s;p>=m;++m)for(var v=t.getLine(m),w=m==s?a:0;;){var b=v.indexOf(n,w),y=v.indexOf(r,w);if(0>b&&(b=v.length),0>y&&(y=v.length),w=Math.min(b,y),w==v.length)break;if(w==b)++g;else if(!--g){u=m,f=w;break e}++w}if(null!=u&&(s!=u||f!=a))return{from:e.Pos(s,a),to:e.Pos(u,f)}}})}),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.overlayMode=function(t,i,o){return{startState:function(){return{base:e.startState(t),overlay:e.startState(i),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(o){return{base:e.copyState(t,o.base),overlay:e.copyState(i,o.overlay),basePos:o.basePos,baseCur:null,overlayPos:o.overlayPos,overlayCur:null}},token:function(e,n){return(e!=n.streamSeen||Math.min(n.basePos,n.overlayPos)<e.start)&&(n.streamSeen=e,n.basePos=n.overlayPos=e.start),e.start==n.basePos&&(n.baseCur=t.token(e,n.base),n.basePos=e.pos),e.start==n.overlayPos&&(e.pos=e.start,n.overlayCur=i.token(e,n.overlay),n.overlayPos=e.pos),e.pos=Math.min(n.basePos,n.overlayPos),null==n.overlayCur?n.baseCur:null!=n.baseCur&&n.overlay.combineTokens||o&&null==n.overlay.combineTokens?n.baseCur+" "+n.overlayCur:n.overlayCur},indent:t.indent&&function(e,i){return t.indent(e.base,i)},electricChars:t.electricChars,innerMode:function(e){return{state:e.base,mode:t}},blankLine:function(e){t.blankLine&&t.blankLine(e.base),i.blankLine&&i.blankLine(e.overlay)}}}}),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";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",r),e.removeLineClass(e.state.activeLines[t],"background",a)}function i(e,t){if(e.length!=t.length)return!1;for(var i=0;i<e.length;i++)if(e[i]!=t[i])return!1;return!0}function o(e,o){for(var n=[],s=0;s<o.length;s++){var l=o[s];if(l.empty()){var c=e.getLineHandleVisualStart(l.head.line);n[n.length-1]!=c&&n.push(c)}}i(e.state.activeLines,n)||e.operation(function(){t(e);for(var i=0;i<n.length;i++)e.addLineClass(n[i],"wrap",r),e.addLineClass(n[i],"background",a);e.state.activeLines=n})}function n(e,t){o(e,t.ranges)}var r="CodeMirror-activeline",a="CodeMirror-activeline-background";e.defineOption("styleActiveLine",!1,function(i,r,a){var s=a&&a!=e.Init;r&&!s?(i.state.activeLines=[],o(i,i.listSelections()),i.on("beforeSelectionChange",n)):!r&&s&&(i.off("beforeSelectionChange",n),t(i),delete i.state.activeLines)})}),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){function t(e,t){var i=e.getRange(c(t.line,t.ch-1),c(t.line,t.ch+1));return 2==i.length?i:null}function i(t,i,o){var n=t.getLine(i.line),r=t.getTokenAt(i);if(/\bstring2?\b/.test(r.type))return!1;var a=new e.StringStream(n.slice(0,i.ch)+o+n.slice(i.ch),4);for(a.pos=a.start=r.start;;){var s=t.getMode().token(a,r.state);if(a.pos>=i.ch+1)return/\bstring2?\b/.test(s);a.start=a.pos}}function o(o,n){for(var r={name:"autoCloseBrackets",Backspace:function(i){if(i.getOption("disableInput"))return e.Pass;for(var n=i.listSelections(),r=0;r<n.length;r++){if(!n[r].empty())return e.Pass;var a=t(i,n[r].head);if(!a||o.indexOf(a)%2!=0)return e.Pass}for(var r=n.length-1;r>=0;r--){var s=n[r].head;i.replaceRange("",c(s.line,s.ch-1),c(s.line,s.ch+1))}}},a="",s=0;s<o.length;s+=2)(function(t,o){a+=o,r["'"+t+"'"]=function(r){if(r.getOption("disableInput"))return e.Pass;for(var s,d,h=r.listSelections(),u=0;u<h.length;u++){var f,g=h[u],p=g.head,d=r.getRange(p,c(p.line,p.ch+1));if(g.empty())if(t==o&&d==o)f=r.getRange(p,c(p.line,p.ch+3))==t+t+t?"skipThree":"skip";else if(t==o&&p.ch>1&&n.indexOf(t)>=0&&r.getRange(c(p.line,p.ch-2),p)==t+t&&(p.ch<=2||r.getRange(c(p.line,p.ch-3),c(p.line,p.ch-2))!=t))f="addFour";else if('"'==t||"'"==t){if(e.isWordChar(d)||!i(r,p,t))return e.Pass;f="both"}else{if(!(r.getLine(p.line).length==p.ch||a.indexOf(d)>=0||l.test(d)))return e.Pass;f="both"}else f="surround";if(s){if(s!=f)return e.Pass}else s=f}r.operation(function(){if("skip"==s)r.execCommand("goCharRight");else if("skipThree"==s)for(var e=0;3>e;e++)r.execCommand("goCharRight");else if("surround"==s){for(var i=r.getSelections(),e=0;e<i.length;e++)i[e]=t+i[e]+o;r.replaceSelections(i,"around")}else"both"==s?(r.replaceSelection(t+o,null),r.execCommand("goCharLeft")):"addFour"==s&&(r.replaceSelection(t+t+t+t,"before"),r.execCommand("goCharRight"))})},t!=o&&(r["'"+o+"'"]=function(t){for(var i=t.listSelections(),n=0;n<i.length;n++){var r=i[n];if(!r.empty()||t.getRange(r.head,c(r.head.line,r.head.ch+1))!=o)return e.Pass}t.execCommand("goCharRight")})})(o.charAt(s),o.charAt(s+1));return r}function n(i){return function(o){if(o.getOption("disableInput"))return e.Pass;for(var n=o.listSelections(),r=0;r<n.length;r++){if(!n[r].empty())return e.Pass;var a=t(o,n[r].head);if(!a||i.indexOf(a)%2!=0)return e.Pass}o.operation(function(){o.replaceSelection("\n\n",null),o.execCommand("goCharLeft"),n=o.listSelections();for(var e=0;e<n.length;e++){var t=n[e].head.line;o.indentLine(t,null,!0),o.indentLine(t+1,null,!0)}})}}var r="()[]{}''\"\"",a="'\"",s="[]{}",l=/\s/,c=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,i,l){if(l!=e.Init&&l&&t.removeKeyMap("autoCloseBrackets"),i){var c=r,d=a,h=s;"string"==typeof i?c=i:"object"==typeof i&&(null!=i.pairs&&(c=i.pairs),null!=i.triples&&(d=i.triples),null!=i.explode&&(h=i.explode));var u=o(c,d);h&&(u.Enter=n(h)),t.addKeyMap(u)}})}),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";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function i(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var i=e.state.fullScreenRestore;t.style.width=i.width,t.style.height=i.height,window.scrollTo(i.scrollLeft,i.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(o,n,r){r==e.Init&&(r=!1),!r!=!n&&(n?t(o):i(o))})}),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";function t(e){"object"==typeof e&&(this.minChars=e.minChars,this.style=e.style,this.showToken=e.showToken,this.delay=e.delay,this.wordsOnly=e.wordsOnly),null==this.style&&(this.style=l),null==this.minChars&&(this.minChars=s),null==this.delay&&(this.delay=c),null==this.wordsOnly&&(this.wordsOnly=d),this.overlay=this.timeout=null}function i(e){var t=e.state.matchHighlighter;clearTimeout(t.timeout),t.timeout=setTimeout(function(){o(e)},t.delay)}function o(e){e.operation(function(){var t=e.state.matchHighlighter;if(t.overlay&&(e.removeOverlay(t.overlay),t.overlay=null),!e.somethingSelected()&&t.showToken){for(var i=t.showToken===!0?/[\w$]/:t.showToken,o=e.getCursor(),r=e.getLine(o.line),s=o.ch,l=s;s&&i.test(r.charAt(s-1));)--s;for(;l<r.length&&i.test(r.charAt(l));)++l;return void(l>s&&e.addOverlay(t.overlay=a(r.slice(s,l),i,t.style)))}var c=e.getCursor("from"),d=e.getCursor("to");if(c.line==d.line&&(!t.wordsOnly||n(e,c,d))){var h=e.getRange(c,d).replace(/^\s+|\s+$/g,"");h.length>=t.minChars&&e.addOverlay(t.overlay=a(h,!1,t.style))}})}function n(e,t,i){var o=e.getRange(t,i);if(null!==o.match(/^\w+$/)){if(t.ch>0){var n={line:t.line,ch:t.ch-1},r=e.getRange(n,t);if(null===r.match(/\W/))return!1}if(i.ch<e.getLine(t.line).length){var n={line:i.line,ch:i.ch+1},r=e.getRange(i,n);if(null===r.match(/\W/))return!1}return!0}return!1}function r(e,t){return!(e.start&&t.test(e.string.charAt(e.start-1))||e.pos!=e.string.length&&t.test(e.string.charAt(e.pos)))}function a(e,t,i){return{token:function(o){return!o.match(e)||t&&!r(o,t)?(o.next(),void(o.skipTo(e.charAt(0))||o.skipToEnd())):i}}}var s=2,l="matchhighlight",c=100,d=!1;e.defineOption("highlightSelectionMatches",!1,function(n,r,a){if(a&&a!=e.Init){var s=n.state.matchHighlighter.overlay;s&&n.removeOverlay(s),clearTimeout(n.state.matchHighlighter.timeout),n.state.matchHighlighter=null,n.off("cursorActivity",i)}r&&(n.state.matchHighlighter=new t(r),o(n),n.on("cursorActivity",i))})});