!function(){"use strict";jQuery(document).on("submit",".fusion-privacy-form",(function(e){var n=jQuery(".fusion-privacy-form"),a=jQuery(this),o="ajax"===a.data("save-action");if(o||!(n.length<2)){e.preventDefault();var t={},i={},c="function"==typeof fusionGetCookieValue?fusionGetCookieValue():[];n.each((function(){jQuery(this).find('input[name="consents[]"]').each((function(){var e=jQuery(this),n=e.val();"checkbox"===e.attr("type")?e.prop("disabled")?t[n]=!0:(i[n]=!0,t[n]=t[n]||e.is(":checked")):t[n]=!0}))})),c&&c.length&&jQuery.each(c,(function(e,n){n&&!i.hasOwnProperty(n)&&(t[n]=!0)}));var r=n.find('input[name="consents[]"][type="checkbox"]:not([disabled])');if(n.find('input[name="consents[]"]').prop("disabled",!0),o){var u=Object.keys(t).filter((function(e){return t[e]}));if("function"==typeof fusionSaveCookieValues&&(fusionSaveCookieValues(u,!1),fusionSaveCookieValues("consent",!0)),"function"==typeof fusionReplacePlaceholders&&u.forEach((function(e){"consent"!==e&&(fusionReplacePlaceholders(e),jQuery('.fusion-privacy-placeholder[data-privacy-type="'+e+'"]').remove())})),"function"==typeof gtag&&"undefined"!=typeof avadaPrivacyVars&&avadaPrivacyVars.types){var s={google_ad_storage:"ad_storage",google_analytics_storage:"analytics_storage",google_ad_user_data:"ad_user_data",google_ad_personalization:"ad_personalization"},p={},f=!1;Object.keys(s).forEach((function(e){-1!==avadaPrivacyVars.types.indexOf(e)&&(p[s[e]]=-1!==u.indexOf(e)?"granted":"denied",f=!0)})),f&&gtag("consent","update",p)}return r.prop("disabled",!1),void jQuery(document).trigger("awb_privacy_saved")}jQuery.each(t,(function(e,n){n&&a.append(jQuery("<input>").attr({type:"hidden",name:"consents[]",value:e}))})),a[0].submit()}})),jQuery(document).on("change",'.fusion-privacy-element input[name="consents[]"][type="checkbox"]:not([disabled])',(function(){var e=jQuery(this),n=e.val(),a=e.is(":checked");jQuery('.fusion-privacy-element input[name="consents[]"][value="'+n+'"]').not(e).prop("checked",a),jQuery('.fusion-privacy-bar input[type="checkbox"][value="'+n+'"], #bar-'+n+", #bar-tab-"+n).prop("checked",a)})),jQuery(document).on("change",'.fusion-privacy-bar input[type="checkbox"]',(function(){var e=jQuery(this).val(),n=jQuery(this).is(":checked");jQuery('.fusion-privacy-element input[name="consents[]"][value="'+e+'"]').prop("checked",n)})),jQuery(document).on("click",".fusion-privacy-element-update",(function(){jQuery(this).closest(".fusion-privacy-form").trigger("submit")})),jQuery(document).on("click",".fusion-privacy-element-accept-all",(function(){var e=jQuery(this).closest(".fusion-privacy-form");jQuery(".fusion-privacy-form").find('input[type="checkbox"][name="consents[]"]').not(":disabled").prop("checked",!0),e.trigger("submit")})),jQuery(document).on("click",".fusion-privacy-element-reject-all",(function(){var e=jQuery(this).closest(".fusion-privacy-form");jQuery(".fusion-privacy-form").find('input[type="checkbox"][name="consents[]"]').not(":disabled").prop("checked",!1),e.trigger("submit")}))}();