import{o as F}from"./chunk-C6uGsfWa.js";import{An as M,Hi as Zt,In as Mg,Io as kg,Ja as g,Mr as S,Ns as rh,Pa as eo,Rr as Si,St as G,To as je,Ws as sn,_r as QH,as as nt,br as Qc,ei as V,ht as Et,k as Bb,qi as _F,ro as he,s as $a,sr as Or,yc as wp}from"./chunk-b0nJCs5_.js";import"./chunk-CDRFWLLW.js";import"./chunk-BXrVgciI.js";import{r as b,t as H}from"./chunk-CswnO8Ym.js";import{t as n}from"./chunk-pq4Luh0F.js";import{t as O}from"./chunk-BdDU3qnh.js";import"./chunk-C0C2vyNb.js";import{s as Jn,u as Qn}from"./chunk-Cmet2Nw-.js";import"./chunk-CkJf4plT.js";import"./chunk-Dga4Oy_6.js";import"./chunk-q-6uNE4L.js";import"./chunk-YjBxjUE4.js";import"./chunk-CxT8jfPH.js";import"./chunk-CKCWxqhm.js";import"./chunk-DcB590Yc.js";import"./chunk-BvsfL09w.js";import"./chunk-BpR0ReBf.js";import"./chunk-DNBjyHdz2.js";import"./chunk-B4yFU5n32.js";import"./chunk-uNqEPBRE2.js";import"./chunk-CnYI1CZp2.js";import"./chunk-CnEH9ox82.js";import"./chunk-DwtxXnIx2.js";import"./chunk-D3sqbh442.js";import"./chunk-2WQXD8yV2.js";import"./chunk-B1IbTx1B2.js";import"./chunk-BqndqiNm2.js";import"./chunk-DzDmtByK2.js";import"./chunk-jYOpi6XL2.js";import{t as S$1}from"./chunk-D6vJfxN82.js";import"./chunk-DkyXk6bJ2.js";import"./chunk-DsKBogZp.js";import"./chunk-B1JWCK7G.js";import{d as ae}from"./chunk-CBkcKks-.js";import"./chunk-DNbwdWcY.js";import"./chunk-Hufy2o-o.js";import"./chunk-CxGsHfUL.js";import"./chunk-DWd4safw.js";import"./chunk-DWL2z-yI.js";import"./chunk-hDPFqAgp.js";import"./chunk-Bka8Q1oK2.js";import"./chunk-x3pAkggI2.js";import"./chunk-KEcglKoj2.js";import{t as R}from"./chunk-DfNp4S442.js";import{t as L}from"./chunk-AtGtJ1de2.js";import{a as Pi,c as pA,l as qt,n as An,o as Ws,r as Di,s as oe,t as $n}from"./chunk-Bda2fbF2.js";var u=class r{route=g(eo);serverService=g(Zt);notifier=g(Si);manageController=g(oe);ngOnInit(){let{userChannels:i,userQuota:t,privacies:a,videoEdit:n}=this.route.snapshot.data.resolverData;this.manageController.setStore({videoEdit:n,userQuota:t,userChannels:i,privacies:a}),this.manageController.setConfig({manageType:`update`,serverConfig:this.serverService.getHTMLConfig()})}ngOnDestroy(){this.manageController.cancelUploadIfNeeded()}onVideoUpdated(){this.notifier.success("Video aggiornato.")}onUnload(e){let{text:i,canDeactivate:t}=this.canDeactivate();if(!t)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||r)};static ɵcmp=$a({type:r,selectors:[[`my-video-manage`]],hostBindings:function(i,t){i&1&&rh(`beforeunload`,function(n){return t.onUnload(n)},QH)},decls:2,vars:0,consts:[[1,`margin-content`],[`canUpdate`,`true`,`canWatch`,`true`,`cancelLink`,`/my-library/videos`,3,`videoUpdated`]],template:function(i,t){i&1&&(wp(0,`div`,0)(1,`my-video-manage-container`,1),rh(`videoUpdated`,function(){return t.onVideoUpdated()}),Bb()())},dependencies:[Jn,Qn,Ws],encapsulation:2,changeDetection:1})};var s=class r{router=g(Et);videoService=g(H);liveVideoService=g(L);authService=g(nt);videoCaptionService=g(O);videoChapterService=g(n);videoPasswordService=g(b);userService=g(Qc);serverService=g(Zt);playerSettingsService=g(S$1);videoEmbedPrivacyService=g(Pi);resolve(e){let i=e.params.uuid;return this.videoService.getVideo({videoId:i}).pipe(je(t=>_F(this.buildObservables(t))),je(mi=>F(this,[mi],function*([t,a,n,V,h,C,y,oe,te,D,P]){return{video:t,userChannels:n,captions:V,chapters:h,videoSource:a,live:C,videoPasswords:y,userQuota:oe,privacies:te,videoEdit:yield $n.createFromAPI(this.serverService.getHTMLConfig(),{video:t,captions:V,chapters:h,live:C,videoSource:a,playerSettings:D,videoPasswords:y.map(ae=>ae.password),embedPrivacy:P}),playerSettings:D,embedPrivacy:P}})),he(t=>(V.error(`Cannot fetch video information`,t),this.router.navigate([`/401`],{state:{obj:t},skipLocationChange:!0}),Or(()=>t))))}buildObservables(e){return[M(e),this.videoService.getSource(e.id),ae({authService:this.authService,includeCollaborations:!0}),this.videoCaptionService.listCaptions(e.uuid).pipe(G(i=>i.data)),this.videoChapterService.getChapters({videoId:e.uuid}).pipe(G(({chapters:i})=>i)),e.isLive?this.liveVideoService.getVideoLive(e.id):M(void 0),e.privacy.id===sn.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):M([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies(),this.playerSettingsService.getVideoSettings({videoId:e.uuid,raw:!0}),this.videoEmbedPrivacyService.getPrivacy({videoId:e.uuid})]}static ɵfac=function(i){return new(i||r)};static ɵprov=S({token:r,factory:r.ɵfac})};var ci=[{path:``,component:u,canActivate:[kg],canDeactivate:[Mg],providers:[oe,s,L,qt,An,Di,R,S$1,Pi],resolve:{resolverData:s},children:pA}];export{ci as default};
//# debugId=0401bd52-fbae-594c-9f80-0de6742d08b7
//# sourceMappingURL=chunk-VOCmtRF6.js.map