Liferay.Loader.define("fragment-web$codemirror@5.65.2/addon/scroll/annotatescrollbar",["module","exports","require","../../lib/codemirror"],(function(t,e,i){var n,o=void 0;window;n=function(t){"use strict";function Annotation(t,e){function scheduleRedraw(t){clearTimeout(i.doRedraw),i.doRedraw=setTimeout((function(){i.redraw()}),t)}this.cm=t,this.options=e,this.buttonHeight=e.scrollButtonHeight||t.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=t.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var i=this;t.on("refresh",this.resizeHandler=function(){clearTimeout(i.doUpdate),i.doUpdate=setTimeout((function(){i.computeScale()&&scheduleRedraw(20)}),100)}),t.on("markerAdded",this.resizeHandler),t.on("markerCleared",this.resizeHandler),!1!==e.listenForChanges&&t.on("changes",this.changeHandler=function(){scheduleRedraw(250)})}t.defineExtension("annotateScrollbar",(function(t){return"string"==typeof t&&(t={className:t}),new Annotation(this,t)})),t.defineOption("scrollButtonHeight",0),Annotation.prototype.computeScale=function(){var t=this.cm,e=(t.getWrapperElement().clientHeight-t.display.barHeight-2*this.buttonHeight)/t.getScrollerElement().scrollHeight;if(e!=this.hScale)return this.hScale=e,!0},Annotation.prototype.update=function(t){this.annotations=t,this.redraw()},Annotation.prototype.redraw=function(t){!1!==t&&this.computeScale();var e=this.cm,i=this.hScale,n=document.createDocumentFragment(),o=this.annotations,r=e.getOption("lineWrapping"),a=r&&1.5*e.defaultTextHeight(),s=null,d=null;function getY(t,i){if(s!=t.line){s=t.line,d=e.getLineHandle(t.line);var n=e.getLineHandleVisualStart(d);n!=d&&(s=e.getLineNumber(n),d=n)}return d.widgets&&d.widgets.length||r&&d.height>a?e.charCoords(t,"local")[i?"top":"bottom"]:e.heightAtLine(d,"local")+(i?0:d.height)}var l=e.lastLine();if(e.display.barWidth)for(var h,c=0;c<o.length;c++){var p=o[c];if(!(p.to.line>l)){for(var u=h||getY(p.from,!0)*i,m=getY(p.to,!1)*i;c<o.length-1&&!(o[c+1].to.line>l)&&!((h=getY(o[c+1].from,!0)*i)>m+.9);)m=getY((p=o[++c]).to,!1)*i;if(m!=u){var f=Math.max(m-u,3),g=n.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(e.display.barWidth-1,2)+"px; top: "+(u+this.buttonHeight)+"px; height: "+f+"px",g.className=this.options.className,p.id&&g.setAttribute("annotation-id",p.id)}}}this.div.textContent="",this.div.appendChild(n)},Annotation.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("changes",this.changeHandler),this.div.parentNode.removeChild(this.div)}},"object"==typeof e&&"object"==typeof t?n(i("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],n):n(CodeMirror)}));
//# sourceMappingURL=annotatescrollbar.js.map