(function ($) {
    "use strict";
    $(document).ready(function () {
        //CUSTOM FIELD
        const $layoutSelect = $('select[name="page_sidebar_layout"]');
        const $sidebarField = $('.page_sidebar');
        function toggleSidebarField() {
           const layoutVal = $layoutSelect.val();
           const isFull = layoutVal === 'full';
           $sidebarField.toggle(!isFull);
        }
        if ( $layoutSelect.length && $sidebarField.length) {
           toggleSidebarField();
           $layoutSelect.on('change', toggleSidebarField);
        }
    });

})(jQuery);
