// (C) 2020-2026 GoodData Corporation
import { call } from "redux-saga/effects";
import { areObjRefsEqual } from "@gooddata/sdk-model";
import { isDrillIntersectionAttributeItem, } from "@gooddata/sdk-ui";
import { getElementTitle } from "./getElementTitle.js";
function getDrillToAttributeUrlIntersectionAttributeItemHeader(drillConfig, event) {
    return event.drillContext.intersection.find((item) => isDrillIntersectionAttributeItem(item.header) &&
        areObjRefsEqual(item.header.attributeHeader.ref, drillConfig.target.displayForm))?.header;
}
export function* resolveDrillToAttributeUrl(drillConfig, event, ctx) {
    const header = getDrillToAttributeUrlIntersectionAttributeItemHeader(drillConfig, event);
    if (!header) {
        return;
    }
    const url = yield call(getElementTitle, ctx.workspace, drillConfig.target.hyperlinkDisplayForm, header.attributeHeaderItem.uri, ctx);
    return url;
}
//# sourceMappingURL=resolveDrillToAttributeUrl.js.map