export async function selectFeedbackComment(comment, editContext, fieldsContext) {
    const currentPageId = editContext?.currentItemDescriptor?.id;
    if (currentPageId &&
        comment.mainItemId &&
        comment.mainItemId !== currentPageId) {
        await editContext?.loadItem({
            id: comment.mainItemId,
            language: comment.language,
            version: comment.version,
        });
    }
    editContext?.setSelectedComment(comment);
    editContext?.setScrollIntoView(comment.itemId);
    if (!editContext?.isMobile) {
        editContext?.select([comment.itemId]);
        if (comment.fieldId) {
            fieldsContext?.setFocusedField({
                fieldId: comment.fieldId,
                item: {
                    id: comment.itemId,
                    language: comment.language,
                    version: comment.version,
                },
            }, false);
            const iframe = editContext?.getActiveSlotContext?.()?.primaryPageViewContext
                ?.editorIframe;
            const fieldElement = iframe?.contentDocument?.querySelector(`[data-fieldid="${comment.fieldId}"][data-itemid="${comment.itemId}"]`);
            if (!fieldElement) {
                const slotId = editContext?.activeSlotId ?? null;
                if (editContext?.isEditorFormHiddenForSlot(slotId)) {
                    editContext.setEditorFormHiddenForSlot(slotId, false);
                }
            }
        }
    }
}
//# sourceMappingURL=feedbackSelection.js.map