const showHiddenBtnUtils = {

    showShowHiddenBtn: function showShowHiddenBtn() {
        log('showShowHiddenBtn: enter');

        const colJQ = $('#divColShowHidden');

        colJQ.addClass('column');
        colJQ.addClass('col-auto');

        colJQ.css('display', '');
        // show the button

        log('showShowHiddenBtn: leave');
    },

    hideShowHiddenBtn: function hideShowHiddenBtn() {
        log('hideShowHiddenBtn: enter');

        const colJQ = $('#divColShowHidden');

        colJQ.removeClass('column');
        colJQ.removeClass('col-auto');

        colJQ.css('display', 'none');

        log('hideShowHiddenBtn: leave');
    },

    showHiddenBtnVisible: function showHiddenBtnVisible() {
        log('showHiddenBtnVisible: enter');

        const visible = ($('#divColShowHidden').attr('display') !== 'none');
        // is the column visible?

        log('showHiddenBtnVisible: visible=' + visible);
        log('showHiddenBtnVisible: leave');

        return visible;
    },

    updateHiddenLensesBtn: function updateHiddenLensesBtn() {

        const logHeader = 'updateHiddenLensesBtn: ';

        log(logHeader + 'enter');

        const hiddenCount = lensesToHideStorageUtils.count();
        // how many lenses are hidden?

        if (hiddenCount < 1) {
            // if no hidden lenses

            showHiddenBtnUtils.hideShowHiddenBtn();
            // hide the show hidden lenses button
        }
        else {
            // if there is at least one hidden lens

            var theCaption = 'Show ' + hiddenCount + ' Hidden Lens';

            if (hiddenCount > 1)
                theCaption += "es";

            $('#btnShowHidden').text(theCaption);

            showHiddenBtnUtils.showShowHiddenBtn();
            // show the button
        }

        log(logHeader + 'leave');
    },

    handleShowHiddenBtnClickAsync: async function handleShowHiddenBtnClickAsync() {
        log('handleShowHiddenBtnClickAsync: enter');

        const beforeCount = lensesToHideStorageUtils.count();
        // get the number of hidden lenses

        log('handleShowHiddenBtnClick: beforeCount=' + beforeCount);

        lensesToHideStorageUtils.clear();
        // clear the stored list of lenses to hide

        const afterCount = lensesToHideStorageUtils.count();
        // get the number of hidden lenses

        log('handleShowHiddenBtnClick: afterCount=' + afterCount);

        // HIDDEN
        // update the show hidden message if it's visible

        await lensUIUtils.displayCurrentLensesAsync();
        // repopulate the page

        await await uiUtils.handleLensCountChangedAsync();

        log('handleShowHiddenBtnClick: leave');
    }
};