import{j as h,e9 as P,o as p,aR as y,e8 as E,dk as R,l as b,R as c,bu as j}from"./app-BgLa5dit.js";import{g as x}from"./DdbSDhh9.chunk.js";import{S as Q}from"./BSa28HTr.chunk.js";function I(){return h.jsx("div",{className:"position-absolute top-0 left-0 right-0 bottom-0 bg-white opacity-75 d-flex justify-content-center align-items-center w-100 h-100 z-1",children:h.jsx(P,{})})}function N(t){const r=p(y.currentUser()),n=p(E.getContentPartner(t.id)),s=x(),u=!!r.data&&!!n.data;return{data:{currentUser:r,contentPartner:n,loaded:u},appLinks:s}}const d=2,D=300,L={series:["series"],videos:["video"]};function q(t){const r=R(),n=b(),[s,u]=c.useState(""),[i,l]=c.useState(null),[a,o]=c.useState(!1),e=j(s,D);function S(f){a||(o(!0),r(Q.searchContent({query:f,indices:L[t.type],success:C=>{l(C),o(!1)},error:()=>{n.error("Error searching content"),o(!1)},filters:{partnerProfile:t.partnerProfileId}})))}function g(){l(null),o(!1)}function m(f){a||u(f)}return c.useEffect(()=>{if(e.length===0){g();return}e.length<d||S(e)},[e]),{data:(i==null?void 0:i.results)||[],isFetching:a,isSearching:a||e.length>=d,searchQuery:s,setSearchQuery:m}}export{I as C,q as a,N as u};
//# sourceMappingURL=BgxNwnDA.chunk.js.map
