1import{_ as G}from"./BIQXtUGu.js";import{d as z,y as H,a as D,x as Y,f as i,i as s,h as n,v as A,m as u,C as E,M as N,E as O,F as h,r as L,l as b,t as S,g as Z,p as f,o as l,n as m}from"./CWXzWxAq.js";import{i as q,S as J}from"./Bxr3hh73.js";const K={class:"mb-4 flex flex-wrap items-center gap-2"},Q={class:"mb-5 flex flex-wrap items-center gap-3 text-sm"},W={class:"flex items-center gap-2"},X=["value"],ee={key:0,class:"flex items-center gap-2"},te=["value"],re={class:"ml-auto flex items-center gap-2"},oe={key:0,value:"rating"},se={key:1,value:"subs"},ne={class:"mb-4 text-sm text-muted"},ie={class:"text-foreground"},le={class:"text-foreground"},ae={key:0,class:"mt-8 text-center"},de={class:"mt-8 text-center text-sm","aria-live":"polite"},ue={key:0,class:"flex items-center justify-center gap-2 text-muted"},fe={key:1,class:"text-muted"},ce={key:2,class:"text-muted"},U=30,ve=z({__name:"CreatorFeed",props:{creators:{},infinite:{type:Boolean,default:!1},hasMore:{type:Boolean,default:!1},loadingMore:{type:Boolean,default:!1},error:{type:Boolean,default:!1},sponsored:{default:()=>[]}},emits:["loadMore","retry"],setup(c,{emit:_}){const a=c,I=_,B=[{label:"Any price",test:()=>!0},{label:"Free",test:t=>t.isFree},{label:"Under $10",test:t=>!t.isFree&&t.price<10},{label:"$10â$20",test:t=>t.price>=10&&t.price<=20},{label:"$20+",test:t=>t.price>20}],g=f(!1),x=f(!1),y=f(!1),k=f(0),p=f(""),w=f("popular"),V=f(U),P=m(()=>{const t=new Set;for(const e of a.creators)for(const o of e.languages)t.add(o);return Array.from(t).sort()}),C=m(()=>({verified:a.creators.some(t=>t.verified),video:a.creators.some(t=>t.hasVideo),rating:a.creators.some(t=>t.rating>0),subs:a.creators.some(t=>t.subscribers>0)})),M=m(()=>{let t=a.creators.slice();g.value&&(t=t.filter(o=>o.isFree)),x.value&&(t=t.filter(o=>o.verified)),y.value&&(t=t.filter(o=>o.hasVideo)),p.value&&(t=t.filter(o=>o.languages.includes(p.value)));const e=B[k.value]??B[0];switch(t=t.filter(e.test),w.value){case"rating":t.sort((o,r)=>r.rating-o.rating||r.reviewsCount-o.reviewsCount);break;case"subs":t.sort((o,r)=>r.subscribers-o.subscribers);break;case"newest":t.sort((o,r)=>o.addedAt<r.addedAt?1:-1);break;case"price-low":t.sort((o,r)=>o.price-r.price);break;case"price-high":t.sort((o,r)=>r.price-o.price);break;default:t.sort((o,r)=>(r.featured?1:0)-(o.featured?1:0)||(r.trending?1:0)-(o.trending?1:0)||r.likes-o.likes)}return t}),$=m(()=>a.infinite?M.value:M.value.slice(0,V.value)),R=m(()=>q($.value,a.sponsored,J));function F(t){return`rounded-full border px-3 py-1.5 text-sm transition ${t?"brand-gradient border-transparent text-white":"bg-surface text-muted hover:text-foreground"}`}const v=f(null);let d=null;function T(){a.infinite&&a.hasMore&&!a.loadingMore&&!a.error&&I("loadMore")}return H(()=>{!a.infinite||typeof IntersectionObserver>"u"||(d=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&T()},{rootMargin:"800px 0px"}),v.value&&d.observe(v.value))}),D(v,t=>{d&&(d.disconnect(),t&&d.observe(t))}),D(()=>a.loadingMore,(t,e)=>{e&&!t&&d&&v.value&&(d.unobserve(v.value),d.observe(v.value))}),Y(()=>{d?.disconnect(),d=null}),(t,e)=>{const o=G;return l(),i("div",null,[s("div",K,[s("button",{class:A(F(n(g))),onClick:e[0]||(e[0]=r=>g.value=!n(g))},"Free only",2),n(C).verified?(l(),i("button",{key:0,class:A(F(n(x))),onClick:e[1]||(e[1]=r=>x.value=!n(x))},"Verified",2)):u("",!0),n(C).video?(l(),i("button",{key:1,class:A(F(n(y))),onClick:e[2]||(e[2]=r=>y.value=!n(y))},"Has video",2)):u("",!0)]),s("div",Q,[s("div",W,[e[8]||(e[8]=s("label",{for:"price",class:"text-muted"},"Price",-1)),E(s("select",{id:"price","onUpdate:modelValue":e[3]||(e[3]=r=>O(k)?k.value=r:null),class:"rounded-lg border bg-surface px-3 py-1.5 text-foreground outline-none focus:border-brand"},[(l(),i(h,null,L(B,(r,j)=>s("option",{key:r.label,value:j},S(r.label),9,X)),64))],512),[[N,n(k),void 0,{number:!0}]])]),n(P).length>1?(l(),i("div",ee,[e[10]||(e[10]=s("label",{for:"lang",class:"text-muted"},"Language",-1)),E(s("select",{id:"lang","onUpdate:modelValue":e[4]||(e[4]=r=>O(p)?p.value=r:null),class:"rounded-lg border bg-surface px-3 py-1.5 text-foreground outline-none focus:border-brand"},[e[9]||(e[9]=s("option",{value:""},"Any",-1)),(l(!0),i(h,null,L(n(P),r=>(l(),i("option",{key:r,value:r},S(r),9,te))),128))],512),[[N,n(p)]])])):u("",!0),s("div",re,[e[15]||(e[15]=s("label",{for:"sort",class:"text-muted"},"Sort",-1)),E(s("select",{id:"sort","onUpdate:modelValue":e[5]||(e[5]=r=>O(w)?w.value=r:null),class:"rounded-lg border bg-surface px-3 py-1.5 text-foreground outline-none focus:border-brand"},[e[11]||(e[11]=s("option",{value:"popular"},"Most popular",-1)),n(C).rating?(l(),i("option",oe,"Top rated")):u("",!0),n(C).subs?(l(),i("option",se,"Most subscribers")):u("",!0),e[12]||(e[12]=s("option",{value:"newest"},"Newest",-1)),e[13]||(e[13]=s("option",{value:"price-low"},"Price: low to high",-1)),e[14]||(e[14]=s("option",{value:"price-high"},"Price: high to low",-1))],512),[[N,n(w)]])])]),s("p",ne,[e[17]||(e[17]=b(" Showing ",-1)),s("strong",ie,S(n($).length),1),c.infinite?u("",!0):(l(),i(h,{key:0},[e[16]||(e[16]=b(" of ",-1)),s("strong",le,S(n(M).length),1)],64)),e[18]||(e[18]=b(" creators ",-1))]),Z(o,{creators:n(R)},null,8,["creators"]),!c.infinite&&n(V)<n(M).length?(l(),i("div",ae,[s("button",{class:"rounded-full border bg-surface px-6 py-3 text-sm font-semibold transition hover:border-brand",onClick:e[6]||(e[6]=r=>V.value+=U)}," Load more creators ")])):u("",!0),c.infinite?(l(),i(h,{key:1},[s("div",{ref_key:"sentinel",ref:v,"aria-hidden":"true",class:"h-px w-full"},null,512),s("div",de,[c.loadingMore?(l(),i("div",ue,[...e[19]||(e[19]=[s("span",{class:"h-4 w-4 animate-spin rounded-full border-2 border-brand border-t-transparent","aria-hidden":"true"},null,-1),b(" Loading more creators⦠",-1)])])):c.error?(l(),i("div",fe,[e[20]||(e[20]=b(" Couldn't load more creators. ",-1)),s("button",{class:"font-semibold text-brand underline-offset-2 hover:underline",onClick:e[7]||(e[7]=r=>I("retry"))}," Try again ")])):!c.hasMore&&n($).length>0?(l(),i("p",ce,"You've reached the end.")):u("",!0)])],64)):u("",!0)])}}}),ge=Object.assign(ve,{__name:"CreatorFeed"});export{ge as _};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.