/*
It is the main entry point to check using route name
543277
public function checkRoute($route,$active=null,$inactive=null)
    {
        $this->setReturnValue($active,$inactive);

        if (is_array($route)) {
            $result = call_user_func_array(array($this,'routeIsDeeply'), $route);
        } else {
            $result = $this->routeIsDeeply($route);   
        }

        return $result ? $this->activeValue : $this->inActiveValue;
    }
1043117
public function match(MainRouter $router, $route = null)
    {
        $route = $route ?: $this->app->uri->route;
        $route = $route ?: '/';

        $input   = $this->app->input;
        $request = $this->app->request;

        if ($request->hasHeader('X-HTTP-Method-Override')) {
            $method = $request->getHeaderLine('X-HTTP-Method-Override');
        } else {
            $method = $input->get('_method') ?: $input->getMethod();
        }

        // Pass variables to custom method
        if ($input->$method) {
            $httpMethod = $input->getMethod();

            $input->$method->setData($input->$httpMethod->toArray());
        }

        // Prepare option data
        $uri = $request->getUri();

        $options = [
            'scheme' => $uri->getScheme(),
            'host' => $uri->getHost(),
            'port' => $uri->getPort(),
        ];

        try {
            return $router->match($route, $method, $options);
        } catch (RouteNotFoundException $e) {
            // If simple_route is disabled, just continue throw the exception.
            if (!$this->app->get('routing.simple_route', false)) {
                throw $e;
            }

            // Simple routing
            $matched = $this->matchSimpleRouting($route, $method, $router);

            if ($matched === false) {
                throw new RouteNotFoundException($e->getMessage(), $e->getCode(), $e);
            }

            return $matched;
        }
    }
145870
function(name){
		var routerCfg = config.router.instances[name];
		log("debug", "Instantiating Router - " + name);
		routers[name] = new EventEmitter2({wildcard: true, delimiter: '.', newListener: false, maxListeners:  config.maxObjectListeners, verboseMemoryLeak: false});
		var Incoming = function(message){
			var route = Route(message.request.host, message.request.path);
			var verb = message.request.verb.toLowerCase();
			if(!route || !route.match.controller) { 
				log("warning","Router > Received request from an interface but could not resolve endpoint - 404 - " + message.msgId, message);
				ReturnError(message,"Page Not Found",404); 
				return; 
			}
			var controller = route.match.controller;
			var Req = require("./lib/req.js");
			var req = new Req;
			req.init(isnode, {
				msgId: message.msgId,
				type: message.type,
				interface: message.interface,
				router: name,
				path: message.request.path,
				host: message.request.host,
				headers: message.request.headers,
				port: message.request.port,
				query: message.request.query,
				params: route.param,
				cookies: message.request.cookies,
				ip: message.request.ip,
				verb: message.request.verb,
				secure: message.request.secure,
				service: route.match.service,
				body: message.request.body
			});
			var Res = require("./lib/res.js");
			var res = new Res;
			res.init(isnode, {
				msgId: message.msgId,
				service: route.match.service,
				type: message.type,
				interface: message.interface,
				router: name
			});
			var responseListener = function(msg){
				log("debug","Router > Received response from controller. Message ID: " + message.msgId, message);
				isnode.module(message.type, "interface").get(message.interface).emit("outgoing."+message.msgId,msg);
				routers[name].removeListener('router.' + msg.msgId, responseListener);
			}
			routers[name].on('router.' + message.msgId, responseListener);
			var verbs = ["get", "post", "put", "delete", "update", "patch", "head", "options", "trace"];
			if(message.request.verb && controller && controller[verb] && verbs.includes(verb)) {
				controller[verb](req,res);
			} else {
				log("error","Router > Cannot pass control to controller because controller function cannot be found", message);
			}
		}
		var Route = function(hostname,url){
			var searchObj = {
				hostname: hostname,
				url: url,
				services: config.router.instances[name].services
			}
			return isnode.module("services").search(searchObj);
		}
		var ReturnError = function(msgObject,message,statusCode){
			var msg = {
				"type": msgObject.type,
				"interface": msgObject.interface,
				"msgId": msgObject.msgId,
				"sessionId": msgObject.sessionId,
				"state": "outgoing",
				"directional": msgObject.directional,
				"response": {
					"body": {"message":message},
					"message": message,
					"statusCode": statusCode
				}
			}	
			log("debug","Router > Sending message " + msgObject.msgId + " back to originating interface", msgObject);
			if(msgObject.sessionId)
				isnode.module(msgObject.type, "interface").get(msgObject.interface).emit("outgoing."+msgObject.sessionId,msg);
			else
				isnode.module(msgObject.type, "interface").get(msgObject.interface).emit("outgoing."+msgObject.msgId,msg);
			return;
		}
		routers[name].incoming = Incoming;
		routers[name].route = Route;
		return;
	}
660731
private boolean matchesPath(String routePath, String pathToMatch) {
		routePath = routePath.replaceAll(Path.VAR_REGEXP, Path.VAR_REPLACE);
		return pathToMatch.matches("(?i)" + routePath);
	}
1315367
function(route, rule) {
            if (rule == null) rule = "base";
            if (_.isString(rule)) rule = Urls[rule];
            route = rule(route);
            window.location.href = route;
        }
605773
function compareUrlRoute(currentURL, currentRoute) {
                var regex = /\{(.*)\}/i;
                var arraySize = currentRoute.length,
                    testValue = false;
                for (var i = 0; i < arraySize; i++) {
                    var dynamic = regex.exec(currentRoute[i]);
                    if (dynamic) {
                        document.routeParams[dynamic[1]] = currentURL[i];
                    } else {
                        if (currentRoute[i] === currentURL[i]) {
                            testValue = true;
                        }
                    }
                }

                return testValue;
            }
1176846
function (name) {
      var route = _containerOwner.getOwner(this).lookup('route:' + name);

      if (!route) {
        return {};
      }

      var transition = this.router.router.activeTransition;
      var state = transition ? transition.state : this.router.router.state;

      var params = {};
      _emberMetalAssign.default(params, state.params[name]);
      _emberMetalAssign.default(params, getQueryParamsFor(route, state));

      return params;
    }
659903
function() {
            if (this.started) {
                logging.warn("routing history already started");
                return false;
            }

            var self = this;
            var $window = $(window);
            var rootUrl = document.location.protocol+'//'+(document.location.hostname||document.location.host);

            logging.log("start routing history");
            $window.bind('hashchange', _.bind(this._handleCurrentState, this));

            var ret = this._handleCurrentState();
            this.started = true;

            return ret;
        }
1331569
function getRouteParams(route, params) {
  const routeParams = {}

  if (!route.path)
    return routeParams

  const paramNames = getParamNames(route.path)

  for (const p in params) {
    if (
      Object.prototype.hasOwnProperty.call(params, p) &&
      paramNames.indexOf(p) !== -1
    ) {
      routeParams[p] = params[p]
    }
  }

  return routeParams
}
996365
public static function check()
    {
        $route = isset($_GET['_framework_url_']) ? $_GET['_framework_url_'] : '';

        $out = config('maintenance.out', []);

        $out[] = config('panel.route', 'vinala');

        if (config('panel.setup', true)) {
            if (config('maintenance.enabled', false) && !in_array($route, $out)) {
                return static::$enabled = true;
            }
        }

        return static::$enabled = false;
    }
155280
function (routes) {
		var self = this;

	
		fs.readdirSync(this.middlewareBasePath()).filter(file => file.match(/\.js$/) || file.match(/\.coffee$/)).forEach(function (file) {
			var middlewareName = file.replace(/\.js$/, '').replace(/\.coffee$/, '');
			self.middlewares[middlewareName] = require(path.join(self.middlewareBasePath(), middlewareName));
		});


		for (var root in routes) {
			if (root && routes[root]) {
				for(var key in routes[root]) {
					var method = key.trim().split(' ')[0].toLowerCase();
					var routerMiddelware = routes[root][key];
					var endpoint;

					if (root == 'index') endpoint = ((key.trim().split(' ')[1].toLowerCase() != '/') ? key.trim().split(' ')[1].toLowerCase() : '/');
					else endpoint = '/' + root + ((key.trim().split(' ')[1].toLowerCase() != '/') ? key.trim().split(' ')[1].toLowerCase() : '');

					self.__endpoint__handler(method, endpoint, routerMiddelware);
				}
			}
		}
	}
1273328
public function actionCheckRoute()
    {
        $post = Yii::$app->request->post();
        if (empty($post['route'])) {
            $result = Yii::t($this->tcModule, 'Error in POST-ed data');
        } else {
            $ctrlLinkPrefix = empty($post['ctrlLinkPrefix']) ? null : $post['ctrlLinkPrefix'];

            $url = ContentMenuBuilder::routeToLink($post['route'], $ctrlLinkPrefix);

            if (Yii::$app instanceof UniApplication && Yii::$app->type == UniApplication::APP_TYPE_BACKEND) {
                // backend application don't have frontend-routes, $url is wrong
                $url = false;

                // if module-container (system-module) has ApplicationModel - it can get frontend application with correct routes
                $containerModule = $this->module->module;
                if ($containerModule instanceof UniModule && array_key_exists(static::$sysAppModel, $containerModule->models)) {
                    $appModel = $containerModule::model(static::$sysAppModel);
                    $appFront = $appModel::initFrontendApplication();
                    $url = ContentMenuBuilder::routeToLink($post['route'], $ctrlLinkPrefix);
                    $appModel::restoreApplication();
                }
            }

            if ($url) {
                $result = htmlspecialchars($url);
            } else {
                $result = Yii::t($this->tcModule, "Can't resolve route '{route}'", ['route' => $post['route']]);
                if (!empty(ContentMenuBuilder::$errorRouteConvert)) {
                    $result .= ', ERROR: ' . ContentMenuBuilder::$errorRouteConvert;
                }
            }
        }
        return $result;
    }
1327868
function HttpRoute(route) {
    if (typeof route === 'string') {
        this.route = { url:route };
    }
    else if (typeof route === 'object') {
        this.route = route;
    }
    this.routeData = { };

    this.patterns = {
        int:function() {
            return "^[1-9]([0-9]*)$";
        },
        boolean:function() {
            return "^true|false$"
        },
        decimal:function() {
            return "^[+-]?[0-9]*\\.?[0-9]*$";
        },
        float:function() {
            return "^[+-]?[0-9]*\\.?[0-9]*$";
        },
        guid:function() {
            return "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$";
        },
        plural: function() {
            return "^[a-zA-Z]+$";
        },
        string: function() {
            return "^'(.*)'$"
        },
        date:function() {
            return "^(datetime)?'\\d{4}-([0]\\d|1[0-2])-([0-2]\\d|3[01])(?:[T ](\\d+):(\\d+)(?::(\\d+)(?:\\.(\\d+))?)?)?(?:Z(-?\\d*))?([+-](\\d+):(\\d+))?'$";
        },
    };

    this.parsers = {
        int:function(v) {
            return parseInt(v);
        },
        boolean:function(v) {
            return (/^true$/ig.test(v));
        },
        decimal:function(v) {
            return parseFloat(v);
        },
        float:function(v) {
            return parseFloat(v);
        },
        plural:function(v) {
            return pluralize.singular(v);
        },
        string:function(v) {
            return v.replace(/^'/,'').replace(/'$/,'');
        },
        date:function(v) {
            return new Date(Date.parse(v.replace(/^(datetime)?'/,'').replace(/'$/,'')));
        }
    }

}
941574
function routeIsActive(pathname, routes, params, indexOnly) {
  // TODO: This is a bit ugly. It keeps around support for treating pathnames
  // without preceding slashes as absolute paths, but possibly also works
  // around the same quirks with basenames as in matchRoutes.
  if (pathname.charAt(0) !== '/') {
    pathname = `/${pathname}`
  }

  const i = getMatchingRouteIndex(pathname, routes, params)

  if (i === null) {
    // No match.
    return false
  } else if (!indexOnly) {
    // Any match is good enough.
    return true
  }

  // If any remaining routes past the match index have paths, then we can't
  // be on the index route.
  return routes.slice(i + 1).every(route => !route.path)
}
40283
function match(routes, path) {

  // Get the query object before it gets stripped by the normalizer
  const query = getQuery(path);
  const pathname = path;

  // Normalize the path
  path = normalizePath(path);

  // Loop over each route to find the match
  for (let i = 0; i < routes.length; i++) {

    // Normalize the current route
    const currentRoute = normalizePath(routes[i].route);

    // Create the params object
    const params = {};

    // Check if it's a straight match first
    if(currentRoute === path) {
      return Object.assign({}, routes[i], {params, query, pathname, path});
    }

    // If there are no dynamic/optional/match-all parts then this route cannot match
    if(!isDynamicRoute.test(routes[i].route)) {
      continue;
    }

    // Split up the route by it's slashes so that we may match by section
    const routeSections = currentRoute.split('/');
    const pathSections = path.split('/');

    // Loop over each section looking for a full match
    for (let j = routeSections.length - 1; j >= 0; j--) {

      // If the route is to match everything, then return
      if(j === 0 && routeSections[j] === '*') {
        return Object.assign({}, routes[i], {params, query, pathname, path});
      }

      // If this section is optional
      if(optionalSectionRegex.test(routeSections[j])) {

        const currentSection = routeSections[j].replace(removeOptionalRegex, '');

        // If it's a param, add it to the params
        if(paramRegex.test(currentSection)) {
          params[currentSection.replace(paramRegex, '')] = pathSections[j];
          continue;
        }

        // If it's a star then skip to next
        if(currentSection === '*') {
          continue;
        }

        // If the optional section can possible be missing skip to next section
        if(routeSections.length === pathSections.length + 1) {
          continue;
        }

        // If the path and route sections have same number of sections and this does match, skip to next
        if(routeSections.length === pathSections.length && currentSection === pathSections[j]) {
          continue;
        }

        // Reject this route as the possible match to the path
        break;
      }

      // If it's a param, add it to the params
      if(paramRegex.test(routeSections[j])) {
        params[routeSections[j].replace(paramRegex, '')] = pathSections[j];

        if(j === 0) {
          return Object.assign({}, routes[i], {params, query, pathname, path});
        }

        continue;
      }

      // If it's a star then skip to next
      if(routeSections[j] === '*') {
        continue;
      }

      // If this doesn't match then go to next route
      if(routeSections[j] !== pathSections[j]) {
        break;
      }

      // If the last item matches strictly then return that match
      if(j === 0 && routeSections[j] === pathSections[j]) {
        return Object.assign({}, routes[i], {params, query, pathname, path});
      }
    }
  }

  // No match found
  return {path: '', params: {}, query};
}
246565
function() {
			var baseUrl = context.getGlobal('location').pathname;

			routerService = context.getService('router');
			routerService.init([
				baseUrl,
				baseUrl + 'active',
				baseUrl + 'completed'
			]);
		}
502464
private boolean matchesPath(String routePath, String pathToMatch) {
        routePath = PathKit.VAR_REGEXP_PATTERN.matcher(routePath).replaceAll(PathKit.VAR_REPLACE);
        return pathToMatch.matches("(?i)" + routePath);
    }