import { jsx } from "react/jsx-runtime";
import "react";
import { useParams } from "react-router-dom";
import { AppNotFound } from "../index.mjs";
import { DataBlockProvider } from "../../data-source/index.mjs";
import { RecordContext_deprecated } from "../../record-provider/index.mjs";
import { RemoteSchemaComponent } from "../../schema-component/index.mjs";
import { PathHandler } from "./utils.mjs";
const DynamicPage = ()=>{
    const params = useParams();
    if (!params['*']) return /*#__PURE__*/ jsx(RemoteSchemaComponent, {
        uid: params.name,
        onlyRenderProperties: true
    });
    {
        const path = PathHandler.getInstance().parse(params['*'], params.name);
        if (!path) return /*#__PURE__*/ jsx(AppNotFound, {});
        return /*#__PURE__*/ jsx(DataBlockProvider, {
            params: {
                filterByTk: path.filterByTk
            },
            action: "get",
            collection: path.collection,
            children: /*#__PURE__*/ jsx(RecordContext_deprecated.Provider, {
                value: {
                    id: path.filterByTk
                },
                children: /*#__PURE__*/ jsx(RemoteSchemaComponent, {
                    uid: params.name,
                    onlyRenderProperties: true
                })
            })
        });
    }
};
export { DynamicPage };
