import{W as WS,m as me,S as Sn,I as Ii,D as Da,P as Pa,a as IC,t as to}from'./chunk-BeVWVE1t.js';import{M}from'./chunk-DTOX4UJn.js';import{d}from'./chunk-CDSZIUlG.js';import'./chunk-B9RMZ5rp.js';import{a as ae}from'./chunk-DgurbgXQ.js';import'./chunk-L5A5rljK.js';import'./chunk-BtfjBYk-.js';import'./chunk-D2g5aDwT.js';import'./chunk-DiHKqxPg.js';import'./chunk-C1fvPFvO.js';import'./chunk-BU_bXFAj.js';import'./chunk-Beqt5oi7.js';import'./chunk-BJ-IexZd.js';import'./chunk-Bs5uhWDK.js';import'./chunk-B8gnsu5Y.js';import'./chunk-1b2UgEHs.js';import'./chunk-BZydbr1g.js';import'./chunk-C91kXzNM.js';import'./chunk-CLNIUXLN.js';import'./chunk-BLHKx18K.js';import{l}from'./chunk-BAXq8voL.js';import'./chunk-xCCSZlL4.js';import{az as rk,d7 as ak,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 L$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,F as Fp,u as ub,aM as R1,aE as L,j,f1 as Ir,f2 as tB}from'./main-ajlqprgK.js';import'./chunk-Dw4eHGQx.js';import'./chunk-F7sai10S.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("\u03A4\u03BF \u03B2\u03AF\u03BD\u03C4\u03B5\u03BF \u03B5\u03BD\u03B7\u03BC\u03B5\u03C1\u03CE\u03B8\u03B7\u03BA\u03B5.");}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);},tB);},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();}),ub()());},dependencies:[Jn,Qn,IC],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=>R1(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[L$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):L$1(void 0),e.privacy.id===Zt.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):L$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:[ak],canDeactivate:[rk],providers:[me,g,d,Sn,Ii,Da,M,l,Pa],resolve:{resolverData:g},children:WS}];/**i18n:fad79908930cbb4c308e7550a5fe49bb3841dbb330066a6429aebaa006173605*/export{Je as default};//# sourceMappingURL=chunk-DAhTLXll.js.map