import * as React from 'react';
import { Redirect } from 'react-router';
import { APIConsole } from './api/APIConsole';
import { ResetPasswordPage } from './auth/ResetPasswordPage';
import { SignInPage } from './auth/SignInPage';
import { SignUpPage } from './auth/SignUpPage';
import { ErrorNotSupportedPage } from './components/ErrorNotSupportedPage';
import { DiscussionsPage } from './discussions/DiscussionsPage';
import { ExplorePage } from './explore/ExplorePage';
import { ExtensionsArea } from './extensions/ExtensionsArea';
import { SurveyPage } from './marketing/SurveyPage';
import { OpenPage } from './open/OpenPage';
import { OrgsArea } from './org/OrgsArea';
import { RepoContainer } from './repo/RepoContainer';
import { parseSearchURLQuery } from './search';
import { MainPage } from './search/input/MainPage';
import { ScopePage } from './search/input/ScopePage';
import { SearchPage } from './search/input/SearchPage';
import { SearchResults } from './search/results/SearchResults';
import { SavedQueriesPage } from './search/saved-queries/SavedQueries';
import { SiteAdminArea } from './site-admin/SiteAdminArea';
import { SiteInitPage } from './site-admin/SiteInitPage';
import { RedirectToUserPage } from './user/account/RedirectToUserPage';
import { RedirectToUserSettings } from './user/account/RedirectToUserSettings';
import { UserArea } from './user/area/UserArea';
import { canListAllRepositories } from './util/features';
/**
 * Holds properties for repository+ routes.
 */
export const repoRevRoute = {
    path: '/:repoRevAndRest+',
    render: props => React.createElement(RepoContainer, Object.assign({}, props)),
};
/**
 * Holds all top-level routes for the app because both the navbar and the main content area need to
 * switch over matched path.
 *
 * See https://reacttraining.com/react-router/web/example/sidebar
 */
export const routes = [
    {
        path: '/',
        render: (props) => window.context.sourcegraphDotComMode && !props.user ? React.createElement(Redirect, { to: "/start" }) : React.createElement(Redirect, { to: "/search" }),
        exact: true,
    },
    {
        path: '/start',
        render: (props) => React.createElement(MainPage, Object.assign({}, props)),
        exact: true,
    },
    {
        path: '/search',
        render: (props) => parseSearchURLQuery(props.location.search) ? React.createElement(SearchResults, Object.assign({}, props)) : React.createElement(SearchPage, Object.assign({}, props)),
        exact: true,
    },
    {
        path: '/search/searches',
        render: props => React.createElement(SavedQueriesPage, Object.assign({}, props)),
        exact: true,
        forceNarrowWidth: true,
    },
    {
        path: '/open',
        render: props => React.createElement(OpenPage, Object.assign({}, props)),
        exact: true,
        forceNarrowWidth: true,
    },
    {
        path: '/sign-in',
        render: props => React.createElement(SignInPage, Object.assign({}, props)),
        exact: true,
        forceNarrowWidth: true,
    },
    {
        path: '/sign-up',
        render: props => React.createElement(SignUpPage, Object.assign({}, props)),
        exact: true,
        forceNarrowWidth: true,
    },
    {
        path: '/settings',
        render: props => React.createElement(RedirectToUserSettings, Object.assign({}, props)),
    },
    {
        path: '/user',
        render: props => React.createElement(RedirectToUserPage, Object.assign({}, props)),
    },
    {
        path: '/organizations',
        render: props => React.createElement(OrgsArea, Object.assign({}, props)),
    },
    {
        path: '/search',
        render: props => React.createElement(SearchResults, Object.assign({}, props)),
        exact: true,
    },
    {
        path: '/site-admin/init',
        exact: true,
        render: props => React.createElement(SiteInitPage, Object.assign({}, props)),
        forceNarrowWidth: false,
    },
    {
        path: '/site-admin',
        render: props => (React.createElement(SiteAdminArea, Object.assign({}, props, { routes: props.siteAdminAreaRoutes, sideBarGroups: props.siteAdminSideBarGroups, overviewComponents: props.siteAdminOverviewComponents }))),
    },
    {
        path: '/password-reset',
        render: props => React.createElement(ResetPasswordPage, Object.assign({}, props)),
        exact: true,
        forceNarrowWidth: true,
    },
    {
        path: '/explore',
        render: props => (canListAllRepositories ? React.createElement(ExplorePage, Object.assign({}, props)) : React.createElement(ErrorNotSupportedPage, null)),
        exact: true,
    },
    {
        path: '/discussions',
        render: props => React.createElement(DiscussionsPage, Object.assign({}, props)),
        exact: true,
    },
    {
        path: '/search/scope/:id',
        render: props => React.createElement(ScopePage, Object.assign({}, props)),
        exact: true,
    },
    {
        path: '/api/console',
        render: props => React.createElement(APIConsole, Object.assign({}, props)),
        exact: true,
    },
    {
        path: '/users/:username',
        render: props => React.createElement(UserArea, Object.assign({}, props)),
    },
    {
        path: '/survey/:score?',
        render: props => React.createElement(SurveyPage, Object.assign({}, props)),
    },
    {
        path: '/extensions',
        render: props => React.createElement(ExtensionsArea, Object.assign({}, props, { routes: props.extensionsAreaRoutes })),
    },
    repoRevRoute,
];
//# sourceMappingURL=routes.js.map