1import{a as kt}from"./chunk-G2J2EHB2.js";import{a as xt,b as wt,c as Ht}from"./chunk-EBBGYWSY.js";import"./chunk-6S7GR7RZ.js";import{a as bt,b as Vt,c as Yt,d as Gt}from"./chunk-IKRNBRJG.js";import{a as Mt,b as vt,k as yt,l as Pt}from"./chunk-N3ODB36S.js";import{a as ce}from"./chunk-TB5BTAZU.js";import{a as At}from"./chunk-L435IOLB.js";import"./chunk-AGD5WKED.js";import{a as Rt}from"./chunk-XAUPS75L.js";import{a as $t}from"./chunk-X2SRRTG5.js";import{a as Lt}from"./chunk-C4KUKUZD.js";import{a as ft}from"./chunk-S7TSA3HI.js";import"./chunk-J3EEEQXE.js";import{a as un}from"./chunk-62ATBB34.js";import{a as Ot}from"./chunk-PVOHGV2Y.js";import"./chunk-LQVRZI54.js";import"./chunk-GDFO7X2G.js";import{a as It}from"./chunk-I6M5NA5Y.js";import"./chunk-Q6I3NOHV.js";import{a as Fn}from"./chunk-KIVJRE4O.js";import"./chunk-L7C23KC7.js";import{h as Nt}from"./chunk-VDA4PBJF.js";import"./chunk-YLZ34D6D.js";import"./chunk-QXVUYXIG.js";import{b as an}from"./chunk-OR7MKCZD.js";import{a as mt}from"./chunk-ZME7CHSV.js";import{a as dn}from"./chunk-OTKVWBE5.js";import{a as Oe}from"./chunk-LLCRV73S.js";import{a as St}from"./chunk-TALII272.js";import{a as cn,b as Tt}from"./chunk-KLT2ZASF.js";import{b as gt,d as x}from"./chunk-V3JZPFOE.js";import{c as fe}from"./chunk-PG4F5PSG.js";import"./chunk-CIVVPYF3.js";import{b as ht}from"./chunk-FZFWY5Y6.js";import{a as Dt}from"./chunk-EGEBNI4V.js";import{E as K,F as de,c as Wn,g as Ae,h as Qn,o as tn,p as Zn,w as Jn,x as et}from"./chunk-EBOVR5NW.js";import{G as st,H as dt,n as at,p as rt,q as _t,r as lt}from"./chunk-UME7L37K.js";import{a as q}from"./chunk-R76LZEZS.js";import{$f as vn,Ab as g,Ah as pt,B as ke,Bb as S,Ca as a,Cb as F,Cc as Xe,Db as C,Dc as le,Df as Mn,Eb as m,Ec as ze,Ee as it,Fa as In,Fb as X,Fd as en,Fe as ot,Gb as v,Gc as Xn,Gd as jn,Gh as Ct,Ib as l,Jd as se,K as bn,Kc as zn,Kd as he,La as wn,Lc as Kn,Ma as R,Mh as sn,Oa as Hn,Pb as kn,Pd as nn,Q as B,Qb as Ke,Rb as Ne,Rg as G,S as Ce,Sb as On,Sg as ct,Ta as _e,Tg as Ft,Ub as Bn,Vc as Je,Xb as P,Xd as nt,Xg as jt,Y as Vn,Yb as z,Zb as me,Zc as qn,aa as c,bc as qe,cc as je,d as Se,dc as We,ed as De,fa as V,fb as E,ga as Y,gb as p,hh as k,ib as Be,ih as _n,j as Te,jb as W,je as tt,jh as ut,k as He,kb as Q,kc as Un,ke as on,kh as ln,lb as d,lc as h,mb as r,n as An,nb as o,nh as Ie,ob as s,qa as Yn,qh as Ln,r as $n,sb as T,sc as Qe,ta as Gn,tb as N,tc as Ze,th as Et,ub as fn,wc as Ue,yb as U,za as xn,zf as rn}from"./chunk-HVCWS4IF.js";import{a as re,b as hn,g as qt,j as D,k as pe}from"./chunk-KJ7W2O2B.js";var ge=class ge{formReactiveService=c(an);error="";videoChannelEdit;mode;formErrors=[];saveHook;storeChanges=new Se();setStore(n){this.videoChannelEdit=n,this.storeChanges.next();}getStore(){return this.videoChannelEdit;}getStoreChangesObs(){return this.storeChanges.asObservable();}getMode(){return this.mode;}setMode(n){this.mode=n;}setError(n){this.error=n;}resetError(){this.setError("");}getError(){return this.error;}setFormError(n,e,i){let _=this.formReactiveService.grabAllErrors(i);this.formErrors=this.formErrors.filter(u=>u.page!==n),_.length!==0&&this.formErrors.push({page:n,path:e,errors:_});}getFormErrors(){return this.formErrors;}hasFormErrors(){return this.formErrors.some(({errors:n})=>n.length!==0);}registerSaveHook(n){this.saveHook=n;}unregisterSaveHook(){this.saveHook=void 0;}runSaveHook(){return this.saveHook?this.saveHook():Promise.resolve();}};D(ge,"\u0275fac",function(e){return new(e||ge)();}),D(ge,"\u0275prov",Vn({token:ge,factory:ge.ɵfac}));var $=ge;function Qt(t,n){t&1&&s(0,"my-collaborator-state",21);}function Zt(t,n){t&1&&s(0,"my-collaborator-state",22);}function Jt(t,n){if(t&1&&E(0,Qt,1,0,"my-collaborator-state",21)(1,Zt,1,0,"my-collaborator-state",22),t&2){let e=l(3);p(e.user.isOwnerOfChannel(e.videoChannelEdit().apiInfo)?0:e.user.isEditorOfChannel(e.videoChannelEdit().apiInfo)?1:-1);}}function ei(t,n){if(t&1&&E(0,Jt,2,1),t&2){let e=l(2);p(e.user.isCollaboratingToChannels()?0:-1);}}function ni(t,n){t&1&&s(0,"my-collaborator-state",23);}function ti(t,n){t&1&&s(0,"my-collaborator-state",24);}function ii(t,n){if(t&1&&E(0,ni,1,0,"my-collaborator-state",23)(1,ti,1,0,"my-collaborator-state",24),t&2){let e=l().action;p(e.data.editor?0:e.data.owner?1:-1);}}function oi(t,n){if(t&1&&E(0,ii,2,1),t&2){let e=n.action;p(e.data.collaborate?0:-1);}}function ai(t,n){if(t&1&&(r(0,"h2")(1,"my-action-dropdown",20),_e(2,ei,1,1,"ng-template",null,0,Ue)(4,oi,1,1,"ng-template",null,1,Ue),o()()),t&2){let e,i=l();a(),d("label",(e=i.videoChannelEdit())==null?null:e.channel.displayName)("actions",i.switchChannelActions);}}function ri(t,n){t&1&&(r(0,"h2"),F(1,4),o());}function _i(t,n){if(t&1&&(r(0,"my-button",15)(1,"span",25),F(2,5),o()()),t&2){let e=l();d("href",e.getChannelPublicUrl());}}function li(t,n){if(t&1&&(r(0,"my-alert",17),P(1),o()),t&2){let e=l();a(),me(" ",e.getError()," ");}}function si(t,n){if(t&1&&(r(0,"li"),P(1),o()),t&2){let e=n.$implicit;a(),z(e);}}function di(t,n){if(t&1&&(r(0,"div",19)(1,"a",26),F(2,7),o(),r(3,"ul",27),W(4,si,2,1,"li",null,Be),o()()),t&2){let e=n.$implicit;a(),d("routerLink",e.path),a(),C(e.page),m(2),a(2),Q(e.errors);}}function ci(t,n){if(t&1&&(r(0,"my-alert",18)(1,"div"),F(2,6),o(),W(3,di,6,2,"div",19,Be),o()),t&2){let e=l();a(3),Q(e.getAllFormErrors());}}var Me=class Me{authService=c(k);horizontalMenuService=c(It);videoChannelEdit=le.required();saveFn=le.required();editControllerService=c($);mode;menuConfig;displayFormErrorsMsg=!1;switchChannelActions=[];isSaving=!1;get user(){return this.authService.getUser();}ngOnInit(){this.mode=this.editControllerService.getMode(),this.menuConfig={title:this.mode==="create"?"Create channel":"Manage my channel",entries:[{type:"link",icon:"channel",label:"General",routerLink:"general"},{type:"link",icon:"users",label:"Editors",routerLink:"editors",isDisplayed:()=>this.mode==="update"},{type:"separator"},{type:"link",icon:"calendar",label:"Activity",routerLink:"activities",isDisplayed:()=>this.mode==="update"}]},this.buildSwitchChannelActions(),this.editControllerService.setStore(this.videoChannelEdit()),this.horizontalMenuService.setMenuHidden(!0);}
1ngOnDestroy(){this.horizontalMenuService.setMenuHidden(!1);}buildSwitchChannelActions(){let n=this.authService.getUser(),e=(_,{editor:u,owner:M,collaborate:O})=>({label:_.displayName,linkBuilder:()=>{let w=this.videoChannelEdit().channel.name,y=window.location.pathname.replace(`/my-library/video-channels/manage/${w}/`,"");return["/my-library/video-channels/manage",_.name,y];},actorAvatar:{actor:_,type:"channel"},data:{collaborate:O,editor:u,owner:M}}),i=n.isCollaboratingToChannels();this.switchChannelActions=[...n.videoChannels.map(_=>e(_,{editor:!1,owner:!0,collaborate:i})),...n.videoChannelCollaborations.map(_=>e(_,{editor:!0,owner:!1,collaborate:i}))];}getError(){return this.editControllerService.getError();}getAllFormErrors(){return this.editControllerService.getFormErrors();}getChannelPublicUrl(){return"/c/"+this.videoChannelEdit().channel.name;}cancelLink(){return"/my-library/video-channels";}canUpdate(){return this.videoChannelEdit().hasChanges()&&!this.editControllerService.hasFormErrors();}hasFormErrors(){return this.editControllerService.hasFormErrors();}onSaveClick(){return pe(this,null,function*(){if(this.displayFormErrorsMsg=!1,yield this.editControllerService.runSaveHook(),this.hasFormErrors()){this.displayFormErrorsMsg=!0;return;}if(!this.isSaving){this.isSaving=!0;try{yield this.saveFn()();}finally{this.isSaving=!1;}}});}};D(Me,"\u0275fac",function(e){return new(e||Me)();}),D(Me,"\u0275cmp",R({type:Me,selectors:[["my-video-channel-edit"]],inputs:{videoChannelEdit:[1,"videoChannelEdit"],saveFn:[1,"saveFn"]},decls:18,vars:6,consts:()=>{let n;n="Cancel";let e;e=" Save ";let i;i="Create a new channel";let _;_="Go to the public page";let u;u="There are errors in your channel settings.";let M;return M=""+"\uFFFD0\uFFFD"+" page",[["labelExtra",""],["dropdownItemExtra",""],n,e,i,_,u,M,[1,"d-flex"],[3,"config"],[1,"w-100","min-width-0"],[1,"actions-container"],[1,"actions","header-block"],["icon","arrow-left","theme","secondary",1,"cancel-button",3,"ptRouterLink"],[1,"go-public-page-save"],["icon","external-link","theme","secondary",1,"go-public-page",3,"href"],["theme","primary","icon","circle-tick","form","channel-manage-form",1,"save-button",3,"click","disabled"],["type","danger",1,"d-block","mt-2"],["type","warning",1,"d-block","mt-2"],[1,"mt-3"],["container","body","buttonStyled","false","buttonIcon","chevron-down",3,"label","actions"],["type","owner",1,"d-inline-flex"],["type","accepted",1,"d-inline-flex"],["small","true","type","accepted",1,"d-inline-flex","ms-2"],["small","true","type","owner",1,"d-inline-flex","ms-2"],[1,"go-public-page-label"],[1,"alert-link",3,"routerLink"],[1,"mb-0"]];},template:function(e,i){if(e&1&&(r(0,"div",8)(1,"div"),s(2,"my-lateral-menu",9),o(),r(3,"div",10)(4,"div",11)(5,"div",12)(6,"my-button",13),F(7,2),o(),E(8,ai,6,2,"h2")(9,ri,2,0,"h2"),r(10,"div",14),E(11,_i,3,1,"my-button",15),r(12,"my-button",16),v("click",function(){return i.onSaveClick();}),F(13,3),o()()(),E(14,li,2,1,"my-alert",17)(15,ci,5,0,"my-alert",18),o(),r(16,"div",19),s(17,"router-outlet"),o()()()),e&2){let _;a(2),d("config",i.menuConfig),a(4),d("ptRouterLink",i.cancelLink()),a(2),p(i.mode==="update"?8:9),a(3),p((_=i.videoChannelEdit())!=null&&_.apiInfo.id?11:-1),a(),d("disabled",!i.canUpdate()),a(2),p(i.getError()?14:i.displayFormErrorsMsg&&i.hasFormErrors()?15:-1);}},dependencies:[K,de,Mt,jn,fe,Fn,nn,he,un,Oe],styles:[".header-block[_ngcontent-%COMP%]{border-radius:14px;background-color:var(--bg-secondary-350)}h2[_ngcontent-%COMP%]{color:var(--fg-300);font-size:calc(1.2625rem + .15vw)}@media(min-width:1200px){h2[_ngcontent-%COMP%]{font-size:1.375rem}}.actions-container[_ngcontent-%COMP%]{position:sticky;top:var(--header-height);background-color:var(--bg);z-index:6}.actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;padding:1.5rem}.actions[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{flex-shrink:1;color:var(--fg-350);font-weight:700;margin-bottom:0;line-height:normal;font-size:calc(1.275rem + .3vw)}@media(min-width:1200px){.actions[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:1.5rem}}.actions[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.actions[_ngcontent-%COMP%] .go-public-page-save[_ngcontent-%COMP%]{display:flex;gap:1rem}@media screen and (max-width:1200px){.actions[_ngcontent-%COMP%]{flex-direction:column;text-align:center}.actions[_ngcontent-%COMP%] .cancel-button[_ngcontent-%COMP%]{display:none}.actions[_ngcontent-%COMP%] .go-public-page-save[_ngcontent-%COMP%]{justify-content:center}}@media screen and (max-width:800px){.actions[_ngcontent-%COMP%] .go-public-page[_ngcontent-%COMP%]{display:none}}@media screen and (max-width:500px){.actions[_ngcontent-%COMP%]{padding:.5rem;gap:.5rem}}"]}));var ve=Me;var Le=class{avatar;banner;playerSettings;channel;collaborators;apiInfo;commonChanged=!1;avatarChanged=!1;bannerChanged=!1;loadFromCreate(n){let{playerSettings:e,user:i}=n;this.playerSettings={theme:e.theme},this.channel={name:"",displayName:"",description:"",support:"",bulkVideosSupportUpdate:!1},this.apiInfo={id:void 0,ownerAccount:i.account,avatars:[],videosCount:0,followersCount:0,bannerUrl:void 0,support:void 0},this.collaborators=[];}loadFromAPI(n){let{channel:e,playerSettings:i,collaborators:_}=n;this.playerSettings={theme:i.theme},this.channel={name:e.name,displayName:e.displayName,description:e.description,support:e.support,bulkVideosSupportUpdate:!1},this.collaborators=[..._],this.apiInfo={id:e.id,avatars:e.avatars,videosCount:e.videosCount,followersCount:e.followersCount,bannerUrl:e.bannerUrl,supp
1ort:e.support,ownerAccount:e.ownerAccount};}hasChanges(){return this.commonChanged||this.avatarChanged||this.bannerChanged;}resetChanges(){this.commonChanged=!1,this.avatarChanged=!1,this.bannerChanged=!1,this.apiInfo.support=this.channel.support;}loadFromGeneralForm(n){this.playerSettings=n.playerSettings,this.channel=re(re({},this.channel),n.channel),this.commonChanged=!0;}updateAvatarFromGeneralForm(n){this.avatar=n,this.avatarChanged=!0;}updateBannerFromGeneralForm(n){this.banner=n,this.bannerChanged=!0;}resetAvatarFromAPI(){this.avatar=null,this.apiInfo.avatars=[];}resetBannerFromAPI(){this.apiInfo.bannerUrl=null;}updateAvatarsFromAPI(n){this.apiInfo.avatars=n;}updateBannerUrlFromAPI(n){this.apiInfo.bannerUrl=n;}};var Re=class Re{authService=c(k);notifier=c(G);videoChannelService=c(x);hooks=c(sn);playerSettingsService=c(ce);editControllerService=c($);router=c(se);videoChannelEdit=new Le();saveFn=this.save.bind(this);ngOnInit(){this.videoChannelEdit.loadFromCreate({user:this.authService.getUser(),playerSettings:{theme:"instance-default"}}),this.editControllerService.setStore(this.videoChannelEdit),this.editControllerService.setMode("create");}ngAfterViewInit(){this.hooks.runAction("action:video-channel-create.init","video-channel");}canDeactivate(){return{canDeactivate:!this.videoChannelEdit.hasChanges()};}save(){return this.editControllerService.resetError(),new Promise(n=>{this.videoChannelService.create(this.videoChannelEdit.channel).pipe(B(()=>this.playerSettingsService.updateChannelSettings({channelHandle:this.videoChannelEdit.channel.name,settings:{theme:this.videoChannelEdit.playerSettings.theme}})),B(()=>this.uploadAvatar(this.videoChannelEdit.channel.name,this.videoChannelEdit.avatar)),B(()=>this.uploadBanner(this.videoChannelEdit.channel.name,this.videoChannelEdit.banner))).subscribe({next:()=>{this.authService.refreshUserInformation(),this.notifier.success("Video channel "+this.videoChannelEdit.channel.displayName+" created."),this.videoChannelEdit.resetChanges(),this.router.navigate(["/my-library/video-channels/manage",this.videoChannelEdit.channel.name]),n();},error:e=>{let i=e.message;e.status===nt.CONFLICT_409&&(i="Channel name \""+this.videoChannelEdit.channel.name+"\" already exists on this platform."),this.editControllerService.setError(i),n();}});});}uploadAvatar(n,e){return e?this.videoChannelService.changeImage(n,e,"avatar"):Te(void 0);}uploadBanner(n,e){return e?this.videoChannelService.changeImage(n,e,"banner"):Te(void 0);}};D(Re,"\u0275fac",function(e){return new(e||Re)();}),D(Re,"\u0275cmp",R({type:Re,selectors:[["ng-component"]],decls:1,vars:2,consts:[[3,"videoChannelEdit","saveFn"]],template:function(e,i){e&1&&s(0,"my-video-channel-edit",0),e&2&&d("videoChannelEdit",i.videoChannelEdit)("saveFn",i.saveFn);},dependencies:[ve],encapsulation:2}));var En=Re;var ye=class ye{authService=c(k);notifier=c(G);route=c(en);videoChannelService=c(x);playerSettingsService=c(ce);hooks=c(sn);editControllerService=c($);videoChannelEdit;saveFn=this.save.bind(this);runChannelInitHook=!0;routeSub;ngOnInit(){this.editControllerService.setMode("update"),this.routeSub=this.route.data.subscribe(n=>{let e=n.data;this.videoChannelEdit=new Le(),this.videoChannelEdit.loadFromAPI({channel:e.videoChannel,playerSettings:e.rawPlayerSettings,collaborators:e.collaborators}),this.editControllerService.setStore(this.videoChannelEdit),this.runChannelInitHook=!0;});}ngOnDestroy(){this.routeSub?.unsubscribe();}ngAfterViewChecked(){this.runChannelInitHook&&(this.hooks.runAction("action:video-channel-update.init","video-channel"),this.runChannelInitHook=!1);}canDeactivate(){return{canDeactivate:!this.videoChannelEdit.hasChanges()};}save(){this.editControllerService.resetError();let n={displayName:this.videoChannelEdit.channel.displayName,description:this.videoChannelEdit.channel.description,support:this.videoChannelEdit.channel.support,bulkVideosSupportUpdate:this.videoChannelEdit.channel.bulkVideosSupportUpdate};return new Promise(e=>{this.videoChannelService.update(this.videoChannelEdit.channel.name,n).pipe(B(()=>this.playerSettingsService.updateChannelSettings({channelHandle:this.videoChannelEdit.channel.name,settings:{theme:this.videoChannelEdit.playerSettings.theme}})),B(()=>this.videoChannelEdit.avatarChanged?this.updateOrDeleteAvatar(this.videoChannelEdit.avatar):Te(!0)),B(()=>this.videoChannelEdit.bannerChanged?this.updateOrDeleteBanner(this.videoChannelEdit.banner):Te(!0))).subscribe({next:()=>{this.authService.refreshUserInformation(),this.videoChannelEdit.resetChanges(),this.notifier.success("Video channel "+n.displayName+" updated."),e();},error:i=>{this.editControllerService.setError(i.message),e();}});});}updateOrDeleteAvatar(n){return n?this.videoChannelService.changeImage(this.videoChannelEdit.channel.name,n,"avatar").pi
1pe(Ce(e=>this.videoChannelEdit.updateAvatarsFromAPI(e.avatars)),ke(e=>He(()=>new Error(vn({err:e,name:"avatar",notifier:this.notifier}))))):this.videoChannelService.deleteImage(this.videoChannelEdit.channel.name,"avatar").pipe(Ce(()=>this.videoChannelEdit.resetAvatarFromAPI()));}updateOrDeleteBanner(n){return n?this.videoChannelService.changeImage(this.videoChannelEdit.channel.name,n,"banner").pipe(Ce(e=>this.videoChannelEdit.updateBannerUrlFromAPI(gt.GET_ACTOR_BANNER_URL(e))),ke(e=>He(()=>new Error(vn({err:e,name:"banner",notifier:this.notifier}))))):this.videoChannelService.deleteImage(this.videoChannelEdit.channel.name,"banner").pipe(Ce(()=>this.videoChannelEdit.resetBannerFromAPI()));}};D(ye,"\u0275fac",function(e){return new(e||ye)();}),D(ye,"\u0275cmp",R({type:ye,selectors:[["my-video-channel-manage"]],decls:1,vars:2,consts:[[3,"videoChannelEdit","saveFn"]],template:function(e,i){e&1&&s(0,"my-video-channel-edit",0),e&2&&d("videoChannelEdit",i.videoChannelEdit)("saveFn",i.saveFn);},dependencies:[ve],encapsulation:2}));var pn=ye;var b=t=>["/w",t],$e=t=>["/my-library/video-playlists/",t];function Fi(t,n){if(t&1&&(T(0),g(1,0),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function ui(t,n){if(t&1&&(T(0),g(1,1),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,$e,e.a.playlist.shortUUID)),C(e.account)(e.a.playlist.name),m(1);}}function Ei(t,n){if(t&1&&(T(0),g(1,2),s(2,"strong")(3,"a",29),S(),N()),t&2){let e=l(2);a(3),C(e.account)(e.a.channelSync.externalChannelUrl),m(1);}}function pi(t,n){if(t&1&&(T(0),g(1,3),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(4,b,e.a.videoImport.uuid)),C(e.account)(e.a.videoImport.name)(e.a.videoImport.targetUrl),m(1);}}function Ci(t,n){if(t&1&&E(0,Fi,4,5,"ng-container")(1,ui,4,5,"ng-container")(2,Ei,4,2,"ng-container")(3,pi,4,6,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:e===2?1:e===4?2:e===5?3:-1);}}function mi(t,n){if(t&1&&(T(0),g(1,4),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function gi(t,n){if(t&1&&(T(0),g(1,5),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,$e,e.a.playlist.shortUUID)),C(e.account)(e.a.playlist.name),m(1);}}function Si(t,n){if(t&1&&(T(0),g(1,6),s(2,"strong"),S(),N()),t&2){let e=l(2);a(2),C(e.account),m(1);}}function Ti(t,n){if(t&1&&E(0,mi,4,5,"ng-container")(1,gi,4,5,"ng-container")(2,Si,3,1,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:e===2?1:e===3?2:-1);}}function Ni(t,n){if(t&1&&(T(0),g(1,7),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function Di(t,n){if(t&1&&(T(0),g(1,8),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,$e,e.a.playlist.shortUUID)),C(e.account)(e.a.playlist.name),m(1);}}function hi(t,n){if(t&1&&(T(0),g(1,9),s(2,"strong"),S(),N()),t&2){let e=l(2);a(2),C(e.account)(e.a.channelSync.externalChannelUrl),m(1);}}function Ai(t,n){if(t&1&&E(0,Ni,4,5,"ng-container")(1,Di,4,5,"ng-container")(2,hi,3,2,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:e===2?1:e===4?2:-1);}}function Ii(t,n){if(t&1&&(T(0),g(1,10),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function fi(t,n){if(t&1&&E(0,Ii,4,5,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:-1);}}function Oi(t,n){if(t&1&&(T(0),g(1,11),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function Mi(t,n){if(t&1&&E(0,Oi,4,5,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:-1);}}function vi(t,n){if(t&1&&(T(0),g(1,12),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function Li(t,n){if(t&1&&E(0,vi,4,5,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:-1);}}function Ri(t,n){if(t&1&&(T(0),g(1,13),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function yi(t,n){if(t&1&&E(0,Ri,4,5,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:-1);}}function Pi(t,n){if(t&1&&(T(0),g(1,14),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function $i(t,n){if(t&1&&E(0,Pi,4,5,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:-1);}}function bi(t,n){if(t&1&&(T(0),g(1,15),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,$e,e.a.playlist.shortUUID)),C(e.account)(e.a.playlist.name),m(1);}}function Vi(t,n){if(t&1&&E(0,bi,4,5,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===2?0:-1);}}
1function Yi(t,n){if(t&1&&(T(0),g(1,16),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function Gi(t,n){if(t&1&&(T(0),g(1,17),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,$e,e.a.playlist.shortUUID)),C(e.account)(e.a.playlist.name),m(1);}}function xi(t,n){if(t&1&&E(0,Yi,4,5,"ng-container")(1,Gi,4,5,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:e===2?1:-1);}}function wi(t,n){if(t&1&&(T(0),g(1,18),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function Hi(t,n){if(t&1&&(T(0),g(1,19),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l(2);a(3),d("routerLink",h(3,$e,e.a.playlist.shortUUID)),C(e.account)(e.a.playlist.name),m(1);}}function ki(t,n){if(t&1&&E(0,wi,4,5,"ng-container")(1,Hi,4,5,"ng-container"),t&2){let e,i=l();p((e=i.a.targetType.id)===1?0:e===2?1:-1);}}function Bi(t,n){if(t&1&&(g(0,20,1),s(1,"strong")(2,"a",28),S()),t&2){let e=l(2);a(2),d("routerLink",h(4,b,e.a.video.shortUUID)),C(e.account)(e.a.targetAccount.displayName)(e.a.video.name),m(0);}}function Ui(t,n){if(t&1&&(g(0,20,2),s(1,"strong"),S()),t&2){let e=l(2);a(),C(e.account)(e.a.targetAccount.displayName),m(0);}}function Xi(t,n){if(t&1&&(T(0),g(1,20),E(2,Bi,3,6)(3,Ui,2,2),S(),N()),t&2){let e=l();a(2),p(e.a.video?2:e.a.channel?3:-1);}}function zi(t,n){if(t&1&&(g(0,21,1),s(1,"strong")(2,"a",28),S()),t&2){let e=l(2);a(2),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(0);}}function Ki(t,n){if(t&1&&(g(0,21,2),s(1,"strong"),S()),t&2){let e=l(2);a(),C(e.account),m(0);}}function qi(t,n){if(t&1&&(T(0),g(1,21),E(2,zi,3,5)(3,Ki,2,1),S(),N()),t&2){let e=l();a(2),p(e.a.video?2:e.a.channel?3:-1);}}function ji(t,n){if(t&1&&(g(0,22,1),s(1,"strong")(2,"a",28),S()),t&2){let e=l(2);a(2),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(0);}}function Wi(t,n){if(t&1&&(g(0,22,2),s(1,"strong"),S()),t&2){let e=l(2);a(),C(e.account),m(0);}}function Qi(t,n){if(t&1&&(T(0),g(1,22),E(2,ji,3,5)(3,Wi,2,1),S(),N()),t&2){let e=l();a(2),p(e.a.video?2:e.a.channel?3:-1);}}function Zi(t,n){if(t&1&&(T(0),g(1,23),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l();a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}function Ji(t,n){if(t&1&&(T(0),g(1,24),s(2,"strong")(3,"a",28),S(),N()),t&2){let e=l();a(3),d("routerLink",h(3,b,e.a.video.shortUUID)),C(e.account)(e.a.video.name),m(1);}}var Pe=class Pe{activity=le();a;account;ngOnInit(){this.a=this.activity(),this.account=this.a.account?this.a.account.displayName:"Deleted account";}};D(Pe,"\u0275fac",function(e){return new(e||Pe)();}),D(Pe,"\u0275cmp",R({type:Pe,selectors:[["my-video-channel-activity"]],inputs:{activity:[1,"activity"]},decls:21,vars:4,consts:()=>{let n;n=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" created video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let e;e=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" created playlist "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let i;i=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" created "+"\uFFFD#3\uFFFD"+"a channel synchronization"+"\uFFFD/#3\uFFFD"+": "+"\uFFFD1\uFFFD"+" ";let _;_=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" imported video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+": "+"\uFFFD2\uFFFD"+" ";let u;u=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" updated video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let M;M=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" updated playlist "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let O;O=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" updated the channel ";let w;w=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" deleted video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let y;y=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" deleted playlist "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let H;H=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" delete channel synchronization "+"\uFFFD1\uFFFD"+" ";let L;L=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" updated captions of video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let Z;Z=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" updated chapters of video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let J;J=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" updated passwords of video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let ee;ee=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" created studio tasks of video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let ne;ne=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" updated source file of video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let te;te=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" updated elements of playlist "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let ie;ie=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" removed video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+" by updating its channel ";let oe;oe=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" removed playlist "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+" by updating its channel ";let ae;ae=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" created video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+" by updating its channel ";let I;I=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" created playlist "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+" by updating its channel ";let ue;ue=""+"\uFFFD*2:1\uFFFD"+""+"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"+""+"[\uFFFD0:1\uFFFD|\uFFFD0:2\uFFFD]"+""+"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"+" sent an ownership change request to "+"[\uFFFD1:1\uFFFD|\uFFFD1:2\uFFFD]"+" for video "+"\uFFFD#2:1\uFFFD"+""+"\uFFFD2:1\uFFFD"+""+"\uFFFD/#2:1\uFFFD"+""+"\uFFFD/*2:1\uFFFD"+""+"\uFFFD*3:2\uFFFD"+""+"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"+""+"[\uFFFD0:1\uFFFD|\uFFFD0:2\uFFFD]"+""+"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"+" sent an ownership change request to "+"[\uFFFD1:1\uFFFD|\uFFFD1:2\uFFFD]"+" for this channel "+"\uFFFD/*3:2\uFFFD"+"",ue=X(ue);let Ee;Ee=""+"\uFFFD*2:1\uFFFD"+""+"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"+""+"[\uFFFD0:1\uFFFD|\uFFFD0:2\uFFFD]"+""+"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"+" accepted an ownership change request for video "+"\uFFFD#2:1\uFFFD"+""+"\uFFFD1:1\uFFFD"+""+"\uFFFD/#2:1\uFFFD"+""+"\uFFFD/*2:1\uFFFD"+""+"\uFFFD*3:2\uFFFD"+""+"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"+""+"[\uFFFD0:1\uFFFD|\uFFFD0:2\uFFFD]"+""+"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"+" accepted an ownership change request for this channel "+"\uFFFD/*3:2\uFFFD"+"",Ee=X(Ee);let A;A=""+"\uFFFD*2:1\uFFFD"+""+"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"+""+"[\uFFFD0:1\uFFFD|\uFFFD0:2\uFFFD]"+""+"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"+" refused an ownership change request for video "+"\uFFFD#2:1\uFFFD"+""+"\uFFFD1:1\uFFFD"+""+"\uFFFD/#2:1\uFFFD"+""+"\uFFFD/*2:1\uFFFD"+""+"\uFFFD*3:2\uFFFD"+""+"[\uFFFD#1:1\uFFFD|\uFFFD#1:2\uFFFD]"+""+"[\uFFFD0:1\uFFFD|\uFFFD0:2\uFFFD]"+""+"[\uFFFD/#1:1\uFFFD|\uFFFD/#1:2\uFFFD]"+" refused an ownership change request for this channel "+"\uFFFD/*3:2\uFFFD"+"",A=X(A);let yn;yn=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" updated embed policy of video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"";let Pn;return Pn=""+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+" deleted an ownership request for video "+"\uFFFD#3\uFFFD"+""+"\uFFFD1\uFFFD"+""+"\uFFFD/#3\uFFFD"+"",[n,e,i,_,u,M,O,w,y,H,L,Z,J,ee,ne,te,ie,oe,ae,I,ue,Ee,A,yn,Pn,[1,"root"],[1,"message"],[1,"date"],[3,"routerLink"],["routerLink","/my-library/video-channel-syncs"]];},template:function(e,i){if(e&1&&(r(0,"div",25)(1,"div",26),E(2,Ci,4,1)(3,Ti,3,1)(4,Ai,3,1)(5,fi,1,1)(6,Mi,1,1)(7,Li,1,1)(8,yi,1,1)(9,$i,1,1)(10,Vi,1,1)(11,xi,2,1)(12,ki,2,1)(13,Xi,4,1,"ng-container")(14,qi,4,1,"ng-container")(15,Qi,4,1,"ng-container")(16,Zi,4,5,"ng-container")(17,Ji,4,5,"ng-container"),o(),r(18,"div",27),P(19),Qe(20,"myFromNow"),o()()),e&2){let _;a(2),p((_=i.a.action.id)===1?2:_===2?3:_===3?4:_===4?5:_===5?6:_===6?7:_===7?8:_===8?9:_===9?10:_
1===10?11:_===11?12:_===12?13:_===13?14:_===14?15:_===15?16:_===16?17:-1),a(17),me(" ",Ze(20,2,i.a.createdAt)," ");}},dependencies:[nn,he,Tt],styles:[".root[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem}.message[_ngcontent-%COMP%]{color:var(--fg-300);word-break:break-word}.date[_ngcontent-%COMP%]{color:var(--fg-200);font-size:.875rem}"]}));var Cn=Pe;var eo=t=>({even:t}),no=(t,n)=>n.id;function to(t,n){t&1&&(r(0,"div",4),F(1,1),o());}function io(t,n){if(t&1&&(s(0,"my-date-group-label",6),r(1,"div",7),s(2,"my-video-channel-activity",8),o()),t&2){let e=n.$implicit,i=n.$index,_=l();d("date",e.createdAt)("store",_.groupByDateStore),a(),d("ngClass",h(4,eo,i%2===0)),a(),d("activity",e);}}var be=class be{notifier=c(G);channelService=c(x);editController=c($);pagination={currentPage:1,itemsPerPage:20,totalItems:null};videoChannelEdit;activities=[];onDataSubject=new Se();groupByDateStore=new Set();storeSub;ngOnInit(){this.videoChannelEdit=this.editController.getStore(),this.reload(),this.storeSub=this.editController.getStoreChangesObs().subscribe(()=>{this.videoChannelEdit=this.editController.getStore(),this.reload();});}ngOnDestroy(){this.storeSub?.unsubscribe();}reload(){this.activities=[],ln(this.pagination),this.loadMoreActivities();}onNearOfBottom(){_n(this.pagination)&&(this.pagination.currentPage+=1,this.loadMoreActivities());}loadMoreActivities(){this.channelService.listActivities({channelName:this.videoChannelEdit.channel.name,componentPagination:this.pagination}).subscribe({next:n=>{this.activities=this.activities.concat(n.data),this.pagination.totalItems=n.total,this.onDataSubject.next(n.data);},error:n=>this.notifier.handleError(n)});}};D(be,"\u0275fac",function(e){return new(e||be)();}),D(be,"\u0275cmp",R({type:be,selectors:[["my-video-channel-activities"]],decls:9,vars:2,consts:()=>{let n;n="Activity";let e;return e=" No activity in the channel yet ",[n,e,[1,"form-title"],["iconName","calendar"],[1,"no-results"],["myInfiniteScroller","",1,"activities",3,"nearOfBottom","dataObservable"],[3,"date","store"],[1,"activity-container",3,"ngClass"],[3,"activity"]];},template:function(e,i){e&1&&(r(0,"div")(1,"h2",2),s(2,"my-global-icon",3),T(3),F(4,0),N(),o(),E(5,to,2,0,"div",4),r(6,"div",5),v("nearOfBottom",function(){return i.onNearOfBottom();}),W(7,io,3,6,null,null,no),o()()),e&2&&(a(5),p(i.pagination.totalItems===0?5:-1),a(),d("dataObservable",i.onDataSubject.asObservable()),a(),Q(i.activities));},dependencies:[De,Je,K,de,q,dn,Cn,mt],styles:[".activity-container[_ngcontent-%COMP%]{margin-bottom:.75rem;border-radius:24px;padding:1rem 1.5rem;background-color:var(--bg-secondary-350)}.activity-container.even[_ngcontent-%COMP%]{background-color:var(--bg-secondary-400)}my-date-group-label[_ngcontent-%COMP%]:not(.date-displayed){display:none}my-date-group-label.date-displayed[_ngcontent-%COMP%]{color:var(--fg-300);font-weight:700;display:block;padding-bottom:calc(1.275rem + .3vw)}@media(min-width:1200px){my-date-group-label.date-displayed[_ngcontent-%COMP%]{padding-bottom:1.5rem}}my-date-group-label.date-displayed[_ngcontent-%COMP%]{font-size:1.125rem}my-date-group-label.date-displayed[_ngcontent-%COMP%]:not(:first-child){border-top:1px solid var(--bg-secondary-500);padding-top:calc(1.275rem + .3vw)}@media(min-width:1200px){my-date-group-label.date-displayed[_ngcontent-%COMP%]:not(:first-child){padding-top:1.5rem}}my-date-group-label.date-displayed[_ngcontent-%COMP%]:not(:first-child){margin-top:calc(1.275rem + .3vw)}@media(min-width:1200px){my-date-group-label.date-displayed[_ngcontent-%COMP%]:not(:first-child){margin-top:1.5rem}}"]}));var mn=be;var oo=["bannerfileInput"],ao=["bannerPopover"];function ro(t,n){if(t&1&&s(0,"img",8),t&2){let e=l();d("src",e.getBannerUrl(),xn);}}function _o(t,n){t&1&&fn(0);}function lo(t,n){if(t&1&&(r(0,"div",9),_e(1,_o,1,0,"ng-container",11),o()),t&2){let e=l(),i=On(7);d("ngbTooltip",e.bannerFormat),a(),d("ngTemplateOutlet",i);}}function so(t,n){t&1&&fn(0);}function co(t,n){if(t&1){let e=U();r(0,"div",10)(1,"button",12),s(2,"my-global-icon",13),r(3,"span"),F(4,2),o()(),r(5,"div",14)(6,"div",15),_e(7,so,1,0,"ng-container",11),o(),r(8,"button",16),v("click",function(){V(e);let _=l();return Y(_.deleteBanner());}),s(9,"my-global-icon",17),r(10,"span"),F(11,3),o()()()();}if(t&2){let e=l(),i=On(7);a(6),d("ngbTooltip",e.bannerFormat),a(),d("ngTemplateOutlet",i);}}function Fo(t,n){if(t&1){let e=U();s(0,"my-global-icon",18),r(1,"label",19),F(2,4),o(),r(3,"input",20,1),v("change",function(){V(e);let _=l();return Y(_.onBannerChange());}),o();}if(t&2){let e=l();a(3),d("accept",e.bannerExtensions);}}var Ve=class Ve{serverService=c(Et);notifier=c(G);bannerfileInput=ze("bannerfileInput");bannerPopover=ze("bannerPopover");bannerUrl=le();previewImage=le(!1,{transform:Kn});bannerChange=Xe();bannerDelete=Xe();bannerFormat="";maxBannerSize=0;bannerExtensions="";preview;ngOnInit(){let n=this.serverService.getHTMLConfig();this.maxBannerSize=n.banner.file.size.max,this.bannerExtensions=n.banner.file.extensions.join(", "),this.bannerFormat="ratio 6/1, recommended size: 1920x317, max size: "+ct(this.maxBannerSize)+", extensions: "+this.bannerExtensions+"";}ngOnChanges(){this.preview=void 0;}onBannerChange(){let n=this.bannerfileInput().nativeElement.files[0];if(n.size>this.maxBannerSize){this.notifier.error("Error","This image is too large.");return;}let e=new FormData();e.append("bannerfile",n),this.bannerPopover()?.close(),this.bannerChange.emit(e),this.previewImage()&&Ft(n).then(i=>this.preview=i);}deleteBanner(){this.previewImage()&&(this.preview=null),this.bannerDelete.emit();}hasBanner(){return this.preview===null?!1:!!this.preview||!!this.bannerUrl();}getBannerUrl(){return this.preview===null?"":this.preview||this.bannerUrl();}};D(Ve,"\u0275fac",function(e){return new(e||Ve)();}),D(Ve,"\u0275cmp",R({type:Ve,selectors:[["my-actor-banner-edit"]],viewQuery:function(e,i){e&1&&Ke(i.bannerfileInput,oo,5)(i.bannerPopover,ao,5),e&2&&Ne(2);},inputs:{bannerUrl:[1,"bannerUrl"],previewImage:[1,"previewImage"]},outputs:{bannerChange:"bannerChange",bannerDelete:"bannerDelete"},features:[Yn],decls:8,vars:2,consts:()=>{let n;n="Change your banner";let e;e="Remove banner";let i;return i="Upload a new banner",[["uploadNewBanner",""],["bannerfileInput",""],n,e,i,[1,"actor"],[1,"actor-img-edit-container"],[1,"banner-placeholder"],["alt","Banner",3,"src"],["placement","right","container","body",1,"actor-img-edit-button","button-file","primary-button","button-focus-within",3,"ngbTooltip"],["ngbDropdown","","placement","right"],[4,"ngTemplateOutlet"],["type","button","ngbDropdownToggle","",1,"actor-img-edit-button","button-file","primary-button"],["
1iconName","edit"],["ngbDropdownMenu",""],[1,"dropdown-item","dropdown-file","button-focus-within",3,"ngbTooltip"],["type","button",1,"dropdown-item",3,"click"],["iconName","delete"],["iconName","upload"],["for","bannerfile"],["type","file","name","bannerfile","id","bannerfile",3,"change","accept"]];},template:function(e,i){e&1&&(r(0,"div",5)(1,"div",6)(2,"div",7),E(3,ro,1,1,"img",8),o(),E(4,lo,2,2,"div",9)(5,co,12,2,"div",10),o()(),_e(6,Fo,5,1,"ng-template",null,0,Ue)),e&2&&(a(3),p(i.hasBanner()?3:-1),a(),p(i.hasBanner()?5:4));},dependencies:[De,qn,dt,st,lt,_t,rt,at,q],styles:[".dropdown-file[_ngcontent-%COMP%]{position:relative;overflow:hidden;display:inline-block}.dropdown-file[_ngcontent-%COMP%] input[type=file][_ngcontent-%COMP%]{position:absolute;top:0;right:0;width:100%;height:100%;font-size:100px;text-align:end;filter:alpha(opacity=0);opacity:0;outline:none;background:var(--bg);cursor:inherit;display:block}.actor-img-edit-button[_ngcontent-%COMP%]{width:31px;cursor:pointer;display:flex;justify-content:center;align-items:center}.actor-img-edit-button[_ngcontent-%COMP%] my-global-icon[_ngcontent-%COMP%]{position:relative;top:-1px;right:0;display:inline-block;width:19px;height:19px;line-height:19px}.actor-img-edit-button[_ngcontent-%COMP%]:not(.icon-only) my-global-icon[_ngcontent-%COMP%]{margin-inline-end:0}label[_ngcontent-%COMP%]{font-weight:400;font-size:inherit;color:inherit;margin:0}",".banner-placeholder[_ngcontent-%COMP%]{position:relative;height:0;width:100%;padding-top:16.6666666667%}.banner-placeholder[_ngcontent-%COMP%] > div[_ngcontent-%COMP%], .banner-placeholder[_ngcontent-%COMP%] > img[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;top:0}.banner-placeholder[_ngcontent-%COMP%]{background-color:var(--bg-secondary-500)}.actor-img-edit-container[_ngcontent-%COMP%]{position:relative;display:flex;justify-content:center;align-items:center}.dropdown[_ngcontent-%COMP%]{position:absolute}.dropdown[_ngcontent-%COMP%] > .actor-img-edit-button[_ngcontent-%COMP%]{position:relative}.actor-img-edit-button[_ngcontent-%COMP%]{width:auto;position:absolute}.actor-img-edit-button[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{font-weight:600;margin-bottom:0}.button-focus-within[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 .2rem var(--fg-100)}.dropdown-item[_ngcontent-%COMP%]{padding:var(--input-y-padding) 1rem}.dropdown-item[_ngcontent-%COMP%] my-global-icon[_ngcontent-%COMP%]{width:22px;opacity:.7;position:relative;top:-2px;margin-inline-end:.5rem}.dropdown-item[_ngcontent-%COMP%] my-actor-avatar[_ngcontent-%COMP%]{margin-inline-end:.5rem}.dropdown-toggle[_ngcontent-%COMP%]:after{display:none}"]}));var gn=Ve;var uo=["sendChangeOwnershipModal"],Ut=t=>({"input-error":t});function Eo(t,n){if(t&1&&(r(0,"div",34),P(1),o()),t&2){let e=l();a(),z(e.formErrors.name);}}function po(t,n){if(t&1&&(r(0,"div",34),P(1),o()),t&2){let e=l();a(),me(" ",e.formErrors.displayName," ");}}function Co(t,n){t&1&&(r(0,"div",35),s(1,"my-peertube-checkbox",49),o());}function mo(t,n){if(t&1){let e=U();r(0,"my-alert",52)(1,"div",56)(2,"div"),g(3,20),s(4,"strong"),S(),o(),r(5,"my-button",57),v("click",function(){V(e);let _=l(2);return Y(_.cancelOwnershipRequest());}),P(6,"Cancel request"),o()()();}if(t&2){let e=l(2);a(4),C(e.pendingOwnershipRequest.nextOwnerAccount.name),m(3);}}function go(t,n){if(t&1){let e=U();r(0,"div",48)(1,"div",25)(2,"h3"),F(3,12),o()(),r(4,"div",26)(5,"div",35)(6,"label",50),F(7,13),o(),r(8,"div",43)(9,"div"),F(10,14),o(),r(11,"div"),F(12,15),o()(),r(13,"button",51),v("click",function(){V(e);let _=l();return Y(_.showChangeOwnershipModal());}),F(14,16),o(),E(15,mo,7,1,"my-alert",52),o(),r(16,"my-send-change-ownership",53,0),v("requestSent",function(_){V(e);let u=l();return Y(u.onChangeOwnershipRequest(_));}),o(),r(18,"div",35)(19,"label",54),F(20,17),o(),r(21,"div",43),F(22,18),o(),r(23,"button",55),v("click",function(){V(e);let _=l();return Y(_.deleteChannel());}),F(24,19),o()()()();}if(t&2){let e=l();a(13),d("disabled",!!e.pendingOwnershipRequest),a(2),p(e.pendingOwnershipRequest?15:-1),a(),d("channelName",e.videoChannelEdit.channel.name);}}var Ye=class Ye{formReactiveService=c(an);editController=c($);authService=c(k);confirmService=c(Ie);notifier=c(G);changeOwnershipService=c(St);channelService=c(x);router=c(se);sendChangeOwnershipModal=ze("sendChangeOwnershipModal");form;formErrors={};validationMessages={};mode;videoChannelEdit;pendingOwnershipRequest;formSub;storeSub;get instanceHost(){return window.location.host;}ngOnInit(){this.mode=this.editController.getMode(),this.videoChannelEdit=this.editController.getStore(),this.loadOwnershipRequestIfNeeded(),this.buildForm(),this.storeSub=this.editController.getStoreChangesObs().subscribe(()=>{this.videoChannelEdit=this.editController.getStore(),this.loadOwnershipRequestIfNeeded(),this.buildForm();}),this.editController.registerSaveHook(()=>{this.formReactiveService.forceCheck(this.form,this.formErrors,this.validationMessages),this.editController.setFormError("General","general",this.formErrors);});}
1ngOnDestroy(){this.storeSub?.unsubscribe(),this.editController.unregisterSaveHook();}buildForm(){this.formSub?.unsubscribe();let n={name:this.mode==="create"?bt:null,displayName:Vt,description:Yt,support:Gt,bulkVideosSupportUpdate:null,playerTheme:null},e={name:this.videoChannelEdit.channel.name,displayName:this.videoChannelEdit.channel.displayName,description:this.videoChannelEdit.channel.description,support:this.videoChannelEdit.channel.support,playerTheme:this.videoChannelEdit.playerSettings.theme},{form:i,formErrors:_,validationMessages:u}=this.formReactiveService.buildForm(n,e);this.form=i,this.formErrors=_,this.validationMessages=u,this.subscribeToFormChanges();}getFormButtonTitle(){return this.mode==="update"?"Manage "+this.videoChannelEdit.channel.displayName+"":"Create your channel";}onAvatarChange(n){this.videoChannelEdit.updateAvatarFromGeneralForm(n);}onAvatarDelete(){this.videoChannelEdit.updateAvatarFromGeneralForm(null);}onBannerChange(n){this.videoChannelEdit.updateBannerFromGeneralForm(n);}onBannerDelete(){this.videoChannelEdit.updateBannerFromGeneralForm(null);}isBulkUpdateVideosDisplayed(){return this.mode==="create"||this.videoChannelEdit.apiInfo.support===void 0?!1:this.videoChannelEdit.apiInfo.support!==this.form.value.support;}subscribeToFormChanges(){this.formSub=this.form.valueChanges.subscribe(n=>{this.editController.setFormError("General","general",{}),this.videoChannelEdit.loadFromGeneralForm({playerSettings:{theme:n.playerTheme},channel:{name:n.name,displayName:n.displayName,description:n.description||null,support:n.support||null,bulkVideosSupportUpdate:this.mode==="update"?n.bulkVideosSupportUpdate||!1:void 0}});});}canBeDeletedOrTransferred(){return this.mode==="create"?!1:this.videoChannelEdit.apiInfo.ownerAccount.id===this.authService.getUser().account.id;}showChangeOwnershipModal(){this.sendChangeOwnershipModal().show();}onChangeOwnershipRequest(n){this.pendingOwnershipRequest=n;}cancelOwnershipRequest(){return pe(this,null,function*(){let n="Are you sure you want to cancel the ownership change request to \""+this.pendingOwnershipRequest.nextOwnerAccount.name+"\"?";(yield this.confirmService.confirm(n,"Cancel request"))!==!1&&this.changeOwnershipService.cancelChannel(this.pendingOwnershipRequest.id).subscribe({next:()=>{this.notifier.success("Ownership change request cancelled"),this.pendingOwnershipRequest=null;},error:i=>this.notifier.handleError(i)});});}loadOwnershipRequestIfNeeded(){this.mode==="update"&&this.changeOwnershipService.listFromChannel(this.videoChannelEdit.channel.name,tt.PENDING).subscribe(({data:n})=>{n.length===0?this.pendingOwnershipRequest=void 0:this.pendingOwnershipRequest=n[0];});}deleteChannel(){let n=re({name:this.videoChannelEdit.channel.name,nameWithHost:this.videoChannelEdit.channel.name,displayName:this.videoChannelEdit.channel.displayName},this.videoChannelEdit.apiInfo);this.channelService.removeWithConfirmation(n).subscribe({next:({removed:e})=>{e&&(this.router.navigateByUrl("/my-library/video-channels"),this.notifier.success("Video channel "+n.displayName+" deleted."));},error:e=>this.notifier.handleError(e)});}};D(Ye,"\u0275fac",function(e){return new(e||Ye)();}),D(Ye,"\u0275cmp",R({type:Ye,selectors:[["my-video-channel-edit-general"]],viewQuery:function(e,i){e&1&&Ke(i.sendChangeOwnershipModal,uo,5),e&2&&Ne();},decls:57,vars:19,consts:()=>{let n;n="Example: my_channel";let e;e="General";let i;i="IMAGES";let _;_="INFORMATION";let u;u="Name";let M;M="Display name";let O;O="Description";let w;w="Support";let y;y=" This is text that helps people visiting your channel page "+"[\uFFFD#40\uFFFD|\uFFFD#42\uFFFD]"+"understand how to support you"+"[\uFFFD/#40\uFFFD|\uFFFD/#42\uFFFD]"+". You can use "+"\uFFFD#41\uFFFD"+"Markdown Language"+"\uFFFD/#41\uFFFD"+", including "+"[\uFFFD#40\uFFFD|\uFFFD#42\uFFFD]"+"links to your fundraising tools"+"[\uFFFD/#40\uFFFD|\uFFFD/#42\uFFFD]"+". ",y=X(y);let H;H="VIDEOS";let L;L="Player Theme";let Z;Z="Only used by the web player";let J;J="Overwrite support field of all videos of this channel";let ee;ee="DANGER ZONE";let ne;ne="Change ownership of your channel";let te;te="A modal window will open for you to specify the local account to which you want to transfer your channel";let ie;ie="The collaborators of this channel will remain after the transfer";let oe;oe="Transfer ownership";let ae;ae="Delete your channel";let I;I="Warning: this is a definitive action!";let ue;ue="Delete";let Ee;return Ee="Ownership change request sent to "+"\uFFFD#4\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#4\uFFFD"+", awaiting its approval.",[["sendChangeOwnershipModal",""],e,i,_,u,M,O,w,y,H,L,Z,ee,ne,te,ie,oe,ae,I,ue,Ee,[1,"form-title"],["iconName","cog"],["id","channel-manage-form",3,"formGroup"],[1,"pt-two-cols"],[1,"title-col"],[1,"content-col"],["previewImage","true",1,"d-block","mb-4",3,"bannerChange","bannerDelete","bannerUrl"],["actorType","channel","previewImage","true",1,"d-block","mb-4",3,"avatarChange","avatarDelete","avatars","username","subscribers"],[1,"form-group",3,"hidden"],["for","name"],[1,"input-group"],["type","text","id","name","placeholder",n,"formControlName","name",1,"form-control","w-auto","flex-grow-1","d-block",3,"ngClass"],[1,"input-group-text"],["role","alert",1,"form-error"],[1,"form-group"],["for","displayName"],["type","text","id","displayName","formControlName","displayName",1,"form-control",3,"ngClass"],[1,"form-group","markdown-block"],["for","description"],["helpType","markdownText","supportRelMe","true"],["inputId","de
1scription","formControlName","description","markdownType","enhanced","withEmoji","true","withHtml","true",3,"formError"],["for","support"],[1,"form-group-description"],["helpType","markdownText"],["inputId","support","formControlName","support","markdownType","enhanced","withEmoji","true","withHtml","true",3,"formError"],["for","playerTheme"],["formControlName","playerTheme","inputId","playerTheme","mode","channel"],[1,"pt-two-cols","danger-zone","mt-5"],["inputName","bulkVideosSupportUpdate","formControlName","bulkVideosSupportUpdate","labelText",J],["for","deleteVideo"],["type","button",1,"peertube-button","danger-button",3,"click","disabled"],["type","success",1,"d-block","mt-3","d-flex"],[3,"requestSent","channelName"],["for","delete-channel-button"],["type","button","id","delete-channel-button",1,"peertube-button","danger-button",3,"click"],[1,"d-flex","align-items-center","gap-2","flex-wrap"],["theme","secondary",3,"click"]];},template:function(e,i){e&1&&(r(0,"h2",21),s(1,"my-global-icon",22),T(2),F(3,1),N(),o(),r(4,"form",23)(5,"div",24)(6,"div",25)(7,"h3"),F(8,2),o()(),r(9,"div",26)(10,"my-actor-banner-edit",27),v("bannerChange",function(u){return i.onBannerChange(u);})("bannerDelete",function(){return i.onBannerDelete();}),o(),r(11,"my-actor-avatar-edit",28),v("avatarChange",function(u){return i.onAvatarChange(u);})("avatarDelete",function(){return i.onAvatarDelete();}),o()()(),r(12,"div",24)(13,"div",25)(14,"h3"),F(15,3),o()(),r(16,"div",26)(17,"div",29)(18,"label",30),F(19,4),o(),r(20,"div",31),s(21,"input",32),r(22,"div",33),P(23),o()(),E(24,Eo,2,1,"div",34),o(),r(25,"div",35)(26,"label",36),F(27,5),o(),s(28,"input",37),E(29,po,2,1,"div",34),o(),r(30,"div",38)(31,"label",39),F(32,6),o(),s(33,"my-help",40)(34,"my-markdown-textarea",41),o(),r(35,"div",38)(36,"label",42),F(37,7),o(),r(38,"div",43),g(39,8),s(40,"strong")(41,"my-markdown-hint",44)(42,"strong"),S(),o(),s(43,"my-markdown-textarea",45),o(),E(44,Co,2,0,"div",35),o()(),r(45,"div",24)(46,"div",25)(47,"h3"),F(48,9),o()(),r(49,"div",26)(50,"div",35)(51,"label",46),F(52,10),o(),r(53,"div",43),F(54,11),o(),s(55,"my-select-player-theme",47),o()()(),E(56,go,25,3,"div",48),o()),e&2&&(a(4),d("formGroup",i.form),a(6),d("bannerUrl",i.videoChannelEdit.apiInfo.bannerUrl),a(),d("avatars",i.videoChannelEdit.apiInfo.avatars)("username",i.mode==="update"&&i.videoChannelEdit.channel.name)("subscribers",i.mode==="update"&&i.videoChannelEdit.apiInfo.followersCount),a(6),d("hidden",i.mode!=="create"),a(4),d("ngClass",h(15,Ut,i.formErrors.name)),a(2),me("@",i.instanceHost),a(),p(i.formErrors.name?24:-1),a(4),d("ngClass",h(17,Ut,i.formErrors.displayName)),a(),p(i.formErrors.displayName?29:-1),a(5),d("formError",i.formErrors.description),a(9),d("formError",i.formErrors.support),a(),p(i.isBulkUpdateVideosDisplayed()?44:-1),a(12),p(i.canBeDeletedOrTransferred()?56:-1));},dependencies:[De,Je,K,Zn,Wn,Ae,Qn,de,et,Jn,gn,$t,Dt,ft,ht,Ht,vt,q,Fn,fe,wt],styles:["my-actor-banner-edit[_ngcontent-%COMP%]{max-width:500px}input[type=text][_ngcontent-%COMP%]{font-size:16px;padding:var(--input-y-padding) var(--input-x-padding);width:340px;max-width:340px;color:var(--input-fg);background-color:var(--input-bg);border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-border-radius);line-height:24px}input[type=text][_ngcontent-%COMP%]::placeholder{color:var(--input-placeholder-color);font-size:var(--input-placeholder-font-size)}input[type=text][readonly][_ngcontent-%COMP%]{color:var(--fg-300)}input[type=text][_ngcontent-%COMP%]:focus, input[type=text][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem var(--fg-100);outline:0}input[type=text][disabled][_ngcontent-%COMP%]{color:var(--fg-300);opacity:.8}@media screen and (max-width:380px){input[type=text][_ngcontent-%COMP%]{width:100%}}input[type=submit][_ngcontent-%COMP%]{margin-inline-start:auto}.markdown-block[_ngcontent-%COMP%]{max-width:500px}my-select-player-theme[_ngcontent-%COMP%]{display:block;width:340px}@media screen and (max-width:370px){my-select-player-theme[_ngcontent-%COMP%]{width:100%}}.danger-zone[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{color:var(--red);font-weight:700;font-size:1rem}"]}));var Sn=Ye;var So=(t,n)=>n.id;function To(t,n){t&1&&(r(0,"span",28),F(1,13),o());}function No(t,n){if(t&1&&s(0,"my-action-dropdown",37),t&2){let e=l().$implicit,i=l();d("actions",i.collaboratorActions)("entry",e);}}function Do(t,n){if(t&1&&(r(0,"div",24),s(1,"my-actor-avatar",25),r(2,"div")(3,"div",34),F(4,14),o(),r(5,"div",35),s(6,"my-collaborator-state",36),E(7,No,1,2,"my-action-dropdown",37),o()()()),t&2){let e=n.$implicit,i=l();a(),d("actor",e.account),a(3),C(e.account.displayName),m(4),a(2),d("type",i.getCollaboratorState(e)),a(),p(i.isOwner()||i.isCollaborator(e)?7:-1);}}function ho(t,n){t&1&&(r(0,"div"),F(1,15),o());}function Ao(t,n){if(t&1){let e=U();r(0,"div",33)(1,"h4"),F(2,16),o(),r(3,"label",38),F(4,17),o(),r(5,"div",39)(6,"my-user-auto-complete",40),We("ngModelChange",function(_){V(e);let u=l();return je(u.newEditorUsername,_)||(u.newEditorUsername=_),Y(_);}),o(),r(7,"my-button",41),v("click",function(){V(e);let _=l();return Y(_.addEditor());}),F(8,18),o()()();}if(t&2){let e=l();a(6),qe("ngModel",e.newEditorUsername),a(),d("disabled",!e.newEditorUsername);}}var Ge=class Ge{confirmService=c(Ie);notifier=c(G);channelService=c(x);editController=c($);authService=c(k);router=c(se);videoChannelEdit;newEditorUsername;collaboratorActions=[];storeSub;ngOnInit(){this.videoChannelEdit=this.editController.getStore(),this.storeSub=this.editController.getStoreChangesObs().subscribe(()=>{this.videoChannelEdit=this.editController.getStore();}),this.buildActions();}
1ngOnDestroy(){this.storeSub?.unsubscribe();}buildActions(){this.collaboratorActions=[{label:"Delete",iconName:"delete",handler:n=>pe(this,null,function*(){let e=n.state.id===on.PENDING?"Are you sure you want to remove invitation of <strong>"+n.account.displayName+"</strong> to collaborate on your channel?":"Are you sure you want to remove <strong>"+n.account.displayName+"</strong> as a collaborator?";(yield this.confirmService.confirm(e,"Remove collaborator"))&&this.channelService.removeCollaborator(this.videoChannelEdit.channel.name,n.id).subscribe({next:()=>{this.videoChannelEdit.collaborators=this.videoChannelEdit.collaborators.filter(_=>_.id!==n.id),this.isCollaborator(n)&&(this.notifier.success("You have been removed as a collaborator from "+this.videoChannelEdit.channel.name+" channel"),this.router.navigate(["/my-library","video-channels"]));},error:_=>this.notifier.handleError(_)});})}];}getOwnerAccount(){return this.videoChannelEdit.apiInfo.ownerAccount;}getOwnerDisplayName(){return this.getOwnerAccount().displayName;}isOwner(){return this.getOwnerAccount().id===this.authService.getUser().account.id;}isCollaborator(n){return n.account.id===this.authService.getUser().account.id;}getCollaboratorState(n){if(n.state.id===on.ACCEPTED)return"accepted";if(n.state.id===on.PENDING)return"invited";rn.error("Cannot find collaborator state for "+n.state.id);}addEditor(){return pe(this,null,function*(){let n="Do you want to send an invitation to <strong>"+this.newEditorUsername+"</strong> to collaborate on <strong>"+this.videoChannelEdit.channel.name+"</strong>?";(yield this.confirmService.confirm(n,"Invite new editor"))&&this.channelService.inviteCollaborator(this.videoChannelEdit.channel.name,this.newEditorUsername).subscribe({next:i=>{this.videoChannelEdit.collaborators.push(i),this.newEditorUsername="";},error:i=>this.notifier.handleError(i)});});}};D(Ge,"\u0275fac",function(e){return new(e||Ge)();}),D(Ge,"\u0275cmp",R({type:Ge,selectors:[["my-video-channel-editors"]],decls:53,vars:5,consts:()=>{let n;n="Editors";let e;e="OWNER";let i;i="Current owner";let _;_="EDITORS";let u;u="Editors "+"\uFFFD#28\uFFFD"+"can:"+"\uFFFD/#28\uFFFD"+"";let M;M="Publish videos in this channel";let O;O="Manage, update, transfer or delete videos, comments, playlists of this channel";let w;w="Add or delete channel synchronization";let y;y="Update information of this channel (title, description, banner...)";let H;H="But editors "+"\uFFFD#40\uFFFD"+"cannot:"+"\uFFFD/#40\uFFFD"+"";let L;L="Delete the channel";let Z;Z="Add or remove other editors";let J;J="Current editors";let ee;ee="(you)";let ne;ne=""+"\uFFFD0\uFFFD"+"";let te;te="No editors at the moment";let ie;ie="New editor";let oe;oe="Editor handle";let ae;return ae="Invite",[n,e,i,_,u,M,O,w,y,H,L,Z,J,ee,ne,te,ie,oe,ae,[1,"form-title"],["iconName","users"],[1,"pt-two-cols"],[1,"title-col"],[1,"content-col"],[1,"collaborator-block"],["actorType","account","size","60",3,"actor"],[1,"collaborator-display-name"],[1,"fw-bold"],[1,"d-inline-block","ms-1"],["type","owner"],[1,"pt-two-cols","mt-4"],[1,"editor-explanation"],[1,"collaborators"],[1,"mt-4"],[1,"collaborator-display-name","fw-bold"],[1,"d-flex","gap-1"],[3,"type"],["container","body","buttonStyled","false","buttonIcon","chevron-down","buttonSize","small",3,"actions","entry"],["for","addEditor"],[1,"d-flex","flex-wrap","gap-3"],["inputName","addEditor",3,"ngModelChange","ngModel"],["theme","secondary",3,"click","disabled"]];},template:function(e,i){e&1&&(r(0,"div")(1,"h2",19),s(2,"my-global-icon",20),T(3),F(4,0),N(),o(),r(5,"div",21)(6,"div",22)(7,"h3"),F(8,1),o()(),r(9,"div",23)(10,"h4"),F(11,2),o(),r(12,"div",24),s(13,"my-actor-avatar",25),r(14,"div")(15,"div",26)(16,"span",27),P(17),o(),E(18,To,2,0,"span",28),o(),s(19,"my-collaborator-state",29),o()()()(),r(20,"div",30)(21,"div",22)(22,"h3"),F(23,3),o()(),r(24,"div",23)(25,"div",31)(26,"p"),g(27,4),s(28,"strong"),S(),o(),r(29,"ul")(30,"li"),F(31,5),o(),r(32,"li"),F(33,6),o(),r(34,"li"),F(35,7),o(),r(36,"li"),F(37,8),o()(),r(38,"p"),g(39,9),s(40,"strong"),S(),o(),r(41,"ul")(42,"li"),F(43,10),o(),r(44,"li"),F(45,11),o()()(),r(46,"h4"),F(47,12),o(),r(48,"div",32),W(49,Do,8,4,"div",24,So,!1,ho,2,0,"div"),o(),E(52,Ao,9,2,"div",33),o()()()),e&2&&(a(13),d("actor",i.getOwnerAccount()),a(4),z(i.getOwnerDisplayName()),a(),p(i.isOwner()?18:-1),a(31),Q(i.videoChannelEdit.collaborators),a(3),p(i.isOwner()?52:-1));},dependencies:[K,Ae,tn,de,cn,fe,un,xt,q,Oe],styles:["h4[_ngcontent-%COMP%]{margin-bottom:1rem;font-weight:700;color:var(--fg-300);font-size:1.25rem}.collaborators[_ngcontent-%COMP%]{display:flex;gap:1rem;flex-wrap:wrap}.collaborator-block[_ngcontent-%COMP%]{display:inline-block;padding:.5rem 1rem;background:var(--bg-secondary-400);gap:10px;display:flex;align-items:center;width:fit-content;border-radius:16px}
1.collaborator-block[_ngcontent-%COMP%] my-actor-avatar[_ngcontent-%COMP%]{display:block}my-user-auto-complete[_ngcontent-%COMP%]{display:block;width:450px}@media screen and (max-width:480px){my-user-auto-complete[_ngcontent-%COMP%]{width:100%}}my-action-dropdown[_ngcontent-%COMP%]{color:var(--fg-200)}.editor-explanation[_ngcontent-%COMP%]{color:var(--fg-200)}"]}));var Tn=Ge;var Rn=[{path:"",redirectTo:"general",pathMatch:"full"},{path:"general",component:Sn,data:{meta:{title:"General channel configuration"}}},{path:"editors",component:Tn,data:{meta:{title:"Channel editors"}}},{path:"activities",component:mn,data:{meta:{title:"Channel activities"}}}];var zt=qt(jt());var Io=(0,zt.default)("peertube:main:DeferLoadingDirective"),xe=class xe{el=c(Gn);viewContainer=c(wn);cd=c(zn);template=Xn(In);loaded=Xe();view;observer;ngAfterViewInit(){if(this.hasIncompatibleBrowser())return this.load();this.observer=new IntersectionObserver(n=>{let e=n[0];!e.isIntersecting||e.target!==this.el.nativeElement||(this.observer.unobserve(this.el.nativeElement),this.load());},{threshold:.1}),this.observer.observe(this.el.nativeElement);}load(){this.isLoaded()||(Io("Loading component"),this.viewContainer.clear(),this.view=this.viewContainer.createEmbeddedView(this.template(),{},0),this.loaded.emit(),this.cd.detectChanges());}isLoaded(){return this.view!=null;}ngOnDestroy(){this.view=null,this.observer&&this.observer.disconnect();}hasIncompatibleBrowser(){return!("IntersectionObserver"in window);}};D(xe,"\u0275fac",function(e){return new(e||xe)();}),D(xe,"\u0275dir",Hn({type:xe,selectors:[["","myDeferLoading",""]],contentQueries:function(e,i,_){e&1&&kn(_,i.template,In,5),e&2&&Ne();},outputs:{loaded:"loaded"}}));var Nn=xe;var Kt=t=>["/c",t],fo=()=>["/my-library","followers"],Oo=t=>({channel:t}),Mo=t=>["/my-library/video-channels/manage",t];function vo(t,n){if(t&1&&(r(0,"span",8),P(1),o()),t&2){let e=l();a(),z(e.getTotalTitle());}}function Lo(t,n){if(t&1){let e=U();r(0,"div",10)(1,"label",17),F(2,1),o(),r(3,"my-select-options",18),We("ngModelChange",function(_){V(e);let u=l();return je(u.displayFilter,_)||(u.displayFilter=_),Y(_);}),v("ngModelChange",function(){V(e);let _=l();return Y(_.onDisplayFilterChanged());}),o()();}if(t&2){let e=l();a(3),d("items",e.displayFilterItems),qe("ngModel",e.displayFilter);}}function Ro(t,n){t&1&&(r(0,"div",14),F(1,2),o());}function yo(t,n){t&1&&s(0,"my-collaborator-state",32);}function Po(t,n){t&1&&s(0,"my-collaborator-state",33);}function $o(t,n){if(t&1&&E(0,yo,1,0,"my-collaborator-state",32)(1,Po,1,0,"my-collaborator-state",33),t&2){let e=l().$implicit,i=l();p(i.user.isOwnerOfChannel(e)?0:i.user.isEditorOfChannel(e)?1:-1);}}function bo(t,n){if(t&1){let e=U();r(0,"my-delete-button",34),v("click",function(){V(e);let _=l().$implicit,u=l();return Y(u.deleteVideoChannel(_));}),o();}}function Vo(t,n){if(t&1&&s(0,"p-chart",36),t&2){let e=l(3).$index,i=l();d("data",i.videoChannelsChartData[e])("options",i.chartOptions)("ariaLabel",i.getChartAriaLabel(i.videoChannelsChartData[e]));}}function Yo(t,n){if(t&1&&E(0,Vo,1,3,"p-chart",36),t&2){let e=l(2).$index,i=l();p(i.chartOptions&&i.videoChannelsChartData&&i.videoChannelsChartData[e]?0:-1);}}function Go(t,n){t&1&&(r(0,"div",31)(1,"div",35),_e(2,Yo,1,1,"ng-template"),o()());}function xo(t,n){if(t&1&&(r(0,"div",16)(1,"div",19),s(2,"my-actor-avatar",20),r(3,"div",21)(4,"div",22)(5,"a",23),P(6),o(),E(7,$o,2,1),o(),r(8,"span",24),P(9),o(),r(10,"a",25),F(11,3),o(),r(12,"div",26)(13,"span"),F(14,4),o(),r(15,"span",27),P(16,"\xB7"),o(),r(17,"span"),F(18,5),Qe(19,"myNumberFormatter"),o()()(),r(20,"div",28),s(21,"my-edit-button",29),E(22,bo,1,0,"my-delete-button",30),o()(),E(23,Go,3,0,"div",31),o()),t&2){let e=n.$implicit,i=l();a(2),d("actor",e)("internalHref",h(21,Kt,e.nameWithHost)),a(3),d("routerLink",h(23,Kt,e.nameWithHost)),a(),z(e.displayName),a(),p(i.user.isCollaboratingToChannels()?7:-1),a(2),z(e.nameWithHost),a(),d("routerLink",Un(25,fo))("queryParams",h(26,Oo,e.name)),a(),C(e.followersCount)(e.followersCount),m(11),a(),Bn("opacity-0",e.totalViews===void 0),a(2),C(e.videosCount)(e.videosCount),m(14),a(5),C(e.totalViews)(Ze(19,19,e.totalViews)),m(18),a(2),d("ptRouterLink",h(28,Mo,e.nameWithHost)),a(),p(i.isOwned(e)?22:-1),a(),p(i.isInSmallView?-1:23);}}var we=class we{authService=c(k);notifier=c(G);confirmService=c(Ie);videoChannelService=c(x);screenService=c(Ct);route=c(en);peertubeRouter=c(pt);videoChannels=[];
1videoChannelsChartData;chartOptions;search;onChannelDataSubject=new Se();pagination={currentPage:1,itemsPerPage:10,totalItems:null};displayFilter="all";displayFilterItems=[{id:"all",label:"All channels"},{id:"owned",label:"Only channels owned by me"}];pagesDone=new Set();get isInSmallView(){return this.screenService.isInSmallView();}get user(){return this.authService.getUser();}ngOnInit(){this.route.snapshot.queryParamMap.get("displayFilter")==="owned"&&(this.displayFilter="owned");}isOwned(n){return n.ownerAccount.id===this.authService.getUser().account.id;}onDisplayFilterChanged(){this.peertubeRouter.silentNavigate([],hn(re({},this.route.snapshot.queryParams),{displayFilter:this.displayFilter==="all"?null:this.displayFilter})),this.resetDataAndReload();}onSearch(n){this.search=n,this.resetDataAndReload();}resetDataAndReload(){ln(this.pagination),this.videoChannels=[],this.pagesDone.clear(),this.loadMoreVideoChannels();}deleteVideoChannel(n){this.videoChannelService.removeWithConfirmation(n).subscribe({next:e=>{e&&(this.videoChannels=this.videoChannels.filter(i=>i.id!==n.id),this.notifier.success("Video channel "+n.displayName+" deleted."),ut(this.pagination));},error:e=>this.notifier.handleError(e)});}onNearOfBottom(){_n(this.pagination)&&(this.pagination.currentPage+=1,this.loadMoreVideoChannels());}loadMoreVideoChannels(){if(this.pagesDone.has(this.pagination.currentPage))return;this.pagesDone.add(this.pagination.currentPage);let n={account:this.authService.getUser().account,search:this.search,componentPagination:this.pagination,includeCollaborations:this.displayFilter==="all",sort:"-updatedAt"};this.authService.userInformationLoaded.pipe(bn()).pipe(B(()=>this.videoChannelService.listAccountChannels(n)),Ce(i=>{this.videoChannels=this.videoChannels.concat(i.data),this.pagination.totalItems=i.total,this.onChannelDataSubject.next(i.data);}),B(()=>this.videoChannelService.listAccountChannels(hn(re({},n),{withStats:!0})))).subscribe({next:i=>{for(let _ of i.data){let u=this.videoChannels.find(M=>M.id===_.id);u.viewsPerDay=_.viewsPerDay,u.videosCount=_.videosCount,u.totalViews=_.totalViews;}this.videoChannelsChartData=this.videoChannels.map(_=>({labels:_.viewsPerDay.map(u=>u.date.toLocaleDateString()),datasets:[{label:"Views for the day",data:_.viewsPerDay.map(u=>u.views),fill:!1,borderColor:"#c6c6c6"}],total:_.viewsPerDay.map(u=>u.views).reduce((u,M)=>u+M,0),startDate:_.viewsPerDay.length!==0?_.viewsPerDay[0].date.toLocaleDateString():""})),this.buildChartOptions();},error:i=>this.notifier.handleError(i)});}buildChartOptions(){let n=Math.min(...this.videoChannels.map(i=>ot(i.viewsPerDay,"views").views)),e=Math.max(...this.videoChannels.map(i=>it(i.viewsPerDay,"views").views));this.chartOptions={plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1,external:function({tooltip:i}){i&&(i.options.displayColors=!1);},callbacks:{label:i=>`${i.formattedValue} views`}}},scales:{x:{display:!1},y:{display:!1,min:Math.max(0,n-3*e/100),max:Math.max(1,e)}},layout:{padding:{left:15,right:15,top:10,bottom:0}},elements:{point:{radius:0}},hover:{mode:"index",intersect:!1}};}getChartAriaLabel(n){return n.startDate?Mn(""+n.total+" {value, plural, =1 {view} other {views}} since "+n.startDate+"",{value:n.total}):"";}getTotalTitle(){return Mn(""+this.pagination.totalItems+" {total, plural, =1 {channel} other {channels}}",{total:this.pagination.totalItems});}};D(we,"\u0275fac",function(e){return new(e||we)();}),D(we,"\u0275cmp",R({type:we,selectors:[["ng-component"]],decls:14,vars:5,consts:()=>{let n;n="Search a channel";let e;e="Create video channel";let i;i="Filter";let _;_="No channel found.";let u;u="Channel page";let M;M="Manage";let O;O="{VAR_PLURAL, plural, =0 {No subscribers} =1 {1 subscriber} other {{INTERPOLATION} subscribers}}",O=X(O,{INTERPOLATION:"\uFFFD1\uFFFD",VAR_PLURAL:"\uFFFD0\uFFFD"});let w;w=" "+O+" ";let y;y="{VAR_PLURAL, plural, =0 {No videos} =1 {1 video} other {{INTERPOLATION} videos}}",y=X(y,{INTERPOLATION:"\uFFFD1\uFFFD",VAR_PLURAL:"\uFFFD0\uFFFD"});let H;return H="{VAR_PLURAL, plural, =0 {No views} =1 {1 view}
1 other {{INTERPOLATION} views}}",H=X(H,{INTERPOLATION:"\uFFFD1\uFFFD",VAR_PLURAL:"\uFFFD0\uFFFD"}),[e,i,_,w,y,H,[3,"hideLink"],[1,"d-flex","align-items-end","gap-2","flex-wrap","mb-4"],[1,"total-items"],["emitOnInit","true","placeholder",n,1,"d-block","ms-auto",3,"search"],[1,"d-flex","align-items-center"],["routerLink","/manage/create",1,"peertube-create-button"],["iconName","add","aria-hidden","true"],[1,"results-container"],[1,"no-results"],["myInfiniteScroller","",1,"video-channels",3,"nearOfBottom","dataObservable"],[1,"channel"],["for","display-filter",1,"label-inline"],["inputId","display-filter",3,"ngModelChange","items","ngModel"],[1,"channel-info"],["actorType","channel","size","120",3,"actor","internalHref"],[1,"metadata"],[1,"min-width-0","d-flex","flex-wrap","w-fit-content","align-items-center"],["title",u,1,"display-name",3,"routerLink"],[1,"handle"],[1,"followers",3,"routerLink","queryParams"],[1,"videos-info"],[1,"mx-1"],[1,"buttons"],["label",M,3,"ptRouterLink"],["label",""],[1,"w-100","d-flex","justify-content-end","chart-container"],["type","owner",1,"d-inline-block","ms-2"],["type","accepted",1,"d-inline-block","ms-2"],["label","",3,"click"],["myDeferLoading",""],["width","40vw","height","100px","type","line",3,"data","options","ariaLabel"]];},template:function(e,i){e&1&&(s(0,"my-channels-setup-message",6),r(1,"div",7),E(2,vo,2,1,"span",8),r(3,"my-search-input",9),v("search",function(u){return i.onSearch(u);}),o(),E(4,Lo,4,2,"div",10),r(5,"a",11),s(6,"my-global-icon",12),T(7),F(8,0),N(),o()(),r(9,"div",13),E(10,Ro,2,0,"div",14),r(11,"div",15),v("nearOfBottom",function(){return i.onNearOfBottom();}),W(12,xo,24,30,"div",16,Be),o()()),e&2&&(d("hideLink",!0),a(2),p(i.pagination.totalItems?2:-1),a(2),p(i.user.isCollaboratingToChannels()?4:-1),a(6),p(i.pagination.totalItems===0?10:-1),a(),d("dataObservable",i.onChannelDataSubject.asObservable()),a(),Q(i.videoChannels));},dependencies:[q,K,Ae,tn,he,kt,Lt,dn,cn,Rt,At,Nn,Pt,yt,Nt,Oe,Ot],styles:[".results-container[_ngcontent-%COMP%]{min-height:40vh}input[type=text][_ngcontent-%COMP%]{font-size:16px;padding:var(--input-y-padding) var(--input-x-padding);width:300px;max-width:300px;color:var(--input-fg);background-color:var(--input-bg);border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-border-radius);line-height:24px}input[type=text][_ngcontent-%COMP%]::placeholder{color:var(--input-placeholder-color);font-size:var(--input-placeholder-font-size)}input[type=text][readonly][_ngcontent-%COMP%]{color:var(--fg-300)}input[type=text][_ngcontent-%COMP%]:focus, input[type=text][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem var(--fg-100);outline:0}input[type=text][disabled][_ngcontent-%COMP%]{color:var(--fg-300);opacity:.8}@media screen and (max-width:340px){input[type=text][_ngcontent-%COMP%]{width:100%}}.channel[_ngcontent-%COMP%]{margin-bottom:1.25rem;border-bottom:1px solid var(--input-border-color);min-height:130px}.channel-info[_ngcontent-%COMP%]{display:flex;gap:1rem}.metadata[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-self:flex-start;min-width:1px}.video-channel-names[_ngcontent-%COMP%]{width:fit-content;display:flex;align-items:baseline;color:var(--fg)}.video-channel-names[_ngcontent-%COMP%], .video-channel-names[_ngcontent-%COMP%]:hover, .video-channel-names[_ngcontent-%COMP%]:focus, .video-channel-names[_ngcontent-%COMP%]:active{text-decoration:none}.video-channel-names[_ngcontent-%COMP%]:focus:not(:focus-visible){outline:none}.display-name[_ngcontent-%COMP%]{font-weight:600;font-size:1.125rem}.handle[_ngcontent-%COMP%], .followers[_ngcontent-%COMP%], .videos-info[_ngcontent-%COMP%]{font-size:.875rem}.handle[_ngcontent-%COMP%]{color:var(--fg-300);margin-bottom:.5rem}.followers[_ngcontent-%COMP%]{color:var(--fg)}.buttons[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem;margin-inline-start:auto}.chart-container[_ngcontent-%COMP%]{width:40vw;height:100px}@media screen and (max-width:800px){.channel-info[_ngcontent-%COMP%]{flex-direction:column;text-align:center;padding-bottom:1rem;align-items:center}.metadata[_ngcontent-%COMP%]{align-self:normal;align-items:center}.buttons[_ngcontent-%COMP%]{text-align:center;margin-inline-start:0}}"]}));var Dn=we;var wo=(t,n)=>{let e=t.params.videoChannelName,i=c(x),_=c(se);return $n([i.get(e),i.listCollaborators(e).pipe(An(({data:u})=>u)),c(ce).getChannelSettings({channelHandle:e,raw:!0})]).pipe(An(([u,M,O])=>({videoChannel:u,collaborators:M,rawPlayerSettings:O})),ke(u=>(rn.error("Cannot fetch channel information",u),_.navigate(["/401"],{state:{obj:u},skipLocationChange:!0}),He(()=>u))));},bl=[{path:"",component:Dn,data:{meta:{title:"My video channels"}}},{path:"create",component:En,data:{meta:{title:"Create a new video channel"}},canDeactivate:[Ln],providers:[ce,$],children:Rn},{path:"update/:videoChannelName",redirectTo:"manage/:videoChannelName"},{path:"manage/:videoChannelName",canDeactivate:[Ln],component:pn,data:{meta:{title:"Manage video channel"}},resolve:{data:wo},providers:[ce,$],children:Rn}];export{wo as channelManageResolver,bl as default};/**i18n:347eeb695970c32bc275618edc2e751c67145d9fc3012e70543c114a99b9e016*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.