import{R as s,o as n,aY as j,g0 as E,aJ as x,g as i,h as r,i as o,j as e,ar as V,g1 as g,aR as C}from"./app-BgLa5dit.js";import{P as h,M as P}from"./CanLAf7a.chunk.js";import{C as k,I as w}from"./DbXnua0D.chunk.js";import{O as b}from"./B-fq6xxv.chunk.js";import{E as S}from"./DAIT4p5u.chunk.js";import"./B0KtsevF.chunk.js";import"./IEOSPmnY.chunk.js";import"./C8_78Eqq.chunk.js";import"./Bkj-W53y.chunk.js";import"./KIVqng-q.chunk.js";import"./DIopWku2.chunk.js";import"./Ib-esfrz.chunk.js";import"./VIUZq4Vp.chunk.js";import"./DqAfjXkG.chunk.js";import"./DD0tWTM_.chunk.js";import"./DOuXJken.chunk.js";import"./BfMtaC_g.chunk.js";const T={application:o.INTERACTIVES,action:r.Interactives.EDIT_INTERACTIVE_DETAILS};function G(a){var I,u;const[v,f]=s.useState(!1),c=n(C.currentUser()),d=n(C.token()),t=n(j.interactiveMetadata(a.id)),l=n(t.data&&h.createViewKey(t.data.id,P.MasterObject)),m=s.useMemo(()=>E(),[]),p=s.useMemo(()=>E(),[]);s.useEffect(()=>{!t.hasCompleted||t.data.status===x.Draft||i.trigger({application:o.INTERACTIVES,action:r.Interactives.PREVIEW_INTERACTIVE,args:[a.id]},{replace:!0})},[t.hasCompleted]);function R(){i.trigger({...T,args:[a.id]})}function A(){i.trigger({...T,args:[a.id],params:{publish:!0}})}function y(){i.trigger({application:o.INTERACTIVES,action:r.Interactives.DELETE_INTERACTIVE,args:[a.id]})}function N(){i.trigger({application:o.INTERACTIVES,action:r.Interactives.COPY_INTERACTIVE,args:[a.id]})}return!l.data||!t.data||!d.data?e.jsx("div",{className:"text-center py-5",children:e.jsx(V,{as:"div",animation:"border"})}):e.jsxs(e.Fragment,{children:[e.jsx(S,{interactive:t.data,activeAction:r.Interactives.EDIT_INTERACTIVE,currentUser:c.data}),e.jsxs("div",{className:`${v?"":"d-none"}`,children:[e.jsxs("div",{className:"d-flex justify-content-between align-items-center mb-3",children:[e.jsx(b,{object:{name:t.data.name},actions:[]}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx(g,{node:m})})]}),e.jsx(k,{viewKey:l.data.viewKey,imageApi:new URL(ClickView.Config.Urls.ImageAPI),playerApi:new URL(ClickView.Config.Urls.PlayerApi),hotkeyElQuerySelector:"body",onReady:()=>f(!0),currentUser:c.data,mode:w.Create,actionsPortalNode:m,questionListPortalNode:p,authToken:d.data,onClickEditDetails:R,onClickPublish:A,onClickDelete:y,onClickCopy:N,eventLogging:!1,parentVideo:((I=t.data)==null?void 0:I._parentClip)||((u=t.data)==null?void 0:u._parentVideo)}),e.jsx(g,{node:p})]})]})}export{G as EditInteractiveView};
//# sourceMappingURL=D7IVmKX6.chunk.js.map
