(()=>{"use strict";var e={1669:e=>{e.exports=jQuery}},t={};function o(s){var n=t[s];if(void 0!==n)return n.exports;var r=t[s]={exports:{}};return e[s](r,r.exports,o),r.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var s in t)o.o(t,s)&&!o.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const s=TomSelect;var n=o.n(s);const r={disable_search_threshold:13,search_contains:!0,inherit_select_classes:!0,placeholder_text_single:edd_vars.one_option,placeholder_text_multiple:edd_vars.one_or_more_option,no_results_text:edd_vars.no_results_text},c=e=>{let t={...r};const o=e?.dataset?.searchType;if(o&&(delete t.disable_search_threshold,"no_ajax"!==o)){const s="edd_"+o+"_search",n="edd_download_search"===s?4:1,r={action:s};for(const t in e.dataset)if(t.startsWith("search")&&"searchType"!==t&&"searchPlaceholder"!==t){const o=t.replace("search","").replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"");r[o]=e.dataset[t]}const c=new Set;let a=null;t.shouldLoad=e=>e.length>=n,t.loadThrottle=521,t.load=function(e,t){const o=new URLSearchParams({...r,s:e});fetch(ajaxurl+"?"+o.toString()).then((e=>e.json())).then((e=>{const o=[];e&&"object"==typeof e&&Object.values(e).forEach((e=>{const t=String(e.id);o.push({value:t,text:e.name}),c.add(t)})),t(o)})).catch((()=>t()))},t.score=function(e){e!==a&&(c.clear(),a=e);const t=this.getScoreFunction(e);return function(e){return c.has(String(e.value))?1:t(e)}}}return{...t}};var a=o(1669);const l=new WeakSet;a.fn.chosen=function(e){return this.each((function(){const t=this,o=a(this);if("string"==typeof e){const s=t.tomselect;if(!s)return;return"destroy"===e?(o.off(".tomselect"),s.destroy(),void o.removeData("chosen")):void 0}l.has(t)||(l.add(t),console.warn("[EDD] jQuery .chosen() is deprecated and will be removed in a future version. Use initChosen( el ) from utils/chosen.js instead, passing a native HTMLSelectElement.",t)),t.tomselect&&(o.off(".tomselect"),t.tomselect.destroy());const s={...c(t),...e||{}},r=t.className.split(/\s+/).filter(Boolean),d=new(n())(t,function(e,t){const o=e.multiple,s={copyClassesToDropdown:!1,closeAfterSelect:!o};o&&(s.plugins=["remove_button"]);const n=e.dataset?.placeholder||"";var r;return n?s.placeholder=n:o&&t.placeholder_text_multiple?s.placeholder=t.placeholder_text_multiple:!o&&t.placeholder_text_single&&(s.placeholder=t.placeholder_text_single),t.no_results_text&&(s.render=s.render||{},s.render.no_results=(e,o)=>`<div class="no-results">${o(t.no_results_text)}</div>`),t.load&&(s.load=t.load,s.loadThrottle=null!==(r=t.loadThrottle)&&void 0!==r?r:521),t.score&&(s.score=t.score),t.shouldLoad&&(s.shouldLoad=t.shouldLoad),!1!==t.inherit_select_classes&&(s.wrapperClass=`ts-wrapper ${e.className||""}`),o||(s.onFocus=function(){this.setTextboxValue("")}),s}(t,s));d.wrapper&&d.wrapper.classList.remove(...r),function(e,t){const{wrapper:o,dropdown:s,control:n}=e;if(o&&o.classList.add("chosen-container",t?"chosen-container-multi":"chosen-container-single"),s&&s.classList.add("chosen-drop"),n&&(n.classList.add(t?"chosen-choices":"chosen-single"),!t)){const t=document.createElement("span");t.className="chosen-legacy";const o=e.getValue();o&&e.options[o]&&(t.textContent=e.options[o].text||""),n.insertBefore(t,n.firstChild),e.on("change",(o=>{const s=o?e.options[o]:null;t.textContent=s&&s.text||""}))}}(d,t.multiple),o.data("chosen",d),function(e,t){e.on("chosen:updated.tomselect",(()=>{t.clear(!0),t.clearOptions((()=>!1)),t.sync(),t.refreshOptions(!1)})),e.on("chosen:open.tomselect",(()=>t.open())),e.on("chosen:close.tomselect",(()=>t.close())),e.on("chosen:activate.tomselect",(()=>t.focus())),t.on("dropdown_open",(()=>{e.trigger("chosen:showing_dropdown"),t.wrapper&&t.wrapper.classList.add("chosen-with-drop","chosen-container-active")})),t.on("dropdown_close",(()=>{e.trigger("chosen:hiding_dropdown"),t.wrapper&&t.wrapper.classList.remove("chosen-with-drop","chosen-container-active")})),e.trigger("chosen:ready")}(o,d)}))}})();