(()=>{"use strict";class e{constructor(e){this.form=e,this.form}place(){var e;let t=document.querySelector(".acp-smartfilters");t&&(this.form.addSearch(t),null===(e=AC_SERVICES.getService("Search"))||void 0===e||e.setForm(this.form.getElement()),this.form.place())}}acp_table&&(acp_table.column_sets_style="dropdown"),document.addEventListener("DOMContentLoaded",()=>{let e=document.querySelector("#gf_form_toolbar");e&&e.insertAdjacentHTML("afterend",'<div class="wp-header-end"></div>')}),AC_SERVICES.addListener("Table.Ready",()=>{var e,t;const r=document.querySelector(".acp-layout-switcher"),n=document.querySelector(".gform-form-toolbar__container #gform-form-toolbar__menu");if(r&&n&&n.parentElement.insertBefore(r,n),AC.list_screen.indexOf("gf_entry")>-1){let r=document.querySelector(".tablenav-pages .displaying-num");if(r){let n=r.innerHTML.split(" ")[0],a=n.replace(",","").replace(".","");"undefined"!=typeof acp_export&&(acp_export.total_num_items=a),null===(t=null===(e=AC_SERVICES.getService("Editing"))||void 0===e?void 0:e.getService("BulkSelectionRow"))||void 0===t||t.setTotalItems(parseInt(a),n)}}}),AC_SERVICES.addListener("Service.Registered.LayoutTabs",e=>{if("tabs"===e.getStyle()){const t=e.getElement(),r=document.querySelector("#gf-admin-notices-wrapper");r&&t&&t.insertSelfBefore(r)}});const t=new class{constructor(){this.form=AC_SERVICES.$.create("form").setAttribute("id","gf-acs-form"),this.search=AC_SERVICES.$.create("div").addClass("acs-form__search"),this.filtering=AC_SERVICES.$.create("div").addClass("acs-form__filtering"),this.button=AC_SERVICES.$.create("div").addClass("acs-form__button"),this.clear=AC_SERVICES.$.create("div").addClass("acs-form__clear"),this.form.append(this.search.getElement()).append(this.filtering.getElement()).append(this.button.getElement()).append(this.clear.getElement()),this.prepareHiddenFields()}prepareHiddenFields(){["page","id"].forEach(e=>{let t=new URLSearchParams(window.location.search).get(e);t&&this.form.getElement().insertAdjacentHTML("afterbegin",`<input type="hidden" name="${e}" value="${t}">`)})}getElement(){return this.form.getElement()}addSearch(e){this.search.append(e)}addFilter(e){this.filtering.append(e)}placeButton(){0===this.button.getElement().children.length&&this.button.append(AC_SERVICES.$.create("button").addClass("button").addHtml("Filter").getElement())}place(){let e=document.querySelector(".gform-settings__content");e.parentElement.insertBefore(this.form.getElement(),e),this.placeButton()}};AC_SERVICES.addListener("Service.Registered.Filtering",()=>{document.querySelectorAll("#wpbody-content .acp-filter-container")&&(document.querySelectorAll("#wpbody-content .acp-filter-container").forEach(e=>{t.addFilter(e)}),t.place())}),AC_SERVICES.addListener("Search.PlacementFactory",r=>{r.register("gravity_forms_entry",new e(t))})})();