import{l as i,b as l,i as m}from"./app-core.3e3b5f4b.js";const p={getTerms:async e=>{const{apiFetch:t}=window.wp,{addQueryArgs:o}=window.wp.url,n=s(e);return await t({path:o(`/wp/v2/${n.restBase}`,{per_page:-1,orderby:"count",order:"desc",_fields:"id,name"})})},getSelectedTerms:(e,t=!1)=>{const o=s(e,t);return window.wp.data.select("core/editor").getEditedPostAttribute(o.restBase)||[]}},d={getTerms:async e=>{const t=[],o=s(e);return(document.getElementById(`${o.name}checklist`)?.querySelectorAll("li")||[]).forEach(r=>{const a=r.querySelector("input").value,u=r.querySelector("label").innerText;t.push({id:parseInt(a,10),name:u.trim()})}),new Promise(r=>{r(t)})},getSelectedTerms:(e,t=!1)=>{const o=[],n=s(e,t);return(document.getElementById(`${n.name}checklist`)?.querySelectorAll("input:checked")||[]).forEach(a=>{o.push(parseInt(a.value,10))}),o}},c=(e=!1)=>{i();const o=l().aioseo.postData?.taxonomies||[];return e?o:o.filter(n=>n.primaryTermSupport===!0)},f=e=>c().some(t=>e===t.name),s=(e,t=!1)=>{const o=c(t).filter(n=>e===n.name);return o.length?o[0]:{}},g=(e,t=!1)=>m()?p.getSelectedTerms(e,t):d.getSelectedTerms(e,t);export{c as a,g,f as t};
