import{a as q,b as K,c as Z,d as l,f as ee,g as re,h as ie}from"./chunk-PYVKVJ6K.js";import{a as Y}from"./chunk-MMS32C27.js";import"./chunk-EZ47K2KV.js";import{a as p}from"./chunk-74NCR33J.js";import"./chunk-23GI6Y4Z.js";import"./chunk-NTZ24MSY.js";import"./chunk-QEXK3RM7.js";import"./chunk-H57GK6SM.js";import"./chunk-NB2HM4DC.js";import"./chunk-A7AOXL5E.js";import"./chunk-PYCXO7QV.js";import"./chunk-IRWUC2CT.js";import"./chunk-OIYWA2HS.js";import"./chunk-FE553XN2.js";import"./chunk-GAFOTJIM.js";import"./chunk-B6E4ZS3W.js";import"./chunk-JAGEB2Z2.js";import{a as v}from"./chunk-XJNCRAEG.js";import"./chunk-CA7DUKLG.js";import"./chunk-MC2ISO42.js";import"./chunk-IHMNCUC3.js";import"./chunk-RDOIXPFS.js";import"./chunk-DQ7X5ENA.js";import{a as X}from"./chunk-DN5WV3DD.js";import"./chunk-AVVTA5TW.js";import"./chunk-YSDVZ4ML.js";import{a as J}from"./chunk-VN5RUFMQ.js";import"./chunk-UXHUTA6H.js";import"./chunk-E5XVMKDC.js";import"./chunk-XMYCMRMC.js";import"./chunk-66LMAQUK.js";import{b as Q,c as $}from"./chunk-V4YGGZ4W.js";import"./chunk-PBWCQDPD.js";import"./chunk-ESBU7OHQ.js";import"./chunk-NRDFEUGY.js";import"./chunk-T5RBWDW4.js";import"./chunk-JRPZV2OL.js";import"./chunk-X3SPFC3P.js";import"./chunk-ITB6MN7G.js";import"./chunk-EATDPRVO.js";import"./chunk-VPWIEXHH.js";import"./chunk-TTVU4ATD.js";import"./chunk-2AOWEEBV.js";import"./chunk-V6J7QVDD.js";import"./chunk-QYZO4RSP.js";import{C as R,D as _}from"./chunk-AWFGIQSJ.js";import{$h as N,B as P,Cb as S,Eh as z,Fa as L,Gh as m,Kg as k,Kh as G,Q as g,Rc as F,Sa as A,Y as I,aa as o,eh as B,fe as j,j as c,k as D,n as f,ob as E,pb as T,pd as H,r as b,td as O,ug as x,vh as W}from"./chunk-GKQGDBUU.js";import{i as s,l as w}from"./chunk-QVFSZZWQ.js";var oe=(()=>{let t=class t{route=o(H);serverService=o(m);notifier=o(B);manageController=o(l);isUpdatingVideo=!1;loaded=!1;ngOnInit(){let e=this.route.snapshot.data.resolverData,{userChannels:r,userQuota:i,privacies:a,videoEdit:d}=e;this.manageController.setStore({videoEdit:d,userQuota:i,userChannels:r,privacies:a}),this.manageController.setConfig({manageType:"update",serverConfig:this.serverService.getHTMLConfig()});}ngOnDestroy(){this.manageController.cancelUploadIfNeeded();}onVideoUpdated(){this.notifier.success("Filmo \u011Disdatigita.");}onUnload(e){let{text:r,canDeactivate:i}=this.canDeactivate();if(!i)return e.returnValue=r,r;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"You have unsaved changes. Are you sure you want to leave?"};}};s(t,"\u0275fac",function(r){return new(r||t)();}),s(t,"\u0275cmp",A({type:t,selectors:[["my-video-manage"]],hostBindings:function(r,i){r&1&&S("beforeunload",function(d){return i.onUnload(d);},!1,L);},decls:2,vars:0,consts:[[1,"margin-content"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]],template:function(r,i){r&1&&(E(0,"div",0)(1,"my-video-manage-container",1),S("videoUpdated",function(){return i.onVideoUpdated();}),T()());},dependencies:[F,R,_,ie],encapsulation:2}));let n=t;return n;})();var h=(()=>{let t=class t{router=o(O);videoService=o($);liveVideoService=o(p);authService=o(W);videoCaptionService=o(J);videoChapterService=o(X);videoPasswordService=o(Q);userService=o(N);serverService=o(m);playerSettingsService=o(v);resolve(e){let r=e.params.uuid;return this.videoService.getVideo({videoId:r}).pipe(g(i=>b(this.buildObservables(i))),g(Ke=>w(this,[Ke],function*([i,a,d,C,V,y,M,te,ne,U]){let ae=yield ee.createFromAPI(this.serverService.getHTMLConfig(),{video:i,captions:C,chapters:V,live:y,videoSource:a,playerSettings:U,videoPasswords:M.map(u=>u.password)});return{video:i,userChannels:d.filter(u=>u.ownerAccountId===i.channel.ownerAccount.id),captions:C,chapters:V,videoSource:a,live:y,videoPasswords:M,userQuota:te,privacies:ne,videoEdit:ae,playerSettings:U};})),P(i=>(x.error("Cannot fetch video information",i),this.router.navigate(["/401"],{state:{obj:i},skipLocationChange:!0}),D(()=>i))));}buildObservables(e){return[c(e),this.videoService.getSource(e.id),k(this.authService,{includeCollaborations:!0}),this.videoCaptionService.listCaptions(e.uuid).pipe(f(r=>r.data)),this.videoChapterService.getChapters({videoId:e.uuid}).pipe(f(({chapters:r})=>r)),e.isLive?this.liveVideoService.getVideoLive(e.id):c(void 0),e.privacy.id===j.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):c([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies(),this.playerSettingsService.getVideoSettings({videoId:e.uuid,raw:!0})];}};s(t,"\u0275fac",function(r){return new(r||t)();}),s(t,"\u0275prov",I({token:t,factory:t.ɵfac}));let n=t;return n;})();var Je=[{path:"",component:oe,canActivate:[G],canDeactivate:[z],providers:[l,h,p,q,K,Z,Y,v],resolve:{resolverData:h},children:re}];export{Je as default};/**i18n:42345378061bf3c93df67acfa161b751a7b03cc91f3ede7c1f1cdf2bba62fe26*///# sourceMappingURL=chunk-4D2SS4TB.js.map