import{a as Y,b as q,c as X,d as u,f as Z,g as ee,h as re}from"./chunk-LWKDSEO2.js";import{a as J}from"./chunk-LGUDDK4W.js";import"./chunk-QSEJS5LW.js";import{a as p}from"./chunk-JK64HEJ2.js";import"./chunk-BJ6RJ5IL.js";import"./chunk-6VN2MQTT.js";import"./chunk-FZVS655W.js";import"./chunk-NB7P33W6.js";import"./chunk-4N2OFATK.js";import"./chunk-UYH2U427.js";import"./chunk-GSE5JE4X.js";import"./chunk-7VITOC6P.js";import"./chunk-U3LL2CIA.js";import"./chunk-TL6U2ZZX.js";import"./chunk-HLDKWU5C.js";import"./chunk-EOBA744C.js";import"./chunk-IKG5YHKC.js";import{a as v}from"./chunk-ZQBUUMDE.js";import"./chunk-4YSTL544.js";import"./chunk-CTVQPMXA.js";import"./chunk-CBOVCQNK.js";import"./chunk-ZCPPMCJV.js";import"./chunk-6BUG6ZEW.js";import{a as K}from"./chunk-R7T67BY4.js";import"./chunk-HBIR2NAK.js";import"./chunk-6V6SU5RT.js";import{a as $}from"./chunk-M3VV57LB.js";import"./chunk-H52ZZWV7.js";import"./chunk-3VSIIQSO.js";import"./chunk-XMLLNCME.js";import"./chunk-LBFQFEKM.js";import{b as N,c as Q}from"./chunk-S3CDSDDX.js";import"./chunk-VO6JGAHP.js";import"./chunk-IB2LK7TH.js";import"./chunk-353P6O36.js";import"./chunk-GAL6OR7Q.js";import"./chunk-Q6JB2APP.js";import"./chunk-GNWGIVUW.js";import"./chunk-OTSILD44.js";import"./chunk-3ZNDWVB3.js";import"./chunk-NJRIO7OX.js";import"./chunk-7Z6BBMUO.js";import"./chunk-MH6M24BO.js";import"./chunk-EVDXICKF.js";import"./chunk-RIF6CCEH.js";import"./chunk-NXALGPN2.js";import{C as O,D as R}from"./chunk-3V3ZIFZ3.js";import{B as P,Cd as H,Gf as x,Gh as B,Ka as A,Ph as W,Q as g,Sh as m,Wh as z,Y as I,aa as t,fb as E,gb as T,j as c,k as D,li as G,n as f,pe as _,pf as j,qh as k,r as b,ya as L,yd as F,zb as S}from"./chunk-AVPM423Z.js";import{i as s,l as U}from"./chunk-W5TMGCPH.js";var ie=(()=>{let o=class o{route=t(F);serverService=t(m);notifier=t(k);manageController=t(u);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("\u5F71\u7247\u5DF2\u66F4\u65B0\u3002");}onUnload(e){let{text:r,canDeactivate:i}=this.canDeactivate();if(!i)return e.returnValue=r,r;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"\u60A8\u6709\u5C1A\u672A\u5132\u5B58\u7684\u8B8A\u66F4\u3002\u60A8\u78BA\u5B9A\u60A8\u60F3\u8981\u96E2\u958B\u55CE\uFF1F"};}};s(o,"\u0275fac",function(r){return new(r||o)();}),s(o,"\u0275cmp",A({type:o,selectors:[["my-video-manage"]],hostBindings:function(r,i){r&1&&S("beforeunload",function(d){return i.onUnload(d);},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:[O,R,re],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 r=e.params.uuid;return this.videoService.getVideo({videoId:r}).pipe(g(i=>b(this.buildObservables(i))),g(Ye=>U(this,[Ye],function*([i,a,d,C,V,y,M,te,oe,w]){let ne=yield Z.createFromAPI(this.serverService.getHTMLConfig(),{video:i,captions:C,chapters:V,live:y,videoSource:a,playerSettings:w,videoPasswords:M.map(l=>l.password)});return{video:i,userChannels:d.filter(l=>l.ownerAccountId===i.channel.ownerAccount.id),captions:C,chapters:V,videoSource:a,live:y,videoPasswords:M,userQuota:te,privacies:oe,videoEdit:ne,playerSettings:w};})),P(i=>(j.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),x(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===_.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(r){return new(r||o)();}),s(o,"\u0275prov",I({token:o,factory:o.ɵfac}));let n=o;return n;})();var Qe=[{path:"",component:ie,canActivate:[z],canDeactivate:[W],providers:[u,h,p,Y,q,X,J,v],resolve:{resolverData:h},children:ee}];export{Qe as default};/**i18n:ceac57349051bcddcb40dd2878e0abcb86556d5ceb9d6109d22ac3f1ae3cc7b1*///# sourceMappingURL=chunk-BQAQKABY.js.map