flood
Version:
A modern Web UI for various torrent clients with multi-user and multi-client support
1 lines • 55.9 kB
JavaScript
"use strict";(globalThis.webpackChunkflood=globalThis.webpackChunkflood||[]).push([[662],{3537:(e,t,n)=>{n.d(t,{A:()=>h});var r=n(1083),a=n(5419),s=n.n(a),i=n(7550),l=n(9550),o=n(4930);const{baseURI:c}=l.A,d=e=>{i.A.add({id:"alert.torrent.add.sent",count:e})},u=e=>{i.A.add({id:"alert.torrent.add",type:"success",count:e})},p=e=>{i.A.add({id:"alert.torrent.add.failed",type:"error",count:e})},h={addTorrentsByUrls:e=>r.A.post(`${c}api/torrents/add-urls`,e).then((({data:t})=>{t.length?u(t.length):d(e.urls.length)}),(()=>{p(e.urls.length)})),addTorrentsByFiles:e=>r.A.post(`${c}api/torrents/add-files`,e).then((({data:t})=>{t.length?u(t.length):d(e.files.length)}),(()=>{p(e.files.length)})),createTorrent:e=>r.A.post(`${c}api/torrents/create`,e,{responseType:"blob"}).then((({data:t})=>{s()(t,(e.name||`${Date.now()}`).concat(".torrent")),u(1)}),(()=>{p(1)})),deleteTorrents:e=>r.A.post(`${c}api/torrents/delete`,e).then((()=>i.A.add({id:"alert.torrent.remove",type:"success",count:e.hashes.length})),(()=>i.A.add({id:"alert.torrent.remove.failed",type:"error",count:e.hashes.length}))),checkHash:e=>r.A.post(`${c}api/torrents/check-hash`,e).then((()=>{}),(()=>{})),fetchMediainfo:(e,t)=>r.A.get(`${c}api/torrents/${e}/mediainfo`,{cancelToken:t}).then((e=>e.data)),fetchTorrentContents:e=>r.A.get(`${c}api/torrents/${e}/contents`).then((e=>e.data),(()=>null)),fetchTorrentPeers:e=>r.A.get(`${c}api/torrents/${e}/peers`).then((e=>e.data),(()=>null)),fetchTorrentTrackers:e=>r.A.get(`${c}api/torrents/${e}/trackers`).then((e=>e.data),(()=>null)),getTorrentContentsDataPermalink:(e,t)=>r.A.get(`${l.A.baseURI}api/torrents/${e}/contents/${t.join(",")}/token`).then((n=>`${window.location.protocol}//${window.location.host}${l.A.baseURI}api/torrents/${e}/contents/${t.join(",")}/data?token=${n.data}`)),moveTorrents:e=>r.A.post(`${c}api/torrents/move`,e).then((()=>i.A.add({id:"alert.torrent.move",type:"success",count:e.hashes.length})),(()=>i.A.add({id:"alert.torrent.move.failed",type:"error",count:e.hashes.length}))),reannounce:e=>r.A.post(`${c}api/torrents/reannounce`,e).then((()=>{}),(()=>{})),startTorrents:async e=>{if(e.hashes.length>0)return r.A.post(`${c}api/torrents/start`,e).then((()=>{}),(()=>{}))},stopTorrents:async e=>{if(e.hashes.length>0)return r.A.post(`${c}api/torrents/stop`,e).then((()=>{}),(()=>{}))},setInitialSeeding:e=>r.A.patch(`${c}api/torrents/initial-seeding`,e).then((()=>{}),(()=>{})),setPriority:e=>r.A.patch(`${c}api/torrents/priority`,e).then((()=>{}),(()=>{})),setSequential:e=>r.A.patch(`${c}api/torrents/sequential`,e).then((()=>{}),(()=>{})),setFilePriority:(e,t)=>r.A.patch(`${c}api/torrents/${e}/contents`,t).then((()=>{}),(()=>{})),setTags:e=>r.A.patch(`${c}api/torrents/tags`,e).then((()=>o.A.handleSetTaxonomySuccess()),(()=>{})),setTrackers:e=>r.A.patch(`${c}api/torrents/trackers`,e).then((()=>{}),(()=>{}))}},7820:(e,t,n)=>{n.d(t,{A:()=>u});var r=n(6540),a=n(3160),s=n(7767),i=n(6565),l=n(5767),o=n(9119),c=n(8045),d=n(2445);const u=({mode:e})=>{const{i18n:t}=(0,a.uB)(),n=(0,r.useRef)(null),u=(0,r.useRef)(null),[p,h]=(0,r.useState)(void 0),[m,_]=(0,r.useState)(!1),g=(0,s.Zp)(),b="login"===e;return(0,d.Y)("div",{className:"application__entry-barrier",children:(0,d.Y)(i.Zk,{spacing:"large",children:(0,d.FD)(i.lV,{onSubmit:e=>{e.event.preventDefault(),_(!0);const t=e.formData;if(null==t.username||""===t.username)return _(!1),void h({id:"auth.error.username.empty"});if(null==t.password||""===t.password)return _(!1),void h({id:"auth.error.password.empty"});if(b){const e=t;l.A.authenticate({username:e.username,password:e.password}).then((()=>{_(!1),g("/overview",{replace:!0})})).catch((e=>{_(!1),h(e.message),g("/login",{replace:!0})}))}else{const e=t;if(null==u.current)return _(!1),void h({id:"connection.settings.error.empty"});const n=u.current;if(null==n)return _(!1),void h({id:"connection.settings.error.empty"});l.A.register({username:e.username,password:e.password,client:n,level:o.h.ADMINISTRATOR}).then((()=>{_(!1),g("/overview",{replace:!0})}),(e=>{_(!1),h(e.message)}))}},ref:n,children:[(0,d.Y)(i.aO,{children:(0,d.Y)("h1",{children:b?t._("auth.login"):t._("auth.create.an.account")})}),(0,d.FD)(i.wq,{children:[(0,d.Y)("p",{className:"copy--lead",children:b?t._("auth.login.intro"):t._("auth.create.an.account.intro")}),null!=p?(0,d.Y)(i.fh,{children:(0,d.Y)(i.jQ,{isLoading:m,children:"string"==typeof p?p:t._(p)})}):null,(0,d.Y)(i.fh,{children:(0,d.Y)(i.Rj,{placeholder:t._("auth.username"),id:"username",autoComplete:"username"})}),(0,d.Y)(i.fh,{children:(0,d.Y)(i.Rj,{placeholder:t._("auth.password"),id:"password",type:"password",autoComplete:b?"current-password":"new-password"})})]}),b?null:(0,d.Y)(i.wq,{hasBorder:!0,children:(0,d.Y)(c.A,{onSettingsChange:e=>{u.current=e}})}),(0,d.Y)(i.WH,{hasBorder:!0,children:(0,d.FD)(i.fh,{justify:"end",children:[(0,d.Y)(i.$n,{priority:"tertiary",onClick:()=>{null!=n.current&&n.current.resetForm()},children:t._("auth.input.clear")}),(0,d.Y)(i.$n,{isLoading:m,type:"submit",children:b?t._("auth.log.in"):t._("auth.create.account")})]})})]})})})}},6541:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(2445);const a=({children:e})=>(0,r.Y)("div",{className:"badge",children:e})},3230:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(3160),a=n(2445);const s=e=>{const{suffix:t,value:n}=e;if(null==n)return null;let s=null,i=null;t&&(i=(0,a.Y)("span",{className:"duration--segment",children:t}));const l=-1===n?-1:(e=>{const t=Math.floor(e/31536e3),n=Math.floor(e%31536e3/604800),r=Math.floor(e%31536e3%604800/86400),a=Math.floor(e%31536e3%604800%86400/3600),s=Math.floor(e%31536e3%604800%86400%3600/60),i=Math.floor(e-60*s);let l=null;return l=t>0?{years:t,weeks:n,cumSeconds:e}:n>0?{weeks:n,days:r,cumSeconds:e}:r>0?{days:r,hours:a,cumSeconds:e}:a>0?{hours:a,minutes:s,cumSeconds:e}:s>0?{minutes:s,seconds:i,cumSeconds:e}:{seconds:i,cumSeconds:e},l})(n);return s=-1===l?(0,a.Y)(r.x6,{id:"unit.time.infinity"}):null!=l.years&&l.years>0?[(0,a.FD)("span",{className:"duration--segment",children:[l.years,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.year"})})]},"years"),(0,a.FD)("span",{className:"duration--segment",children:[l.weeks,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.week"})})]},"weeks")]:null!=l.weeks&&l.weeks>0?[(0,a.FD)("span",{className:"duration--segment",children:[l.weeks,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.week"})})]},"weeks"),(0,a.FD)("span",{className:"duration--segment",children:[l.days,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.day"})})]},"days")]:null!=l.days&&l.days>0?[(0,a.FD)("span",{className:"duration--segment",children:[l.days,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.day"})})]},"days"),(0,a.FD)("span",{className:"duration--segment",children:[l.hours,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.hour"})})]},"hours")]:null!=l.hours&&l.hours>0?[(0,a.FD)("span",{className:"duration--segment",children:[l.hours,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.hour"})})]},"hours"),(0,a.FD)("span",{className:"duration--segment",children:[l.minutes,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.minute"})})]},"minutes")]:null!=l.minutes&&l.minutes>0?[(0,a.FD)("span",{className:"duration--segment",children:[l.minutes,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.minute"})})]},"minutes"),(0,a.FD)("span",{className:"duration--segment",children:[l.seconds,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.second"})})]},"seconds")]:(0,a.FD)("span",{className:"duration--segment",children:[l.seconds,(0,a.Y)("em",{className:"unit",children:(0,a.Y)(r.x6,{id:"unit.time.second"})})]}),(0,a.FD)("span",{className:"duration",children:[s,i]})};s.defaultProps={suffix:void 0};const i=s},9689:(e,t,n)=>{n.d(t,{A:()=>c});var r=n(6540),a=n(3160);const s={file:{0:"DONT_DOWNLOAD",1:"NORMAL",2:"HIGH"},torrent:{0:"DONT_DOWNLOAD",1:"LOW",2:"NORMAL",3:"HIGH"}};var i=n(2445);var l={name:"1gxvag8",styles:":focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"};const o=({id:e,level:t,maxLevel:n,priorityType:o,showLabel:c,clickHandled:d,changePriorityFuncRef:u,onChange:p})=>{const{i18n:h}=(0,a.uB)(),[m,_]=(0,r.useState)(t),g=()=>{let t=m;return t>=n?t=0:t+=1,_(t),p(e,t),t};let b;if(null!=u&&(u.current=g),c){let e;switch(s[o][m]){case"DONT_DOWNLOAD":e=h._("priority.dont.download");break;case"HIGH":e=h._("priority.high");break;case"LOW":e=h._("priority.low");break;default:e=h._("priority.normal")}b=(0,i.Y)("span",{className:"priority-meter__label",children:e})}const f=(0,i.Y)("div",{className:`priority-meter priority-meter--max-${n} priority-meter--level-${m}`}),v=l;return d?(0,i.FD)("div",{className:"priority-meter__wrapper",css:v,children:[f,b]}):(0,i.FD)("button",{className:"priority-meter__wrapper",css:v,type:"button",onClick:()=>{g()},children:[f,b]})};o.defaultProps={showLabel:!1,clickHandled:!1,changePriorityFuncRef:void 0};const c=o},1915:(e,t,n)=>{n.d(t,{A:()=>c});var r=n(4015),a=n(6540),s=n(942),i=n(2445);const l=(0,a.memo)((({status:e})=>{switch(e){case"error":return(0,i.Y)(s.$D,{});case"checking":return(0,i.Y)(s.y$,{});case"downloading":case"seeding":return(0,i.Y)(s.fe,{});default:return(0,i.Y)(s.VG,{})}})),o=(0,r.PA)((({percent:e,status:t})=>(0,i.FD)("div",{className:"progress-bar",children:[(0,i.Y)("div",{className:"progress-bar__icon",children:t&&(0,i.Y)(l,{status:t})}),(0,i.Y)("div",{className:"progress-bar__fill__wrapper",children:(0,i.Y)("div",{className:"progress-bar__fill",style:{width:`${e}%`}})})]})));o.defaultProps={status:void 0};const c=o},7189:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(3160),a=n(7458),s=n(2445);const i=({value:e,isSpeed:t,className:n,precision:i})=>{const l=(0,a.O)(e,i),{i18n:o}=(0,r.uB)();let c=o._((0,a.b)(l.unit));return t&&(c=o._("unit.speed",{baseUnit:c})),(0,s.FD)("span",{className:n,children:[Number.isNaN(l.value)?"—":o.number(l.value),(0,s.Y)("em",{className:"unit",children:c})]})};i.defaultProps={isSpeed:!1,precision:2,className:void 0};const l=i},6975:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(6942),a=n.n(r),s=n(2445);const i=e=>{const{children:t,modifier:n}=e,r=a()("application__view",{[`application__view--${n}`]:null!=n});return(0,s.Y)("div",{className:r,children:t})};i.defaultProps={modifier:void 0};const l=i},1693:(e,t,n)=>{n.d(t,{A:()=>r});const r={start:"torrents.list.context.start",stop:"torrents.list.context.stop",remove:"torrents.list.context.remove",checkHash:"torrents.list.context.check.hash",reannounce:"torrents.list.context.reannounce",setTaxonomy:"torrents.list.context.set.tags",move:"torrents.list.context.move",setTrackers:"torrents.list.context.set.trackers",torrentDetails:"torrents.list.context.details",downloadContents:"torrents.list.context.download.contents",downloadMetainfo:"torrents.list.context.download.metainfo",generateMagnet:"torrents.list.context.generate.magnet",setInitialSeeding:"torrents.list.context.initial.seeding",setSequential:"torrents.list.context.sequential",setPriority:"torrents.list.context.priority"}},2607:(e,t,n)=>{n.d(t,{A:()=>r});const r={dateAdded:"torrents.properties.date.added",dateFinished:"torrents.properties.date.finished",downRate:"torrents.properties.download.speed",downTotal:"torrents.properties.download.total",eta:"torrents.properties.eta",name:"torrents.properties.name",peers:"torrents.properties.peers",percentComplete:"torrents.properties.percentage",ratio:"torrents.properties.ratio",seeds:"torrents.properties.seeds",sizeBytes:"torrents.properties.size",tags:"torrents.properties.tags",upRate:"torrents.properties.upload.speed",upTotal:"torrents.properties.upload.total",dateCreated:"torrents.properties.date.created",directory:"torrents.properties.directory",hash:"torrents.properties.hash",isPrivate:"torrents.properties.is.private",message:"torrents.properties.tracker.message",trackerURIs:"torrents.properties.trackers"}},2428:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});var r=n(6975),a=n(7820),s=n(2445);const i=()=>(0,s.Y)(r.A,{modifier:"auth-form",children:(0,s.Y)(a.A,{mode:"login"})})},9472:(e,t,n)=>{n.r(t),n.d(t,{default:()=>$t});var r=n(6540),a=n(6942),s=n.n(a),i=n(4015),l=n(3160),o=n(942),c=n(9075),d=n(2412),u=n(3537),p=n(484),h=n(4930),m=n(2189),_=n(2445);const g=e=>{const{clickHandler:t,icon:n,label:r,slug:a,noTip:i}=e,l=s()("action tooltip__wrapper",{[`action--${a}`]:null!=a});return(0,_.FD)(m.A,{content:r,onClick:t,position:"bottom",wrapperClassName:l,suppress:i,children:[n,(0,_.Y)("span",{className:"action__label",children:r})]})};g.defaultProps={noTip:!1};const b=g,f={dateAdded:"desc",dateFinished:"desc",downRate:"desc",downTotal:"desc",upRate:"desc",upTotal:"desc"};var v=n(6488),A=n(2618),Y=n(7200),y=n.n(Y),w=n(9679);var N={name:"140xmhl",styles:"width:100%;height:100%;text-align:left;:focus-visible{outline:dashed;}"};const k=({className:e,label:t,isFocusHandled:n,onClick:r})=>n?(0,_.Y)("div",{role:"none",className:e,onClick:r,children:t}):(0,_.Y)("button",{type:"button",className:e,css:N,onClick:r,children:t});k.defaultProps={className:void 0};const C=(0,i.PA)((({baseClassName:e,dropdownWrapperClass:t,dropdownButtonClass:n,dropdownClickRef:a,direction:i,header:l,matchButtonWidth:o,menuItems:c,noWrap:d,trigger:u,width:p,isFocusHandled:m,handleItemSelect:g,onOpen:b})=>{const f=(0,r.useRef)(y()("dropdown_")),Y=h.A.activeDropdownMenu===f.current,N=s()(t,`${e}--direction-${i}`,{[`${e}--match-button-width`]:o,[`${e}--width-${p}`]:null!=p,[`${e}--no-wrap`]:d,"is-expanded":Y}),C=(0,r.useCallback)((()=>{window.removeEventListener("click",C),h.A.setActiveDropdownMenu(null)}),[]);(0,w.A)("Escape",(()=>C()));const D=(0,r.useCallback)((()=>{window.addEventListener("click",C),b&&b(),h.A.setActiveDropdownMenu(f.current)}),[C,b]),x=e=>{e?.stopPropagation(),Y?C():D()};let S;if(a&&(a.current=x),Y){const e=(0,_.Y)("div",{className:"dropdown__header",children:(0,_.Y)(k,{className:n,label:l,isFocusHandled:m??!1,onClick:x})},"dropdown-header"),t=(0,_.Y)("ul",{className:"dropdown__items",children:c.map(((e,t)=>(0,_.Y)("div",{className:"dropdown__list",children:e.map(((e,t)=>{const n=s()("dropdown__item menu__item",e.className,{"is-selectable":!1!==e.selectable,"is-selected":e.selected});return(0,_.Y)("li",{className:n,children:(0,_.Y)("button",{type:"button",disabled:!1===e.selectable,onClick:!1===e.selectable?void 0:()=>{C(),g(e)},children:e.displayName})},t)}))},t)))},"dropdown-items");S=(0,_.Y)(v.A,{classNames:"menu",timeout:{enter:250,exit:250},children:(0,_.Y)("div",{className:"dropdown__content menu",children:"up"===i?[t,e]:[e,t]})})}return(0,_.FD)("div",{className:N,children:[(0,_.Y)(k,{className:n,label:u??l,isFocusHandled:m??!1,onClick:x}),(0,_.Y)(A.A,{children:S})]})}));C.defaultProps={baseClassName:"dropdown",direction:"down",dropdownWrapperClass:"dropdown",dropdownButtonClass:"dropdown__trigger",matchButtonWidth:!1,noWrap:!1,isFocusHandled:!1};const D=C;var x=n(2607);const S=["name","eta","downRate","upRate","ratio","percentComplete","downTotal","upTotal","sizeBytes","dateAdded","dateFinished"],T=e=>{const{direction:t,selectedProperty:n,onSortChange:r}=e,{i18n:a}=(0,l.uB)();if(null==n)return null;const s=(0,_.FD)("div",{className:"dropdown__button",children:[(0,_.Y)("span",{className:"dropdown__label",children:(0,_.Y)(l.x6,{id:"torrents.sort.title"})}),(0,_.Y)("span",{className:"dropdown__value",children:(0,_.Y)(l.x6,{id:x.A[n]})})]}),i=[S.map((e=>{const r=e===n,s=r?(0,_.Y)("span",{className:`sort-dropdown__indicator sort-dropdown__indicator--${t}`}):null;return{displayName:(0,_.FD)("div",{className:"sort-dropdown__item",children:[a._(x.A[e]),s]}),selected:r,property:e}}))];return(0,_.Y)(D,{handleItemSelect:e=>{const{property:a}=e;if(null==a)return;let s=f[a]??"asc";n===a&&(s="asc"===t?"desc":"asc"),r({direction:s,property:a})},header:s,menuItems:i})},F=(0,i.PA)((()=>{const{i18n:e}=(0,l.uB)(),{sortTorrents:t,torrentListViewSize:n}=d.A.floodSettings,r=s()("action-bar",{"action-bar--is-condensed":"condensed"===n});return(0,_.FD)("nav",{className:r,children:[(0,_.Y)("div",{className:"actions action-bar__item action-bar__item--sidebar-expand-collapse",children:(0,_.Y)(b,{label:"actionbar.button.sidebar.expand.collapse",slug:"sidebar-expand-collapse",icon:(0,_.Y)(o.W1,{}),clickHandler:()=>{const e=document.getElementsByClassName("application__view")[0];null!=e&&e.classList.toggle("application__view--sidebar-alternative-state")},noTip:!0})}),(0,_.Y)("div",{className:"actions action-bar__item action-bar__item--sort-torrents",children:(0,_.Y)(T,{direction:null!=t?t.direction:"desc",onSortChange:e=>{c.A.saveSetting("sortTorrents",e)},selectedProperty:null!=t?t.property:"dateAdded"})}),(0,_.FD)("div",{className:"actions action-bar__item action-bar__item--torrent-operations",children:[(0,_.FD)("div",{className:"action-bar__group",children:[(0,_.Y)(b,{label:e._("actionbar.button.start.torrent"),slug:"start-torrent",icon:(0,_.Y)(o.fe,{}),clickHandler:()=>u.A.startTorrents({hashes:p.A.selectedTorrents})}),(0,_.Y)(b,{label:e._("actionbar.button.stop.torrent"),slug:"stop-torrent",icon:(0,_.Y)(o.VG,{}),clickHandler:()=>u.A.stopTorrents({hashes:p.A.selectedTorrents})})]}),(0,_.FD)("div",{className:"action-bar__group action-bar__group--has-divider",children:[(0,_.Y)(b,{label:e._("actionbar.button.add.torrent"),slug:"add-torrent",icon:(0,_.Y)(o.OM,{}),clickHandler:()=>h.A.setActiveModal({id:"add-torrents"})}),(0,_.Y)(b,{label:e._("actionbar.button.remove.torrent"),slug:"remove-torrent",icon:(0,_.Y)(o.n$,{}),clickHandler:()=>h.A.setActiveModal({id:"remove-torrents"})})]})]})]})})),R=({children:e})=>(0,_.Y)("div",{className:"application__content",children:e}),$=e=>{const{children:t,baseClassName:n,className:r,modifier:a}=e,i=s()(n,{[`${n}--${a}`]:n,[r]:r});return(0,_.Y)("div",{className:i,children:t})};$.defaultProps={baseClassName:"application__panel"};const P=$;var M=n(6975),H=n(8851),B=n(1966),L=n(6816),E=n(7189),I=n(1915);const O=({label:e,value:t})=>(0,_.FD)("li",{"aria-label":"label",className:"diskusage__details-list__item",role:"cell",children:[(0,_.Y)("span",{className:"diskusage__details-list__label",children:e}),(0,_.Y)(E.A,{className:"diskuage__size-used",value:t})]});var z={name:"1ll9bqd",styles:"cursor:default"};const W=(0,i.PA)((()=>{const{i18n:e}=(0,l.uB)(),{disks:t}=L.A,{mountPoints:n}=d.A.floodSettings;if(null==t||null==n)return null;const r=t.reduce(((e,t)=>({...e,[t.target]:t})),{}),a=n.filter((e=>e in r)).map((e=>r[e])).map((t=>(0,_.Y)("li",{className:"sidebar-filter__item sidebar__diskusage",role:"row",children:(0,_.FD)(m.A,{content:(0,_.FD)("ul",{className:"diskusage__details-list",role:"tooltip",children:[(0,_.Y)(O,{value:t.used,label:e._("status.diskusage.used")}),(0,_.Y)(O,{value:t.avail,label:e._("status.diskusage.free")}),(0,_.Y)(O,{value:t.size,label:e._("status.diskusage.total")})]}),position:"top",styles:z,wrapperClassName:"diskusage__item",children:[(0,_.FD)("div",{className:"diskusage__text-row",children:[t.target,(0,_.FD)("span",{children:[Math.round(100*t.used/t.size),"%"]})]}),(0,_.Y)(I.A,{percent:Math.round(100*t.used/t.size)})]})},t.target)));if(null==a||0===a.length)return null;const s=e._("status.diskusage.title");return(0,_.FD)("ul",{"aria-label":s,className:"sidebar-filter sidebar__item",role:"table",children:[(0,_.Y)("li",{className:"sidebar-filter__item sidebar-filter__item--heading",children:s}),a]})})),G=()=>{const{i18n:e}=(0,l.uB)(),t=(0,r.useRef)(null);return(0,_.Y)(m.A,{content:e._("sidebar.button.feeds"),onClick:()=>{null!=t.current&&t.current.dismissTooltip(),h.A.setActiveModal({id:"feeds"})},ref:t,position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button sidebar__icon-button--interactive tooltip__wrapper",children:(0,_.Y)(o.JY,{})})};var U=n(5504),q=n(6541);const j=({children:e,name:t,icon:n,isActive:a,slug:i,count:c,size:d,handleClick:u})=>{const p=(0,r.createRef)(),h=(e=>{const[t,n]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{if(e.current){const{current:t}=e;n(t.scrollWidth>t.clientWidth)}}),[e,e?.current?.scrollWidth,e?.current?.clientWidth]),t})(p),{i18n:m}=(0,l.uB)(),[g,b]=(0,r.useState)(!1),f=s()("sidebar-filter__item",{"is-active":a}),v=s()("sidebar-filter__expander",{"is-active":a,expanded:g}),A=e?{display:"flex"}:{},Y={":focus":{outline:"none",WebkitTapHighlightColor:"transparent"}};let y=t;if(""===y)y=m._("filter.all");else if("untagged"===y){if(0===c)return null;y=m._("filter.untagged")}return"checking"!==i&&"error"!==i||0!==c?(0,_.FD)("li",{children:[(0,_.FD)("div",{css:A,children:[e&&(0,_.Y)("button",{className:v,css:Y,type:"button",onClick:()=>b(!g),role:"switch","aria-checked":g,children:(0,_.Y)(o.fe,{})}),(0,_.FD)("button",{className:f,css:Y,type:"button",onClick:e=>u(i,e),role:"menuitem",children:[n,(0,_.Y)("span",{className:"name",ref:p,title:h?y||"":void 0,children:y}),(0,_.Y)(q.A,{children:c}),null!=d&&(0,_.Y)(E.A,{value:d,className:"size"})]})]}),e&&g&&(0,_.Y)("ul",{className:"sidebar-filter__nested",children:e})]}):null};j.defaultProps={icon:void 0,size:void 0};const K=j;var V=n(9399);const X=e=>{if(1===e.children.length&&e.containedCount===e.children[0].containedCount){const t=e.children[0],n=t.fullPath.includes("/")?"/":"\\";return X({...t,directoryName:e.directoryName+n+t.directoryName})}const t=e.children.map(X);return(0,_.Y)(K,{handleClick:(e,t)=>V.A.setLocationFilters(e,t),count:e.containedCount,isActive:""===e.fullPath&&!V.A.locationFilter.length||V.A.locationFilter.includes(e.fullPath),name:e.directoryName,slug:e.fullPath,size:e.containedSize,children:t.length&&t||void 0},e.fullPath)},J=(0,i.PA)((()=>{const{i18n:e}=(0,l.uB)();if(0===V.A.taxonomy.locationTree.containedCount)return null;const t=X(V.A.taxonomy.locationTree),n=e._("filter.location.title");return(0,_.FD)("ul",{"aria-label":n,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.Y)("li",{className:"sidebar-filter__item sidebar-filter__item--heading",role:"none",children:n}),t]})}));var Q=n(6289);const Z=10,ee=e=>H.A.fetchNotifications({id:"notification-tooltip",limit:Z,start:e}),te=({paginationStart:e,notificationTotal:t})=>{const{i18n:n}=(0,l.uB)();if(t>Z){let r=e+1,a=e+Z;return r>t&&(r=t),a>t&&(a=t),(0,_.Y)("div",{className:"toolbar toolbar--dark toolbar--top tooltip__toolbar tooltip__content--padding-surrogate",children:(0,_.FD)("span",{className:"toolbar__item toolbar__item--label",children:[`${n._("notification.showing")} `,(0,_.FD)("strong",{children:[r,` ${n._("general.to")} `,a]}),` ${n._("general.of")} `,(0,_.Y)("strong",{children:t})]})})}return null},ne=({notification:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.FD)("li",{className:"notifications__list__item",children:[(0,_.FD)("div",{className:"notification__heading",children:[(0,_.Y)("span",{className:"notification__category",children:t._(`${e.id}.heading`)})," — ",(0,_.Y)("span",{className:"notification__timestamp",children:t.date(new Date(e.ts),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"})})]}),(0,_.Y)("div",{className:"notification__message",children:t._(`${e.id}.body`,e.data)})]})},re=({paginationStart:e,notificationTotal:t,onPrevClick:n,onClearClick:r,onNextClick:a})=>{const{i18n:i}=(0,l.uB)();if(t>0){let l=e+20,c=e-Z;return l>t&&(l=t),c<0&&(c=0),(0,_.FD)("ul",{className:"notifications__toolbar toolbar toolbar--dark toolbar--bottom",children:[(0,_.Y)("li",{className:s()("toolbar__item toolbar__item--button",{"is-disabled":0===e}),children:(0,_.FD)("button",{className:"tooltip__content--padding-surrogate",type:"button",onClick:n,children:[(0,_.Y)(o.JG,{}),`${c+1} - ${e}`]})}),(0,_.Y)("li",{className:"toolbar__item toolbar__item--button",children:(0,_.Y)("button",{className:"tooltip__content--padding-surrogate",type:"button",onClick:r,children:i._("notification.clear.all")})}),(0,_.Y)("li",{className:s()("toolbar__item toolbar__item--button",{"is-disabled":e+Z>=t}),children:(0,_.FD)("button",{className:"tooltip__content--padding-surrogate",type:"button",onClick:a,children:[`${e+Z+1} - ${l}`,(0,_.Y)(o.c_,{})]})})]})}return null},ae=(0,i.PA)((()=>{const{i18n:e}=(0,l.uB)(),t=(0,r.useRef)(null),n=(0,r.useRef)(null),[a,i]=(0,r.useState)(!1),[c,d]=(0,r.useState)(0),[u,p]=(0,r.useState)(0),{hasNotification:h,notifications:g,notificationCount:b}=Q.A;return(0,r.useEffect)((()=>{b.total>0&&t.current?.isOpen()&&(i(!0),ee(c).finally((()=>i(!1))))}),[b,c]),(0,_.FD)(m.A,{contentClassName:"tooltip__content tooltip__content--no-padding",content:h?(0,_.FD)("div",{className:s()("notifications",{"notifications--is-loading":a}),children:[(0,_.Y)(te,{paginationStart:c,notificationTotal:b.total}),(0,_.Y)("div",{className:"notifications__loading-indicator",children:(0,_.Y)(o.mY,{})}),(0,_.Y)("ul",{className:"notifications__list tooltip__content--padding-surrogate",ref:n,style:{minHeight:u},children:g.map(((e,t)=>(0,_.Y)(ne,{notification:e},t)))}),(0,_.Y)(re,{paginationStart:c,notificationTotal:b.total,onPrevClick:()=>{const e=c-Z;e>=0&&(p(n.current?.clientHeight||0),d(e))},onClearClick:()=>{null!=t.current&&t.current.dismissTooltip(),H.A.clearNotifications(),p(0),d(0)},onNextClick:()=>{const e=c+Z;b.total>e&&(p(n.current?.clientHeight||0),d(e))}})]}):(0,_.Y)("div",{className:"notifications tooltip__content--padding-surrogate",style:{textAlign:"center"},children:e._("notification.no.notification")}),interactive:!0,onOpen:()=>ee(c),ref:t,width:340,position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button tooltip__wrapper",children:[(0,_.Y)(o.Eg,{}),h?(0,_.Y)("span",{className:"notifications__badge",children:b.total}):null]})})),se=(0,i.PA)((()=>{const{i18n:e}=(0,l.uB)(),t=(0,r.useRef)(null),{searchFilter:n}=V.A;(0,r.useEffect)((()=>{null!=t.current&&n!==t.current.value&&(t.current.value=n)}),[t,n]);const a=""!==n;return(0,_.FD)("div",{className:s()({sidebar__item:!0,search:!0,"is-in-use":a}),children:[a&&(0,_.Y)("button",{className:"button search__reset-button",onClick:()=>{V.A.setSearchFilter(""),null!=t.current&&t.current.blur()},type:"button",children:(0,_.Y)(o.bm,{})}),(0,_.Y)(o.vj,{}),(0,_.Y)("input",{className:"textbox",ref:t,type:"text",placeholder:e._("sidebar.search.placeholder"),onChange:e=>{V.A.setSearchFilter(e.target.value)}})]})})),ie=()=>{const{i18n:e}=(0,l.uB)(),t=(0,r.useRef)(null);return(0,_.Y)(m.A,{content:e._("sidebar.button.settings"),onClick:()=>{null!=t.current&&t.current.dismissTooltip(),h.A.setActiveModal({id:"settings"})},ref:t,position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button sidebar__icon-button--interactive tooltip__wrapper",children:(0,_.Y)(o.wB,{})})},le=({children:e})=>(0,_.Y)("div",{className:"sidebar__actions",children:e});var oe=n(9107),ce=n.n(oe),de=n(8440);const ue=({bytes:e})=>0===e?(0,_.Y)(l.x6,{id:"speed.unlimited"}):(0,_.Y)(E.A,{value:e,isSpeed:!0,precision:1}),pe=({i18n:e,direction:t,speedLimits:n,throttleGlobalDownSpeed:r,throttleGlobalUpSpeed:a})=>{const s={className:`dropdown__label dropdown__label--${t}`,..."download"===t?{displayName:e._("sidebar.speedlimits.download")}:{displayName:e._("sidebar.speedlimits.upload")},selectable:!1,value:null},i={download:r,upload:a},l=n[t];let o=!0;const c=l.map((e=>{let n=!1;return i&&i[t]===e&&(n=!0,o=!1),{displayName:(0,_.Y)(ue,{bytes:e}),property:t,selected:n,selectable:!0,value:e}}));if(o&&i){const e=ce()(l,i[t]);c.splice(e,0,{displayName:(0,_.Y)(ue,{bytes:i[t]}),property:t,selected:!0,selectable:!0,value:i[t]})}return c.unshift(s),c},he=(0,i.PA)((()=>{const{i18n:e}=(0,l.uB)(),t=(0,r.useRef)(null),n=(0,r.useRef)((()=>{})),a=e._("sidebar.button.speedlimits"),s={i18n:e,speedLimits:d.A.floodSettings.speedLimits,throttleGlobalDownSpeed:d.A.clientSettings?.throttleGlobalDownSpeed??0,throttleGlobalUpSpeed:d.A.clientSettings?.throttleGlobalUpSpeed??0};return(0,_.Y)(D,{dropdownClickRef:n,dropdownWrapperClass:"dropdown dropdown--speed-limits sidebar__action",handleItemSelect:e=>{null!=e.value&&("download"===e.property?de.A.saveSetting("throttleGlobalDownSpeed",e.value):"upload"===e.property&&de.A.saveSetting("throttleGlobalUpSpeed",e.value))},header:(0,_.FD)("div",{className:"sidebar__icon-button sidebar__icon-button--interactive sidebar__icon-button--limits",title:a,children:[(0,_.Y)(o.xu,{}),a]}),menuItems:[pe({direction:"download",...s}),pe({direction:"upload",...s})],onOpen:()=>{null!=t.current&&t.current.dismissTooltip()},trigger:(0,_.Y)(m.A,{content:a,position:"bottom",ref:t,wrapperClassName:"sidebar__icon-button tooltip__wrapper",onClick:()=>n.current?.(),children:(0,_.Y)(o.xu,{})}),isFocusHandled:!0})}));var me={name:"zlw20a",styles:"transform:scaleY(-1)"};const _e=({children:e,className:t,expanded:n,handleClick:r})=>(0,_.FD)("button",{className:t,onClick:e=>r(e),children:[e,n?(0,_.Y)(o.cL,{css:me}):(0,_.Y)(o.cL,{})]});_e.defaultProps={className:void 0};const ge=_e,be=(0,i.PA)((()=>{const{i18n:e}=(0,l.uB)(),t=[{label:e._("filter.all"),slug:"",icon:(0,_.Y)(o.u8,{})},{label:e._("filter.status.downloading"),slug:"downloading",icon:(0,_.Y)(o.QH,{})},{label:e._("filter.status.seeding"),slug:"seeding",icon:(0,_.Y)(o.H8,{})},{label:e._("filter.status.checking"),slug:"checking",icon:(0,_.Y)(o.y$,{})},{label:e._("filter.status.completed"),slug:"complete",icon:(0,_.Y)(o.AY,{})},{label:e._("filter.status.stopped"),slug:"stopped",icon:(0,_.Y)(o.VG,{})},{label:e._("filter.status.active"),slug:"active",icon:(0,_.Y)(o.RZ,{})},{label:e._("filter.status.inactive"),slug:"inactive",icon:(0,_.Y)(o.Up,{})},{label:e._("filter.status.error"),slug:"error",icon:(0,_.Y)(o.$D,{})}].map((e=>(0,_.Y)(K,{handleClick:(e,t)=>V.A.setStatusFilters(e,t),count:V.A.taxonomy.statusCounts[e.slug]||0,icon:e.icon,isActive:""===e.slug&&!V.A.statusFilter.length||V.A.statusFilter.includes(e.slug),name:e.label,slug:e.slug},e.slug))),n=e._("filter.status.title"),[a,s]=(0,r.useState)(!0);return(0,_.FD)("ul",{"aria-label":n,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.Y)("li",{className:"sidebar-filter__item",role:"none",children:(0,_.Y)(ge,{className:"sidebar-filter__item--heading",expanded:a,handleClick:()=>{s(!a)},children:n})}),a&&t]})})),fe=(0,i.PA)((()=>{const{i18n:e}=(0,l.uB)(),[t,n]=(0,r.useState)(!0),a=Object.keys(V.A.taxonomy.tagCounts);if(1===a.length&&""===a[0]||2===a.length&&"untagged"===a[1])return null;const s=a.slice().sort(((e,t)=>""===e||"untagged"===e?-1:""===t||"untagged"===t?1:e.localeCompare(t))).map((e=>(0,_.Y)(K,{handleClick:(e,t)=>V.A.setTagFilters(e,t),count:V.A.taxonomy.tagCounts[e]||0,isActive:""===e&&!V.A.tagFilter.length||V.A.tagFilter.includes(e),name:e,slug:e,size:V.A.taxonomy.tagSizes[e]},e))),i=e._("filter.tag.title");return(0,_.FD)("ul",{"aria-label":i,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.Y)("li",{className:"sidebar-filter__item",role:"none",children:(0,_.Y)(ge,{className:"sidebar-filter__item--heading",expanded:t,handleClick:()=>{n(!t)},children:i})}),t&&s]})}));var ve=n(9550);const Ae=()=>{const{i18n:e}=(0,l.uB)();return(0,_.Y)(m.A,{content:e._(ve.A.isPreferDark?"sidebar.button.theme.light":"sidebar.button.theme.dark"),onClick:()=>ve.A.setUserPreferDark(!ve.A.isPreferDark),position:"bottom",wrapperClassName:"sidebar__action sidebar__icon-button sidebar__icon-button--interactive tooltip__wrapper",children:(0,_.Y)(o.oy,{})})},Ye=(0,i.PA)((()=>{const{i18n:e}=(0,l.uB)(),[t,n]=(0,r.useState)(!0),a=Object.keys(V.A.taxonomy.trackerCounts);if(1===a.length&&""===a[0])return null;const s=a.slice().sort(((e,t)=>""===e?-1:""===t?1:e.localeCompare(t))).map((e=>(0,_.Y)(K,{handleClick:(e,t)=>V.A.setTrackerFilters(e,t),count:V.A.taxonomy.trackerCounts[e]||0,isActive:""===e&&!V.A.trackerFilter.length||V.A.trackerFilter.includes(e),name:e,slug:e,size:V.A.taxonomy.trackerSizes[e]},e))),i=e._("filter.tracker.title");return(0,_.FD)("ul",{"aria-label":i,className:"sidebar-filter sidebar__item",role:"menu",children:[(0,_.Y)("li",{className:"sidebar-filter__item",role:"none",children:(0,_.Y)(ge,{className:"sidebar-filter__item--heading",expanded:t,handleClick:()=>{n(!t)},children:i})}),t&&s]})}));var ye=n(1304),we=n(6307),Ne=n(4669),ke=n(3230);const Ce={download:(0,_.Y)(o.f5,{}),infinity:(0,_.Y)(o.Qt,{}),upload:(0,_.Y)(o._O,{})},De=(0,i.PA)((({inspectorPoint:e})=>{const{i18n:t}=(0,l.uB)(),n=(n,r={})=>{const{throttleGlobalDownSpeed:a=0,throttleGlobalUpSpeed:i=0}=d.A.clientSettings||{},{transferSummary:l}=Ne.A,o={download:a,upload:i},c={download:l.downTotal,upload:l.upTotal};let u={download:l.downRate,upload:l.upRate};null!=e&&(u={upload:e.upload,download:e.download});const p=s()("client-stats__rate__data--secondary",{"is-visible":null==e&&we.A.isConnected}),h=s()("client-stats__rate__data--timestamp",{"is-visible":null!=e&&r.showHoverDuration});let m=null;null!=e?.timestamp&&(m=(0,_.Y)("div",{className:h,children:(0,_.Y)(ke.A,{suffix:t._("general.ago"),value:Math.trunc((Date.now()-e.timestamp)/1e3)})}));let g=null;return g=0===o[n]?Ce.infinity:(0,_.Y)(E.A,{value:o[n],isSpeed:!0}),(0,_.FD)("div",{className:`client-stats__rate client-stats__rate--${n}`,children:[(0,_.Y)("div",{className:"client-stats__rate__icon",children:Ce[n]}),(0,_.FD)("div",{className:"client-stats__rate__data",children:[(0,_.Y)("div",{className:"client-stats__rate__data--primary",children:(0,_.Y)(E.A,{value:u[n],isSpeed:!0})}),m,(0,_.FD)("div",{className:p,children:[(0,_.Y)("div",{className:"client-stats__rate__data--total",children:(0,_.Y)(E.A,{value:c[n]})}),(0,_.Y)("div",{className:"client-stats__rate__data--limit",children:g})]})]})]})};return(0,_.FD)("div",{className:"client-stats__rates",children:[n("download",{showHoverDuration:!0}),n("upload")]})}));var xe=n(1253),Se=n(4439),Te=n(8640),Fe=n(846),Re=n(8239);const $e=({direction:e})=>(0,_.FD)("linearGradient",{id:`graph__gradient--${e}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[(0,_.Y)("stop",{className:`graph__gradient--top graph__gradient--top--${e}`,offset:"0%"}),(0,_.Y)("stop",{className:`graph__gradient--bottom graph__gradient--bottom--${e}`,offset:"100%"})]}),Pe=(e,t,n)=>{const r=e[t][Math.ceil(n)],a=e[t][Math.floor(n)];return a+n%1*(r-a)},Me=(0,i.PA)((({id:e,height:t,width:n,handlerRefs:a,onHover:s,onMouseOut:i})=>{const[l,o]=(0,r.useState)(!1),c=(0,r.useRef)(0),d=(0,r.useRef)({download:0,upload:0,timestamp:0}),u=Ne.A.transferRates,p=(0,Re.A)().domain([0,u.download.length-1]).range([0,n]),h=(0,Re.A)().domain([0,(0,Fe.A)(u.download,((e,t)=>Math.max(e,u.upload[t])))]).range([t-10,10]);a.current={handleMouseMove:e=>{c.current=p.invert(e),s(d.current)},handleMouseOut:()=>{o(!1),i()},handleMouseOver:()=>{o(!0)}},l&&(d.current={download:Pe(u,"download",c.current),upload:Pe(u,"upload",c.current),timestamp:u.timestamps[Math.round(c.current)]});const m=xe.G;return(0,_.FD)("svg",{className:"graph",id:e,height:"100%",width:"100%",children:[(0,_.FD)("defs",{children:[(0,_.Y)($e,{direction:"upload"}),(0,_.Y)($e,{direction:"download"})]}),Ne.j.map((e=>[(0,_.Y)("path",{className:"graph__area",fill:`url('#graph__gradient--${e}')`,d:(0,Se.A)().x(((e,t)=>p(t)||0)).y0(t).y1((e=>h(e)||0)).curve(m)(u[e])},`area-${e}`),(0,_.Y)("path",{className:`graph__line graph__line--${e}`,d:(0,Te.A)().x(((e,t)=>p(t)||0)).y((e=>h(e)||0)).curve(m)(u[e])},`line-${e}`),(0,_.Y)("circle",{className:`graph__circle graph__circle--${e}`,r:2.5,style:{opacity:l?1:0},transform:`translate(${p(c.current)},${h(d.current[e])})`},`point-${e}`)]))]})})),He=(0,i.PA)((()=>{const[e,t]=(0,r.useState)(null),[n,a]=(0,r.useState)(250),s=(0,r.useRef)(null);return(0,_.Y)(ye.A,{offset:!0,onResize:e=>{e.offset?.width&&a(e.offset.width)},children:({measureRef:r})=>(0,_.Y)("div",{ref:r,className:"client-stats__wrapper sidebar__item",children:(0,_.FD)("div",{className:"client-stats",onMouseMove:e=>{null!=e?.nativeEvent?.clientX&&s.current?.handleMouseMove(e.nativeEvent.clientX)},onMouseOver:()=>s.current?.handleMouseOver(),onMouseOut:()=>s.current?.handleMouseOut(),onFocus:()=>s.current?.handleMouseOver(),onBlur:()=>s.current?.handleMouseOut(),children:[(0,_.Y)(De,{inspectorPoint:e}),we.A.isConnected&&(0,_.Y)(Me,{height:150,id:"transfer-rate-graph",onMouseOut:()=>{t(null)},onHover:e=>{t(e)},handlerRefs:s,width:n})]})})})})),Be=()=>(0,_.Y)(B.r,{className:"application__sidebar",options:{scrollbars:{autoHide:"scroll",clickScroll:!1,dragScroll:!1,theme:"os-theme-thin"},overflow:{x:"hidden",y:"scroll"}},children:(0,_.FD)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,_.FD)(le,{children:[(0,_.Y)(he,{}),(0,_.Y)(ie,{}),(0,_.Y)(G,{}),(0,_.Y)(ae,{}),(0,_.Y)(U.A,{})]}),(0,_.Y)(He,{}),(0,_.Y)(se,{}),(0,_.Y)(be,{}),(0,_.Y)(fe,{}),(0,_.Y)(Ye,{}),(0,_.Y)(J,{}),(0,_.Y)(W,{}),(0,_.Y)("div",{style:{flexGrow:1}}),(0,_.Y)(le,{children:(0,_.Y)(Ae,{})})]})});var Le=n(7813),Ee=n(377),Ie=n(6565),Oe=n(3675);const ze=(0,i.PA)((({id:e})=>{const t=h.A.activeContextMenu?.id===e,n=h.A.activeContextMenu?.items??[],r=h.A.activeContextMenu?.clickPosition??{x:0,y:0},{i18n:a}=(0,l.uB)();return(0,w.A)("Escape",(()=>h.A.dismissContextMenu(e))),(0,_.Y)(Ie.tz,{triggerCoordinates:r,onOverlayClick:()=>{h.A.dismissContextMenu(e)},onOverlayRightClick:e=>{e.preventDefault()},isIn:t,children:n.map(((t,n)=>{let r,i;if("action"===t.type)i=s()("menu__item",{"is-selectable":t.clickHandler}),r=(0,_.FD)("span",{children:[(0,_.FD)("span",{className:s()("menu__item__label--primary",{"has-action":t.labelAction}),children:[(0,_.Y)("span",{className:"menu__item__label",children:a._(t.label)}),t.labelAction?(0,_.Y)("span",{className:"menu__item__label__action",children:(0,_.Y)(t.labelAction,{})}):void 0]}),t.labelSecondary?(0,_.Y)("span",{className:"menu__item__label--secondary",children:(0,_.Y)(t.labelSecondary,{})}):void 0]});else i=s()("menu__item",{"menu__item--separator":"separator"===t.type});return(0,_.Y)("li",{className:i,children:(0,_.Y)("button",{type:"button",disabled:"action"!==t.type||!t.clickHandler,onClick:n=>("separator"!==t.type&&(!1===t.dismissMenu&&n.nativeEvent.stopImmediatePropagation(),t.clickHandler&&t.clickHandler(n),!1!==t.dismissMenu&&h.A.dismissContextMenu(e)),!1),onContextMenu:e=>{e.preventDefault()},children:r})},"action"===t.type?t.action:`sep-${n}`)}))})}));var We=n(88),Ge=n(4712);const Ue=(0,r.forwardRef)(((e,t)=>{const{children:n,onScroll:a}=e,s=(0,r.useRef)(null);return(0,r.useEffect)((()=>{const e=s.current;if(null==e)return()=>{};const n=e.osInstance()?.elements().viewport;return t(n),a&&n.addEventListener("scroll",(e=>a(e)),{passive:!0}),()=>{a&&n.removeEventListener("scroll",(e=>a(e)))}}),[a,t]),(0,_.Y)(B.r,{...e,options:{scrollbars:{autoHide:"leave",clickScroll:!0,theme:"os-theme-"+(ve.A.isPreferDark?"light":"dark")}},ref:s,children:n})})),qe=(0,r.forwardRef)(((e,t)=>{const{className:n,itemCount:r,itemKey:a,itemRenderer:s,itemSize:i,outerRef:l}=e,{height:o}=(0,Ge.A)();return(0,_.Y)(We.Y1,{className:n,height:Math.max(30*i,o),itemCount:r,itemKey:a,itemSize:i,width:"100%",outerElementType:ve.A.isSmallScreen?void 0:Ue,ref:t,overscanCount:30,outerRef:l,children:s})})),je=(0,i.PA)(qe);var Ke=n(5162);const Ve="\n body { user-select: none !important; }\n * { cursor: col-resize !important; }\n";var Xe={name:"3v16dc",styles:"text-align:left;:focus{outline:none;-webkit-tap-highlight-color:transparent;}"};const Je=(0,i.PA)((0,r.forwardRef)((({onCellClick:e,onCellFocus:t,onWidthsChange:n},a)=>{const[i,o]=(0,r.useState)(!1),c=(0,r.useRef)(),u=(0,r.useRef)(),p=(0,r.useRef)(),m=(0,Ke.A)(a),g=(0,r.useRef)(null),{i18n:b}=(0,l.uB)(),f=e=>{let t=0;null!=p.current&&(t=e.clientX-p.current);let n=20;null!=u.current&&(n=u.current+t),n>20&&(u.current=n,p.current=e.clientX,null!=g.current&&null!=m.current&&(g.current.style.transform=`translate(${Math.max(0,e.clientX)}px, ${m.current.getBoundingClientRect().top}px)`))},v=()=>{h.A.removeGlobalStyle(Ve),window.removeEventListener("pointerup",v),window.removeEventListener("pointermove",f),o(!1),p.current=void 0,null!=g.current&&(g.current.style.opacity="0"),null!=c.current&&null!=u.current&&n(c.current,u.current),c.current=void 0,u.current=void 0};return(0,_.FD)("div",{className:"table__row table__row--heading",role:"row",ref:m,children:[d.A.floodSettings.torrentListColumns.reduce(((n,{id:r,visible:a})=>{if(!a)return n;const A=x.A[r];if(null==A)return n;let Y=null;const y=d.A.floodSettings.torrentListColumnWidths[r]||100;i||(Y=(0,_.Y)("span",{className:"table__heading__handle",onPointerDown:e=>{i||null==g.current||null==m.current||(o(!0),c.current=r,u.current=y,p.current=e.clientX,window.addEventListener("pointerup",v),window.addEventListener("pointermove",f),h.A.addGlobalStyle(Ve),g.current.style.transform=`translate(${Math.max(0,e.clientX)}px, ${m.current.getBoundingClientRect().top}px)`,g.current.style.opacity="1")}}));const w=r===d.A.floodSettings.sortTorrents.property,N=s()("table__cell table__heading",{"table__heading--is-sorted":w,[`table__heading--direction--${d.A.floodSettings.sortTorrents.direction}`]:w});return n.push((0,_.FD)("button",{className:N,css:Xe,role:"columnheader","aria-sort":w?"asc"===d.A.floodSettings.sortTorrents.direction?"ascending":"descending":"none",type:"button",onClick:()=>e(r),onFocus:()=>t(),style:{width:`${y}px`},children:[(0,_.Y)("span",{className:"table__heading__label",title:b._(A),children:(0,_.Y)(l.x6,{id:A})}),Y]},r)),n}),[]),(0,_.Y)("div",{className:"table__cell table__heading table__heading--fill"}),(0,_.Y)("div",{className:"table__heading__resize-line",ref:g})]})})));var Qe=n(4802);const Ze=e=>{const t=[];e.forEach((n=>{const r=new FileReader;r.onload=r=>{null!=r.target?.result&&"string"==typeof r.target.result&&t.push({name:n.name,data:r.target.result.split("base64,")[1]}),t.length===e.length&&null!=t[0]&&h.A.setActiveModal({id:"add-torrents",tab:"by-file",files:t})},r.readAsDataURL(n)}))},et=({children:e})=>{const{getRootProps:t,isDragActive:n}=(0,Qe.VB)({onDrop:Ze,noClick:!0,noKeyboard:!0});return(0,_.Y)("div",{...t({onClick:e=>e.preventDefault()}),className:"dropzone dropzone--with-overlay torrents "+(n?"dropzone--is-dragging":""),children:e})};var tt=n(3736),nt=n(2471),rt=n(1693),at=n(9689);const st=()=>p.A.selectedTorrents[p.A.selectedTorrents.length-1],it=(0,i.PA)((({property:e})=>(0,_.Y)("span",{className:"toggle-input checkbox",style:{display:"inline"},children:(0,_.Y)("div",{className:"toggle-input__indicator",children:(0,_.Y)("div",{className:"toggle-input__indicator__icon",style:{opacity:p.A.torrents[st()][e]?"1":void 0},children:(0,_.Y)(o.MG,{})})})}))),lt=e=>{const t=(0,r.createRef)();return[{type:"action",action:"start",label:rt.A.start,clickHandler:()=>{u.A.startTorrents({hashes:p.A.selectedTorrents})}},{type:"action",action:"stop",label:rt.A.stop,clickHandler:()=>{u.A.stopTorrents({hashes:p.A.selectedTorrents})}},{type:"action",action:"remove",label:rt.A.remove,clickHandler:()=>{h.A.setActiveModal({id:"remove-torrents"})}},{type:"action",action:"checkHash",label:rt.A.checkHash,clickHandler:()=>{u.A.checkHash({hashes:p.A.selectedTorrents})}},{type:"action",action:"reannounce",label:rt.A.reannounce,clickHandler:()=>{u.A.reannounce({hashes:p.A.selectedTorrents})}},{type:"separator"},{type:"action",action:"setTaxonomy",label:rt.A.setTaxonomy,clickHandler:()=>{h.A.setActiveModal({id:"set-taxonomy"})}},{type:"action",action:"move",label:rt.A.move,clickHandler:()=>{h.A.setActiveModal({id:"move-torrents"})}},{type:"action",action:"setTrackers",label:rt.A.setTrackers,clickHandler:()=>{h.A.setActiveModal({id:"set-trackers"})}},{type:"separator"},{type:"action",action:"torrentDetails",label:rt.A.torrentDetails,clickHandler:()=>{h.A.setActiveModal({id:"torrent-details",hash:st()})}},{type:"action",action:"downloadContents",label:rt.A.downloadContents,clickHandler:e=>{e.preventDefault(),p.A.selectedTorrents.forEach((e=>{const t=document.createElement("a");t.download="",t.href=`${ve.A.baseURI}api/torrents/${e}/contents/all/data`,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)}))}},{type:"action",action:"downloadMetainfo",label:rt.A.downloadMetainfo,clickHandler:e=>{e.preventDefault();const t=document.createElement("a");t.download="",t.href=`${ve.A.baseURI}api/torrents/${p.A.selectedTorrents.join(",")}/metainfo`,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)}},{type:"action",action:"generateMagnet",label:rt.A.generateMagnet,clickHandler:()=>{h.A.setActiveModal({id:"generate-magnet"})}},{type:"action",action:"setInitialSeeding",label:rt.A.setInitialSeeding,clickHandler:()=>{const{selectedTorrents:e}=p.A;u.A.setInitialSeeding({hashes:e,isInitialSeeding:!p.A.torrents[st()].isInitialSeeding})},dismissMenu:!1,labelAction:()=>(0,_.Y)(it,{property:"isInitialSeeding"})},{type:"action",action:"setSequential",label:rt.A.setSequential,clickHandler:()=>{const{selectedTorrents:e}=p.A;u.A.setSequential({hashes:e,isSequential:!p.A.torrents[st()].isSequential})},dismissMenu:!1,labelAction:()=>(0,_.Y)(it,{property:"isSequential"})},{type:"action",action:"setPriority",label:rt.A.setPriority,clickHandler:()=>{null!=t.current&&u.A.setPriority({hashes:p.A.selectedTorrents,priority:t.current()})},dismissMenu:!1,labelAction:()=>(0,_.Y)(at.A,{id:e.hash,level:e.priority,maxLevel:3,onChange:()=>{},priorityType:"torrent",showLabel:!1,changePriorityFuncRef:t,clickHandled:!0},e.hash)}]};const ot={eta:(0,_.Y)(o.zD,{}),sizeBytes:(0,_.Y)(o.Vd,{}),downRate:(0,_.Y)(o.Cx,{}),directory:(0,_.Y)(o.Ah,{}),hash:(0,_.Y)(o.Vw,{}),dateAdded:(0,_.Y)(o.Vv,{}),dateCreated:(0,_.Y)(o.xo,{}),dateFinished:(0,_.Y)(o.T9,{}),isPrivate:(0,_.Y)(o.LM,{}),message:(0,_.Y)(o.qX,{}),percentComplete:(0,_.Y)(o.Cx,{}),peers:(0,_.Y)(o.SL,{}),ratio:(0,_.Y)(o.wj,{}),seeds:(0,_.Y)(o.pK,{}),trackerURIs:(0,_.Y)(o.mB,{}),upRate:(0,_.Y)(o.NM,{}),upTotal:(0,_.Y)(o.NM,{})},ct=(0,i.PA)((({value:e})=>e?(0,_.Y)(o.H4,{className:"torrent__detail__icon torrent__detail__icon--checkmark"}):null)),dt=(0,i.PA)((({date:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.Y)("span",{children:t.date(new Date(1e3*e))})})),ut=(0,i.PA)((({eta:e})=>e?(0,_.Y)(ke.A,{value:e}):null)),pt=(0,i.PA)((({peersConnected:e,totalPeers:t})=>{const{i18n:n}=(0,l.uB)();return(0,_.Y)(l.x6,{id:"torrent.list.peers",values:{connected:n.number(e),of:(0,_.Y)("em",{className:"unit",children:(0,_.Y)(l.x6,{id:"torrent.list.peers.of"})}),total:n.number(t)}})})),ht=(0,i.PA)((({ratio:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.Y)("span",{children:t.number(e,{maximumFractionDigits:2})})})),mt=(0,i.PA)((({tags:e})=>(0,_.Y)("ul",{className:"torrent__tags tag",children:e.map((e=>(0,_.Y)("li",{className:"torrent__tag",children:e},e)))}))),_t=(0,i.PA)((({trackers:e})=>(0,_.Y)("span",{children:e.join(", ")}))),gt=(0,i.PA)((({torrent:e,column:t})=>{switch(t){case"dateAdded":case"dateCreated":case"dateFinished":return(0,_.Y)(dt,{date:e[t]});case"downRate":case"upRate":return(0,_.Y)(E.A,{value:e[t],isSpeed:!0});case"downTotal":case"upTotal":case"sizeBytes":return(0,_.Y)(E.A,{value:e[t]});case"ratio":return(0,_.Y)(ht,{ratio:e[t]});case"isPrivate":return(0,_.Y)(ct,{value:e[t]});case"tags":return(0,_.Y)(mt,{tags:e[t]});case"trackerURIs":return(0,_.Y)(_t,{trackers:e[t]});case"eta":return(0,_.Y)(ut,{eta:e[t]});case"seeds":return(0,_.Y)(pt,{peersConnected:e.seedsConnected,totalPeers:e.seedsTotal});case"peers":return(0,_.Y)(pt,{peersConnected:e.peersConnected,totalPeers:e.peersTotal});case"percentComplete":return(0,_.Y)(I.A,{percent:(0,Le.EW)((()=>Math.ceil(e.percentComplete))).get(),status:(0,Le.EW)((()=>(0,nt.s)(e.status))).get()});default:return(0,_.Y)("span",{children:e[t]})}}));var bt={name:"1te7sjq",styles:"pointer-events:none;user-select:none"};const ft=(0,i.PA)((({hash:e,content:t,column:n,className:r,classNameOverride:a,width:i,showIcon:l})=>{const c=l?ot[n]:null;return(0,_.FD)("div",{className:a?r:s()("torrent__detail",`torrent__detail--${n}`,r),css:bt,role:"cell",style:{width:`${i}px`},children:[c,t?(0,_.Y)(t,{torrent:p.A.torrents[e],column:n}):(0,_.Y)(o.Eh,{})]})}));ft.defaultProps={className:void 0,classNameOverride:!1,content:gt,width:void 0,showIcon:!1};const vt=ft,At=(0,i.PA)((0,r.forwardRef)((({className:e,style:t,hash:n,handleClick:r,handleDoubleClick:a,handleRightClick:s,handleTouchStart:i,handleTouchEnd:l,handleKeyPress:o},c)=>{const u=d.A.floodSettings.torrentListColumns.reduce(((e,{id:t,visible:r})=>null==x.A[t]?e:r?(e.push((0,_.Y)(vt,{className:"table__cell",hash:n,column:t,width:d.A.floodSettings.torrentListColumnWidths[t]},t)),e):e),[]);return(0,_.Y)("div",{className:e,role:"row",style:t,tabIndex:0,onClick:e=>r(n,e),onContextMenu:e=>s(n,e),onDoubleClick:()=>a(n),onTouchStart:i,onTouchEnd:l,onKeyPress:o,ref:c,children:u})})));const Yt=(0,i.PA)((({torrent:e})=>{const{i18n:t}=(0,l.uB)();return(0,_.FD)("span",{children:[t.number(e.percentComplete,{maximumFractionDigits:1}),(0,_.Y)("em",{className:"unit",children:"%"})," — ",(0,_.Y)(E.A,{value:e.downTotal})]})}));var yt={name:"1vr7vmn",styles:"align-items:center;display:flex"};const wt=(0,i.PA)((0,r.forwardRef)((({className:e,style:t,hash:n,handleClick:r,handleDoubleClick:a,handleRightClick:s,handleTouchStart:i,handleTouchEnd:l,handleKeyPress:o},c)=>{const u=d.A.floodSettings.torrentListColumns,p=[(0,_.Y)(vt,{hash:n,column:"name",className:"torrent__details__section torrent__details__section--primary"},"name")],h=[(0,_.Y)(vt,{hash:n,column:"eta",showIcon:!0},"eta"),(0,_.Y)(vt,{hash:n,column:"downRate",showIcon:!0},"downRate"),(0,_.Y)(vt,{hash:n,column:"upRate",showIcon:!0},"upRate")],m=[(0,_.Y)(vt,{hash:n,column:"percentComplete",content:Yt,showIcon:!0},"percentComplete")],g=[(0,_.Y)(vt,{hash:n,column:"percentComplete",className:"torrent__details__section torrent__details__section--quaternary",classNameOverride:!0},"percentBar")];for(let e=0;e<u.length;e+=1){const{id:t,visible:r}=u[e];if(null!=x.A[t]&&r)switch(t){case"name":case"downRate":case"upRate":case"eta":case"downTotal":case"percentComplete":break;default:m.push((0,_.Y)(vt,{hash:n,column:t,showIcon:!0},t))}}return(0,_.FD)("div",{className:e,role:"row",style:t,tabIndex:0,onClick:e=>r(n,e),onContextMenu:e=>s(n,e),onDoubleClick:()=>a(n),onTouchStart:i,onTouchEnd:l,onKeyPress:o,ref:c,children:[(0,_.FD)("div",{css:yt,children:[p,(0,_.Y)("div",{className:"torrent__