import{a as ee,b as ie,c as te,d as _,f as re,g as ae,h as ne}from"./chunk-ILTXBTPW.js";import{a as Z}from"./chunk-2OM62VLO.js";import"./chunk-OLEUXR5V.js";import{a as p}from"./chunk-OUBPWIML.js";import"./chunk-KK44WE4T.js";import"./chunk-EGNSYET5.js";import"./chunk-EMMR7BLW.js";import"./chunk-THHXMFBJ.js";import"./chunk-AKAZT3JD.js";import"./chunk-JDEXQVPI.js";import"./chunk-RH5LUZZL.js";import"./chunk-KNOHY4JH.js";import"./chunk-BFY7NOOI.js";import"./chunk-3ZHM23VT.js";import"./chunk-DRN2GOMC.js";import"./chunk-VOOAG62Y.js";import"./chunk-FRPROPM5.js";import"./chunk-RZOWWMZN.js";import"./chunk-BJAAX4ND.js";import"./chunk-R2VTEU4L.js";import{a as oe}from"./chunk-2G7NQEPN.js";import"./chunk-4E55FHF6.js";import{a as X}from"./chunk-M4RKIDTM.js";import"./chunk-DW2XETRE.js";import"./chunk-T7HKDGYI.js";import"./chunk-GDRCXM3C.js";import{b as q,c as K}from"./chunk-EK7PNUS6.js";import"./chunk-LT3D367Q.js";import"./chunk-K6BTOK6K.js";import"./chunk-P6IZY6NM.js";import"./chunk-XP52Z2T6.js";import"./chunk-2XLVWFPJ.js";import"./chunk-AVW5T5UK.js";import"./chunk-HOGUEFQ3.js";import"./chunk-FRUNJAEM.js";import"./chunk-NHKGWW2Q.js";import"./chunk-TCKW62LY.js";import"./chunk-QEMOOM5D.js";import"./chunk-V2M57NO3.js";import{B as W,C as B}from"./chunk-HYHNBP3O.js";import"./chunk-L4RULAQQ.js";import{Bf as z,Db as y,Eb as H,Fa as L,Fc as R,Ha as x,Pg as Y,Qc as j,S as D,Sa as T,Xf as G,Z as P,Za as F,Zb as O,Zd as N,ba as t,gb as A,ha as b,ia as I,ig as Q,j as c,ld as k,n as m,pb as C,qb as V,s as w,sg as $,ug as v,vb as E,yg as J}from"./chunk-7W5IJG57.js";import{i as n,j as M}from"./chunk-RB5FWREQ.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("\u0412\u0438\u0434\u0435\u043E \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u043E.");}onUnload(i){let{text:e,canDeactivate:r}=this.canDeactivate();if(!r)return i.returnValue=e,e;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"You have unsaved changes. Are you sure you want to leave?"};}};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:3558f4fa3a6acf6a8a484a0589828971efacd00f9f89386e64ec00a5fc269cc5*///# sourceMappingURL=chunk-CVTTJ4BX.js.map