/* Aurelia Protractor Plugin Custom Locators
341440
function addValueBindLocator() {
  by.addLocator('valueBind', function (bindingModel, opt_parentElement) {
    const using = opt_parentElement || document;
    const selector = `*[value\\.bind='${bindingModel}']`;
    const matches = using.querySelectorAll(selector);

    return (matches.length === 0)
      ? null
      : (matches.length === 1)
        ? matches[0]
        : matches;
  });
}
306935
function SettingsRenderer(settingsListExplorer, serviceRegistry) {
		this.serviceRegistry = serviceRegistry;
		this.childWidgets = [];
		SelectionRenderer.call(this, {cachePrefix: 'pluginSettings', noRowHighlighting: true}, settingsListExplorer); //$NON-NLS-0$
	}
1035461
function(callback) {

      if (window.angular) {
        var hooks = getNg1Hooks(rootSelector);
        if (!hooks){
          callback();  // not an angular1 app
        }
        else{
          if (hooks.$$testability) {
            hooks.$$testability.whenStable(callback);
          } else if (hooks.$injector) {
            hooks.$injector.get('$browser')
                .notifyWhenNoOutstandingRequests(callback);
          } else if (!rootSelector) {
            throw new Error(
                'Could not automatically find injector on page: "' +
                window.location.toString() + '".  Consider using config.rootEl');
          } else {
            throw new Error(
                'root element (' + rootSelector + ') has no injector.' +
                ' this may mean it is not inside ng-app.');
          }
        }
      }
      else {callback();}  // not an angular1 app
    }
70844
function triggerClickHoverEvent(eventname, event, seriesFilter, searchDistance) {
            var options = plot.getOptions(),
                offset = plot.offset(),
                page = browser.getPageXY(event),
                canvasX = page.X - offset.left,
                canvasY = page.Y - offset.top,
                pos = plot.c2p({
                    left: canvasX,
                    top: canvasY
                }),
                distance = searchDistance !== undefined ? searchDistance : options.grid.mouseActiveRadius;

            pos.pageX = page.X;
            pos.pageY = page.Y;

            var item = plot.findNearbyItem(canvasX, canvasY, seriesFilter, distance);

            if (item) {
                // fill in mouse pos for any listeners out there
                item.pageX = parseInt(item.series.xaxis.p2c(item.datapoint[0]) + offset.left, 10);
                item.pageY = parseInt(item.series.yaxis.p2c(item.datapoint[1]) + offset.top, 10);
            }

            if (options.grid.autoHighlight) {
                // clear auto-highlights
                for (var i = 0; i < highlights.length; ++i) {
                    var h = highlights[i];
                    if ((h.auto === eventname &&
                        !(item && h.series === item.series &&
                            h.point[0] === item.datapoint[0] &&
                            h.point[1] === item.datapoint[1])) || !item) {
                        unhighlight(h.series, h.point);
                    }
                }

                if (item) {
                    highlight(item.series, item.datapoint, eventname);
                }
            }

            plot.getPlaceholder().trigger(eventname, [pos, item]);
        }
926687
function importCustomSelectorsFromObject(object) {
	const customSelectors = Object.assign(
		{},
		Object(object).customSelectors || Object(object)['custom-selectors']
	);

	for (const key in customSelectors) {
		customSelectors[key] = getSelectorsAstFromSelectorsString(customSelectors[key]);
	}

	return customSelectors;
}
268094
function getSelectorList(eventName){
  if (hasOwnProperty.call(eventMap, eventName))
    return eventMap[eventName];

  var selectorList = eventMap[eventName] = [];
  var inputTimeout = null;

  switch (eventName) {
    case SHOW_EVENT:
      selectorList.visible = {};
      setInterval(checkShow, VISIBLE_CHECK_INTERVAL);
      break;

    default:
      eventUtils.addGlobalHandler(eventName, function(event){
        var path = event.path.reduce(function(res, node){
          var role = node.getAttribute ? node.getAttribute('role-marker') : null;
          if (role)
            res.unshift(parseRole(role));
          return res;
        }, []);

        // if there is at least one `role-marker` attribute in the DOM [x]path for the clicked (or hovered or `event`ed) element
        // then lets search a matching selector in our loaded track map
        if (path.length)
          selectorList.forEach(function(item){
            var result = handleEventFor(path, item, event);
            if (result)
              if (result.debounce)
              {
                clearTimeout(inputTimeout);
                inputTimeout = setTimeout(function(){
                  track(result.dataToTrack);
                }, INPUT_DEBOUNCE_TIMEOUT);
              }
              else
              {
                track(result.dataToTrack);
              }
          });
      });
  }

  return selectorList;
}
1015126
function (hooks, ui) {

        var config = hooks
            .map(transformConfig)
            .reduce(createConfigItem, {});

        return {
            /**
             * pagesConfig - This is the angular configuration such as routes
             */
            pagesConfig: configTmpl
                .replace("%when%", hooks.reduce(
                    createAngularRoutes,
                    ""
                ))
                .replace("%pages%", JSON.stringify(
                    config,
                    null,
                    4
                )),
            /**
             * pagesConfig in object form
             */
            pagesObj: config,
            pageMarkup: function () {
                return preAngular(ui.pluginManager.plugins, config, ui);
            }
        };
    }
