import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__components_index_mjs__ from "../components/index.mjs";
function normalizeContainer(container) {
    if (!container) {
        console.warn("Failed to mount app: mount target should not be null or undefined.");
        return null;
    }
    if ('string' == typeof container) {
        const res = document.querySelector(container);
        if (!res) console.warn('Failed to mount app: mount target selector "'.concat(container, '" returned null.'));
        return res;
    }
    if (window.ShadowRoot && container instanceof window.ShadowRoot && 'closed' === container.mode) console.warn('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs');
    return container;
}
const compose = function() {
    for(var _len = arguments.length, components = new Array(_len), _key = 0; _key < _len; _key++)components[_key] = arguments[_key];
    const Component = components.reduce((Parent, child)=>{
        const [Child, childProps] = child;
        const ComposeComponent = (param)=>{
            let { children } = param;
            return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Parent, {
                children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Child, {
                    ...childProps,
                    children: children
                })
            });
        };
        ComposeComponent.displayName = "compose(".concat(Child.displayName || Child.name, ")");
        return ComposeComponent;
    }, __WEBPACK_EXTERNAL_MODULE__components_index_mjs__.BlankComponent);
    return (LastChild)=>(props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Component, {
                children: LastChild && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(LastChild, {
                    ...props
                })
            });
};
export { compose, normalizeContainer };
