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