Liferay.Loader.define("journal-web$codemirror@5.65.2/addon/search/match-highlighter",["module","exports","require","../../lib/codemirror","./matchesonscrollbar"],(function(t,e,o){var r,i=void 0;window;r=function(t){"use strict";var e={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};function State(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 cursorActivity(t){var e=t.state.matchHighlighter;(e.active||t.hasFocus())&&scheduleHighlight(t,e)}function onFocus(t){var e=t.state.matchHighlighter;e.active||(e.active=!0,scheduleHighlight(t,e))}function scheduleHighlight(t,e){clearTimeout(e.timeout),e.timeout=setTimeout((function(){highlightMatches(t)}),e.options.delay)}function addOverlay(t,e,o,r){var i=t.state.matchHighlighter;if(t.addOverlay(i.overlay=function makeOverlay(t,e,o){return{token:function(r){if(r.match(t)&&(!e||function boundariesAround(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 removeOverlay(t){var e=t.state.matchHighlighter;e.overlay&&(t.removeOverlay(e.overlay),e.overlay=null,e.matchesonscroll&&(e.matchesonscroll.clear(),e.matchesonscroll=null))}function highlightMatches(t){t.operation((function(){var e=t.state.matchHighlighter;if(removeOverlay(t),t.somethingSelected()||!e.options.showToken){var o=t.getCursor("from"),r=t.getCursor("to");if(o.line==r.line&&(!e.options.wordsOnly||function isWord(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&&addOverlay(t,i,!1,e.options.style)}}else{for(var n=!0===e.options.showToken?/[\w$]/:e.options.showToken,a=t.getCursor(),c=t.getLine(a.line),l=a.ch,s=l;l&&n.test(c.charAt(l-1));)--l;for(;s<c.length&&n.test(c.charAt(s));)++s;l<s&&addOverlay(t,c.slice(l,s),n,e.options.style)}}))}t.defineOption("highlightSelectionMatches",!1,(function(e,o,r){if(r&&r!=t.Init&&(removeOverlay(e),clearTimeout(e.state.matchHighlighter.timeout),e.state.matchHighlighter=null,e.off("cursorActivity",cursorActivity),e.off("focus",onFocus)),o){var i=e.state.matchHighlighter=new State(o);e.hasFocus()?(i.active=!0,highlightMatches(e)):e.on("focus",onFocus),e.on("cursorActivity",cursorActivity)}}))},"object"==typeof e&&"object"==typeof t?r(o("../../lib/codemirror"),o("./matchesonscrollbar")):"function"==typeof i&&i.amd?i(["../../lib/codemirror","./matchesonscrollbar"],r):r(CodeMirror)}));
//# sourceMappingURL=match-highlighter.js.map