import{dk as C,R as A,o as s,S as o,ai as R,j as c,h,dl as L,aR as O}from"./app-BgLa5dit.js";import{O as U}from"./B-fq6xxv.chunk.js";import{A as n}from"./BGBqNFqg.chunk.js";import{E as k}from"./kJGoOu-N.chunk.js";import{E as T}from"./KB6Isaz1.chunk.js";import"./BfMtaC_g.chunk.js";import"./AvyxFUsd.chunk.js";function w(a){var p,b;const u=C(),[e,r]=A.useState(),l=s(O.currentUser()),j=s(n.backboneAudience(a.clipId)),f=s(n.audiences(a.clipId)),v=s(o.member(a.clipId)),d=s(o.presentations(R.Subject)),E=s(n.backboneAudiences()),I=s((e==null?void 0:e.id)&&o.presentationAudiences(e.id));A.useEffect(()=>{var i,t;!e&&((t=(i=d.data)==null?void 0:i[0])!=null&&t.id)&&r(d.data[0])},[(b=(p=d.data)==null?void 0:p[0])==null?void 0:b.id]);function S(i,t){u(n.updateObjectAudiences(a.clipId,e.id,i,t,t))}function x(i,t,m){u(n.updateObjectLevels(a.clipId,i,t,m,m))}return c.jsxs(c.Fragment,{children:[!!l.data&&c.jsx(k,{clipId:a.clipId,activeAction:h.Clips.EDIT_CLIP_AUDIENCES,currentUser:l.data}),c.jsx(U,{object:v.data}),c.jsx(T,{objectLevels:j.data,objectAudiences:f.data,presentations:d.data,currentPresentation:e,setCurrentPresentation:r,levels:E.data,presentationAudiences:I.data,memberType:L.Clips,saveAudiences:S,saveLevels:x})]})}export{w as EditClipAudiencesView};
//# sourceMappingURL=DD1rdfXI.chunk.js.map
