var acf={ajaxurl:"",admin_url:"",post_id:0,nonce:"",l10n:{},text:{},helpers:{uniqid:null,sortable:null,create_field:null},conditional_logic:null,location:null};!function($){function e(){$("#acf_fields .fields").each(function(){$(this).children(".field").each(function(e){$(this).find("td.field_order .circle").first().html(e+1)})})}$.fn.exists=function(){return $(this).length>0},acf.helpers.sortable=function(e,t){return t.children().each(function(){$(this).width($(this).width())}),t},acf.helpers.uniqid=function(e,t){"undefined"==typeof e&&(e="");var i,a=function(e,t){return e=parseInt(e,10).toString(16),te.length?Array(1+(t-e.length)).join("0")+e:e};return this.php_js||(this.php_js={}),this.php_js.uniqidSeed||(this.php_js.uniqidSeed=Math.floor(123456789*Math.random())),this.php_js.uniqidSeed++,i=e,i+=a(parseInt((new Date).getTime()/1e3,10),8),i+=a(this.php_js.uniqidSeed,5),t&&(i+=(10*Math.random()).toFixed(8).toString()),i};var t={init:function(){return $(document).on("submit","#post",this.submit),this},submit:function(e){var i=$("#titlewrap #title"),a=$("#submitdiv .spinner").last(),n=$('#submitdiv input[type="submit"]').last();i.val()||(e.preventDefault(),t.hide_spinner(a),t.enable_submit(n),alert(acf.l10n.title),i.focus())},hide_spinner:function(e){if(e.exists()){var t=acf.wp_version;parseFloat(t)>=4.2?e.removeClass("is-active"):e.css("display","none")}},enable_submit:function(e){e.exists()&&e.removeClass("disabled button-disabled button-primary-disabled")}}.init();$(document).on("click","#submit-delete",function(){var e=confirm(acf.l10n.move_to_trash);return e?void 0:!1}),$(document).on("change","#acf_fields tr.field_type select",function(){var e=$(this),t=e.closest("tbody"),i=t.closest(".field"),a=i.attr("data-type"),n=i.attr("data-id"),l=e.val();if(i.removeClass("field_type-"+a).addClass("field_type-"+l),i.attr("data-type",l),("tab"==l||"message"==l)&&t.find('tr.field_name input[type="text"]').val("").trigger("keyup"),t.children("tr.field_option_"+l).exists())t.children("tr.field_option").hide().find("[name]").attr("disabled","true"),t.children("tr.field_option_"+l).show().find("[name]").removeAttr("disabled");else{var o=$('
');t.children("tr.field_option").hide().find("[name]").attr("disabled","true"),t.children("tr.conditional-logic").exists()?t.children("tr.conditional-logic").before(o):t.children("tr.field_save").before(o);var c={action:"acf/field_group/render_options",post_id:acf.post_id,field_key:e.attr("name"),field_type:l,nonce:acf.nonce};$.ajax({url:ajaxurl,data:c,type:"post",dataType:"html",success:function(e){return e?void o.replaceWith(e):void o.remove()}})}}),$.fn.update_names=function(){var e=$(this),t=e.attr("data-id"),i="field_"+acf.helpers.uniqid();e.attr("data-id",i),e.attr("class",e.attr("class").replace(t,i)),e.find(".field_meta td.field_key").text(i),e.find('[id*="'+t+'"]').each(function(){$(this).attr("id",$(this).attr("id").replace(t,i))}),e.find('[name*="'+t+'"]').each(function(){$(this).attr("name",$(this).attr("name").replace(t,i))})},$(document).on("click","#acf_fields a.acf_edit_field",function(){var e=$(this).closest(".field");e.hasClass("form_open")?(e.removeClass("form_open"),$(document).trigger("acf/field_form-close",[e])):(e.addClass("form_open"),$(document).trigger("acf/field_form-open",[e])),e.children(".field_form_mask").animate({height:"toggle"},250)}),$(document).on("click","#acf_fields a.acf_delete_field",function(){var t=$(this),i=t.closest(".field"),a=i.closest(".fields"),n=$('
');i.animate({left:"50px",opacity:0},250,function(){i.before(n),i.remove(),a.children(".field").length<=1?(n.remove(),a.children(".no_fields_message").show()):n.animate({height:0},250,function(){n.remove()}),e()})}),$(document).on("click","#acf_fields a.acf_duplicate_field",function(){var t=$(this),i=t.closest(".field"),a=null;i.find("select").each(function(){$(this).attr("data-val",$(this).val())}),a=i.clone(),a.update_names(),a.find(".field:not(.field_key-field_clone)").each(function(){$(this).update_names()}),i.after(a),a.find("select").each(function(){$(this).val($(this).attr("data-val")).trigger("change")}),i.hasClass("form_open")?i.find(".acf_edit_field").first().trigger("click"):a.find(".acf_edit_field").first().trigger("click");var n=a.find('tr.field_label:first input[type="text"]'),l=a.find('tr.field_name:first input[type="text"]');l.val(""),n.val(n.val()+" ("+acf.l10n.copy+")"),n.trigger("blur").trigger("keyup"),e()}),$(document).on("click","#acf_fields #add_field",function(){var t=$(this).closest(".table_footer").siblings(".fields"),i=t.children(".field_key-field_clone").clone();return i.update_names(),i.show(),t.children(".field_key-field_clone").before(i),t.children(".no_fields_message").exists()&&t.children(".no_fields_message").hide(),i.find("tr.field_type select").trigger("change"),i.find('.field_form input[type="text"]').val(""),setTimeout(function(){i.find('.field_form input[type="text"]').first().focus()},500),i.find("a.acf_edit_field").first().trigger("click"),e(),!1}),$(document).on("blur","#acf_fields tr.field_label input.label",function(){var e=$(this),t=e.closest(".field"),i=t.find('tr.field_name:first input[type="text"]'),a=t.attr("data-type");if("tab"==a||"message"==a)return void i.val("").trigger("keyup");if(""==i.val()){var n=e.val(),l={"ä":"a","æ":"a","å":"a","ö":"o","ø":"o","é":"e","ë":"e","ü":"u","ó":"o","ő":"o","ú":"u","é":"e","á":"a","ű":"u","í":"i"," ":"_","'":"","\\?":""};$.each(l,function(e,t){var i=new RegExp(e,"g");n=n.replace(i,t)}),n=n.toLowerCase(),i.val(n),i.trigger("keyup")}}),$(document).on("keyup","#acf_fields .field_form tr.field_label input.label",function(){var e=$(this).val(),t=$(this).closest(".field").find("td.field_label strong a").first().html(e)}),$(document).on("keyup","#acf_fields .field_form tr.field_name input.name",function(){var e=$(this).val(),t=$(this).closest(".field").find("td.field_name").first().html(e)}),$(document).on("change","#acf_fields .field_form tr.field_type select",function(){var e=$(this).val(),t=$(this).find('option[value="'+e+'"]').html();$(this).closest(".field").find("td.field_type").first().html(t)}),$(document).on("mouseover","#acf_fields td.field_order",function(){var t=$(this).closest(".fields");return t.hasClass("sortable")?!1:void t.addClass("sortable").sortable({update:function(t,i){e()},handle:"td.field_order"})}),$(document).ready(function(){acf.location.init(),acf.conditional_logic.init()}),acf.location={$el:null,init:function(){var e=this;e.$el=$("#acf_location"),e.$el.on("click",".location-add-rule",function(){return e.add_rule($(this).closest("tr")),!1}),e.$el.on("click",".location-remove-rule",function(){return e.remove_rule($(this).closest("tr")),!1}),e.$el.on("click",".location-add-group",function(){return e.add_group(),!1}),e.$el.on("change",".param select",function(){var e=$(this).closest("tr"),t=e.attr("data-id"),i=e.closest(".location-group"),a=i.attr("data-id"),n={action:"acf/field_group/render_location",nonce:acf.nonce,rule_id:t,group_id:a,value:"",param:$(this).val()},l=$('
');e.find("td.value").html(l),$.ajax({url:acf.ajaxurl,data:n,type:"post",dataType:"html",success:function(e){l.replaceWith(e)}})})},add_rule:function(e){var t=e.clone(),i=t.attr("data-id"),a=acf.helpers.uniqid();return t.find("[name]").each(function(){$(this).attr("name",$(this).attr("name").replace(i,a)),$(this).attr("id",$(this).attr("id").replace(i,a))}),t.attr("data-id",a),e.after(t),!1},remove_rule:function(e){var t=e.siblings("tr").length;0==t?this.remove_group(e.closest(".location-group")):e.remove()},add_group:function(){var e=this.$el.find(".location-group:last"),t=e.clone(),i=t.attr("data-id"),a=acf.helpers.uniqid();t.find("[name]").each(function(){$(this).attr("name",$(this).attr("name").replace(i,a)),$(this).attr("id",$(this).attr("id").replace(i,a))}),t.attr("data-id",a),t.find("h4").text(acf.l10n.or),t.find("tr:not(:first)").remove(),e.after(t)},remove_group:function(e){e.remove()}},$(document).ready(function(){$("#submitdiv #publish").attr("class","acf-button large"),$("#submitdiv a.submitdelete").attr("class","delete-field-group").attr("id","submit-delete");var e=$("#hide-on-screen ul.acf-checkbox-list"),t=$('
  • ");0==e.find("input:not(:checked)").length&&t.find("input").attr("checked","checked"),t.on("change","input",function(){var t=$(this).is(":checked");e.find("input").attr("checked",t)}),e.prepend(t)}),$(document).on("change",'#adv-settings input[name="show-field_key"]',function(){"1"==$(this).val()?$("#acf_fields table.acf").addClass("show-field_key"):$("#acf_fields table.acf").removeClass("show-field_key")}),acf.helpers.create_field=function(e){var t={type:"text",classname:"",name:"",value:""};e=$.extend(!0,t,e);var i="";if("text"==e.type)i+='';else if("select"==e.type){var a={};$.each(e.choices,function(e,t){void 0===t.group&&(t.group=0),void 0===a[t.group]&&(a[t.group]=[]),a[t.group].push(t)}),i+='"}return i=$(i)},acf.conditional_logic={triggers:null,init:function(){var e=this;$(document).on("acf/field_form-open",function(t,i){e.render(i)}),$(document).on("change","#acf_fields tr.field_label input.label",function(){$("#acf_fields .field.form_open").each(function(){e.render($(this))})}),$(document).on("change",'tr.conditional-logic input[type="radio"]',function(t){t.preventDefault(),e.change_toggle($(this))}),$(document).on("change","select.conditional-logic-field",function(t){t.preventDefault(),e.change_trigger($(this))}),$(document).on("click","tr.conditional-logic .acf-button-add",function(t){t.preventDefault(),e.add($(this).closest("tr"))}),$(document).on("click","tr.conditional-logic .acf-button-remove",function(t){t.preventDefault(),e.remove($(this).closest("tr"))})},render:function(e){var t=this,i=[],a=e.attr("data-id"),n=e.parents(".fields"),l=e.find("> .field_form_mask > .field_form > table > tbody > tr.conditional-logic");$.each(n,function(e){var t=0==e?acf.l10n.sibling_fields:acf.l10n.parent_fields;$(this).children(".field").each(function(){var e=$(this),n=e.attr("data-id"),l=e.attr("data-type"),o=e.find("tr.field_label input").val();"field_clone"!=n&&n!=a&&("select"==l||"checkbox"==l||"true_false"==l||"radio"==l)&&i.push({value:n,label:o,group:t})})}),0==i.length&&i.push({value:"null",label:acf.l10n.no_fields}),l.find(".conditional-logic-field").each(function(){var e=$(this).val(),t=$(this).attr("name"),a=acf.helpers.create_field({type:"select",classname:"conditional-logic-field",name:t,value:e,choices:i});$(this).replaceWith(a),a.trigger("change")})},change_toggle:function(e){var t=e.val(),i=e.closest("tr.conditional-logic");"1"==t?i.find(".contional-logic-rules-wrapper").show():i.find(".contional-logic-rules-wrapper").hide()},change_trigger:function(e){var t=e.val(),i=$(".field_key-"+t),a=i.attr("data-type"),n=e.closest("tr").find(".conditional-logic-value"),l=[];if("true_false"==a)l=[{value:1,label:acf.l10n.checked}];else if("select"==a||"checkbox"==a||"radio"==a){var o=i.find(".field_option-choices").val().split("\n");if(o)for(var c=0;c