1 line
165 KiB
JavaScript
1 line
165 KiB
JavaScript
(()=>{var e={7(){jQuery(function(e){e("#wpconsent-create-cookie-policy-page").on("click",function(t){t.preventDefault();var n=e(this);WPConsentSpinner.show_button_spinner(n);var i={action:"wpconsent_generate_cookie_policy",nonce:wpconsent.nonce};e.post(ajaxurl,i).always(function(){WPConsentSpinner.hide_button_spinner(n)}).success(function(t){if(t.success)try{wpconsent_choices["cookie-policy-page"].setValue([{value:t.data.page_id,label:t.data.page_title,selected:!0}]),e("#cookie-policy-page").trigger("change")}catch(e){console.error(e)}let n={ok:{text:wpconsent.ok,btnClass:"btn-blue"}};t.data.link&&(n.view_page={text:t.data.view_page,btnClass:"btn-blue",action:function(){window.open(t.data.link,"_blank")}}),e.confirm({title:t.data.title,content:t.data.message,type:"blue",buttons:n})})})})},11(){window.WPConsentInstallPlugin=window.WPConsentInstallPlugin||function(e,t,n){const i={init:function(){i.should_init()&&i.init_install()},should_init:()=>(i.$install_buttons=n(".wpconsent-button-install-plugin"),i.$install_buttons.length>0),init_install(){i.$install_buttons.on("click",function(e){e.preventDefault();const t=n(this);i.install_plugin(t)})},install_plugin(e){const i=e.data("slug");if(!i)return;const o=e.text();e.prop("disabled",!0).text(wpconsent.installing||"Installing..."),n.post(ajaxurl,{action:"wpconsent_install_plugin",slug:i,_wpnonce:wpconsent.nonce},function(i){if(i.success)e.text(wpconsent.activated||"Activated!"),setTimeout(function(){t.location.reload()},1500);else if(e.prop("disabled",!1).text(o),i.data&&i.data.message){let e="<div class='excl-mark'>!</div>";n.confirm({title:!1,content:e+i.data.message,type:"blue",buttons:{confirm:{text:wpconsent.ok,btnClass:"wpconsent-btn-confirm",action:function(){}}}})}})}};return i}(document,window,jQuery),WPConsentInstallPlugin.init()},44(){jQuery(function(e){e("#wpconsent-reset-banner-content").on("click",function(t){t.preventDefault(),e.confirm({title:wpconsent.reset_warning_title||"Warning: Reset To Defaults",content:`\n\t\t\t\t<div class="wpconsent-reset-warning">\n\t\t\t\t\t<p>${wpconsent.reset_warning_message||"This action will reset all banner content and default categories/cookies to the default English state. This cannot be undone. We recommend exporting your current settings as a backup before proceeding."}</p>\n\t\t\t\t</div>\n\t\t\t`,boxWidth:"600px",theme:"modern",type:"blue",buttons:{reset:{text:wpconsent.reset_button||"Reset to Defaults",btnClass:"btn-confirm",action:function(){var t={action:"wpconsent_reset_to_defaults",nonce:wpconsent.nonce};e.post(ajaxurl,t,function(){window.location.reload()})}},cancel:{text:wpconsent.cancel_button||"Cancel",btnClass:""}}})})})},50(){jQuery(function(e){const t={init:function(){t.elements=e("[data-show-if-id]"),t.add_listeners()},add_listeners:function(){t.elements.each(function(){const n=e(this),i=n.data("show-if-id");if(""===i)return;let o=!1,s=String(n.data("show-if-value")).split(",");n.data("hide-if-value")&&(s=String(n.data("hide-if-value")).split(","),o=!0);const c=e(i);e(".wpconsent-admin-page #wpbody-content").on("change",i,function(){t.maybe_hide(e(this),n,s,o)}),t.maybe_hide(c,n,s,o)})},maybe_hide:function(e,t,n,i){let o=String(e.val());if("checkbox"===e.attr("type")&&(o=e.prop("checked")?"1":"0"),"radio"===e.attr("type")&&(o=e.closest("form").find('input[name="'+e.attr("name")+'"]:checked').val()),i){if(n.indexOf(o)>=0)return void t.hide();t.show()}else n.indexOf(o)<0?t.hide():t.show()}};t.init()})},54(){jQuery(function(e){e(".wpconsent-select").on("change",function(){const t=e(this).data("target"),n=e(this).data("target-property");if(t&&n){const i=document.getElementById("wpconsent-container").shadowRoot.querySelector(t);if("class"===n){const t=e(this).data("prefix")||"",n=t+e(this).val();t&&e(i).removeClass(function(e,n){return(n.match(new RegExp("\\b"+t+"\\S+","g"))||[]).join(" ")}),e(i).addClass(n)}else e(i).css(n,e(this).val())}})})},192(){window.WPConsentModalForm=class{constructor(e){this.modal=document.getElementById(e),this.form=this.modal.querySelector("form"),this.closeButton=this.modal.querySelector(".wpconsent-modal-close"),this.cancelButton=this.modal.querySelector(".wpconsent-button-secondary"),this.saveButton=this.modal.querySelector(".wpconsent-button-primary"),this.title=this.modal.querySelector(".wpconsent-modal-header h2"),this.bindEvents()}bindEvents(){this.closeButton.addEventListener("click",()=>this.close()),this.cancelButton.addEventListener("click",()=>this.close()),this.form.addEventListener("submit",e=>this.handleSubmit(e))}open(e={}){e.title&&(this.title.textContent=e.title),e.data&&this.populateFields(e.data),e.successCallback&&(this.successCallback=e.successCallback),e.errorCallback&&(this.errorCallback=e.errorCallback),this.modal.style.display="block"}close(){this.modal.style.display="none",this.form.reset(),this.submitCallback=null}populateFields(e){Object.keys(e).forEach(t=>{const n=this.form.querySelector(`[name="${t}"]`);n&&("radio"===n.type?this.form.querySelectorAll(`[name="${t}"]`).forEach(n=>{n.checked=n.value===e[t]}):"checkbox"===n.type?n.checked=!!e[t]:n.value=e[t])})}getFormData(){const e=new FormData(this.form),t={};for(let[n,i]of e.entries())t[n]=i;return t}handleSubmit(e){if(e.preventDefault(),this.isSubmitting)return;this.isSubmitting=!0;const t=this.getFormData();this.saveButton.disabled=!0,jQuery.post(ajaxurl,{...t}).done(e=>{this.successCallback&&this.successCallback(e)}).always(()=>{this.isSubmitting=!1,this.saveButton.disabled=!1}).fail(e=>{this.errorCallback&&this.errorCallback(e)})}}},197(){window.WPConsentItemsList||function(e,t,n){const i=function(e){this.container=n(e),this.category="*",this.search_term="",this.categories_list=this.container.find(".wpconsent-items-filters"),this.search_input=this.container.find(".wpconsent-items-search-input"),this.items=this.container.find(".wpconsent-list-item"),this.banner=null,this.init()};i.prototype={init:function(){this.should_init()&&(this.init_category_switch(),this.init_search(),this.show_connect_banner(),this.init_custom_event_handlers())},init_custom_event_handlers(){this.container.on("wpconsent_reset_items",()=>{this.reset_items()}),this.container.on("wpconsent_select_item",(e,t)=>{this.set_item(t)})},set_item(e){this.reset_items();const t=this.items.filter(function(){return n(this).data("id")===e});this.items.removeClass("wpconsent-list-item-selected"),t.addClass("wpconsent-list-item-selected");const i=t.data("categories"),o=i.length>0?i[0]:"*";this.switch_to_category(o);const s=this.categories_list.find(`button[data-category="${o}"]`);this.switch_category_button(s);const c=t.find('input[type="radio"]');c.length>0&&c.prop("checked",!0)},reset_items(){this.search_input.val(""),this.search_term="";const e=this.categories_list.find("button").first();this.switch_to_category(e.data("category")),this.switch_category_button(e)},should_init:function(){return this.categories_list.length>0},init_category_switch:function(){const e=this;this.categories_list.on("click","button",function(){const t=n(this);t.hasClass("wpconsent-active")||(e.switch_to_category(t.data("category")),e.switch_category_button(t))})},switch_category_button:function(e){this.categories_list.find("button").removeClass("wpconsent-active"),e.addClass("wpconsent-active")},switch_to_category:function(e){this.category=e,this.filter_items()},filter_items:function(){let e;const t=this,i=this.items.filter(function(){return"*"===t.category||n(this).data("categories").indexOf(t.category)>-1});if(t.search_term.length>2){const i=t.search_term.toLowerCase();e=this.items.filter(function(){return n(this).text().toLowerCase().indexOf(i)>-1})}else e=i;t.items.hide(),e.show(),this.update_banner_position()},init_search:function(){const e=this;this.search_input.on("keyup change search",function(){const t=n(this).val();e.search_term=t.length<3?"":t,e.filter_items()})},show_connect_banner:function(){const e=n("#tmpl-wpconsent-library-connect-banner");if(!e.length)return;const t=this.container.find(".wpconsent-items-list-category .wpconsent-list-item:visible");t.length>5?t.eq(5).after(e.html()):t.last().after(e.html()),this.banner=this.container.find("#wpconsent-library-connect-banner")},update_banner_position:function(){const e=this.container.find(".wpconsent-items-list-category .wpconsent-list-item:visible");this.banner&&this.banner.length>0&&(e.length>5?this.banner.insertAfter(e.eq(5)):this.banner.insertAfter(e.last()))}},n(e).ready(function(){n(".wpconsent-items-metabox").each(function(){new i(this)})})}(document,window,jQuery)},209(){(window.WPConsentAdminNotices||function(e,t,n){const i={l10n:wpconsent,init:function(){t.WPConsentAdminNotices=i,i.notice_holder=n(e.getElementById("wpconsent-notice-area")),i.document=n(e),i.addEvents()},add_notice(e,t="updated"){const n=i.get_notice(e,t);i.notice_holder.append(n),i.document.trigger("wp-updates-notice-added"),n.find("button").focus()},get_notice(e,t){const i=n("<div />"),o=n("<p />");return o.html(e),i.addClass("fade notice is-dismissible"),i.addClass(t),i.append(o),i},addEvents(){n(e).on("click",".wpconsent-pro-notice",function(e){e.preventDefault(),i.show_pro_notice(n(this).data("pro_title"),n(this).data("pro_description"),n(this).data("pro_link"))})},show_pro_notice(e,o,s,c){const r=i.l10n.lock_icon;n.confirm({title:r+e,content:o,boxWidth:"560px",theme:"modern upsell-box",onOpenBefore(){this.$btnc.after('<div class="wpconsent_check"></div>'),i.l10n.purchased_text&&this.$btnc.after('<div class="wpconsent-already-purchased"><a href=" '+i.l10n.purchased_link+' ">'+i.l10n.purchased_text+"</a></div>"),i.l10n.discount_note&&(this.$btnc.after('<div class="wpconsent-discount-note">'+i.l10n.discount_note+"</div>"),this.$body.find(".jconfirm-content").addClass("wpconsent-lite-upgrade"))},buttons:{confirm:{text:c||i.l10n.upgrade_button,btnClass:"wpconsent-btn-orange",action:function(){t.open(s,"_blank","noopener noreferrer")}}},closeIcon:!0,backgroundDismiss:!0,useBootstrap:!1})}};return i}(document,window,jQuery)).init()},226(){let e=[],t=[],n=1,i=50,o="",s="",c="name_asc";function r(){t=e.filter(function(e){if(o){const t=e.querySelector(".wpconsent-vendor-name label").textContent.toLowerCase(),n=e.getAttribute("data-vendor-id");if(!t.includes(o)&&!n.includes(o))return!1}if(s){const t=e.querySelector(".wpconsent-vendor-checkbox"),n=t&&t.checked;if("selected"===s&&!n||"not_selected"===s&&n)return!1}return!0}),t.sort(function(e,t){const n=e.querySelector(".wpconsent-vendor-name label").textContent,i=t.querySelector(".wpconsent-vendor-name label").textContent,o=parseInt(e.getAttribute("data-vendor-id")),s=parseInt(t.getAttribute("data-vendor-id"));switch(c){case"name_desc":return i.localeCompare(n);case"id_asc":return o-s;case"id_desc":return s-o;default:return n.localeCompare(i)}}),l(),a(),d(),function(){const e=document.getElementById("vendor-clear-search");e&&(e.style.display=o?"inline-block":"none")}()}function a(){e.forEach(function(e){e.style.display="none"});const o=(n-1)*i,s=o+i;t.slice(o,s).forEach(function(e){e.style.display=""})}function l(){const e=Math.ceil(t.length/i),o=document.querySelector(".wpconsent-vendor-pagination"),s=document.getElementById("vendor-prev-page"),c=document.getElementById("vendor-next-page"),r=o.querySelector(".wpconsent-pagination-info");e<=1?o.style.display="none":(o.style.display="flex",r&&(r.textContent=`Page ${n} of ${e}`),s&&(s.disabled=n<=1),c&&(c.disabled=n>=e))}function d(){const n=document.querySelector(".wpconsent-vendor-results-info span"),i=document.querySelectorAll(".wpconsent-vendor-checkbox:checked").length,c=o||s?t.length:e.length;n&&(n.textContent=`Showing ${c} vendors (${i} selected)`)}document.addEventListener("DOMContentLoaded",function(){const h=document.querySelector(".wpconsent-iab-tcf-vendors");h&&(i=parseInt(h.getAttribute("data-per-page"))||50,function(){const n=document.querySelectorAll(".wpconsent-vendor-item");e=Array.from(n),t=[...e],l(),a(),d()}(),function(){const e=document.getElementById("vendor-search"),t=document.getElementById("vendor-search-btn"),i=document.getElementById("vendor-clear-search");if(!e)return;let s;e.addEventListener("input",function(){clearTimeout(s),s=setTimeout(function(){o=e.value.trim().toLowerCase(),n=1,r()},300)}),t&&t.addEventListener("click",function(){o=e.value.trim().toLowerCase(),n=1,r()}),e.addEventListener("keypress",function(t){"Enter"===t.key&&(t.preventDefault(),o=e.value.trim().toLowerCase(),n=1,r())}),i&&i.addEventListener("click",function(){e.value="",o="",n=1,r()})}(),function(){const e=document.getElementById("vendor-status-filter"),t=document.getElementById("vendor-sort-order");e&&e.addEventListener("change",function(){s=this.value,n=1,r()}),t&&t.addEventListener("change",function(){c=this.value,n=1,r()})}(),function(){const e=document.querySelectorAll(".wpconsent-vendor-checkbox"),t=document.querySelectorAll(".wpconsent-vendor-item");function n(t){e.forEach(function(e){e.checked!==t&&(e.checked=t,e.closest(".wpconsent-vendor-item").classList.toggle("selected",t))}),d(),s&&r()}e.forEach(function(e){e.addEventListener("change",function(){const e=this.closest(".wpconsent-vendor-item");this.value,this.checked?e.classList.add("selected"):e.classList.remove("selected"),d(),s&&r()})});const i=document.getElementById("wpconsent-select-all-vendors");i&&i.addEventListener("click",()=>n(!0));const o=document.getElementById("wpconsent-deselect-all-vendors");o&&o.addEventListener("click",()=>n(!1)),t.forEach(function(e){const t=e.querySelector(".wpconsent-vendor-header"),n=e.querySelector(".wpconsent-vendor-checkbox");t&&n&&t.addEventListener("click",function(e){e.target.closest(".wpconsent-vendor-details-toggle")||e.target.closest("a")||e.target===n||(n.checked=!n.checked,n.dispatchEvent(new Event("change")))})})}(),document.querySelectorAll(".wpconsent-vendor-details-toggle").forEach(function(e){e.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();const t=this.closest(".wpconsent-vendor-item").querySelector(".wpconsent-vendor-details"),n=this.querySelector(".dashicons");"none"!==t.style.display&&t.style.display?(t.style.display="none",n.classList.remove("dashicons-arrow-up-alt2"),n.classList.add("dashicons-arrow-down-alt2"),this.setAttribute("aria-expanded","false")):(t.style.display="block",n.classList.remove("dashicons-arrow-down-alt2"),n.classList.add("dashicons-arrow-up-alt2"),this.setAttribute("aria-expanded","true"))})}),function(){const e=document.getElementById("vendor-prev-page"),o=document.getElementById("vendor-next-page");e&&e.addEventListener("click",function(){n>1&&(n--,a(),l())}),o&&o.addEventListener("click",function(){const e=Math.ceil(t.length/i);n<e&&(n++,a(),l())})}(),document.querySelectorAll(".wpconsent-section-toggle").forEach(function(e){e.addEventListener("click",function(e){e.preventDefault();const t=this.closest(".wpconsent-publisher-declarations-section").querySelector(".wpconsent-section-content");"true"===this.getAttribute("aria-expanded")?(t.style.display="none",this.setAttribute("aria-expanded","false")):(t.style.display="block",this.setAttribute("aria-expanded","true"))})}))})},239(){jQuery(document).ready(function(e){e('.wpconsent-checkbox-toggle input[type="checkbox"]').on("change",function(){const t=e(this).data("target");if(!t)return;const n=document.getElementById("wpconsent-container").shadowRoot.querySelector(t);e(this).is(":checked")?e(n).show():e(n).hide()}),e('.wpconsent-checkbox-toggle input[type="checkbox"]').each(function(){const t=e(this).data("target");if(!t)return;const n=document.getElementById("wpconsent-container").shadowRoot.querySelector(t);e(this).is(":checked")?e(n).show():e(n).hide()})})},249(){jQuery(function(e){e(".wpconsent-input-text").on("keyup",function(){const t=e(this).data("target");t&&(document.getElementById("wpconsent-container").shadowRoot.querySelector(t).innerText=e(this).val())})})},254(){window.WPConsentScanner=window.WPConsentScanner||function(e,t,n){const i={init:function(){i.should_init()&&(i.find_elements(),i.add_events())},should_init:function(){return i.start_button=n("#wpconsent-start-scanner"),i.start_button.length>0},find_elements:function(){i.results=n("#wpconsent-scanner-scripts"),i.service_template=n("#wpconsent-scanner-service").html(),i.message=n("#wpconsent-scanner-message"),i.essential=n("#wpconsent-scanner-essential"),i.form=n("#wpconsent-scanner-form"),i.after_scan=n("#wpconsent-after-scan")},add_events:function(){i.start_button.on("click",i.start_scanner),i.form.on("submit",i.configure_cookies)},start_scanner:function(e){e.preventDefault(),i.start_button.prop("disabled",!0),i.after_scan_action=i.start_button.data("action"),i.results.empty();const t=n('input[name="scanner_items[]"]');if(t.length>0)i.page_ids=["0"],i.current_scan_index=0,i.scan_results={scripts:{},services_needed:[],total_pages:0,scanned_pages:0,request_id:""},t.each(function(){i.page_ids.push(n(this).val())}),i.scan_results.total_pages=i.page_ids.length,i.scan_results.request_id=Date.now().toString(),WPConsentConfirm.show_please_wait(wpconsent.scanning_title,!0),i.scan_next_page();else{WPConsentConfirm.show_please_wait(wpconsent.scanning_title);const e=n("#scanner-email").val(),t={action:"wpconsent_scan_website",nonce:wpconsent.nonce};""!==e&&(t.email=e),n.post(ajaxurl,t).always(function(){i.start_button.prop("disabled",!1)}).done(i.handle_response)}},scan_next_page:function(){if(i.current_scan_index>=i.page_ids.length){const e=i.page_ids[i.page_ids.length-1];return WPConsentConfirm.update_progress(i.scan_results.scanned_pages,i.page_ids.length),void n.post(ajaxurl,{action:"wpconsent_scan_page",nonce:wpconsent.nonce,page_id:e,request_id:i.scan_results.request_id,email:n("#scanner-email").val(),is_final:!0,total_pages:i.scan_results.total_pages,scanned_pages:i.scan_results.scanned_pages}).always(function(){i.start_button.prop("disabled",!1)}).done(i.handle_response)}const e=i.page_ids[i.current_scan_index];n.post(ajaxurl,{action:"wpconsent_scan_page",nonce:wpconsent.nonce,page_id:e,request_id:i.scan_results.request_id,email:n("#scanner-email").val()}).done(function(e){WPConsentConfirm.update_progress(i.scan_results.scanned_pages,i.page_ids.length),e.success?(i.current_scan_index++,e.data.error||i.scan_results.scanned_pages++,i.scan_next_page()):i.handle_scan_error(e.data.message||wpconsent.scan_error)}).fail(function(e,t,n){i.handle_scan_error(wpconsent.scan_error)})},handle_scan_error:function(e){WPConsentConfirm.close(),i.start_button.prop("disabled",!1),n.alert({title:wpconsent.scan_error,content:e,type:"red",icon:"fa fa-exclamation-circle",animateFromElement:!1,buttons:{confirm:{text:wpconsent.ok,btnClass:"btn-confirm",keys:["enter"]}}})},handle_response:function(e){if(WPConsentConfirm.close(),e.success){const t=e.data.error&&!0===e.data.error,o=!i.scan_results||i.scan_results.scanned_pages===i.scan_results.total_pages,s=t||!o?"red":"blue",c=t?"fa fa-exclamation-circle":"fa fa-check-circle",r=t?wpconsent.scan_error:wpconsent.scan_complete;let a=e.data.message;n.confirm({title:r,content:a,type:s,icon:c,animateFromElement:!1,buttons:{confirm:{text:wpconsent.ok,btnClass:"btn-confirm",keys:["enter"]}},onAction:function(n){"confirm"===n&&(t||i.do_after_scan_action(e))}})}},do_after_scan_action:function(t){""!==i.after_scan_action&&"reload"!==i.after_scan_action?n(e).trigger("wpconsent_after_scan",t):location.reload()},configure_cookies:function(e){e.preventDefault(),n.confirm({title:wpconsent.configure_cookies_title,content:wpconsent.configure_cookies_content,type:"blue",icon:"fa fa-exclamation-circle",animateFromElement:!1,buttons:{confirm:{text:wpconsent.yes,btnClass:"btn-confirm",keys:["enter"]},cancel:{text:wpconsent.no,btnClass:"btn-cancel",keys:["esc"]}},onAction:function(e){if("confirm"===e){const e=i.form.serialize();WPConsentConfirm.show_please_wait(),n.post(ajaxurl,e).done(function(e){WPConsentConfirm.close(),e.success&&n.alert({title:"",content:e.data.message,onAction:function(){WPConsentConfirm.show_please_wait(),location.reload()}})})}}})}};return i}(document,window,jQuery),WPConsentScanner.init()},302(){window.WPConsentImportConfirm=window.WPConsentImportConfirm||function(e,t,n){const i={strings:{warning_title:wpconsent.import_warning_title||"Warning: Import Settings",warning_message:wpconsent.import_warning_message||"This action will overwrite all your current settings. This cannot be undone. We recommend exporting your current settings as a backup before proceeding.",import_button:wpconsent.import_button||"Import Settings",cancel_button:wpconsent.cancel_button||"Cancel"},init(){this.bindEvents()},bindEvents(){const e=n('form[action*="wpconsent-cookies"]'),t=e.find('button[name="wpconsent_import"]'),i=n("#wpconsent-import-file");t.on("click",t=>{t.preventDefault(),i[0].files.length&&this.showConfirmDialog(e)})},showConfirmDialog(e){n.confirm({title:this.strings.warning_title,content:`\n <div class="wpconsent-import-warning">\n <p>${this.strings.warning_message}</p>\n </div>\n `,boxWidth:"600px",theme:"modern",type:"blue",buttons:{import:{text:this.strings.import_button,btnClass:"btn-confirm",action:()=>{const t=n("<input>").attr({type:"hidden",name:"wpconsent_import",value:"1"});e.append(t),e.submit()}},cancel:{text:this.strings.cancel_button,btnClass:""}}})}};return n(e).ready(()=>{i.init()}),i}(document,window,jQuery)},332(){(window.WPConsentAdminNotifications||function(e,t,n){const i={init(){i.should_init()&&(i.find_elements(),i.init_open(),i.init_close(),i.init_dismiss(),i.init_view_switch(),i.update_count(i.active_count))},should_init:()=>(i.$drawer=n("#wpconsent-notifications-drawer"),i.$drawer.length>0),find_elements(){i.$open_button=n("#wpconsent-notifications-button"),i.$count=i.$drawer.find("#wpconsent-notifications-count"),i.$dismissed_count=i.$drawer.find("#wpconsent-notifications-dismissed-count"),i.active_count=i.$open_button.data("count")?i.$open_button.data("count"):0,i.dismissed_count=i.$open_button.data("dismissed"),i.$body=n("body"),i.$dismissed_button=n("#wpconsent-notifications-show-dismissed"),i.$active_button=n("#wpconsent-notifications-show-active"),i.$active_list=n(".wpconsent-notifications-list .wpconsent-notifications-active"),i.$dismissed_list=n(".wpconsent-notifications-list .wpconsent-notifications-dismissed"),i.$dismiss_all=n("#wpconsent-dismiss-all")},update_count(e){i.$open_button.data("count",e).attr("data-count",e),0===e&&i.$open_button.removeAttr("data-count"),i.$count.text(e),i.dismissed_count+=Math.abs(e-i.active_count),i.active_count=e,i.$dismissed_count.text(i.dismissed_count),0===i.active_count&&i.$dismiss_all.hide()},init_open(){i.$open_button.on("click",function(e){e.preventDefault(),i.$body.addClass("wpconsent-notifications-open")})},init_close(){i.$body.on("click",".wpconsent-notifications-close, .wpconsent-notifications-overlay",function(e){e.preventDefault(),i.$body.removeClass("wpconsent-notifications-open")})},init_dismiss(){i.$drawer.on("click",".wpconsent-notification-dismiss",function(e){e.preventDefault();const t=n(this).data("id");if(i.dismiss_notification(t),"all"===t)return i.move_to_dismissed(i.$active_list.find("li")),void i.update_count(0);i.move_to_dismissed(n(this).closest("li")),i.update_count(i.active_count-1)})},move_to_dismissed(e){e.slideUp(function(){n(this).prependTo(i.$dismissed_list).show()})},dismiss_notification:e=>n.post(ajaxurl,{action:"wpconsent_notification_dismiss",nonce:wpconsent.nonce,id:e}),init_view_switch(){i.$dismissed_button.on("click",function(e){e.preventDefault(),i.$drawer.addClass("show-dismissed")}),i.$active_button.on("click",function(e){e.preventDefault(),i.$drawer.removeClass("show-dismissed")})}};return i}(document,window,jQuery)).init()},342(){jQuery(document).ready(e=>{const t=e(".wpconsent-floating-button-preview"),n=e("#consent_floating_icon"),i=e(".wpconsent-floating-button-grid");e("#banner_background_color").on("irischange",function(e,t){i.css("--wpconsent-floating-button-bg",t.color.toString())}),e("#banner_text_color").on("irischange",function(e,t){const n=t.color.toString();i.css("--wpconsent-floating-button-color",n),i.find("svg path").attr("fill",n)}),t.on("click",function(i){const o=e(this);if("custom"===o.data("icon")){i.preventDefault(),i.stopPropagation();const e=wp.media({title:"Select Icon Image",button:{text:"Select"},multiple:!1});e.on("select",function(){const i=e.state().get("selection").first().toJSON();o.find("img").remove(),o.append(`<img src="${i.url}" alt="">`),t.removeClass("selected"),o.addClass("selected has-image"),n.val(i.url)}),e.open()}else t.removeClass("selected"),o.addClass("selected"),n.val(o.data("icon"))});const o=n.val();o?o.startsWith("http://")||o.startsWith("https://")?e("#floating-icon-custom").addClass("selected has-image"):e(`#floating-icon-${o}`).addClass("selected"):(e("#floating-icon-preferences").addClass("selected"),n.val("preferences"))})},350(e,t,n){var i,o,s;o=[n(428)],void 0===(s="function"==typeof(i=function(e){var t=window;e.fn.confirm=function(n,i){return void 0===n&&(n={}),"string"==typeof n&&(n={content:n,title:i||!1}),e(this).each(function(){var i=e(this);i.attr("jc-attached")?console.warn("jConfirm has already been attached to this element ",i[0]):(i.on("click",function(o){o.preventDefault();var s=e.extend({},n);if(i.attr("data-title")&&(s.title=i.attr("data-title")),i.attr("data-content")&&(s.content=i.attr("data-content")),void 0===s.buttons&&(s.buttons={}),s.$target=i,i.attr("href")&&0===Object.keys(s.buttons).length){var c=e.extend(!0,{},t.jconfirm.pluginDefaults.defaultButtons,(t.jconfirm.defaults||{}).defaultButtons||{}),r=Object.keys(c)[0];s.buttons=c,s.buttons[r].action=function(){location.href=i.attr("href")}}s.closeIcon=!1,e.confirm(s)}),i.attr("jc-attached",!0))}),e(this)},e.confirm=function(n,i){void 0===n&&(n={}),"string"==typeof n&&(n={content:n,title:i||!1});var o=!(!1===n.buttons);if("object"!=typeof n.buttons&&(n.buttons={}),0===Object.keys(n.buttons).length&&o){var s=e.extend(!0,{},t.jconfirm.pluginDefaults.defaultButtons,(t.jconfirm.defaults||{}).defaultButtons||{});n.buttons=s}return t.jconfirm(n)},e.alert=function(n,i){void 0===n&&(n={}),"string"==typeof n&&(n={content:n,title:i||!1});var o=!(!1===n.buttons);if("object"!=typeof n.buttons&&(n.buttons={}),0===Object.keys(n.buttons).length&&o){var s=e.extend(!0,{},t.jconfirm.pluginDefaults.defaultButtons,(t.jconfirm.defaults||{}).defaultButtons||{}),c=Object.keys(s)[0];n.buttons[c]=s[c]}return t.jconfirm(n)},e.dialog=function(e,n){return void 0===e&&(e={}),"string"==typeof e&&(e={content:e,title:n||!1,closeIcon:function(){}}),e.buttons={},void 0===e.closeIcon&&(e.closeIcon=function(){}),e.confirmKeys=[13],t.jconfirm(e)},t.jconfirm=function(n){void 0===n&&(n={});var i=e.extend(!0,{},t.jconfirm.pluginDefaults);t.jconfirm.defaults&&(i=e.extend(!0,i,t.jconfirm.defaults)),i=e.extend(!0,{},i,n);var o=new t.Jconfirm(i);return t.jconfirm.instances.push(o),o},t.Jconfirm=function(t){e.extend(this,t),this._init()},t.Jconfirm.prototype={_init:function(){var n=this;t.jconfirm.instances.length||(t.jconfirm.lastFocused=e("body").find(":focus")),this._id=Math.round(99999*Math.random()),this.contentParsed=e(document.createElement("div")),this.lazyOpen||setTimeout(function(){n.open()},0)},_buildHTML:function(){var t=this;this._parseAnimation(this.animation,"o"),this._parseAnimation(this.closeAnimation,"c"),this._parseBgDismissAnimation(this.backgroundDismissAnimation),this._parseColumnClass(this.columnClass),this._parseTheme(this.theme),this._parseType(this.type);var n=e(this.template);n.find(".jconfirm-box").addClass(this.animationParsed).addClass(this.backgroundDismissAnimationParsed).addClass(this.typeParsed),this.typeAnimated&&n.find(".jconfirm-box").addClass("jconfirm-type-animated"),this.useBootstrap?(n.find(".jc-bs3-row").addClass(this.bootstrapClasses.row),n.find(".jc-bs3-row").addClass("justify-content-md-center justify-content-sm-center justify-content-xs-center justify-content-lg-center"),n.find(".jconfirm-box-container").addClass(this.columnClassParsed),this.containerFluid?n.find(".jc-bs3-container").addClass(this.bootstrapClasses.containerFluid):n.find(".jc-bs3-container").addClass(this.bootstrapClasses.container)):n.find(".jconfirm-box").css("width",this.boxWidth),this.titleClass&&n.find(".jconfirm-title-c").addClass(this.titleClass),n.addClass(this.themeParsed);var i="jconfirm-box"+this._id;n.find(".jconfirm-box").attr("aria-labelledby",i).attr("tabindex",-1),n.find(".jconfirm-content").attr("id",i),null!==this.bgOpacity&&n.find(".jconfirm-bg").css("opacity",this.bgOpacity),this.rtl&&n.addClass("jconfirm-rtl"),this.$el=n.appendTo(this.container),this.$jconfirmBoxContainer=this.$el.find(".jconfirm-box-container"),this.$jconfirmBox=this.$body=this.$el.find(".jconfirm-box"),this.$jconfirmBg=this.$el.find(".jconfirm-bg"),this.$title=this.$el.find(".jconfirm-title"),this.$titleContainer=this.$el.find(".jconfirm-title-c"),this.$content=this.$el.find("div.jconfirm-content"),this.$contentPane=this.$el.find(".jconfirm-content-pane"),this.$icon=this.$el.find(".jconfirm-icon-c"),this.$closeIcon=this.$el.find(".jconfirm-closeIcon"),this.$holder=this.$el.find(".jconfirm-holder"),this.$btnc=this.$el.find(".jconfirm-buttons"),this.$scrollPane=this.$el.find(".jconfirm-scrollpane"),t.setStartingPoint(),this._contentReady=e.Deferred(),this._modalReady=e.Deferred(),this.$holder.css({"padding-top":this.offsetTop,"padding-bottom":this.offsetBottom}),this.setTitle(),this.setIcon(),this._setButtons(),this._parseContent(),this.initDraggable(),this.isAjax&&this.showLoading(!1),e.when(this._contentReady,this._modalReady).then(function(){t.isAjaxLoading?setTimeout(function(){t.isAjaxLoading=!1,t.setContent(),t.setTitle(),t.setIcon(),setTimeout(function(){t.hideLoading(!1),t._updateContentMaxHeight()},100),"function"==typeof t.onContentReady&&t.onContentReady()},50):(t._updateContentMaxHeight(),t.setTitle(),t.setIcon(),"function"==typeof t.onContentReady&&t.onContentReady()),t.autoClose&&t._startCountDown()}).then(function(){t._watchContent()}),"none"===this.animation&&(this.animationSpeed=1,this.animationBounce=1),this.$body.css(this._getCSS(this.animationSpeed,this.animationBounce)),this.$contentPane.css(this._getCSS(this.animationSpeed,1)),this.$jconfirmBg.css(this._getCSS(this.animationSpeed,1)),this.$jconfirmBoxContainer.css(this._getCSS(this.animationSpeed,1))},_typePrefix:"jconfirm-type-",typeParsed:"",_parseType:function(e){this.typeParsed=this._typePrefix+e},setType:function(e){var t=this.typeParsed;this._parseType(e),this.$jconfirmBox.removeClass(t).addClass(this.typeParsed)},themeParsed:"",_themePrefix:"jconfirm-",setTheme:function(e){var t=this.theme;this.theme=e||this.theme,this._parseTheme(this.theme),t&&this.$el.removeClass(t),this.$el.addClass(this.themeParsed),this.theme=e},_parseTheme:function(t){var n=this;t=t.split(","),e.each(t,function(i,o){-1===o.indexOf(n._themePrefix)&&(t[i]=n._themePrefix+e.trim(o))}),this.themeParsed=t.join(" ").toLowerCase()},backgroundDismissAnimationParsed:"",_bgDismissPrefix:"jconfirm-hilight-",_parseBgDismissAnimation:function(t){var n=t.split(","),i=this;e.each(n,function(t,o){-1===o.indexOf(i._bgDismissPrefix)&&(n[t]=i._bgDismissPrefix+e.trim(o))}),this.backgroundDismissAnimationParsed=n.join(" ").toLowerCase()},animationParsed:"",closeAnimationParsed:"",_animationPrefix:"jconfirm-animation-",setAnimation:function(e){this.animation=e||this.animation,this._parseAnimation(this.animation,"o")},_parseAnimation:function(t,n){n=n||"o";var i=t.split(","),o=this;e.each(i,function(t,n){-1===n.indexOf(o._animationPrefix)&&(i[t]=o._animationPrefix+e.trim(n))});var s=i.join(" ").toLowerCase();return"o"===n?this.animationParsed=s:this.closeAnimationParsed=s,s},setCloseAnimation:function(e){this.closeAnimation=e||this.closeAnimation,this._parseAnimation(this.closeAnimation,"c")},setAnimationSpeed:function(e){this.animationSpeed=e||this.animationSpeed},columnClassParsed:"",setColumnClass:function(e){this.useBootstrap?(this.columnClass=e||this.columnClass,this._parseColumnClass(this.columnClass),this.$jconfirmBoxContainer.addClass(this.columnClassParsed)):console.warn("cannot set columnClass, useBootstrap is set to false")},_updateContentMaxHeight:function(){var t=e(window).height()-(this.$jconfirmBox.outerHeight()-this.$contentPane.outerHeight())-(this.offsetTop+this.offsetBottom);this.$contentPane.css({"max-height":t+"px"})},setBoxWidth:function(e){this.useBootstrap?console.warn("cannot set boxWidth, useBootstrap is set to true"):(this.boxWidth=e,this.$jconfirmBox.css("width",e))},_parseColumnClass:function(e){var t;switch(e=e.toLowerCase()){case"xl":case"xlarge":t="col-md-12";break;case"l":case"large":t="col-md-8 col-md-offset-2";break;case"m":case"medium":t="col-md-6 col-md-offset-3";break;case"s":case"small":t="col-md-4 col-md-offset-4";break;case"xs":case"xsmall":t="col-md-2 col-md-offset-5";break;default:t=e}this.columnClassParsed=t},initDraggable:function(){var t=this,n=this.$titleContainer;this.resetDrag(),this.draggable&&(n.on("mousedown",function(e){n.addClass("jconfirm-hand"),t.mouseX=e.clientX,t.mouseY=e.clientY,t.isDrag=!0}),e(window).on("mousemove."+this._id,function(e){t.isDrag&&(t.movingX=e.clientX-t.mouseX+t.initialX,t.movingY=e.clientY-t.mouseY+t.initialY,t.setDrag())}),e(window).on("mouseup."+this._id,function(){n.removeClass("jconfirm-hand"),t.isDrag&&(t.isDrag=!1,t.initialX=t.movingX,t.initialY=t.movingY)}))},resetDrag:function(){this.isDrag=!1,this.initialX=0,this.initialY=0,this.movingX=0,this.movingY=0,this.mouseX=0,this.mouseY=0,this.$jconfirmBoxContainer.css("transform","translate(0px, 0px)")},setDrag:function(){if(this.draggable){this.alignMiddle=!1;var t=this.$jconfirmBox.outerWidth(),n=this.$jconfirmBox.outerHeight(),i=e(window).width(),o=e(window).height(),s=this;if(s.movingX%1==0||s.movingY%1==0){if(s.dragWindowBorder){var c=i/2-t/2,r=o/2-n/2;r-=s.dragWindowGap,(c-=s.dragWindowGap)+s.movingX<0?s.movingX=-c:c-s.movingX<0&&(s.movingX=c),r+s.movingY<0?s.movingY=-r:r-s.movingY<0&&(s.movingY=r)}s.$jconfirmBoxContainer.css("transform","translate("+s.movingX+"px, "+s.movingY+"px)")}}},_scrollTop:function(){if("undefined"!=typeof pageYOffset)return pageYOffset;var e=document.body,t=document.documentElement;return(t=t.clientHeight?t:e).scrollTop},_watchContent:function(){var t=this;this._timer&&clearInterval(this._timer);var n=0;this._timer=setInterval(function(){if(t.smoothContent){var i=t.$content.outerHeight()||0;i!==n&&(n=i);var o=e(window).height();t.offsetTop+t.offsetBottom+t.$jconfirmBox.height()-t.$contentPane.height()+t.$content.height()<o?t.$contentPane.addClass("no-scroll"):t.$contentPane.removeClass("no-scroll")}},this.watchInterval)},_overflowClass:"jconfirm-overflow",_hilightAnimating:!1,highlight:function(){this.hiLightModal()},hiLightModal:function(){var e=this;if(!this._hilightAnimating){e.$body.addClass("hilight");var t=parseFloat(e.$body.css("animation-duration"))||2;this._hilightAnimating=!0,setTimeout(function(){e._hilightAnimating=!1,e.$body.removeClass("hilight")},1e3*t)}},_bindEvents:function(){var t=this;this.boxClicked=!1,this.$scrollPane.click(function(e){if(!t.boxClicked){var n,i=!1,o=!1;if("string"==typeof(n="function"==typeof t.backgroundDismiss?t.backgroundDismiss():t.backgroundDismiss)&&void 0!==t.buttons[n]?(i=n,o=!1):o=void 0===n||1==!!n,i){var s=t.buttons[i].action.apply(t);o=void 0===s||!!s}o?t.close():t.hiLightModal()}t.boxClicked=!1}),this.$jconfirmBox.click(function(e){t.boxClicked=!0});var n=!1;e(window).on("jcKeyDown."+t._id,function(e){n||(n=!0)}),e(window).on("keyup."+t._id,function(e){n&&(t.reactOnKey(e),n=!1)}),e(window).on("resize."+this._id,function(){t._updateContentMaxHeight(),setTimeout(function(){t.resetDrag()},100)})},_cubic_bezier:"0.36, 0.55, 0.19",_getCSS:function(e,t){return{"-webkit-transition-duration":e/1e3+"s","transition-duration":e/1e3+"s","-webkit-transition-timing-function":"cubic-bezier("+this._cubic_bezier+", "+t+")","transition-timing-function":"cubic-bezier("+this._cubic_bezier+", "+t+")"}},_setButtons:function(){var t=this,n=0;if("object"!=typeof this.buttons&&(this.buttons={}),e.each(this.buttons,function(i,o){n+=1,"function"==typeof o&&(t.buttons[i]=o={action:o}),t.buttons[i].text=o.text||i,t.buttons[i].btnClass=o.btnClass||"btn-default",t.buttons[i].action=o.action||function(){},t.buttons[i].keys=o.keys||[],t.buttons[i].isHidden=o.isHidden||!1,t.buttons[i].isDisabled=o.isDisabled||!1,e.each(t.buttons[i].keys,function(e,n){t.buttons[i].keys[e]=n.toLowerCase()});var s=e('<button type="button" class="btn"></button>').html(t.buttons[i].text).addClass(t.buttons[i].btnClass).prop("disabled",t.buttons[i].isDisabled).css("display",t.buttons[i].isHidden?"none":"").click(function(e){e.preventDefault();var n=t.buttons[i].action.apply(t,[t.buttons[i]]);t.onAction.apply(t,[i,t.buttons[i]]),t._stopCountDown(),(void 0===n||n)&&t.close()});t.buttons[i].el=s,t.buttons[i].setText=function(e){s.html(e)},t.buttons[i].addClass=function(e){s.addClass(e)},t.buttons[i].removeClass=function(e){s.removeClass(e)},t.buttons[i].disable=function(){t.buttons[i].isDisabled=!0,s.prop("disabled",!0)},t.buttons[i].enable=function(){t.buttons[i].isDisabled=!1,s.prop("disabled",!1)},t.buttons[i].show=function(){t.buttons[i].isHidden=!1,s.css("display","")},t.buttons[i].hide=function(){t.buttons[i].isHidden=!0,s.css("display","none")},t["$_"+i]=t["$$"+i]=s,t.$btnc.append(s)}),0===n&&this.$btnc.hide(),null===this.closeIcon&&0===n&&(this.closeIcon=!0),this.closeIcon){if(this.closeIconClass){var i='<i class="'+this.closeIconClass+'"></i>';this.$closeIcon.html(i)}this.$closeIcon.click(function(e){e.preventDefault();var n,i=!1,o=!1;if("string"==typeof(n="function"==typeof t.closeIcon?t.closeIcon():t.closeIcon)&&void 0!==t.buttons[n]?(i=n,o=!1):o=void 0===n||1==!!n,i){var s=t.buttons[i].action.apply(t);o=void 0===s||!!s}o&&t.close()}),this.$closeIcon.show()}else this.$closeIcon.hide()},setTitle:function(e,t){if(t=t||!1,void 0!==e)if("string"==typeof e)this.title=e;else if("function"==typeof e){"function"==typeof e.promise&&console.error("Promise was returned from title function, this is not supported.");var n=e();this.title="string"==typeof n&&n}else this.title=!1;this.isAjaxLoading&&!t||(this.$title.html(this.title||""),this.updateTitleContainer())},setIcon:function(e,t){if(t=t||!1,void 0!==e)if("string"==typeof e)this.icon=e;else if("function"==typeof e){var n=e();this.icon="string"==typeof n&&n}else this.icon=!1;this.isAjaxLoading&&!t||(this.$icon.html(this.icon?'<i class="'+this.icon+'"></i>':""),this.updateTitleContainer())},updateTitleContainer:function(){this.title||this.icon?this.$titleContainer.show():this.$titleContainer.hide()},setContentPrepend:function(e,t){e&&this.contentParsed.prepend(e)},setContentAppend:function(e){e&&this.contentParsed.append(e)},setContent:function(e,t){t=!!t;var n=this;e&&this.contentParsed.html("").append(e),this.isAjaxLoading&&!t||(this.$content.html(""),this.$content.append(this.contentParsed),setTimeout(function(){n.$body.find("input[autofocus]:visible:first").focus()},100))},loadingSpinner:!1,showLoading:function(e){this.loadingSpinner=!0,this.$jconfirmBox.addClass("loading"),e&&this.$btnc.find("button").prop("disabled",!0)},hideLoading:function(e){this.loadingSpinner=!1,this.$jconfirmBox.removeClass("loading"),e&&this.$btnc.find("button").prop("disabled",!1)},ajaxResponse:!1,contentParsed:"",isAjax:!1,isAjaxLoading:!1,_parseContent:function(){var t=this,n=" ";if("function"==typeof this.content){var i=this.content.apply(this);"string"==typeof i?this.content=i:"object"==typeof i&&"function"==typeof i.always?(this.isAjax=!0,this.isAjaxLoading=!0,i.always(function(e,n,i){t.ajaxResponse={data:e,status:n,xhr:i},t._contentReady.resolve(e,n,i),"function"==typeof t.contentLoaded&&t.contentLoaded(e,n,i)}),this.content=n):this.content=n}if("string"==typeof this.content&&"url:"===this.content.substr(0,4).toLowerCase()){this.isAjax=!0,this.isAjaxLoading=!0;var o=this.content.substring(4,this.content.length);e.get(o).done(function(e){t.contentParsed.html(e)}).always(function(e,n,i){t.ajaxResponse={data:e,status:n,xhr:i},t._contentReady.resolve(e,n,i),"function"==typeof t.contentLoaded&&t.contentLoaded(e,n,i)})}this.content||(this.content=n),this.isAjax||(this.contentParsed.html(this.content),this.setContent(),t._contentReady.resolve())},_stopCountDown:function(){clearInterval(this.autoCloseInterval),this.$cd&&this.$cd.remove()},_startCountDown:function(){var t=this,n=this.autoClose.split("|");if(2!==n.length)return console.error("Invalid option for autoClose. example 'close|10000'"),!1;var i=n[0],o=parseInt(n[1]);if(void 0===this.buttons[i])return console.error("Invalid button key '"+i+"' for autoClose"),!1;var s=Math.ceil(o/1e3);this.$cd=e('<span class="countdown"> ('+s+")</span>").appendTo(this["$_"+i]),this.autoCloseInterval=setInterval(function(){t.$cd.html(" ("+(s-=1)+") "),s<=0&&(t["$$"+i].trigger("click"),t._stopCountDown())},1e3)},_getKey:function(e){switch(e){case 192:return"tilde";case 13:return"enter";case 16:return"shift";case 9:return"tab";case 20:return"capslock";case 17:return"ctrl";case 91:return"win";case 18:return"alt";case 27:return"esc";case 32:return"space"}var t=String.fromCharCode(e);return!!/^[A-z0-9]+$/.test(t)&&t.toLowerCase()},reactOnKey:function(t){var n=this,i=e(".jconfirm");if(i.eq(i.length-1)[0]!==this.$el[0])return!1;var o=t.which;if(this.$content.find(":input").is(":focus")&&/13|32/.test(o))return!1;var s,c=this._getKey(o);"esc"===c&&this.escapeKey&&(!0===this.escapeKey?this.$scrollPane.trigger("click"):"string"!=typeof this.escapeKey&&"function"!=typeof this.escapeKey||(s="function"==typeof this.escapeKey?this.escapeKey():this.escapeKey)&&(void 0===this.buttons[s]?console.warn("Invalid escapeKey, no buttons found with key "+s):this["$_"+s].trigger("click"))),e.each(this.buttons,function(e,t){-1!==t.keys.indexOf(c)&&n["$_"+e].trigger("click")})},setDialogCenter:function(){console.info("setDialogCenter is deprecated, dialogs are centered with CSS3 tables")},_unwatchContent:function(){clearInterval(this._timer)},close:function(n){var i=this;return"function"==typeof this.onClose&&this.onClose(n),this._unwatchContent(),e(window).unbind("resize."+this._id),e(window).unbind("keyup."+this._id),e(window).unbind("jcKeyDown."+this._id),this.draggable&&(e(window).unbind("mousemove."+this._id),e(window).unbind("mouseup."+this._id),this.$titleContainer.unbind("mousedown")),i.$el.removeClass(i.loadedClass),e("body").removeClass("jconfirm-no-scroll-"+i._id),i.$jconfirmBoxContainer.removeClass("jconfirm-no-transition"),setTimeout(function(){i.$body.addClass(i.closeAnimationParsed),i.$jconfirmBg.addClass("jconfirm-bg-h");var n="none"===i.closeAnimation?1:i.animationSpeed;setTimeout(function(){i.$el.remove(),t.jconfirm.instances;for(var n=t.jconfirm.instances.length-1;n>=0;n--)t.jconfirm.instances[n]._id===i._id&&t.jconfirm.instances.splice(n,1);if(!t.jconfirm.instances.length&&i.scrollToPreviousElement&&t.jconfirm.lastFocused&&t.jconfirm.lastFocused.length&&e.contains(document,t.jconfirm.lastFocused[0])){var o=t.jconfirm.lastFocused;if(i.scrollToPreviousElementAnimate){var s=e(window).scrollTop(),c=t.jconfirm.lastFocused.offset().top,r=e(window).height();if(c>s&&c<s+r)o.focus();else{var a=c-Math.round(r/3);e("html, body").animate({scrollTop:a},i.animationSpeed,"swing",function(){o.focus()})}}else o.focus();t.jconfirm.lastFocused=!1}"function"==typeof i.onDestroy&&i.onDestroy()},.4*n)},50),!0},open:function(){return!this.isOpen()&&(this._buildHTML(),this._bindEvents(),this._open(),!0)},setStartingPoint:function(){var n=!1;if(!0!==this.animateFromElement&&this.animateFromElement)n=this.animateFromElement,t.jconfirm.lastClicked=!1;else{if(!t.jconfirm.lastClicked||!0!==this.animateFromElement)return!1;n=t.jconfirm.lastClicked,t.jconfirm.lastClicked=!1}if(!n)return!1;var i=n.offset(),o=n.outerHeight()/2,s=n.outerWidth()/2;o-=this.$jconfirmBox.outerHeight()/2,s-=this.$jconfirmBox.outerWidth()/2;var c=i.top+o;c-=this._scrollTop();var r=i.left+s,a=e(window).height()/2,l=e(window).width()/2;if(c-=a-this.$jconfirmBox.outerHeight()/2,r-=l-this.$jconfirmBox.outerWidth()/2,Math.abs(c)>a||Math.abs(r)>l)return!1;this.$jconfirmBoxContainer.css("transform","translate("+r+"px, "+c+"px)")},_open:function(){var e=this;"function"==typeof e.onOpenBefore&&e.onOpenBefore(),this.$body.removeClass(this.animationParsed),this.$jconfirmBg.removeClass("jconfirm-bg-h"),this.$body.focus(),e.$jconfirmBoxContainer.css("transform","translate(0px, 0px)"),setTimeout(function(){e.$body.css(e._getCSS(e.animationSpeed,1)),e.$body.css({"transition-property":e.$body.css("transition-property")+", margin"}),e.$jconfirmBoxContainer.addClass("jconfirm-no-transition"),e._modalReady.resolve(),"function"==typeof e.onOpen&&e.onOpen(),e.$el.addClass(e.loadedClass)},this.animationSpeed)},loadedClass:"jconfirm-open",isClosed:function(){return!this.$el||0===this.$el.parent().length},isOpen:function(){return!this.isClosed()},toggle:function(){this.isOpen()?this.close():this.open()}},t.jconfirm.instances=[],t.jconfirm.lastFocused=!1,t.jconfirm.pluginDefaults={template:'<div class="jconfirm"><div class="jconfirm-bg jconfirm-bg-h"></div><div class="jconfirm-scrollpane"><div class="jconfirm-row"><div class="jconfirm-cell"><div class="jconfirm-holder"><div class="jc-bs3-container"><div class="jc-bs3-row"><div class="jconfirm-box-container jconfirm-animated"><div class="jconfirm-box" role="dialog" aria-labelledby="labelled" tabindex="-1"><div class="jconfirm-closeIcon">×</div><div class="jconfirm-title-c"><span class="jconfirm-icon-c"></span><span class="jconfirm-title"></span></div><div class="jconfirm-content-pane"><div class="jconfirm-content"></div></div><div class="jconfirm-buttons"></div><div class="jconfirm-clear"></div></div></div></div></div></div></div></div></div></div>',title:"Hello",titleClass:"",type:"default",typeAnimated:!0,draggable:!0,dragWindowGap:15,dragWindowBorder:!0,animateFromElement:!0,alignMiddle:!0,smoothContent:!0,content:"Are you sure to continue?",buttons:{},defaultButtons:{ok:{action:function(){}},close:{action:function(){}}},contentLoaded:function(){},icon:"",lazyOpen:!1,bgOpacity:null,theme:"light",animation:"scale",closeAnimation:"scale",animationSpeed:400,animationBounce:1,escapeKey:!0,rtl:!1,container:"body",containerFluid:!1,backgroundDismiss:!1,backgroundDismissAnimation:"shake",autoClose:!1,closeIcon:null,closeIconClass:!1,watchInterval:100,columnClass:"col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1",boxWidth:"50%",scrollToPreviousElement:!0,scrollToPreviousElementAnimate:!0,useBootstrap:!0,offsetTop:40,offsetBottom:40,bootstrapClasses:{container:"container",containerFluid:"container-fluid",row:"row"},onContentReady:function(){},onOpenBefore:function(){},onOpen:function(){},onClose:function(){},onDestroy:function(){},onAction:function(){}};var n=!1;e(window).on("keydown",function(t){if(!n){var i=!1;e(t.target).closest(".jconfirm-box").length&&(i=!0),i&&e(window).trigger("jcKeyDown"),n=!0}}),e(window).on("keyup",function(){n=!1}),t.jconfirm.lastClicked=!1,e(document).on("mousedown","button, a, [jc-source]",function(){t.jconfirm.lastClicked=e(this)})})?i.apply(t,o):i)||(e.exports=s)},405(){(window.WPConsentHelp||function(e,t,n){const i={init:function(){i.should_init()&&(i.find_elements(),i.init_show(),i.init_close_button(),i.init_search(),i.init_accordion())},should_init:()=>(i.$overlay=n("#wpconsent-docs-overlay"),i.$overlay.length>0),find_elements(){i.$close_button=n("#wpconsent-help-close"),i.$search=n("#wpconsent-help-search"),i.$no_result=n("#wpconsent-help-no-result"),i.$search_results=n("#wpconsent-help-result ul"),i.$categories=n("#wpconsent-help-categories")},init_close_button(){i.$close_button.on("click",function(e){e.preventDefault(),i.$overlay.fadeOut(200)})},init_show(){n(e).on("click",".wpconsent-show-help",function(e){e.preventDefault(),i.$overlay.fadeIn(200)})},init_accordion(){i.$categories.on("click",".wpconsent-help-category header",function(){const e=n(this).closest(".wpconsent-help-category");i.toggle_category(e)}),i.$categories.on("click",".viewall",function(e){e.preventDefault(),n(this).closest(".wpconsent-help-docs").find("div").slideDown(),n(this).hide()})},toggle_category(e){e.toggleClass("open"),e.find(".wpconsent-help-docs").slideToggle()},init_search(){i.$search.on("keyup","input",i.input_search),i.$search.on("click","#wpconsent-help-search-clear",i.clear_search)},input_search(){i.$search_results.html("");const e=n(this).val().toLowerCase(),t=n("#wpconsent-help-categories .wpconsent-help-docs li").filter(function(){return n(this).text().toLowerCase().indexOf(""+e)>-1});e.length>2&&t.clone().appendTo(i.$search_results),0===t.length?i.$no_result.show():i.$no_result.hide(),i.$search.toggleClass("wpconsent-search-empty",!e)},clear_search(){i.$search.find("input").val("").trigger("keyup")}};return i}(document,window,jQuery)).init()},425(){!function(e){"use strict";e("body").hasClass("wpconsent_page_wpconsent-cookies")&&(e("#enable_consent_banner").on("change",function(){const t=e("#enable_script_blocking").closest(".wpconsent-metabox-form-row-input"),n=e("#enable_script_blocking");this.checked?t.removeClass("disabled"):(t.addClass("disabled"),n.prop("checked",!1))}),e(document).ready(function(){if(!e("#enable_consent_banner").is(":checked")){const t=e("#enable_script_blocking").closest(".wpconsent-metabox-form-row-input"),n=e("#enable_script_blocking");t.addClass("disabled"),n.prop("checked",!1)}}))}(jQuery)},428(e){"use strict";e.exports=window.jQuery},469(){jQuery(function(e){e(".wpconsent-colorpicker").each(function(){e(this).wrap('<div class="wpconsent-colorpicker-wrap"></div>'),e(this).before('<div class="wpconsent-color-preview"></div>');const t=e(this).val()||"#ffffff";e(this).siblings(".wpconsent-color-preview").css("background-color",t),e(this).iris({defaultColor:!1,change:function(t,n){e(this).val(n.color.toString()),e(this).siblings(".wpconsent-color-preview").css("background-color",n.color.toString());var i=e(this).data("target"),o=e(this).data("target-property")||"background-color",s=document.getElementById("wpconsent-container").shadowRoot.querySelector(i);e(s).css(o,n.color.toString())},hide:!0,border:!0,palettes:!0})}),e(document).click(function(t){e(t.target).is(".wpconsent-colorpicker, .iris-picker, .iris-picker *")||e(".wpconsent-colorpicker").each(function(){e(this).iris("hide")})}),e(".wpconsent-colorpicker").click(function(t){t.stopPropagation(),e(".wpconsent-colorpicker").iris("hide"),e(this).iris("show")})})},609(){(window.WPConsentSpinner||function(e,t,n){const i={init(){t.WPConsentSpinner=i,i.spinner=n("#wpconsent-admin-spinner")},show_button_spinner(e,t="right"){e.prop("disabled",!0);const o=e.offset(),s=n("#adminmenuwrap"),c=n("#wpadminbar"),r=s.is(":visible")?s.width():0,a=c.is(":visible")?c.height():0;let l={};i.spinner.show(),l="right"===t?{left:o.left-r+e.outerWidth(),top:o.top-a+e.outerHeight()/2-i.spinner.height()/2}:{left:o.left-r-i.spinner.outerWidth()-20,top:o.top-a+e.outerHeight()/2-i.spinner.height()/2},i.spinner.css(l)},hide_button_spinner(e){e.prop("disabled",!1),i.spinner.hide()}};return i}(document,window,jQuery)).init()},615(){(window.WPConsentInputs||function(e,t,n){const i={init(){n(i.ready)},ready(){i.initCheckbox(),i.initShowHidden(),i.itemToggle(),i.initFileUploads()},initCheckbox(){n(e).on("change",".wpconsent-styled-checkbox input",function(){var e=n(this);e.prop("checked")?e.parent().addClass("checked"):e.parent().removeClass("checked")})},initShowHidden(){n(e).on("click",".wpconsent-show-hidden",function(e){e.preventDefault();const t=n(this).data("target"),i=n(this).data("hide-label");if(n(this).closest(".wpconsent-show-hidden-container").find(t).toggleClass("wpconsent-visible"),i){const e=n(this).text(),t=n(this).data("hide-label");n(this).data("hide-label",e),n(this).text(n(this).text()===e?t:e)}})},itemToggle(){n(e).on("click",".wpconsent-onboarding-selectable-item",function(e){if(n(e.target).closest(".wpconsent-onboarding-service-info").length)return;const t=n(this).find('input[type="checkbox"]');t.prop("checked",!t.prop("checked")).trigger("change")})},initFileUploads(){n(".wpconsent-file-upload").each(function(){const e=n(this).find("input[type=file]"),t=n(this).find("label").find(".placeholder");e.on("change",function(e){let n="";this.files&&this.files.length>1?n=(this.getAttribute("data-multiple-caption")||"").replace("{count}",this.files.length):e.target.value&&(n=e.target.value.split("\\").pop()),n?t.html(n):t.html("No file chosen")}),e.on("focus",function(){e.addClass("has-focus")}).on("blur",function(){e.removeClass("has-focus")})})}};return i}(document,window,jQuery)).init()},622(){window.WPConsentCookieManagement=class{constructor(){document.getElementById("wpconsent-modal-add-cookie")&&(this.modal=new WPConsentModalForm("wpconsent-modal-add-cookie"),this.bindEvents()),this.initializeAccordions()}bindEvents(){document.addEventListener("click",e=>{e.target.closest(".wpconsent-add-cookie")&&this.handleAddCookie(e)}),document.addEventListener("click",e=>{e.target.closest(".wpconsent-edit-cookie")&&this.handleEditCookie(e)}),document.addEventListener("click",e=>{e.target.closest(".wpconsent-delete-cookie")&&this.handleDeleteCookie(e)})}handleAddCookie(e){const t=e.target.closest(".wpconsent-add-cookie").dataset.categoryId;this.updateServicesSelect(t),this.modal.open({title:"Add New Cookie",data:{cookie_name:"",cookie_id:"",cookie_description:"",cookie_service_policy:"",cookie_service:"",category_duration:"",cookie_category:t,action:"wpconsent_manage_cookie"},successCallback:e=>{e.success&&this.addCookieToList(e.data,t),this.modal.close()}})}handleEditCookie(e){const t=e.target.closest(".wpconsent-edit-cookie"),n=t.closest(".wpconsent-cookie-item"),i=n.querySelector(".wpconsent-cookie-id").value,o=n.querySelector(".cookie-name").textContent,s=n.querySelector(".cookie-desc").textContent,c=t.closest(".wpconsent-accordion-item").querySelector(".wpconsent-add-cookie").dataset.categoryId,r=t.dataset.cookieId,a=n.querySelector(".wpconsent-cookie-service"),l=n.querySelector(".cookie-duration").textContent;let d=0;a&&(d=a.value),this.updateServicesSelect(c).then(()=>{this.modal.open({title:"Edit Cookie",data:{cookie_id:i,cookie_name:o,cookie_description:s,cookie_category:c,cookie_service:d,cookie_duration:l,post_id:r,action:"wpconsent_manage_cookie"},successCallback:e=>{e.success&&this.updateCookieInList(e.data),this.modal.close()}})})}handleDeleteCookie(e){if(!confirm("Are you sure you want to delete this cookie?"))return;const t=e.target.closest(".wpconsent-delete-cookie"),n=t.closest(".wpconsent-cookie-item"),i=t.dataset.cookieId,o=new FormData;o.append("action","wpconsent_delete_cookie"),o.append("cookie_id",i),o.append("nonce",window.wpconsent.nonce),fetch(ajaxurl,{method:"POST",body:o,credentials:"same-origin"}).then(e=>e.json()).then(e=>{e.success?(n.remove(),this.maybe_hide_header()):alert("Failed to delete cookie. Please try again.")}).catch(e=>{console.error("Error deleting cookie:",e),alert("Failed to delete cookie. Please try again.")})}addCookieToList(e,t){const n=document.querySelector(`.wpconsent-accordion-item [data-category-id="${t}"]`).closest(".wpconsent-accordion-item").querySelector(".wpconsent-cookies-list").querySelector(".wpconsent-cookie-header");let i=null;if(e.service_id){const t=document.querySelector(`.wpconsent-service-item .wpconsent-service-id[value="${e.service_id}"]`);t&&(i=t.closest(".wpconsent-service-item").querySelector(".wpconsent-cookies-list"))}const o=document.getElementById("wpconsent-new-cookie-row").innerHTML.replace(/{{id}}/g,e.id).replace(/{{name}}/g,e.name).replace(/{{description}}/g,e.description).replace(/{{duration}}/g,e.duration).replace(/{{cookie_id}}/g,e.cookie_id);i?i.insertAdjacentHTML("afterend",o):n.insertAdjacentHTML("afterend",o),this.maybe_hide_header();const s=n.closest(".wpconsent-accordion-content");s.style.maxHeight=s.scrollHeight+"px"}updateCookieInList(e){const t=document.querySelector(`.wpconsent-cookie-item .wpconsent-edit-cookie[data-cookie-id="${e.id}"]`).closest(".wpconsent-cookie-item");t&&(t.querySelector(".cookie-name").textContent=e.name,t.querySelector(".cookie-desc").textContent=e.description,t.querySelector(".cookie-duration").textContent=e.duration,t.querySelector(".wpconsent-cookie-id").value=e.cookie_id)}initializeAccordions(){document.querySelectorAll(".wpconsent-accordion").forEach(e=>{e.querySelectorAll(".wpconsent-accordion-item").forEach((e,t)=>{const n=e.querySelector(".wpconsent-accordion-header"),i=e.querySelector(".wpconsent-accordion-content"),o=e.querySelector(".wpconsent-accordion-toggle"),s=i?i.querySelector(".wpconsent-cookie-header"):null;if(0===t){e.classList.add("active"),i.style.maxHeight=i.scrollHeight+"px";const t=o.querySelector(".dashicons");t.classList.add("dashicons-arrow-up-alt2"),t.classList.remove("dashicons-arrow-down-alt2"),this.maybe_hide_header()}const c=t=>{if(t.target.closest(".wpconsent-button"))return;document.querySelectorAll(".wpconsent-accordion-item").forEach(t=>{if(t!==e){t.classList.remove("active"),t.querySelector(".wpconsent-accordion-content").style.maxHeight=null;const e=t.querySelector(".wpconsent-accordion-toggle .dashicons");e.classList.add("dashicons-arrow-down-alt2"),e.classList.remove("dashicons-arrow-up-alt2")}}),e.classList.toggle("active");const n=o.querySelector(".dashicons");n.classList.toggle("dashicons-arrow-down-alt2"),n.classList.toggle("dashicons-arrow-up-alt2"),e.classList.contains("active")?i.style.maxHeight=i.scrollHeight+"px":i.style.maxHeight=null};n.addEventListener("click",c),s&&s.addEventListener("click",t=>{e.classList.contains("active")||c(t)})})})}updateServicesSelect(e=null){const t=document.getElementById("cookie_category"),n=document.getElementById("cookie_service");if(!t||!n)return;e&&(t.value=e);const i=new FormData;return i.append("action","wpconsent_get_services"),i.append("category_id",t.value),i.append("nonce",window.wpconsent.nonce),fetch(ajaxurl,{method:"POST",body:i,credentials:"same-origin"}).then(e=>e.json()).then(e=>{e.success&&(n.innerHTML=e.data)}).catch(e=>{console.error("Error updating services select:",e)})}maybe_hide_header(){document.querySelectorAll(".wpconsent-cookies-list").forEach(e=>{const t=Array.from(e.children).some(e=>e.classList.contains("wpconsent-cookie-item")),n=e.querySelector(".wpconsent-cookie-header");n&&(n.style.display=t?"grid":"none")})}},document.addEventListener("DOMContentLoaded",()=>{new WPConsentCookieManagement})},708(){var e;window.WPConsentConfirm=window.WPConsentConfirm||(document,window,e=jQuery,{please_wait:null,show_please_wait(t=wpconsent.please_wait,n=!1){let i='<div class="wpconsent-loading-ring"></div>';return n&&(i+='<div class="wpconsent-progress-container"><div class="wpconsent-progress-bar" style="width: 0%"></div><div class="wpconsent-progress-text">0 of 0</div></div>'),this.please_wait=e.confirm({title:t,closeIcon:!1,content:i,boxWidth:"600px",theme:"modern loader-spinner",buttons:{close:{isHidden:!0}},onOpenBefore:function(){this.buttons.close.hide(),this.$content.parent().addClass("jconfirm-loading")},onClose:function(){this.$content.parent().removeClass("jconfirm-loading")}}),this.please_wait},update_progress(e,t){if(this.please_wait){const n=this.please_wait.$content.find(".wpconsent-progress-bar"),i=this.please_wait.$content.find(".wpconsent-progress-text");if(n.length&&i.length){const o=Math.round(e/t*100);n.css("width",o+"%"),i.text(e+" of "+t)}}},close(){this.please_wait&&this.please_wait.close()}})},759(){window.WPConsentOnboarding=window.WPConsentOnboarding||function(e,t,n){const i={step:1,maxSteps:wpconsent.max_steps,init:function(){i.shouldInit()&&(i.findElements(),i.removeAdminBar(),i.stepButtons(),i.handleRenderingScan(),i.handleAutoConfigure(),i.handleBannerLayout(),i.handleCompleteOnboarding())},shouldInit:function(){return e.querySelector(".wpconsent-admin-page.wpconsent-onboarding")},findElements(){i.body=e.querySelector("body"),i.progressBar=e.querySelector(".wpconsent-onboarding-progress-bar-inner"),i.itemTemplate=e.getElementById("wpconsent-onboarding-selectable-item").innerHTML,i.servicesForm=e.getElementById("wpconsent-onboarding-services")},removeAdminBar:function(){e.documentElement.classList.remove("wp-toolbar")},nextStep(){i.step++,i.updateStep()},prevStep(){i.step--,i.updateStep()},updateStep(){for(let e=1;e<=i.maxSteps;e++)i.body.classList.remove("wpconsent-onboarding-step-"+e);const e=new CustomEvent("wpconsent_onboarding_step_change",{detail:{step:i.step}});t.dispatchEvent(e),i.body.classList.add("wpconsent-onboarding-step-"+i.step),i.updateProgressBar()},updateProgressBar(){const e=i.step/i.maxSteps*100;i.progressBar.style.width=e+"%"},stepButtons(){const t=e.querySelectorAll(".wpconsent-onboarding-next"),n=e.querySelectorAll(".wpconsent-onboarding-prev");t.forEach(function(e){e.addEventListener("click",i.nextStep)}),n.forEach(function(e){e.addEventListener("click",i.prevStep)})},handleRenderingScan(){n(e).on("wpconsent_after_scan",function(e,t){i.saveUsageTrackingPreference(),i.nextStep();const n=i.servicesForm.querySelector(".wpconsent-onboarding-selectable-list");n.innerHTML="",Object.values(t.data.scripts).forEach(function(e){e.forEach(function(e){i.addItem(e,n)})})})},addItem(t,n){let o=i.itemTemplate.replaceAll("{{name}}",t.name);o=o.replaceAll("{{logo}}",t.logo),o=o.replaceAll("{{description}}",t.description),o=o.replaceAll("{{service}}",t.service);const s=e.createElement("div");s.innerHTML=o,s.firstElementChild.querySelector('input[type="checkbox"]').checked=!0,n.appendChild(s.firstElementChild)},handleAutoConfigure(){n(e).on("submit","#wpconsent-onboarding-services",function(e){e.preventDefault();const t=n(this).serialize();WPConsentConfirm.show_please_wait(wpconsent.configuring_title),n.post(ajaxurl,t,function(e){WPConsentConfirm.close(),e.success&&i.nextStep()})})},handleBannerLayout(){n(e).on("submit","#wpconsent-onboarding-banner-layout",function(e){e.preventDefault();const i=n(this).serialize();WPConsentConfirm.show_please_wait(wpconsent.banner_title),n.post(ajaxurl,i,function(e){WPConsentConfirm.close(),e.success&&(t.location.href=e.data.redirect)})})},handleCompleteOnboarding(){n(e).on("click",".wpconsent-complete-onboarding",function(e){e.preventDefault(),WPConsentConfirm.show_please_wait(wpconsent.completing_title),n.post(ajaxurl,{action:"wpconsent_complete_onboarding",nonce:wpconsent.nonce},function(e){WPConsentConfirm.close(),e.success&&(t.location.href=e.data.redirect)})})},saveUsageTrackingPreference(){const t=e.getElementById("wpconsent-usage-tracking");if(t){const e=t.checked?1:0;n.post(ajaxurl,{action:"wpconsent_save_usage_tracking",nonce:wpconsent.nonce,usage_tracking:e})}}};return i}(document,window,jQuery),WPConsentOnboarding.init()},766(){jQuery(function(e){function t(){WPConsentAdminNotices.show_pro_notice(wpconsent.scanner.title,wpconsent.scanner.text,wpconsent.scanner.url)}jQuery("#wpconsent-records-of-consent-lite").on("change",function(){jQuery(this).prop("checked",!1),WPConsentAdminNotices.show_pro_notice(wpconsent.records_of_consent.title,wpconsent.records_of_consent.text,wpconsent.records_of_consent.url)}),jQuery("#wpconsent-auto-scanner-lite").on("change",function(){jQuery(this).prop("checked",!1),t()}),jQuery('[for="wpconsent-auto-scanner-lite"], [for="wpconsent-auto-scanner-interval-lite"], #wpconsent-auto-scanner-interval-lite').on("click",function(e){e.preventDefault(),t()}),jQuery("#wpconsent-export-custom-scripts-lite").on("change",function(){jQuery(this).prop("checked",!1),WPConsentAdminNotices.show_pro_notice(wpconsent.custom_scripts_export.title,wpconsent.custom_scripts_export.text,wpconsent.custom_scripts_export.url)}),e(".wpconsent-languages-button-lite").on("click",function(){WPConsentAdminNotices.show_pro_notice(wpconsent.languages_upsell.title,wpconsent.languages_upsell.text,wpconsent.languages_upsell.url)}),e(".wpconsent-add-service-from-library-lite").on("click",function(){WPConsentAdminNotices.show_pro_notice(wpconsent.service_library_upsell.title,wpconsent.service_library_upsell.text,wpconsent.service_library_upsell.url)}),e("#export-records-of-consent-lite .wpconsent-button").on("click",function(e){e.preventDefault(),WPConsentAdminNotices.show_pro_notice(wpconsent.consent_logs_export.title,wpconsent.consent_logs_export.text,wpconsent.consent_logs_export.url)}),e("#export-do-not-track-lite .wpconsent-button").on("click",function(e){e.preventDefault(),WPConsentAdminNotices.show_pro_notice(wpconsent.do_not_track_export.title,wpconsent.do_not_track_export.text,wpconsent.do_not_track_export.url)}),e("#delete-consent-logs-lite .wpconsent-button").on("click",function(e){e.preventDefault(),WPConsentAdminNotices.show_pro_notice(wpconsent.consent_logs_delete.title,wpconsent.consent_logs_delete.text,wpconsent.consent_logs_delete.url)}),e("#delete-dnt-logs-lite .wpconsent-button").on("click",function(e){e.preventDefault(),WPConsentAdminNotices.show_pro_notice(wpconsent.do_not_track_delete.title,wpconsent.do_not_track_delete.text,wpconsent.do_not_track_delete.url)})})},875(){!function(e,t,n){"use strict";const i={init(){this.findElements(),this.bindEvents()},findElements(){this.$sslVerifyButton=n("#wpconsent-ssl-verify"),this.$sslSettings=n("#test-ssl-connections")},bindEvents(){this.$sslVerifyButton.on("click",e=>{e.preventDefault(),this.verifySSL()})},verifySSL(){const e=this.$sslVerifyButton,i=e.text(),o=e.outerWidth(),s={action:"wpconsent_verify_ssl",nonce:t.wpconsent.nonce};e.css("width",o).prop("disabled",!0).text(t.wpconsent.testing||"Testing..."),n.post(t.ajaxurl,s,t=>{this.$sslSettings.find(".wpconsent-alert, .wpconsent-ssl-error").remove(),t.success&&this.$sslSettings.before('<div class="wpconsent-alert wpconsent-alert-success">'+t.data.msg+"</div>"),!t.success&&t.data.msg&&this.$sslSettings.before('<div class="wpconsent-alert wpconsent-alert-danger">'+t.data.msg+"</div>"),!t.success&&t.data.debug&&this.$sslSettings.before('<div class="wpconsent-ssl-error pre-error">'+t.data.debug+"</div>"),e.css("width",o).prop("disabled",!1).text(i)}).fail(()=>{this.$sslSettings.find(".wpconsent-alert, .wpconsent-ssl-error").remove(),this.$sslSettings.before('<div class="wpconsent-alert wpconsent-alert-danger">An unexpected error occurred. Please try again.</div>'),e.css("width",o).prop("disabled",!1).text(i)})}};n(e).ready(()=>{i.init()})}(document,window,jQuery)},887(){class e{constructor(){document.getElementById("wpconsent-modal-add-service")&&(this.modal=new WPConsentModalForm("wpconsent-modal-add-service"),this.bindEvents())}bindEvents(){document.addEventListener("click",e=>{e.target.closest(".wpconsent-add-service")&&this.handleAddService(e)}),document.addEventListener("click",e=>{e.target.closest(".wpconsent-edit-service")&&this.handleEditService(e)}),document.addEventListener("click",e=>{e.target.closest(".wpconsent-delete-service")&&this.handleDeleteService(e)})}handleAddService(e){const t=e.target.closest(".wpconsent-add-service").dataset.categoryId;this.modal.open({title:"Add New Service",beforeOpen:()=>{const e=document.querySelector("#cookie_category");e&&(e.value=t)},data:{service_name:"",service_description:"",service_url:"",service_category:t,action:"wpconsent_manage_service"},successCallback:e=>{e.success&&this.addServiceToList(e.data),this.modal.close()}})}handleEditService(e){const t=e.target.closest(".wpconsent-edit-service"),n=t.closest(".wpconsent-service-item"),i=(n.querySelector(".wpconsent-service-id").value,n.querySelector(".wpconsent-service-url").value),o=n.querySelector(".service-name").textContent,s=n.querySelector(".service-desc").textContent,c=t.closest(".wpconsent-accordion-item").querySelector(".wpconsent-add-cookie").dataset.categoryId,r=t.dataset.serviceId;this.modal.open({title:"Edit Service",beforeOpen:()=>{const e=document.querySelector("#cookie_category");e&&(e.value=c)},data:{post_id:r,service_name:o,service_description:s,service_url:i,service_category:c,action:"wpconsent_manage_service"},successCallback:e=>{e.success&&this.updateServiceInList(e.data),this.modal.close()}})}handleDeleteService(e){if(!confirm("Are you sure you want to delete this service?"))return;const t=e.target.closest(".wpconsent-delete-service"),n=t.closest(".wpconsent-service-item"),i=t.dataset.serviceId,o=new FormData;o.append("action","wpconsent_delete_service"),o.append("service_id",i),o.append("nonce",window.wpconsent.nonce),fetch(ajaxurl,{method:"POST",body:o,credentials:"same-origin"}).then(e=>e.json()).then(e=>{e.success?n.remove():alert("Failed to delete service. Please try again.")}).catch(e=>{console.error("Error deleting service:",e),alert("Failed to delete service. Please try again.")})}addServiceToList(e){const t=e.category_id,n=document.querySelector(`.wpconsent-accordion-item [data-category-id="${t}"]`).closest(".wpconsent-accordion-item").querySelector(".wpconsent-cookies-list"),i=document.getElementById("wpconsent-new-service-row").innerHTML.replace(/{{name}}/g,e.name).replace(/{{description}}/g,e.description).replace(/{{service_id}}/g,e.cookie_id).replace(/{{service_url}}/g,e.service_url).replace(/{{id}}/g,e.cookie_id);n.insertAdjacentHTML("beforeend",i);const o=n.closest(".wpconsent-accordion-content");o.style.maxHeight=o.scrollHeight+"px"}updateServiceInList(e){const t=document.querySelector(`.wpconsent-service-item .wpconsent-edit-service[data-service-id="${e.id}"]`).closest(".wpconsent-service-item");t&&(t.querySelector(".service-name").textContent=e.name,t.querySelector(".service-desc").textContent=e.description)}}document.addEventListener("DOMContentLoaded",()=>{const t=new e;document.addEventListener("wpconsent:service-added",e=>{if(t.addServiceToList(e.detail),e.detail.cookies&&e.detail.cookies.length>0){const t=new WPConsentCookieManagement;e.detail.cookies.forEach(n=>{n.service_id=e.detail.id,t.addCookieToList(n,e.detail.category_id)})}})})},918(){!function(){let e=[],t=0,n=[],i=[],o={},s="",c=!1;const r=[];let a=0,l=0,d={name:"",categoryId:"",serviceId:""};function h(){const e=document.getElementById("wpconsent-review-category"),t=document.getElementById("wpconsent-review-service");if(!e||!t)return;const n=""!==e.value;t.disabled=!n;const o=parseInt(e.value,10),s=n?i.filter(e=>e.category_id===o):[];t.innerHTML="";const r=document.createElement("option");r.value="0",r.textContent=wpconsentInspectorReview.i18n.none,t.appendChild(r);const a=document.createElement("option");a.value="new",a.textContent=wpconsentInspectorReview.i18n.createNewService,t.appendChild(a);const l=document.createElement("option");l.value="library",l.textContent=c?wpconsentInspectorReview.i18n.addFromLibrary:wpconsentInspectorReview.i18n.addFromLibraryPro,t.appendChild(l),s.forEach(e=>{const n=document.createElement("option");n.value=e.id,n.textContent=e.name,t.appendChild(n)})}function u(e){const t=document.getElementById("wpconsent-review-script-keywords");if(!t)return;const n=new Set(t.value.split(",").map(e=>e.trim()).filter(Boolean));e.querySelectorAll(".wpconsent-script-token").forEach(e=>{e.classList.toggle("wpconsent-script-token--selected",n.has(e.dataset.token))})}function p(e){const t=document.getElementById("wpconsent-review-inline-script-section"),n=document.getElementById("wpconsent-review-inline-script-code");t&&n&&(e.inlineScript?(t.style.display="",n.innerHTML=e.inlineScript.split(/(\b[a-zA-Z_$][a-zA-Z0-9_$]*\b)/).map((e,t)=>{const n=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return 1==t%2?`<span class="wpconsent-script-token" data-token="${n}">${n}</span>`:n}).join(""),u(n),n.onclick=e=>{const t=e.target.closest(".wpconsent-script-token");t&&(function(e){const t=document.getElementById("wpconsent-review-script-keywords");if(!t)return;const n=t.value.split(",").map(e=>e.trim()).filter(Boolean),i=n.indexOf(e);-1===i?n.push(e):n.splice(i,1),t.value=n.join(", ")}(t.dataset.token),u(n))}):t.style.display="none")}function m(e){if(!c)return void function(e){const t=document.getElementById("wpconsent-review-upgrade-prompt");if(!t)return;const i=document.getElementById("wpconsent-review-category"),o=(i&&i.options[i.selectedIndex],i?parseInt(i.value,10):0),s=n.find(e=>e.id===o),c=s&&"essential"===s.slug,r="pre-consent"===e.consentState,a=i&&""!==i.value;if(r&&a&&!c){const e=document.getElementById("wpconsent-review-upgrade-message");e&&(e.textContent=wpconsentInspectorReview.i18n.upgradePrompt),t.style.display=""}else t.style.display="none"}(e);const t=document.getElementById("wpconsent-review-blocking-section"),i=document.getElementById("wpconsent-review-already-blocked"),s=document.getElementById("wpconsent-review-create-rule"),a=document.getElementById("wpconsent-review-blocked-message"),l=document.getElementById("wpconsent-review-block-toggle"),d=document.getElementById("wpconsent-review-block-description"),h=document.getElementById("wpconsent-review-script-tag"),u=document.getElementById("wpconsent-review-script-keywords"),m=document.getElementById("wpconsent-review-blocking-fields");if(!t)return;if(!e.suggestedPattern&&!e.scriptUrl)return t.style.display="none",void p({inlineScript:null});t.style.display="";const f=function(e,t){for(const n of r){if(n.scriptTag&&e&&-1!==e.indexOf(n.scriptTag))return{blocked:!0,label:n.serviceName,isSession:!0};if(n.scriptTag&&t&&-1!==t.indexOf(n.scriptTag))return{blocked:!0,label:n.serviceName,isSession:!0};if(n.keywords){const t=n.keywords.split(",").map(e=>e.trim());for(const i of t)if(i&&e&&-1!==e.indexOf(i))return{blocked:!0,label:n.serviceName,isSession:!0}}}for(const n of Object.keys(o))for(const i of Object.keys(o[n])){const s=o[n][i],c=s.scripts||[];for(const n of c){if(e&&n&&-1!==e.indexOf(n))return{blocked:!0,label:s.label||i,isSession:!1};if(t&&n&&-1!==t.indexOf(n))return{blocked:!0,label:s.label||i,isSession:!1}}}return{blocked:!1,label:"",isSession:!1}}(e.suggestedPattern||"",e.scriptUrl||"");if(f.blocked)i.style.display="",s.style.display="none",f.isSession?a.textContent=wpconsentInspectorReview.i18n.willBeBlocked.replace("%s",f.label):a.textContent=wpconsentInspectorReview.i18n.alreadyBlocked.replace("%s",f.label),p({inlineScript:null});else{i.style.display="none",s.style.display="";const t=document.getElementById("wpconsent-review-category"),n=t?t.options[t.selectedIndex]?.textContent:"";d.textContent=wpconsentInspectorReview.i18n.blockDescription.replace("%s",n),d.style.color="",h&&(h.value=e.scriptUrl&&e.suggestedPattern||""),u&&(u.value=!e.scriptUrl&&e.suggestedPattern?e.suggestedPattern:""),l&&(l.checked=!0),m&&(m.style.display=""),p(e)}}function f(n){if(n>=e.length)return void function(){const e=document.getElementById("wpconsent-inspector-review-wizard"),t=document.getElementById("wpconsent-inspector-review-complete"),n=document.getElementById("wpconsent-inspector-review-summary");if(e&&(e.style.display="none"),t&&(t.style.display=""),!n)return;const i=[],o=wpconsentInspectorReview.pagesInspected||0;if(o>0&&i.push(g(o,"summaryPagesOne","summaryPagesMany")),a>0&&i.push(g(a,"summarySavedOne","summarySavedMany")),l>0&&i.push(g(l,"summarySkippedOne","summarySkippedMany")),r.length>0&&i.push(g(r.length,"summaryRulesOne","summaryRulesMany")),i.length>0){const e=document.createElement("ul");i.forEach(t=>{const n=document.createElement("li");n.textContent=t,e.appendChild(n)}),n.appendChild(e)}}();const i=document.getElementById("wpconsent-inspector-review-loading"),o=document.getElementById("wpconsent-inspector-review-form");i&&(i.style.display="none"),o&&(o.style.display=""),t=n;const s=e[n],c=document.getElementById("wpconsent-review-current"),u=document.getElementById("wpconsent-review-total");c&&(c.textContent=n+1),u&&(u.textContent=e.length);const p=document.getElementById("wpconsent-review-badge-current");p&&(p.textContent=n+1);const f=document.getElementById("wpconsent-review-cookie-name");f&&(f.textContent=s.name);const v=document.getElementById("wpconsent-review-consent-badge");v&&("pre-consent"===s.consentState?(v.textContent=wpconsentInspectorReview.i18n.loadedBeforeConsent,v.style.display=""):v.style.display="none");const _=document.getElementById("wpconsent-review-cookie-pages");_&&(_.innerHTML="",(s.pages||[]).forEach(e=>{const t=document.createElement("span");t.className="wpconsent-input-area-description",t.style.display="block";try{const n=new URL(e);t.textContent=n.pathname}catch(n){t.textContent=e}_.appendChild(t)}));const w=document.getElementById("wpconsent-review-source-row"),y=document.getElementById("wpconsent-review-source-pattern"),b=document.getElementById("wpconsent-review-source-url");w&&y&&b&&(s.suggestedPattern?(y.textContent=s.suggestedPattern,b.textContent=s.scriptUrl||"",w.style.display=""):w.style.display="none");const C=document.getElementById("wpconsent-review-description"),E=document.getElementById("wpconsent-review-duration");C&&(C.value=""),E&&(E.value=s.duration||"");const x=document.getElementById("wpconsent-review-category");if(d.name&&function(e,t){const n=e.split(/[_\-.]/),i=t.split(/[_\-.]/);let o=0;for(let e=0;e<Math.min(n.length,i.length)&&n[e].toLowerCase()===i[e].toLowerCase();e++)o++;return o>0?n.slice(0,o).join("_"):""}(s.name,d.name)&&x){x.value=d.categoryId,h();const e=document.getElementById("wpconsent-review-service");e&&(e.value=d.serviceId)}else x&&(x.value=""),h();m(s)}function g(e,t,n){const i=wpconsentInspectorReview.i18n;return(1===e?i[t]:i[n]).replace("%s",e)}function v(){const n=e[t],i=document.getElementById("wpconsent-review-category"),o=document.getElementById("wpconsent-review-service"),c=document.getElementById("wpconsent-review-description"),l=document.getElementById("wpconsent-review-duration"),h=document.getElementById("wpconsent-review-save");h&&(h.disabled=!0);const u=i?i.value:"",p=o?o.value:0;if(!u)return i&&i.focus(),void(h&&(h.disabled=!1));if(_()&&(!p||"0"===p)){o&&o.focus();const e=document.getElementById("wpconsent-review-block-description");return e&&(e.textContent=wpconsentInspectorReview.i18n.serviceRequiredForBlocking,e.style.color="#d63638"),void(h&&(h.disabled=!1))}jQuery.post(ajaxurl,{action:"wpconsent_inspector_add_cookie",nonce:s,cookie_id:n.name,cookie_name:n.name,cookie_description:c?c.value:"",cookie_category:u,cookie_service:p,cookie_duration:l?l.value:"",dismiss:"true"}).done(()=>{a++,d={name:n.name,categoryId:u,serviceId:p},_()?function(e,t,n){const i=document.getElementById("wpconsent-review-script-tag"),o=document.getElementById("wpconsent-review-script-keywords"),c=document.getElementById("wpconsent-review-service"),a=c?c.options[c.selectedIndex]?.textContent:"",l=i?i.value.trim():"",d=o?o.value.trim():"";l||d?jQuery.post(ajaxurl,{action:"wpconsent_inspector_add_blocking_rule",nonce:s,rule_category:e,rule_service:t,script_tag:l,script_keywords:d}).done(e=>{e.success&&r.push({scriptTag:l,keywords:d,serviceName:a||"Custom"})}).always(n):n()}(u,p,()=>{y(h)}):y(h)}).fail(()=>{y(h)})}function _(){const e=document.getElementById("wpconsent-review-blocking-section"),t=document.getElementById("wpconsent-review-create-rule"),n=document.getElementById("wpconsent-review-block-toggle");return!(!e||"none"===e.style.display)&&!(!t||"none"===t.style.display)&&n&&n.checked}function w(e){const t=document.getElementById("wpconsent-inspector-review-form");if(!t)return void e();t.classList.add("wpconsent-review-transitioning-out");const n=()=>{t.removeEventListener("transitionend",n),e(),t.classList.remove("wpconsent-review-transitioning-out"),t.classList.add("wpconsent-review-transitioning-in"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.classList.remove("wpconsent-review-transitioning-in")})})};t.addEventListener("transitionend",n,{once:!0}),setTimeout(()=>{t.classList.contains("wpconsent-review-transitioning-out")&&n()},250)}function y(e){e&&(e.disabled=!1),t++,w(()=>f(t))}function b(){const n=e[t];l++,jQuery.post(ajaxurl,{action:"wpconsent_inspector_dismiss_cookie",nonce:s,cookie_name:n.name}).always(()=>{t++,w(()=>f(t))})}function C(){const e=document.getElementById("wpconsent-modal-inspector-service");e&&(e.style.display="none")}function E(e){e.preventDefault();const t=e.target,n=new FormData(t),o={};for(const[e,t]of n.entries())o[e]=t;const s=t.querySelector(".wpconsent-button-primary");s&&(s.disabled=!0),jQuery.post(ajaxurl,o).done(e=>{if(e.success){const t=e.data.id;i.push({id:t,name:o.service_name,category_id:parseInt(o.service_category,10)}),h();const n=document.getElementById("wpconsent-review-service");n&&(n.value=t),C()}}).always(()=>{s&&(s.disabled=!1)})}document.addEventListener("DOMContentLoaded",function(){"undefined"!=typeof wpconsentInspectorReview&&document.getElementById("wpconsent-inspector-review-wizard")&&(e=wpconsentInspectorReview.cookies||[],n=wpconsentInspectorReview.categories||[],i=wpconsentInspectorReview.services||[],o=wpconsentInspectorReview.blockingRules||{},c=wpconsentInspectorReview.isPro||!1,s=wpconsentInspectorReview.nonce||"",0!==e.length&&(e.sort((e,t)=>e.name.localeCompare(t.name)),function(){const e=document.getElementById("wpconsent-review-category");if(!e)return;e.innerHTML="";const t=document.createElement("option");t.value="",t.textContent=wpconsentInspectorReview.i18n.chooseCategory,t.disabled=!0,t.selected=!0,e.appendChild(t),n.forEach(t=>{const n=document.createElement("option");n.value=t.id,n.textContent=t.name,e.appendChild(n)}),h()}(),function(){const n=document.getElementById("wpconsent-review-save");n&&n.addEventListener("click",v);const o=document.getElementById("wpconsent-review-skip");o&&o.addEventListener("click",b);const s=document.getElementById("wpconsent-review-category");s&&s.addEventListener("change",()=>{h(),t<e.length&&m(e[t])});const r=document.getElementById("wpconsent-review-service");r&&r.addEventListener("change",()=>{"new"===r.value?(r.value="0",function(){const e=document.getElementById("wpconsent-modal-inspector-service");if(!e)return;const t=document.getElementById("wpconsent-review-category"),n=document.getElementById("inspector_service_category"),i=t?t.value:"",o=e.querySelector("form");o&&o.reset(),n&&i&&(n.value=i),e.style.display="block"}()):"library"===r.value&&(r.value="0",c?function(){if(void 0===window.WPConsentServiceLibrary)return;const e=document.getElementById("wpconsent-review-category");if(!e||!e.value)return;const t=e.options[e.selectedIndex],n=t?t.textContent:"";window.WPConsentServiceLibrary.open(e.value,n)}():window.WPConsentAdminNotices&&wpconsent&&wpconsent.service_library_upsell?WPConsentAdminNotices.show_pro_notice(wpconsent.service_library_upsell.title,wpconsent.service_library_upsell.text,wpconsent.service_library_upsell.url):"undefined"!=typeof console&&console.warn("WPConsentAdminNotices not available for service library upsell."))});const a=document.getElementById("wpconsent-review-block-toggle"),l=document.getElementById("wpconsent-review-blocking-fields");a&&l&&a.addEventListener("change",()=>{l.style.display=a.checked?"":"none"});const d=document.getElementById("wpconsent-modal-inspector-service");if(d){const e=d.querySelector("form");d.querySelector(".wpconsent-modal-close")?.addEventListener("click",C),d.querySelector(".wpconsent-button-secondary")?.addEventListener("click",C),e&&e.addEventListener("submit",E)}document.addEventListener("wpconsent:service-added",function(e){const t=e.detail;if(!t||!t.id)return;i.find(e=>String(e.id)===String(t.id))||i.push({id:t.id,name:t.name,category_id:parseInt(t.category_id,10)}),h();const n=document.getElementById("wpconsent-review-service");n&&(n.value=t.id)})}(),f(0)))})}()},936(){!function(){"use strict";const e=document.querySelector(".wpconsent-alert-bar");e&&e.addEventListener("click",function(t){const n=t.target.closest(".wpconsent-alert-bar-dismiss");if(!n)return;const i=n.closest(".wpconsent-alert-bar-item");i&&(i.style.transition="opacity 0.2s ease",i.style.opacity="0",setTimeout(function(){i.remove(),e.querySelector(".wpconsent-alert-bar-item")||e.remove()},200))});const t=document.querySelector(".wpconsent-score-toggle-btn");if(t){const e=document.querySelector(".wpconsent-score-details-content"),n=t.dataset.showText||"",i=t.dataset.hideText||"";e&&t.addEventListener("click",function(){const o="none"===e.style.display;e.style.display=o?"":"none",t.classList.toggle("wpconsent-score-toggle-open",o),t.querySelector(".wpconsent-score-toggle-text").textContent=o?i:n})}const n=document.querySelector(".wpconsent-compliance-score");n&&(n.addEventListener("click",function(e){const t=e.target.closest(".wpconsent-score-action-toggle");if(!t)return;const n=t.dataset.setting;if(!n)return;const i=t.textContent;t.disabled=!0,t.textContent=wpconsent.please_wait||"Please wait...";const o=new FormData;o.append("action","wpconsent_toggle_setting"),o.append("nonce",wpconsent.nonce),o.append("setting",n),fetch(ajaxurl,{method:"POST",body:o}).then(function(e){return e.json()}).then(function(e){e.success?window.location.reload():(t.disabled=!1,t.textContent=wpconsent.error||"Error",setTimeout(function(){t.textContent=i},2e3))}).catch(function(){t.disabled=!1,t.textContent=i})}),n.addEventListener("click",function(e){const t=e.target.closest(".wpconsent-score-action-generate-policy");if(!t)return;const n=t.textContent;t.disabled=!0,t.textContent=wpconsent.please_wait||"Please wait...";const i=new FormData;i.append("action","wpconsent_generate_cookie_policy"),i.append("nonce",wpconsent.nonce),fetch(ajaxurl,{method:"POST",body:i}).then(function(e){return e.json()}).then(function(e){e.success?window.location.reload():(t.disabled=!1,t.textContent=e.data&&e.data.message?e.data.message:wpconsent.error||"Error",setTimeout(function(){t.textContent=n},3e3))}).catch(function(){t.disabled=!1,t.textContent=n})}));const i=document.querySelector(".wpconsent-suggestions");if(i&&i.addEventListener("click",function(e){const t=e.target.closest(".wpconsent-suggestion-dismiss");if(!t)return;const n=t.closest(".wpconsent-suggestion-item"),o=t.dataset.suggestion;if(!n||!o)return;const s=new FormData;s.append("action","wpconsent_dismiss_suggestion"),s.append("nonce",wpconsent.nonce),s.append("suggestion",o),fetch(ajaxurl,{method:"POST",body:s}).then(function(e){return e.json()}).then(function(e){if(e.success){t.remove(),n.classList.add("wpconsent-suggestion-item-dismissed");const e=document.querySelector(".wpconsent-dismissed-suggestions-area");if(e){const t=e.querySelector(".wpconsent-suggestion-list-dismissed");t&&(n.style.transition="opacity 0.3s ease",n.style.opacity="0",setTimeout(function(){t.appendChild(n),n.style.opacity="1",e.style.display="",i.querySelector(".wpconsent-suggestion-item:not(.wpconsent-suggestion-item-dismissed)")||(i.style.display="none")},300))}}})}),!document.querySelector(".wpconsent-banner-preview-widget"))return;const o=document.getElementById("wpconsent-container");if(!o)return;let s=0;!function e(){const t=o.shadowRoot;if(!t)return void(s<50&&(s++,setTimeout(e,100)));const n=t.querySelector("#wpconsent-banner-holder");n&&n.classList.add("wpconsent-banner-preview-visible")}()}()},961(){class e{constructor(){document.getElementById("wpconsent-modal-add-category")&&(this.addButton=document.getElementById("wpconsent-add-category"),this.modal=new WPConsentModalForm("wpconsent-modal-add-category"),this.bindEvents())}bindEvents(){this.addButton&&this.addButton.addEventListener("click",()=>this.handleAddCategory()),document.addEventListener("click",e=>{e.target.closest(".wpconsent-button-enabled-column .wpconsent-edit-category")&&this.handleEditCategory(e)}),document.addEventListener("click",e=>{e.target.closest(".wpconsent-button-enabled-column .wpconsent-delete-category")&&this.handleDeleteCategory(e)})}handleAddCategory(){this.modal.open({title:"Add New Category",data:{category_name:"",action:"wpconsent_add_category"},successCallback:e=>{e.success&&this.addCategoryToList(e.data),this.modal.close()}})}handleEditCategory(e){const t=e.target.closest(".wpconsent-button-row"),n=t.dataset.buttonId,i=t.querySelector(".wpconsent-button-label-column").textContent.trim(),o=t.querySelector(".wpconsent-category-description").value.trim();this.modal.open({title:"Edit Category",data:{category_name:i,category_id:n,category_description:o,action:"wpconsent_edit_category"},successCallback:e=>{e.success&&this.updateCategoryInList(e.data),this.modal.close()}})}handleDeleteCategory(e){if(!confirm("Are you sure you want to delete this category?"))return;const t=e.target.closest(".wpconsent-button-row"),n=t.dataset.buttonId,i=new FormData;i.append("action","wpconsent_delete_category"),i.append("category_id",n),i.append("nonce",window.wpconsent.nonce),fetch(ajaxurl,{method:"POST",body:i,credentials:"same-origin"}).then(e=>e.json()).then(e=>{e.success?t.remove():alert("Failed to delete category. Please try again.")}).catch(e=>{console.error("Error deleting category:",e),alert("Failed to delete category. Please try again.")})}addCategoryToList(e){const t=document.getElementById("wpconsent-new-category-row").innerHTML.replace(/{{id}}/g,e.id).replace(/{{name}}/g,e.name).replace(/{{description}}/g,e.description);document.querySelector(".wpconsent-actions-row").insertAdjacentHTML("beforebegin",t)}updateCategoryInList(e){const t=document.querySelector(`[data-button-id="${e.id}"]`);t.querySelector(".wpconsent-button-label-column").textContent=e.name,t.querySelector(".wpconsent-category-description").value=e.description}}document.addEventListener("DOMContentLoaded",()=>{new e})}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,n),s.exports}(()=>{"use strict";n(350),window.jconfirm.defaults={closeIcon:!1,backgroundDismiss:!1,escapeKey:!0,animationBounce:1,useBootstrap:!1,theme:"modern",boxWidth:"560px",type:"blue",animateFromElement:!1,scrollToPreviousElement:!1},n(469),n(197),n(50),n(54),n(249),n(239),n(615),n(192),n(961),n(622),n(887);var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function __(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(__.prototype=n.prototype,new __)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)};function o(e,t,n){if(n||2===arguments.length)for(var i,o=0,s=t.length;o<s;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var s,c="ADD_CHOICE",r="REMOVE_CHOICE",a="FILTER_CHOICES",l="ACTIVATE_CHOICES",d="CLEAR_CHOICES",h="ADD_GROUP",u="ADD_ITEM",p="REMOVE_ITEM",m="HIGHLIGHT_ITEM",f="search",g="removeItem",v="highlightItem",_=["fuseOptions","classNames"],w="select-one",y="select-multiple",b=function(e){return{type:r,choice:e}},C=function(e){return{type:p,item:e}},E=function(e,t){return{type:m,item:e,highlighted:t}},x=function(e){return Array.from({length:e},function(){return Math.floor(36*Math.random()+0).toString(36)}).join("")},S=function(e){if("string"!=typeof e){if(null==e)return"";if("object"==typeof e){if("raw"in e)return S(e.raw);if("trusted"in e)return e.trusted}return e}return e.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/'/g,"'").replace(/"/g,""")},k=(s=document.createElement("div"),function(e){s.innerHTML=e.trim();for(var t=s.children[0];s.firstChild;)s.removeChild(s.firstChild);return t}),I=function(e,t){return"function"==typeof e?e(S(t),t):e},A=function(e){return"function"==typeof e?e():e},L=function(e){if("string"==typeof e)return e;if("object"==typeof e){if("trusted"in e)return e.trusted;if("raw"in e)return e.raw}return""},j=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):S(t)},P=function(e,t,n){e.innerHTML=j(t,n)},O=function(e,t){return e.rank-t.rank},T=function(e){return Array.isArray(e)?e:[e]},$=function(e){return e&&Array.isArray(e)?e.map(function(e){return".".concat(e)}).join(""):".".concat(e)},B=function(e,t){var n;(n=e.classList).add.apply(n,T(t))},D=function(e,t){var n;(n=e.classList).remove.apply(n,T(t))},M=function(e){if(void 0!==e)try{return JSON.parse(e)}catch(t){return e}return{}},F=function(){function e(e){var t=e.element,n=e.type,i=e.classNames;this.element=t,this.classNames=i,this.type=n,this.isActive=!1}return e.prototype.show=function(){return B(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","true"),this.isActive=!0,this},e.prototype.hide=function(){return D(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this},e}(),q=function(){function e(e){var t=e.element,n=e.type,i=e.classNames,o=e.position;this.element=t,this.classNames=i,this.type=n,this.position=o,this.isOpen=!1,this.isFlipped=!1,this.isDisabled=!1,this.isLoading=!1}return e.prototype.shouldFlip=function(e,t){var n=!1;return"auto"===this.position?n=this.element.getBoundingClientRect().top-t>=0&&!window.matchMedia("(min-height: ".concat(e+1,"px)")).matches:"top"===this.position&&(n=!0),n},e.prototype.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},e.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},e.prototype.open=function(e,t){B(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e,t)&&(B(this.element,this.classNames.flippedState),this.isFlipped=!0)},e.prototype.close=function(){D(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(D(this.element,this.classNames.flippedState),this.isFlipped=!1)},e.prototype.addFocusState=function(){B(this.element,this.classNames.focusState)},e.prototype.removeFocusState=function(){D(this.element,this.classNames.focusState)},e.prototype.enable=function(){D(this.element,this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===w&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},e.prototype.disable=function(){B(this.element,this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===w&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},e.prototype.wrap=function(e){var t=this.element,n=e.parentNode;n&&(e.nextSibling?n.insertBefore(t,e.nextSibling):n.appendChild(t)),t.appendChild(e)},e.prototype.unwrap=function(e){var t=this.element,n=t.parentNode;n&&(n.insertBefore(e,t),n.removeChild(t))},e.prototype.addLoadingState=function(){B(this.element,this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},e.prototype.removeLoadingState=function(){D(this.element,this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},e}(),N=function(){function e(e){var t=e.element,n=e.type,i=e.classNames,o=e.preventPaste;this.element=t,this.type=n,this.classNames=i,this.preventPaste=o,this.isFocussed=this.element.isEqualNode(document.activeElement),this.isDisabled=t.disabled,this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}return Object.defineProperty(e.prototype,"placeholder",{set:function(e){this.element.placeholder=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.addEventListeners=function(){var e=this.element;e.addEventListener("paste",this._onPaste),e.addEventListener("input",this._onInput,{passive:!0}),e.addEventListener("focus",this._onFocus,{passive:!0}),e.addEventListener("blur",this._onBlur,{passive:!0})},e.prototype.removeEventListeners=function(){var e=this.element;e.removeEventListener("input",this._onInput),e.removeEventListener("paste",this._onPaste),e.removeEventListener("focus",this._onFocus),e.removeEventListener("blur",this._onBlur)},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.isDisabled=!0},e.prototype.focus=function(){this.isFocussed||this.element.focus()},e.prototype.blur=function(){this.isFocussed&&this.element.blur()},e.prototype.clear=function(e){return void 0===e&&(e=!0),this.element.value="",e&&this.setWidth(),this},e.prototype.setWidth=function(){var e=this.element;e.style.minWidth="".concat(e.placeholder.length+1,"ch"),e.style.width="".concat(e.value.length+1,"ch")},e.prototype.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},e.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},e.prototype._onInput=function(){this.type!==w&&this.setWidth()},e.prototype._onPaste=function(e){this.preventPaste&&e.preventDefault()},e.prototype._onFocus=function(){this.isFocussed=!0},e.prototype._onBlur=function(){this.isFocussed=!1},e}(),W=function(){function e(e){var t=e.element;this.element=t,this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight}return e.prototype.prepend=function(e){var t=this.element.firstElementChild;t?this.element.insertBefore(e,t):this.element.append(e)},e.prototype.scrollToTop=function(){this.element.scrollTop=0},e.prototype.scrollToChildElement=function(e,t){var n=this;if(e){var i=this.element.offsetHeight,o=this.element.scrollTop+i,s=e.offsetHeight,c=e.offsetTop+s,r=t>0?this.element.scrollTop+c-o:e.offsetTop;requestAnimationFrame(function(){n._animateScroll(r,t)})}},e.prototype._scrollDown=function(e,t,n){var i=(n-e)/t,o=i>1?i:1;this.element.scrollTop=e+o},e.prototype._scrollUp=function(e,t,n){var i=(e-n)/t,o=i>1?i:1;this.element.scrollTop=e-o},e.prototype._animateScroll=function(e,t){var n=this,i=this.element.scrollTop,o=!1;t>0?(this._scrollDown(i,4,e),i<e&&(o=!0)):(this._scrollUp(i,4,e),i>e&&(o=!0)),o&&requestAnimationFrame(function(){n._animateScroll(e,t)})},e}(),R=function(){function e(e){var t=e.element,n=e.classNames;this.element=t,this.classNames=n,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e=this.element;B(e,this.classNames.input),e.hidden=!0,e.tabIndex=-1;var t=e.getAttribute("style");t&&e.setAttribute("data-choice-orig-style",t),e.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e=this.element;D(e,this.classNames.input),e.hidden=!1,e.removeAttribute("tabindex");var t=e.getAttribute("data-choice-orig-style");t?(e.removeAttribute("data-choice-orig-style"),e.setAttribute("style",t)):e.removeAttribute("style"),e.removeAttribute("data-choice")},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,n){void 0===n&&(n=null);var i=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0});e.dispatchEvent(i)}(this.element,e,t||{})},e}(),H=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n}(R),K=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},V=function(e){if("string"==typeof e&&(e=e.split(" ").filter(function(e){return e.length})),Array.isArray(e)&&e.length)return e},Q=function(e,t){if("string"==typeof e)return Q({value:e,label:e},!1);var n=e;if("choices"in n){if(!t)throw new TypeError("optGroup is not allowed");var i=n,o=i.choices.map(function(e){return Q(e,!1)});return{id:0,label:L(i.label)||i.value,active:!!o.length,disabled:!!i.disabled,choices:o}}var s=n;return{id:0,group:null,score:0,rank:0,value:s.value,label:s.label||s.value,active:K(s.active),selected:K(s.selected,!1),disabled:K(s.disabled,!1),placeholder:K(s.placeholder,!1),highlighted:!1,labelClass:V(s.labelClass),labelDescription:s.labelDescription,customProperties:s.customProperties}},U=function(e){return"SELECT"===e.tagName},z=function(e){function n(t){var n=t.element,i=t.classNames,o=t.template,s=t.extractPlaceholder,c=e.call(this,{element:n,classNames:i})||this;return c.template=o,c.extractPlaceholder=s,c}return t(n,e),Object.defineProperty(n.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),n.prototype.addOptions=function(e){var t=this,n=document.createDocumentFragment();e.forEach(function(e){var i=e;if(!i.element){var o=t.template(i);n.appendChild(o),i.element=o}}),this.element.appendChild(n)},n.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach(function(n){!function(e){return"OPTION"===e.tagName}(n)?function(e){return"OPTGROUP"===e.tagName}(n)&&t.push(e._optgroupToChoice(n)):t.push(e._optionToChoice(n))}),t},n.prototype._optionToChoice=function(e){return!e.hasAttribute("value")&&e.hasAttribute("placeholder")&&(e.setAttribute("value",""),e.value=""),{id:0,group:null,score:0,rank:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(!e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?V(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:M(e.dataset.customProperties)}},n.prototype._optgroupToChoice=function(e){var t=this,n=e.querySelectorAll("option"),i=Array.from(n).map(function(e){return t._optionToChoice(e)});return{id:0,label:e.label||"",element:e,active:!!i.length,disabled:e.disabled,choices:i}},n}(R),G={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,closeDropdownOnSelect:"auto",singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:function(e,t){var n=e.value,i=e.label,o=void 0===i?n:i,s=t.value,c=t.label,r=void 0===c?s:c;return L(o).localeCompare(L(r),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(e){return'Press Enter to add <b>"'.concat(e,'"</b>')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],placeholder:["choices__placeholder"],group:["choices__group"],groupHeading:["choices__heading"],button:["choices__button"],activeState:["is-active"],focusState:["is-focused"],openState:["is-open"],disabledState:["is-disabled"],highlightedState:["is-highlighted"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],notice:["choices__notice"],addChoice:["choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},X=function(e){var t=e.itemEl;t&&(t.remove(),e.itemEl=void 0)},Y={groups:function(e,t){var n=e,i=!0;switch(t.type){case h:n.push(t.group);break;case d:n=[];break;default:i=!1}return{state:n,update:i}},items:function(e,t,n){var i=e,o=!0;switch(t.type){case u:t.item.selected=!0,(s=t.item.element)&&(s.selected=!0,s.setAttribute("selected","")),i.push(t.item);break;case p:var s;if(t.item.selected=!1,s=t.item.element){s.selected=!1,s.removeAttribute("selected");var c=s.parentElement;c&&U(c)&&c.type===w&&(c.value="")}X(t.item),i=i.filter(function(e){return e.id!==t.item.id});break;case r:X(t.choice),i=i.filter(function(e){return e.id!==t.choice.id});break;case m:var a=t.highlighted,l=i.find(function(e){return e.id===t.item.id});l&&l.highlighted!==a&&(l.highlighted=a,n&&function(e,t,n){var i=e.itemEl;i&&(D(i,n),B(i,t))}(l,a?n.classNames.highlightedState:n.classNames.selectedState,a?n.classNames.selectedState:n.classNames.highlightedState));break;default:o=!1}return{state:i,update:o}},choices:function(e,t,n){var i=e,o=!0;switch(t.type){case c:i.push(t.choice);break;case r:t.choice.choiceEl=void 0,t.choice.group&&(t.choice.group.choices=t.choice.group.choices.filter(function(e){return e.id!==t.choice.id})),i=i.filter(function(e){return e.id!==t.choice.id});break;case u:case p:t.item.choiceEl=void 0;break;case a:var s=[];t.results.forEach(function(e){s[e.item.id]=e}),i.forEach(function(e){var t=s[e.id];void 0!==t?(e.score=t.score,e.rank=t.rank,e.active=!0):(e.score=0,e.rank=0,e.active=!1),n&&n.appendGroupInSearch&&(e.choiceEl=void 0)});break;case l:i.forEach(function(e){e.active=t.active,n&&n.appendGroupInSearch&&(e.choiceEl=void 0)});break;case d:i=[];break;default:o=!1}return{state:i,update:o}}},J=function(){function e(e){this._state=this.defaultState,this._listeners=[],this._txn=0,this._context=e}return Object.defineProperty(e.prototype,"defaultState",{get:function(){return{groups:[],items:[],choices:[]}},enumerable:!1,configurable:!0}),e.prototype.changeSet=function(e){return{groups:e,items:e,choices:e}},e.prototype.reset=function(){this._state=this.defaultState;var e=this.changeSet(!0);this._txn?this._changeSet=e:this._listeners.forEach(function(t){return t(e)})},e.prototype.subscribe=function(e){return this._listeners.push(e),this},e.prototype.dispatch=function(e){var t=this,n=this._state,i=!1,o=this._changeSet||this.changeSet(!1);Object.keys(Y).forEach(function(s){var c=Y[s](n[s],e,t._context);c.update&&(i=!0,o[s]=!0,n[s]=c.state)}),i&&(this._txn?this._changeSet=o:this._listeners.forEach(function(e){return e(o)}))},e.prototype.withTxn=function(e){this._txn++;try{e()}finally{if(this._txn=Math.max(0,this._txn-1),!this._txn){var t=this._changeSet;t&&(this._changeSet=void 0,this._listeners.forEach(function(e){return e(t)}))}}},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightedActiveItems",{get:function(){return this.items.filter(function(e){return!e.disabled&&e.active&&e.highlighted})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"choices",{get:function(){return this.state.choices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeChoices",{get:function(){return this.choices.filter(function(e){return e.active})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"searchableChoices",{get:function(){return this.choices.filter(function(e){return!e.disabled&&!e.placeholder})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groups",{get:function(){return this.state.groups},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeGroups",{get:function(){var e=this;return this.state.groups.filter(function(t){var n=t.active&&!t.disabled,i=e.state.choices.some(function(e){return e.active&&!e.disabled});return n&&i},[])},enumerable:!1,configurable:!0}),e.prototype.inTxn=function(){return this._txn>0},e.prototype.getChoiceById=function(e){return this.activeChoices.find(function(t){return t.id===e})},e.prototype.getGroupById=function(e){return this.groups.find(function(t){return t.id===e})},e}(),Z="no-choices",ee="no-results",te="add-choice";function ne(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(n),!0).forEach(function(t){ne(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function se(e){return Array.isArray?Array.isArray(e):"[object Array]"===he(e)}function ce(e){return"string"==typeof e}function re(e){return"number"==typeof e}function ae(e){return"object"==typeof e}function le(e){return null!=e}function de(e){return!e.trim().length}function he(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const ue=Object.prototype.hasOwnProperty;class pe{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=me(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function me(e){let t=null,n=null,i=null,o=1,s=null;if(ce(e)||se(e))i=e,t=fe(e),n=ge(e);else{if(!ue.call(e,"name"))throw new Error("Missing name property in key");const c=e.name;if(i=c,ue.call(e,"weight")&&(o=e.weight,o<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(c));t=fe(c),n=ge(c),s=e.getFn}return{path:t,id:n,weight:o,src:i,getFn:s}}function fe(e){return se(e)?e:e.split(".")}function ge(e){return se(e)?e.join("."):e}const ve={useExtendedSearch:!1,getFn:function(e,t){let n=[],i=!1;const o=(e,t,s)=>{if(le(e))if(t[s]){const c=e[t[s]];if(!le(c))return;if(s===t.length-1&&(ce(c)||re(c)||function(e){return!0===e||!1===e||function(e){return ae(e)&&null!==e}(e)&&"[object Boolean]"==he(e)}(c)))n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(c));else if(se(c)){i=!0;for(let e=0,n=c.length;e<n;e+=1)o(c[e],t,s+1)}else t.length&&o(c,t,s+1)}else n.push(e)};return o(e,ce(t)?t.split("."):t,0),i?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var _e=oe(oe(oe(oe({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1}),{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1}),{location:0,threshold:.6,distance:100}),ve);const we=/[^ ]+/g;class ye{constructor({getFn:e=_e.getFn,fieldNormWeight:t=_e.fieldNormWeight}={}){this.norm=function(e=1,t=3){const n=new Map,i=Math.pow(10,t);return{get(t){const o=t.match(we).length;if(n.has(o))return n.get(o);const s=1/Math.pow(o,.5*e),c=parseFloat(Math.round(s*i)/i);return n.set(o,c),c},clear(){n.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,ce(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();ce(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!le(e)||de(e))return;let n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){let n={i:t,$:{}};this.keys.forEach((t,i)=>{let o=t.getFn?t.getFn(e):this.getFn(e,t.path);if(le(o))if(se(o)){let e=[];const t=[{nestedArrIndex:-1,value:o}];for(;t.length;){const{nestedArrIndex:n,value:i}=t.pop();if(le(i))if(ce(i)&&!de(i)){let t={v:i,i:n,n:this.norm.get(i)};e.push(t)}else se(i)&&i.forEach((e,n)=>{t.push({nestedArrIndex:n,value:e})})}n.$[i]=e}else if(ce(o)&&!de(o)){let e={v:o,n:this.norm.get(o)};n.$[i]=e}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function be(e,t,{getFn:n=_e.getFn,fieldNormWeight:i=_e.fieldNormWeight}={}){const o=new ye({getFn:n,fieldNormWeight:i});return o.setKeys(e.map(me)),o.setSources(t),o.create(),o}function Ce(e,{errors:t=0,currentLocation:n=0,expectedLocation:i=0,distance:o=_e.distance,ignoreLocation:s=_e.ignoreLocation}={}){const c=t/e.length;if(s)return c;const r=Math.abs(i-n);return o?c+r/o:r?1:c}const Ee=32;function xe(e){let t={};for(let n=0,i=e.length;n<i;n+=1){const o=e.charAt(n);t[o]=(t[o]||0)|1<<i-n-1}return t}class Se{constructor(e,{location:t=_e.location,threshold:n=_e.threshold,distance:i=_e.distance,includeMatches:o=_e.includeMatches,findAllMatches:s=_e.findAllMatches,minMatchCharLength:c=_e.minMatchCharLength,isCaseSensitive:r=_e.isCaseSensitive,ignoreLocation:a=_e.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:i,includeMatches:o,findAllMatches:s,minMatchCharLength:c,isCaseSensitive:r,ignoreLocation:a},this.pattern=r?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const l=(e,t)=>{this.chunks.push({pattern:e,alphabet:xe(e),startIndex:t})},d=this.pattern.length;if(d>Ee){let e=0;const t=d%Ee,n=d-t;for(;e<n;)l(this.pattern.substr(e,Ee),e),e+=Ee;if(t){const e=d-Ee;l(this.pattern.substr(e),e)}}else l(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:n}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let t={isMatch:!0,score:0};return n&&(t.indices=[[0,e.length-1]]),t}const{location:i,distance:o,threshold:s,findAllMatches:c,minMatchCharLength:r,ignoreLocation:a}=this.options;let l=[],d=0,h=!1;this.chunks.forEach(({pattern:t,alphabet:u,startIndex:p})=>{const{isMatch:m,score:f,indices:g}=function(e,t,n,{location:i=_e.location,distance:o=_e.distance,threshold:s=_e.threshold,findAllMatches:c=_e.findAllMatches,minMatchCharLength:r=_e.minMatchCharLength,includeMatches:a=_e.includeMatches,ignoreLocation:l=_e.ignoreLocation}={}){if(t.length>Ee)throw new Error("Pattern length exceeds max of 32.");const d=t.length,h=e.length,u=Math.max(0,Math.min(i,h));let p=s,m=u;const f=r>1||a,g=f?Array(h):[];let v;for(;(v=e.indexOf(t,m))>-1;){let e=Ce(t,{currentLocation:v,expectedLocation:u,distance:o,ignoreLocation:l});if(p=Math.min(e,p),m=v+d,f){let e=0;for(;e<d;)g[v+e]=1,e+=1}}m=-1;let _=[],w=1,y=d+h;const b=1<<d-1;for(let i=0;i<d;i+=1){let s=0,r=y;for(;s<r;)Ce(t,{errors:i,currentLocation:u+r,expectedLocation:u,distance:o,ignoreLocation:l})<=p?s=r:y=r,r=Math.floor((y-s)/2+s);y=r;let a=Math.max(1,u-r+1),v=c?h:Math.min(u+r,h)+d,C=Array(v+2);C[v+1]=(1<<i)-1;for(let s=v;s>=a;s-=1){let c=s-1,r=n[e.charAt(c)];if(f&&(g[c]=+!!r),C[s]=(C[s+1]<<1|1)&r,i&&(C[s]|=(_[s+1]|_[s])<<1|1|_[s+1]),C[s]&b&&(w=Ce(t,{errors:i,currentLocation:c,expectedLocation:u,distance:o,ignoreLocation:l}),w<=p)){if(p=w,m=c,m<=u)break;a=Math.max(1,2*u-m)}}if(Ce(t,{errors:i+1,currentLocation:u,expectedLocation:u,distance:o,ignoreLocation:l})>p)break;_=C}const C={isMatch:m>=0,score:Math.max(.001,w)};if(f){const e=function(e=[],t=_e.minMatchCharLength){let n=[],i=-1,o=-1,s=0;for(let c=e.length;s<c;s+=1){let c=e[s];c&&-1===i?i=s:c||-1===i||(o=s-1,o-i+1>=t&&n.push([i,o]),i=-1)}return e[s-1]&&s-i>=t&&n.push([i,s-1]),n}(g,r);e.length?a&&(C.indices=e):C.isMatch=!1}return C}(e,t,u,{location:i+p,distance:o,threshold:s,findAllMatches:c,minMatchCharLength:r,includeMatches:n,ignoreLocation:a});m&&(h=!0),d+=f,m&&g&&(l=[...l,...g])});let u={isMatch:h,score:h?d/this.chunks.length:1};return h&&n&&(u.indices=l),u}}class ke{constructor(e){this.pattern=e}static isMultiMatch(e){return Ie(e,this.multiRegex)}static isSingleMatch(e){return Ie(e,this.singleRegex)}search(){}}function Ie(e,t){const n=e.match(t);return n?n[1]:null}class Ae extends ke{constructor(e,{location:t=_e.location,threshold:n=_e.threshold,distance:i=_e.distance,includeMatches:o=_e.includeMatches,findAllMatches:s=_e.findAllMatches,minMatchCharLength:c=_e.minMatchCharLength,isCaseSensitive:r=_e.isCaseSensitive,ignoreLocation:a=_e.ignoreLocation}={}){super(e),this._bitapSearch=new Se(e,{location:t,threshold:n,distance:i,includeMatches:o,findAllMatches:s,minMatchCharLength:c,isCaseSensitive:r,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class Le extends ke{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,n=0;const i=[],o=this.pattern.length;for(;(t=e.indexOf(this.pattern,n))>-1;)n=t+o,i.push([t,n-1]);const s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}}const je=[class extends ke{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},Le,class extends ke{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends ke{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends ke{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends ke{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends ke{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},Ae],Pe=je.length,Oe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Te=new Set([Ae.type,Le.type]);const $e=[];function Be(e,t){for(let n=0,i=$e.length;n<i;n+=1){let i=$e[n];if(i.condition(e,t))return new i(e,t)}return new Se(e,t)}const De="$and",Me="$path",Fe=e=>!(!e[De]&&!e.$or),qe=e=>({[De]:Object.keys(e).map(t=>({[t]:e[t]}))});function Ne(e,t,{auto:n=!0}={}){const i=e=>{let o=Object.keys(e);const s=(e=>!!e[Me])(e);if(!s&&o.length>1&&!Fe(e))return i(qe(e));if((e=>!se(e)&&ae(e)&&!Fe(e))(e)){const i=s?e[Me]:o[0],c=s?e.$val:e[i];if(!ce(c))throw new Error((e=>`Invalid value for key ${e}`)(i));const r={keyId:ge(i),pattern:c};return n&&(r.searcher=Be(c,t)),r}let c={children:[],operator:o[0]};return o.forEach(t=>{const n=e[t];se(n)&&n.forEach(e=>{c.children.push(i(e))})}),c};return Fe(e)||(e=qe(e)),i(e)}function We(e,t){const n=e.matches;t.matches=[],le(n)&&n.forEach(e=>{if(!le(e.indices)||!e.indices.length)return;const{indices:n,value:i}=e;let o={indices:n,value:i};e.key&&(o.key=e.key.src),e.idx>-1&&(o.refIndex=e.idx),t.matches.push(o)})}function Re(e,t){t.score=e.score}class He{constructor(e,t={},n){this.options=oe(oe({},_e),t),this.options.useExtendedSearch,this._keyStore=new pe(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof ye))throw new Error("Incorrect 'index' type");this._myIndex=t||be(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){le(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let n=0,i=this._docs.length;n<i;n+=1){const o=this._docs[n];e(o,n)&&(this.removeAt(n),n-=1,i-=1,t.push(o))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:o,sortFn:s,ignoreFieldNorm:c}=this.options;let r=ce(e)?ce(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=_e.ignoreFieldNorm}){e.forEach(e=>{let n=1;e.matches.forEach(({key:e,norm:i,score:o})=>{const s=e?e.weight:null;n*=Math.pow(0===o&&s?Number.EPSILON:o,(s||1)*(t?1:i))}),e.score=n})}(r,{ignoreFieldNorm:c}),o&&r.sort(s),re(t)&&t>-1&&(r=r.slice(0,t)),function(e,t,{includeMatches:n=_e.includeMatches,includeScore:i=_e.includeScore}={}){const o=[];return n&&o.push(We),i&&o.push(Re),e.map(e=>{const{idx:n}=e,i={item:t[n],refIndex:n};return o.length&&o.forEach(t=>{t(e,i)}),i})}(r,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){const t=Be(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:e,i:n,n:o})=>{if(!le(e))return;const{isMatch:s,score:c,indices:r}=t.searchIn(e);s&&i.push({item:e,idx:n,matches:[{score:c,value:e,norm:o,indices:r}]})}),i}_searchLogical(e){const t=Ne(e,this.options),n=(e,t,i)=>{if(!e.children){const{keyId:n,searcher:o}=e,s=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:o});return s&&s.length?[{idx:i,item:t,matches:s}]:[]}const o=[];for(let s=0,c=e.children.length;s<c;s+=1){const c=e.children[s],r=n(c,t,i);if(r.length)o.push(...r);else if(e.operator===De)return[]}return o},i=this._myIndex.records,o={},s=[];return i.forEach(({$:e,i})=>{if(le(e)){let c=n(t,e,i);c.length&&(o[i]||(o[i]={idx:i,item:e,matches:[]},s.push(o[i])),c.forEach(({matches:e})=>{o[i].matches.push(...e)}))}}),s}_searchObjectList(e){const t=Be(e,this.options),{keys:n,records:i}=this._myIndex,o=[];return i.forEach(({$:e,i})=>{if(!le(e))return;let s=[];n.forEach((n,i)=>{s.push(...this._findMatches({key:n,value:e[i],searcher:t}))}),s.length&&o.push({idx:i,item:e,matches:s})}),o}_findMatches({key:e,value:t,searcher:n}){if(!le(t))return[];let i=[];if(se(t))t.forEach(({v:t,i:o,n:s})=>{if(!le(t))return;const{isMatch:c,score:r,indices:a}=n.searchIn(t);c&&i.push({score:r,key:e,value:t,idx:o,norm:s,indices:a})});else{const{v:o,n:s}=t,{isMatch:c,score:r,indices:a}=n.searchIn(o);c&&i.push({score:r,key:e,value:o,norm:s,indices:a})}return i}}He.version="7.0.0",He.createIndex=be,He.parseIndex=function(e,{getFn:t=_e.getFn,fieldNormWeight:n=_e.fieldNormWeight}={}){const{keys:i,records:o}=e,s=new ye({getFn:t,fieldNormWeight:n});return s.setKeys(i),s.setIndexRecords(o),s},He.config=_e,He.parseQuery=Ne,function(...e){$e.push(...e)}(class{constructor(e,{isCaseSensitive:t=_e.isCaseSensitive,includeMatches:n=_e.includeMatches,minMatchCharLength:i=_e.minMatchCharLength,ignoreLocation:o=_e.ignoreLocation,findAllMatches:s=_e.findAllMatches,location:c=_e.location,threshold:r=_e.threshold,distance:a=_e.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:i,findAllMatches:s,ignoreLocation:o,location:c,threshold:r,distance:a},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map(e=>{let n=e.trim().split(Oe).filter(e=>e&&!!e.trim()),i=[];for(let e=0,o=n.length;e<o;e+=1){const o=n[e];let s=!1,c=-1;for(;!s&&++c<Pe;){const e=je[c];let n=e.isMultiMatch(o);n&&(i.push(new e(n,t)),s=!0)}if(!s)for(c=-1;++c<Pe;){const e=je[c];let n=e.isSingleMatch(o);if(n){i.push(new e(n,t));break}}}return i})}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i}=this.options;e=i?e:e.toLowerCase();let o=0,s=[],c=0;for(let i=0,r=t.length;i<r;i+=1){const r=t[i];s.length=0,o=0;for(let t=0,i=r.length;t<i;t+=1){const i=r[t],{isMatch:a,indices:l,score:d}=i.search(e);if(!a){c=0,o=0,s.length=0;break}if(o+=1,c+=d,n){const e=i.constructor.type;Te.has(e)?s=[...s,...l]:s.push(l)}}if(o){let e={isMatch:!0,score:c/o};return n&&(e.indices=s),e}}return{isMatch:!1,score:1}}});var Ke=function(){function e(e){this._haystack=[],this._fuseOptions=i(i({},e.fuseOptions),{keys:o([],e.searchFields,!0),includeMatches:!0})}return e.prototype.index=function(e){this._haystack=e,this._fuse&&this._fuse.setCollection(e)},e.prototype.reset=function(){this._haystack=[],this._fuse=void 0},e.prototype.isEmptyIndex=function(){return!this._haystack.length},e.prototype.search=function(e){return this._fuse||(this._fuse=new He(this._haystack,this._fuseOptions)),this._fuse.search(e).map(function(e,t){return{item:e.item,score:e.score||0,rank:t+1}})},e}(),Ve=function(e,t,n){var i=e.dataset,o=t.customProperties,s=t.labelClass,c=t.labelDescription;s&&(i.labelClass=T(s).join(" ")),c&&(i.labelDescription=c),n&&o&&("string"==typeof o?i.customProperties=o:"object"!=typeof o||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(o)||(i.customProperties=JSON.stringify(o)))},Qe=function(e,t,n){var i=t&&e.querySelector("label[for='".concat(t,"']")),o=i&&i.innerText;o&&n.setAttribute("aria-label",o)},Ue={containerOuter:function(e,t,n,i,o,s,c){var r=e.classNames.containerOuter,a=document.createElement("div");return B(a,r),a.dataset.type=s,t&&(a.dir=t),i&&(a.tabIndex=0),n&&(a.setAttribute("role",o?"combobox":"listbox"),o?a.setAttribute("aria-autocomplete","list"):c||Qe(this._docRoot,this.passedElement.element.id,a),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false")),c&&a.setAttribute("aria-labelledby",c),a},containerInner:function(e){var t=e.classNames.containerInner,n=document.createElement("div");return B(n,t),n},itemList:function(e,t){var n=e.searchEnabled,i=e.classNames,o=i.list,s=i.listSingle,c=i.listItems,r=document.createElement("div");return B(r,o),B(r,t?s:c),this._isSelectElement&&n&&r.setAttribute("role","listbox"),r},placeholder:function(e,t){var n=e.allowHTML,i=e.classNames.placeholder,o=document.createElement("div");return B(o,i),P(o,n,t),o},item:function(e,t,n){var i=e.allowHTML,o=e.removeItemButtonAlignLeft,s=e.removeItemIconText,c=e.removeItemLabelText,r=e.classNames,a=r.item,l=r.button,d=r.highlightedState,h=r.itemSelectable,u=r.placeholder,p=L(t.value),m=document.createElement("div");if(B(m,a),t.labelClass){var f=document.createElement("span");P(f,i,t.label),B(f,t.labelClass),m.appendChild(f)}else P(m,i,t.label);if(m.dataset.item="",m.dataset.id=t.id,m.dataset.value=p,Ve(m,t,!0),(t.disabled||this.containerOuter.isDisabled)&&m.setAttribute("aria-disabled","true"),this._isSelectElement&&(m.setAttribute("aria-selected","true"),m.setAttribute("role","option")),t.placeholder&&(B(m,u),m.dataset.placeholder=""),B(m,t.highlighted?d:h),n){t.disabled&&D(m,h),m.dataset.deletable="";var g=document.createElement("button");g.type="button",B(g,l),P(g,!0,I(s,t.value));var v=I(c,t.value);v&&g.setAttribute("aria-label",v),g.dataset.button="",o?m.insertAdjacentElement("afterbegin",g):m.appendChild(g)}return m},choiceList:function(e,t){var n=e.classNames.list,i=document.createElement("div");return B(i,n),t||i.setAttribute("aria-multiselectable","true"),i.setAttribute("role","listbox"),i},choiceGroup:function(e,t){var n=e.allowHTML,i=e.classNames,o=i.group,s=i.groupHeading,c=i.itemDisabled,r=t.id,a=t.label,l=t.disabled,d=L(a),h=document.createElement("div");B(h,o),l&&B(h,c),h.setAttribute("role","group"),h.dataset.group="",h.dataset.id=r,h.dataset.value=d,l&&h.setAttribute("aria-disabled","true");var u=document.createElement("div");return B(u,s),P(u,n,a||""),h.appendChild(u),h},choice:function(e,t,n,i){var o=e.allowHTML,s=e.classNames,c=s.item,r=s.itemChoice,a=s.itemSelectable,l=s.selectedState,d=s.itemDisabled,h=s.description,u=s.placeholder,p=t.label,m=L(t.value),f=document.createElement("div");f.id=t.elementId,B(f,c),B(f,r),i&&"string"==typeof p&&(p=j(o,p),p={trusted:p+=" (".concat(i,")")});var g=f;if(t.labelClass){var v=document.createElement("span");P(v,o,p),B(v,t.labelClass),g=v,f.appendChild(v)}else P(f,o,p);if(t.labelDescription){var _="".concat(t.elementId,"-description");g.setAttribute("aria-describedby",_);var w=document.createElement("span");P(w,o,t.labelDescription),w.id=_,B(w,h),f.appendChild(w)}return t.selected&&B(f,l),t.placeholder&&B(f,u),f.setAttribute("role",t.group?"treeitem":"option"),f.dataset.choice="",f.dataset.id=t.id,f.dataset.value=m,n&&(f.dataset.selectText=n),t.group&&(f.dataset.groupId="".concat(t.group.id)),Ve(f,t,!1),t.disabled?(B(f,d),f.dataset.choiceDisabled="",f.setAttribute("aria-disabled","true")):(B(f,a),f.dataset.choiceSelectable=""),f},input:function(e,t){var n=e.classNames,i=n.input,o=n.inputCloned,s=e.labelId,c=document.createElement("input");return c.type="search",B(c,i),B(c,o),c.autocomplete="off",c.autocapitalize="off",c.spellcheck=!1,c.setAttribute("role","textbox"),c.setAttribute("aria-autocomplete","list"),t?c.setAttribute("aria-label",t):s||Qe(this._docRoot,this.passedElement.element.id,c),c},dropdown:function(e){var t=e.classNames,n=t.list,i=t.listDropdown,o=document.createElement("div");return B(o,n),B(o,i),o.setAttribute("aria-expanded","false"),o},notice:function(e,t,n){var i=e.classNames,o=i.item,s=i.itemChoice,c=i.addChoice,r=i.noResults,a=i.noChoices,l=i.notice;void 0===n&&(n="");var d=document.createElement("div");switch(P(d,!0,t),B(d,o),B(d,s),B(d,l),n){case te:B(d,c);break;case ee:B(d,r);break;case Z:B(d,a)}return n===te&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=L(e.label),n=new Option(t,e.value,!1,e.selected);return Ve(n,e,!0),n.disabled=e.disabled,e.selected&&n.setAttribute("selected",""),n}},ze="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Ge={},Xe=function(e){if(e)return e.dataset.id?parseInt(e.dataset.id,10):void 0},Ye="[data-choice-selectable]",Je=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var o=this;this.initialisedOK=void 0,this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0;var s=e.defaults;this.config=i(i(i({},s.allOptions),s.options),n),_.forEach(function(e){o.config[e]=i(i(i({},s.allOptions[e]),s.options[e]),n[e])});var c=this.config;c.silent||this._validateConfig();var r=c.shadowRoot||document.documentElement;this._docRoot=r;var a="string"==typeof t?r.querySelector(t):t;if(!a||"object"!=typeof a||"INPUT"!==a.tagName&&!U(a)){if(!a&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}var l=a.type,d="text"===l;(d||1!==c.maxItemCount)&&(c.singleModeForMultiSelect=!1),c.singleModeForMultiSelect&&(l=y);var h=l===w,u=l===y,p=h||u;if(this._elementType=l,this._isTextElement=d,this._isSelectOneElement=h,this._isSelectMultipleElement=u,this._isSelectElement=h||u,this._canAddUserChoices=d&&c.addItems||p&&c.addChoices,"boolean"!=typeof c.renderSelectedChoices&&(c.renderSelectedChoices="always"===c.renderSelectedChoices||h),"auto"===c.closeDropdownOnSelect?c.closeDropdownOnSelect=d||h||c.singleModeForMultiSelect:c.closeDropdownOnSelect=K(c.closeDropdownOnSelect),c.placeholder&&(c.placeholderValue?this._hasNonChoicePlaceholder=!0:a.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,c.placeholderValue=a.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var m=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);c.addItemFilter=m.test.bind(m)}if(this._isTextElement)this.passedElement=new H({element:a,classNames:c.classNames});else{var f=a;this.passedElement=new z({element:f,classNames:c.classNames,template:function(e){return o._templates.option(e)},extractPlaceholder:c.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new J(c),this._currentValue="",c.searchEnabled=!d&&c.searchEnabled||u,this._canSearch=c.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e){var t=e.id||e.name&&"".concat(e.name,"-").concat(x(2))||x(4);return t=t.replace(/(:|\.|\[|\]|,)/g,""),"".concat("choices-","-").concat(t)}(a),this._direction=a.dir,!this._direction){var g=window.getComputedStyle(a).direction;g!==window.getComputedStyle(document.documentElement).direction&&(this._direction=g)}if(this._idNames={itemChoice:"item-choice"},this._templates=s.templates,this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onSelectKey=this._onSelectKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),this.passedElement.isActive)return c.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),this.initialised=!0,void(this.initialisedOK=!1);this.init(),this._initialItems=this._store.items.map(function(e){return e.value})}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return Ge},get allOptions(){return G},get templates(){return Ue}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised&&void 0===this.initialisedOK){var e;this._searcher=(e=this.config,new Ke(e)),this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),this._isTextElement&&!this.config.addItems||this.passedElement.element.hasAttribute("disabled")||this.passedElement.element.closest("fieldset:disabled")?this.disable():(this.enable(),this._addEventListeners()),this._initStore(),this.initialised=!0,this.initialisedOK=!0;var t=this.config.callbackOnInit;"function"==typeof t&&t.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._store._listeners=[],this.clearStore(!1),this._stopSearch(),this._templates=e.defaults.templates,this.initialised=!1,this.initialisedOK=void 0)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var n=this._store.items.find(function(t){return t.id===e.id});return!n||n.highlighted||(this._store.dispatch(E(n,!0)),t&&this.passedElement.triggerEvent(v,this._getChoiceForOutput(n))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var n=this._store.items.find(function(t){return t.id===e.id});return n&&n.highlighted?(this._store.dispatch(E(n,!1)),t&&this.passedElement.triggerEvent("unhighlightItem",this._getChoiceForOutput(n)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withTxn(function(){e._store.items.forEach(function(t){t.highlighted||(e._store.dispatch(E(t,!0)),e.passedElement.triggerEvent(v,e._getChoiceForOutput(t)))})}),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withTxn(function(){e._store.items.forEach(function(t){t.highlighted&&(e._store.dispatch(E(t,!1)),e.passedElement.triggerEvent(v,e._getChoiceForOutput(t)))})}),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withTxn(function(){t._store.items.filter(function(t){return t.value===e}).forEach(function(e){return t._removeItem(e)})}),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withTxn(function(){t._store.items.filter(function(t){return t.id!==e}).forEach(function(e){return t._removeItem(e)})}),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withTxn(function(){t._store.highlightedActiveItems.forEach(function(n){t._removeItem(n),e&&t._triggerChange(n.value)})}),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame(function(){t.dropdown.show();var n=t.dropdown.element.getBoundingClientRect();t.containerOuter.open(n.bottom,n.height),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown")}),this},e.prototype.hideDropdown=function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame(function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent("hideDropdown")}),this):this},e.prototype.getValue=function(e){var t=this,n=this._store.items.map(function(n){return e?n.value:t._getChoiceForOutput(n)});return this._isSelectOneElement||this.config.singleModeForMultiSelect?n[0]:n},e.prototype.setValue=function(e){var t=this;return this.initialisedOK?(this._store.withTxn(function(){e.forEach(function(e){e&&t._addChoice(Q(e,!1))})}),this._searcher.reset(),this):(this._warnChoicesInitFailed("setValue"),this)},e.prototype.setChoiceByValue=function(e){var t=this;return this.initialisedOK?(this._isTextElement||(this._store.withTxn(function(){(Array.isArray(e)?e:[e]).forEach(function(e){return t._findAndSelectChoiceByValue(e)}),t.unhighlightAll()}),this._searcher.reset()),this):(this._warnChoicesInitFailed("setChoiceByValue"),this)},e.prototype.setChoices=function(e,t,n,o,s){var c=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===o&&(o=!1),void 0===s&&(s=!0),!this.initialisedOK)return this._warnChoicesInitFailed("setChoices"),this;if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(o&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise(function(e){return requestAnimationFrame(e)}).then(function(){return c._handleLoadingState(!0)}).then(function(){return r}).then(function(e){return c.setChoices(e,t,n,o)}).catch(function(e){c.config.silent||console.error(e)}).then(function(){return c._handleLoadingState(!1)}).then(function(){return c});if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}if(!Array.isArray(e))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._store.withTxn(function(){s&&(c._isSearching=!1);var o="value"===t,r="label"===n;e.forEach(function(e){if("choices"in e){var s=e;r||(s=i(i({},s),{label:s[n]})),c._addGroup(Q(s,!0))}else{var a=e;r&&o||(a=i(i({},a),{value:a[t],label:a[n]})),c._addChoice(Q(a,!1))}}),c.unhighlightAll()}),this._searcher.reset(),this},e.prototype.refresh=function(e,t,n){var i=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===n&&(n=!1),this._isSelectElement?(this._store.withTxn(function(){var o=i.passedElement.optionsAsChoices(),s={};n||i._store.items.forEach(function(e){e.id&&e.active&&e.selected&&!e.disabled&&(s[e.value]=!0)}),i.clearStore(!1);var c=function(e){n?i._store.dispatch(C(e)):s[e.value]&&(e.selected=!0)};o.forEach(function(e){"choices"in e?e.choices.forEach(c):c(e)}),i._addPredefinedChoices(o,t,e),i._isSearching&&i._searchChoices(i.input.value)}),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a <select> element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find(function(t){return t.value===e});return t?(this._clearNotice(),this._store.dispatch(b(t)),this._searcher.reset(),t.selected&&this.passedElement.triggerEvent(g,this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){var e=this;return this._store.withTxn(function(){e._store.choices.forEach(function(t){t.selected||e._store.dispatch(b(t))})}),this._searcher.reset(),this},e.prototype.clearStore=function(e){return void 0===e&&(e=!0),this._stopSearch(),e&&this.passedElement.element.replaceChildren(""),this.itemList.element.replaceChildren(""),this.choiceList.element.replaceChildren(""),this._store.reset(),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this._searcher.reset(),this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._stopSearch(),this},e.prototype._validateConfig=function(){var e,t,n,i,o=this.config,s=(e=o,t=G,n=Object.keys(e).sort(),i=Object.keys(t).sort(),n.filter(function(e){return i.indexOf(e)<0}));s.length&&console.warn("Unknown config option(s) passed",s.join(", ")),o.allowHTML&&o.allowHtmlUserInput&&(o.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),o.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"))},e.prototype._render=function(e){void 0===e&&(e={choices:!0,groups:!0,items:!0}),this._store.inTxn()||(this._isSelectElement&&(e.choices||e.groups)&&this._renderChoices(),e.items&&this._renderItems())},e.prototype._renderChoices=function(){var e=this;if(this._canAddItems()){var t=this.config,n=this._isSearching,i=this._store,o=i.activeGroups,s=i.activeChoices,c=0;if(n&&t.searchResultLimit>0?c=t.searchResultLimit:t.renderChoiceLimit>0&&(c=t.renderChoiceLimit),this._isSelectElement){var r=s.filter(function(e){return!e.element});r.length&&this.passedElement.addOptions(r)}var a=document.createDocumentFragment(),l=function(e){return e.filter(function(e){return!e.placeholder&&(n?!!e.rank:t.renderSelectedChoices||!e.selected)})},d=!1,h=function(i,o,s){n?i.sort(O):t.shouldSort&&i.sort(t.sorter);var r=i.length;r=!o&&c&&r>c?c:r,r--,i.every(function(i,o){var c=i.choiceEl||e._templates.choice(t,i,t.itemSelectText,s);return i.choiceEl=c,a.appendChild(c),i.disabled||!n&&i.selected||(d=!0),o<r})};s.length&&(t.resetScrollPosition&&requestAnimationFrame(function(){return e.choiceList.scrollToTop()}),this._hasNonChoicePlaceholder||n||!this._isSelectOneElement||h(s.filter(function(e){return e.placeholder&&!e.group}),!1,void 0),o.length&&!n?(t.shouldSort&&o.sort(t.sorter),h(s.filter(function(e){return!e.placeholder&&!e.group}),!1,void 0),o.forEach(function(i){var o=l(i.choices);if(o.length){if(i.label){var s=i.groupEl||e._templates.choiceGroup(e.config,i);i.groupEl=s,s.remove(),a.appendChild(s)}h(o,!0,t.appendGroupInSearch&&n?i.label:void 0)}})):h(l(s),!1,void 0)),d||(this._notice||(this._notice={text:A(n?t.noResultsText:t.noChoicesText),type:n?ee:Z}),a.replaceChildren("")),this._renderNotice(a),this.choiceList.element.replaceChildren(a),d&&this._highlightChoice()}},e.prototype._renderItems=function(){var e=this,t=this._store.items||[],n=this.itemList.element,i=this.config,o=document.createDocumentFragment(),s=function(e){return n.querySelector('[data-item][data-id="'.concat(e.id,'"]'))},c=function(t){var n=t.itemEl;n&&n.parentElement||(n=s(t)||e._templates.item(i,t,i.removeItemButton),t.itemEl=n,o.appendChild(n))};t.forEach(c);var r=!!o.childNodes.length;if(this._isSelectOneElement&&this._hasNonChoicePlaceholder){var a=n.children.length;if(r||a>1){var l=n.querySelector($(i.classNames.placeholder));l&&l.remove()}else a||(r=!0,c(Q({selected:!0,value:"",label:i.placeholderValue||"",placeholder:!0},!1)))}r&&(n.append(o),i.shouldSortItems&&!this._isSelectOneElement&&(t.sort(i.sorter),t.forEach(function(e){var t=s(e);t&&(t.remove(),o.append(t))}),n.append(o))),this._isTextElement&&(this.passedElement.value=t.map(function(e){return e.value}).join(i.delimiter))},e.prototype._displayNotice=function(e,t,n){void 0===n&&(n=!0);var i=this._notice;i&&(i.type===t&&i.text===e||i.type===te&&(t===ee||t===Z))?n&&this.showDropdown(!0):(this._clearNotice(),this._notice=e?{text:e,type:t}:void 0,this._renderNotice(),n&&e&&this.showDropdown(!0))},e.prototype._clearNotice=function(){if(this._notice){var e=this.choiceList.element.querySelector($(this.config.classNames.notice));e&&e.remove(),this._notice=void 0}},e.prototype._renderNotice=function(e){var t=this._notice;if(t){var n=this._templates.notice(this.config,t.text,t.type);e?e.append(n):this.choiceList.prepend(n)}},e.prototype._getChoiceForOutput=function(e,t){return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:e.group?e.group.label:void 0,element:e.element,keyCode:t}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._handleButtonAction=function(e){var t=this,n=this._store.items;if(n.length&&this.config.removeItems&&this.config.removeItemButton){var i=e&&Xe(e.parentElement),o=i&&n.find(function(e){return e.id===i});o&&this._store.withTxn(function(){if(t._removeItem(o),t._triggerChange(o.value),t._isSelectOneElement&&!t._hasNonChoicePlaceholder){var e=t._store.choices.reverse().find(function(e){return!e.disabled&&e.placeholder});e&&(t._addItem(e),t.unhighlightAll(),e.value&&t._triggerChange(e.value))}})}},e.prototype._handleItemAction=function(e,t){var n=this;void 0===t&&(t=!1);var i=this._store.items;if(i.length&&this.config.removeItems&&!this._isSelectOneElement){var o=Xe(e);o&&(i.forEach(function(e){e.id!==o||e.highlighted?!t&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)}),this.input.focus())}},e.prototype._handleChoiceAction=function(e){var t=this,n=Xe(e),i=n&&this._store.getChoiceById(n);if(!i||i.disabled)return!1;var o=this.dropdown.isActive;if(!i.selected){if(!this._canAddItems())return!0;this._store.withTxn(function(){t._addItem(i,!0,!0),t.clearInput(),t.unhighlightAll()}),this._triggerChange(i.value)}return o&&this.config.closeDropdownOnSelect&&(this.hideDropdown(!0),this.containerOuter.element.focus()),!0},e.prototype._handleBackspace=function(e){var t=this.config;if(t.removeItems&&e.length){var n=e[e.length-1],i=e.some(function(e){return e.highlighted});t.editItems&&!i&&n?(this.input.value=n.value,this.input.setWidth(),this._removeItem(n),this._triggerChange(n.value)):(i||this.highlightItem(n,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e,t=this.config;if(this._isTextElement){if(this._presetChoices=t.items.map(function(e){return Q(e,!1)}),this.passedElement.value){var n=this.passedElement.value.split(t.delimiter).map(function(e){return Q(e,!1)});this._presetChoices=this._presetChoices.concat(n)}this._presetChoices.forEach(function(e){e.selected=!0})}else if(this._isSelectElement){this._presetChoices=t.choices.map(function(e){return Q(e,!0)});var i=this.passedElement.optionsAsChoices();i&&(e=this._presetChoices).push.apply(e,i)}},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element;e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t.replaceChildren(this._templates.placeholder(this.config,this.config.loadingText)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?(t.replaceChildren(""),this._render()):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed)if(null!=e&&e.length>=this.config.searchFloor){var t=this.config.searchChoices?this._searchChoices(e):0;null!==t&&this.passedElement.triggerEvent(f,{value:e,resultCount:t})}else this._store.choices.some(function(e){return!e.active})&&this._stopSearch()},e.prototype._canAddItems=function(){var e=this.config,t=e.maxItemCount,n=e.maxItemText;return!(!e.singleModeForMultiSelect&&t>0&&t<=this._store.items.length&&(this.choiceList.element.replaceChildren(""),this._displayNotice("function"==typeof n?n(t):n,te),1))},e.prototype._canCreateItem=function(e){var t=this.config,n=!0,i="";if(n&&"function"==typeof t.addItemFilter&&!t.addItemFilter(e)&&(n=!1,i=I(t.customAddItemText,e)),n){var o=this._store.choices.find(function(n){return t.valueComparer(n.value,e)});if(this._isSelectElement){if(o)return this._displayNotice("",te),!1}else this._isTextElement&&!t.duplicateItemsAllowed&&o&&(n=!1,i=I(t.uniqueItemText,e))}return n&&(i=I(t.addItemText,e)),i&&this._displayNotice(i,te),n},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(!t.length||t===this._currentValue)return null;var n=this._searcher;n.isEmptyIndex()&&n.index(this._store.searchableChoices);var i=n.search(t);this._currentValue=t,this._highlightPosition=0,this._isSearching=!0;var o=this._notice;return(o&&o.type)!==te&&(i.length?this._clearNotice():this._displayNotice(A(this.config.noResultsText),ee)),this._store.dispatch(function(e){return{type:a,results:e}}(i)),i.length},e.prototype._stopSearch=function(){this._isSearching&&(this._currentValue="",this._isSearching=!1,this._clearNotice(),this._store.dispatch({type:l,active:!0}),this.passedElement.triggerEvent(f,{value:"",resultCount:0}))},e.prototype._addEventListeners=function(){var e=this._docRoot,t=this.containerOuter.element,n=this.input.element;e.addEventListener("touchend",this._onTouchEnd,!0),t.addEventListener("keydown",this._onKeyDown,!0),t.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(t.addEventListener("focus",this._onFocus,{passive:!0}),t.addEventListener("blur",this._onBlur,{passive:!0})),n.addEventListener("keyup",this._onKeyUp,{passive:!0}),n.addEventListener("input",this._onInput,{passive:!0}),n.addEventListener("focus",this._onFocus,{passive:!0}),n.addEventListener("blur",this._onBlur,{passive:!0}),n.form&&n.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this._docRoot,t=this.containerOuter.element,n=this.input.element;e.removeEventListener("touchend",this._onTouchEnd,!0),t.removeEventListener("keydown",this._onKeyDown,!0),t.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(t.removeEventListener("focus",this._onFocus),t.removeEventListener("blur",this._onBlur)),n.removeEventListener("keyup",this._onKeyUp),n.removeEventListener("input",this._onInput),n.removeEventListener("focus",this._onFocus),n.removeEventListener("blur",this._onBlur),n.form&&n.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()},e.prototype._onKeyDown=function(e){var t=e.keyCode,n=this.dropdown.isActive,i=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||n||(this.showDropdown(),!this.input.isFocussed&&i&&(this.input.value+=e.key," "===e.key&&e.preventDefault())),t){case 65:return this._onSelectKey(e,this.itemList.element.hasChildNodes());case 13:return this._onEnterKey(e,n);case 27:return this._onEscapeKey(e,n);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,n);case 8:case 46:return this._onDeleteKey(e,this._store.items,this.input.isFocussed)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;e?this._canAddItems()&&(this._canSearch&&this._handleSearch(e),this._canAddUserChoices&&(this._canCreateItem(e),this._isSelectElement&&(this._highlightPosition=0,this._highlightChoice()))):this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._onSelectKey=function(e,t){(e.ctrlKey||e.metaKey)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t){var n=this,i=this.input.value,o=e.target;if(e.preventDefault(),o&&o.hasAttribute("data-button"))this._handleButtonAction(o);else if(t){var s=this.dropdown.element.querySelector($(this.config.classNames.highlightedState));if(!s||!this._handleChoiceAction(s))if(o&&i){if(this._canAddItems()){var c=!1;this._store.withTxn(function(){if(!(c=n._findAndSelectChoiceByValue(i,!0))){if(!n._canAddUserChoices)return;if(!n._canCreateItem(i))return;var e=S(i),t=n.config.allowHtmlUserInput||e===i?i:{escaped:e,raw:i};n._addChoice(Q({value:t,label:t,selected:!0},!1),!0,!0),c=!0}n.clearInput(),n.unhighlightAll()}),c&&(this._triggerChange(i),this.config.closeDropdownOnSelect&&this.hideDropdown(!0))}}else this.hideDropdown(!0)}else(this._isSelectElement||this._notice)&&this.showDropdown()},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.element.focus())},e.prototype._onDirectionKey=function(e,t){var n,i,o,s=e.keyCode;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c=40===s||34===s?1:-1,r=void 0;if(e.metaKey||34===s||33===s)r=c>0?this.dropdown.element.querySelector("".concat(Ye,":last-of-type")):this.dropdown.element.querySelector(Ye);else{var a=this.dropdown.element.querySelector($(this.config.classNames.highlightedState));r=a?function(e,t,n){void 0===n&&(n=1);for(var i="".concat(n>0?"next":"previous","ElementSibling"),o=e[i];o;){if(o.matches(t))return o;o=o[i]}return null}(a,Ye,c):this.dropdown.element.querySelector(Ye)}r&&(n=r,i=this.choiceList.element,void 0===(o=c)&&(o=1),(o>0?i.scrollTop+i.offsetHeight>=n.offsetTop+n.offsetHeight:n.offsetTop>=i.scrollTop)||this.choiceList.scrollToChildElement(r,c),this._highlightChoice(r)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,n){this._isSelectOneElement||e.target.value||!n||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=function(e){var t=(e||e.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(t)&&((t===this.containerOuter.element||t===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),e.stopPropagation()),this._wasTap=!0},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(ze&&this.choiceList.element.contains(t)){var n=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=n.offsetWidth:e.offsetX<n.offsetLeft}if(t!==this.input.element){var i=t.closest("[data-button],[data-item],[data-choice]");i instanceof HTMLElement&&("button"in i.dataset?this._handleButtonAction(i):"item"in i.dataset?this._handleItemAction(i,e.shiftKey):"choice"in i.dataset&&this._handleChoiceAction(i)),e.preventDefault()}}},e.prototype._onMouseOver=function(e){var t=e.target;t instanceof HTMLElement&&"choice"in t.dataset&&this._highlightChoice(t)},e.prototype._onClick=function(e){var t=e.target,n=this.containerOuter;n.element.contains(t)?this.dropdown.isActive||n.isDisabled?this._isSelectOneElement&&t!==this.input.element&&!this.dropdown.element.contains(t)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),n.element.focus()):(n.removeFocusState(),this.hideDropdown(!0),this.unhighlightAll())},e.prototype._onFocus=function(e){var t=e.target,n=this.containerOuter;if(t&&n.element.contains(t)){var i=t===this.input.element;this._isTextElement?i&&n.addFocusState():this._isSelectMultipleElement?i&&(this.showDropdown(!0),n.addFocusState()):(n.addFocusState(),i&&this.showDropdown(!0))}},e.prototype._onBlur=function(e){var t=e.target,n=this.containerOuter;if(t&&n.element.contains(t)&&!this._isScrollingOnIe){var i=t===this.input.element;this._isTextElement||this._isSelectMultipleElement?i&&(n.removeFocusState(),this.hideDropdown(!0),this.unhighlightAll()):(n.removeFocusState(),(i||t===n.element&&!this._canSearch)&&this.hideDropdown(!0))}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withTxn(function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),e._initialItems.length&&e.setChoiceByValue(e._initialItems)})},e.prototype._highlightChoice=function(e){void 0===e&&(e=null);var t=Array.from(this.dropdown.element.querySelectorAll(Ye));if(t.length){var n=e,i=this.config.classNames.highlightedState;Array.from(this.dropdown.element.querySelectorAll($(i))).forEach(function(e){D(e,i),e.setAttribute("aria-selected","false")}),n?this._highlightPosition=t.indexOf(n):(n=t.length>this._highlightPosition?t[this._highlightPosition]:t[t.length-1])||(n=t[0]),B(n,i),n.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:n}),this.dropdown.isActive&&(this.input.setActiveDescendant(n.id),this.containerOuter.setActiveDescendant(n.id))}},e.prototype._addItem=function(e,t,n){if(void 0===t&&(t=!0),void 0===n&&(n=!1),!e.id)throw new TypeError("item.id must be set before _addItem is called for a choice/item");(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&this.removeActiveItems(e.id),this._store.dispatch(function(e){return{type:u,item:e}}(e)),t&&(this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e)),n&&this.passedElement.triggerEvent("choice",this._getChoiceForOutput(e)))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(C(e)),this.passedElement.triggerEvent(g,this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t,n){if(void 0===t&&(t=!0),void 0===n&&(n=!1),e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=this.config;if(!this._isSelectElement&&i.duplicateItemsAllowed||!this._store.choices.find(function(t){return i.valueComparer(t.value,e.value)})){this._lastAddedChoiceId++,e.id=this._lastAddedChoiceId,e.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(e.id);var o=i.prependValue,s=i.appendValue;o&&(e.value=o+e.value),s&&(e.value+=s.toString()),(o||s)&&e.element&&(e.element.value=e.value),this._clearNotice(),this._store.dispatch(function(e){return{type:c,choice:e}}(e)),e.selected&&this._addItem(e,t,n)}},e.prototype._addGroup=function(e,t){var n=this;if(void 0===t&&(t=!0),e.id)throw new TypeError("Can not re-add a group which has already been added");this._store.dispatch(function(e){return{type:h,group:e}}(e)),e.choices&&(this._lastAddedGroupId++,e.id=this._lastAddedGroupId,e.choices.forEach(function(i){i.group=e,e.disabled&&(i.disabled=!0),n._addChoice(i,t)}))},e.prototype._createTemplates=function(){var e=this,t=this.config.callbackOnCreateTemplates,n={};"function"==typeof t&&(n=t.call(this,k,j,T));var i={};Object.keys(this._templates).forEach(function(t){i[t]=t in n?n[t].bind(e):e._templates[t].bind(e)}),this._templates=i},e.prototype._createElements=function(){var e=this._templates,t=this.config,n=this._isSelectOneElement,i=t.position,o=t.classNames,s=this._elementType;this.containerOuter=new q({element:e.containerOuter(t,this._direction,this._isSelectElement,n,t.searchEnabled,s,t.labelId),classNames:o,type:s,position:i}),this.containerInner=new q({element:e.containerInner(t),classNames:o,type:s,position:i}),this.input=new N({element:e.input(t,this._placeholderValue),classNames:o,type:s,preventPaste:!t.paste}),this.choiceList=new W({element:e.choiceList(t,n)}),this.itemList=new W({element:e.itemList(t,n)}),this.dropdown=new F({element:e.dropdown(t),classNames:o,type:s})},e.prototype._createStructure=function(){var e=this,t=e.containerInner,n=e.containerOuter,i=e.passedElement,o=this.dropdown.element;i.conceal(),t.wrap(i.element),n.wrap(t.element),this._isSelectOneElement?this.input.placeholder=this.config.searchPlaceholderValue||"":(this._placeholderValue&&(this.input.placeholder=this._placeholderValue),this.input.setWidth()),n.element.appendChild(t.element),n.element.appendChild(o),t.element.appendChild(this.itemList.element),o.appendChild(this.choiceList.element),this._isSelectOneElement?this.config.searchEnabled&&o.insertBefore(this.input.element,o.firstChild):t.element.appendChild(this.input.element),this._highlightPosition=0,this._isSearching=!1},e.prototype._initStore=function(){var e=this;this._store.subscribe(this._render).withTxn(function(){e._addPredefinedChoices(e._presetChoices,e._isSelectOneElement&&!e._hasNonChoicePlaceholder,!1)}),(!this._store.choices.length||this._isSelectOneElement&&this._hasNonChoicePlaceholder)&&this._render()},e.prototype._addPredefinedChoices=function(e,t,n){var i=this;void 0===t&&(t=!1),void 0===n&&(n=!0),t&&-1===e.findIndex(function(e){return e.selected})&&e.some(function(e){return!e.disabled&&!("choices"in e)&&(e.selected=!0,!0)}),e.forEach(function(e){"choices"in e?i._isSelectElement&&i._addGroup(e,n):i._addChoice(e,n)})},e.prototype._findAndSelectChoiceByValue=function(e,t){var n=this;void 0===t&&(t=!1);var i=this._store.choices.find(function(t){return n.config.valueComparer(t.value,e)});return!(!i||i.disabled||i.selected||(this._addItem(i,!0,t),0))},e.prototype._generatePlaceholderValue=function(){var e=this.config;if(!e.placeholder)return null;if(this._hasNonChoicePlaceholder)return e.placeholderValue;if(this._isSelectElement){var t=this.passedElement.placeholderOption;return t?t.text:null}return null},e.prototype._warnChoicesInitFailed=function(e){if(!this.config.silent){if(!this.initialised)throw new TypeError("".concat(e," called on a non-initialised instance of Choices"));if(!this.initialisedOK)throw new TypeError("".concat(e," called for an element which has multiple instances of Choices initialised on it"))}},e.version="11.0.2",e}();jQuery(function(e){window.wpconsent_choices={},document.querySelectorAll(".wpconsent-choices").forEach(t=>{const n=new Je(t,{removeItemButton:"false"!==t.dataset.removeItem,searchEnabled:"true"===t.dataset.search,placeholder:!0,placeholderValue:t.dataset.placeholder||"Select an option"});if(t.id&&(window.wpconsent_choices[t.id]=n),"true"===t.dataset.ajax){const i=t.dataset.ajaxAction||"wpconsent_search_pages";n.passedElement.element.addEventListener("search",(e=>{let t=null;return(...n)=>{clearTimeout(t),t=setTimeout(()=>{e.apply(null,n)},300)}})(t=>{const o=t.detail.value;!o||o.length<3||e.ajax({url:ajaxurl,type:"POST",data:{action:i,nonce:wpconsent.nonce,search:o},success:function(e){if(e.success&&e.data){const t=e.data.map(e=>({value:e.value,label:e.label}));n.setChoices(t,"value","label",!0)}}})}))}})}),n(254),n(759),n(708),n(209),n(332),n(609),n(7),n(44),n(425),n(766),jQuery(function(e){const t=t=>{const n=[...new Set(t)];e.ajax({url:ajaxurl,type:"POST",data:{action:"wpconsent_save_scanner_items",nonce:wpconsent.nonce,items:n},success:function(e){e.success||console.error("Failed to save scanner items:",e.data)},error:function(e,t,n){console.error("Error saving scanner items:",n)}})},n=(e,n)=>{e.remove();const i=document.querySelector(".wpconsent-scanner-selected-items-container"),o=Array.from(i.querySelectorAll('input[name="scanner_items[]"]')).map(e=>parseInt(e.value)).filter(e=>e!==parseInt(n));t(o)},i=document.querySelector("#manual-scanner-page");if(!i)return;let o;if(window.wpconsent_choices?.[i.id])o=window.wpconsent_choices[i.id];else{if(i.classList.contains("choices__input"))return;o=new Je(i,{removeItemButton:!0,searchEnabled:!0,placeholder:!0,placeholderValue:i.dataset.placeholder,searchPlaceholderValue:i.dataset.placeholder,searchResultLimit:10,shouldSort:!1,classNames:{containerOuter:"choices wpconsent-choices"}}),i.id&&(window.wpconsent_choices=window.wpconsent_choices||{},window.wpconsent_choices[i.id]=o)}o.passedElement.element.addEventListener("change",function(){const e=o.getValue(!0);if(!e)return;const i=o.passedElement.element.querySelector(`option[value="${e}"]`);if(!i)return;const s=i.textContent,c=JSON.parse(i.getAttribute("data-custom-properties")||"{}"),r=i.getAttribute("data-url")||c.url,a=`\n <div class="wpconsent-scanner-selected-item" id="scanner-item-${l=e}">\n <div class="wpconsent-scanner-selected-item-info">\n <h3>${s}</h3>\n ${(d=r)?`\n <a href="${d}" target="_blank" rel="noopener noreferrer">\n ${new URL(d).pathname}\n </a>\n `:""}\n </div>\n <button type="button" class="wpconsent-remove-item" data-id="${l}">\n <span class="dashicons dashicons-no-alt"></span>\n </button>\n <input type="hidden" name="scanner_items[]" value="${l}">\n </div>\n `;var l,d;const h=document.querySelector(".wpconsent-scanner-selected-items-container");if(h){const i=document.createElement("div");i.innerHTML=a;const o=i.firstElementChild;h.appendChild(o),o.querySelector(".wpconsent-remove-item").addEventListener("click",()=>n(o,e));const s=Array.from(h.querySelectorAll('input[name="scanner_items[]"]')).map(e=>parseInt(e.value));t(s)}}),document.querySelectorAll(".wpconsent-remove-item").forEach(e=>{e.addEventListener("click",function(){const e=this.getAttribute("data-id"),t=document.getElementById(`scanner-item-${e}`);t&&n(t,e)})}),"true"!==i.dataset.ajax&&i.addEventListener("search",(e=>{let t=null;return(...n)=>{clearTimeout(t),t=setTimeout(()=>{e.apply(null,n)},300)}})(t=>{const n=t.detail.value;!n||n.length<3||(o.setChoices([{value:"",label:wpconsent.searching||"Searching...",disabled:!0}],"value","label",!0),e.ajax({url:ajaxurl,type:"POST",data:{action:i.dataset.ajaxAction||"wpconsent_search_content",nonce:wpconsent.nonce,search:n},success:function(e){if(e.success&&e.data){const t=e.data.map(e=>({value:e.value,label:e.label,customProperties:{url:e.url||""}}));o.setChoices(t,"value","label",!0)}},error:function(e,t,n){console.error("Error searching content:",n),o.setChoices([{value:"",label:"Error searching content",disabled:!0}],"value","label",!0)}}))}))}),n(302),n(342),n(875),n(226),n(918),n(936),n(405),n(11)})()})(); |