!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(d){"use strict";d.registerHelper("fold","markdown",function(t,e){function i(e){var n=t.getTokenTypeAt(d.Pos(e,0));return n&&/\bheader\b/.test(n)}function n(e,n,t){var r=n&&n.match(/^#+/);return r&&i(e)?r[0].length:(r=t&&t.match(/^[=\-]+\s*$/))&&i(e+1)?"="==t[0]?1:2:100}var r=t.getLine(e.line),o=t.getLine(e.line+1),f=n(e.line,r,o);if(100!==f){for(var l=t.lastLine(),c=e.line,u=t.getLine(c+2);c<l&&!(n(c+1,o,u)<=f);)++c,o=u,u=t.getLine(c+2);return{from:d.Pos(e.line,r.length),to:d.Pos(c,t.getLine(c).length)}}})});