import{l as h,k as w,o as g,aT as y,j as l,e9 as x,dT as S,aR as V,aJ as I,aS as j,e8 as f,g as A}from"./app-BgLa5dit.js";import{E}from"./BZdMvuHR.chunk.js";import{g as L}from"./DdbSDhh9.chunk.js";import"./RP02HACF.chunk.js";import"./w68yffRy.chunk.js";import"./CanLAf7a.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"./B4CwEi02.chunk.js";import"./CULwvqVp.chunk.js";import"./VIUZq4Vp.chunk.js";import"./B3xA170I.chunk.js";import"./t8cVFCZO.chunk.js";import"./Cu2-dDll.chunk.js";import"./kOrk-qeI.chunk.js";function X(){var p;const r=h(),o=w(),C=L(),s=g(S.contentRegions()),a=g(V.currentUser()),[t,i]=y.useState(null);async function P(e){i(e)}async function R(e){var m,d,u;const c={...j.omit(e,["contentRegions","parent","slug"]),status:I.Draft,contentRegionIds:e.contentRegions.map(n=>n.id),parentId:(m=e.parent)==null?void 0:m.id,slug:(d=e.slug)==null?void 0:d.toLowerCase()};try{if(await o(f.createContentPartner(c)),t)if(t.masterVideoId&&t.pendingProcessId)await o(f.updateVideoBanner(c.slug,t.masterVideoId,t.pendingProcessId)),i(null);else throw new Error("Pending video banner is not valid.");r.success("Successfully created a content partner."),A.trigger(C.contentPartners())}catch(n){r.error(((u=n.responseJSON)==null?void 0:u.message)||"There was an error creating a content partner. Please try again.")}}return!s.hasCompleted||!a.hasCompleted?l.jsx(x,{}):l.jsx(E,{onSave:R,contentRegions:(p=s.data)==null?void 0:p.data,currentUser:a.data,onVideoUploadComplete:P})}export{X as NewContentPartnerView};
//# sourceMappingURL=ByeSlvUd.chunk.js.map
