import{j as jS,m as me,C as Cn,I as Ii,y as ya,P as Pa,N as NC,t as to}from'./chunk-Ds59TNFm.js';import{M}from'./chunk-C89jj1h3.js';import{d}from'./chunk-DYCVurrT.js';import'./chunk-DPXYhRMW.js';import{b as ae}from'./chunk-CMLdmrtw.js';import'./chunk-DQ5VcJyq.js';import'./chunk-GGsUHC4k.js';import'./chunk-CQ8DS5LS.js';import'./chunk-qdb8laCV.js';import'./chunk-uEB92--4.js';import'./chunk-BDD4BUtg.js';import'./chunk-CxfBy6jH.js';import'./chunk-BnIKUp8E.js';import'./chunk-CQdb83PF.js';import'./chunk-DJ6i_Em4.js';import'./chunk-lrWSmANS.js';import'./chunk-C6aRWhcU.js';import'./chunk-Bvwvgf7A.js';import'./chunk-BoSUUHP8.js';import'./chunk-BPC3eMsU.js';import{l}from'./chunk-TXYIqQAV.js';import'./chunk-CL-NC5ZB.js';import{az as ok,d7 as ck,g as g$1,b2 as mt,aC as x,aQ as Xe,bc as k,e$ as I,f0 as _,P as Pc,$ as $t,a9 as Oe,aX as le,bs as M$1,aN as $,am as Zt,aY as S,aO as Vr,a as rc,b as Pa$1,J as Jn,Q as Qn,s as sp,e as Fp,d as lb,aM as N1,aE as L,j,f1 as Ir,f2 as nB}from'./main-C0Sl1OBd.js';import'./chunk-CryX_e-u.js';import'./chunk-DZVj2nmI.js';var ie=(()=>{class t{route=g$1(Vr);serverService=g$1($t);notifier=g$1(rc);manageController=g$1(me);ngOnInit(){let e=this.route.snapshot.data.resolverData,{userChannels:i,userQuota:o,privacies:a,videoEdit:n}=e;this.manageController.setStore({videoEdit:n,userQuota:o,userChannels:i,privacies:a}),this.manageController.setConfig({manageType:"update",serverConfig:this.serverService.getHTMLConfig()});}ngOnDestroy(){this.manageController.cancelUploadIfNeeded();}onVideoUpdated(){this.notifier.success("Video aktualiziran.");}onUnload(e){let{text:i,canDeactivate:o}=this.canDeactivate();if(!o)return e.returnValue=i,i;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"You have unsaved changes. Are you sure you want to leave?"};}static ɵfac=function(i){return new(i||t)();};static ɵcmp=Pa$1({type:t,selectors:[["my-video-manage"]],hostBindings:function(i,o){i&1&&Fp("beforeunload",function(n){return o.onUnload(n);},nB);},decls:2,vars:0,consts:[[1,"margin-content"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]],template:function(i,o){i&1&&(sp(0,"div",0)(1,"my-video-manage-container",1),Fp("videoUpdated",function(){return o.onVideoUpdated();}),lb()());},dependencies:[Jn,Qn,NC],encapsulation:2,changeDetection:1});}return t;})();var g=(()=>{class t{router=g$1(mt);videoService=g$1(x);liveVideoService=g$1(d);authService=g$1(Xe);videoCaptionService=g$1(k);videoChapterService=g$1(I);videoPasswordService=g$1(_);userService=g$1(Pc);serverService=g$1($t);playerSettingsService=g$1(l);videoEmbedPrivacyService=g$1(Pa);resolve(e){let i=e.params.uuid;return this.videoService.getVideo({videoId:i}).pipe(Oe(o=>N1(this.buildObservables(o))),Oe(Ke=>L(this,[Ke],function*([o,a,n,S,h,C,V,re,oe,y,M]){let te=yield to.createFromAPI(this.serverService.getHTMLConfig(),{video:o,captions:S,chapters:h,live:C,videoSource:a,playerSettings:y,videoPasswords:V.map(ae=>ae.password),embedPrivacy:M});return{video:o,userChannels:n,captions:S,chapters:h,videoSource:a,live:C,videoPasswords:V,userQuota:re,privacies:oe,videoEdit:te,playerSettings:y,embedPrivacy:M};})),le(o=>(j.error("Cannot fetch video information",o),this.router.navigate(["/401"],{state:{obj:o},skipLocationChange:true}),Ir(()=>o))));}buildObservables(e){return[M$1(e),this.videoService.getSource(e.id),ae({authService:this.authService,includeCollaborations:true}),this.videoCaptionService.listCaptions(e.uuid).pipe($(i=>i.data)),this.videoChapterService.getChapters({videoId:e.uuid}).pipe($(({chapters:i})=>i)),e.isLive?this.liveVideoService.getVideoLive(e.id):M$1(void 0),e.privacy.id===Zt.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):M$1([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies(),this.playerSettingsService.getVideoSettings({videoId:e.uuid,raw:true}),this.videoEmbedPrivacyService.getPrivacy({videoId:e.uuid})];}static ɵfac=function(i){return new(i||t)();};static ɵprov=S({token:t,factory:t.ɵfac});}return t;})();var Je=[{path:"",component:ie,canActivate:[ck],canDeactivate:[ok],providers:[me,g,d,Cn,Ii,ya,M,l,Pa],resolve:{resolverData:g},children:jS}];/**i18n:c8855ca17fb20171aa9dd43d012e42547cb1f0cfd9c21d4dc05679bbbdf5ccb8*/export{Je as default};//# sourceMappingURL=chunk-Dp6MKsMF.js.map