import{a as Y,b as q,c as X,d as l,f as Z,g as ee,h as ie}from"./chunk-UN7XM26W.js";import{a as J}from"./chunk-4E6CTLK6.js";import"./chunk-ZCLVEPSE.js";import{a as p}from"./chunk-4TNDDV3K.js";import"./chunk-2PNFXYZ6.js";import"./chunk-ES2VWGRK.js";import"./chunk-GMNE7MIA.js";import"./chunk-WQWKKHX2.js";import"./chunk-A55IRY6G.js";import"./chunk-GFQ3OWDA.js";import"./chunk-TIXILAY2.js";import"./chunk-D7C6ODTH.js";import"./chunk-GZFOY262.js";import"./chunk-VJ5OMPQD.js";import"./chunk-DN5K4BTU.js";import"./chunk-X52NXDG3.js";import"./chunk-L4VDLAN5.js";import{a as v}from"./chunk-QM4QUBVM.js";import"./chunk-7JIWVLSZ.js";import"./chunk-R3RCTP7Y.js";import"./chunk-PGTIEPSN.js";import"./chunk-SS5UNTYN.js";import"./chunk-QE43GCDT.js";import{a as K}from"./chunk-6ML4ZO7N.js";import"./chunk-NRJWHBW4.js";import"./chunk-YR7E5ZGU.js";import{a as $}from"./chunk-E4VNMGFY.js";import"./chunk-5Z2M7DB4.js";import"./chunk-ZWVTSJMP.js";import"./chunk-SMPG6HOB.js";import"./chunk-2GL4IZBA.js";import{b as N,c as Q}from"./chunk-TQUYGBVG.js";import"./chunk-HLOOXAIQ.js";import"./chunk-K7HENY5F.js";import"./chunk-QYGUMUGN.js";import"./chunk-VUTL6VWZ.js";import"./chunk-ZGZL4C6F.js";import"./chunk-QYDO4TY5.js";import"./chunk-KUFH5V3T.js";import"./chunk-ICRG7CY6.js";import"./chunk-VFZ3Y5O2.js";import"./chunk-LOOUJWFZ.js";import"./chunk-WCHENBV3.js";import"./chunk-2XR2VGOA.js";import"./chunk-XZLMPP4F.js";import"./chunk-VJOXMIQY.js";import{C as O,D as R}from"./chunk-UR42IA56.js";import{B as P,Bd as H,Dg as j,Eh as B,Ka as A,Nh as W,Ph as m,Q as g,Tg as x,Th as z,Y as I,aa as t,fb as E,gb as T,ii as G,j as c,k as D,n as f,nh as k,oe as _,r as b,xd as F,ya as L,zb as S}from"./chunk-CUA2BO3S.js";import{i as s,l as w}from"./chunk-75J4RO44.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("Myndskei\xF0 uppf\xE6rt.");}onUnload(e){let{text:i,canDeactivate:r}=this.canDeactivate();if(!r)return e.returnValue=i,i;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"\xDE\xFA ert me\xF0 \xF3vista\xF0ar breytingar. Viltu samt fara?"};}};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:42440f0a8726af1836b15b193adfd3f46a3ecd983a1ed2a1e05982c4f600c8a1*///# sourceMappingURL=chunk-RTWS5YW6.js.map