import 'somes';
import * as React from 'react';
import CMSPage, { CMSDataPage } from './page';
import './util.css';
const jq = require('jquery');
const raphael = require('raphael');
const glob = globalThis;
glob.jQuery = glob.$ = jq;
glob.Raphael = raphael;
require('./_ext');
require('cport-nifty/css/bootstrap.min.css');
require('cport-nifty/js/bootstrap.js');
require('cport-nifty/plugins/font-awesome/css/font-awesome.min.css');
require('cport-nifty/css/nifty.min.css');
require('cport-nifty/plugins/magic-check/css/magic-check.css');
require('cport-nifty/plugins/pace/pace.css');
require('cport-nifty/plugins/pace/pace.js');
require('cport-nifty/plugins/morris-js/morris.css');
require('cport-nifty/plugins/morris-js/morris.js');
import { Router as MyRouter, Root } from '../lib';
import { Router, Route, Switch } from 'react-router-dom';
import Menu from './menu';
import Login from './login';
import Header from './header';
import Footer from './footer';
import NotFound from './404';
export * from '../lib';
export { CMSPage, CMSDataPage, Header, Footer, Menu, Login };
export class CMSRoot extends Root {
    constructor(props) {
        super(props);
        this.history.listen(() => {
            if (this.state.__is_404) {
                this._no404();
            }
        });
    }
    render() {
        var _NotFound = this.props.notFound || NotFound;
        return (this.isLoaded ?
            this.state.__is_404 ? React.createElement(_NotFound, null) :
                React.createElement(Router, { history: this.history },
                    React.createElement(Switch, null,
                        React.createElement(Route, { path: "/login" }, this.login()),
                        React.createElement(Route, { path: "/404" },
                            React.createElement(_NotFound, null)),
                        React.createElement(Route, { path: "/" },
                            React.createElement("div", { id: "container", className: "effect aside-float aside-bright mainnav-lg" },
                                this.header(),
                                this.menu(),
                                React.createElement(MyRouter, { ref: "router", notFound: _NotFound, routes: this.props.routes }),
                                this.footer(),
                                React.createElement("button", { className: "scroll-top btn" },
                                    React.createElement("i", { className: "pci-chevron chevron-up" }))))))
            :
                React.createElement("div", { className: "init-loading" }, "Loading.."));
    }
    _404() {
        this.setState({ __is_404: true });
    }
    _no404() {
        this.setState({ __is_404: false });
    }
    login() {
        return this.props.login;
    }
    menu() {
        return this.props.menu;
    }
    header() {
        return this.props.header;
    }
    footer() {
        return this.props.footer;
    }
}
