"use strict";function arf_display_field_conversion_option_after_save(){jQuery("#arf_field_type_converter").show()}function arf_set_field_type_option_for_field_type_converter(e,r){if("field_type_converter"==e&&jQuery("#arf_field_type_conversion_array").length>0){var t=arf_parse_json(Base64.decode(jQuery("#arf_field_type_conversion_array").val()));if(jQuery("#arf_current_field_type").val(r),jQuery(".arf_ar_dropdown_wrapper_note_current_type").css("display","none"),jQuery('ul[data-id="field_type_to_convert"]').find("li").removeAttr("data-field-in-condition"),jQuery('ul[data-id="field_type_to_convert"]').find("li").removeClass("arfhidden").addClass("arfvisible"),"undefined"!=typeof r&&""!=r){if(jQuery(".arf_current_field_type").html(t[r]),jQuery(".arf_ar_dropdown_wrapper_note_current_type").css("display","block"),jQuery('ul[data-id="field_type_to_convert"]').find('li[data-type="'+r+'"]').removeClass("arfvisible").addClass("arfhidden"),jQuery("#field_type_to_convert").val()==r){var _=jQuery('ul[data-id="field_type_to_convert"]').find("li:first-child").attr("data-label");jQuery("#field_type_to_convert").val(""),jQuery('dl[data-name="field_type_to_convert"]').find("dt span").html(_)}}else jQuery(".arf_current_field_type").html("");var a=jQuery("#arf_current_field_type").val(),o=jQuery("#field_type_to_convert").val(),n="",d="<li>"+t[a]+field_convert_part1+t[o]+arf_type_text+"</li>",i="",l="",f="<li>"+field_converting_part1+t[a]+" "+field_converting_type_to+" "+t[o]+" "+field_converting_part2+" "+t[a]+" "+field_coverting_to_text+" "+t[o]+". "+field_converting_part3+"</li>",p='<li class="field-covertnotice-nbsp">&nbsp;</li><li>'+field_converting_notice+"</li>";n=f+p,d+=f+p,i=f+p,"checkbox"==a?"radio"!=o&&"select"!=o?jQuery(".arf_ar_dropdown_wrapper_note_changing_type").html(d):jQuery(".arf_ar_dropdown_wrapper_note_changing_type").html(n):"radio"==a?"checkbox"!=o&&"select"!=o?jQuery(".arf_ar_dropdown_wrapper_note_changing_type").html(d):jQuery(".arf_ar_dropdown_wrapper_note_changing_type").html(n):"select"==a?"radio"!=o&&"checkbox"!=o?jQuery(".arf_ar_dropdown_wrapper_note_changing_type").html(d):jQuery(".arf_ar_dropdown_wrapper_note_changing_type").html(n):"email"==a?jQuery(".arf_ar_dropdown_wrapper_note_changing_type").html(i+l):jQuery(".arf_ar_dropdown_wrapper_note_changing_type").html(i),""!=a&&""!=o?jQuery(".arf_ar_dropdown_wrapper_note_changing_type").show():jQuery(".arf_ar_dropdown_wrapper_note_changing_type").hide()}}function arf_update_type_conversion_list(e,r,t){var _=arf_parse_json(Base64.decode(jQuery("#arf_field_type_conversion_array").val()));if("undefined"==typeof _[r])return!1;var a=""!=jQuery("#arf_field_order").attr("data-db-field-order")?JSON.parse(jQuery("#arf_field_order").attr("data-db-field-order")):null,o=""!=jQuery("#arf_inner_field_order").attr("data-db-field-order")?JSON.parse(jQuery("#arf_inner_field_order").attr("data-db-field-order")):null,n=(arf_retrieve_field_data(e),[]),d=String(e);if(null!=a&&""!=a){var i=Object.keys(a);i.indexOf(d)>-1&&n.push(d)}if(null!=o&&""!=o){var l=Object.keys(o);if(l.length>0)for(var f=0;f<l.length;f++){var p=l[f];if(null!=o[p])for(var y=o[p].length,c=0;y>c;c++){var s=o[p][c].split("|"),u=s[0];n.push(u)}}}if(-1==n.indexOf(d))return!1;for(var v=document.getElementsByClassName("arf_change_type_conversion_dropdown"),h=v.length,j=0;h>j;j++){var g=v[j];if(null!=g.querySelector('li[data-value="'+e+'"]'))g.querySelector('li[data-value="'+e+'"]').innerHTML=t,g.querySelector('li[data-value="'+e+'"]').setAttribute("data-label",t),g.querySelector('li[data-value="'+e+'"]').setAttribute("data-type",r);else{var w=document.createElement("li");w.setAttribute("class","arf_selectbox_option"),w.setAttribute("data-type",r),w.setAttribute("data-value",e),w.setAttribute("data-label",t),w.appendChild(document.createTextNode(t)),g.appendChild(w)}}}function arf_delete_type_conversion_list(e,r){jQuery(".arf_change_type_conversion_dropdown").find("li[data-value='"+r+"']").remove()}jQuery(document).ready(function(){wp.hooks.addAction("arf_after_save_form_first_time","arforms",arf_display_field_conversion_option_after_save,10),wp.hooks.addAction("arf_set_field_type_for_outside_options","arforms",arf_set_field_type_option_for_field_type_converter,10),wp.hooks.addAction("arf_update_name_dropdown_outside","arforms",arf_update_type_conversion_list,10),wp.hooks.addAction("arf_delete_name_dropdown_outside","arforms",arf_delete_type_conversion_list,10)});