!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,a){return void 0===a&&(a="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(a),a}:e(jQuery)}(function(e){"use strict";function t(e,a){if(!(this instanceof t)){var n=new t(e,a);return n.open(),n}this.id=t.id++,this.setup(e,a),this.chainCallbacks(t._callbackChain)}if(void 0===e)return void("console"in window&&window.console.info("Too much lightness, Featherlight needs jQuery."));if(e.fn.jquery.match(/-ajax/))return void("console"in window&&window.console.info("Featherlight needs regular jQuery, not the slim version."));var a=[],n=function(t){return a=e.grep(a,function(e){return e!==t&&e.$instance.closest("body").length>0})},r={allow:1,allowfullscreen:1,frameborder:1,height:1,longdesc:1,marginheight:1,marginwidth:1,mozallowfullscreen:1,name:1,referrerpolicy:1,sandbox:1,scrolling:1,src:1,srcdoc:1,style:1,webkitallowfullscreen:1,width:1},s={keyup:"onKeyUp",resize:"onResize"},o=function(a){e.each(t.opened().reverse(),function(){return a.isDefaultPrevented()||!1!==this[s[a.type]](a)?void 0:(a.preventDefault(),a.stopPropagation(),!1)})},p=function(a){if(a!==t._globalHandlerInstalled){t._globalHandlerInstalled=a;var n=e.map(s,function(e,a){return a+"."+t.prototype.namespace}).join(" ");e(window)[a?"on":"off"](n,o)}};t.prototype={constructor:t,namespace:"featherlight",targetAttr:"data-featherlight",variant:null,resetCss:!1,background:null,openTrigger:"click",closeTrigger:"click",filter:null,root:"body",openSpeed:250,closeSpeed:250,closeOnClick:"background",closeOnEsc:!0,closeIcon:"✕",loading:"",persist:!1,otherClose:null,beforeOpen:e.noop,beforeContent:e.noop,beforeClose:e.noop,afterOpen:e.noop,afterContent:e.noop,afterClose:e.noop,onKeyUp:e.noop,onResize:e.noop,type:null,contentFilters:["jquery","image","html","ajax","iframe","text"],setup:function(t,a){"object"!=typeof t||t instanceof e!=!1||a||(a=t,t=void 0);var n=e.extend(this,a,{target:t}),r=n.resetCss?n.namespace+"-reset":n.namespace,s=e(n.background||['
",{text:t})}}},functionAttributes:["beforeOpen","afterOpen","beforeContent","afterContent","beforeClose","afterClose"],readElementConfig:function(t,a){var n=this,r=RegExp("^data-"+a+"-(.*)"),s={};return t&&t.attributes&&e.each(t.attributes,function(){var t=this.name.match(r);if(t){var a=this.value,o=e.camelCase(t[1]);if(e.inArray(o,n.functionAttributes)>=0)a=Function(a);else try{a=JSON.parse(a)}catch(p){}s[o]=a}}),s},extend:function(t,a){var n=function(){this.constructor=t};return n.prototype=this.prototype,t.prototype=new n,t.__super__=this.prototype,e.extend(t,this,a),t.defaults=t.prototype,t},attach:function(t,a,n){var r=this;"object"!=typeof a||a instanceof e!=!1||n||(n=a,a=void 0);var s,o=(n=e.extend({},n)).namespace||r.defaults.namespace,p=e.extend({},r.defaults,r.readElementConfig(t[0],o),n),c=function(o){var c=e(o.currentTarget),f=e.extend({$source:t,$currentTarget:c},r.readElementConfig(t[0],p.namespace),r.readElementConfig(o.currentTarget,p.namespace),n),l=s||c.data("featherlight-persisted")||new r(a,f);"shared"===l.persist?s=l:!1!==l.persist&&c.data("featherlight-persisted",l),f.$currentTarget.blur&&f.$currentTarget.blur(),l.open(o)};return t.on(p.openTrigger+"."+p.namespace,p.filter,c),{filter:p.filter,handler:c}},current:function(){var e=this.opened();return e[e.length-1]||null},opened:function(){var t=this;return n(),e.grep(a,function(e){return e instanceof t})},close:function(e){var t=this.current();return t?t.close(e):void 0},_onReady:function(){var t=this;if(t.autoBind){var a=e(t.autoBind);a.each(function(){t.attach(e(this))}),e(document).on("click",t.autoBind,function(n){if(!n.isDefaultPrevented()){var r=e(n.currentTarget);if(a.length!==(a=a.add(r)).length){var s=t.attach(r);(!s.filter||e(n.target).parentsUntil(r,s.filter).length>0)&&s.handler(n)}}})}},_callbackChain:{onKeyUp:function(t,a){return 27===a.keyCode?(this.closeOnEsc&&e.featherlight.close(a),!1):t(a)},beforeOpen:function(t,a){return e(document.documentElement).addClass("with-featherlight"),this._previouslyActive=document.activeElement,this._$previouslyTabbable=e("a, input, select, textarea, iframe, button, iframe, [contentEditable=true]").not("[tabindex]").not(this.$instance.find("button")),this._$previouslyWithTabIndex=e("[tabindex]").not('[tabindex="-1"]'),this._previousWithTabIndices=this._$previouslyWithTabIndex.map(function(t,a){return e(a).attr("tabindex")}),this._$previouslyWithTabIndex.add(this._$previouslyTabbable).attr("tabindex",-1),document.activeElement.blur&&document.activeElement.blur(),t(a)},afterClose:function(a,n){var r=a(n),s=this;return this._$previouslyTabbable.removeAttr("tabindex"),this._$previouslyWithTabIndex.each(function(t,a){e(a).attr("tabindex",s._previousWithTabIndices[t])}),this._previouslyActive.focus(),0===t.opened().length&&e(document.documentElement).removeClass("with-featherlight"),r},onResize:function(e,t){return this.resize(this.$content.naturalWidth,this.$content.naturalHeight),e(t)},afterContent:function(e,t){var a=e(t);return this.$instance.find("[autofocus]:not([disabled])").focus(),this.onResize(t),a}}}),e.featherlight=t,e.fn.featherlight=function(e,a){return t.attach(this,e,a),this},e(document).ready(function(){t._onReady()})}),jQuery(document).ready(function(e){function t(t=0){let a=saswp_rf_localize_data.default_rating,n=0;void 0!==saswp_rf_localize_data.admin_ry_rating&&(n=saswp_rf_localize_data.admin_ry_rating);let r="#saswp-rf-form-rating";(1==t||1==n)&&(a=e(r="#saswp-rf-edit-form-rating").next().next().val()),e(r).length>0&&e(r).rateYo({rating:a,spacing:"5px",onSet:function(t,a){e(this).next().next().val(t)}}).on("rateyo.change",function(t,a){var n=a.rating;e(this).next().text(n)})}function a(t=0){let a=saswp_rf_localize_data.saswp_multi_criteria_count,n=0;if(void 0!==saswp_rf_localize_data.admin_ry_rating&&(n=saswp_rf_localize_data.admin_ry_rating),"undefined"!=typeof saswp_localize_front_data&&a>0)for(i=1;i<=a;i++){let r="#saswp-rf-form-multi-criteria-"+i,s=saswp_rf_localize_data.default_rating;(1==t||1==n)&&(s=e(r="#saswp-rf-edit-form-multi-criteria-"+i).next().next().val()),e(r).rateYo({rating:s,spacing:"5px",onSet:function(t,a){e(this).next().next().val(t)}}).on("rateyo.change",function(t,a){var n=a.rating;e(this).next().text(n)})}}function n(){"self"==e("#saswp-rf-form-video-source").val()?(e(".saswp-rf-form-source-video").show(),e(".saswp-rf-form-source-external").hide()):(e(".saswp-rf-form-source-video").hide(),e(".saswp-rf-form-source-external").show())}t(0),a(0),e(document).on("click",".saswp-rf-form-remove-field",function(t){t.preventDefault(),e(this).parent().remove();let a=parseInt(e("#saswp-rf-form-pros-field-wrapper").find("div").length)+1;a<=saswp_rf_localize_data.saswp_rfpage_settings_pros_cons_limit&&e("#saswp-rf-form-add-pros-field").show(),(a=parseInt(e("#saswp-rf-form-cons-field-wrapper").find("div").length)+1)<=saswp_rf_localize_data.saswp_rfpage_settings_pros_cons_limit&&e("#saswp-rf-form-add-cons-field").show()}),e(document).on("click","#saswp-rf-form-add-pros-field",function(t){t.preventDefault();let a=parseInt(e("#saswp-rf-form-pros-field-wrapper").find("div").length)+1;if(a<=saswp_rf_localize_data.saswp_rfpage_settings_pros_cons_limit){let n="";n+='
',n+='+ ',n+=' ',n+="
",e("#saswp-rf-form-pros-field-wrapper").append(n),a==saswp_rf_localize_data.saswp_rfpage_settings_pros_cons_limit&&e("#saswp-rf-form-add-pros-field").hide()}else e("#saswp-rf-form-add-pros-field").hide()}),e(document).on("click","#saswp-rf-form-add-cons-field",function(t){t.preventDefault();let a=parseInt(e("#saswp-rf-form-cons-field-wrapper").find("div").length)+1;if(a<=saswp_rf_localize_data.saswp_rfpage_settings_pros_cons_limit){let n="";n+='
',n+='+ ',n+=' ',n+="
",e("#saswp-rf-form-cons-field-wrapper").append(n),a==saswp_rf_localize_data.saswp_rfpage_settings_pros_cons_limit&&e("#saswp-rf-form-add-cons-field").hide()}else e("#saswp-rf-form-add-cons-field").hide()}),n(),e(document).on("click",".saswp-rf-template-review-edit-btn",function(r){r.preventDefault();let s=e(this).attr("data-comment-post-id"),o=e(this).attr("data-comment-id"),p=e(this);e.ajax({type:"post",dataType:"json",url:saswp_rf_localize_data.ajaxurl,data:{action:"saswp_rf_template_review_edit_form",comment_post_id:s,comment_id:o,saswp_rf_form_nonce:saswp_rf_localize_data.saswp_rf_page_security_nonce},beforeSend:function(){p.html("("+saswp_rf_localize_data.loading+")")},success:function(r){r.success?(p.html("("+saswp_rf_localize_data.edit+")"),e("body").prepend(r.data),t(1),a(1),n(),e("#saswp-rf-form-video-source").on("change",function(){n()})):console.log(r.data)}})}),e(document).on("click",".saswp-rf-edit-submit",function(t){t.preventDefault();let a=e(this).parents("form").serialize();a+="&saswp_rf_form_nonce="+saswp_rf_localize_data.saswp_rf_page_security_nonce,e.ajax({type:"post",dataType:"json",url:saswp_rf_localize_data.ajaxurl,data:a,success:function(e){e.success?location.reload():console.log(e.data)}})}),e(document).on("mouseup",function(t){let a=e(".saswp-rf-review-popup");a.is(t.target)||0!==a.has(t.target).length||e(".saswp-rf-modal").remove()}),e("#saswp-rf-form-video-source").on("change",function(){n()}),e(document).on("click","#saswp-rf-form-upload-box-image",function(){e("#saswp-rf-form-image").trigger("click")}),e(document).on("click",".saswp-rf-template-review-play-self-video",function(t){t.preventDefault();let a=e(this).attr("data-video-url");e.ajax({type:"post",dataType:"json",url:saswp_rf_localize_data.ajaxurl,data:{action:"saswp_rf_form_self_video_popup",saswp_rf_form_nonce:saswp_rf_localize_data.saswp_rf_page_security_nonce,video_url:a},success:function(t){t.success&&e("body").prepend(t.data)}})}),e(document).on("change","#saswp-rf-form-image",function(t){let a,n;a=e(this).prop("files")[0],(n=new FormData).append("saswp-rf-form-image",a),n.append("saswp_rf_form_nonce",saswp_rf_localize_data.saswp_rf_page_security_nonce),n.append("action","saswp_rf_form_image_upload"),e.ajax({url:saswp_rf_localize_data.ajaxurl,type:"POST",contentType:!1,processData:!1,data:n,beforeSend:function(){e(".saswp-rf-form-image-error").html(""),e("#saswp-rf-form-upload-box-image span").html(saswp_rf_localize_data.loading)},success:function(t){t.success?e(".saswp-rf-form-preview-imgs").append("
"):e(".saswp-rf-form-image-error").html(t.data.msg),e("#saswp-rf-form-upload-box-image span").html(saswp_rf_localize_data.upload_img)}})}),e(document).on("click",".saswp-rf-form-file-remove",function(t){t.preventDefault();let a=e(this).data("id");confirm(saswp_rf_localize_data.sure_txt)&&(e(this).parent().remove(),e.ajax({type:"post",dataType:"json",url:saswp_rf_localize_data.ajaxurl,data:{action:"saswp_rf_form_remove_file",attachment_id:a,saswp_rf_form_nonce:saswp_rf_localize_data.saswp_rf_page_security_nonce},success:function(){}}))}),e(document).on("click","#saswp-rf-form-upload-box-video",function(){e("#saswp-rf-form-video").trigger("click")}),e(document).on("change","#saswp-rf-form-video",function(t){let a,n;a=e(this).prop("files")[0],(n=new FormData).append("saswp-rf-form-video",a),n.append("saswp_rf_form_nonce",saswp_rf_localize_data.saswp_rf_page_security_nonce),n.append("action","saswp_rf_form_video_upload"),e.ajax({url:saswp_rf_localize_data.ajaxurl,type:"POST",contentType:!1,processData:!1,data:n,beforeSend:function(){e(".saswp-rf-form-video-error").html(""),e("#saswp-rf-form-upload-box-video span").html(saswp_rf_localize_data.loading)},success:function(t){t.success?e(".saswp-rf-form-preview-videos").append("
"+t.data.file_info.name+" x
"):e(".saswp-rf-form-video-error").html(t.data.msg),e("#saswp-rf-form-upload-box-video span").html(saswp_rf_localize_data.upload_video)},error:function(e,t,a){console.log("Error:",a),console.log("Status:",t),console.log("Response:",e.responseText)}})}),e(document).on("click",".saswp-rf-template-reply-btn",function(t){e(".saswp-rf-form-hide-reply").hide()}),e(document).on("click",".saswp-rf-form #cancel-comment-reply-link",function(t){e(".saswp-rf-form-hide-reply").show()});let r=new URL(window.location.href);if(e(".saswp_rf_template_review_filter").on("change",function(t){let a=this.value;"sort"===e(this).data("type")?r.searchParams.set("sort_by",a):r.searchParams.set("filter_by",a),window.history.replaceState(null,null,r);let n=r.searchParams.get("sort_by"),s=r.searchParams.get("filter_by");e.ajax({type:"post",dataType:"json",url:saswp_rf_localize_data.ajaxurl,data:{action:"saswp_rf_template_review_filter",post_id:saswp_rf_localize_data.post_id,saswp_rf_form_nonce:saswp_rf_localize_data.saswp_rf_page_security_nonce,sort_by:n,filter_by:s},beforeSend:function(){e(".saswp-rf-template-paginate").html(saswp_rf_localize_data.loading)},success:function(t){t.success&&(e(".saswp-rf-template-comment-list").html(t.data.review),e(".saswp-rf-template-paginate").html(t.data.pagination))}})}),e("body").on("click","#saswp-rf-template-load-more",function(){let t=e("#saswp-rf-template-load-more").attr("data-max"),a=e("#saswp-rf-template-load-more"),n=r.searchParams.get("sort_by"),s=parseInt(saswp_rf_localize_data.current_page);return 1==s&&s++,e.ajax({url:saswp_rf_localize_data.ajaxurl,data:{action:"saswp_rf_template_pagination",post_id:saswp_rf_localize_data.post_id,current_page:s,max_page:t,pagi_num:!0,saswp_rf_form_nonce:saswp_rf_localize_data.saswp_rf_page_security_nonce,sort_by:n},type:"POST",dataType:"json",beforeSend:function(){a.text(saswp_rf_localize_data.loading)},success:function(n){a.text("Load More"),n.success&&e(".saswp-rf-template-comment-list").append(n.data.review),saswp_rf_localize_data.current_page++,saswp_rf_localize_data.current_page==t&&a.remove()}}),!1}),e("body").on("click",".saswp-rf-template-paginate-ajax a",function(t){t.preventDefault();let a=e(this).attr("href").match("/comment-page-([0-9]+)/"),n=1;a&&(n=a[1]);let s=e(this).parent().attr("data-max"),o=r.searchParams.get("sort_by");return e.ajax({url:saswp_rf_localize_data.ajaxurl,data:{action:"saswp_rf_template_pagination",post_id:saswp_rf_localize_data.post_id,current_page:n,max_page:s,pagi_num:!0,saswp_rf_form_nonce:saswp_rf_localize_data.saswp_rf_page_security_nonce,sort_by:o},type:"POST",dataType:"json",beforeSend:function(){e(".saswp-rf-template-paginate-ajax").html(saswp_rf_localize_data.loading)},success:function(t){t.success&&(e(".saswp-rf-template-comment-list").html(t.data.review),e(".saswp-rf-template-paginate-ajax").html(t.data.pagination))}}),!1}),e(".saswp-rf-template-paginate-onscroll").length>0){let s=!0;e(window).scroll(function(){if(!s)return;let t=e(".saswp-rf-template-paginate-onscroll").attr("data-max"),a=r.searchParams.get("sort_by");if(saswp_rf_localize_data.current_page>=t){s=!1;return}let n=parseInt(saswp_rf_localize_data.current_page);1==n&&n++,e(document).scrollTop()>e(document).height()-2900&&!0==s&&e.ajax({url:saswp_rf_localize_data.ajaxurl,data:{action:"saswp_rf_template_pagination",post_id:saswp_rf_localize_data.post_id,current_page:n,max_page:t,pagi_num:!0,saswp_rf_form_nonce:saswp_rf_localize_data.saswp_rf_page_security_nonce,sort_by:a},type:"POST",dataType:"json",beforeSend:function(){e(".saswp-rf-template-paginate-onscroll").html(saswp_rf_localize_data.loading),s=!1},success:function(t){t.success&&(e(".saswp-rf-template-comment-list").append(t.data.review),e(".saswp-rf-template-paginate-onscroll").html(""),saswp_rf_localize_data.current_page++,s=!0)}})})}e("#comment_form").removeAttr("novalidate"),e(document).on("click",".saswp-rf-template-review-helpful label",function(t){t.preventDefault(),e(".saswp-rf-template-review-helpful label input").removeAttr("checked");let a=e(this).find(".saswp-rf-form-helful-radio");a.prop("checked",!0);let n=a.val(),r=e(this).find(".saswp-rf-template-helpful-count").text();r=parseInt(r);let s=e(a).data("comment-id");e.ajax({type:"post",dataType:"json",url:saswp_rf_localize_data.ajaxurl,data:{action:"saswp_rf_template_review_helpful",comment_id:s,type:n,saswp_rf_form_nonce:saswp_rf_localize_data.saswp_rf_page_security_nonce},beforeSend:function(){},success:function(t){t.success&&t.data&&(e("#saswp-rf-template-helpful-like-count").text(t.data.likes),e("#saswp-rf-template-helpful-dislike-count").text(t.data.dislikes))}})}),e(document).on("change",".saswp-rf-template-review-highlight",function(t){let a=e(this).data("comment-id"),n="no";e(this).is(":checked")?(n="yes",e(this).closest(".saswp-rf-template-single-review").addClass("saswp-rf-template-top-review")):e(this).closest(".saswp-rf-template-single-review").removeClass("saswp-rf-template-top-review"),e.ajax({type:"post",dataType:"json",url:saswp_rf_localize_data.ajaxurl,data:{action:"saswp_template_review_hightlight",comment_id:a,highlight:n,saswp_rf_form_nonce:saswp_rf_localize_data.saswp_rf_page_security_nonce},beforeSend:function(){},success:function(e){}})}),e(document).on("mouseenter",".saswp-rf-template-single-review",function(t){let a=e(this).find(".saswp-rf-form-highlight-wrapper");a.length>0&&a.removeClass("saswp-rf-template-hide")}),e(document).on("mouseleave",".saswp-rf-template-single-review",function(t){let a=e(this).find(".saswp-rf-form-highlight-wrapper");a.length>0&&a.addClass("saswp-rf-template-hide")})});