/* search collided entities for target to hover/dragover
518888
function () {
    var hvrevt, hoverEl
    // end previous hover
    if (this.state.has(this.HOVER_EVENT)) {
      this._unHover(this.state.get(this.HOVER_EVENT), true)
    }
    if (this.state.has(this.DRAGOVER_EVENT)) {
      this._unHover(this.state.get(this.DRAGOVER_EVENT), true)
    }
    if (this.dragging && this.state.get(this.DRAG_EVENT)) {
      hvrevt = {
        hand: this.el,
        hovered: hoverEl,
        carried: this.state.get(this.DRAG_EVENT)
      }
      hoverEl = this.findTarget(this.DRAGOVER_EVENT, hvrevt, true)
      if (hoverEl) {
        this.emitCancelable(this.state.get(this.DRAG_EVENT), this.DRAGOVER_EVENT, hvrevt)
        this.state.set(this.DRAGOVER_EVENT, hoverEl)
      }
    }
    // fallback to hover if not dragging or dragover wasn't successful
    if (!this.state.has(this.DRAGOVER_EVENT)) {
      hoverEl = this.findTarget(this.HOVER_EVENT, { hand: this.el }, true)
      if (hoverEl) {
        this.state.set(this.HOVER_EVENT, hoverEl)
      }
    }
  }
1264532
function(e) {
		var target = e.target,
		setting = data.getSetting(e.data.treeId),
		relatedTarget = e.relatedTarget,
		tId = "", node = null,
		nodeEventType = "", treeEventType = "",
		nodeEventCallback = null, treeEventCallback = null,
		tmp = null;

		if (tools.eqs(e.type, "mouseover")) {
			tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
			if (tmp) {
				tId = tools.getNodeMainDom(tmp).id;
				nodeEventType = "hoverOverNode";
			}
		} else if (tools.eqs(e.type, "mouseout")) {
			tmp = tools.getMDom(setting, relatedTarget, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
			if (!tmp) {
				tId = "remove";
				nodeEventType = "hoverOutNode";
			}
		} else if (tools.eqs(e.type, "mousedown")) {
			tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
			if (tmp) {
				tId = tools.getNodeMainDom(tmp).id;
				nodeEventType = "mousedownNode";
			}
		}
		if (tId.length>0) {
			node = data.getNodeCache(setting, tId);
			switch (nodeEventType) {
				case "mousedownNode" :
					nodeEventCallback = _handler.onMousedownNode;
					break;
				case "hoverOverNode" :
					nodeEventCallback = _handler.onHoverOverNode;
					break;
				case "hoverOutNode" :
					nodeEventCallback = _handler.onHoverOutNode;
					break;
			}
		}
		var proxyResult = {
			stop: false,
			node: node,
			nodeEventType: nodeEventType,
			nodeEventCallback: nodeEventCallback,
			treeEventType: treeEventType,
			treeEventCallback: treeEventCallback
		};
		return proxyResult
	}
121199
function handleMouseup(event) {
        scope.broadcast('dragend');
        $window.off('mousemove', handleMousemove);
        $window.off('mouseup', handleMouseup);
        event.preventDefault();
    }
1303443
function () {
    // constants
    this.HOVER_EVENT = 'hover-start'
    this.UNHOVER_EVENT = 'hover-end'
    this.GRAB_EVENT = 'grab-start'
    this.UNGRAB_EVENT = 'grab-end'
    this.STRETCH_EVENT = 'stretch-start'
    this.UNSTRETCH_EVENT = 'stretch-end'
    this.DRAG_EVENT = 'drag-start'
    this.UNDRAG_EVENT = 'drag-end'
    this.DRAGOVER_EVENT = 'dragover-start'
    this.UNDRAGOVER_EVENT = 'dragover-end'
    this.DRAGDROP_EVENT = 'drag-drop'

    // links to other systems/components
    this.otherSuperHand = null

    // state tracking - global event handlers (GEH)
    this.gehDragged = new Set()
    this.gehClicking = new Set()

    // state tracking - reaction components
    this.hoverEls = []
    this.hoverElsIntersections = []
    this.prevCheckTime = null
    this.state = new Map()
    this.dragging = false

    this.unHover = this.unHover.bind(this)
    this.unWatch = this.unWatch.bind(this)
    this.onHit = this.onHit.bind(this)
    this.onGrabStartButton = this.onGrabStartButton.bind(this)
    this.onGrabEndButton = this.onGrabEndButton.bind(this)
    this.onStretchStartButton = this.onStretchStartButton.bind(this)
    this.onStretchEndButton = this.onStretchEndButton.bind(this)
    this.onDragDropStartButton = this.onDragDropStartButton.bind(this)
    this.onDragDropEndButton = this.onDragDropEndButton.bind(this)
    this.system.registerMe(this)
  }
706558
public void dragAndDrop(WebElement source, WebElement target) {
        getActions().dragAndDrop(source, target).perform();
    }
1270775
function (out, delegateId, cssClassPostfix, skinIcon, label, focusable) {
            // --------------------------------------------------- destructuring

            var cfg = this._cfg;
            var skinnableClass = this._skinnableClass;

            var waiAria = cfg.waiAria;

            // ------------------------------------------------------ processing

            // wrapper (opening) -----------------------------------------------

            var attributes = [];

            // Adding atdraggable="" to make sure clicking on the button does not start the drag operation
            // Using the atdraggable attribute directly instead of the aria.utils.Mouse.DRAGGABLE_ATTRIBUTE
            // variable because aria.utils.Mouse may not be loaded yet.
            attributes.push('atdraggable=""');

            attributes.push('class="' + [
                'x' + skinnableClass + '_' + cssClassPostfix,
                'x' + skinnableClass + '_' + cfg.sclass + '_' + cssClassPostfix
            ].join(' ') + '"');

            attributes.push(ariaUtilsDelegate.getMarkup(delegateId));

            var openingTagMarkup = '<span ' + attributes.join(' ') + '>';

            out.write(openingTagMarkup);

            // button ----------------------------------------------------------

            var iconConfiguration = {
                icon : this._skinObj[skinIcon],
                waiAria : waiAria
            };

            if (label) {
                iconConfiguration.tooltip = label;
                iconConfiguration.label = label;
            }

            if (label || focusable) {
                iconConfiguration.role = 'button';
            }

            if (focusable) {
                iconConfiguration.tabIndex = 0;
            }


            var button = new ariaWidgetsIcon(iconConfiguration, this._context, this._lineNumber);

            out.registerBehavior(button);

            button.writeMarkup(out);

            // wrapper (closing) -----------------------------------------------

            out.write('</span>');

            // ---------------------------------------------------------- return

            return button;
        }
726201
function searchFormSubmitted(e){
    e = e || window.event;
    e.preventDefault();

    // If there's no selected item, do nothing
    if(!selectedItem) return false;

    // Otherwise, jump to the page
    window.location.href = relativeDir + selectedItem.getAttribute('data-value');

    return false;
  }
1337927
function enableSearch() {
    var query;
    var relHref = $("meta[property='docfx\\:rel']").attr("content");
    if (typeof relHref === 'undefined') {
      return;
    }
    try {
      var worker = new Worker(relHref + 'styles/search-worker.js');
      if (!worker && !window.worker) {
        localSearch();
      } else {
        webWorkerSearch();
      }

      renderSearchBox();
      highlightKeywords();
      addSearchEvent();
    } catch (e) {
      console.error(e);
    }

    //Adjust the position of search box in navbar
    function renderSearchBox() {
      autoCollapse();
      $(window).on('resize', autoCollapse);
      $(document).on('click', '.navbar-collapse.in', function (e) {
        if ($(e.target).is('a')) {
          $(this).collapse('hide');
        }
      });

      function autoCollapse() {
        var navbar = $('#autocollapse');
        if (navbar.height() === null) {
          setTimeout(autoCollapse, 300);
        }
        navbar.removeClass(collapsed);
        if (navbar.height() > 60) {
          navbar.addClass(collapsed);
        }
      }
    }

    // Search factory
    function localSearch() {
      console.log("using local search");
      var lunrIndex = lunr(function () {
        this.ref('href');
        this.field('title', { boost: 50 });
        this.field('keywords', { boost: 20 });
      });
      lunr.tokenizer.seperator = /[\s\-\.]+/;
      var searchData = {};
      var searchDataRequest = new XMLHttpRequest();

      var indexPath = relHref + "index.json";
      if (indexPath) {
        searchDataRequest.open('GET', indexPath);
        searchDataRequest.onload = function () {
          if (this.status != 200) {
            return;
          }
          searchData = JSON.parse(this.responseText);
          for (var prop in searchData) {
            if (searchData.hasOwnProperty(prop)){
              lunrIndex.add(searchData[prop]);
            }
          }
        }
        searchDataRequest.send();
      }

      $("body").bind("queryReady", function () {
        var hits = lunrIndex.search(query);
        var results = [];
        hits.forEach(function (hit) {
          var item = searchData[hit.ref];
          results.push({ 'href': item.href, 'title': item.title, 'keywords': item.keywords });
        });
        handleSearchResults(results);
      });
    }

    function webWorkerSearch() {
      console.log("using Web Worker");
      var indexReady = $.Deferred();

      worker.onmessage = function (oEvent) {
        switch (oEvent.data.e) {
          case 'index-ready':
            indexReady.resolve();
            break;
          case 'query-ready':
            var hits = oEvent.data.d;
            handleSearchResults(hits);
            break;
        }
      }

      indexReady.promise().done(function () {
        $("body").bind("queryReady", function () {
          worker.postMessage({ q: query });
        });
      });
    }

    // Highlight the searching keywords
    function highlightKeywords() {
      var q = url('?q');
      if (q !== null) {
        var keywords = q.split("%20");
        keywords.forEach(function (keyword) {
          if (keyword !== "") {
            $('.data-searchable *').mark(keyword);
            $('article *').mark(keyword);
          }
        });
      }
    }

    function addSearchEvent() {
      $('body').bind("searchEvent", function () {
        $('#search-query').keypress(function (e) {
          return e.which !== 13;
        });

        $('#search-query').keyup(function () {
          query = $(this).val();
          if (query.length < 3) {
            flipContents("show");
          } else {
            flipContents("hide");
            $("body").trigger("queryReady");
            $('#search-results>.search-list').text('Search Results for "' + query + '"');
          }
        }).off("keydown");
      });
    }

    function flipContents(action) {
      if (action === "show") {
        $('.hide-when-search').show();
        $('#search-results').hide();
      } else {
        $('.hide-when-search').hide();
        $('#search-results').show();
      }
    }

    function relativeUrlToAbsoluteUrl(currentUrl, relativeUrl) {
      var currentItems = currentUrl.split(/\/+/);
      var relativeItems = relativeUrl.split(/\/+/);
      var depth = currentItems.length - 1;
      var items = [];
      for (var i = 0; i < relativeItems.length; i++) {
        if (relativeItems[i] === '..') {
          depth--;
        } else if (relativeItems[i] !== '.') {
          items.push(relativeItems[i]);
        }
      }
      return currentItems.slice(0, depth).concat(items).join('/');
    }

    function extractContentBrief(content) {
      var briefOffset = 512;
      var words = query.split(/\s+/g);
      var queryIndex = content.indexOf(words[0]);
      var briefContent;
      if (queryIndex > briefOffset) {
        return "..." + content.slice(queryIndex - briefOffset, queryIndex + briefOffset) + "...";
      } else if (queryIndex <= briefOffset) {
        return content.slice(0, queryIndex + briefOffset) + "...";
      }
    }

    function handleSearchResults(hits) {
      var numPerPage = 10;
      $('#pagination').empty();
      $('#pagination').removeData("twbs-pagination");
      if (hits.length === 0) {
        $('#search-results>.sr-items').html('<p>No results found</p>');
      } else {
        $('#pagination').twbsPagination({
          totalPages: Math.ceil(hits.length / numPerPage),
          visiblePages: 5,
          onPageClick: function (event, page) {
            var start = (page - 1) * numPerPage;
            var curHits = hits.slice(start, start + numPerPage);
            $('#search-results>.sr-items').empty().append(
              curHits.map(function (hit) {
                var currentUrl = window.location.href;
                var itemRawHref = relativeUrlToAbsoluteUrl(currentUrl, relHref + hit.href);
                var itemHref = relHref + hit.href + "?q=" + query;
                var itemTitle = hit.title;
                var itemBrief = extractContentBrief(hit.keywords);

                var itemNode = $('<div>').attr('class', 'sr-item');
                var itemTitleNode = $('<div>').attr('class', 'item-title').append($('<a>').attr('href', itemHref).attr("target", "_blank").text(itemTitle));
                var itemHrefNode = $('<div>').attr('class', 'item-href').text(itemRawHref);
                var itemBriefNode = $('<div>').attr('class', 'item-brief').text(itemBrief);
                itemNode.append(itemTitleNode).append(itemHrefNode).append(itemBriefNode);
                return itemNode;
              })
            );
            query.split(/\s+/).forEach(function (word) {
              if (word !== '') {
                $('#search-results>.sr-items *').mark(word);
              }
            });
          }
        });
      }
    }
  }
880893
public void onMouseUp(ListenerEvent event) {
		if (clickstart && !dragging) {
			Coordinate worldPosition = event.getWorldPosition();
			Point point = mapWidget.getMapModel().getGeometryFactory().createPoint(worldPosition);

			SearchByLocationRequest request = new SearchByLocationRequest();
			request.setLocation(GeometryConverter.toDto(point));
			request.setCrs(mapWidget.getMapModel().getCrs());
			request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
			request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
			request.setBuffer(calculateBufferFromPixelTolerance());
			request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect());
			
			for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
				if (layer.isShowing() && layer instanceof VectorLayer  && !layersToExclude.contains(layer.getId())) {
					request.addLayerWithFilter(layer.getId(), layer.getServerLayerId(),
							((VectorLayer) layer).getFilter());
				}
			}
			final SearchByPointRequest rasterLayerRequest = new SearchByPointRequest();
			rasterLayerRequest.setLocation(point.getCoordinate());
			rasterLayerRequest.setCrs(mapWidget.getMapModel().getCrs());
			rasterLayerRequest.setSearchType(SearchByPointRequest.SEARCH_ALL_LAYERS);
			rasterLayerRequest.setPixelTolerance(pixelTolerance);
			final Map<String, String> rasterLayerIds = new HashMap<String, String>();
			for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
				if (layer.isShowing() && layer instanceof RasterLayer && !layersToExclude.contains(layer.getId())) {
					rasterLayerIds.put(layer.getId(), layer.getServerLayerId());
				}
			}
			rasterLayerRequest.setLayerMapping(rasterLayerIds);
			rasterLayerRequest.setBbox(toBbox(mapWidget.getMapModel().getMapView().getBounds()));
			rasterLayerRequest.setScale(mapWidget.getMapModel().getMapView().getCurrentScale());

			GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
			commandRequest.setCommandRequest(request);
			// TODO: commands are now chained. Perhaps we should combine this
			// into a single command?
			GwtCommandDispatcher.getInstance().execute(commandRequest, 
								new AbstractCommandCallback<SearchByLocationResponse>() {
				public void execute(final SearchByLocationResponse vectorResponse) {
					if (includeRasterLayers) {
						GwtCommand commandRequest = new GwtCommand(SearchByPointRequest.COMMAND);
						commandRequest.setCommandRequest(rasterLayerRequest);
						GwtCommandDispatcher.getInstance().execute(commandRequest,
								new AbstractCommandCallback<SearchByPointResponse>() {
									public void execute(final SearchByPointResponse rasterResponse) {
										//Featuremap maps client layer on feature
										Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = 
											vectorResponse.getFeatureMap();
										featureMap.putAll(rasterResponse.getFeatureMap());
										showFeatureInfo(featureMap);
									}
								});

					} else {
						showFeatureInfo(vectorResponse.getFeatureMap());
					}
				}
			});

		} else {
			dragging = false;
		}
		clickstart = false;
	}
1268905
function onDrag(target, innerTarget, dir, listener) { // eslint-disable-line max-params
	const hasPointerEvent = undefined !== target.onpointerup;
	const hasTouchEvent   = undefined !== target.ontouchstart;
	const pointerDown = hasPointerEvent ? 'pointerdown' : hasTouchEvent ? 'touchstart' : 'mousedown';
	const pointerMove = hasPointerEvent ? 'pointermove' : hasTouchEvent ? 'touchmove' : 'mousemove';
	const pointerUp   = hasPointerEvent ? 'pointerup'   : hasTouchEvent ? 'touchend' : 'mouseup';

	// ...
	const dirIsInline = /^(ltr|rtl)$/i.test(dir);
	const dirIsStart  = /^(ltr|ttb)$/i.test(dir);

	// ...
	const axisProp = dirIsInline ? 'clientX' : 'clientY';

	let window, start, end;

	// on pointer down
	target.addEventListener(pointerDown, onpointerdown);

	function onpointerdown(event) {
		// window
		window = target.ownerDocument.defaultView;

		// client boundaries
		const rect = innerTarget.getBoundingClientRect();

		// the container start and end coordinates
		start = dirIsInline ? rect.left : rect.top;
		end   = dirIsInline ? rect.right : rect.bottom;

		onpointermove(event);

		window.addEventListener(pointerMove, onpointermove);
		window.addEventListener(pointerUp, onpointerup);
	}

	function onpointermove(event) {
		// prevent browser actions on this event
		event.preventDefault();

		// the pointer coordinate
		const position = axisProp in event ? event[axisProp] : event.touches && event.touches[0] && event.touches[0][axisProp] || 0;

		// the percentage of the pointer along the container
		const percentage = (dirIsStart ? position - start : end - position) / (end - start);

		// call the listener with percentage
		listener(percentage);
	}

	function onpointerup() {
		window.removeEventListener(pointerMove, onpointermove);
		window.removeEventListener(pointerUp, onpointerup);
	}
}
839226
function handleMouseUp (e) {
                    if(enabled){
                        var selectable = (e.target.attributes && 'drag-scroll-text' in e.target.attributes);
                        var withinXConstraints = (e.clientX >= (startClientX - allowedClickOffset) && e.clientX <= (startClientX + allowedClickOffset));
                        var withinYConstraints = (e.clientY >= (startClientY - allowedClickOffset) && e.clientY <= (startClientY + allowedClickOffset));

                        // Set 'pushed' state
                        pushed = false;

                        // Check if cursor falls within X and Y axis constraints
                        if(selectable && withinXConstraints && withinYConstraints) {
                            // If so, select the text inside the target element
                            selectText(e.target);
                        }

                        $scope.$apply(function() {
                            onDragEnd($scope);
                        });

                        removeDragListeners();
                    }

                }
62680
function( event ){
                // sorry, only one touch at a time
                if ( drag.touched )
                    return;
                // the drag/drop interaction data
                var dd = event.data, results;
                // check the which directive
                if ( event.which != 0 && dd.which > 0 && event.which != dd.which )
                    return;
                // check for suppressed selector
                if ( $( event.target ).is( dd.not ) )
                    return;
                // check for handle selector
                if ( dd.handle && !$( event.target ).closest( dd.handle, event.currentTarget ).length )
                    return;

                drag.touched = event.type == 'touchstart' ? this : null;
                dd.propagates = 1;
                dd.mousedown = this;
                dd.interactions = [ drag.interaction( this, dd ) ];
                dd.target = event.target;
                dd.pageX = event.pageX;
                dd.pageY = event.pageY;
                dd.dragging = null;
                // handle draginit event...
                results = drag.hijack( event, "draginit", dd );
                // early cancel
                if ( !dd.propagates )
                    return;
                // flatten the result set
                results = drag.flatten( results );
                // insert new interaction elements
                if ( results && results.length ){
                    dd.interactions = [];
                    $.each( results, function(){
                        dd.interactions.push( drag.interaction( this, dd ) );
                    });
                }
                // remember how many interactions are propagating
                dd.propagates = dd.interactions.length;
                // locate and init the drop targets
                if ( dd.drop !== false && $special.drop )
                    $special.drop.handler( event, dd );
                // disable text selection
                drag.textselect( false );
                // bind additional events...
                if ( drag.touched )
                    $event.add( drag.touched, "touchmove touchend", drag.handler, dd );
                else
                    $event.add( document, "mousemove mouseup", drag.handler, dd );
                // helps prevent text selection or scrolling
                if ( !drag.touched || dd.live )
                    return false;
            }
239724
function insertBefore(targetElement, targetScope) {
            // Ensure the placeholder is visible in the target (unless it's a table row)
            if (placeHolder.css('display') !== 'table-row') {
              placeHolder.css('display', 'block');
            }
            if (!targetScope.sortableScope.options.clone) {
              targetElement[0].parentNode.insertBefore(placeHolder[0], targetElement[0]);
              dragItemInfo.moveTo(targetScope.sortableScope, targetScope.index());
            }
          }
989680
function insertAfter(targetElement, targetScope) {
            // Ensure the placeholder is visible in the target (unless it's a table row)
            if (placeHolder.css('display') !== 'table-row') {
              placeHolder.css('display', 'block');
            }
            if (!targetScope.sortableScope.options.clone) {
              targetElement.after(placeHolder);
              dragItemInfo.moveTo(targetScope.sortableScope, targetScope.index() + 1);
            }
          }
220172
function( event, drag ) {
			var el, drops, selector, sels;
			this.last_active = [];
			for(var i=0; i < this._elements.length; i++){ //for each element
				el = this._elements[i]
				var drops = $.event.findBySelector(el, eventNames)

				for(selector in drops){ //find the selectors
					sels = selector ? jQuery(selector, el) : [el];
					for(var e= 0; e < sels.length; e++){ //for each found element, create a drop point
						jQuery.removeData(sels[e],"offset");
						this.add(sels[e], new this(drops[selector]), event, drag);
					}
				}
			}
			
		}
328814
function selectIndex(idx){

    // If another item is currently selected, deselect it
    if(selectedItem) selectedItem.className = selectedItem.className.replace(/\s?selected/,'');

    // Grab the search results straight from the DOM
    var r = document.getElementById('searchresults');
    var items = r.childNodes;

    // If we actually have no items, there's not much we can do
    if(items.length === 0){
      selectedSearchIndex = -1;
      selectedItem = false;
      return;
    }

    // Store the item and its index in helper variables
    selectedSearchIndex = idx;
    var s = selectedItem = items[idx];

    // Select the item
    s.className += ' selected';

    // Figure out whether or not the item is fully visible inside
    // the scrollable view, and if not, then scroll appropriately
    var o = s.offsetTop - r.offsetTop - r.scrollTop;
    if(o < 0){
      r.scrollTop = s.offsetTop - r.offsetTop;
    }else if(o > r.offsetHeight - s.offsetHeight){
      r.scrollTop = o + r.scrollTop - r.offsetHeight + s.offsetHeight;
    }
  }
174115
function () {
            this._draggable = new ariaUtilsDragdropDrag(this._slider, {
                handle : this._slider,
                proxy : null,
                axis : "x",
                constrainTo : this._sliderContainer
            });
            this._draggable.$on({
                "dragstart" : {
                    fn : this._onDragStart,
                    scope : this
                },
                "move" : {
                    fn : this._onDragMove,
                    scope : this
                },
                "dragend" : {
                    fn : this._onDragEnd,
                    scope : this
                }
            });
        }