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