import{bp as T,bq as I,br as y,bs as v,aS as L,w as k,be as c,aX as x,ag as A,bd as R,bt as S,R as W}from"./app-BgLa5dit.js";var C=(e=>(e.LatestReleases="latest-releases",e.ExploreAllTopics="explore-all-topics",e.ClassificationLatestReleases="classification-latest-releases",e.ClassificationDirectory="classification-directory",e))(C||{}),H=(e=>(e.TopicDirectory="topic-directory",e.TopicNewReleases="topic-new-releases",e.CuratedTopic="curated-topic",e))(H||{}),p=(e=>(e[e.Draft=0]="Draft",e[e.Published=1]="Published",e[e.Archived=2]="Archived",e))(p||{});const O={getSliderAnalyticsOptions:()=>({actionType:v.Click,location:y.SlidingList,entity:I.Widget,descriptor:T.Slide}),getSliderItemAnalyticsOptions:()=>({location:y.SlidingListItem}),getSliderHeadingAnalyticsOptions:()=>({actionType:v.Click,location:y.SlidingList,entity:I.Widget,descriptor:T.Title}),useGetContent(e,t,i,n,r){return W.useMemo(()=>{if(!e)return{content:null,unfilteredContent:null};if(!Array.isArray(e))return{content:e,unfilteredContent:e};const l=(n==null?void 0:n.reduce((s,o)=>(s[o.id]=o,s),{}))??{},a=r.reduce((s,o)=>(s[o]=!0,s),{}),u=[...e],d=u.sort((s,o)=>{var b,h;if(!("id"in s)||!("id"in o))return 0;const m=((b=l[s.id])==null?void 0:b.index)??u.findIndex(f=>"id"in f&&f.id===s.id),g=((h=l[o.id])==null?void 0:h.index)??u.findIndex(f=>"id"in f&&f.id===o.id);return m<g?-1:m>g?1:0});return O.isBelowContentMinimum(d,t)&&!i?{content:[],unfilteredContent:d}:{content:d.filter(s=>{var o;return!((o=l["id"in s&&s.id])!=null&&o.hidden||a["id"in s&&s.id])}),unfilteredContent:d}},[e,n])},isBelowContentMinimum(e,t){var n;const i=((n=S[t])==null?void 0:n.minContent)||0;return(e==null?void 0:e.length)<i},getCustomAppLink(e){var t,i,n,r,l,a;return!("metadata"in e)||!("appLinks"in e)||!("appLink"in e.metadata)?null:((t=e.metadata)==null?void 0:t.appLink)===C.LatestReleases&&"latestReleases"in e.appLinks?(n=(i=e.appLinks)==null?void 0:i.latestReleases)==null?void 0:n.call(i):((r=e.metadata)==null?void 0:r.appLink)===C.ExploreAllTopics&&"allTopics"in e.appLinks&&"presentation"in e?(a=(l=e.appLinks)==null?void 0:l.allTopics)==null?void 0:a.call(l,e.presentation.id):null},getWidgetStatus(e){let t=e.status;if(typeof t=="string")switch(t){case"Archived":t=p.Archived;break;case"Published":t=p.Published;break;case"Draft":t=p.Draft;break}return t},formatResponseData(e,t){const i=e.content;if(!i)return e;if("author"in i)return e.content=[i],e;switch("data"in i?e.content=i.data:Array.isArray(i)||(e.content=[i]),e.widgetId){case c.ClassificationSeries:e.content=e.content.filter(n=>{var r;return"tallPoster"in n&&!!((r=n.tallPoster)!=null&&r.id)});break;case c.ClassificationPlaylists:e.content=e.content.filter(n=>{var r;return"cover"in n&&!!((r=n.cover)!=null&&r.id)});break;case c.ContinueWatching:e.content=e.content.map(n=>"object"in n&&n.object);default:break;case c.Presentations:e.content=e.content.filter(n=>{var r;return"id"in n&&n.id.toString()!==((r=t==null?void 0:t.id)==null?void 0:r.toString())});break}return e},isWidgetInTableOfContents(e){return!!(e!=null&&e.showInTableOfContents)},hasNoContent(e){return e===c.Blurb},canDisplayOnScreenSize(e,t,i){return t===c.Blurb&&i===R.HeroBannerSmall?!e.xs&&!e.sm:!0},isCompanyWidget(e){switch(e){case c.CompanyLatestReleasedVideo:case c.CompanyVideos:case c.UpcomingLivestreams:return!0;default:return!1}},getVideoContent(e){const t=k.first(e);return x.isType(t,A.Series)?t.videos.data:e},showRemoveButton(e){return e===c.ContinueWatching},mergeWidgets(e,t){const i=L.deepClone(e),n=k.groupBy(i,"widgetId"),r=[];for(const l of Object.values(n)){let a=null;const u=[];for(const d of l){if(!a){a=d;continue}if(d.templateId!==a.templateId){u.push(a),a=d;continue}t(a,d)}a&&u.push(a),r.push(...u)}return r}};export{C,O as W,p as a,H as b};
//# sourceMappingURL=KIVqng-q.chunk.js.map
