/**handles:um_conditional**/
var arr_all_conditions=[],um_field_conditions={},um_field_default_values={};function um_get_field_default_value(e){var i,n="",t=um_get_field_type(e);switch(t){case"text":case"number":case"date":case"textarea":case"select":n=e.find('input:text,input[type="number"],textarea,select').val();break;case"multiselect":n=e.find("select").val();break;case"radio":1&lt;=e.find(&#039;input[type=&quot;radio&quot;]:checked&#039;).length&amp;&amp;(n=e.find(&#039;input[type=&quot;radio&quot;]:checked&#039;).val());break;case&quot;checkbox&quot;:1&lt;=e.find(&#039;input[type=&quot;checkbox&quot;]:checked&#039;).length&amp;&amp;(n=1&lt;e.find(&#039;input[type=&quot;checkbox&quot;]:checked&#039;).length?((i=[]).push(n),e.find(&#039;input[type=&quot;checkbox&quot;]:checked&#039;).each(function(){i.push(jQuery(this).val())}),i):e.find(&#039;input[type=&quot;checkbox&quot;]:checked&#039;).val());break;default:n=wp.hooks.applyFilters(&quot;um_conditional_logic_default_value&quot;,n,t,e)}return{type:t,value:n}}function um_get_field_element(e){var i=e.find(&quot;input,textarea,select&quot;),n=um_get_field_type(e);return wp.hooks.applyFilters(&quot;um_conditional_logic_field_element&quot;,i,n,e)}function um_get_field_type(e){var n=&quot;&quot;,e=e.attr(&quot;class&quot;).split(&quot; &quot;);return jQuery.each(e,function(e,i){/um-field-type_/.test(i)&amp;&amp;(n=i.replace(&quot;um-field-type_&quot;,&quot;&quot;).trim())}),n}function um_get_field_children(n){var t=[];return jQuery.each(arr_all_conditions,function(e,i){i.field.parent===n&amp;&amp;t.push(i.field.condition)}),t}function um_splitup_array(e,i){for(var n=e.length%i,t=n,a=Math.floor(e.length/i),u=[],o=0;o&lt;e.length;o+=a){var r=a+o,d=!1;0!=n&amp;&amp;t&amp;&amp;(r++,t--,d=!0),u.push(e.slice(o,r)),d&amp;&amp;o++}var c=[];return jQuery.each(u,function(e,i){c.push({action:i[0],if_field:i[1],operator:i[2],value:i[3]})}),c}function um_get_field_data(e){return um_live_field=e.parents(&quot;.um-field&quot;).data(&quot;key&quot;),um_live_value=e.val(),e.is(&quot;:checkbox&quot;)&amp;&amp;(um_live_value=&quot;&quot;,1&lt;e.parents(&quot;.um-field&quot;).find(&quot;input:checked&quot;).length?e.parents(&quot;.um-field&quot;).find(&quot;input:checked&quot;).each(function(){um_live_value=um_live_value+jQuery(this).val()+&quot; &quot;}):1parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"less than"===i.operator&amp;&amp;(n=Array.isArray(a)&amp;&amp;1===a.length?a[0]:a,jQuery.isNumeric(i.value)&amp;&amp;parseInt(n)&lt;parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),&quot;contains&quot;===i.operator)switch(t){case&quot;multiselect&quot;:a&amp;&amp;0&lt;=a.indexOf(i.value)&amp;&amp;um_in_array(i.value,a)?u[i.owner][e]=!0:u[i.owner][e]=!1;break;case&quot;checkbox&quot;:a&amp;&amp;0&lt;=a.indexOf(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1;break;default:void 0===(u=wp.hooks.applyFilters(&quot;um_conditional_logic_contains_operator_owners&quot;,u,t,a,i,e))[i.owner][e]&amp;&amp;(a&amp;&amp;0&lt;=a.indexOf(i.value)&amp;&amp;um_in_array(a,o[i.owner])?u[i.owner][e]=!0:u[i.owner][e]=!1)}}),jQuery.each(u,function(e,i){um_in_array(!0,i)?um_field_apply_action(n,r[e],!0):um_field_apply_action(n,r[e],!1)}),n.trigger(&quot;um_fields_change&quot;))}function um_field_apply_action(e,i,n){var t=jQuery(&#039;div.um-field[data-key=&quot;&#039;+i.owner+&#039;&quot;]&#039;);return&quot;show&quot;===i.action&amp;&amp;n&amp;&amp;(t.is(&quot;:hidden&quot;)&amp;&amp;um_field_restore_default_value(t),t.show(),_show_in_ie(t)),&quot;show&quot;!==i.action||n||(t.hide(),_hide_in_ie(t)),&quot;hide&quot;===i.action&amp;&amp;n&amp;&amp;(t.hide(),_hide_in_ie(t)),&quot;hide&quot;!==i.action||n||(t.is(&quot;:hidden&quot;)&amp;&amp;um_field_restore_default_value(t),t.show(),_show_in_ie(t)),e.removeClass(&quot;um-field-has-changed&quot;)}function um_field_restore_default_value(n){var e,i=um_get_field_type(n),t=n.data(&quot;key&quot;),a=um_field_default_values[t];switch(i){case&quot;text&quot;:case&quot;number&quot;:case&quot;date&quot;:case&quot;textarea&quot;:n.find(&#039;input:text,input[type=&quot;number&quot;],textareas&#039;).val(a.value);break;case&quot;select&quot;:n.find(&quot;select&quot;).find(&quot;option&quot;).prop(&quot;selected&quot;,!1),n.find(&quot;select&quot;).val(a.value),n.find(&quot;select&quot;).trigger(&quot;change&quot;);break;case&quot;multiselect&quot;:n.find(&quot;select&quot;).find(&quot;option&quot;).prop(&quot;selected&quot;,!1),jQuery.each(a.value,function(e,i){n.find(&quot;select&quot;).find(&#039;option[value=&quot;&#039;+i+&#039;&quot;]&#039;).attr(&quot;selected&quot;,!0)}),n.find(&quot;select&quot;).trigger(&quot;change&quot;);break;case&quot;checkbox&quot;:1&lt;=n.find(&#039;input[type=&quot;checkbox&quot;]:checked&#039;).length&amp;&amp;(n.find(&#039;input[type=&quot;checkbox&quot;]:checked&#039;).prop(&quot;checked&quot;,!1),n.find(&quot;span.um-field-checkbox-state i&quot;).removeClass(&quot;um-icon-android-checkbox-outline&quot;),n.find(&quot;span.um-field-checkbox-state i&quot;).addClass(&quot;um-icon-android-checkbox-outline-blank&quot;),n.find(&quot;.um-field-checkbox.active&quot;).removeClass(&quot;active&quot;),Array.isArray(a.value)?jQuery.each(a.value,function(e,i){i=n.find(&#039;input[type=&quot;checkbox&quot;][value=&quot;&#039;+i+&#039;&quot;]&#039;);i.attr(&quot;checked&quot;,!0),i.closest(&quot;.um-field-checkbox&quot;).find(&quot;i&quot;).removeClass(&quot;um-icon-android-checkbox-outline-blank&quot;),i.closest(&quot;.um-field-checkbox&quot;).find(&quot;i&quot;).addClass(&quot;um-icon-android-checkbox-outline&quot;),i.closest(&quot;.um-field-checkbox&quot;).addClass(&quot;active&quot;)}):((e=n.find(&#039;input[type=&quot;checkbox&quot;][value=&quot;&#039;+a.value+&#039;&quot;]&#039;)).attr(&quot;checked&quot;,!0),e.closest(&quot;.um-field-checkbox&quot;).find(&quot;i&quot;).removeClass(&quot;um-icon-android-checkbox-outline-blank&quot;),e.closest(&quot;.um-field-checkbox&quot;).find(&quot;i&quot;).addClass(&quot;um-icon-android-checkbox-outline&quot;),e.closest(&quot;.um-field-checkbox&quot;).addClass(&quot;active&quot;)));break;case&quot;radio&quot;:1&lt;=n.find(&#039;input[type=&quot;radio&quot;]:checked&#039;).length&amp;&amp;setTimeout(function(){n.find(&#039;input[type=&quot;radio&quot;]:checked&#039;).prop(&quot;checked&quot;,!1),n.find(&quot;span.um-field-radio-state i&quot;).removeClass(&quot;um-icon-android-radio-button-on&quot;),n.find(&quot;span.um-field-radio-state i&quot;).addClass(&quot;um-icon-android-radio-button-off&quot;),n.find(&quot;.um-field-radio.active&quot;).removeClass(&quot;active&quot;);var e=n.find(&#039;input[type=&quot;radio&quot;][value=&quot;&#039;+a.value+&#039;&quot;]&#039;);e.attr(&quot;checked&quot;,!0),e.closest(&quot;.um-field-radio&quot;).find(&quot;i&quot;).removeClass(&quot;um-icon-android-radio-button-off&quot;),e.closest(&quot;.um-field-radio&quot;).find(&quot;i&quot;).addClass(&quot;um-icon-android-radio-button-on&quot;),e.closest(&quot;.um-field-radio&quot;).addClass(&quot;active&quot;)},100);break;default:wp.hooks.doAction(&quot;um_conditional_logic_restore_default_value&quot;,i,n,a)}!n.hasClass(&quot;um-field-has-changed&quot;)&amp;&amp;(t=um_get_field_element(n),t=&quot;radio&quot;!==i&amp;&amp;&quot;checkbox&quot;!==i?t:t.find(&quot;:checked&quot;))&amp;&amp;(t.trigger(&quot;change&quot;),n.addClass(&quot;um-field-has-changed&quot;))}function um_field_hide_siblings(){jQuery.each(um_field_conditions,function(e,i){(1&lt;=jQuery(&#039;.um-field[data-key=&quot;&#039;+e+&#039;&quot;]:hidden&#039;).length||&quot;none&quot;===jQuery(&#039;.um-field[data-key=&quot;&#039;+e+&#039;&quot;]&#039;).css(&quot;display&quot;))&amp;&amp;jQuery.each(i,function(e,i){jQuery(&#039;.um-field[data-key=&quot;&#039;+i.owner+&#039;&quot;]&#039;).hide()})})}function _hide_in_ie(e){void 0!==jQuery.browser&amp;&amp;jQuery.browser.msie&amp;&amp;e.css({visibility:&quot;hidden&quot;})}function _show_in_ie(e){void 0!==jQuery.browser&amp;&amp;jQuery.browser.msie&amp;&amp;e.css({visibility:&quot;visible&quot;})}function um_init_field_conditions(){var e=[];jQuery(&quot;.um-field[data-key]&quot;).each(function(){var n=jQuery(this).data(&quot;key&quot;),a=(e.push(n),{});jQuery.each(jQuery(this)[0].attributes,function(e,i){var n,t;-1!==i.name.indexOf(&quot;data-cond&quot;)&amp;&amp;(n=(t=i.name.slice(10)).substring(1,0),t=t.slice(2),void 0===a[n]&amp;&amp;(a[n]={}),a[n][t]=i.value)}),jQuery.each(a,function(e,i){i={field:{owner:n,action:i.action,parent:i.field,operator:i.operator,value:i.value,condition:{owner:n,action:i.action,operator:i.operator,value:i.value}}};arr_all_conditions.push(i)}),um_field_default_values[jQuery(this).data(&quot;key&quot;)]=um_get_field_default_value(jQuery(this))}),jQuery.each(e,function(e,i){um_field_conditions[i]=um_get_field_children(i)}),jQuery(&quot;.um-field[data-key]:visible&quot;).each(function(){var e=um_get_field_element(jQuery(this));void 0!==e.trigger&amp;&amp;e.trigger(&quot;change&quot;)})}jQuery(document).ready(function(){jQuery(document).on(&quot;change&quot;,&#039;.um-field select, .um-field input[type=&quot;radio&quot;], .um-field input[type=&quot;checkbox&quot;]&#039;,function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on(&quot;input change&quot;,&#039;.um-field input[type=&quot;text&quot;]&#039;,function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on(&quot;input change&quot;,&#039;.um-field input[type=&quot;number&quot;]&#039;,function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on(&quot;input change&quot;,&#039;.um-field input[type=&quot;password&quot;]&#039;,function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on(&quot;change&quot;,&#039;.um-field-image input[type=&quot;hidden&quot;],.um-field-file input[type=&quot;hidden&quot;]&#039;,function(){um_apply_conditions(jQuery(this),!1)}),jQuery(document).on(&quot;click&quot;,&quot;.um-finish-upload&quot;,function(){var e=jQuery(this).attr(&quot;data-key&quot;),i=jQuery(&quot;.um-field-&quot;+e+&quot; input&quot;);setTimeout(function(){um_apply_conditions(i,!1)},100)}),jQuery(document).on(&quot;click&quot;,&quot;.um-field .cancel&quot;,function(){var e=jQuery(this).parent().attr(&quot;data-key&quot;),i=jQuery(&quot;.um-field-&quot;+e+&quot; input&quot;);setTimeout(function(){um_apply_conditions(i,!1)},1e3)}),jQuery(document).on(&quot;um_fields_change&quot;,function(){um_field_hide_siblings(),um_field_hide_siblings()}),um_init_field_conditions()});