977743
def locate(name, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('locate', **{
        'name': name,
        'locator': ctx.locator,
    })
6611
function(options){
      if (typeof window !== 'undefined' && window.navigator.geolocation) {

        // Have default options, but allow to extend with custom.
        var geolocationOptions = this.extend({
          maximumAge: 0,
          timeout: 10000,
          enableHighAccuracy: true
        }, options);

        return new Promise(function (resolve, reject) {

          window.navigator.geolocation.getCurrentPosition(function (position) {

            resolve(position);

          }, function (err) {

            var errorMessage = 'Geolocation: ';
            if(err.code === 1) {
              errorMessage = 'You didn\'t share your location.';
            } else if(err.code === 2) {
              errorMessage = 'Couldn\'t detect your current location.';
            } else if(err.code === 3) {
              errorMessage = 'Retrieving position timed out.';
            } else {
              errorMessage = 'Unknown error.';
            }
            reject(errorMessage);

          }, geolocationOptions);

        });

      }else{
        return new Promise(function (resolve, reject) {
          reject('Your browser\/environment doesn\'t support geolocation.');
        });
      }
    }
437038
function locateHostElement(factory, elementOrSelector) {
    ngDevMode && assertDataInRange(-1);
    rendererFactory = factory;
    var defaultRenderer = factory.createRenderer(null, null);
    var rNode = typeof elementOrSelector === 'string' ?
        (isProceduralRenderer(defaultRenderer) ?
            defaultRenderer.selectRootElement(elementOrSelector) :
            defaultRenderer.querySelector(elementOrSelector)) :
        elementOrSelector;
    if (ngDevMode && !rNode) {
        if (typeof elementOrSelector === 'string') {
            throw createError('Host node with selector not found:', elementOrSelector);
        }
        else {
            throw createError('Host node is required:', elementOrSelector);
        }
    }
    return rNode;
}
690735
function ReflectiveInjector_(_providers, _parent) {
        if (_parent === void 0) { _parent = null; }
        /** @internal */
        this._constructionCounter = 0;
        this._providers = _providers;
        this._parent = _parent;
        var len = _providers.length;
        this.keyIds = new Array(len);
        this.objs = new Array(len);
        for (var i = 0; i < len; i++) {
            this.keyIds[i] = _providers[i].key.id;
            this.objs[i] = UNDEFINED;
        }
    }
479155
function(containerEl, attributeVal) {
      var AUTO_FOCUS = this.prefixer('md-autofocus', true);
      var elToFocus;

      elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS);

      if (!elToFocus && attributeVal != AUTO_FOCUS) {
        // Scan for deprecated attribute
        elToFocus = scanForFocusable(containerEl, this.prefixer('md-auto-focus', true));

        if (!elToFocus) {
          // Scan for fallback to 'universal' API
          elToFocus = scanForFocusable(containerEl, AUTO_FOCUS);
        }
      }

      return elToFocus;

      /**
       * Can target and nested children for specified Selector (attribute)
       * whose value may be an expression that evaluates to True/False.
       */
      function scanForFocusable(target, selector) {
        var elFound, items = target[0].querySelectorAll(selector);

        // Find the last child element with the focus attribute
        if (items && items.length){
          items.length && angular.forEach(items, function(it) {
            it = angular.element(it);

            // Check the element for the md-autofocus class to ensure any associated expression
            // evaluated to true.
            var isFocusable = it.hasClass('md-autofocus');
            if (isFocusable) elFound = it;
          });
        }
        return elFound;
      }
    }
