!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(F){"use strict";var q="CodeMirror-hint-active";function i(e,t){this.cm=e,this.options=t,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var n=this;e.on("cursorActivity",this.activityFunc=function(){n.cursorActivity()})}F.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var o={hint:t};if(n)for(var i in n)o[i]=n[i];return e.showHint(o)},F.defineExtension("showHint",function(e){e=function(e,t,n){var o=e.options.hintOptions,i={};for(var r in l)i[r]=l[r];if(o)for(var r in o)void 0!==o[r]&&(i[r]=o[r]);if(n)for(var r in n)void 0!==n[r]&&(i[r]=n[r]);i.hint.resolve&&(i.hint=i.hint.resolve(e,t));return i}(this,this.getCursor("start"),e);var t=this.listSelections();if(!(1l.clientHeight+1,H=r.getScrollInfo();0w&&(l.style.width=w-5+"px",E-=O.right-O.left-w),l.style.left=(y=v.left-E-x)+"px"),S)for(var P=l.firstChild;P;P=P.nextSibling)P.style.paddingRight=r.display.nativeBarWidth+"px";return r.addKeyMap(this.keyMap=function(e,o){var i={Up:function(){o.moveFocus(-1)},Down:function(){o.moveFocus(1)},PageUp:function(){o.moveFocus(1-o.menuSize(),!0)},PageDown:function(){o.moveFocus(o.menuSize()-1,!0)},Home:function(){o.setFocus(0)},End:function(){o.setFocus(o.length-1)},Enter:o.pick,Tab:o.pick,Esc:o.close};/Mac/.test(navigator.platform)&&(i["Ctrl-P"]=function(){o.moveFocus(-1)},i["Ctrl-N"]=function(){o.moveFocus(1)});var t=e.options.customKeys,r=t?{}:i;function n(e,t){var n="string"!=typeof t?function(e){return t(e,o)}:i.hasOwnProperty(t)?i[t]:t;r[e]=n}if(t)for(var s in t)t.hasOwnProperty(s)&&n(s,t[s]);var a=e.options.extraKeys;if(a)for(var s in a)a.hasOwnProperty(s)&&n(s,a[s]);return r}(i,{moveFocus:function(e,t){n.changeActive(n.selectedHint+e,t)},setFocus:function(e){n.changeActive(e)},menuSize:function(){return n.screenAmount()},length:o.length,close:function(){i.close()},pick:function(){n.pick()},data:e})),i.options.closeOnUnfocus&&(r.on("blur",this.onBlur=function(){N=setTimeout(function(){i.close()},100)}),r.on("focus",this.onFocus=function(){clearTimeout(N)})),r.on("scroll",this.onScroll=function(){var e=r.getScrollInfo(),t=r.getWrapperElement().getBoundingClientRect(),n=C+H.top-e.top,o=n-(a.pageYOffset||(s.documentElement||s.body).scrollTop);if(b||(o+=l.offsetHeight),o<=t.top||o>=t.bottom)return i.close();l.style.top=n+"px",l.style.left=y+H.left-e.left+"px"}),F.on(l,"dblclick",function(e){var t=D(l,e.target||e.srcElement);t&&null!=t.hintId&&(n.changeActive(t.hintId),n.pick())}),F.on(l,"click",function(e){var t=D(l,e.target||e.srcElement);t&&null!=t.hintId&&(n.changeActive(t.hintId),i.options.completeOnSingleClick&&n.pick())}),F.on(l,"mousedown",function(){setTimeout(function(){r.focus()},20)}),F.signal(e,"select",o[this.selectedHint],l.childNodes[this.selectedHint]),!0}function a(e,t,n,o){var i;e.async?e(t,o,n):(i=e(t,n))&&i.then?i.then(o):o(i)}i.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&F.signal(this.data,"close"),this.widget&&this.widget.close(),F.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(e,t){var n=e.list[t];n.hint?n.hint(this.cm,e,n):this.cm.replaceRange(R(n),n.from||e.from,n.to||e.to,"complete"),F.signal(e,"pick",n),this.close()},cursorActivity:function(){this.debounce&&(r(this.debounce),this.debounce=0);var e,t=this.cm.getCursor(),n=this.cm.getLine(t.line);t.line!=this.startPos.line||n.length-t.ch!=this.startLen-this.startPos.ch||t.ch=this.data.list.length?e=t?this.data.list.length-1:0:e<0&&(e=t?0:this.data.list.length-1),this.selectedHint!=e&&((n=this.hints.childNodes[this.selectedHint])&&(n.className=n.className.replace(" "+q,"")),(n=this.hints.childNodes[this.selectedHint=e]).className+=" "+q,n.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+3),F.signal(this.data,"select",this.data.list[this.selectedHint],n))},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},F.registerHelper("hint","auto",{resolve:function(e,t){var n,s=e.getHelpers(t,"hint");if(s.length){var o=function(e,o,i){var r=function(e,t){if(!e.somethingSelected())return t;for(var n=[],o=0;o,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};F.defineOption("hintOptions",null)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(u){function h(e,t,n){var o=e.getWrapperElement(),i=o.appendChild(document.createElement("div"));return i.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?i.innerHTML=t:i.appendChild(t),u.addClass(o,"dialog-opened"),i}function d(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}u.defineExtension("openDialog",function(e,t,n){n=n||{},d(this,null);var o=h(this,e,n.bottom),i=!1,r=this;function s(e){if("string"==typeof e)l.value=e;else{if(i)return;i=!0,u.rmClass(o.parentNode,"dialog-opened"),o.parentNode.removeChild(o),r.focus(),n.onClose&&n.onClose(o)}}var a,l=o.getElementsByTagName("input")[0];return l?(l.focus(),n.value&&(l.value=n.value,!1!==n.selectValueOnOpen&&l.select()),n.onInput&&u.on(l,"input",function(e){n.onInput(e,l.value,s)}),n.onKeyUp&&u.on(l,"keyup",function(e){n.onKeyUp(e,l.value,s)}),u.on(l,"keydown",function(e){n&&n.onKeyDown&&n.onKeyDown(e,l.value,s)||((27==e.keyCode||!1!==n.closeOnEnter&&13==e.keyCode)&&(l.blur(),u.e_stop(e),s()),13==e.keyCode&&t(l.value,e))}),!1!==n.closeOnBlur&&u.on(l,"blur",s)):(a=o.getElementsByTagName("button")[0])&&(u.on(a,"click",function(){s(),r.focus()}),!1!==n.closeOnBlur&&u.on(a,"blur",s),a.focus()),s}),u.defineExtension("openConfirm",function(e,t,n){d(this,null);var o=h(this,e,n&&n.bottom),i=o.getElementsByTagName("button"),r=!1,s=this,a=1;function l(){r||(r=!0,u.rmClass(o.parentNode,"dialog-opened"),o.parentNode.removeChild(o),s.focus())}i[0].focus();for(var c=0;c>1,a=o(e.slice(0,s)).length;if(a==n)return s;nr.cursorCoords(t,"window").top&&((a=o).style.opacity=.4)}))},i=b(o=r),c=h,f=l,u=function(e,t){var n=d.keyName(e),o=r.getOption("extraKeys"),i=o&&o[n]||d.keyMap[r.getOption("keyMap")][n];"findNext"==i||"findPrev"==i||"findPersistentNext"==i||"findPersistentPrev"==i?(d.e_stop(e),v(r,p(r),t),r.execCommand(i)):"find"!=i&&"findPersistent"!=i||(d.e_stop(e),l(t,e))},o.openDialog(i,f,{value:c,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){C(o)},onKeyDown:u}),n&&h&&(v(r,s,h),y(r,t))):m(r,b(),"搜索: ",h,function(e){e&&!s.query&&r.operation(function(){v(r,s,e),s.posFrom=s.posTo=r.getCursor(),y(r,t)})})}function y(n,o,i){n.operation(function(){var e=p(n),t=h(n,e.query,o?e.posFrom:e.posTo);if(!t.find(o)&&!(t=h(n,e.query,o?d.Pos(n.lastLine()):d.Pos(n.firstLine(),0))).find(o))return i&&i(null,null);n.setSelection(t.from(),t.to()),n.scrollIntoView({from:t.from(),to:t.to()},20),e.posFrom=t.from(),e.posTo=t.to(),i&&i(t.from(),t.to())})}function C(n){n.operation(function(){var e=document.getElementById("CodeMirror-search-count");e&&(e.innerText="");var t=p(n);t.lastQuery=t.query,t.query&&(t.query=t.queryText=null,n.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function b(){return'搜索: 0/0 使用/re/语法正则搜索'}function x(t,o,i){t.operation(function(){for(var n,e=h(t,o);e.findNext();){"string"!=typeof o?(n=t.getRange(e.from(),e.to()).match(o),e.replace(i.replace(/\$(\d)/g,function(e,t){return n[t]}))):e.replace(i)}})}function i(u,e){var t,n;u.getOption("readOnly")||(t=u.getSelection()||p(u).lastQuery,m(u,(n=''+(e?"全部替换":"替换")+"")+' 使用/re/语法正则搜索',n,t,function(f){f&&(f=r(f),m(u,'替换为: ',"替换为: ","",function(s){var a,l,c;s=o(s),e?x(u,f,s):(C(u),a=h(u,f,u.getCursor("from")),l=function(){var e,t,n,o,i,r=a.from();!(e=a.findNext())&&(a=h(u,f),!(e=a.findNext())||r&&a.from().line==r.line&&a.from().ch==r.ch)||(u.setSelection(a.from(),a.to()),u.scrollIntoView({from:a.from(),to:a.to()}),n='确认替换? ',o="确定替换?",i=[function(){c(e)},l,function(){x(u,f,s)}],(t=u).openConfirm?t.openConfirm(n,i):confirm(o)&&i[0]())},c=function(n){a.replace("string"==typeof f?s:s.replace(/\$(\d)/g,function(e,t){return n[t]})),l()},l())}))}))}d.commands.find=function(e){C(e),n(e)},d.commands.findPersistent=function(e){C(e),n(e,!1,!0)},d.commands.findPersistentNext=function(e){n(e,!1,!0,!0)},d.commands.findPersistentPrev=function(e){n(e,!0,!0,!0)},d.commands.findNext=n,d.commands.findPrev=function(e){n(e,!0)},d.commands.clearSearch=C,d.commands.replace=i,d.commands.replaceAll=function(e){i(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(o){var f=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),m=o.Pos,v={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function y(e){return e&&e.bracketRegex||/[(){}[\]]/}function u(e,t,n){var o=e.getLineHandle(t.line),i=t.ch-1,r=n&&n.afterCursor;null==r&&(r=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var s=y(n),a=!r&&0<=i&&s.test(o.text.charAt(i))&&v[o.text.charAt(i)]||s.test(o.text.charAt(i+1))&&v[o.text.charAt(++i)];if(!a)return null;var l=">"==a.charAt(1)?1:-1;if(n&&n.strict&&0r))for(f==t.line&&(h=t.ch-(n<0?1:0));h!=d;h+=n){var p=u.charAt(h);if(l.test(p)&&(void 0===o||e.getTokenTypeAt(m(f,h+1))==o)){var g=v[p];if(g&&">"==g.charAt(1)==0",triples:"",explode:"[]{}"},w=k.Pos;function T(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:n[t]}k.defineOption("autoCloseBrackets",!1,function(e,t,n){n&&n!=k.Init&&(e.removeKeyMap(i),e.state.closeBrackets=null),t&&(o(T(t,"pairs")),e.state.closeBrackets=t,e.addKeyMap(i))});var i={Backspace:function(e){var t=L(e);if(!t||e.getOption("disableInput"))return k.Pass;for(var n=T(t,"pairs"),o=e.listSelections(),i=0;i=r.to&&(r.to=s+1);r.from>n.from.line&&(r.from=n.from.line);t.lineCount()>f&&100 (.*)$/);return{args:e,rettype:o&&o[1]}}(t.type),name:t.exprName||t.name||"fn",guess:t.guess,doc:o.getDoc()},C(n,o,s))})}(this,e)},jumpToDef:function(e){function t(e){var t={type:"definition",variable:e||null},i=u(r,s.getDoc());r.server.request(h(r,i,t),function(e,t){if(e)return T(r,s,e);if(t.file||!t.url){if(t.file){var n,o=r.docs[t.file];if(o&&(n=function(e,t){for(var n=t.context.slice(0,t.contextOffset).split("\n"),o=t.start.line-(n.length-1),i=y(o,(1==n.length?t.start.ch:e.getLine(o).length)-n[0].length),r=e.getLine(o).slice(i.ch),s=1+o;s/g,"\n"))),e.url&&(n.appendChild(document.createTextNode("\n")),(t=n.appendChild(d("a",null,"[文档]"))).href=e.url,t.target="_blank"),n}}function C(e,t,n){L(e);for(var o=e.cachedArgHints,i=o.type,r=d("span",o.guess?p+"fhint-guess":null,d("span",p+"fname",o.name),"("),s=0;s ":")")),i.rettype&&r.appendChild(d("span",p+"type",i.rettype));var l=t.cursorCoords(null,"page"),c=e.activeArgHints=k(l.right+1,l.bottom,r);setTimeout(function(){c.clear=x(t,function(){e.activeArgHints==c&&L(e)})},20)}function l(e,t,n,o,i){n.doc.setSelection(o,i),t!=n&&e.options.switchToDoc&&(L(e),e.options.switchToDoc(n.name,n.doc))}var c=0;function h(e,t,n,o){var i=[],r=0,s=!n.fullDocs;s||delete n.fullDocs,"string"==typeof n&&(n={type:n}),n.lineCharPositions=!0,null==n.end&&(n.end=o||t.doc.getCursor("end"),t.doc.somethingSelected()&&(n.start=t.doc.getCursor("start")));var a=n.start||n.end;for(var l in t.changed?t.doc.lineCount()>f&&!1!=s&&t.changed.to-t.changed.from<100&&t.changed.from<=a.line&&t.changed.to>n.end.line?(i.push(function(e,t,n){for(var o,i=e.doc,r=null,s=null,a=t.line-1,l=Math.max(0,a-50);l<=a;--a){var c=i.getLine(a);c.search(/\bfunction\b/)<0||(u=v.countColumn(c,null,4),null!=r&&r<=u||(r=u,s=a))}null==s&&(s=l);var f=Math.min(i.lastLine(),n.line+20);if(null==r||r==v.countColumn(i.getLine(t.line),null,4))o=f;else for(o=n.line+1;o",n):n(prompt(t,""))}function r(t,e){t.state.ternTooltip&&w(t.state.ternTooltip);var n=t.cursorCoords(),o=t.state.ternTooltip=k(n.right+1,n.bottom,e);var i=!1;v.on(o,"mousemove",function(){i=!0}),v.on(o,"mouseout",function(e){i=!1});var r=x(t,function e(){if(i)return i=!1,void setTimeout(e,100);t.state.ternTooltip=null,o.parentNode&&w(o),r()})}function x(e,t){return e.on("cursorActivity",t),e.on("blur",t),e.on("scroll",t),e.on("setDoc",t),function(){e.off("cursorActivity",t),e.off("blur",t),e.off("scroll",t),e.off("setDoc",t)}}function k(e,t,n){"string"==typeof n&&(n=n.replace(//g,"\n"));var o=d("div",p+"tooltip",n);return o.style.left=e+"px",o.style.top=t+"px",document.body.appendChild(o),o}function w(e){var t=e&&e.parentNode;t&&t.removeChild(e)}function T(e,t,n){e.options.showError?e.options.showError(t,n):r(t,String(n))}function L(e){e.activeArgHints&&(e.activeArgHints.clear&&e.activeArgHints.clear(),w(e.activeArgHints),e.activeArgHints=null)}function M(e,t){var n=t.doc.getValue();return e.options.fileFilter&&(n=e.options.fileFilter(n,t.name,t.doc)),n}function O(t){var n=t.worker=new Worker(t.options.workerScript);n.postMessage({type:"init",defs:t.options.defs,plugins:t.options.plugins,scripts:t.options.workerDeps});var o=0,i={};function r(e,t){t&&(e.id=++o,i[o]=t),n.postMessage(e)}n.onmessage=function(e){var n=e.data;"getFile"==n.type?s(t,n.name,function(e,t){r({type:"getFile",err:String(e),text:t,id:n.id})}):"debug"==n.type?window.console.log(n.message):n.id&&i[n.id]&&(i[n.id](n.err,n.body),delete i[n.id])},n.onerror=function(e){for(var t in i)i[t](e);i={}},this.addFile=function(e,t){r({type:"add",name:e,text:t})},this.delFile=function(e){r({type:"del",name:e})},this.request=function(e,t){r({type:"req",body:e},t)}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(h){"use strict";var p="CodeMirror-lint-markers";function d(e){e.parentNode&&e.parentNode.removeChild(e)}function f(e,t,n,o){var i,r,s,a,l=(i=e,r=t,s=n,(a=document.createElement("div")).className="CodeMirror-lint-tooltip cm-s-"+i.options.theme,a.appendChild(s.cloneNode(!0)),i.state.lint.options.selfContain?i.getWrapperElement().appendChild(a):document.body.appendChild(a),h.on(document,"mousemove",c),c(r),null!=a.style.opacity&&(a.style.opacity=1),a);function c(e){if(!a.parentNode)return h.off(document,"mousemove",c);a.style.top=Math.max(0,e.clientY-a.offsetHeight-5)+"px",a.style.left=e.clientX+5+"px"}function f(){var e;h.off(o,"mouseout",f),l&&((e=l).parentNode&&(null==e.style.opacity&&d(e),e.style.opacity=0,setTimeout(function(){d(e)},600)),l=null)}var u=setInterval(function(){if(l)for(var e=o;;e=e.parentNode){if(e&&11==e.nodeType&&(e=e.host),e==document.body)return;if(!e){f();break}}if(!l)return clearInterval(u)},400);h.on(o,"mouseout",f)}function l(t,e,n){this.marked=[],this.options=e,this.timeout=null,this.hasGutter=n,this.onMouseOver=function(e){!function(e,t){var n=t.target||t.srcElement;if(!/\bCodeMirror-lint-mark-/.test(n.className))return;for(var o=n.getBoundingClientRect(),i=(o.left+o.right)/2,r=(o.top+o.bottom)/2,s=e.findMarksAt(e.coordsChar({left:i,top:r},"client")),a=[],l=0;l=t||(s.line>=t&&(s=A(t,0)),t=r.line,null==o?o=this.uncomment(r,s,e)?"un":(this.lineComment(r,s,e),"line"):"un"==o?this.uncomment(r,s,e):this.lineComment(r,s,e))}}),e.defineExtension("lineComment",function(r,e,s){s=s||M;var t,n,a,l,c,f,u=this,o=S(u,r),i=u.getLine(r.line);null!=i&&(t=r,n=i,!/\bstring\b/.test(u.getTokenTypeAt(A(t.line,0)))||/^[\'\"\`]/.test(n))&&((a=s.lineComment||o.lineComment)?(l=Math.min(0!=e.ch||e.line==r.line?e.line+1:e.line,u.lastLine()+1),c=null==s.padding?" ":s.padding,f=s.commentBlankLines||r.line==e.line,u.operation(function(){if(s.indent){for(var e=null,t=r.line;tn.length)&&(e=n)}for(t=r.line;ts||l.operation(function(){if(0!=r.fullLines){var e=O.test(l.getLine(s));l.replaceRange(a+u,A(s)),l.replaceRange(f+a,A(o.line,0));var t=r.blockCommentLead||c.blockCommentLead;if(null!=t)for(var n=o.line+1;n<=s;++n)n==s&&!e||l.replaceRange(t+a,A(n,0))}else l.replaceRange(u,i),l.replaceRange(f,o)})):(r.lineComment||c.lineComment)&&0!=r.fullLines&&l.lineComment(o,i,r)}),e.defineExtension("uncomment",function(e,t,n){n=n||M;var i,r=this,o=S(r,e),s=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,r.lastLine()),a=Math.min(e.line,s),l=n.lineComment||o.lineComment,c=[],f=null==n.padding?" ":n.padding;e:if(l){for(var u=a;u<=s;++u){var h=r.getLine(u),d=h.indexOf(l);if(-1i.firstLine();)r=f.Pos(r.line-1,0),c=t(!1);c&&!c.cleared&&"unfold"!==s&&(n=function(e,t,n){var o=u(e,t,"widget");"function"==typeof o&&(o=o(n.from,n.to));{var i;"string"==typeof o?(i=document.createTextNode(o),(o=document.createElement("span")).appendChild(i),o.className="CodeMirror-foldmarker"):o=o&&o.cloneNode(!0)}return o}(i,e,c),f.on(n,"mousedown",function(e){o.clear(),f.e_preventDefault(e)}),(o=i.markText(c.from,c.to,{replacedWith:n,clearOnEnter:u(i,e,"clearOnEnter"),__isFold:!0})).on("clear",function(e,t){f.signal(i,"unfold",i,e,t)}),f.signal(i,"fold",i,c.from,c.to))}f.newFoldFunction=function(n,o){return function(e,t){i(e,t,{rangeFinder:n,widget:o})}},f.defineExtension("foldCode",function(e,t,n){i(this,e,t,n)}),f.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n=l){if(u&&n&&u.test(n.className))return;t=p(s.indicatorOpen)}}(t||n)&&r.setGutterMarker(e,s.gutter,t)})}function n(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function s(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){r(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function a(e,t,n){var o,i,r=e.state.foldGutter;!r||n==(o=r.options).gutter&&((i=d(e,t))?i.clear():e.foldCode(h(t,0),o))}function l(e){var t,n=e.state.foldGutter;n&&(t=n.options,n.from=n.to=0,clearTimeout(n.changeUpdate),n.changeUpdate=setTimeout(function(){s(e)},t.foldOnChangeTimeSpan||600))}function c(t){var e,n=t.state.foldGutter;n&&(e=n.options,clearTimeout(n.changeUpdate),n.changeUpdate=setTimeout(function(){var e=t.getViewport();n.from==n.to||20n.to&&(r(t,n.to,e.to),n.to=e.to)})},e.updateViewportTimeSpan||400))}function f(e,t){var n,o=e.state.foldGutter;!o||(n=t.line)>=o.from&&nr.lastLine())return null;var t=r.getTokenAt(y.Pos(e,1));if(/\S/.test(t.string)||(t=r.getTokenAt(y.Pos(e,t.end+1))),"keyword"!=t.type||"import"!=t.string)return null;for(var n=e,o=Math.min(r.lastLine(),e+10);n<=o;++n){var i=r.getLine(n).indexOf(";");if(-1!=i)return{startCh:t.end,end:y.Pos(n,i)}}}var n,o=e.line,i=t(o);if(!i||t(o-1)||(n=t(o-2))&&n.end.line==o-1)return null;for(var s=i.end;;){var a=t(s.line+1);if(null==a)break;s=a.end}return{from:r.clipPos(y.Pos(o,i.startCh+1)),to:s}}),y.registerHelper("fold","include",function(n,e){function t(e){if(en.lastLine())return null;var t=n.getTokenAt(y.Pos(e,1));return/\S/.test(t.string)||(t=n.getTokenAt(y.Pos(e,t.end+1))),"meta"==t.type&&"#include"==t.string.slice(0,8)?t.start+8:void 0}var o=e.line,i=t(o);if(null==i||null!=t(o-1))return null;for(var r=o;;){if(null==t(r+1))break;++r}return{from:y.Pos(o,i+1),to:n.clipPos(y.Pos(r))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],e):e(CodeMirror)}(function(i){"use strict";var n={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};function r(e){for(var t in this.options={},n)this.options[t]=(e&&e.hasOwnProperty(t)?e:n)[t];this.overlay=this.timeout=null,this.matchesonscroll=null,this.active=!1}function s(e){var t=e.state.matchHighlighter;(t.active||e.hasFocus())&&o(e,t)}function a(e){var t=e.state.matchHighlighter;t.active||(t.active=!0,o(e,t))}function o(e,t){clearTimeout(t.timeout),t.timeout=setTimeout(function(){l(e)},t.options.delay)}function f(e,t,n,o){var i,r,s,a,l=e.state.matchHighlighter;e.addOverlay(l.overlay=(i=t,r=n,s=o,{token:function(e){if(e.match(i)&&(!r||(n=r,!((t=e).start&&n.test(t.string.charAt(t.start-1))||t.pos!=t.string.length&&n.test(t.string.charAt(t.pos))))))return s;var t,n;e.next(),e.skipTo(i.charAt(0))||e.skipToEnd()}})),l.options.annotateScrollbar&&e.showMatchesOnScrollbar&&(a=n?new RegExp((/\w/.test(t.charAt(0))?"\\b":"")+t.replace(/[\\\[.+*?(){|^$]/g,"\\$&")+(/\w/.test(t.charAt(t.length-1))?"\\b":"")):t,l.matchesonscroll=e.showMatchesOnScrollbar(a,!1,{className:"CodeMirror-selection-highlight-scrollbar"}))}function u(e){var t=e.state.matchHighlighter;t.overlay&&(e.removeOverlay(t.overlay),t.overlay=null,t.matchesonscroll&&(t.matchesonscroll.clear(),t.matchesonscroll=null))}function l(c){c.operation(function(){var e=c.state.matchHighlighter;if(u(c),c.somethingSelected()||!e.options.showToken){var t,n=c.getCursor("from"),o=c.getCursor("to");n.line==o.line&&(e.options.wordsOnly&&!function(e,t,n){{if(null===e.getRange(t,n).match(/^\w+$/))return;if(0=e.options.minChars&&f(c,t,!1,e.options.style)))}else{for(var i=!0===e.options.showToken?/[\w$]/:e.options.showToken,r=c.getCursor(),s=c.getLine(r.line),a=r.ch,l=a;a&&i.test(s.charAt(a-1));)--a;for(;l