import{a as ee,b as ie,c as te,d as _,f as re,g as ae,h as ne}from"./chunk-P4ODO75H.js";import{a as Z}from"./chunk-Z3I5LHFS.js";import"./chunk-HS2V4JCS.js";import{a as p}from"./chunk-63NDXCI3.js";import"./chunk-ZXNM22MX.js";import"./chunk-DATURVE5.js";import"./chunk-LXGYIIUB.js";import"./chunk-O6JXR2OW.js";import"./chunk-HVVT3GZE.js";import"./chunk-XWT32R5B.js";import"./chunk-GGRNY3WW.js";import"./chunk-6BDWDAKX.js";import"./chunk-SY4AOJQ7.js";import"./chunk-EIHKEQI5.js";import"./chunk-YHSFEDF5.js";import"./chunk-Q4J7KWPP.js";import"./chunk-XDYURQN2.js";import"./chunk-YPG7KLHH.js";import"./chunk-R4NB6MQQ.js";import"./chunk-VFBRWSLH.js";import"./chunk-RKTIEY3M.js";import{a as oe}from"./chunk-SASVJPSV.js";import"./chunk-VNDWBPR3.js";import{a as X}from"./chunk-GSBGV76F.js";import"./chunk-RFWQ3L7A.js";import"./chunk-YGFLMKWT.js";import"./chunk-73Z5KCOV.js";import{b as q,c as K}from"./chunk-D7H42SK4.js";import"./chunk-2EJJTPWC.js";import"./chunk-DSBAZZXJ.js";import"./chunk-TSBSUMF7.js";import"./chunk-W745FSLQ.js";import"./chunk-2TVFIIIH.js";import"./chunk-LN6GZSCF.js";import"./chunk-VGCPEGLQ.js";import"./chunk-QAPESTOS.js";import"./chunk-I7RAUMQD.js";import"./chunk-EFFM3OQ7.js";import"./chunk-6CO3TQ23.js";import"./chunk-WBNZT2UZ.js";import"./chunk-RTQ2EPMM.js";import"./chunk-4GTILEN6.js";import"./chunk-WTQ3NEC7.js";import"./chunk-JWTR3OKP.js";import{C as W,D as B}from"./chunk-A6GAOBDS.js";import"./chunk-TC6VXY6B.js";import{$b as O,$h as Y,Bb as y,Cb as H,Eh as $,Fa as L,Gh as v,Ha as x,Hc as R,Kg as z,Kh as J,Q as D,Sa as T,Tc as j,Y as P,Ya as F,aa as t,eb as A,eh as G,fe as N,ha as b,ia as I,j as c,n as m,nb as C,ob as V,r as w,rd as k,tb as E,vh as Q}from"./chunk-K5TQVRW4.js";import{i as n,j as M}from"./chunk-RYEVWIKN.js";function ve(a,o){if(a&1){let se=E();C(0,"my-video-manage-container",2),y("videoUpdated",function(){b(se);let e=H();return I(e.onVideoUpdated());}),V();}}var de=(()=>{let o=class o{route=t(k);serverService=t(v);notifier=t(G);manageController=t(_);isUpdatingVideo=!1;loaded=!1;ngOnInit(){return M(this,null,function*(){let i=this.route.snapshot.data.resolverData,{video:e,userChannels:r,captions:s,chapters:d,videoSource:l,live:u,videoPasswords:f,userQuota:g,privacies:S}=i,h=yield re.createFromAPI(this.serverService.getHTMLConfig(),{video:e,captions:s,chapters:d,live:u,videoSource:l,videoPasswords:f.map(ce=>ce.password)});this.manageController.setStore({videoEdit:h,userQuota:g,userChannels:r,privacies:S}),this.manageController.setConfig({manageType:"update",serverConfig:this.serverService.getHTMLConfig()}),this.loaded=!0;});}ngOnDestroy(){this.manageController.cancelUploadIfNeeded();}onVideoUpdated(){this.notifier.success("V\xEDdeo atualizado.");}onUnload(i){let{text:e,canDeactivate:r}=this.canDeactivate();if(!r)return i.returnValue=e,e;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"Voc\xEA tem altera\xE7\xF5es n\xE3o salvas. Tem certeza de que deseja sair?"};}};n(o,"\u0275fac",function(e){return new(e||o)();}),n(o,"\u0275cmp",T({type:o,selectors:[["my-video-manage"]],hostBindings:function(e,r){e&1&&y("beforeunload",function(d){return r.onUnload(d);},!1,L);},features:[O([_])],decls:2,vars:1,consts:[[1,"margin-content"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated",4,"ngIf"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]],template:function(e,r){e&1&&(C(0,"div",0),F(1,ve,1,0,"my-video-manage-container",1),V()),e&2&&(x(),A("ngIf",r.loaded));},dependencies:[j,R,W,B,ne],encapsulation:2}));let a=o;return a;})();var U=(()=>{let o=class o{videoService=t(K);liveVideoService=t(p);authService=t(Q);videoCaptionService=t(X);videoChapterService=t(oe);videoPasswordService=t(q);userService=t(Y);serverService=t(v);resolve(i){let e=i.params.uuid;return this.videoService.getVideo({videoId:e}).pipe(D(r=>w(this.buildObservables(r))),m(([r,s,d,l,u,f,g,S,h])=>({video:r,userChannels:d,captions:l,chapters:u,videoSource:s,live:f,videoPasswords:g,userQuota:S,privacies:h})));}buildObservables(i){return[c(i),this.videoService.getSource(i.id),z(this.authService),this.videoCaptionService.listCaptions(i.uuid).pipe(m(e=>e.data)),this.videoChapterService.getChapters({videoId:i.uuid}).pipe(m(({chapters:e})=>e)),i.isLive?this.liveVideoService.getVideoLive(i.id):c(void 0),i.privacy.id===N.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:i.uuid}):c([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies()];}};n(o,"\u0275fac",function(e){return new(e||o)();}),n(o,"\u0275prov",P({token:o,factory:o.ɵfac}));let a=o;return a;})();var Je=[{path:"",component:de,canActivate:[J],canDeactivate:[$],providers:[U,p,ee,ie,te,Z],resolve:{resolverData:U},children:ae}];export{Je as default};/**i18n:3ab8a6a12ff574644ebf46057f36e5643b4288edb94e57af377eaee98d8b77d4*///# sourceMappingURL=chunk-QWWPOXCN.js.map