1import{a as ee,b as Et,c as Ue,d as Ot,e as N,f as xe,g as te,h as bt,i as ne}from"./chunk-RDII6C65.js";import{a as It}from"./chunk-NGEAMI4X.js";import{a as Z}from"./chunk-5V32CCEH.js";import{a as Ne}from"./chunk-YYIVV5FU.js";import"./chunk-2VCO3ELQ.js";import{a as ft}from"./chunk-BH6MQPW4.js";import"./chunk-U7E76NBH.js";import"./chunk-ARBLAW36.js";import{a as ht}from"./chunk-PY2X2NPU.js";import"./chunk-EKHN3NGM.js";import"./chunk-5GVXZ5ON.js";import"./chunk-G3L6OW7K.js";import"./chunk-YEN262T4.js";import"./chunk-4GM7L6JB.js";import"./chunk-LCNXNM6E.js";import"./chunk-XGC7JZAU.js";import"./chunk-MBPSVMMT.js";import{a as Pt}from"./chunk-G2J2EHB2.js";import"./chunk-EBBGYWSY.js";import"./chunk-6S7GR7RZ.js";import"./chunk-N3ODB36S.js";import{a as J}from"./chunk-TB5BTAZU.js";import"./chunk-L435IOLB.js";import"./chunk-AGD5WKED.js";import"./chunk-XAUPS75L.js";import"./chunk-S7TSA3HI.js";import"./chunk-J3EEEQXE.js";import"./chunk-PVOHGV2Y.js";import"./chunk-LQVRZI54.js";import{a as Mt}from"./chunk-ZNX7BU5Q.js";import{a as Ae}from"./chunk-JRXKYMED.js";import{a as St}from"./chunk-SSETSBQT.js";import"./chunk-MTPQLCOP.js";import"./chunk-X3ZEAWQQ.js";import"./chunk-SGZLU3PA.js";import"./chunk-EO7FPGTW.js";import"./chunk-GDFO7X2G.js";import{c as ue}from"./chunk-Q6I3NOHV.js";import{a as pe}from"./chunk-KIVJRE4O.js";import"./chunk-VDA4PBJF.js";import"./chunk-YLZ34D6D.js";import"./chunk-QXVUYXIG.js";import"./chunk-OR7MKCZD.js";import"./chunk-LLCRV73S.js";import{a as Le}from"./chunk-GGNTEXQL.js";import"./chunk-TALII272.js";import"./chunk-V3JZPFOE.js";import{c as vt}from"./chunk-PG4F5PSG.js";import"./chunk-CIVVPYF3.js";import"./chunk-FZFWY5Y6.js";import{a as ce}from"./chunk-EGEBNI4V.js";import{E as q,F as Y,c as de,g as Q,o as W,r as ot}from"./chunk-EBOVR5NW.js";import{A as pt,C as ct,D as ut,G as Te,w as st,y as _t,z as dt}from"./chunk-UME7L37K.js";import{a as K}from"./chunk-R76LZEZS.js";import{$d as he,Aa as Ze,Ab as X,Bb as z,Ca as d,Cb as u,Cc as T,Db as Me,Dc as O,Eb as Oe,Ec as F,Fd as w,Gb as C,Hd as it,Ib as _,Jd as ye,Kd as Ve,Ma as U,Mf as at,Mh as B,Oh as Ct,Q as ae,Qb as le,Qf as lt,Rb as se,Rg as j,Sb as _e,Ta as x,Vc as tt,Xb as R,Xg as Pe,Y as Je,Yb as ie,Zb as be,Zc as nt,aa as s,bc as b,cc as y,dc as V,fa as p,fb as v,ga as c,gb as f,hh as L,lb as m,lc as et,mb as a,n as re,nb as l,ne as rt,ob as h,qh as De,r as G,sb as k,tb as H,th as D,wc as Fe,xh as mt,yb as P,yh as gt}from"./chunk-HVCWS4IF.js";import{g as Se,j as I,k as $}from"./chunk-KJ7W2O2B.js";var Nt=Se(Pe());var yt=Se(Pe());var At=["torrentfileInput"];function Ut(o,t){if(o&1){let e=P();a(0,"div",8),C("fileDropped",function(i){p(e);let r=_();return c(r.setTorrentFile(i));}),a(1,"div",9),h(2,"my-global-icon",10),a(3,"div",11)(4,"span"),u(5,1),l(),a(6,"input",12,0),C("change",function(){p(e);let i=_();return c(i.fileChange());}),l()(),h(8,"div",13),a(9,"div",14)(10,"label",15),u(11,2),l(),a(12,"my-help"),k(13),u(14,3),H(),l(),a(15,"input",16),V("ngModelChange",function(i){p(e);let r=_();return y(r.firstStepMagnetUri,i)||(r.firstStepMagnetUri=i),c(i);}),l()(),a(16,"div",17)(17,"label",18),u(18,4),l(),a(19,"my-select-channel",19),V("ngModelChange",function(i){p(e);let r=_();return y(r.firstStepChannelId,i)||(r.firstStepChannelId=i),c(i);}),l()(),a(20,"input",20),C("click",function(){p(e);let i=_();return c(i.importVideo());}),l()()();}if(o&2){let e=_();d(3),m("ngbTooltip","(extensions: .torrent)"),d(12),b("ngModel",e.firstStepMagnetUri),d(4),m("items",e.userChannels()),b("ngModel",e.firstStepChannelId),d(),m("disabled",!e.isMagnetUrlValid()||e.isImportingVideo);}}function xt(o,t){if(o&1){let e=P();a(0,"my-video-manage-container",21),C("videoUpdated",function(){p(e);let i=_();return c(i.onVideoUpdated());}),a(1,"my-alert",22),u(2,5),l()();}}var Rt=(0,yt.default)("peertube:video-publish"),me=class me{authService=s(L);loadingBar=s(Le);notifier=s(j);videoService=s(ue);playerSettingsService=s(J);videoImportService=s(Ae);hooks=s(B);serverService=s(D);manageController=s(N);route=s(w);videoEmbedPrivacyService=s(ee);userChannels=O.required();userQuota=O.required();highestPrivacy=O.required();firstStepDone=T();firstStepError=T();torrentfileInput=F("torrentfileInput");firstStep=!0;
1firstStepChannelId;firstStepMagnetUri="";isImportingVideo=!1;ngOnInit(){this.firstStepChannelId=this.userChannels()[0].id;}ngAfterViewInit(){this.hooks.runAction("action:video-torrent-import.init","video-edit");}canDeactivate(){if(this.firstStep)return{canDeactivate:!0};let t="";return this.manageController.hasPendingChanges()&&(t="Your video is being imported. But there are unsaved changes: are you sure you want to leave this page?"),{canDeactivate:!t,text:t};}onVideoUpdated(){this.notifier.success("Changes saved.");}reset(){this.firstStep=!0,this.isImportingVideo=!1,this.firstStepMagnetUri="";}isMagnetUrlValid(){return!!this.firstStepMagnetUri;}fileChange(){let t=this.torrentfileInput().nativeElement.files[0];t&&this.importVideo(t);}setTorrentFile(t){this.torrentfileInput().nativeElement.files=t,this.fileChange();}importVideo(t){if(this.isImportingVideo)return;this.isImportingVideo=!0;let e=this.serverService.getHTMLConfig(),n=te.createFromImport(e,{torrentfile:t,magnetUri:this.firstStepMagnetUri,channelId:this.firstStepChannelId,support:this.userChannels().find(i=>i.id===this.firstStepChannelId).support??"",user:this.authService.getUser()});this.manageController.setConfig({manageType:"import-torrent",serverConfig:this.serverService.getHTMLConfig()}),this.manageController.setVideoEdit(n),this.loadingBar.useRef("import-video").start(),this.videoImportService.importVideo(n.toVideoImportCreate(this.highestPrivacy())).pipe(ae(({video:i})=>G([this.videoService.getVideo({videoId:i.uuid}),this.playerSettingsService.getVideoSettings({videoId:i.uuid,raw:!0}),this.videoEmbedPrivacyService.getPrivacy({videoId:i.uuid})]))).subscribe({next:S=>$(this,[S],function*([i,r,g]){yield n.loadFromAPI({video:i,playerSettings:r,embedPrivacy:g,loadPrivacy:!1}),this.loadingBar.useRef("import-video").complete(),Rt("Torrent/magnet import created"),this.manageController.silentRedirectOnManage(n.getVideoAttributes().shortUUID,this.route),this.firstStep=!1,this.isImportingVideo=!1,this.firstStepDone.emit(n.getVideoAttributes().name);}),error:i=>{if(this.isImportingVideo=!1,this.loadingBar.useRef("import-video").complete(),this.firstStepError.emit(),i.body?.code===he.INCORRECT_FILES_IN_TORRENT){this.notifier.error("Torrents with only 1 file are supported.");return;}this.notifier.handleError(i);}});}};I(me,"\u0275fac",function(e){return new(e||me)();}),I(me,"\u0275cmp",U({type:me,selectors:[["my-video-import-torrent"]],viewQuery:function(e,n){e&1&&le(n.torrentfileInput,At,5),e&2&&se();},inputs:{userChannels:[1,"userChannels"],userQuota:[1,"userQuota"],highestPrivacy:[1,"highestPrivacy"]},outputs:{firstStepDone:"firstStepDone",firstStepError:"firstStepError"},decls:2,vars:1,consts:()=>{let t;t="Select the torrent to import";let e;e="OR";let n;n="Import";let i;i="Select the torrent to import";let r;r="Paste magnet URI";let g;g=" You can import any torrent file that points to a media file. You should make sure you have diffusion rights over the content it points to, otherwise it could cause legal trouble to yourself and your instance. ";let S;S="Channel";let E;return E=" Congratulations, the video will be imported with BitTorrent! You can already add information about this video. ",[["torrentfileInput",""],i,r,g,S,E,["myDragDrop","",1,"upload-video-container"],["canUpdate","true","canWatch","false","cancelLink","/my-library/videos"],["myDragDrop","",1,"upload-video-container",3,"fileDropped"],[1,"first-step-block"],["iconName","upload","aria-hidden","true",1,"upload-icon"],[1,"button-file","primary-button","form-control",3,"ngbTooltip"],["aria-label",t,"type","file","name","torrentfile","id","torrentfile","accept",".torrent",3,"change"],["data-content",e,1,"torrent-or-magnet"],[1,"form-group","form-group-magnet-uri"],["for","magnetUri"],["type","text","id","magnetUri",1,"form-control",3,"ngModelChange","ngModel"],[1,"form-group"],["for","first-step-channel"],["inputId","first-step-channel",3,"ngModelChange","items","ngModel"],["type","button","value",n,1,"peertube-button","primary-button",3,"click","disabled"],["canUpdate","true","canWatch","false","cancelLink","/my-library/videos",3,"videoUpdated"],["type","primary"]];},template:function(e,n){e&1&&v(0,Ut,21,5,"div",6)(1,xt,3,0,"my-video-manage-container",7),e&2&&f(n.firstStep?0:1);},dependencies:[K,Te,ce,q,de,Q,W,xe,Z,Y,pe,ne],styles:[".alert.alert-danger[_ngcontent-%COMP%]{text-align:center}.alert.alert-danger[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{font-weight:600}.first-step-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;--textarea-bg: var(--textarea-bg-in-modal);--input-bg: var(--input-bg-in-modal);--input-border-color: var(--input-bg-in-modal);--p-multiselect-background: var(--input-bg-in-modal);--p-select-background: var(--input-bg-in-modal)}.first-step-block[_ngcontent-%COMP%] .upload-icon[_ngcontent-%COMP%]{width:90px;margin-bottom:25px;color:var(--fg-300)}.first-step-block[_ngcontent-%COMP%] .peertube-select-container[_ngcontent-%COMP%]{width:275px}@media screen and (max-width:305px){.first-step-block[_ngcontent-%COMP%] .peertube-select-container[_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] my-select-channel[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] my-select-options[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .peertube-radio-container[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{display:block;width:275px}@media screen and (max-width:275px){.first-step-block[_ngcontent-%COMP%] my-select-channel[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] my-select-options[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .peertube-radio-container[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{white-space:nowrap}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]{display:block;font-size:16px;padding:var(--input-y-padding) var(--input-x-padding);width:275px;max-width:275px;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}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]::placeholder{color:var(--input-placeholder-color);font-size:var(--input-placeholder-font-size)}.first-step-block[_ngcontent-%COMP%] input[type=text][readonly][_ngcontent-%COMP%]{color:var(--fg-300)}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]:focus, .first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem var(--fg-100);outline:0}.first-step-block[_ngcontent-%COMP%] input[type=text][disabled][_ngcontent-%COMP%]{color:var(--fg-300);opacity:.8}@media screen and (max-width:315px){.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] .button-file[_ngcontent-%COMP%]{width:max-content}",".first-step-block[_ngcontent-%COMP%] .torrent-or-magnet[_ngcontent-%COMP%]{width:95%;border-top:.05rem solid var(--secondary-icon-color);height:.05rem;text-align:center;display:block;position:relative}.first-step-block[_ngcontent-%COMP%] .torrent-or-magnet[data-content][_ngcontent-%COMP%]{margin:.8rem 0}.first-step-block[_ngcontent-%COMP%] .torrent-or-magnet[data-content][_ngcontent-%COMP%]:after{background:var(--bg-secondary-400);color:var(--secondary-icon-color);content:attr(data-content);display:inline-block;font-size:.7rem;padding:0 .4rem;
1transform:translateY(-.65rem)}.first-step-block[_ngcontent-%COMP%] .torrent-or-magnet[data-content][_ngcontent-%COMP%]{margin:1.5rem 0}.first-step-block[_ngcontent-%COMP%] .form-group-magnet-uri[_ngcontent-%COMP%]{margin-bottom:40px}"]}));var Re=me;var Vt=Se(Pe());function wt(o,t){o&1&&(a(0,"div",13),X(1,3),h(2,"a",17),z(),l());}function Bt(o,t){if(o&1){let e=P();a(0,"div",5)(1,"div",7),h(2,"my-global-icon",8),a(3,"div",9)(4,"label",10),u(5,0),l(),a(6,"my-help"),k(7),X(8,1),h(9,"a",11),z(),H(),l(),a(10,"input",12),V("ngModelChange",function(i){p(e);let r=_();return y(r.targetUrl,i)||(r.targetUrl=i),c(i);}),l(),v(11,wt,3,0,"div",13),l(),a(12,"div",9)(13,"label",14),u(14,2),l(),a(15,"my-select-channel",15),V("ngModelChange",function(i){p(e);let r=_();return y(r.firstStepChannelId,i)||(r.firstStepChannelId=i),c(i);}),l()(),a(16,"input",16),C("click",function(){p(e);let i=_();return c(i.importVideo());}),l()()();}if(o&2){let e=_();d(10),b("ngModel",e.targetUrl),d(),f(e.isChannelSyncEnabled()?11:-1),d(4),m("items",e.userChannels()),b("ngModel",e.firstStepChannelId),d(),m("disabled",!e.isTargetUrlValid()||e.isImportingVideo);}}function $t(o,t){if(o&1){let e=P();a(0,"my-video-manage-container",18),C("videoUpdated",function(){p(e);let i=_();return c(i.onVideoUpdated());}),a(1,"my-alert",19),u(2,4),l()();}if(o&2){let e=_();d(2),Me(e.targetUrl),Oe(2);}}var kt=(0,Vt.default)("peertube:video-publish"),ge=class ge{authService=s(L);loadingBar=s(Le);notifier=s(j);videoService=s(ue);videoImportService=s(Ae);hooks=s(B);serverService=s(D);manageController=s(N);route=s(w);chapterService=s(Mt);captionService=s(St);playerSettingsService=s(J);videoEmbedPrivacyService=s(ee);userChannels=O.required();userQuota=O.required();highestPrivacy=O.required();firstStepDone=T();firstStepError=T();targetUrl="";firstStep=!0;firstStepChannelId;isImportingVideo=!1;ngOnInit(){this.firstStepChannelId=this.userChannels()[0].id;}ngAfterViewInit(){this.hooks.runAction("action:video-url-import.init","video-edit");}canDeactivate(){if(this.firstStep)return{canDeactivate:!0};let t="";return this.manageController.hasPendingChanges()&&(t="Your video is being imported. But there are unsaved changes: are you sure you want to leave this page?"),{canDeactivate:!t,text:t};}onVideoUpdated(){this.notifier.success("Changes saved.");}reset(){this.firstStep=!0,this.isImportingVideo=!1;}isTargetUrlValid(){return this.targetUrl?.match(/https?:\/\//);}isChannelSyncEnabled(){return this.serverService.getHTMLConfig().import.videoChannelSynchronization.enabled;}importVideo(){if(this.isImportingVideo)return;this.isImportingVideo=!0;let t=this.serverService.getHTMLConfig(),e=te.createFromImport(t,{targetUrl:this.targetUrl,channelId:this.firstStepChannelId,support:this.userChannels().find(n=>n.id===this.firstStepChannelId).support??"",user:this.authService.getUser()});this.manageController.setConfig({manageType:"import-url",serverConfig:this.serverService.getHTMLConfig()}),this.manageController.setVideoEdit(e),this.loadingBar.useRef("import-video").start(),this.videoImportService.importVideo(e.toVideoImportCreate(this.highestPrivacy())).pipe(ae(({video:n})=>G([this.captionService.listCaptions(n.uuid),this.chapterService.getChapters({videoId:n.uuid}),this.playerSettingsService.getVideoSettings({videoId:n.uuid,raw:!0}),this.videoService.getVideo({videoId:n.uuid}),this.videoEmbedPrivacyService.getPrivacy({videoId:n.uuid})]).pipe(re(([{data:i},{chapters:r},g,S,E])=>({captions:i,chapters:r,playerSettings:g,video:S,embedPrivacy:E}))))).subscribe({next:E=>$(this,[E],function*({video:n,playerSettings:i,captions:r,chapters:g,embedPrivacy:S}){yield e.loadFromAPI({video:n,captions:r,playerSettings:i,chapters:g,embedPrivacy:S,loadPrivacy:!1}),this.loadingBar.useRef("import-video").complete(),kt("URL import created"),this.manageController.silentRedirectOnManage(e.getVideoAttributes().shortUUID,this.route),this.firstStep=!1,this.isImportingVideo=!1,this.firstStepDone.emit(e.getVideoAttributes().name);}),error:n=>{this.loadingBar.useRef("import-video").complete(),this.isImportingVideo=!1,this.firstStepError.emit(),this.notifier.handleError(n);}});}};I(ge,"\u0275fac",function(e){return new(e||ge)();}),I(ge,"\u0275cmp",U({type:ge,selectors:[["my-video-import-url"]],inputs:{userChannels:[1,"userChannels"],userQuota:[1,"userQuota"],highestPrivacy:[1,"highestPrivacy"]},outputs:{firstStepDone:"firstStepDone",firstStepError:"firstStepError"},decls:2,vars:1,consts:()=>{let t;t="Import";let e;e="URL";let n;n=" You can import any URL "+"\uFFFD#9\uFFFD"+"supported by youtube-dl/yt-dlp"+"\uFFFD/#9\uFFFD"+" or URL that points to a media file. You should make sure you have diffusion rights over the content it points to, otherwise it could cause legal trouble to yourself and your instance. ";let i;i="Channel";let r;r=" You can also synchronize a remote channel in "+"\uFFFD#2\uFFFD"+"your library"+"\uFFFD/#2\uFFFD"+"";let g;return g=" Congratulations, the video behind "+"\uFFFD0\uFFFD"+" is being imported! You can already add information about this video. ",[e,n,i,r,g,[1,"upload-video-container"],["canUpdate","true","canWatch","false","cancelLink","/my-library/videos"],[1,"first-step-block"],["iconName","upload","aria-hidden","true",1,"upload-icon"],[1,"form-group"],["for","targetUrl"],["href","https://rg3.github.io/youtube-dl/supportedsites.html","target","_blank","rel","noopener noreferrer"],["type","text","id","targetUrl",1,"form-control",3,"ngModelChange","ngModel"],[1,"form-group-description"],["for","first-step-channel"],["inputId","first-step-channel",3,"ngModelChange","items","ngModel"],["type","button","value",t,1,"peertube-button","primary-button",3,"click","disabled"],["routerLink","/my-library/video-channel-syncs",1,"text-decoration-underline"],["canUpdate","true","canWatch","false","cancelLink","/my-library/videos",3,"videoUpdated"],["type","primary"]];},template:function(e,n){e&1&&v(0,Bt,17,5,"div",5)(1,$t,3,1,"my-video-manage-container",6),e&2&&f(n.firstStep?0:1);},dependencies:[K,ce,q,de,Q,W,Ve,Z,Y,pe,ne],styles:[".alert.alert-danger[_ngcontent-%COMP%]{text-align:center}.alert.alert-danger[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{font-weight:600}.first-step-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;--textarea-bg: var(--textarea-bg-in-modal);--input-bg: var(--input-bg-in-modal);--input-border-color: var(--input-bg-in-modal);--p-multiselect-background: var(--input-bg-in-modal);--p-select-background: var(--input-bg-in-modal)}.first-step-block[_ngcontent-%COMP%] .upload-icon[_ngcontent-%COMP%]{width:90px;margin-bottom:25px;color:var(--fg-300)}.first-step-block[_ngcontent-%COMP%] .peertube-select-container[_ngcontent-%COMP%]{width:275px}@media screen and (max-width:305px){.first-step-block[_ngcontent-%COMP%] .peertube-select-container[_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] my-select-channel[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] my-select-options[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .peertube-radio-container[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{display:block;width:275px}@media screen and (max-width:275px){.first-step-block[_ngcontent-%COMP%] my-select-channel[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] my-select-options[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .peertube-radio-container[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{white-space:nowrap}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]{display:block;font-size:16px;padding:var(--input-y-padding) var(--input-x-padding);width:275px;max-width:275px;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}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]::placeholder{color:var(--input-placeholder-color);font-size:var(--input-placeholder-font-size)}.first-step-block[_ngcontent-%COMP%] input[type=text][readonly][_ngcontent-%COMP%]{color:var(--fg-300)}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]:focus, .first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem var(--fg-100);outline:0}.first-step-block[_ngcontent-%COMP%] input[type=text][disabled][_ngcontent-%COMP%]{color:var(--fg-300);opacity:.8}@media screen and (max-width:315px){.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] .button-file[_ngcontent-%COMP%]{width:max-content}"]}));var Be=ge;var Tt=Se(Pe());function Ht(o,t){if(o&1){let e=P();a(0,"div",4)(1,"div",6),h(2,"my-global-icon",7),a(3,"div",8)(4,"label",9),u(5,0),l(),a(6,"my-select-channel",10),V("ngModelChange",function(i){p(e);let r=_();
1return y(r.firstStepChannelId,i)||(r.firstStepChannelId=i),c(i);}),l()(),a(7,"div",11)(8,"div",12)(9,"input",13),V("ngModelChange",function(i){p(e);let r=_();return y(r.firstStepPermanentLive,i)||(r.firstStepPermanentLive=i),c(i);}),l(),a(10,"label",14),u(11,1),l(),a(12,"span",15),R(13),l()(),a(14,"div",12)(15,"input",16),V("ngModelChange",function(i){p(e);let r=_();return y(r.firstStepPermanentLive,i)||(r.firstStepPermanentLive=i),c(i);}),l(),a(16,"label",17),u(17,2),l(),a(18,"span",15),u(19,3),l()()(),a(20,"input",18),C("click",function(){p(e);let i=_();return c(i.goLive());}),l()()();}if(o&2){let e=_();d(6),m("items",e.userChannels()),b("ngModel",e.firstStepChannelId),d(3),b("ngModel",e.firstStepPermanentLive),m("value",!1),d(4),ie(e.getNormalLiveDescription()),d(2),b("ngModel",e.firstStepPermanentLive),m("value",!0),d(4),Me(e.getPermanentLiveDescription()),Oe(19),d(),m("disabled",e.firstStepPermanentLive!==!0&&e.firstStepPermanentLive!==!1);}}function Ft(o,t){if(o&1){let e=P();a(0,"my-video-manage-container",19),C("videoUpdated",function(){p(e);let i=_();return c(i.onVideoUpdated());}),l();}}var Gt=(0,Tt.default)("peertube:video-publish"),Ce=class Ce{notifier=s(j);authService=s(L);serverService=s(D);liveVideoService=s(Ne);hooks=s(B);manageController=s(N);route=s(w);playerSettingsService=s(J);videoEmbedPrivacyService=s(ee);userChannels=O.required();userQuota=O.required();highestPrivacy=O.required();firstStepDone=T();firstStepError=T();firstStep=!0;firstStepChannelId;firstStepPermanentLive;isGoingLive=!1;ngOnInit(){this.firstStepChannelId=this.userChannels()[0].id;}ngAfterViewInit(){this.hooks.runAction("action:go-live.init","video-edit");}canDeactivate(){if(this.firstStep)return{canDeactivate:!0};let t="";return this.manageController.hasPendingChanges()&&(t="Your live is waiting in your library. But there are unsaved changes: are you sure you want to leave this page?"),{canDeactivate:!t,text:t};}reset(){this.firstStep=!0,this.isGoingLive=!1;}goLive(){if(this.isGoingLive)return;this.isGoingLive=!0;let t=this.serverService.getHTMLConfig(),e=te.createFromLive(t,{name:"Live",channelId:this.firstStepChannelId,support:this.userChannels().find(n=>n.id===this.firstStepChannelId).support??"",permanentLive:this.firstStepPermanentLive,latencyMode:rt.DEFAULT,dvrWindow:t.live.dvr.maxWindow,saveReplay:this.isReplayAllowed()&&t.defaults.live.saveReplay,replaySettings:{privacy:this.highestPrivacy()},schedules:[],user:this.authService.getUser()});this.manageController.setConfig({manageType:"go-live",serverConfig:this.serverService.getHTMLConfig()}),this.manageController.setVideoEdit(e),this.liveVideoService.goLive(e.toLiveCreate(this.highestPrivacy())).pipe(ae(({video:n})=>G([this.liveVideoService.getVideoLive(n.uuid),this.playerSettingsService.getVideoSettings({videoId:n.uuid,raw:!0}),this.videoEmbedPrivacyService.getPrivacy({videoId:n.uuid})]).pipe(re(([i,r,g])=>({live:i,playerSettings:r,embedPrivacy:g,video:n}))))).subscribe({next:A=>$(this,[A],function*({video:{id:n,uuid:i,shortUUID:r},live:g,playerSettings:S,embedPrivacy:E}){e.loadAfterPublish({video:{id:n,uuid:i,shortUUID:r}}),yield e.loadFromAPI({live:g,playerSettings:S,embedPrivacy:E,loadPrivacy:!1}),Gt("Live published"),this.manageController.silentRedirectOnManage(r,this.route),this.firstStep=!1,this.isGoingLive=!1,this.firstStepDone.emit(e.getVideoAttributes().name);}),error:n=>{this.firstStepError.emit(),this.isGoingLive=!1;let i=n.body;i?.code===he.MAX_INSTANCE_LIVES_LIMIT_REACHED?this.notifier.error("Cannot create live because this platform has too many created lives"):i?.code===he.MAX_USER_LIVES_LIMIT_REACHED?this.notifier.error("Cannot create live because you created too many lives"):this.notifier.handleError(n);}});}onVideoUpdated(){this.notifier.success("Changes saved.");}getNormalLiveDescription(){return this.isReplayAllowed()?"Stream only once, replay will replace your live":"Stream only once";}getPermanentLiveDescription(){return this.isReplayAllowed()?"Stream multiple times, replays will be separate videos":"Stream multiple times using the same URL";}isReplayAllowed(){return this.serverService.getHTMLConfig().live.allowReplay;}};I(Ce,"\u0275fac",function(e){return new(e||Ce)();}),I(Ce,"\u0275cmp",U({type:Ce,selectors:[["my-video-go-live"]],inputs:{userChannels:[1,"userChannels"],userQuota:[1,"userQuota"],highestPrivacy:[1,"highestPrivacy"]},outputs:{firstStepDone:"firstStepDone",firstStepError:"firstStepError"},decls:2,vars:1,consts:()=>{let t;t="Go Live";let e;e="Channel";let n;n="Normal live";let i;i="Permanent/recurring live";let r;return r=""+"\uFFFD0\uFFFD"+"",[e,n,i,r,[1,"upload-video-container"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos"],[1,"first-step-block"],["iconName","upload","aria-hidden","true",1,"upload-icon"],[1,"form-group"],["for","first-step-channel"],["inputId","first-step-channel",3,"ngModelChange","items","ngModel"],[1,"form-group","live-type"],[1,"peertube-radio-container"],["type","radio","id","permanentLiveFalse",3,"ngModelChange","ngModel","value"],["for","permanentLiveFalse",1,"radio"],[1,"form-group-description"],["type","radio","id","permanentLiveTrue",3,"ngModelChange","ngModel","value"],["for","permanentLiveTrue",1,"radio"],["type","button","value",t,1,"peertube-button","primary-button",3,"click","disabled"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]];},template:function(e,n){e&1&&v(0,Ht,21,9,"div",4)(1,Ft,1,0,"my-video-manage-container",5),e&2&&f(n.firstStep?0:1);},dependencies:[K,Z,q,de,ot,Q,W,Y,ne],styles:[".alert.alert-danger[_ngcontent-%COMP%]{text-align:center}.alert.alert-danger[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{font-weight:600}.first-step-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;--textarea-bg: var(--textarea-bg-in-modal);--input-bg: var(--input-bg-in-modal);--input-border-color: var(--input-bg-in-modal);--p-multiselect-background: var(--input-bg-in-modal);--p-select-background: var(--input-bg-in-modal)}.first-step-block[_ngcontent-%COMP%] .upload-icon[_ngcontent-%COMP%]{width:90px;margin-bottom:25px;color:var(--fg-300)}.first-step-block[_ngcontent-%COMP%] .peertube-select-container[_ngcontent-%COMP%]{width:275px}@media screen and (max-width:305px){.first-step-block[_ngcontent-%COMP%] .peertube-select-container[_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] my-select-channel[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] my-select-options[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .peertube-radio-container[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{display:block;width:275px}@media screen and (max-width:275px){.first-step-block[_ngcontent-%COMP%] my-select-channel[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] my-select-options[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .peertube-radio-container[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{white-space:nowrap}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]{display:block;font-size:16px;padding:var(--input-y-padding) var(--input-x-padding);width:275px;max-width:275px;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}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]::placeholder{color:var(--input-placeholder-color);font-size:var(--input-placeholder-font-size)}.first-step-block[_ngcontent-%COMP%] input[type=text][readonly][_ngcontent-%COMP%]{color:var(--fg-300)}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]:focus, .first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem var(--fg-100);outline:0}.first-step-block[_ngcontent-%COMP%] input[type=text][disabled][_ngcontent-%COMP%]{color:var(--fg-300);opacity:.8}@media screen and (max-width:315px){.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] .button-file[_ngcontent-%COMP%]{width:max-content}",".live-type[_ngcontent-%COMP%]{margin-top:15px}"]}));var $e=Ce;var Dt=Se(Pe());var Xt=["videoFileInput"];function zt(o,t){if(o&1){let e=P();a(0,"div",15)(1,"label",16),u(2,3),l(),a(3,"div",17),X(4,4),h(5,"br"),z(),l(),a(6,"my-image-input",18),V("ngModelChange",function(i){p(e);let r=_(2);return y(r.audioThumbnailFile,i)||(r.audioThumbnailFile=i),c(i);}),l()(),a(7,"div",19)(8,"my-button",20),C("click",function(){p(e);let i=_(2);return c(i.uploadAudio());}),l()();}if(o&2){let e=_(2);d(6),b("ngModel",e.audioThumbnailFile),d(2),m("label",e.getAudioUploadLabel());}}
1function Qt(o,t){if(o&1){let e=P();a(0,"div",7),C("fileDropped",function(i){p(e);let r=_();return c(r.onFileDropped(i));}),a(1,"div",8),h(2,"my-global-icon",9),a(3,"div",10)(4,"span"),u(5,1),l(),a(6,"input",11,0),C("change",function(i){p(e);let r=_();return c(r.onFileChange(i));}),l()(),a(8,"div",12)(9,"label",13),u(10,2),l(),a(11,"my-select-channel",14),V("ngModelChange",function(i){p(e);let r=_();return y(r.firstStepChannelId,i)||(r.firstStepChannelId=i),c(i);}),l()(),v(12,zt,9,2),l()();}if(o&2){let e=_();d(3),m("ngbTooltip","(extensions: "+e.getVideoExtensions()+")"),d(3),m("accept",e.getVideoExtensions()),d(5),m("items",e.userChannels()),b("ngModel",e.firstStepChannelId),d(),f(e.uploadingAudioFile?12:-1);}}function Wt(o,t){if(o&1){let e=P();a(0,"my-video-manage-container",21),C("videoUpdated",function(){p(e);let i=_();return c(i.onVideoUpdated());}),l();}if(o&2){let e=_();m("canUpdate",e.hasUploadedFile())("canWatch",e.hasUploadedFile())("cancelLink",e.getCancelLink());}}var Lt=(0,Dt.default)("peertube:video-publish"),ve=class ve{notifier=s(j);authService=s(L);serverService=s(D);hooks=s(B);metaService=s(gt);route=s(w);videoUploadService=s(Ue);manageController=s(N);userChannels=O.required();userQuota=O.required();highestPrivacy=O.required();firstStepDone=T();firstStepError=T();videoFileInput=F("videoFileInput");uploadingAudioFile=!1;audioThumbnailFile;firstStep=!0;firstStepChannelId;hasFirstUpdated=!1;videoEdit;uploadEventsSubscription;ngOnInit(){this.uploadEventsSubscription=this.manageController.getUploadEventsObs().subscribe(t=>{if(this.updateTitle(),t.status==="cancelled"){Lt("Upload cancelled",t),this.firstStepError.emit(),this.firstStep=!0,this.manageController.silentRedirectOnAbortUpload(this.route);return;}if(t.status==="complete"){let{id:e,uuid:n,shortUUID:i}=t.response.video;this.videoEdit.loadAfterPublish({video:{id:e,uuid:n,shortUUID:i}}),Lt("Upload complete",t),this.manageController.silentRedirectOnManage(i,this.route);return;}}),this.firstStepChannelId=this.userChannels()[0].id;}ngAfterViewInit(){this.hooks.runAction("action:video-upload.init","video-edit");}ngOnDestroy(){this.uploadEventsSubscription?.unsubscribe(),this.manageController.cancelUploadIfNeeded();}canDeactivate(){if(this.firstStep)return{canDeactivate:!0};let t="";return this.hasUploadedFile()!==!0?t="Your video is not uploaded yet, are you sure you want to leave this page?":this.manageController.hasPendingChanges()&&(t="Your video was uploaded to your library. But there are unsaved changes: are you sure you want to leave this page?"),{canDeactivate:!t,text:t};}updateTitle(){this.hasUploadedFile()?this.metaService.setTitle("Publish"):this.uploadingAudioFile||!this.firstStep?this.metaService.setTitle(`${this.manageController.getUploadPercents()}% - Publish`):this.metaService.update(this.route.snapshot.data.meta);}getVideoExtensions(){return this.videoUploadService.getVideoExtensions().join(", ");}onFileDropped(t){let e=this.videoFileInput();e.nativeElement.files=t,this.onFileChange({target:e.nativeElement});}onFileChange(t){this.resetUploadState();let e=t.target.files[0];if(e&&this.manageController.checkUserQuota(e)){if(this.videoUploadService.isAudioFile(e.name)){this.uploadingAudioFile=!0;return;}this.firstStep=!1,this.uploadFile(e);}}resetUploadState(){this.firstStep=!0,this.videoEdit=void 0,this.uploadingAudioFile=!1,this.audioThumbnailFile=void 0;}uploadAudio(){this.uploadFile(this.getInputVideoFile(),this.audioThumbnailFile);}getAudioUploadLabel(){let t=this.getInputVideoFile();return t?"Upload "+t.name+"":"Upload";}onVideoUpdated(){this.notifier.success("Changes saved.");}hasUploadedFile(){return this.videoEdit?!!this.videoEdit.getVideoAttributes().id:!1;}getCancelLink(){return this.hasUploadedFile()?"/my-library/videos":"/videos/publish";}reset(){this.resetUploadState(),this.manageController.cancelUploadIfNeeded(),this.updateTitle();}getInputVideoFile(){return this.videoFileInput().nativeElement.files[0];}uploadFile(t,e){let n=this.serverService.getHTMLConfig();this.videoEdit=te.createFromUpload(n,{name:this.buildVideoFilename(t.name),channelId:this.firstStepCh
1annelId,support:this.userChannels().find(i=>i.id===this.firstStepChannelId).support??"",user:this.authService.getUser()}),this.manageController.setConfig({manageType:"upload",serverConfig:this.serverService.getHTMLConfig()}),this.manageController.setVideoEdit(this.videoEdit),this.manageController.uploadNewVideo({privacy:this.highestPrivacy(),file:t,thumbnailfile:e}),this.manageController.silentRedirectOnUploading(this.route),this.firstStep=!1,this.firstStepDone.emit(this.videoEdit.getVideoAttributes().name),this.updateTitle();}buildVideoFilename(t){let e=t.replace(/\.[^/.]+$/,""),n=e.length<3?t:e,i=110;return n.length>i&&(n=at(n,{length:i,omission:""})),n;}};I(ve,"\u0275fac",function(e){return new(e||ve)();}),I(ve,"\u0275cmp",U({type:ve,selectors:[["my-video-upload"]],viewQuery:function(e,n){e&1&&le(n.videoFileInput,Xt,5),e&2&&se();},inputs:{userChannels:[1,"userChannels"],userQuota:[1,"userQuota"],highestPrivacy:[1,"highestPrivacy"]},outputs:{firstStepDone:"firstStepDone",firstStepError:"firstStepError"},decls:2,vars:1,consts:()=>{let t;t="File uploaded! Your video is now available in your private library.";let e;e="Select the file to upload";let n;n="Select the file to upload";let i;i="Channel";let r;r="Edit";let g;g="Video background image";let S;return S=" Image that will be merged with your audio file. "+"\uFFFD#5\uFFFD\uFFFD/#5\uFFFD"+" The chosen image will be definitive and cannot be modified. ",[["videoFileInput",""],n,i,g,S,["myDragDrop","",1,"upload-video-container"],["uploadedLabel",t,3,"canUpdate","canWatch","cancelLink"],["myDragDrop","",1,"upload-video-container",3,"fileDropped"],[1,"first-step-block"],["iconName","upload","aria-hidden","true",1,"upload-icon"],[1,"button-file","primary-button","form-control",3,"ngbTooltip"],["aria-label",e,"id","videofile","type","file",3,"change","accept"],[1,"form-group","form-group-channel"],["for","first-step-channel"],["inputId","first-step-channel",3,"ngModelChange","items","ngModel"],[1,"form-group","audio-thumbnail"],["for","thumbnailfileUpload"],[1,"audio-image-info"],["inputLabel",r,"inputName","thumbnailfileUpload",3,"ngModelChange","ngModel"],[1,"form-group","upload-audio-button"],["theme","primary","icon","upload",3,"click","label"],["uploadedLabel",t,3,"videoUpdated","canUpdate","canWatch","cancelLink"]];},template:function(e,n){e&1&&v(0,Qt,13,5,"div",5)(1,Wt,1,3,"my-video-manage-container",6),e&2&&f(n.firstStep?0:1);},dependencies:[xe,K,Te,Z,q,Q,W,ft,vt,Y,ne],styles:[".alert.alert-danger[_ngcontent-%COMP%]{text-align:center}.alert.alert-danger[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{font-weight:600}.first-step-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;--textarea-bg: var(--textarea-bg-in-modal);--input-bg: var(--input-bg-in-modal);--input-border-color: var(--input-bg-in-modal);--p-multiselect-background: var(--input-bg-in-modal);--p-select-background: var(--input-bg-in-modal)}.first-step-block[_ngcontent-%COMP%] .upload-icon[_ngcontent-%COMP%]{width:90px;margin-bottom:25px;color:var(--fg-300)}.first-step-block[_ngcontent-%COMP%] .peertube-select-container[_ngcontent-%COMP%]{width:275px}@media screen and (max-width:305px){.first-step-block[_ngcontent-%COMP%] .peertube-select-container[_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] my-select-channel[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] my-select-options[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .peertube-radio-container[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{display:block;width:275px}@media screen and (max-width:275px){.first-step-block[_ngcontent-%COMP%] my-select-channel[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] my-select-options[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .peertube-radio-container[_ngcontent-%COMP%], .first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] .form-group-description[_ngcontent-%COMP%]{white-space:nowrap}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]{display:block;font-size:16px;padding:var(--input-y-padding) var(--input-x-padding);width:275px;max-width:275px;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}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]::placeholder{color:var(--input-placeholder-color);font-size:var(--input-placeholder-font-size)}.first-step-block[_ngcontent-%COMP%] input[type=text][readonly][_ngcontent-%COMP%]{color:var(--fg-300)}.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]:focus, .first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem var(--fg-100);outline:0}.first-step-block[_ngcontent-%COMP%] input[type=text][disabled][_ngcontent-%COMP%]{color:var(--fg-300);opacity:.8}@media screen and (max-width:315px){.first-step-block[_ngcontent-%COMP%] input[type=text][_ngcontent-%COMP%]{width:100%}}.first-step-block[_ngcontent-%COMP%] .button-file[_ngcontent-%COMP%]{width:max-content}",".first-step-block[_ngcontent-%COMP%] .form-group-channel[_ngcontent-%COMP%]{margin-bottom:20px;margin-top:35px}.first-step-block[_ngcontent-%COMP%] .audio-image-info[_ngcontent-%COMP%]{margin-bottom:10px}
1.first-step-block[_ngcontent-%COMP%] .audio-thumbnail[_ngcontent-%COMP%]{margin:30px 0}.first-step-block[_ngcontent-%COMP%] .audio-thumbnail[_ngcontent-%COMP%] my-image-input[_ngcontent-%COMP%]{width:360px;height:200px}"]}));var ke=ve;var qt=["videoUpload"],Yt=["videoImportUrl"],jt=["videoImportTorrent"],Kt=["videoGoLive"],Jt=o=>({"hide-nav":o});function Zt(o,t){o&1&&(a(0,"a",22),u(1,8),l());}function en(o,t){if(o&1&&(v(0,Zt,2,0,"a",22),a(1,"a",23),u(2,7),l()),o&2){let e=_();f(e.isContactFormEnabled?0:-1);}}function tn(o,t){}function nn(o,t){if(o&1&&(a(0,"my-alert",24)(1,"div"),R(2),l(),x(3,tn,0,0,"ng-template",27),l()),o&2){let e=_(2),n=_e(1);d(2),ie(e.uploadMessages==null?null:e.uploadMessages.autoBlock),d(),m("ngTemplateOutlet",n);}}function on(o,t){o&1&&(a(0,"my-alert",25)(1,"div"),X(2,9),h(3,"strong"),z(),l(),a(4,"div"),X(5,10),h(6,"a",28),z(),l()());}function rn(o,t){o&1&&h(0,"my-channels-setup-message");}function an(o,t){if(o&1&&(a(0,"div"),R(1),l()),o&2){let e=_(3);d(),ie(e.uploadMessages==null?null:e.uploadMessages.quotaLeft);}}function ln(o,t){if(o&1&&(a(0,"div"),R(1),l()),o&2){let e=_(3);d(),ie(e.uploadMessages==null?null:e.uploadMessages.quotaLeftDaily);}}function sn(o,t){}function _n(o,t){if(o&1&&(a(0,"my-alert",26),v(1,an,2,1,"div"),v(2,ln,2,1,"div"),x(3,sn,0,0,"ng-template",27),l()),o&2){let e=_(2),n=_e(1);d(),f(e.hasNoQuotaLeft?1:-1),d(),f(e.hasNoQuotaLeftDaily?2:-1),d(),m("ngTemplateOutlet",n);}}function dn(o,t){if(o&1&&(v(0,nn,4,2,"my-alert",24),v(1,on,7,0,"my-alert",25)(2,rn,1,0,"my-channels-setup-message"),h(3,"my-user-quota"),v(4,_n,4,3,"my-alert",26)),o&2){let e=_();f(e.user.isAutoBlocked(e.serverConfig)?0:-1),d(),f(e.isRootUser()?1:2),d(3),f(e.hasNoQuotaLeft||e.hasNoQuotaLeftDaily?4:-1);}}function pn(o,t){}function cn(o,t){if(o&1&&(a(0,"div",21)(1,"my-alert",29)(2,"div"),R(3),l(),x(4,pn,0,0,"ng-template",27),l(),a(5,"div",30),h(6,"img",31),l()()),o&2){let e=_(),n=_e(1);d(3),ie(e.uploadMessages==null?null:e.uploadMessages.noQuota),d(),m("ngTemplateOutlet",n);}}function un(o,t){}function mn(o,t){if(o&1&&x(0,un,0,0,"ng-template",27),o&2){_(2);let e=_e(3);m("ngTemplateOutlet",e);}}function gn(o,t){if(o&1){let e=P();a(0,"my-video-upload",41,3),C("firstStepDone",function(i){p(e);let r=_(2);return c(r.onFirstStepDone("upload",i));})("firstStepError",function(){p(e);let i=_(2);return c(i.onError());}),l();}if(o&2){let e=_(2);m("userChannels",e.userChannels)("userQuota",e.userQuota)("highestPrivacy",e.highestPrivacy);}}function Cn(o,t){o&1&&(a(0,"a",34)(1,"span"),u(2,12),l()());}function vn(o,t){if(o&1&&(a(0,"div",37)(1,"span"),u(2,13),l(),a(3,"div",42),u(4,14),l(),a(5,"my-help",43),R(6),l()()),o&2){let e=_(2);d(6),be(" Import with URL is not available on ",e.instanceName,". ");}}function fn(o,t){if(o&1){let e=P();a(0,"my-video-import-url",41,4),C("firstStepDone",function(i){p(e);let r=_(2);return c(r.onFirstStepDone("import-url",i));})("firstStepError",function(){p(e);let i=_(2);return c(i.onError());}),l();}if(o&2){let e=_(2);m("userChannels",e.userChannels)("userQuota",e.userQuota)("highestPrivacy",e.highestPrivacy);}}function Sn(o,t){o&1&&(a(0,"a",34)(1,"span"),u(2,15),l()());}function hn(o,t){if(o&1&&(a(0,"div",37)(1,"span"),u(2,16),l(),a(3,"div",42),u(4,17),l(),a(5,"my-help",44),R(6),l()()),o&2){let e=_(2);d(6),be(" Import with torrent is not available on ",e.instanceName,". ");}}function Pn(o,t){if(o&1){let e=P();a(0,"my-video-import-torrent",41,5),C("firstStepDone",function(i){p(e);let r=_(2);return c(r.onFirstStepDone("import-torrent",i));})("firstStepError",function(){p(e);let i=_(2);return c(i.onError());}),l();}if(o&2){let e=_(2);m("userChannels",e.userChannels)("userQuota",e.userQuota)("highestPrivacy",e.highestPrivacy);}}function In(o,t){o&1&&(a(0,"a",34)(1,"span"),u(2,18),l()());}function En(o,t){if(o&1&&(a(0,"div",37)(1,"span"),u(2,19),l(),a(3,"div",42),u(4,20),l(),a(5,"my-help",45),R(6),l()()),o&2){let e=_(2);d(6),be(" Live streaming is not available on ",e.instanceName,". ");}}function Mn(o,t){if(o&1){let e=P();a(0,"my-video-go-live",41,6),C("firstStepDone",function(i){p(e);let r=_(2);return c(r.onFirstStepDone("go-live",i));})("firstStepError",function(){p(e);let i=_(2);return c(i.onError());}),l();}if(o&2){let e=_(2);m("userChannels",e.userChannels)("userQuota",e.userQuota)("highe
1stPrivacy",e.highestPrivacy);}}function On(o,t){if(o&1){let e=P();a(0,"div",21),v(1,mn,1,1,null,27),a(2,"div",32,2),C("activeIdChange",function(i){p(e);let r=_();return c(r.onNavChange(i));}),k(4,33),a(5,"a",34)(6,"span"),u(7,11),l()(),x(8,gn,2,3,"ng-template",35),H(),k(9,36),v(10,Cn,3,0,"a",34)(11,vn,7,1,"div",37),x(12,fn,2,3,"ng-template",35),H(),k(13,38),v(14,Sn,3,0,"a",34)(15,hn,7,1,"div",37),x(16,Pn,2,3,"ng-template",35),H(),k(17,39),v(18,In,3,0,"a",34)(19,En,7,1,"div",37),x(20,Mn,2,3,"ng-template",35),H(),l(),h(21,"div",40),l();}if(o&2){let e=_e(3),n=_();d(),f(n.isInSecondStep()?-1:1),d(),m("activeId",n.activeNav)("ngClass",et(7,Jt,n.isInSecondStep())),d(8),f(n.isVideoImportHttpEnabled()?10:11),d(4),f(n.isVideoImportTorrentEnabled()?14:15),d(4),f(n.isVideoLiveEnabled()?18:19),d(3),m("ngbNavOutlet",e);}}var fe=class fe{auth=s(L);hooks=s(B);serverService=s(D);route=s(w);router=s(ye);manageController=s(N);videoService=s(ue);canDeactivateGuard=s(De);videoUpload=F("videoUpload");videoImportUrl=F("videoImportUrl");videoImportTorrent=F("videoImportTorrent");videoGoLive=F("videoGoLive");user=null;secondStepType;videoName;activeNav;uploadMessages;hasNoQuotaLeft=!1;hasNoQuotaLeftDaily=!1;serverConfig;highestPrivacy;userChannels;userQuota;privacies;publishedIdQuery;uploadingQuery;get isContactFormEnabled(){return this.serverConfig.email.enabled&&this.serverConfig.contactForm.enabled;}get instanceName(){return this.serverConfig.instance.name;}ngOnInit(){let t=this.route.snapshot.data.resolverData,{videoChannels:e,userQuota:n,privacies:i}=t;this.userChannels=e,this.userQuota=n,this.privacies=i,this.user=this.auth.getUser(),this.serverConfig=this.serverService.getHTMLConfig(),this.highestPrivacy=this.videoService.getMostPrivatePrivacy(i),this.route.snapshot.fragment&&this.onNavChange(this.route.snapshot.fragment),this.buildUploadMessages(),this.user.videoQuota!==-1&&n.videoQuotaUsed>this.user.videoQuota*.9&&(this.hasNoQuotaLeft=!0),this.user.videoQuotaDaily!==-1&&n.videoQuotaUsedDaily>this.user.videoQuotaDaily*.9&&(this.hasNoQuotaLeftDaily=!0),this.reset(),this.route.queryParams.subscribe(r=>{r.publishedId?this.publishedIdQuery=r.publishedId:r.uploading?this.uploadingQuery=r.uploading:(this.publishedIdQuery||this.uploadingQuery)&&this.tryToReset();});}tryToReset(){return $(this,null,function*(){let t=[this.videoUpload(),this.videoImportUrl(),this.videoImportTorrent(),this.videoGoLive()];for(let e of t)if(e){if(!(yield this.canDeactivateGuard.canDeactivate(e))){this.publishedIdQuery?this.manageController.silentRedirectOnManage(this.publishedIdQuery,this.route):this.uploadingQuery&&this.manageController.silentRedirectOnUploading(this.route);return;}e.reset();}this.reset();});}reset(){this.secondStepType=void 0,this.videoName=void 0,this.publishedIdQuery=void 0,this.uploadingQuery=void 0,this.manageController.setStore({userChannels:this.userChannels,userQuota:this.userQuota,privacies:this.privacies,videoEdit:void 0});}buildUploadMessages(){return $(this,null,function*(){let t="Sorry, the upload feature is disabled for your account. If you want to add videos, an admin must unlock your quota.",e="Uploaded videos are reviewed before publishing for your account. If you want to add videos without moderation review, an admin must turn off your videos auto-block.",n="Your daily video quota is insufficient. If you want to add more videos, you must wait for 24 hours or an admin must increase your daily quota.",i="Your video quota is insufficient. If you want to add more videos, an admin must increase your quota.",r={noQuota:t,autoBlock:e,quotaLeftDaily:n,quotaLeft:i};this.uploadMessages=yield this.hooks.wrapObject(r,"common","filter:upload.messages.create.result");});}onNavChange(t){this.activeNav=t,this.manageController.setConfig({manageType:t,serverConfig:this.serverConfig}),this.router.navigate([],{fragment:this.activeNav});}onFirstStepDone(t,e){this.secondStepType=t,this.videoName=e;}onError(){this.videoName=void 0,this.secondStepType=void 0;}onUnload(t){let{text:e,canDeactivate:n}=this.canDeactivate();if(!n)return t.returnValue=e,e;}canDeactivate(){return this.secondStepType==="upload"?this.videoUpload().canDeactivate():this.secondStepType==="import-url"?this.videoImportUrl().canDeactivate():this.secondStepType==="import-torrent"?this.videoImportTorrent().canDeactivate():this.secondStepType==="go-live"?this.videoGoLive
1().canDeactivate():{canDeactivate:!0};}isVideoImportHttpEnabled(){return this.serverConfig.import.videos.http.enabled;}isVideoImportTorrentEnabled(){return this.serverConfig.import.videos.torrent.enabled;}isVideoLiveEnabled(){return this.serverConfig.live.enabled;}isInSecondStep(){return!!this.secondStepType;}isRootUser(){return this.user.username==="root";}};I(fe,"\u0275fac",function(e){return new(e||fe)();}),I(fe,"\u0275cmp",U({type:fe,selectors:[["my-video-publish"]],viewQuery:function(e,n){e&1&&le(n.videoUpload,qt,5)(n.videoImportUrl,Yt,5)(n.videoImportTorrent,jt,5)(n.videoGoLive,Kt,5),e&2&&se(4);},hostBindings:function(e,n){e&1&&C("beforeunload",function(r){return n.onUnload(r);},Ze);},decls:6,vars:1,consts:()=>{let t;t="Read instance rules for help";let e;e="Contact us";let n;n="We recommend you to not use the "+"\uFFFD#3\uFFFD"+"root"+"\uFFFD/#3\uFFFD"+" user to publish your videos, since it's the super-admin account of your instance.";let i;i="Instead, "+"\uFFFD#6\uFFFD"+"create a dedicated account"+"\uFFFD/#6\uFFFD"+" to upload your videos.";let r;r="Upload a file";let g;g="Import with URL";let S;S="Feature unavailable";let E;E="Import with URL";let A;A="UNAVAILABLE";let Xe;Xe="Import with torrent";let ze;ze="Feature unavailable";let Qe;Qe="Import with torrent";let We;We="UNAVAILABLE";let qe;qe="Go live";let Ye;Ye="Feature unavailable";let je;je="Go live";let Ke;return Ke="UNAVAILABLE",[["helpButtons",""],["infoMessages",""],["nav","ngbNav"],["videoUpload",""],["videoImportUrl",""],["videoImportTorrent",""],["videoGoLive",""],t,e,n,i,r,g,E,A,Xe,Qe,We,qe,je,Ke,[1,"margin-content"],["routerLink","/about/contact",1,"peertube-button-link","primary-button","mt-3","me-3"],["routerLink","/about/instance",1,"peertube-button-link","primary-button","mt-3"],["type","primary",1,"upload-message","auto-blocked"],["type","warning",1,"upload-message","root-user","root-user","root-user"],["type","warning",1,"upload-message","quota-left"],[3,"ngTemplateOutlet"],["routerLink","/admin/overview/users",1,"text-decoration-underline","alert-link"],["type","warning",1,"upload-message","upload-disabled"],[1,"upload-image"],["src","/client/assets/images/mascot/defeated.svg","alt","defeated mascot"],["ngbNav","",1,"nav-tabs","video-add-nav",3,"activeIdChange","activeId","ngClass"],["ngbNavItem","upload"],["ngbNavLink",""],["ngbNavContent",""],["ngbNavItem","import-url"],[1,"unavailable-nav-link"],["ngbNavItem","import-torrent"],["ngbNavItem","go-live"],[1,"nav-content",3,"ngbNavOutlet"],[3,"firstStepDone","firstStepError","userChannels","userQuota","highestPrivacy"],[1,"pt-badge","badge-secondary","ms-2","me-1"],["helpTitle",S,"container","body"],["helpTitle",ze,"container","body"],["helpTitle",Ye,"container","body"]];},template:function(e,n){e&1&&(x(0,en,3,1,"ng-template",null,0,Fe)(2,dn,5,3,"ng-template",null,1,Fe),v(4,cn,7,2,"div",21)(5,On,22,9,"div",21)),e&2&&(d(4),f(n.user.hasUploadDisabled()?4:5));},dependencies:[Ve,nt,ht,Pt,dt,tt,_t,ct,pt,st,ut,pe,$e,Re,Be,ke,ce],styles:[".upload-message[_ngcontent-%COMP%]{display:block;width:100%;text-align:center;margin-bottom:0}.upload-message[_ngcontent-%COMP%]:last-child{margin-bottom:1rem}.upload-image[_ngcontent-%COMP%]{width:100%;text-align:center}.upload-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{margin-top:2rem;margin-bottom:75px;width:220px;height:auto}[_nghost-%COMP%] .video-add-nav{border-bottom:0 solid #fff;margin:20px 0 0!important}[_nghost-%COMP%] .video-add-nav.hide-nav{display:none!important}[_nghost-%COMP%] .video-add-nav a.nav-link, [_nghost-%COMP%] .video-add-nav .unavailable-nav-link{margin-bottom:0;min-height:40px!important;padding:0 30px!important;border:0 solid transparent}[_nghost-%COMP%] .video-add-nav a.nav-link, [_nghost-%COMP%] .video-add-nav a.nav-link:hover, [_nghost-%COMP%] .video-add-nav a.nav-link:focus, [_nghost-%COMP%] .video-add-nav a.nav-link:active, [_nghost-%COMP%] .video-add-nav .unavailable-nav-link, [_nghost-%COMP%] .video-add-nav .unavailable-nav-link:hover, [_nghost-%COMP%] .video-add-nav .unavailable-nav-link:focus, [_nghost-%COMP%] .video-add-nav .unavailable-nav-link:active{text-decoration:none}
1[_nghost-%COMP%] .video-add-nav a.nav-link:focus:not(:focus-visible), [_nghost-%COMP%] .video-add-nav .unavailable-nav-link:focus:not(:focus-visible){outline:none}[_nghost-%COMP%] .video-add-nav a.nav-link span, [_nghost-%COMP%] .video-add-nav .unavailable-nav-link span{border-bottom:2px solid transparent}[_nghost-%COMP%] .video-add-nav a.nav-link.active, [_nghost-%COMP%] .video-add-nav .unavailable-nav-link.active{border-color:#fff;border-bottom-color:transparent}[_nghost-%COMP%] .video-add-nav a.nav-link.active span, [_nghost-%COMP%] .video-add-nav .unavailable-nav-link.active span{border-bottom-color:var(--border-primary)}[_nghost-%COMP%] .video-add-nav a.nav-link:hover:not(.active), [_nghost-%COMP%] .video-add-nav .unavailable-nav-link:hover:not(.active){border-color:transparent}[_nghost-%COMP%] .video-add-nav{overflow-x:auto;flex-wrap:unset;white-space:nowrap}[_nghost-%COMP%] .video-add-nav a.nav-link.active{background-color:var(--bg-secondary-400)!important}[_nghost-%COMP%] .upload-video-container{border:0 solid #fff;border-top:transparent;background-color:var(--bg-secondary-400);border-bottom-left-radius:3px;border-bottom-right-radius:3px;width:100%;min-height:440px;padding-bottom:20px;display:flex;justify-content:center;padding-top:20px}[_nghost-%COMP%] .upload-video-container.dragover{border:3px dashed var(--primary)}"]}));var He=fe;var oe=class oe{authService=s(L);serverService=s(D);userService=s(Ct);resolve(){return G([lt(this.authService,{includeCollaborations:!0}),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies()]).pipe(re(([t,e,n])=>({videoChannels:t,userQuota:e,privacies:n})));}};I(oe,"\u0275fac",function(e){return new(e||oe)();}),I(oe,"\u0275prov",Je({token:oe,factory:oe.ɵfac}));var Ee=oe;var bn=(0,Nt.default)("peertube:video-publish"),ur=[{path:"",component:He,canActivate:[mt,()=>{let o=new URLSearchParams(window.location.search).get("publishedId"),t=s(ye);if(o){let e=window.location.pathname.match(/^\/videos\/publish\/(.*)$/),n=e?`/${e[1]}`:"";return bn("Redirecting to video manage page",{publishedId:o,match:e,suffixUrl:n}),new it(t.parseUrl(`/videos/manage/${o}${n}`));}return!0;}],canDeactivate:[De],providers:[Ee,N,J,It,Ne,Et,Ue,Ot,ee],resolve:{resolverData:Ee},children:bt}];export{ur 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.