function z(e,o=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(o)}function E(e,o=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(o)}function N(e,o="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(t=>typeof t=="function"?`function ${t.name||"unnamed"}()`:typeof t).join(", ");throw new TypeError(`${o}[${r}]`)}}var C=e=>Array.isArray(e)?e:[e];function I(e){const o=Array.isArray(e[0])?e[0]:e;return N(o,"createSelector expects all input-selectors to be functions, but received the following types: "),o}function x(e,o){const r=[],{length:t}=e;for(let s=0;s<t;s++)r.push(e[s].apply(null,o));return r}var L=class{constructor(e){this.value=e}deref(){return this.value}},O=typeof WeakRef<"u"?WeakRef:L,$=0,T=1;function v(){return{s:$,v:void 0,o:null,p:null}}function A(e,o={}){let r=v();const{resultEqualityCheck:t}=o;let s,i=0;function c(){var g;let n=r;const{length:d}=arguments;for(let p=0,m=d;p<m;p++){const f=arguments[p];if(typeof f=="function"||typeof f=="object"&&f!==null){let u=n.o;u===null&&(n.o=u=new WeakMap);const y=u.get(f);y===void 0?(n=v(),u.set(f,n)):n=y}else{let u=n.p;u===null&&(n.p=u=new Map);const y=u.get(f);y===void 0?(n=v(),u.set(f,n)):n=y}}const l=n;let a;if(n.s===T)a=n.v;else if(a=e.apply(null,arguments),i++,t){const p=((g=s==null?void 0:s.deref)==null?void 0:g.call(s))??s;p!=null&&t(p,a)&&(a=p,i!==0&&i--),s=typeof a=="object"&&a!==null||typeof a=="function"?new O(a):a}return l.s=T,l.v=a,a}return c.clearCache=()=>{r=v(),c.resetResultsCount()},c.resultsCount=()=>i,c.resetResultsCount=()=>{i=0},c}function F(e,...o){const r=typeof e=="function"?{memoize:e,memoizeOptions:o}:e,t=(...s)=>{let i=0,c=0,n,d={},l=s.pop();typeof l=="object"&&(d=l,l=s.pop()),z(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const a={...r,...d},{memoize:g,memoizeOptions:p=[],argsMemoize:m=A,argsMemoizeOptions:f=[]}=a,u=C(p),y=C(f),b=I(s),R=g(function(){return i++,l.apply(null,arguments)},...u),M=m(function(){c++;const k=x(b,arguments);return n=R.apply(null,k),n},...y);return Object.assign(M,{resultFunc:l,memoizedResultFunc:R,dependencies:b,dependencyRecomputations:()=>c,resetDependencyRecomputations:()=>{c=0},lastResult:()=>n,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:g,argsMemoize:m})};return Object.assign(t,{withTypes:()=>t}),t}var w=F(A),W=Object.assign((e,o=w)=>{E(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),t=r.map(i=>e[i]);return o(t,(...i)=>i.reduce((c,n,d)=>(c[r[d]]=n,c),{}))},{withTypes:()=>W});const h=e=>e.article,S=e=>h(e).entities,q=e=>h(e).currentArticle,K=e=>h(e).isLoading,D=e=>h(e).filters,P=e=>h(e).error,U=w([S],e=>{const o=e.flatMap(t=>t.tags);return Array.from(new Set(o)).map(t=>({id:t,label:t}))}),V=w([S,D],(e,o)=>{const{search:r,category:t,tags:s}=o,i=r.toLowerCase();return e.filter(c=>{const n=t==="all"||c.category===t,d=c.title.toLowerCase().includes(i)||c.description.toLowerCase().includes(i),l=s.length===0||s.every(a=>c.tags.includes(a));return n&&d&&l})});export{U as a,S as b,q as c,K as d,P as e,V as f,D as g};