!function(a){"use strict";a(document).ready((function(){a(document).on("click",".nexa-loadmore-btn",(function(){const e=a(this),t=e.closest(".wp-block-nexa-post-list"),o=t.find(".nexa-posts-container"),n=t.data("block-id"),s=parseInt(e.data("page")),d=parseInt(e.data("max-pages")),c=e.data("args");e.prop("disabled",!0),a.ajax({url:nexaGLocalize?.ajax_url,type:"POST",data:{action:"nexa_load_more_posts",page:s+1,args:c,block_id:n,nonce:nexaGLocalize.nonce},success:function(a){a.success?(o.append(a.data.html),e.data("page",s+1),e.prop("disabled",!1),e.text("Load More"),s+1>=d&&e.hide()):(e.text("No more posts"),setTimeout((function(){e.text("Load More"),e.prop("disabled",!1)}),2e3))},error:function(){e.text("Error. Try again"),setTimeout((function(){e.text("Load More"),e.prop("disabled",!1)}),2e3)}})}))}))}(jQuery);