!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(n){"use strict";function i(e){e.state.selectionPointer.rects=null,l(e)}function l(e){e.state.selectionPointer.willUpdate||(e.state.selectionPointer.willUpdate=!0,setTimeout(function(){!function(e){var t=e.state.selectionPointer;if(!t)return;if(null==t.rects&&null!=t.mouseX&&(t.rects=[],e.somethingSelected()))for(var o=e.display.selectionDiv.firstChild;o;o=o.nextSibling)t.rects.push(o.getBoundingClientRect());var n=!1;if(null!=t.mouseX)for(var i=0;i<t.rects.length;i++){var l=t.rects[i];l.left<=t.mouseX&&l.right>=t.mouseX&&l.top<=t.mouseY&&l.bottom>=t.mouseY&&(n=!0)}var s=n?t.value:"";e.display.lineDiv.style.cursor!=s&&(e.display.lineDiv.style.cursor=s)}(e),e.state.selectionPointer.willUpdate=!1},50))}n.defineOption("selectionPointer",!1,function(t,e){var o=t.state.selectionPointer;o&&(n.off(t.getWrapperElement(),"mousemove",o.mousemove),n.off(t.getWrapperElement(),"mouseout",o.mouseout),n.off(window,"scroll",o.windowScroll),t.off("cursorActivity",i),t.off("scroll",i),t.state.selectionPointer=null,t.display.lineDiv.style.cursor=""),e&&(o=t.state.selectionPointer={value:"string"==typeof e?e:"default",mousemove:function(e){!function(e,t){var o=e.state.selectionPointer;(null==t.buttons?t.which:t.buttons)?o.mouseX=o.mouseY=null:(o.mouseX=t.clientX,o.mouseY=t.clientY);l(e)}(t,e)},mouseout:function(e){!function(e,t){if(!e.getWrapperElement().contains(t.relatedTarget)){var o=e.state.selectionPointer;o.mouseX=o.mouseY=null,l(e)}}(t,e)},windowScroll:function(){i(t)},rects:null,mouseX:null,mouseY:null,willUpdate:!1},n.on(t.getWrapperElement(),"mousemove",o.mousemove),n.on(t.getWrapperElement(),"mouseout",o.mouseout),n.on(window,"scroll",o.windowScroll),t.on("cursorActivity",i),t.on("scroll",i))})});