jQuery(document).ready(function(){jQuery(".wpse-duplicate-trigger").click(function(e){e.preventDefault();var t=jQuery(this).parents(".remodal");if(!t.find('[name="duplicate_this"]').val())return t.find('[name="duplicate_this"]')[0].reportValidity(),!0;window.wpseAddRowExtraData=t.find("input,select,textarea").serialize(),jQuery(".vg-toolbar .add_rows-container .number_rows").val(t.find('[name="number_of_copies"]').val()),jQuery("#addrow").click(),t.find('[name="number_of_copies"], select').val("").trigger("change"),t.remodal().close()}),jQuery('input[name="number_of_copies"]').change(function(e){75<parseInt(jQuery(this).val())&&jQuery(".remodal-duplicate .posts-templates-small-batches-message").show()}),jQuery("body").on("vgSheetEditor:afterNewRowsInsert",function(){"undefined"!=typeof wpseAddRowExtraData&&-1<wpseAddRowExtraData.indexOf("duplicate:")&&(wpseAddRowExtraData=null)})}),jQuery(document).ready(function(){if("undefined"==typeof hot||!jQuery(".remodal-duplicate").length)return!0;var e=hot.getSettings().contextMenu;void 0===e.items&&(e.items={}),e.items.wpse_duplicate_row={name:vgse_editor_settings.texts.duplicate_row,callback:function(e,t,a){if(beGetModifiedItems().length)alert(vgse_editor_settings.texts.save_changes_before_we_reload);else{var r=parseInt(hot.getDataAtRowProp(t[0].start.row,"ID")),n=hot.getDataAtRowProp(t[0].start.row,"post_title")||r,o=jQuery('.remodal-duplicate [name="duplicate_this"]'),i="product--"+r;o.append('<option value="'+i+'">'+n+"</option>"),o.val(i).trigger("change"),jQuery(".duplicate-container  button").click()}}},hot.updateSettings({contextMenu:e})});