jQuery(document).ready(function(){function o(t,n){var o,s=vgse_editor_settings.final_spreadsheet_columns_settings[t].title,i=prompt(vgse_editor_settings.texts.enter_column_name,s);if(i&&i!==s){vgse_editor_settings.final_spreadsheet_columns_settings[t].title=i,jQuery.post(vgse_global_data.ajax_url,{action:"vgse_rename_column",nonce:vgse_global_data.nonce,post_type:jQuery('.modal-columns-visibility input[name="wpsecv_post_type"]').val(),column_key:t,new_title:i},function(e){e.success?notification({mensaje:vgse_editor_settings.texts.column_title_saved}):notification({mensaje:vgse_editor_settings.texts.column_title_not_saved,tipo:"error",tiempo:6e4})}),"undefined"!=typeof hot&&(s=hot.propToCol(t),(o=hot.getSettings().colHeaders)[s]=i,hot.updateSettings({colHeaders:o}));let e=Alpine.$data(document.querySelector('[x-data="vgseColumnsManager"]'));void 0!==e.prepared_columns[t]&&(e.prepared_columns[t].title=i,e.$nextTick(()=>e.renderVirtualLists())),"function"==typeof n&&n()}}if(jQuery("body").on("click",".modal-columns-visibility .rename-column",function(e){return e.preventDefault(),o(jQuery(this).parent().data("column-key")),!1}),"undefined"==typeof hot||!jQuery(".modal-columns-visibility").length)return!0;var e=hot.getSettings().contextMenu;void 0===e.items&&(e.items={}),e.items.wpse_rename_column={name:vgse_editor_settings.texts.enter_column_name,hidden:function(){var e;return!hot.getSelected()||(e=hot.colToProp(hot.getSelected()[0][1]),(e=vgse_editor_settings.final_spreadsheet_columns_settings[e])&&!e.allow_to_rename)},callback:function(e,t,n){o(hot.colToProp(t[0].start.col))}},hot.updateSettings({contextMenu:e})});