import{ao as e,L as u,e3 as T,aJ as x,f1 as P,ck as V,cx as N,cv as F,aR as w,aq as I,bc as U,b0 as B,az as g,f0 as C,dK as D,t as S,bN as _,f as E,e as A,o as R,cu as W,W as q,p as O,E as G,r as H}from"./app-k0jcl5PQ.js";import{l as n}from"./DLmnDxSd.chunk.js";import{C as M}from"./CXr58ipf.chunk.js";import{F as $}from"./DzRq1F5-.chunk.js";import{F as L}from"./DV1GpLCe.chunk.js";import{F as z}from"./C3DvQ1wU.chunk.js";import{I as K,u as J,C as Q,P as X}from"./CK7nvaZH.chunk.js";import{R as d}from"./BlKMjFEf.chunk.js";import{B as Y}from"./CCtuxSlD.chunk.js";import{u as Z}from"./CAxN5LKv.chunk.js";import"./CW7x8M-z.chunk.js";import"./Di9d6zcy.chunk.js";import"./CKctgafI.chunk.js";import"./CPXlV0fg.chunk.js";import"./DIAJ896Y.chunk.js";const ee="_title_1te3z_1",ae={title:ee},m="shared.fullEditClip",t=u.encloseNamespace(m),y="edit-workspace-clip-details";function ie(a){return{name:a.name,description:a.description,startTime:a.startTime,endTime:a.endTime,thumbnail:a.thumbnail}}const te=n.object().shape({name:n.string().trim().max(255,()=>t("titleTooLong")).required(()=>t("titleRequired")).default(""),description:n.string().trim().max(16e3,()=>t("descriptionTooLong")).default(""),startTime:n.number().required(),endTime:n.number().required(),thumbnail:n.object().shape({id:n.string(),fileId:n.string().nullable(),fileIdType:n.mixed(),url:n.string()}).noUnknown()}).noUnknown();function se(a){var r;const s=T(),[h,i]=x.useState(!1),o=P(),f=()=>o.unlock(y);return x.useEffect(()=>{s.dirty&&o.lock({id:y,title:u.getPhrase(m,"navLockTitle"),text:u.getPhrase(m,"navLockBody"),appLinkWhitelist:a.navLockAppLinkWhitelist??[]}),s.dirty||f()},[s.dirty]),e.jsxs(e.Fragment,{children:[e.jsx(V,{children:e.jsxs(d,{children:[e.jsxs("div",{className:"col-sm-4 col-xs-12 py-3",children:[e.jsx("h2",{className:"h5",children:t("thumbnail")}),e.jsx(K,{imageType:F.Thumbnails,fieldName:"thumbnail",appLink:a.imageUploadAppLink,btnVariant:"outline-dark",imageFallbackType:N.Video,fallbackImage:(r=a.clip._parentVideo)==null?void 0:r.thumbnail})]}),e.jsxs("div",{className:"col-sm-8 col-xs-12 py-3",children:[e.jsx(d,{children:e.jsxs("div",{className:"col-12 d-flex justify-content-between",children:[e.jsx("h2",{className:"h5",children:t("basicInformation")}),e.jsxs("div",{children:[!!s.dirty&&e.jsx(w,{variant:"link",onClick:()=>i(!0),children:t("undoChanges")}),e.jsx($,{isNew:!1,variant:"dark"})]})]})}),e.jsx(d,{children:e.jsx("div",{className:`col-auto px-2 ${ae.title}`,children:e.jsx(L,{label:t("title"),type:"text",name:"name",id:"name",value:s.values.name,placeholder:t("titlePlaceholder")})})}),e.jsx(d,{children:e.jsx("div",{className:"col-md-12",children:e.jsx(L,{label:t("description"),as:"textarea",name:"description",id:"description",value:s.values.description,placeholder:t("descriptionPlaceholder")})})})]})]})}),h&&e.jsx(M,{title:t("undoPopupTitle"),onClickConfirm:()=>{s.resetForm(),i(!1)},closePopup:()=>i(!1),confirmButtonText:t("undoPopupConfirm"),cancelButtonText:t("undoPopupCancel"),confirmButtonVariant:"danger",children:e.jsx("p",{children:e.jsx(I,{phrase:"undoPopupBody",namespace:m,options:{videoName:s.initialValues.name}})})})]})}function ne(a){return e.jsx(z,{initialValues:ie(a.clip),validationSchema:te,onSubmit:a.saveClip,children:e.jsx(se,{clip:a.clip,imageUploadAppLink:a.imageUploadAppLink,navLockAppLinkWhitelist:a.navLockAppLinkWhitelist})})}const oe="shared.fullEitClipView",p=u.encloseNamespace(oe);function le(){return[{application:A.VIDEOS,action:E.Videos.UPLOAD_IMAGE}]}function Le(a){var k,j,v,b;const s=U(),h=B(),i=g(C.clip(a.id)),o=(j=(k=i.data)==null?void 0:k._parentVideo)==null?void 0:j.id;g(!!o&&D.video(o));const f=J(i.data);x.useEffect(()=>{var l,c;i.hasCompleted&&((c=(l=i.data)==null?void 0:l._canUpdate)!=null&&c.value||S.throw(new Q))},[(b=(v=i.data)==null?void 0:v._canUpdate)==null?void 0:b.value]),_({title:!!i.data&&p("pageTitle",{name:i.data.name})}),Z(i);async function r(l,c){try{await h(C.updateClip(a.id,l)),s.success(p("clipDetailsUpdateSuccess",{name:l.name,escapeText:!0})),R.logUserAction(W.getAnalyticsData(i.data),{actionType:H.Edit,entity:G.Clip,location:O.EditClipDetails,workflowPhase:q.Complete})}catch{s.error(p("clipDetailsUpdateError"))}finally{c()}}return e.jsxs("div",{className:"px-3",children:[e.jsxs("div",{className:"border-bottom pb-3",children:[e.jsx("h1",{className:"h2",children:p("heading")}),e.jsx(Y,{breadcrumbs:f})]}),i.data?e.jsx(ne,{clip:i.data,saveClip:r,imageUploadAppLink:{application:A.VIDEOS,action:E.Videos.UPLOAD_IMAGE},navLockAppLinkWhitelist:le()}):e.jsx(X,{})]})}export{Le as FullEditClipView};
//# sourceMappingURL=DNGPJIt8.chunk.js.map
