import{e3 as D,e5 as B,aJ as x,f3 as H,ao as a,a_ as P,ce as M,bW as R,bT as w,cw as O,aq as v,f4 as y,f5 as Y,f6 as z,K as q,c8 as G,d_ as U,cv as E,L as I,v as J,cg as K,az as W,f7 as Q,f8 as X,T as L,dv as Z,c3 as ee,f as k,e as _}from"./app-k0jcl5PQ.js";const ae="_deleteIcon_xgdch_1",te="_imageContainer_xgdch_12",j={deleteIcon:ae,imageContainer:te},$="shared.imageSelect",C=I.encloseNamespace($);function se(e){return{[E.Thumbnails]:C("uploadAThumbnail"),[E.Covers]:C("uploadACover"),[E.Banners]:C("uploadABanner")}[e]}ne.defaultProps={btnVariant:"light"};function ne(e){const{imageType:n,fieldName:s,appLink:m,extraClasses:p,setSelectedImage:u,deleteImage:o}=e,i=D(),t=B(i==null?void 0:i.values,s),{setDataUrl:g,getImage:c,imageUploaded:h}=x.useContext(H),[l,b]=x.useState(!1),[f,S]=x.useState(t);x.useEffect(()=>{!(t!=null&&t.id)&&!(t!=null&&t.fileId)&&!(t!=null&&t.url)&&S(null),t!=null&&t.url&&S(t)},[t]);function A(r){b(!0),g(r.src),J.trigger({...m,args:[n]})}function T(r){if(G.isFunction(u)){u(r);return}i&&i.setFieldValue(s,{fileId:r.id||r.fileId,fileIdType:U.ImageAPIv2})}function F(){return e.fallbackImage?f!=null&&f.url?f:e.fallbackImage:f}return x.useEffect(()=>{if(!l)return;const r=c();r&&(b(!1),S(r),T(r))},[h]),a.jsxs("div",{className:"h-auto",children:[a.jsxs("div",{className:`pb-2 img-padding ${j.imageContainer}`,children:[o&&f&&a.jsx(P,{svg:M,onClick:()=>o(s),className:`svg-container cursor-pointer ${j.deleteIcon}`}),a.jsx(R,{data:F(),imageType:n,imageOptions:{size:w.Medium},children:p?a.jsx("div",{className:p}):a.jsx(O,{type:e.imageFallbackType})})]}),a.jsx("em",{className:"d-block mb-2 em-margin text-secondary",children:a.jsx(v,{namespace:$,phrase:"minDimensions",options:{width:y[n].width,height:y[n].height}})}),a.jsx(Y,{className:`btn btn-${e.btnVariant} w-100`,mimeType:q.IMAGES,onFileSelect:r=>z.onFileSelect(n,r,A),children:se(n)})]})}const ie="_header_1uupt_1",re="_subHeader_1uupt_5",ce="_thumbnailContainer_1uupt_9",le="_input_1uupt_12",oe="_textbox_1uupt_12",d={header:ie,subHeader:re,thumbnailContainer:ce,input:le,textbox:oe};function pe(){return a.jsxs("div",{className:"row",children:[a.jsxs("div",{className:"col-sm-4 col-xs-12 py-3",children:[a.jsx("div",{className:`partial-loading-background mb-2 ${d.header}`}),a.jsx("div",{className:`partial-loading-background mb-2 w-100 ${d.thumbnailContainer}`}),a.jsx("button",{className:"btn my-3 w-100 partial-loading-background",children:" "})]}),a.jsxs("div",{className:"col-sm-8 col-xs-12 py-3",children:[a.jsx("div",{className:`partial-loading-background mb-2 ${d.header}`}),a.jsx("div",{className:`partial-loading-background mb-2 ${d.subHeader}`}),a.jsx("div",{className:`partial-loading-background mb-2 ${d.input}`}),a.jsx("div",{className:`partial-loading-background mb-2 ${d.subHeader}`}),a.jsx("div",{className:`partial-loading-background mb-2 ${d.textbox}`}),a.jsx("div",{className:`partial-loading-background mb-2 ${d.subHeader}`}),a.jsx("div",{className:`partial-loading-background mb-2 ${d.input}`})]})]})}const N="shared.cannotEditVideo";class ge extends K{constructor(){super(I.getPhrase(N,"title"))}get name(){return"CannnotEditVideoError"}get heading(){return I.getPhrase(N,"heading")}get description(){return I.getPhrase(N,"description")}}function de(e){var t,g;const{folderId:n,firstItem:s,lastItem:m,getAppLink:p}=e,u=W(n&&Q.folderParentTree(n));if(!((g=(t=u.data)==null?void 0:t.children)!=null&&g.length))return[];const o=u.data.children.map(c=>({node:c,path:[c]}));let i=[];for(;o.length;){const{node:c,path:h}=o.pop();c.data.id.toString()===n.toString()&&(i=h.map(l=>({name:l.data.name,appLink:p(l)}))),c.children&&o.push(...c.children.map(l=>({node:l,path:[...h,l]})))}return s&&i.unshift(s),m&&i.push(m),i}const ue="myVideos.hooks",V=I.encloseNamespace(ue);function he(e){var t,g,c,h,l;const n=(g=(t=e==null?void 0:e.categories)==null?void 0:t.data)==null?void 0:g[0],s=(h=(c=n==null?void 0:n.libraries)==null?void 0:c.data)==null?void 0:h[0],m=(s==null?void 0:s.type)===X.CustomLibrary,p=m?{name:s==null?void 0:s.name,appLink:{application:_.LIBRARIES,action:k.Libraries.LIBRARY,args:[s==null?void 0:s.id,L.slugify(s==null?void 0:s.name)]}}:{name:V("myVideos"),appLink:{application:_.MY_VIDEOS,action:k.MyVideos.MY_VIDEOS}},u={name:e==null?void 0:e.name,appLink:(e==null?void 0:e.status)===Z.Processing?null:ee.getAppLink(e,{},null)},o={name:V("edit"),active:!0},i=de({folderId:n==null?void 0:n.id,getAppLink:b=>m?{application:_.LIBRARIES,action:k.Libraries.FOLDER,args:[s.id,b.data.id,L.slugify(b.data.name)]}:{application:_.MY_VIDEOS,action:k.MyVideos.MY_VIDEOS_FOLDER,args:[b.data.id,L.slugify(b.data.name)]},firstItem:p,lastItem:u});return(l=e==null?void 0:e.categories)!=null&&l.data&&!e.categories.data.length?[p,u,o]:[...i,o]}export{ge as C,ne as I,pe as P,he as u};
//# sourceMappingURL=CK7nvaZH.chunk.js.map
