text: !function(n){"object"==typeof exports&&"object"==typeof module?n(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)}(function(a){"use strict";function t(t,i,n,l){var f;n&&n.call?(f=n,n=null):f=c(t,n,"rangeFinder"),"number"==typeof i&&(i=a.Pos(i,0));var d=c(t,n,"minFoldSize");function o(n){var o=f(t,i);if(!o||o.to.line-o.from.line<d)return null;for(var e=t.findMarksAt(o.from),r=0;r<e.length;++r)if(e[r].__isFold&&"fold"!==l){if(!n)return null;o.cleared=!0,e[r].clear()}return o}var e,r,u=o(!0);if(c(t,n,"scanUp"))for(;!u&&i.line>t.firstLine();)i=a.Pos(i.line-1,0),u=o(!1);u&&!u.cleared&&"unfold"!==l&&(e=function(n,o){var e=c(n,o,"widget");{var r;"string"==typeof e?(r=document.createTextNode(e),(e=document.createElement("span")).appendChild(r),e.className="CodeMirror-foldmarker"):e=e&&e.cloneNode(!0)}return e}(t,n),a.on(e,"mousedown",function(n){r.clear(),a.e_preventDefault(n)}),(r=t.markText(u.from,u.to,{replacedWith:e,clearOnEnter:c(t,n,"clearOnEnter"),__isFold:!0})).on("clear",function(n,o){a.signal(t,"unfold",t,n,o)}),a.signal(t,"fold",t,u.from,u.to))}a.newFoldFunction=function(e,r){return function(n,o){t(n,o,{rangeFinder:e,widget:r})}},a.defineExtension("foldCode",function(n,o,e){t(this,n,o,e)}),a.defineExtension("isFolded",function(n){for(var o=this.findMarksAt(n),e=0;e<o.length;++e)if(o[e].__isFold)return!0}),a.commands.toggleFold=function(n){n.foldCode(n.getCursor())},a.commands.fold=function(n){n.foldCode(n.getCursor(),null,"fold")},a.commands.unfold=function(n){n.foldCode(n.getCursor(),null,"unfold")},a.commands.foldAll=function(e){e.operation(function(){for(var n=e.firstLine(),o=e.lastLine();n<=o;n++)e.foldCode(a.Pos(n,0),null,"fold")})},a.commands.unfoldAll=function(e){e.operation(function(){for(var n=e.firstLine(),o=e.lastLine();n<=o;n++)e.foldCode(a.Pos(n,0),null,"unfold")})},a.registerHelper("fold","combine",function(){var t=Array.prototype.slice.call(arguments,0);return function(n,o){for(var e=0;e<t.length;++e){var r=t[e](n,o);if(r)return r}}}),a.registerHelper("fold","auto",function(n,o){for(var e=n.getHelpers(o,"fold"),r=0;r<e.length;r++){var t=e[r](n,o);if(t)return t}});var i={rangeFinder:a.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function c(n,o,e){if(o&&void 0!==o[e])return o[e];var r=n.options.foldOptions;return r&&void 0!==r[e]?r[e]:i[e]}a.defineOption("foldOptions",null),a.defineExtension("foldOption",function(n,o){return c(this,n,o)})});