import{b2 as B,bc as U,p as _,az as P,aj as z,f0 as L,bN as G,L as j,aX as O,T as n,f as W,e as X,aI as D,ao as i,c3 as J,dy as K,v as Q}from"./app-k0jcl5PQ.js";import{B as Y}from"./CCtuxSlD.chunk.js";import{I as Z}from"./DXJ2-V8v.chunk.js";import{V as $,a as ee}from"./DH1mz64H.chunk.js";import{h as te}from"./DIAJ896Y.chunk.js";import{u as ie}from"./CnmbO5oy.chunk.js";import{u as oe,V as se}from"./BUtU6IOA.chunk.js";import{u as re}from"./DDxzgH2W.chunk.js";import{u as ae}from"./DgW9Cwsn.chunk.js";import{u as ne}from"./GqZ33xmI.chunk.js";import{V as v,P as pe}from"./Ci0tHKfw.chunk.js";import"./CPXlV0fg.chunk.js";import"./BlKMjFEf.chunk.js";import"./CofWDDSQ.chunk.js";import"./DwvfEevL.chunk.js";import"./D9SGbB34.chunk.js";import"./BwBaQklX.chunk.js";import"./ByBCp1MC.chunk.js";import"./BhYYYlpK.chunk.js";import"./FGhEvk_q.chunk.js";import"./WCBjpMHJ.chunk.js";import"./DoFMWlew.chunk.js";import"./CMnqIsoM.chunk.js";import"./eerUhItV.chunk.js";import"./Cukd0Qmt.chunk.js";import"./B31bqZwo.chunk.js";import"./uoUaCILN.chunk.js";import"./f_twTV5Z.chunk.js";import"./BDeUEvb2.chunk.js";import"./Daim1zo7.chunk.js";import"./B3XH0kWB.chunk.js";import"./BRhv_AHY.chunk.js";import"./BDviDDog.chunk.js";import"./wCY37Ze3.chunk.js";import"./CIN5bTKK.chunk.js";import"./DAIetGMf.chunk.js";import"./TReHo2Ua.chunk.js";import"./Bj7bJt_4.chunk.js";import"./CGYNvpr2.chunk.js";import"./U4M4wGTR.chunk.js";import"./Bw9otuBi.chunk.js";import"./BvnABNse.chunk.js";import"./Bh7bFXwG.chunk.js";import"./DCdUbbLx.chunk.js";import"./t24_x3Gi.chunk.js";const b="shared.videoMedia",I=j.encloseNamespace(b);function et(p){var f,h,C,V,g,x;const{clipId:o}=p,w=B(),k=U(),{commonVideoProps:y,hasCommonVideoPropsCompleted:N}=re({locationContext:_.VideoThumbnail}),R=oe({location:se.VideoItem,presentationSlug:null}),r=ne(),S=P(z.currentUser()),t=P(L.clip(o)),m=(h=(f=t.data)==null?void 0:f._parentVideo)==null?void 0:h.id;G({title:t.data?I("otherClipsViewPageTitle",{video:(C=t.data)==null?void 0:C.name}):""});function c(e){return L.videoClips(m,null,e)}function d(e){return w(c(e))}function F(e,a){if(e===1)return te(a);k.error(j.getPhrase(b,"errorClips"))}const{items:s,hasMore:H,isFetching:l}=ie(r.canViewClips&&m?c:!1,d,F),u=I("otherClipsHeading"),M=ae(),{hasPermissions:T}=O(),E=[{name:(V=t.data)==null?void 0:V.name,appLink:{...v.playClip,args:[o,n.slugify((g=t.data)==null?void 0:g.name)]}},{name:u,appLink:{application:X.CLIPS,action:W.Clips.CLIP_CLIPS,args:[o,n.slugify((x=t.data)==null?void 0:x.name)]},active:!0}];function q(){var e;Q.trigger({...v.playClip,args:[o,n.slugify((e=t.data)==null?void 0:e.name)]},{replace:!0})}return D.useEffect(()=>{r.canViewClips||q()},[r.canViewClips]),!t.data||!(s!=null&&s.length)||!N?i.jsx(pe,{}):i.jsx($.Provider,{value:R,children:i.jsxs("div",{className:"px-3",children:[i.jsx("h1",{className:"h2 mb-2",children:u}),i.jsx("div",{className:"mb-2",children:i.jsx(Y,{breadcrumbs:E})}),i.jsx(ee,{videos:s,getVideoAppLink:(e,a)=>{var A;return J.getAppLink(e,{...a,context:K.Widget,contextId:p.clipId,includeContext:(A=S.data)==null?void 0:A.isAuthenticated},null)},hasPermissions:T,presentationAudiences:M.data,showOwner:!0,commonVideoProps:y}),(H||l)&&i.jsx(Z,{isFetching:l,fetchNext:d})]})})}export{et as ClipClipsView};
//# sourceMappingURL=BgnGCu2b.chunk.js.map
