Liferay.Loader.define("portal-search-web$codemirror@5.62.0/addon/search/match-highlighter",["module","exports","require","../../lib/codemirror","./matchesonscrollbar"],(function(t,e,o){var r;window,r=function(t){"use strict";var e={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};function o(t){for(var o in this.options={},e)this.options[o]=(t&&t.hasOwnProperty(o)?t:e)[o];this.overlay=this.timeout=null,this.matchesonscroll=null,this.active=!1}function r(t){var e=t.state.matchHighlighter;(e.active||t.hasFocus())&&n(t,e)}function i(t){var e=t.state.matchHighlighter;e.active||(e.active=!0,n(t,e))}function n(t,e){clearTimeout(e.timeout),e.timeout=setTimeout((function(){c(t)}),e.options.delay)}function a(t,e,o,r){var i=t.state.matchHighlighter;if(t.addOverlay(i.overlay=function(t,e,o){return{token:function(r){if(r.match(t)&&(!e||function(t,e){return!(t.start&&e.test(t.string.charAt(t.start-1))||t.pos!=t.string.length&&e.test(t.string.charAt(t.pos)))}(r,e)))return o;r.next(),r.skipTo(t.charAt(0))||r.skipToEnd()}}}(e,o,r)),i.options.annotateScrollbar&&t.showMatchesOnScrollbar){var n=o?new RegExp((/\w/.test(e.charAt(0))?"\\b":"")+e.replace(/[\\\[.+*?(){|^$]/g,"\\$&")+(/\w/.test(e.charAt(e.length-1))?"\\b":"")):e;i.matchesonscroll=t.showMatchesOnScrollbar(n,!1,{className:"CodeMirror-selection-highlight-scrollbar"})}}function s(t){var e=t.state.matchHighlighter;e.overlay&&(t.removeOverlay(e.overlay),e.overlay=null,e.matchesonscroll&&(e.matchesonscroll.clear(),e.matchesonscroll=null))}function c(t){t.operation((function(){var e=t.state.matchHighlighter;if(s(t),t.somethingSelected()||!e.options.showToken){var o=t.getCursor("from"),r=t.getCursor("to");if(o.line==r.line&&(!e.options.wordsOnly||function(t,e,o){if(null!==t.getRange(e,o).match(/^\w+$/)){if(e.ch>0){var r={line:e.line,ch:e.ch-1};if(null===t.getRange(r,e).match(/\W/))return!1}return!(o.ch<t.getLine(e.line).length&&(r={line:o.line,ch:o.ch+1},null===t.getRange(o,r).match(/\W/)))}return!1}(t,o,r))){var i=t.getRange(o,r);e.options.trim&&(i=i.replace(/^\s+|\s+$/g,"")),i.length>=e.options.minChars&&a(t,i,!1,e.options.style)}}else{for(var n=!0===e.options.showToken?/[\w$]/:e.options.showToken,c=t.getCursor(),l=t.getLine(c.line),h=c.ch,g=h;h&&n.test(l.charAt(h-1));)--h;for(;g<l.length&&n.test(l.charAt(g));)++g;h<g&&a(t,l.slice(h,g),n,e.options.style)}}))}t.defineOption("highlightSelectionMatches",!1,(function(e,n,a){if(a&&a!=t.Init&&(s(e),clearTimeout(e.state.matchHighlighter.timeout),e.state.matchHighlighter=null,e.off("cursorActivity",r),e.off("focus",i)),n){var l=e.state.matchHighlighter=new o(n);e.hasFocus()?(l.active=!0,c(e)):e.on("focus",i),e.on("cursorActivity",r)}}))},"object"==typeof e&&"object"==typeof t?r(o("../../lib/codemirror"),o("./matchesonscrollbar")):r(CodeMirror)}));
//# sourceMappingURL=match-highlighter.js.map