(()=>{var e={1669:e=>{"use strict";e.exports=jQuery}},o={};function n(t){var d=o[t];if(void 0!==d)return d.exports;var i=o[t]={exports:{}};return e[t](i,i.exports,n),i.exports}var t=n(1669),d=n(1669);const i={init:function(){this.enter_key(),this.add_note(),this.remove_note()},enter_key:function(){t(document.body).on("keydown","#edd-note",(function(e){13===e.keyCode&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t("#edd-add-note").click())}))},add_note:function(){t("#edd-add-note").on("click",(function(e){e.preventDefault();const o=t(this),n=t("#edd-note"),d=t(".edd-notes"),i=t(".edd-no-notes"),s=t(".edd-add-note .spinner"),c={action:"edd_add_note",nonce:t("#edd_note_nonce").val(),object_id:o.data("object-id"),object_type:o.data("object-type"),note:n.val()};if(c.note)o.prop("disabled",!0),s.css("visibility","visible"),t.ajax({type:"POST",data:c,url:ajaxurl,success:function(e){let t=wpAjax.parseAjaxResponse(e);t=t.responses[0],d.append(t.data),i.hide(),o.prop("disabled",!1),s.css("visibility","hidden"),n.val("")}}).fail((function(e){window.console&&window.console.log&&console.log(e),o.prop("disabled",!1),s.css("visibility","hidden")}));else{const e=n.css("border-color");n.css("border-color","red"),setTimeout((function(){n.css("border-color",e)}),userInteractionInterval)}}))},remove_note:function(){t(document.body).on("click",".edd-delete-note",(function(e){e.preventDefault();const o=t(this),n=t(".edd-note"),d=o.parents(".edd-note"),i=t(".edd-no-notes"),s=t("#edd_note_nonce");if(confirm(edd_vars.delete_note)){const e={action:"edd_delete_note",nonce:s.val(),note_id:o.data("note-id")};return d.addClass("deleting"),t.ajax({type:"POST",data:e,url:ajaxurl,success:function(e){return"1"===e&&d.remove(),1===n.length&&i.show(),!1}}).fail((function(e){window.console&&window.console.log&&console.log(e),d.removeClass("deleting")})),!0}}))}};d(document).ready((function(e){i.init()}))})();