import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__emotion_css__ from "@emotion/css";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
import * as __WEBPACK_EXTERNAL_MODULE_react_router__ from "react-router";
import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom__ from "react-router-dom";
import * as __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__ from "../../api-client/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__built_in_admin_layout_index_mjs__ from "../../built-in/admin-layout/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__built_in_pinned_list_index_mjs__ from "../../built-in/pinned-list/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__built_in_system_settings_index_mjs__ from "../../built-in/system-settings/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__user_index_mjs__ from "../../user/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../hooks/index.mjs";
function _tagged_template_literal(strings, raw) {
    if (!raw) raw = strings.slice(0);
    return Object.freeze(Object.defineProperties(strings, {
        raw: {
            value: Object.freeze(raw)
        }
    }));
}
function _templateObject() {
    const data = _tagged_template_literal([
        "\n          display: flex;\n          flex-direction: column;\n          position: relative;\n          overflow-y: auto;\n          > div {\n            position: relative;\n          }\n          .ant-layout-footer {\n            position: absolute;\n            bottom: 0;\n            text-align: center;\n            width: 100%;\n            z-index: 0;\n            padding: 0px 50px;\n          }\n        "
    ]);
    _templateObject = function() {
        return data;
    };
    return data;
}
function useShareToken() {
    const url = new URL(window.location.href);
    const api = (0, __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__.useAPIClient)();
    const token = url.searchParams.get('token');
    return token && api.auth.setToken(token), api.auth.getToken();
}
const ShareLayout = ()=>{
    var _result_data_data_logo, _result_data_data, _result_data, _result_data_data1, _result_data1;
    const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_admin_layout_index_mjs__.useStyles)();
    const app = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useApp)();
    const result = (0, __WEBPACK_EXTERNAL_MODULE__built_in_system_settings_index_mjs__.useSystemSettings)();
    const sideMenuRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Layout, {
        style: {
            height: '100%'
        },
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_antd__.Layout.Content, {
            className: (0, __WEBPACK_EXTERNAL_MODULE__emotion_css__.css)(_templateObject()),
            children: [
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Layout.Header, {
                    className: styles.header,
                    children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
                        className: styles.headerA,
                        children: [
                            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
                                className: styles.headerB,
                                children: [
                                    /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
                                        className: styles.titleContainer,
                                        onClick: ()=>{
                                            location.href = app.adminUrl;
                                        },
                                        children: [
                                            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("img", {
                                                className: styles.logo,
                                                src: null == result ? void 0 : null === (_result_data = result.data) || void 0 === _result_data ? void 0 : null === (_result_data_data = _result_data.data) || void 0 === _result_data_data ? void 0 : null === (_result_data_data_logo = _result_data_data.logo) || void 0 === _result_data_data_logo ? void 0 : _result_data_data_logo.url
                                            }),
                                            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("h1", {
                                                className: styles.title,
                                                children: null == result ? void 0 : null === (_result_data1 = result.data) || void 0 === _result_data1 ? void 0 : null === (_result_data_data1 = _result_data1.data) || void 0 === _result_data_data1 ? void 0 : _result_data_data1.title
                                            })
                                        ]
                                    }),
                                    /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__built_in_admin_layout_index_mjs__.MenuEditor, {
                                        sideMenuRef: sideMenuRef
                                    }),
                                    /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
                                        className: styles.headerTabs,
                                        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__built_in_admin_layout_index_mjs__.AdminTabs, {})
                                    })
                                ]
                            }),
                            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
                                className: styles.right,
                                children: [
                                    /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__built_in_pinned_list_index_mjs__.PinnedPluginList, {
                                        belongToFilter: "pinnedmenu"
                                    }),
                                    /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__user_index_mjs__.CurrentUser, {})
                                ]
                            })
                        ]
                    })
                }),
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Outlet, {})
            ]
        })
    });
};
const SharePage = ()=>{
    const shareToken = useShareToken();
    return shareToken ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__built_in_admin_layout_index_mjs__.AdminProvider, {
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(ShareLayout, {})
    }) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(NotAuthorityResult, {});
};
function NotAuthorityResult() {
    const { pathname, search } = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useLocation)();
    const redirect = "?redirect=".concat(pathname).concat(search);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router__.Navigate, {
        replace: true,
        to: "/signin".concat(redirect)
    });
}
export { NotAuthorityResult, ShareLayout, SharePage, useShareToken };
