function resolveMatchingConfig (regularPath, config) {
  if (Array.isArray(config)) {
    return {
      base: '/',
      config: config
    }
  }
  for (const base in config) {
    if (ensureEndingSlash(regularPath).indexOf(encodeURI(base)) === 0) {
      return {
        base,
        config: config[base]
      }
    }
  }
  return {}
}
@param { Route } route
@param { Array<string|string[]> | Array<SidebarGroup> | [link: string]: SidebarConfig } config
@returns { base: string, config: SidebarConfig }