text: !function($){acf.pro=acf.model.extend({actions:{refresh:"refresh"},filters:{get_fields:"get_fields"},get_fields:function(e){return e=e.not(".acf-clone .acf-field")},refresh:function(e){var t=this;return e=e||!1,e&&e.is("tr")?void t.render_table(e.closest("table")):void $(".acf-table",e).each(function(){t.render_table($(this))})},render_table:function(e){var t=e.find("> thead th.acf-th"),a=1,i=100;t.exists()&&(t.each(function(){var t=$(this),a=t.attr("data-key"),i=e.find('td[data-key="'+a+'"]');i.removeClass("appear-empty"),t.removeClass("hidden-by-conditional-logic"),i.exists()&&(0==i.not(".hidden-by-conditional-logic").length?t.addClass("hidden-by-conditional-logic"):i.filter(".hidden-by-conditional-logic").addClass("appear-empty"))}),t.css("width","auto"),t=t.not(".hidden-by-conditional-logic"),a=t.length,t.filter("[data-width]").each(function(){var e=parseInt($(this).attr("data-width"));i-=e,$(this).css("width",e+"%")}),t=t.not("[data-width]"),t.each(function(){var e=i/t.length;$(this).css("width",e+"%")}),e.find(".acf-row .acf-field.-collapsed-target").removeAttr("colspan"),e.find(".acf-row.-collapsed .acf-field.-collapsed-target").attr("colspan",a))}})}(jQuery),function($){acf.fields.repeater=acf.field.extend({type:"repeater",$el:null,$input:null,$table:null,$tbody:null,$clone:null,actions:{ready:"initialize",append:"initialize",show:"show"},events:{'click a[data-event="add-row"]':"_add",'click a[data-event="remove-row"]':"_remove",'click a[data-event="collapse-row"]':"_collapse","mouseenter td.order":"_mouseenter"},focus:function(){this.$el=this.$field.find(".acf-repeater:first"),this.$input=this.$field.find("input:first"),this.$table=this.$field.find("table:first"),this.$tbody=this.$table.children("tbody"),this.$clone=this.$tbody.children("tr.acf-clone"),this.o=acf.get_data(this.$el),this.o.min=this.o.min||0,this.o.max=this.o.max||0},initialize:function(){this.$clone.find("input, textarea, select").attr("disabled","disabled"),this.render()},show:function(){this.$tbody.find(".acf-field:visible").each(function(){acf.do_action("show_field",$(this))})},count:function(){return this.$tbody.children().length-1},render:function(){this.$tbody.children().each(function(e){$(this).find("> td.order > span").html(e+1)}),0==this.count()?this.$el.addClass("-empty"):this.$el.removeClass("-empty"),this.o.max>0&&this.count()>=this.o.max?this.$el.find("> .acf-actions .button").addClass("disabled"):this.$el.find("> .acf-actions .button").removeClass("disabled")},add:function(e){if(e=e||this.$clone,this.o.max>0&&this.count()>=this.o.max)return alert(acf._e("repeater","max").replace("{max}",this.o.max)),!1;var t=this.$field;return $el=acf.duplicate(this.$clone),$el.removeClass("acf-clone"),$el.find("input, textarea, select").not(".acf-disabled").removeAttr("disabled"),e.before($el),this.doFocus(t),this.render(),acf.validation.remove_error(this.$field),this.sync(),$el},remove:function(e){var t=this;return this.count()<=this.o.min?(alert(acf._e("repeater","min").replace("{min}",this.o.min)),!1):(acf.do_action("remove",e),void acf.remove_tr(e,function(){t.$input.trigger("change"),t.render(),t.sync(),acf.do_action("refresh",t.$field)}))},sync:function(){var e="collapsed_"+this.$field.data("key"),t=[];this.$tbody.children().each(function(e){$(this).hasClass("-collapsed")&&t.push(e)}),acf.update_user_setting(e,t.join(","))},_mouseenter:function(e){if(!this.$tbody.hasClass("ui-sortable")&&1!=this.o.max){var t=this;this.$tbody.sortable({items:"> tr",handle:"> td.order",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,start:function(e,t){acf.do_action("sortstart",t.item,t.placeholder)},stop:function(e,a){t.render(),acf.do_action("sortstop",a.item,a.placeholder)},update:function(e,a){t.$input.trigger("change")}})}},_add:function(e){$row=!1,e.$el.hasClass("acf-icon")&&($row=e.$el.closest(".acf-row")),this.add($row)},_remove:function(e){this.remove(e.$el.closest(".acf-row"))},_collapse:function(e){var t=e.$el.closest(".acf-row");t.hasClass("-collapsed")?(t.removeClass("-collapsed"),acf.do_action("show",t,"collapse")):(t.addClass("-collapsed"),acf.do_action("hide",t,"collapse")),this.sync(),acf.do_action("refresh",this.$field)}})}(jQuery),function($){acf.fields.flexible_content=acf.field.extend({type:"flexible_content",$el:null,$input:null,$values:null,$clones:null,actions:{ready:"initialize",append:"initialize",show:"show"},events:{'click [data-event="add-layout"]':"_open",'click [data-event="remove-layout"]':"_remove",'click [data-event="collapse-layout"]':"_collapse","click .acf-fc-layout-handle":"_collapse","click .acf-fc-popup a":"_add","blur .acf-fc-popup .focus":"_close","mouseenter .acf-fc-layout-handle":"_mouseenter"},focus:function(){this.$el=this.$field.find(".acf-flexible-content:first"),this.$input=this.$el.siblings("input"),this.$values=this.$el.children(".values"),this.$clones=this.$el.children(".clones"),this.o=acf.get_data(this.$el),this.o.min=this.o.min||0,this.o.max=this.o.max||0},count:function(){return this.$values.children(".layout").length},initialize:function(){this.$clones.find("input, textarea, select").attr("disabled","disabled"),this.render()},show:function(){this.$values.find(".acf-field:visible").each(function(){acf.do_action("show_field",$(this))})},render:function(){var e=this;this.$values.children(".layout").each(function(e){$(this).find("> .acf-fc-layout-handle .acf-fc-layout-order").html(e+1)}),0==this.count()?this.$el.addClass("empty"):this.$el.removeClass("empty"),this.o.max>0&&this.count()>=this.o.max?this.$el.find("> .acf-actions .button").addClass("disabled"):this.$el.find("> .acf-actions .button").removeClass("disabled")},render_layout:function(e){},validate_add:function(e){if(this.o.max>0&&this.count()>=this.o.max){var t=1==this.o.max?"layout":"layouts",a=acf._e("flexible_content","max");return a=a.replace("{max}",this.o.max),a=a.replace("{identifier}",acf._e("flexible_content",t)),alert(a),!1}var i=$(this.$el.children(".tmpl-popup").html()),l=i.find('[data-layout="'+e+'"]'),n=parseInt(l.attr("data-max")),s=this.$values.children('.layout[data-layout="'+e+'"]').length;if(n>0&&s>=n){var t=1==n?"layout":"layouts",a=acf._e("flexible_content","max_layout");return a=a.replace("{max}",s),a=a.replace("{label}",'"'+l.text()+'"'),a=a.replace("{identifier}",acf._e("flexible_content",t)),alert(a),!1}return!0},validate_remove:function(e){if(this.o.min>0&&this.count()<=this.o.min){var t=1==this.o.min?"layout":"layouts",a=acf._e("flexible_content","min")+", "+acf._e("flexible_content","remove");return a=a.replace("{min}",this.o.min),a=a.replace("{identifier}",acf._e("flexible_content",t)),a=a.replace("{layout}",acf._e("flexible_content","layout")),confirm(a)}var i=$(this.$el.children(".tmpl-popup").html()),l=i.find('[data-layout="'+e+'"]'),n=parseInt(l.attr("data-min")),s=this.$values.children('.layout[data-layout="'+e+'"]').length;if(n>0&&n>=s){var t=1==n?"layout":"layouts",a=acf._e("flexible_content","min_layout")+", "+acf._e("flexible_content","remove");return a=a.replace("{min}",s),a=a.replace("{label}",'"'+l.text()+'"'),a=a.replace("{identifier}",acf._e("flexible_content",t)),a=a.replace("{layout}",acf._e("flexible_content","layout")),confirm(a)}return!0},sync:function(){var e="collapsed_"+this.$field.data("key"),t=[];this.$values.children(".layout").each(function(e){$(this).hasClass("-collapsed")&&t.push(e)}),acf.update_user_setting(e,t.join(","))},add:function(e,t){if(t=t||!1,!this.validate_add(e))return!1;var a=this.$field,i=this.$clones.children('.layout[data-layout="'+e+'"]');$el=acf.duplicate(i),$el.find("input, textarea, select").not(".acf-disabled").removeAttr("disabled"),this.$el.children(".no-value-message").hide(),t?t.before($el):this.$values.append($el),this.doFocus(a),this.render(),acf.validation.remove_error(this.$field),this.sync()},_mouseenter:function(e){if(!this.$values.hasClass("ui-sortable")&&1!=this.o.max){var t=this;this.$values.sortable({items:"> .layout",handle:"> .acf-fc-layout-handle",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,start:function(e,t){acf.do_action("sortstart",t.item,t.placeholder)},stop:function(e,a){t.render(),acf.do_action("sortstop",a.item,a.placeholder)},update:function(e,a){t.$input.trigger("change")}})}},_open:function(e){var t=this.$values,a=$(this.$el.children(".tmpl-popup").html());a.find("a").each(function(){var e=parseInt($(this).attr("data-min")),a=parseInt($(this).attr("data-max")),i=$(this).attr("data-layout"),l=$(this).text(),n=t.children('.layout[data-layout="'+i+'"]').length,s=$(this).children(".status");if(a>0){var c=a-n,o=acf._e("flexible_content","available"),r=1==c?"layout":"layouts",o=o.replace("{available}",c);o=o.replace("{max}",a),o=o.replace("{label}",'"'+l+'"'),o=o.replace("{identifier}",acf._e("flexible_content",r)),s.show().text(c).attr("title",o),0==c&&s.addClass("warning")}if(e>0){var d=e-n,o=acf._e("flexible_content","required"),r=1==d?"layout":"layouts",o=o.replace("{required}",d);o=o.replace("{min}",e),o=o.replace("{label}",'"'+l+'"'),o=o.replace("{identifier}",acf._e("flexible_content",r)),d>0&&s.addClass("warning").show().text(d).attr("title",o)}}),e.$el.after(a),e.$el.closest(".acf-fc-layout-controlls").exists()&&a.closest(".layout").addClass("-open"),a.css({"margin-top":0-a.height()-e.$el.outerHeight()-14,"margin-left":(e.$el.outerWidth()-a.width())/2});var i=a.offset().top;30>i&&(a.css({"margin-top":15}),a.find(".bit").addClass("top")),a.children(".focus").trigger("focus")},_close:function(e){var t=e.$el.parent(),a=t.closest(".layout");a.removeClass("-open"),setTimeout(function(){t.remove()},200)},_add:function(e){var t=e.$el.closest(".acf-fc-popup"),a=e.$el.attr("data-layout"),i=!1;t.closest(".acf-fc-layout-controlls").exists()&&(i=t.closest(".layout")),this.add(a,i)},_remove:function(e){var t=this,a=e.$el.closest(".layout");if(this.validate_remove(a.attr("data-layout"))){var i=0,l=this.$el.children(".no-value-message");0==a.siblings(".layout").length&&(i=l.outerHeight()),acf.do_action("remove",a),acf.remove_el(a,function(){t.render(),t.$input.trigger("change"),i>0&&l.show(),t.sync()},i)}},_collapse:function(e){var t=e.$el.closest(".layout");t.hasClass("-collapsed")?(t.removeClass("-collapsed"),acf.do_action("refresh",t)):t.addClass("-collapsed"),this.sync();var a=acf.serialize(t);$.extend(a,{action:"acf/fields/flexible_content/layout_title",field_key:this.$field.data("key"),post_id:acf.get("post_id"),i:t.index(),layout:t.data("layout")}),$.ajax({url:acf.get("ajaxurl"),dataType:"html",type:"post",data:a,success:function(e){e&&t.find("> .acf-fc-layout-handle").html(e)}})}})}(jQuery),function($){acf.fields.gallery=acf.field.extend({type:"gallery",$el:null,actions:{ready:"initialize",append:"initialize",submit:"close_sidebar",show:"resize"},events:{"click .acf-gallery-attachment":"select_attachment","click .remove-attachment":"remove_attachment","click .edit-attachment":"edit_attachment","click .update-attachment":"update_attachment","click .add-attachment":"add_attachment","click .close-sidebar":"close_sidebar","change .acf-gallery-side input":"update_attachment","change .acf-gallery-side textarea":"update_attachment","change .acf-gallery-side select":"update_attachment","change .bulk-actions":"sort"},focus:function(){this.$el=this.$field.find(".acf-gallery").first(),this.$values=this.$el.children(".values"),this.$clones=this.$el.children(".clones"),this.o=acf.get_data(this.$el),this.o.min=this.o.min||0,this.o.max=this.o.max||0},get_attachment:function(e){e=e||"";var t=".acf-gallery-attachment";return"active"===e?t+=".active":e&&(t+='[data-id="'+e+'"]'),this.$el.find(t)},count:function(){return this.get_attachment().length},initialize:function(){var e=this,t=this.$field;this.$el.find(".acf-gallery-attachments").unbind("sortable").sortable({items:".acf-gallery-attachment",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,start:function(e,t){t.placeholder.html(t.item.html()),t.placeholder.removeAttr("style"),acf.do_action("sortstart",t.item,t.placeholder)},stop:function(e,t){acf.do_action("sortstop",t.item,t.placeholder)}}),this.$el.unbind("resizable").resizable({handles:"s",minHeight:200,stop:function(e,t){acf.update_user_setting("gallery_height",t.size.height)}}),$(window).on("resize",function(){e.doFocus(t).resize()}),this.render(),this.resize()},render:function(){var e=this.$el.find(".bulk-actions"),t=this.$el.find(".add-attachment");this.o.max>0&&this.count()>=this.o.max?t.addClass("disabled"):t.removeClass("disabled")},sort:function(e){var t=e.$el.val();if(t){var a=acf.prepare_for_ajax({action:"acf/fields/gallery/get_sort_order",field_key:this.$field.data("key"),post_id:acf.get("post_id"),ids:[],sort:t});this.get_attachment().each(function(){a.ids.push($(this).attr("data-id"))});var i=$.ajax({url:acf.get("ajaxurl"),dataType:"json",type:"post",cache:!1,data:a,context:this,success:this.sort_success})}},sort_success:function(e){if(acf.is_ajax_success(e)){e.data.reverse();for(i in e.data){var t=e.data[i],a=this.get_attachment(t);this.$el.find(".acf-gallery-attachments").prepend(a)}}},clear_selection:function(){this.get_attachment().removeClass("active")},select_attachment:function(e){var t=e.$el;if(!t.hasClass("active")){var a=t.attr("data-id");this.clear_selection(),t.addClass("active"),this.fetch(a),this.open_sidebar()}},open_sidebar:function(){this.$el.addClass("sidebar-open"),this.$el.find(".bulk-actions").hide();var e=this.$el.width()/3;e=parseInt(e),e=Math.max(e,350),this.$el.find(".acf-gallery-side-inner").css({width:e-1}),this.$el.find(".acf-gallery-side").animate({width:e-1},250),this.$el.find(".acf-gallery-main").animate({right:e},250)},close_sidebar:function(){this.$el.removeClass("sidebar-open");var e=this.$el.find(".bulk-actions");this.clear_selection(),this.$el.find(".acf-gallery-side").find("input, textarea, select").attr("disabled","disabled"),this.$el.find(".acf-gallery-main").animate({right:0},250),this.$el.find(".acf-gallery-side").animate({width:0},250,function(){e.show(),$(this).find(".acf-gallery-side-data").html("")})},fetch:function(e){var t=acf.prepare_for_ajax({action:"acf/fields/gallery/get_attachment",field_key:this.$field.data("key"),nonce:acf.get("nonce"),post_id:acf.get("post_id"),id:e});this.$el.data("xhr")&&this.$el.data("xhr").abort();var a=$.ajax({url:acf.get("ajaxurl"),dataType:"html",type:"post",cache:!1,data:t,context:this,success:this.render_fetch});this.$el.data("xhr",a)},render_fetch:function(e){if(e){var t=this.$el.find(".acf-gallery-side-data");t.html(e),t.find(".compat-field-acf-form-data").remove();var a=t.find("> .compat-attachment-fields > tbody > tr").detach();t.find("> table.form-table > tbody").append(a),t.find("> .compat-attachment-fields").remove(),acf.do_action("append",t)}},update_attachment:function(){var e=this.$el.find(".update-attachment");return $form=this.$el.find(".acf-gallery-side-data"),data=acf.serialize_form($form),e.attr("disabled")?!1:(e.attr("disabled","disabled"),e.before('<i class="acf-loading"></i>'),data.action="acf/fields/gallery/update_attachment",acf.prepare_for_ajax(data),void $.ajax({url:acf.get("ajaxurl"),data:data,type:"post",dataType:"json",complete:function(t){e.removeAttr("disabled"),e.prev(".acf-loading").remove()}}))},add:function(e){if(this.o.max>0&&this.count()>=this.o.max)return void acf.validation.add_warning(this.$field,acf._e("gallery","max"));var t=e.url,a="acf-gallery-attachment acf-soh",i="",l=this.$el.find('[data-name="ids"]').attr("name");"image"!==e.type&&e.filename&&(i='<div class="filename">'+e.filename+"</div>"),t||(t=e.icon,a+=" is-mime-icon");var n=['<div class="'+a+'" data-id="'+e.id+'">','<input type="hidden" value="'+e.id+'" name="'+l+'[]">','<div class="margin" title="'+e.filename+'">','<div class="thumbnail">','<img src="'+t+'">',"</div>",i,"</div>",'<div class="actions acf-soh-target">','<a href="#" class="acf-icon -cancel dark remove-attachment" data-id="'+e.id+'"></a>',"</div>","</div>"].join("");this.$el.find(".acf-gallery-attachments").append(n),this.render()},edit_attachment:function(e){var t=this,a=acf.get_data(e.$el,"id"),i=acf.media.popup({title:acf._e("image","edit"),button:acf._e("image","update"),mode:"edit",id:a,select:function(e){acf.isset(e,"attributes","sizes",t.o.preview_size,"url")&&(e.url=e.attributes.sizes[t.o.preview_size].url),t.get_attachment(a).find("img").attr("src",e.url),t.fetch(a)}})},remove_attachment:function(e){e.stopPropagation();var t=acf.get_data(e.$el,"id");this.clear_selection(),this.close_sidebar(),this.get_attachment(t).remove(),this.render()},render_collection:function(e){var t=this;setTimeout(function(){var a=e.content.get().$el;if(collection=e.content.get().collection||null,collection){var i=-1;collection.each(function(e){i++;var l=a.find(".attachments > .attachment:eq("+i+")");t.get_attachment(e.id).exists()&&(e.off("selection:single"),l.addClass("acf-selected"))})}},10)},add_attachment:function(e){if(this.o.max>0&&this.count()>=this.o.max)return void acf.validation.add_warning(this.$field,acf._e("gallery","max"));var t=this.o.preview_size,a=this,i=this.$field,l=acf.media.popup({title:acf._e("gallery","select"),mode:"select",type:"",field:this.$field.data("key"),multiple:"add",library:this.o.library,mime_types:this.o.mime_types,select:function(e,l){var n=e.attributes;if(a.doFocus(i),!a.get_attachment(n.id).exists()){var s={id:n.id,type:n.type,icon:n.icon,filename:n.filename,url:""};"image"===s.type?s.url=acf.maybe_get(n,"sizes."+t+".url",n.url):s.url=acf.maybe_get(n,"thumb.src",""),a.add(s)}}});l.on("content:activate:browse",function(){a.render_collection(l),l.content.get().collection.on("reset add",function(){a.render_collection(l)})})},resize:function(){for(var e=100,t=175,a=4,i=this.$el.width(),l=4;20>l;l++){var n=i/l;if(n>e&&t>n){a=l;break}}a=Math.min(a,8),this.$el.attr("data-columns",a)}})}(jQuery);
  