$((function(){var e=!1,o="",n=function(e,o,n){var t=new Date;t.setDate(t.getDate()+n),o=encodeURIComponent(o)+(null==n?"":"; expires="+t.toUTCString()),document.cookie="fob-comment-".concat(e,"=").concat(o,"; path=/")},t=function(e){var o=document.cookie.match(new RegExp("(^| )fob-comment-".concat(e,"=([^;]*)(;|$)")));return null!=o?decodeURIComponent(o[2]):null},c=function(e){document.cookie="fob-comment-".concat(e,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/")};$(document).find(".fob-comment-form input").each((function(e,o){var n=$(o).prop("name");t(n)&&("cookie_consent"===n?$(o).prop("checked",!0):$(o).val($(o).val()||t(n)))}));var m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fobComment.listUrl;$.ajax({url:e,type:"GET",dataType:"json",success:function(e){var o,n=e.error,t=e.data,c=e.message;if(void 0!==(null===(o=window)||void 0===o?void 0:o.Theme)&&n)Theme.showError(c);else{var m=t.title,i=t.html,a=t.comments,r=$(document).find(".fob-comment-list-section");a.total<1?r.hide():(r.show(),$(document).find(".fob-comment-list-title").text(m),$(document).find(".fob-comment-list-wrapper").html(i))}}})};$(document).on("submit",".fob-comment-form",(function(t){if(t.stopPropagation(),t.preventDefault(),void 0===$.fn.validate||$(".fob-comment-form").valid()){var i=$(t.currentTarget),a=new FormData(i[0]),r=i.find('input[type="checkbox"][name="cookie_consent"]'),f=r.length>0&&r.is(":checked");$.ajax({url:i.prop("action"),type:"POST",data:a,processData:!1,contentType:!1,dataType:"json",success:function(t){var r,l=t.error,d=t.message;if(void 0!==(null===(r=window)||void 0===r?void 0:r.Theme)){if(l)return void Theme.showError(d);Theme.showSuccess(d)}f?(n("name",a.get("name"),365),n("email",a.get("email"),365),n("website",a.get("website"),365),n("cookie_consent",1,365),i.find('textarea[name="content"]').val("")):(i[0].reset(),c("name"),c("email"),c("website"),c("cookie_consent")),m(),e&&(e=!1,$(document).find(".fob-comment-form-section").remove(o),$(document).find(".fob-comment-list-section").after(o))},error:function(e){var o;void 0!==(null===(o=window)||void 0===o?void 0:o.Theme)&&Theme.handleError(e)}})}})).on("click",".fob-comment-pagination a",(function(e){e.preventDefault();var o=e.currentTarget.href;o&&(m(o),$("html, body").animate({scrollTop:$(".fob-comment-list-section").offset().top}))})).on("click",".fob-comment-item-reply",(function(n){n.preventDefault();var t=$(n.currentTarget),c=$(document).find(".fob-comment-form-section");c&&c.remove(),e||(o=c.clone()),t.closest(".fob-comment-item").after(c),c.find(".fob-comment-form-title span").text(t.data("reply-to")),c.find(".fob-comment-form-title .cancel-comment-reply-link").remove(),c.find(".fob-comment-form-title").append('<a href="#" class="cancel-comment-reply-link" rel="nofollow">'.concat(t.data("cancel-reply"),"</a")),c.find("form").prop("action",t.prop("href")),e=!0})).on("click",".cancel-comment-reply-link",(function(n){n.preventDefault(),e=!1;var t=$(document).find(".fob-comment-form-section");t&&t.remove(),$(document).find(".fob-comment-list-section").after(o)})),m()}));