Liferay.Loader.define("liferay!object-js-components-web$codemirror@5.65.12/addon/edit/matchtags",["module","exports","require","../../lib/codemirror","../fold/xml-fold"],(function(t,a,e){var o,r=void 0;window;o=function(t){"use strict";function clear(t){t.state.tagHit&&t.state.tagHit.clear(),t.state.tagOther&&t.state.tagOther.clear(),t.state.tagHit=t.state.tagOther=null}function doMatchTags(a){a.state.failedTagMatch=!1,a.operation((function(){if(clear(a),!a.somethingSelected()){var e=a.getCursor(),o=a.getViewport();o.from=Math.min(o.from,e.line),o.to=Math.max(e.line+1,o.to);var r=t.findMatchingTag(a,e,o);if(r){if(a.state.matchBothTags){var i="open"==r.at?r.open:r.close;i&&(a.state.tagHit=a.markText(i.from,i.to,{className:"CodeMirror-matchingtag"}))}var c="close"==r.at?r.open:r.close;c?a.state.tagOther=a.markText(c.from,c.to,{className:"CodeMirror-matchingtag"}):a.state.failedTagMatch=!0}}}))}function maybeUpdateMatch(t){t.state.failedTagMatch&&doMatchTags(t)}t.defineOption("matchTags",!1,(function(a,e,o){o&&o!=t.Init&&(a.off("cursorActivity",doMatchTags),a.off("viewportChange",maybeUpdateMatch),clear(a)),e&&(a.state.matchBothTags="object"==typeof e&&e.bothTags,a.on("cursorActivity",doMatchTags),a.on("viewportChange",maybeUpdateMatch),doMatchTags(a))})),t.commands.toMatchingTag=function(a){var e=t.findMatchingTag(a,a.getCursor());if(e){var o="close"==e.at?e.open:e.close;o&&a.extendSelection(o.to,o.from)}}},"object"==typeof a&&"object"==typeof t?o(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof r&&r.amd?r(["../../lib/codemirror","../fold/xml-fold"],o):o(CodeMirror)}));
//# sourceMappingURL=matchtags.js.map