import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE__block_provider_BlockProvider_mjs__ from "../../../../block-provider/BlockProvider.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__ from "../../../../collection-manager/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__record_provider_index_mjs__ from "../../../../record-provider/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../../hooks/index.mjs";
const useGetAriaLabelOfAction = (title)=>{
    const record = (0, __WEBPACK_EXTERNAL_MODULE__record_provider_index_mjs__.useRecord)();
    const recordIndex = (0, __WEBPACK_EXTERNAL_MODULE__record_provider_index_mjs__.useRecordIndex)();
    const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
    const compile = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCompile)();
    const component = fieldSchema['x-component'];
    let recordName = (null == record ? void 0 : record.name) || (null == record ? void 0 : record.title) || (null != recordIndex ? String(recordIndex) : '');
    let action = fieldSchema['x-action'];
    let { name: collectionName } = (0, __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__.useCollection_deprecated)();
    let { name: blockName } = (0, __WEBPACK_EXTERNAL_MODULE__block_provider_BlockProvider_mjs__.useBlockContext)() || {};
    const actionTitle = title || compile(fieldSchema.title);
    collectionName = collectionName ? "-".concat(collectionName) : '';
    blockName = blockName ? "-".concat(blockName) : '';
    action = action ? "-".concat(action) : '';
    recordName = recordName ? "-".concat(recordName) : '';
    const getAriaLabel = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((postfix)=>{
        postfix = postfix ? "-".concat(postfix) : '';
        return "action-".concat(component, "-").concat(actionTitle).concat(action).concat(collectionName).concat(blockName).concat(recordName).concat(postfix);
    }, [
        action,
        actionTitle,
        blockName,
        collectionName,
        component,
        recordName
    ]);
    return {
        getAriaLabel
    };
};
export { useGetAriaLabelOfAction };
