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_react_router_dom__ from "react-router-dom";
import * as __WEBPACK_EXTERNAL_MODULE__document_title_index_mjs__ from "../document-title/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__PageStyle_provider_mjs__ from "./PageStyle.provider.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__usePageStyle_mjs__ from "./usePageStyle.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: none;\n            "
    ]);
    _templateObject = function() {
        return data;
    };
    return data;
}
const TabContentInternal = (param)=>{
    let { items, activeKey } = param;
    return items.map((item)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
            className: activeKey !== item.key ? (0, __WEBPACK_EXTERNAL_MODULE__emotion_css__.css)(_templateObject()) : '',
            children: item.children
        }, item.key));
};
const TabContent = ()=>{
    const { title, setTitle } = (0, __WEBPACK_EXTERNAL_MODULE__document_title_index_mjs__.useDocumentTitle)();
    const location = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useLocation)();
    const { items, setItems } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__PageStyle_provider_mjs__.PageStyleContext);
    const targetKey = location.pathname;
    const outlet = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useOutlet)();
    (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
        if (targetKey && title) {
            const targetItem = items.find((value)=>value.key === targetKey);
            if (targetItem) setTitle(targetItem.label);
            else setItems([
                ...items,
                {
                    key: targetKey,
                    label: title,
                    children: outlet
                }
            ]);
        }
    }, [
        targetKey,
        title
    ]);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabContentInternal, {
        items: items,
        activeKey: targetKey
    });
};
const CustomAdminContent = ()=>{
    const params = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useParams)();
    const pageStyle = (0, __WEBPACK_EXTERNAL_MODULE__usePageStyle_mjs__.usePageStyle)();
    return params.name && 'tab' === pageStyle ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabContent, {}) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Outlet, {});
};
export { CustomAdminContent, TabContent, TabContentInternal };
