import{a as Y,b as q,c as X,d as l,f as Z,g as ee,h as ie}from"./chunk-LP4IUN6L.js";import{a as J}from"./chunk-ELQAKHRN.js";import"./chunk-HVHJZZBS.js";import{a as p}from"./chunk-ZIQRAESY.js";import"./chunk-P7O5AXMA.js";import"./chunk-HWMASNPY.js";import"./chunk-V22XJQIS.js";import"./chunk-JJPPPEYO.js";import"./chunk-KSBJFKUC.js";import"./chunk-NWNN2266.js";import"./chunk-AFZYFOYP.js";import"./chunk-F5BGNMZU.js";import"./chunk-QZHZMTI7.js";import"./chunk-3LNMQRGW.js";import"./chunk-P2QKOLPI.js";import"./chunk-Z7IJHEYT.js";import"./chunk-6MEEQLWL.js";import{a as v}from"./chunk-6JZMHAXO.js";import"./chunk-IUHKOT6L.js";import"./chunk-PRXPZT23.js";import"./chunk-RYB2UKRC.js";import"./chunk-6SKKCLHH.js";import"./chunk-YVZKTMAK.js";import{a as K}from"./chunk-IXVWQEGZ.js";import"./chunk-DDGB622D.js";import"./chunk-ULGYO4HA.js";import{a as $}from"./chunk-4OBCC667.js";import"./chunk-ME3Z53NC.js";import"./chunk-PK2XDCF3.js";import"./chunk-72GOCXWJ.js";import"./chunk-OTMFBZXA.js";import{b as N,c as Q}from"./chunk-JITMAVP4.js";import"./chunk-CWZHKLYO.js";import"./chunk-NNGPXXI4.js";import"./chunk-3WAQSKYH.js";import"./chunk-QXEYT4D7.js";import"./chunk-BIFSHE2D.js";import"./chunk-WO4ED4IM.js";import"./chunk-QCA54E2P.js";import"./chunk-WPBWOUWA.js";import"./chunk-KHHQCOMB.js";import"./chunk-OJS2US3R.js";import"./chunk-J4ZKCWKK.js";import"./chunk-M47TE5K7.js";import"./chunk-IX3C5NWZ.js";import"./chunk-KLWYGBZ6.js";import{C as O,D as R}from"./chunk-NQFIF6FB.js";import{B as P,Bd as H,Ff as x,Fh as B,Ka as A,Oh as W,Q as g,Qh as m,Uh as z,Y as I,aa as t,fb as E,gb as T,j as c,ji as G,k as D,n as f,oe as _,of as j,ph as k,r as b,xd as F,ya as L,zb as S}from"./chunk-W6R7I2TH.js";import{i as s,l as w}from"./chunk-PTJGHD3V.js";var re=(()=>{let o=class o{route=t(F);serverService=t(m);notifier=t(k);manageController=t(l);isUpdatingVideo=!1;loaded=!1;ngOnInit(){let e=this.route.snapshot.data.resolverData,{userChannels:i,userQuota:r,privacies:a,videoEdit:d}=e;this.manageController.setStore({videoEdit:d,userQuota:r,userChannels:i,privacies:a}),this.manageController.setConfig({manageType:"update",serverConfig:this.serverService.getHTMLConfig()});}ngOnDestroy(){this.manageController.cancelUploadIfNeeded();}onVideoUpdated(){this.notifier.success("mi ante e ijo sitelen.");}onUnload(e){let{text:i,canDeactivate:r}=this.canDeactivate();if(!r)return e.returnValue=i,i;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"You have unsaved changes. Are you sure you want to leave?"};}};s(o,"\u0275fac",function(i){return new(i||o)();}),s(o,"\u0275cmp",A({type:o,selectors:[["my-video-manage"]],hostBindings:function(i,r){i&1&&S("beforeunload",function(d){return r.onUnload(d);},L);},decls:2,vars:0,consts:[[1,"margin-content"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]],template:function(i,r){i&1&&(E(0,"div",0)(1,"my-video-manage-container",1),S("videoUpdated",function(){return r.onVideoUpdated();}),T()());},dependencies:[O,R,ie],encapsulation:2}));let n=o;return n;})();var h=(()=>{let o=class o{router=t(H);videoService=t(Q);liveVideoService=t(p);authService=t(B);videoCaptionService=t($);videoChapterService=t(K);videoPasswordService=t(N);userService=t(G);serverService=t(m);playerSettingsService=t(v);resolve(e){let i=e.params.uuid;return this.videoService.getVideo({videoId:i}).pipe(g(r=>b(this.buildObservables(r))),g(Ye=>w(this,[Ye],function*([r,a,d,C,V,y,M,te,oe,U]){let ne=yield Z.createFromAPI(this.serverService.getHTMLConfig(),{video:r,captions:C,chapters:V,live:y,videoSource:a,playerSettings:U,videoPasswords:M.map(u=>u.password)});return{video:r,userChannels:d.filter(u=>u.ownerAccountId===r.channel.ownerAccount.id),captions:C,chapters:V,videoSource:a,live:y,videoPasswords:M,userQuota:te,privacies:oe,videoEdit:ne,playerSettings:U};})),P(r=>(j.error("Cannot fetch video information",r),this.router.navigate(["/401"],{state:{obj:r},skipLocationChange:!0}),D(()=>r))));}buildObservables(e){return[c(e),this.videoService.getSource(e.id),x(this.authService,{includeCollaborations:!0}),this.videoCaptionService.listCaptions(e.uuid).pipe(f(i=>i.data)),this.videoChapterService.getChapters({videoId:e.uuid}).pipe(f(({chapters:i})=>i)),e.isLive?this.liveVideoService.getVideoLive(e.id):c(void 0),e.privacy.id===_.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):c([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies(),this.playerSettingsService.getVideoSettings({videoId:e.uuid,raw:!0})];}};s(o,"\u0275fac",function(i){return new(i||o)();}),s(o,"\u0275prov",I({token:o,factory:o.ɵfac}));let n=o;return n;})();var Qe=[{path:"",component:re,canActivate:[z],canDeactivate:[W],providers:[l,h,p,Y,q,X,J,v],resolve:{resolverData:h},children:ee}];export{Qe as default};/**i18n:90f1dd82a779b57eddc91ef20913c88eecaa9632bba8ac04ad50f47ae2b82df7*///# sourceMappingURL=chunk-7ZESKJYZ.js.map