import { Fragment, jsxs } from "react/jsx-runtime";
import { useMemo } from "react";
import { useCollectionRecordData, useDataSourceManager } from "../../data-source/index.mjs";
import { useCompile } from "../../schema-component/index.mjs";
const CollectionTitle = ()=>{
    const { dataSourceKey = 'main', collectionName } = useCollectionRecordData();
    const dataSourceManager = useDataSourceManager();
    const compile = useCompile();
    const [title1, title2] = useMemo(()=>{
        const dataSource = dataSourceManager.getDataSource(dataSourceKey);
        if (dataSource) {
            const collection = dataSource.collectionManager.getCollection(collectionName);
            return [
                dataSource.displayName,
                (null == collection ? void 0 : collection.title) || collectionName
            ];
        }
        return [
            dataSourceKey,
            null
        ];
    }, [
        dataSourceManager,
        dataSourceKey,
        collectionName
    ]);
    return /*#__PURE__*/ jsxs(Fragment, {
        children: [
            compile(title1),
            " ",
            '>',
            " ",
            compile(title2)
        ]
    });
};
export { CollectionTitle };
