!function(a){const e=window.ac_acf_field_settings||{};function d(d,c,t,s,n){n.prop("disabled",!0).text(e.adding||"Adding...");const i=n.closest(".ac-acf-row"),l=String(i.data("group-id")||""),o=String(i.data("child-key")||""),f=String(i.data("label")||""),p={action:"acp-acf-add-column",_ajax_nonce:e.nonce||"",table_id:d,group_id:l,field_key:c};f&&(p.label=f),t&&(p.sub_field_key=t),o&&(p.child_key=o),s&&(p.list_screen_id=s),a.post(ajaxurl,p).done(function(d){if(!d.success)return void n.prop("disabled",!1).text(e.add_as_column||"Add as column");const c=d.data&&d.data.editor_url?d.data.editor_url:"#",t=d.data&&d.data.view_title?d.data.view_title:"";i.closest(".acf-field-settings").find(".ac-acf-tab-badge").first().addClass("is-enabled");const s=n.closest(".ac-acf-view");if(s.length){const d=s.find(".ac-acf-view-name").text();s.addClass("ac-acf-view--added").empty().append(a("<div>",{class:"ac-acf-view-left"}).append(a("<span>",{class:"ac-acf-view-name",text:d}))).append(a("<div>",{class:"ac-acf-view-actions"}).append(a("<span>",{class:"ac-acf-view-meta"}).append(a("<span>",{class:"ac-acf-badge",html:"&#10003;"})).append(a("<span>",{text:e.added||"Added"}))).append(a("<a>",{href:c,class:"ac-acf-link",text:e.edit_column||"Edit column →"})));const t=i.find(".ac-acf-view--added").length,n=i.find(".ac-acf-summary"),l=1===t?e.added_to_1_view||"Added to 1 view":(e.added_to||"Added to")+" "+t+" "+(e.views||"views");n.length?n.find("span:last").text(l):i.find(".ac-acf-row-left").append(a("<span>",{class:"ac-acf-summary"}).append(a("<span>",{class:"ac-acf-badge",html:"&#10003;"})).append(a("<span>",{text:l})))}else{const d=i.find(".ac-acf-row-left"),s=i.find(".ac-acf-row-actions"),n=t?(e.added_to||"Added to")+" "+t:e.added||"Added";d.find(".ac-acf-status, .ac-acf-view-link").remove(),d.append(a("<span>",{class:"ac-acf-status"}).append(a("<span>",{class:"ac-acf-badge",html:"&#10003;"})).append(a("<span>",{text:n}))),s.empty().append(a("<a>",{href:c,class:"ac-acf-link",text:e.edit_column||"Edit column →"}))}}).fail(function(){n.prop("disabled",!1).text(e.add_as_column||"Add as column")})}a(document).on("click",".ac-acf-add-column",function(){const e=a(this),c=e.closest(".ac-acf-row");d(e.data("table-id"),e.data("field-key"),c.data("sub-field-key")||"","",e)}),a(document).on("click",".ac-acf-toggle-views",function(){const e=a(this),d=e.closest(".ac-acf-row").find(".ac-acf-expander"),c=d.hasClass("ac-acf-expander--closed");d.toggleClass("ac-acf-expander--closed"),c?e.addClass("ac-acf-toggle-views--open").removeClass("button").addClass("ac-acf-link").text(e.data("label-hide")):e.removeClass("ac-acf-toggle-views--open").removeClass("ac-acf-link").addClass("button").text(e.data("label-show"))}),a(document).on("click",".ac-acf-add-to-view",function(){const e=a(this).closest(".ac-acf-view"),c=a(this).closest(".ac-acf-row");d(e.data("table-id"),e.data("field-key"),c.data("sub-field-key")||"",e.data("list-screen-id"),a(this))}),"undefined"!=typeof acf&&acf.addAction("ready",function(){a(".ac-acf-hide-tab").each(function(){a(this).closest(".acf-field-settings").find("li.acf-settings-type-admin-columns").hide()}),a(".ac-acf-badge-active").each(function(){a(this).closest(".acf-field-settings").find(".ac-acf-tab-badge").first().addClass("is-enabled")})})}(jQuery);