(function(c){"object"==typeof exports&&"object"==typeof module?c(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],c):c(CodeMirror)})(function(c){c.registerGlobalHelper("fold","comment",function(d){return d.blockCommentStart&&d.blockCommentEnd},function(d,e){var f=d.getModeAt(e),m=f.blockCommentStart;f=f.blockCommentEnd;if(m&&f){for(var g=e.line,h=d.getLine(g),a=e.ch,k=0;;)if(a=0>=a?-1:h.lastIndexOf(m,a-1),-1==a){if(1==k)return;k=1;a=h.length}else{if(1==
k&&a<e.ch)return;if(/comment/.test(d.getTokenTypeAt(c.Pos(g,a+1)))&&(0==a||h.slice(a-f.length,a)==f||!/comment/.test(d.getTokenTypeAt(c.Pos(g,a))))){e=a+m.length;break}--a}h=1;k=d.lastLine();a=g;a:for(;a<=k;++a)for(var l=d.getLine(a),b=a==g?e:0;;){var n=l.indexOf(m,b);b=l.indexOf(f,b);0>n&&(n=l.length);0>b&&(b=l.length);b=Math.min(n,b);if(b==l.length)break;if(b==n)++h;else if(!--h){var p=a;var q=b;break a}++b}if(null!=p&&(g!=p||q!=e))return{from:c.Pos(g,e),to:c.Pos(p,q)}}})});
