export function directAggregateContainsFormulaOwnerCell(serviceArgs, directAggregate, cellIndex, ownerPosition) {
    if (!directAggregate) {
        return false;
    }
    const ownerSheetId = serviceArgs.state.workbook.cellStore.sheetIds[cellIndex];
    const aggregateSheet = serviceArgs.state.workbook.getSheet(directAggregate.sheetName);
    if (ownerSheetId === undefined || !aggregateSheet || aggregateSheet.id !== ownerSheetId) {
        return false;
    }
    const resolvedOwnerPosition = ownerPosition ?? serviceArgs.state.workbook.getCellPosition(cellIndex);
    return (resolvedOwnerPosition !== undefined &&
        resolvedOwnerPosition.row >= directAggregate.rowStart &&
        resolvedOwnerPosition.row <= directAggregate.rowEnd &&
        resolvedOwnerPosition.col >= directAggregate.col &&
        resolvedOwnerPosition.col <= directAggregate.colEnd);
}
//# sourceMappingURL=formula-binding-direct-aggregate-owner.js.map