var getElementskitAllFields=function(e,i){var n={};for(var r of i){var t=e.find(".elementor-field-group-"+r);if(t.length){n[r]={wrapper:t};var a=t.find(`[name=form_fields\\[${r}\\]]`);a.length?n[r].inputs=a:n[r].inputs=t.find(`[name=form_fields\\[${r}\\]\\[\\]]`)}}return n},getElementskitFieldsValues=function(e){var i={};for(var n in e){var r=e[n].inputs;if(1===r.length){var t=r.attr("type");"checkbox"===t||"radio"===t?r.prop("checked")?i[n]=r.val():i[n]="":i[n]=r.val()}else{var a=[];r.each(((e,i)=>{i.checked&&a.push(i.value)})),"radio"===r.attr("type")?i[n]=a[0]:i[n]=a.length?a:""}}return i},getElementskitOnFormChange=function({fields:e,field_conditions:i,$form:n}){return function(){!function(n){for(const k of i){var r=k.condition.split(/&&/),t=!0;for(var a of r){var o=a.split(/\|\|\s|\sOR/),l=!1;for(splitedByOrFinalCondition of o){splitedByOrFinalCondition=splitedByOrFinalCondition.replace(/^\(/,""),splitedByOrFinalCondition=splitedByOrFinalCondition.replace(/\)$/,"");var s="",d="",f="";for(conOperator of["==","!=",">=","<=",">","<"]){var p=splitedByOrFinalCondition.split(conOperator);if(2==p.length){s=conOperator,d=p[0].replace(/\s/g,""),f=(f=p[1].trim().replace(/^'+|'+$/g,"")).trim().replace(/^"+|"+$/g,"");break}}var c=n[d];switch(s){case"==":Array.isArray(c)?c.map((e=>e.trim())).includes(f)&&(l=!0):c==f&&(l=!0);break;case"!=":Array.isArray(c)?c.includes(f)||(l=!0):c!=f&&(l=!0);break;case">=":c>=f&&(l=!0);break;case"<=":c<=f&&(l=!0);break;case">":c>f&&(l=!0);break;case"<":c<f&&(l=!0);break;default:l=!1}}l||(t=!1)}var m=k.mode,u=k.id;"show-if"==m?t?e[u].wrapper.show():e[u].wrapper.hide():t?e[u].wrapper.hide():e[u].wrapper.show()}}(getElementskitFieldsValues(e))}};function initializeElementskitConditionalFields(e){var i=e.find(".elementor-form-fields-wrapper"),n=i.attr("elementskit-field-conditions"),r=i.attr("elementskit-field-ids");if(n!==undefined){e.addClass("elementskit-form-has-conditions"),r=JSON.parse(r),n=JSON.parse("string"==typeof n?n:"[]");var t=getElementskitAllFields(e,r),a=getElementskitOnFormChange({fields:t,field_conditions:n,$form:e});a(),e.find("input, select, textarea").on("change paste keyup",a)}}jQuery(window).on("elementor/frontend/init",(function(){elementorFrontend.hooks.addAction("frontend/element_ready/form.default",initializeElementskitConditionalFields)}));