"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const j=require("react/jsx-runtime"),i=require("react"),q=require("./PostsFilterDropdown.js"),A=require("../../conf/index.js"),R=l=>{const{taxonomy:o,group:u,placeholder:c,allLabel:p,noneLabel:f,useSingleColumn:d,enableTextSearch:g,filterType:y,showNoDataOption:S,closeOnSelect:m,allNoneSameBehaviour:x,autoApply:O,alphabeticalSort:P,ascOrder:h,type:T,categories:n,onChange:b,...v}=l,[w,e]=i.useState([]),C=async()=>{if(!o||o==="none"){e([]);return}const a=await(await fetch(A.Config.REACT_APP_WP_API+"/wp/v2/"+o)).json();if(a){const r=a.map(t=>({key:t.id,value:t.id,text:t.name}));if(n){const t=r.filter(_=>n.indexOf(_.value.toString())>-1);e([]),e(t)}else e([]),e(r)}};return i.useEffect(()=>{let s=!1;return s||(e([]),C()),()=>{s=!0}},[T,o,n]),j.jsx(q.default,{...v,group:u,placeholder:c,allLabel:p,noneLabel:f,useSingleColumn:d,enableTextSearch:g,filterType:y,showNoDataOption:S,closeOnSelect:m,allNoneSameBehaviour:x,autoApply:O,alphabeticalSort:P,ascOrder:h,options:w,onChange:b})};exports.default=R;
