import Vue from 'vue'
import Router from 'vue-router'
import { normalizeURL, decode } from 'ufo'
import { interopDefault } from './utils'
import scrollBehavior from './router.scrollBehavior.js'

const _647eb306 = () => interopDefault(import('..\\pages\\authenticate\\index.vue' /* webpackChunkName: "pages/authenticate/index" */))
const _085a1188 = () => interopDefault(import('..\\pages\\explore.vue' /* webpackChunkName: "pages/explore" */))
const _5c274378 = () => interopDefault(import('..\\pages\\install.vue' /* webpackChunkName: "pages/install" */))
const _1a2394c2 = () => interopDefault(import('..\\pages\\project.vue' /* webpackChunkName: "pages/project" */))
const _f804a068 = () => interopDefault(import('..\\pages\\project\\_pid\\calendar.vue' /* webpackChunkName: "pages/project/_pid/calendar" */))
const _cc627676 = () => interopDefault(import('..\\pages\\project\\_pid\\kanban.vue' /* webpackChunkName: "pages/project/_pid/kanban" */))
const _3f2e0c87 = () => interopDefault(import('..\\pages\\project\\_pid\\overview.vue' /* webpackChunkName: "pages/project/_pid/overview" */))
const _8e47139e = () => interopDefault(import('..\\pages\\project\\_pid\\settings.vue' /* webpackChunkName: "pages/project/_pid/settings" */))
const _15adf6f2 = () => interopDefault(import('..\\pages\\project\\_pid\\settings\\general.vue' /* webpackChunkName: "pages/project/_pid/settings/general" */))
const _8eea596a = () => interopDefault(import('..\\pages\\project\\_pid\\settings\\information.vue' /* webpackChunkName: "pages/project/_pid/settings/information" */))
const _14514438 = () => interopDefault(import('..\\pages\\project\\_pid\\settings\\members.vue' /* webpackChunkName: "pages/project/_pid/settings/members" */))
const _4f890c20 = () => interopDefault(import('..\\pages\\project\\_pid\\tasks.vue' /* webpackChunkName: "pages/project/_pid/tasks" */))
const _275ffbeb = () => interopDefault(import('..\\pages\\project\\_pid\\whiteboard.vue' /* webpackChunkName: "pages/project/_pid/whiteboard" */))
const _55a52402 = () => interopDefault(import('..\\pages\\authenticate\\completed.vue' /* webpackChunkName: "pages/authenticate/completed" */))
const _4e658744 = () => interopDefault(import('..\\pages\\authenticate\\verified.vue' /* webpackChunkName: "pages/authenticate/verified" */))
const _26769e3b = () => interopDefault(import('..\\pages\\index.vue' /* webpackChunkName: "pages/index" */))

const emptyFn = () => {}

Vue.use(Router)

export const routerOptions = {
  mode: 'history',
  base: '/',
  linkActiveClass: 'nuxt-link-active',
  linkExactActiveClass: 'nuxt-link-exact-active',
  scrollBehavior,

  routes: [{
    path: "/authenticate",
    component: _647eb306,
    name: "authenticate"
  }, {
    path: "/explore",
    component: _085a1188,
    name: "explore"
  }, {
    path: "/install",
    component: _5c274378,
    name: "install"
  }, {
    path: "/project",
    component: _1a2394c2,
    name: "project",
    children: [{
      path: ":pid?/calendar",
      component: _f804a068,
      name: "project-pid-calendar"
    }, {
      path: ":pid?/kanban",
      component: _cc627676,
      name: "project-pid-kanban"
    }, {
      path: ":pid?/overview",
      component: _3f2e0c87,
      name: "project-pid-overview"
    }, {
      path: ":pid?/settings",
      component: _8e47139e,
      name: "project-pid-settings",
      children: [{
        path: "general",
        component: _15adf6f2,
        name: "project-pid-settings-general"
      }, {
        path: "information",
        component: _8eea596a,
        name: "project-pid-settings-information"
      }, {
        path: "members",
        component: _14514438,
        name: "project-pid-settings-members"
      }]
    }, {
      path: ":pid?/tasks",
      component: _4f890c20,
      name: "project-pid-tasks"
    }, {
      path: ":pid?/whiteboard",
      component: _275ffbeb,
      name: "project-pid-whiteboard"
    }]
  }, {
    path: "/authenticate/completed",
    component: _55a52402,
    name: "authenticate-completed"
  }, {
    path: "/authenticate/verified",
    component: _4e658744,
    name: "authenticate-verified"
  }, {
    path: "/",
    component: _26769e3b,
    name: "index"
  }],

  fallback: false
}

export function createRouter (ssrContext, config) {
  const base = (config._app && config._app.basePath) || routerOptions.base
  const router = new Router({ ...routerOptions, base  })

  // TODO: remove in Nuxt 3
  const originalPush = router.push
  router.push = function push (location, onComplete = emptyFn, onAbort) {
    return originalPush.call(this, location, onComplete, onAbort)
  }

  const resolve = router.resolve.bind(router)
  router.resolve = (to, current, append) => {
    if (typeof to === 'string') {
      to = normalizeURL(to)
    }
    return resolve(to, current, append)
  }

  return router
}