865387
function parse_locator(locator)
{
    var result = locator.match(/^([A-Za-z]+)=.+/);
    if (result) {
        var type = result[1].toLowerCase();
        var actualLocator = locator.substring(type.length + 1);
        return { type: type, string: actualLocator };
    }
    return { type: 'implicit', string: locator };
}
992712
function (scope, iAttrs, newValue) {
    'use strict';
    var ngModelArr = iAttrs.ngModel.split('.');
    // console.log(JSON.stringify(ngModelArr, null, 2));


    switch (ngModelArr.length) {
    case 1:
        scope.$apply(function () {scope[ngModelArr[0]] = newValue;});
        break;
    case 2:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]] = newValue;});
        break;
    case 3:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]] = newValue;});
        break;
    case 4:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]] = newValue;});
        break;
    case 5:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]][ngModelArr[4]] = newValue;});
        break;
    default:
        scope.$apply(function () {scope[iAttrs.ngModel] = newValue;});
    }

}
773977
function (aNavigableItems) {
				// Initialize the ItemNavigation if required
				if (!this.oItemNavigation) {
					this.oItemNavigation = new ItemNavigation();
					this.addDelegate(this.oItemNavigation);
				}

				this.oItemNavigation.setRootDomRef(ToolbarRenderer.getPopupArea(this.oToolbar));
				this.oItemNavigation.setItemDomRefs(aNavigableItems);
				this.oItemNavigation.focusItem(0);
			}
1294763
private <T, U> T[] locateAll(final ClassLocator locator, final Class<T> clazz, final Consumer<T> bootstrapper) {
        Set<Class<? extends T>> set = locator.subtypeOf(clazz);
        if (!set.isEmpty()) {
            
            @SuppressWarnings("unchecked")
            T[] all =   (T[]) Array.newInstance(clazz, set.size());
            int index = 0;
            
            Iterator<Class<? extends T>> iterator = set.iterator();
            while (iterator.hasNext()) {
                Class<? extends T> c = iterator.next();
                
                try {
                    T locatedImplementation = DynamicClassFactory.createInstance(c, clazz);
                    bootstrapper.accept(locatedImplementation);
                    logger.debug("Loaded configuration from: " + c);
                    all[index++] = locatedImplementation;
                    
                } catch (IllegalArgumentException e) {
                    throw e;
                } catch (Exception e) {
                    logger.debug("Error reading custom configuration. Going with built in defaults. The error was: " + getCauseMessage(e));
                }
            }
            return all;
        } else {
            logger.debug("Did not find custom configuration for {}. Going with built in defaults ", clazz);
        }
        return null;
    }
828209
function findClosestPointOnSpecialAttractor(x,y) {
  var nSpecialAttractor = specialAttractors.length;
  var currentMinDistance = 0;
  var currentSpecialAttractor;
  var ox = 0;
  var oy = 0;
  for(var a=0; a<nSpecialAttractor; a++) {
    var specialAttractor = specialAttractors[a];
    var closestSegmentPoint = distanceToSegment(specialAttractor.x1, specialAttractor.y1, specialAttractor.x2, specialAttractor.y2, x, y);
    if(a == 0 || (closestSegmentPoint.distance) < currentMinDistance) {
      currentMinDistance = closestSegmentPoint.distance;
      currentSpecialAttractor = specialAttractor;
      ox = closestSegmentPoint.originX;
      oy = closestSegmentPoint.originY;
    }
  }
  return {
    distance: currentMinDistance,
    specialAttractor: currentSpecialAttractor,
    originX: ox,
    originY: oy
  }
}