!function(e){"use strict";e.WS_Form.prototype.form_conditional=function(t){var a=this;if(void 0===t&&(t=!1),!1===this.conditional_cache){if(void 0===(f=this.get_object_meta_value(this.form,"conditional",!1)).groups)return!1;if(void 0===f.groups[0])return!1;if(void 0===f.groups[0].rows)return!1;for(var i in f.groups[0].rows)if(f.groups[0].rows.hasOwnProperty(i)){var s=f.groups[0].rows[i];if(null!==s&&"object"==typeof s&&(void 0===s.disabled||!s.disabled)&&void 0!==s.data&&void 0!==s.data[0]&&void 0!==s.data[1]){var o=s.data[0],r=s.data[1];try{r=JSON.parse(r)}catch(e){r=!1}!1!==r&&(r.label=o,r.last_state=[],this.conditional_events(r,t),!1===this.conditional_cache&&(this.conditional_cache=[]),this.conditional_cache.push(r))}}}else for(var i in this.conditional_cache){if(this.conditional_cache.hasOwnProperty(i))(r=this.conditional_cache[i]).last_state=[],this.conditional_events(r,t)}var c=[];for(var _ in this.conditional_event_selector_to_condition)if(this.conditional_event_selector_to_condition.hasOwnProperty(_)){var n=this.conditional_event_selector_to_condition[_];for(var d in n)if(n.hasOwnProperty(d)){var l=n[d],h=l.object_event_selector,u=l.object_event_obj,f=l.conditionals;if(t){"null"===_&&(_=null);u.each(function(){e(this).on(d,_,{conditionals:f},function(t,i,s,o){if(void 0===s||void 0===o||a.form_id===s||a.form_instance_id===o){var r=e(this).closest("[data-repeatable-index]"),c=r.length?r.attr("data-repeatable-index"):0;for(var _ in t.data.conditionals)if(t.data.conditionals.hasOwnProperty(_)){var n=t.data.conditionals[_];a.conditional_process(n,!1,e(this),c,t)}}}),a.form_events_reset.push({obj:e(this),event:d})}),this.log("log_conditional_event",(null===_?this.language("debug_form"):_)+" ("+d+")","conditional")}var v=e(h,this.form_canvas_obj),b=[],p=[];for(var m in v.each(function(){if(void 0!==e(this).attr("name")){var t=e(this).attr("name");p.includes(t)||(p.push(t),b.push(e(this)))}}),b)if(b.hasOwnProperty(m)){var g=b[m];if(void 0===g.attr("data-wsf-conditional-initialize-once")){var k=g.closest("[data-repeatable-index]"),w=k.length?k.attr("data-repeatable-index"):0,y=!1;for(var i in f)if(f.hasOwnProperty(i)){r=f[i];if(a.conditional_destination_repeatable(r))y=!0;a.conditional_process(r,!0,g,w,!1)}y||c.includes(g)||c.push(g)}}}}for(var j in c){if(c.hasOwnProperty(j))c[j].attr("data-wsf-conditional-initialize-once","")}},e.WS_Form.prototype.conditional_destination_repeatable=function(e){return this.conditional_destination_repeatable_then_else(e,"then")||this.conditional_destination_repeatable_then_else(e,"else")},e.WS_Form.prototype.conditional_destination_repeatable_then_else=function(e,t){var a=e[t];for(var i in a)if(a.hasOwnProperty(i)){var s=a[i];if(this.conditional_action_check(s)){var o=s.object,r=s.object_id;switch(o){case"section":if(void 0===this.section_data_cache[r])continue;var c=this.section_data_cache[r];break;case"field":if(void 0===this.field_data_cache[r])continue;var _=this.field_data_cache[r].section_id;if(void 0===this.section_data_cache[_])continue;c=this.section_data_cache[_]}if(this.get_object_meta_value(c,"section_repeatable"))return!0}}return!1},e.WS_Form.prototype.conditional_events=function(t,a){void 0===a&&(a=!0);var i=this,s=void 0!==this.framework.tabs.public.selector_href?this.framework.tabs.public.selector_href:"href";for(var o in t.if)if(t.if.hasOwnProperty(o)){var r=t.if[o];if(void 0!==r.conditions)for(var c in r.conditions)if(r.conditions.hasOwnProperty(c)){var _=r.conditions[c];if(this.conditional_condition_check(_)){var n=_.object,d=_.object_id,l=_.logic,h=_.value,u=[];switch(n){case"form":u.push(this.conditional_event_get(n,this.form_id,0,this.form,l));break;case"group":if(void 0===this.group_data_cache[d])break;var f=this.group_data_cache[d];u.push(this.conditional_event_get(n,d,!1,f,l));break;case"section":if(void 0===this.section_data_cache[d])break;f=this.section_data_cache[d];u.push(this.conditional_event_get(n,d,!1,f,l));break;case"field":if(void 0===this.field_data_cache[d])break;f=this.field_data_cache[d];var v=e.WS_Form.field_type_cache[f.type],b=this.get_object_row_id(_),p=void 0!==f.section_repeatable_section_id;u.push(this.conditional_event_get(n,d,b,f,l,p));var m=[];switch(l){case"field_match":case"field_match_not":var g=h;if(0==parseInt(g,10))break;if(void 0===this.field_data_cache[g])break;var k=this.field_data_cache[g];p=void 0!==k.section_repeatable_section_id;u.push(this.conditional_event_get("field",g,!1,k,l,p)),m.field_match_id=this.form_id_prefix+"field-"+g}var w=this.get_field_value_fallback(v,!1,"attribute_"+l,!1);if("object"==typeof w){var y="#"+this.form_id_prefix+n+"-"+d;for(var j in w)if(w.hasOwnProperty(j)){var x=w[j];x=this.mask_parse(x,m),e(y,this.form_canvas_obj).attr(j,x)}}break;case"submit":u.push(this.conditional_event_get(n,0,!1,this.submit,l));break;case"user":u.push(this.conditional_event_get(n,0,!1,!1,l))}for(var q in u)if(u.hasOwnProperty(q)){var O=u[q],A=(y=null,O.repeatable);if("wsf-group-index"==O.event||"wsf-section-repeatable"==O.event||"wsf-validate"==O.event||"wsf-validate-silent"==O.event){if(!a)continue;"wsf-section-repeatable"==O.event&&(O.event="wsf-section-repeatable-"+d);var S=this.form_canvas_obj;y=null}else if("wsf-rendered"==O.event||"wsf-submit"==O.event||"wsf-save"==O.event||"wsf-submit wsf-save"==O.event||"wsf-submit-complete"==O.event||"wsf-save-complete"==O.event||"wsf-complete"==O.event||"wsf-submit-error"==O.event||"wsf-save-error"==O.event||"wsf-error"==O.event||"wsf-submit-success"==O.event||"wsf-save-success"==O.event||"wsf-success"==O.event)S=e(document),y=null;else{S=this.form_canvas_obj;switch(O.object){case"form":y=null;break;case"group":y="["+s+'="#'+this.form_id_prefix+"group-"+d+'"]';break;case"section":y='[id^="'+this.esc_selector(this.form_id_prefix+O.object+"-"+O.object_id)+'"][data-id="'+this.esc_selector(O.object_id)+'"]';break;case"field":var W=this.field_data_cache[d];switch(W.type){case"radio":case"price_radio":case"checkbox":case"price_checkbox":y='[name^="'+this.esc_selector(ws_form_settings.field_prefix+d)+'["],[name^="'+this.esc_selector(ws_form_settings.field_prefix+d)+'["] ~ label';break;case"select":case"price_select":if(this.get_object_meta_value(W,"select2",!1)&&-1!==["click","mousedown","mouseup","mouseover","mouseout","touchstart","touchmove","touchend","touchcancel"].indexOf(O.event))if(A)y='[id^="'+this.esc_selector(this.form_id_prefix+O.object+"-wrapper-"+O.object_id)+'-repeat-"] .select2';else y="#"+this.esc_selector(this.form_id_prefix+O.object+"-wrapper-"+O.object_id)+" .select2";else if(A)y='[id^="'+this.esc_selector(this.form_id_prefix+O.object+"-"+O.object_id)+'-repeat-"]';else y="#"+this.esc_selector(this.form_id_prefix+O.object+"-"+O.object_id);break;default:if(A)y='[id^="'+this.esc_selector(this.form_id_prefix+O.object+"-"+O.object_id)+'-repeat-"]';else y="#"+this.esc_selector(this.form_id_prefix+O.object+"-"+O.object_id)}}}if(O.create&&!1!==O.event&&!1!==y){var F=0,P=e(y);if(P.each(function(){e(this).attr("data-init-conditional")&&F++}),0===F)switch(O.event){case"recaptcha":this.recaptchas_conditions.push(function(){i.conditional_process(t,!1,P,0,!1)});break;case"hcaptcha":this.hcaptchas_conditions.push(function(){i.conditional_process(t,!1,P,0,!1)});break;case"turnstile":this.turnstiles_conditions.push(function(){i.conditional_process(t,!1,P,0,!1)});break;default:if(null===y&&(y="null"),void 0===this.conditional_event_selector_to_condition[y]&&(this.conditional_event_selector_to_condition[y]=[]),void 0===this.conditional_event_selector_to_condition[y][O.event]&&(this.conditional_event_selector_to_condition[y][O.event]={object_event_selector:y,object_event_obj:S,conditionals:[],event_processed:!1}),-1===this.conditional_event_selector_to_condition[y][O.event].conditionals.indexOf(t)&&this.conditional_event_selector_to_condition[y][O.event].conditionals.push(t),ws_form_settings.debug){var D=e(y,this.form_canvas_obj).attr("data-populate-event"),I=D?D.split(" "):[];I.push(O.event),D=(I=I.filter(function(e,t,a){return a.indexOf(e)===t})).join(" "),e(y,this.form_canvas_obj).attr("data-populate-event",D)}}}}}}}},e.WS_Form.prototype.conditional_event_get=function(t,a,i,s,o,r){void 0===r&&(r=!1);var c={object:t,object_id:a,object_row_id:i,create:!0,event:!1,row:!1,repeatable:r};switch(t){case"field":var _=e.WS_Form.field_type_cache[s.type];void 0!==_.conditional&&(void 0!==_.conditional.exclude_condition&&(c.create=!_.conditional.exclude_condition),void 0!==_.conditional.condition_event&&(c.event=_.conditional.condition_event),void 0!==_.conditional["object_event.row"]&&_.conditional["object_event.row"]&&!1!==i&&(c.row=!0))}var n=e.WS_Form.settings_form.conditional.objects[t].logic;return void 0!==n[o]&&void 0!==n[o].event&&(c.event=n[o].event),c},e.WS_Form.prototype.conditional_process=function(t,a,i,s,o){if(void 0===t.if)return!1;if(void 0===t.then)return!1;if(void 0===t.else)return!1;var r=!1;for(var c in t.if)if(t.if.hasOwnProperty(c)){var _=t.if[c];if(void 0!==_.conditions){var n=!1,d=[];for(var l in _.conditions)if(_.conditions.hasOwnProperty(l)){var h=_.conditions[l];if(this.conditional_condition_check(h)){var u=h.object,f=h.object_id,v=h.logic,b=h.value,p=void 0===h.case_sensitive||h.case_sensitive,m=l>0?void 0===h.logic_previous?"||":h.logic_previous:"||",g=ws_form_settings.field_prefix+f,k=void 0===h.force_result?null:h.force_result;switch(u){case"form":var w=!1,y="#"+this.esc_selector(this.form_obj_id);break;case"group":w=!1,y="#"+this.esc_selector(this.form_id_prefix+"group-"+f);break;case"section":w=!1,y="#"+this.esc_selector(this.form_id_prefix+u+"-"+f);break;case"field":w=this.get_object_row_id(h);if(!s){var j=this.field_data_cache[f];if("object"==typeof j&&void 0!==j.section_id&&"object"==typeof this.section_data_cache[j.section_id]){var x=this.section_data_cache[j.section_id];if(this.get_object_meta_value(x,"section_repeatable"))return}}var q=s>0?"-repeat-"+s:"",O=(y="#"+this.esc_selector(this.form_id_prefix+u+"-"+f+q),e('[data-type][data-id="'+this.esc_selector(f)+'"]'+(s>0?'[data-repeatable-index="'+this.esc_selector(s)+'"]':""),this.form_canvas_obj))}if(e.WS_Form.debug_rendered){switch(u){case"form":var A=this.form;break;case"group":A=this.group_data_cache[f];break;case"section":A=this.section_data_cache[f];break;case"field":A=this.field_data_cache[f]}if(void 0!==A){var S=e.WS_Form.settings_form.conditional,W=S.logic_previous,F=S.objects[u].logic;if(void 0!==F[v])var P=F[v].text.toUpperCase();else P="";if(void 0!==W[m])var D=W[m].text.toUpperCase();else D="";d.push(""+(l>0?D+" ":"")+"["+this.esc_html(A.label)+"] "+P+(""!=b?" '"+this.esc_html(b)+"'":"")+" ("+(void 0!==A.type?"Type: "+A.type+" | ":"")+"ID: "+f+(!1!==w?" | Row ID: "+w.join(", "):"")+")")}}var I=e(y,this.form_canvas_obj),C=I.length?I.val():"";!p&&C&&("string"==typeof C&&(C=C.toLowerCase()),"string"==typeof b&&(b=b.toLowerCase()));if(-1!==["r==","r!=","r>","r<","r>=","r<="].indexOf(v)){var z=e('[data-repeatable][data-id="'+this.esc_selector(f)+'"]',this.form_canvas_obj);if(!z.length)continue;C=z.length}b=this.parse_variables_process(b).output;switch(v){case"d==":case"d!=":case"d>":case"d<":case"d>=":case"d<=":if(!1!==(Z=void 0!==this.field_data_cache[f]&&this.field_data_cache[f])){var N=this.get_object_meta_value(Z,"input_type_datetime","date"),T=this.get_object_meta_value(Z,"format_date",ws_form_settings.date_format);T||(T=ws_form_settings.date_format),b=this.get_date(b,N,T),C=this.get_date(C,N,T)}break;case"==":case"!=":case">":case"<":case">=":case"<=":var Z;if(!1!==(Z=void 0!==this.field_data_cache[f]&&this.field_data_cache[f])){switch(Z.type){case"price":case"price_subtotal":case"cart_price":case"cart_total":C=this.get_number(C,0,!0);break;default:C=this.get_number(C,0,!1)}b=parseFloat(b)}}var E=!1;switch(v){case"==":E=C==b;break;case"!=":E=C!=b;break;case">":E=C>b;break;case"<":E=C=":E=C>=b;break;case"<=":E=C<=b;break;case"d==":""!=C&&""!=b&&(E=Date.parse(C)==Date.parse(b));break;case"d!=":""!=C&&""!=b&&(E=Date.parse(C)!=Date.parse(b));break;case"d>":""!=C&&""!=b&&(E=Date.parse(C)>Date.parse(b));break;case"d<":""!=C&&""!=b&&(E=Date.parse(C)=":""!=C&&""!=b&&(E=Date.parse(C)>=Date.parse(b));break;case"d<=":""!=C&&""!=b&&(E=Date.parse(C)<=Date.parse(b));break;case"rc==":case"rc!=":E=(C=e('input[type="checkbox"]:not([data-wsf-select-all]):checked',O).length)==this.get_number(b),"rc!="==v&&(E=!E);break;case"rc>":E=(C=e('input[type="checkbox"]:not([data-wsf-select-all]):checked',O).length)>this.get_number(b);break;case"rc<":E=(C=e('input[type="checkbox"]:not([data-wsf-select-all]):checked',O).length)":E=(C=e("option:not([data-placeholder]):selected",O).length)>this.get_number(b);break;case"rs<":E=(C=e("option:not([data-placeholder]):selected",O).length)":""!=C&&(E=this.get_number(C)>this.get_number(b));break;case"r<":""!=C&&(E=this.get_number(C)=":""!=C&&(E=this.get_number(C)>=this.get_number(b));break;case"r<=":""!=C&&(E=this.get_number(C)<=this.get_number(b));break;case"section_repeatable":t.last_state[s]="",E=o.type=="wsf-section-repeatable-"+f;break;case"equals":case"c==":E=C==b;break;case"equals_not":case"c!=":E=C!=b;break;case"contains":case"contains_not":E=-1!=C.indexOf(b),"contains_not"==v&&(E=!E);break;case"starts":case"starts_not":E=C.startsWith(b),"starts_not"==v&&(E=!E);break;case"ends":case"ends_not":E=C.endsWith(b),"ends_not"==v&&(E=!E);break;case"blank":case"blank_not":E=""==C,"blank_not"==v&&(E=!E);break;case"checked":case"checked_not":E=!1;if("object"!=typeof w)break;for(var L in w)if(w.hasOwnProperty(L)){var R=w[L],U="#"+this.esc_selector(this.form_id_prefix+u+"-"+f+"-row-"+R+q);E|=e(U,this.form_canvas_obj).is(":checked")}"checked_not"==v&&(E=!E);break;case"checked_any":case"checked_any_not":E=e("input:checked",O).length>0,"checked_any_not"==v&&(E=!E);break;case"checked_all":case"checked_all_not":var Q=e("input:not([disabled])",O),$=Q.filter(":checked");E=Q.length==$.length;"checked_all_not"==v&&(E=!E);break;case"checked_value_equals":case"checked_value_equals_not":E=e('input[value="'+this.esc_selector(b)+'"]:checked',O).length;"checked_value_equals_not"==v&&(E=!E);break;case"selected":case"selected_not":E=!1;if("object"!=typeof w)break;for(var L in w)if(w.hasOwnProperty(L)){R=w[L];E|=e('option[data-id="'+this.esc_selector(R)+'"]',e(y,this.form_canvas_obj)).prop("selected")}"selected_not"==v&&(E=!E);break;case"selected_any":case"selected_any_not":E=e("option:not([data-placeholder]):selected",e(y,this.form_canvas_obj)).length>0;"selected_any_not"==v&&(E=!E);break;case"selected_all":case"selected_all_not":var J=e("option:not([data-placeholder],[disabled])",e(y,this.form_canvas_obj)),K=J.filter(":selected");E=J.length==K.length;"selected_all_not"==v&&(E=!E);break;case"selected_value_equals":case"selected_value_equals_not":E=e('option[value="'+this.esc_selector(b)+'"]',e(y,this.form_canvas_obj)).prop("selected");"selected_value_equals_not"==v&&(E=!E);break;case"regex_email":case"regex_email_not":E=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(C),"regex_email_not"==v&&(E=!E);break;case"regex_url":case"regex_url_not":E=/[-a-zA-Z0-9@:%_\+.~#?&\/\/=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)?/gi.test(C),"regex_url_not"==v&&(E=!E);break;case"regex":case"regex_not":E=new RegExp(b).test(C),"regex_not"==v&&(E=!E);break;case"wsf-rendered":case"wsf-submit":case"wsf-submit-complete":case"wsf-submit-success":case"wsf-submit-error":case"wsf-save":case"wsf-save-complete":case"wsf-save-success":case"wsf-save-error":case"wsf-submit-save":case"wsf-complete":case"wsf-success":case"wsf-error":case"click":case"mousedown":case"mouseup":case"mouseover":case"mouseout":case"touchstart":case"touchmove":case"touchend":case"touchcancel":case"focus":case"blur":case"change":case"change_input":case"input":case"keyup":case"keydown":t.last_state[s]="",E=v==o.type||void 0!==o.handleObj&&void 0!==o.handleObj.origType&&v==o.handleObj.origType||"wsf-"+v==o.type||"change_input"==v&&-1!=["change","input"].indexOf(o.type)||"wsf-submit-save"==v&&-1!=["wsf-submit","wsf-save"].indexOf(o.type);break;case"token_validated":case"token_validated_not":E=!1!==this.submit&&void 0!==this.submit.token_validated&&this.submit.token_validated,"token_validated_not"==v&&(E=!E);break;case"user_logged_in":case"user_logged_in_not":case"user_role":case"user_role_not":case"user_capability":case"user_capability_not":E=k;break;case"ch>":E=360*this.hex_to_hsl(C).h>b;break;case"ch<":E=360*this.hex_to_hsl(C).h":E=100*this.hex_to_hsl(C).s>b;break;case"cs<":E=100*this.hex_to_hsl(C).s":E=100*this.hex_to_hsl(C).l>b;break;case"cl<":E=100*this.hex_to_hsl(C).l0,"recaptcha_not"==v&&(E=!E);break;case"hcaptcha":case"hcaptcha_not":this.hcaptcha_get_response_by_name,E="string"==typeof(B=this.hcaptcha_get_response_by_name(g))&&B.length>0,"hcaptcha_not"==v&&(E=!E);break;case"turnstile":case"turnstile_not":var B;this.turnstile_get_response_by_name,E="string"==typeof(B=this.turnstile_get_response_by_name(g))&&B.length>0,"turnstile_not"==v&&(E=!E);break;case"signature":case"signature_not":this.signature_get_response_by_name,E=this.signature_get_response_by_name(g),"signature_not"==v&&(E=!E);break;case"file":case"file_not":this.file_get_count_by_field_id,E=this.file_get_count_by_field_id(f)>0,"file_not"==v&&(E=!E);break;case"f>":this.file_get_count_by_field_id,E=this.file_get_count_by_field_id(f)>b;break;case"f<":this.file_get_count_by_field_id,E=this.file_get_count_by_field_id(f)0){var H="#"+this.form_id_prefix+"field-"+G+(s>0?"-repeat-"+s:"");E=e(H,this.form_canvas_obj).val()==C,"field_match_not"==v&&(E=!E)}break;case"cc==":E=C.length==parseInt(b,10);break;case"cc!=":E=C.length!=parseInt(b,10);break;case"cc>":E=C.length>parseInt(b,10);break;case"cc<":E=C.length":E=this.get_word_count(C)>parseInt(b,10);break;case"cw<":E=this.get_word_count(C)0?void 0===_.logic_previous?"||":_.logic_previous:"||";r=this.conditional_logic_previous(r,n,m)}}var M=!1;if(r?!0===t.last_state[s]&&void 0!==t.last_state[s]||(M="then",t.last_state[s]=!0):!1===t.last_state[s]&&void 0!==t.last_state[s]||(M="else",t.last_state[s]=!1),!1!==M){var V=t[M];V.length&&(this.log("log_conditional_fired_"+M,"("+this.esc_html(t.label)+") "+d.join(" "),"conditional"),this.conditional_process_actions(V,M,i,s))}!a&&this.has_ecommerce&&"function"==typeof this.form_ecommerce_calculate&&this.form_ecommerce_calculate()},e.WS_Form.prototype.conditional_process_actions=function(t,a,i,s){var o=0,r=!1,c=!1,_=!1,n=this;for(var d in t)if(t.hasOwnProperty(d)){var l=t[d];if(this.conditional_action_check(l)){var h=l.object,u=l.object_id,f=this.get_object_row_id(l),v=l.action;switch(h){case"form":var b=n.form_obj,p=n.form_obj,m=void 0!==l.value&&this.parse_variables_process(l.value,!1,!1,!1,!1,!1).output,g=this.conditional_process_action(a,v,b,p,h,u,!1,m,!1);r=r||g.process_required,c=c||g.process_bypass,_=_||g.process_navigation;break;case"group":var k="#"+this.esc_selector(this.form_id_prefix+"group-"+u);b=p=e(k,this.form_canvas_obj),m=void 0!==l.value&&this.parse_variables_process(l.value,!1,!1,!1,!1,!1).output,g=this.conditional_process_action(a,v,b,p,h,u,!1,m,!1);r=r||g.process_required,c=c||g.process_bypass,_=_||g.process_navigation;break;case"section":var w=this.get_section_id(i);if(!(j=e('[id^="'+this.esc_selector(this.form_id_prefix)+'section-"][data-id="'+this.esc_selector(u)+'"]',this.form_canvas_obj)).length)break;var y=j.first();w===parseInt(u,10)&&y.attr("data-repeatable-index")&&(j=j.filter('[data-repeatable-index="'+this.esc_selector(s)+'"]')),j.each(function(){var t=void 0!==e(this).attr("data-repeatable-index")&&e(this).attr("data-repeatable-index"),i=void 0!==l.value&&n.parse_variables_process(l.value,t,!1,!1,!1,!1,!1).output,s=n.conditional_process_action(a,v,e(this),e(this),h,u,!1,i,t);r=r||s.process_required,c=c||s.process_bypass,_=_||s.process_navigation});break;case"field":var j;w=this.get_section_id(i);if(!(j=e('[id^="'+this.esc_selector(this.form_id_prefix)+'field-wrapper-"][data-id="'+this.esc_selector(u)+'"],input[type="hidden"][data-id-hidden="'+this.esc_selector(u)+'"]',this.form_canvas_obj)).length)break;y=j.first();w===this.get_section_id(y.first())&&y.attr("data-repeatable-index")&&(j=j.filter('[data-repeatable-index="'+this.esc_selector(s)+'"]')),j.each(function(){var t=void 0!==e(this).attr("data-repeatable-index")&&e(this).attr("data-repeatable-index"),i=!1!==t?"-repeat-"+t:"";if("object"==typeof f){var s=[];for(var o in f)if(f.hasOwnProperty(o)){var d=f[o];s.push("#"+n.esc_selector(n.form_id_prefix+"field-"+u+"-row-"+d+i))}var b=s.join(", ")}else b="#"+n.esc_selector(n.form_id_prefix+"field-"+u+i);var p=e(b,n.form_canvas_obj),m=void 0!==n.field_data_cache[u]&&n.field_data_cache[u],g=void 0!==l.value&&n.parse_variables_process(l.value,t,!1,m,!1,!1,!1).output,k=n.conditional_process_action(a,v,e(this),p,h,u,f,g,t);r=r||k.process_required,c=c||k.process_bypass,_=_||k.process_navigation});break;case"action":m=void 0!==l.value&&n.parse_variables_process(l.value,!1,!1,!1,!1,!1).output,g=n.conditional_process_action(a,v,e(this),!1,h,u,!1,m,!1);r=r||g.process_required,c=c||g.process_bypass,_=_||g.process_navigation}o++}}return r&&("function"==typeof this.form_progress&&this.form_progress(),this.form_required()),c&&this.form_bypass(!0)&&"function"==typeof this.form_tab_validation_process&&this.form_tab_validation_process(),_&&this.form_navigation(),o},e.WS_Form.prototype.conditional_process_action=function(t,a,i,s,o,r,c,_,n){void 0===_&&(_="");var d=void 0!==this.framework.tabs.public.selector_href?this.framework.tabs.public.selector_href:"href",l=ws_form_settings.field_prefix+r+(n?"["+n+"]":""),h=_,u=!1,f=!1,v=!1,b=!1;switch(a){case"value":case"value_number":case"value_datetime":case"value_tel":case"value_email":case"value_textarea":case"value_url":case"value_range":case"value_rating":case"value_color":case"html":case"text_editor":case"button_html":this.field_value_set(i,s,_);break;case"class_add_wrapper":i.addClass(_),u="debug_action_added";break;case"class_remove_wrapper":i.removeClass(_),u="debug_action_removed";break;case"class_add_field":s.addClass(_),u="debug_action_added";break;case"class_remove_field":s.removeClass(_),u="debug_action_removed";break;case"reset_signature":"function"==typeof this.signature_clear_by_name&&(this.signature_clear_by_name(l),u="debug_action_reset");break;case"value_row_select":case"value_row_deselect":s.each(function(){if(e(this).is(":enabled")){var t=e(this).prop("selected")!==("value_row_select"==a);e(this).prop("selected",!1).prop("selected","value_row_select"==a),t&&e(this).closest("select").trigger("change")}}),u="debug_action_"+("value_row_select"==a?"selected":"deselected");break;case"value_row_select_value":case"value_row_deselect_value":var p="value_row_select_value"==a;this.field_value_set(i,s,_,p),u="debug_action_"+(p?"selected_value":"deselected_value");break;case"value_row_select_all":case"value_row_deselect_all":e("option",i).each(function(){if(e(this).is(":enabled")){var t=e(this).prop("selected")!==("value_row_select_all"==a);e(this).prop("selected",!1).prop("selected","value_row_select_all"==a),t&&e(this).closest("select").trigger("change"),u="debug_action_"+("value_row_select_all"==a?"selected":"deselected")}});break;case"value_row_reset":e("option:selected:enabled",i).prop("selected",!1).trigger("change"),u="debug_action_reset";break;case"value_row_check":case"value_row_uncheck":s.each(function(){if(e(this).is(":enabled")){var t=e(this).prop("checked")!==("value_row_check"==a);e(this).prop("checked","value_row_check"==a),t&&e(this).trigger("change")}}),u="debug_action_"+("value_row_check"==a?"checked":"unchecked");break;case"value_row_check_value":case"value_row_uncheck_value":p="value_row_check_value"==a;this.field_value_set(i,s,_,p),u="debug_action_"+(p?"checked":"unchecked");break;case"value_row_check_all":case"value_row_uncheck_all":e('input[type="checkbox"]',i).each(function(){if(e(this).is(":enabled")){var t=e(this).prop("checked")!==("value_row_check_all"==a);e(this).prop("checked","value_row_check_all"==a),t&&e(this).trigger("change"),u="debug_action_"+("value_row_check_all"==a?"checked":"unchecked")}});break;case"value_row_required":case"value_row_not_required":s.prop("required","value_row_required"==a).removeAttr("data-init-required"),"value_row_required"==a?s.attr("data-required","").attr("aria-required","true").removeAttr("data-conditional-logic-bypass"):s.removeAttr("data-required").removeAttr("aria-required").attr("data-conditional-logic-bypass",""),u="debug_action_"+("value_row_required"==a?"required":"not_required"),f=!0,v=!0;break;case"value_row_disabled":case"value_row_not_disabled":s.attr("disabled","value_row_disabled"==a),void 0!==s.parent().attr("data-wsf-select2")&&"function"==typeof this.form_select2&&this.form_select2(s.parent()),u="debug_action_"+("value_row_disabled"==a?"disabled":"enabled");break;case"value_row_visible":case"value_row_not_visible":"value_row_not_visible"===a?s.parent().hide():s.parent().show(),u="debug_action_"+("value_row_not_visible"==a?"hide":"show");break;case"value_row_focus":s.trigger("focus"),u="debug_action_focussed";break;case"value_row_class_add":s.addClass(_),u="debug_action_added";break;case"value_row_class_remove":s.removeClass(_),u="debug_action_removed";break;case"value_row_set_custom_validity":this.set_invalid_feedback(s,_,c),v=!0;break;case"min":case"max":case"step":case"low":case"high":case"optimum":_=""!=_&&this.get_float(_,0),this.obj_set_attribute(s,a,_);break;case"min_int":case"max_int":case"step_int":var m=a.replace("_int","");_=""!=_&&this.get_number(_,0,!1),this.obj_set_attribute(s,m,_);break;case"min_date":case"max_date":case"min_time":case"max_time":if("function"==typeof s.datetimepicker)switch(a){case"min_date":s.datetimepicker("setOptions",{minDate:_});break;case"max_date":s.datetimepicker("setOptions",{maxDate:_});break;case"min_time":s.datetimepicker("setOptions",{minTime:_});break;case"max_time":s.datetimepicker("setOptions",{maxTime:_})}break;case"ecommerce_price_min":case"ecommerce_price_max":_=""!=_&&this.get_float(_,0);var g=s.val();this.obj_set_attribute(s,"data-ecommerce-"+("ecommerce_price_min"===a?"min":"max"),_),"function"==typeof this.form_ecommerce_input_mask_currency&&this.form_ecommerce_input_mask_currency(s),s.val()!==g&&s.trigger("change");break;case"select_min":case"select_max":var k="select_min"===a?"min":"max";_=""!=_&&this.get_number(_,0,!1);var w=void 0===i.attr("data-select-min-max-init");if(!1!==_?i.attr("data-select-"+k,_):i.removeAttr("data-select-"+k),w)"function"==typeof this.form_select_min_max&&this.form_select_min_max();else{var y=e('input[type="number"]',i);this.obj_set_attribute(y,k,_)}break;case"checkbox_min":case"checkbox_max":k="checkbox_min"===a?"min":"max";_=""!=_&&this.get_number(_,0,!1);var j=void 0===i.attr("data-checkbox-min-max-init");if(!1!==_?i.attr("data-checkbox-"+k,_):i.removeAttr("data-checkbox-"+k),j)"function"==typeof this.form_checkbox_min_max&&this.form_checkbox_min_max();else{y=e('input[type="number"]',i);this.obj_set_attribute(y,k,_)}break;case"visibility":switch(o){case"group":var x=e("["+d+'="#'+this.esc_selector(this.form_id_prefix+"group-"+r)+'"]',this.form_canvas_obj).parent();if("off"===_){if(i.is(":visible")){var q=e('[id^="'+this.esc_selector(this.form_id_prefix)+'group-"]:not([data-wsf-group-hidden])');if(q.length){var O=q.first().attr("id");e("["+d+'="#'+this.esc_selector(O)+'"]').trigger("click")}}x.attr("data-wsf-group-hidden","").hide().attr("aria-live","polite").attr("aria-hidden","true"),i.attr("data-wsf-group-hidden","").attr("aria-live","polite").attr("aria-hidden","true"),u="debug_action_hide"}else x.removeAttr("data-wsf-group-hidden").show().removeAttr("aria-hidden"),i.removeAttr("data-wsf-group-hidden").removeAttr("aria-hidden"),u="debug_action_show";v=!0,b=!0;break;case"section":case"field":"off"===_?(i.hide().attr("aria-live","polite").attr("aria-hidden","true"),v=!0,u="debug_action_hide"):(i.show().removeAttr("aria-hidden"),v=!0,"function"==typeof this.signatures_redraw&&("section"==o&&this.signatures_redraw(!1,r),"field"==o&&this.signatures_redraw(!1,!1,r)),u="debug_action_show")}break;case"set_row_count":if(!(T=e('[data-repeatable][data-id="'+this.esc_selector(r)+'"]',this.form_canvas_obj)).length)break;var A=T.length;if(isNaN(_))break;var S=parseInt(_,10),W=this.section_data_cache[r],F=this.get_object_meta_value(W,"section_repeat_min",1);(F=""==F||isNaN(F)?1:parseInt(F,10))<1&&(F=1);var P=this.get_object_meta_value(W,"section_repeat_max",!1);if(SP&&(S=P),AS){for(var z=A-S,N=0;N ("+this.language("debug_action_type")+": "+B+" | ID: "+r+(!1!==c?" | "+this.language("debug_action_row")+" ID: "+c.join(", "):"")+")";this.log("log_conditional_action_"+t,X,"conditional")}}return{process_required:f,process_bypass:v,process_navigation:b}},e.WS_Form.prototype.obj_set_attribute=function(e,t,a){void 0!==e.attr("data-"+t+"-bypass")?!1!==a?e.attr("data-"+t+"-bypass",a).trigger("change"):e.removeAttr("data-"+t+"-bypass").trigger("change"):!1!==a?e.attr(t,a).trigger("change"):e.removeAttr(t).trigger("change")},e.WS_Form.prototype.conditional_logic_previous=function(e,t,a){switch(a){case"||":e|=t;break;case"&&":e&=t}return e},e.WS_Form.prototype.conditional_condition_check=function(e){return!(null===e||"object"!=typeof e||void 0===e.id||void 0===e.object||void 0===e.object_id||void 0===e.object_row_id||void 0===e.logic||void 0===e.value||void 0===e.case_sensitive||void 0===e.logic_previous||""==e.id||0==e.id||""==e.object||""==e.object_id||""==e.logic)},e.WS_Form.prototype.conditional_action_check=function(e){return!(null===e||"object"!=typeof e||void 0===e.object||void 0===e.object_id||void 0===e.action||""==e.object||""==e.object_id||""==e.action)}}(jQuery);