window.fusionFormLogics={onReady:function(){jQuery(".fusion-form input, .fusion-form select, .fusion-form textarea").on("change keyup",(function(){void 0!==jQuery(this).attr("name")&&""!==jQuery(this).attr("name")&&window.fusionFormLogics.formLogics(jQuery(this))}))},formLogics:function(o=""){""===o?jQuery(".fusion-form.fusion-form-builder").each((function(){var o=jQuery(this).data("form-id");window.fusionFormLogics.applyLogics(o)})):window.fusionFormLogics.applyLogics(o.closest(".fusion-form-field").data("form-id"),o.attr("name"))},applyLogics:function(o,e=""){var i=jQuery(".fusion-form-form-wrapper.fusion-form-"+o).data("config"),n=void 0!==i?i.field_logics:{},r={};jQuery.isEmptyObject(n)||""!==e&&(jQuery.each(n,(function(o,i){-1===e.indexOf(o)&&-1===i.indexOf(e)||""===i||(r[o]=i)})),0===Object.keys(r).length)||(n=Object.keys(r).length?r:n,jQuery.each(n,(function(e,i){window.fusionFormLogics.checkFieldLogic(e,i,o)})))},checkFieldLogic:function(o,e,i){var n=""!==e?JSON.parse(e):[],r=jQuery(".fusion-form-"+i),t=r.find('[name="'+o+'"]'),a=r.find(".data-"+o),s=r.find('[data-form-element-name="'+o+'"]'),f=!1,u=[];t=t.length?t:r.find('[name="'+o+'[]"]'),jQuery.each(n,(function(o,e){var i,n=[],t=void 0!==e.operator?e.operator:"",a=void 0!==e.comparison?e.comparison:"",s=void 0!==e.field?e.field:"",f=void 0!==e.value?e.value:"";i=window.fusionFormLogics.getFieldValue(s,r),n.push(t),n.push("false"!==i&&window.fusionFormLogics.isMatch(i,f,a)),u.push(n)})),u.length&&(f=window.fusionFormLogics.MatchConditions(u),window.fusionFormLogics.toggleField(f,t),window.fusionFormLogics.toggleNotice(f,a),window.fusionFormLogics.toggleElement(f,s))},toggleField:function(o,e){var i=e.attr("aria-required");o?(e.closest(".fusion-form-field").removeClass("fusion-form-field-hidden"),void 0!==i&&"true"===i&&e.attr("required",!0)):e.closest(".fusion-form-field").addClass("fusion-form-field-hidden")},toggleNotice:function(o,e){o?e.removeClass("fusion-form-notice-hidden"):e.addClass("fusion-form-notice-hidden")},toggleElement:function(o,e){o?(e.removeClass("fusion-form-field-hidden"),e.find("input, textarea, select").filter("[data-required]").attr("required",!0).removeAttr("data-required")):e.addClass("fusion-form-field-hidden")},getFieldValue:function(o,e){var i=e.find('[name="'+o+'"]'),n=-1!==jQuery.inArray(i.attr("type"),["checkbox","radio"]);return!i.closest(".fusion-form-field-hidden").hasClass("fusion-form-field-hidden")&&(n?window.fusionFormLogics.getArrayTypeValue(i,e):i.val())},getArrayTypeValue:function(o,e){var i=[];return"radio"===o.attr("type")?e.find('input[name="'+o.attr("name")+'"]:checked').val():(jQuery.each(e.find('input[name="'+o.attr("name")+'"]:checked'),(function(){i.push(jQuery(this).val())})),i.join(" | "))},isMatch:function(o,e,i){switch(o=o?o.toLowerCase():"",e=e?e.toLowerCase():"",i){case"equal":return o===e;case"not-equal":return o!==e;case"greater-than":return parseFloat(o)>parseFloat(e);case"less-than":return parseFloat(o)(a=i.length))return s.push(i[0]),void s.push(i[1]);for(e=0;e(a=s.length))return s[0];for(e=0;e