import{W as WS,_ as _e,S as Sn,I as Ii,y as ya,P as Pa,a as IC,t as to}from'./chunk-Ddecr1cP.js';import{M}from'./chunk-CyPgJ3OZ.js';import{m}from'./chunk-RxmJ9Fa4.js';import'./chunk-DZQAYT0s.js';import{a as ae}from'./chunk-DD8MQbrM.js';import'./chunk-C5r1aluR.js';import'./chunk-CwlPVglh.js';import'./chunk-DwfQijvj.js';import'./chunk-uAC8t5Px.js';import'./chunk-Bto8Nw8v.js';import'./chunk-CmO6E5J5.js';import'./chunk-D1adbcO5.js';import'./chunk-DLVdZllO.js';import'./chunk-BvVTt34V.js';import'./chunk-BNGsiHsg.js';import'./chunk-D6R-e_vb.js';import'./chunk-DsZ3hjLw.js';import'./chunk-DHYGrK7v.js';import'./chunk-DUHu7YLX.js';import'./chunk-BytPeYh8.js';import{l}from'./chunk-B-6nTIgK.js';import'./chunk-z3i9wMnz.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,e$ as _,P as Pc,$ as $t,a9 as Oe,aX as fe,bs as L$1,aN as $,am as Zt,aY as S,aO as jr,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,f0 as Fo,f1 as tB}from'./main-sJAtkqeq.js';import'./chunk-CzJ2GmUK.js';import'./chunk-F7sai10S.js';var ie=(()=>{class t{route=g$1(jr);serverService=g$1($t);notifier=g$1(rc);manageController=g$1(_e);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("Tavidyut tettwaleqqem.");}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(m);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};})),fe(o=>(j.error("Cannot fetch video information",o),this.router.navigate(["/401"],{state:{obj:o},skipLocationChange:true}),Fo(()=>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:[_e,g,m,Sn,Ii,ya,M,l,Pa],resolve:{resolverData:g},children:WS}];/**i18n:fad79908930cbb4c308e7550a5fe49bb3841dbb330066a6429aebaa006173605*/export{Je as default};//# sourceMappingURL=chunk-B6WaVupN.js.map