flood 4.8.0 → 4.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.8.2] (May 4, 204)
|
|
4
|
+
|
|
5
|
+
nothing new, just a new release to for deb files.
|
|
6
|
+
|
|
7
|
+
## [4.8.1] (May 4, 204)
|
|
8
|
+
|
|
9
|
+
- feat: new args `--disable-rate-limit` to disable rate limit on api except login (#737)
|
|
10
|
+
- fix: only generate mediainfo for video file (#741)
|
|
11
|
+
- fix: `/metainfo` json response for error (#740)
|
|
12
|
+
|
|
13
|
+
## [4.8.0] (April 24, 2024)
|
|
14
|
+
|
|
15
|
+
- fix(client): filter empty tags when setting/submitting tags (#715)
|
|
16
|
+
- fix(client): modal overflow on mobile (#713)
|
|
17
|
+
- fix(server): content-type on responding html (#708)
|
|
18
|
+
- fix(client): allows modal to grow when inner width exceeds container (#597)
|
|
19
|
+
- fix(client): misc styles (#691)
|
|
20
|
+
- fix(server): `@fastify/express` doesn't work with http2 (#705)
|
|
21
|
+
- fix(client): tracker filter size conditional render logic and react key prop (#702)
|
|
22
|
+
- fix: log error trace (#697)
|
|
23
|
+
- fix(server): handle number port (#692)
|
|
24
|
+
- feat(client): detect magnet and torrent links from clipboard (#690)
|
|
25
|
+
- server: remove port requirement, permit running on paths (#680)
|
|
26
|
+
- perf: mediainfo router should use async/await to get file info (#656)
|
|
27
|
+
- feat: use relative path in mediainfo info (#657)
|
|
28
|
+
- TorrentGeneralInfo: drop leading and trailing whitespaces from comment (#674)
|
|
29
|
+
- LinkedText: fix torrent comment line break (#667)
|
|
30
|
+
- server: rTorrent: manage request queue with p-queue - fix memory leak (#650)
|
|
31
|
+
- TransferRateGraph: explicitly declare width and height to 100%
|
|
32
|
+
- server: qBittorrent: use POST method for API calls
|
|
33
|
+
- server: qBittorrent: log in using POST method (#594)
|
|
34
|
+
- server: torrentService: normalize case of hash during torrent lookup
|
|
35
|
+
- TorrentListColumns: add "Finished" column (#565)
|
|
36
|
+
- styles: sortable-list: disallow selecting text in a list
|
|
37
|
+
- client: scripts: development: drop unnecessary browser popup
|
|
38
|
+
- MoveTorrentsModal: suggest longest common prefix as path
|
|
39
|
+
- server: rTorrent: throw error when file moving fails
|
|
40
|
+
- FilesystemBrowser: line break unconditionally for long paths
|
|
41
|
+
- TorrentListDropzone: pop up "Add Torrents" modal instead of adding directly
|
|
42
|
+
- server: rTorrent: avoid relying on type coercion of RPC value
|
|
43
|
+
- server: rTorrent: remove "hasLoadThrow" and fold into "isJSONCapable"
|
|
44
|
+
- server: ditch unmaintained "spdy"
|
|
45
|
+
- SortableList: switch to clauderic/dnd-kit
|
|
46
|
+
- server: drop databases before removing user
|
|
47
|
+
- server: switch to @seald/nedb
|
|
48
|
+
- server: tests: replace "ts-jest/utils" with "ts-jest"
|
|
49
|
+
- TorrentGeneralInfo: display "None" when there is no comment
|
|
50
|
+
- LinkedText: drop RegEx incompatible with Safari
|
|
51
|
+
- feature: display comment inside .torrent in torrent details (#541)
|
|
52
|
+
- TransferRateGraph: fix blank graph in some cases
|
|
53
|
+
- TorrentList: fix "a wild 0 appears"
|
|
54
|
+
- client: Fix regression introduced in PR #519, fixes #522 (#523)
|
|
55
|
+
- sidebar: make filter sections collapsible (#519)
|
|
56
|
+
- client: add page title speed display preference
|
|
57
|
+
- DownloadRulesTab, FeedsTab: force new component when editing
|
|
58
|
+
- server: add shebang to bundled executable
|
|
59
|
+
- Dockerfile: use the "npm run build" command
|
|
60
|
+
- server: create production build with webpack directly
|
|
61
|
+
- server: flatten directory structure a bit
|
|
62
|
+
- server: tests: ensure connectivity to client before tests
|
|
63
|
+
- server: tests: confirm deletion of torrents before continue
|
|
64
|
+
- client: reformat "typings.d.ts", fixup ffcc5c8e0
|
|
65
|
+
- server: tests: mock response to torrents fetch
|
|
66
|
+
- server: normalize fetching of torrents added with URL
|
|
67
|
+
- client: fix webpack devServer port selection
|
|
68
|
+
- styles: apply dark theme to TorrentListDropzone
|
|
69
|
+
- TorrentFilterStore: simplify and fix scroll to top on filter change
|
|
70
|
+
- client: allow multi-select of filters with Ctrl and Shift keys
|
|
71
|
+
- server: remove unused history snapshots and make it in-mem only
|
|
72
|
+
- TagFilters, TrackerFilters: fix filtering by tag/tracker
|
|
73
|
+
- client: remove unnecessary "UIActions" abstraction
|
|
74
|
+
- server: Transmission: normalize "unknown" ETA (-2) to infinity (-1) (#432)
|
|
75
|
+
|
|
3
76
|
## [4.7.0] (October 9, 2021)
|
|
4
77
|
|
|
5
78
|
- Display total size by tag or tracker of torrents on sidebar (#369, @sabersalv)
|
|
@@ -536,3 +609,6 @@ Other changes:
|
|
|
536
609
|
[4.6.0]: https://github.com/jesec/flood/compare/v4.5.4...v4.6.0
|
|
537
610
|
[4.6.1]: https://github.com/jesec/flood/compare/v4.6.0...v4.6.1
|
|
538
611
|
[4.7.0]: https://github.com/jesec/flood/compare/v4.6.1...v4.7.0
|
|
612
|
+
[4.8.0]: https://github.com/jesec/flood/compare/v4.7.0...v4.8.0
|
|
613
|
+
[4.8.1]: https://github.com/jesec/flood/compare/v4.8.0...v4.8.1
|
|
614
|
+
[4.8.2]: https://github.com/jesec/flood/compare/v4.8.1...v4.8.2
|
package/dist/assets/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/><meta http-equiv="Pragma" content="no-cache"/><meta http-equiv="Expires" content="0"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="apple-mobile-web-app-title" content="Flood"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="default"/><link rel="manifest" href="manifest.json"/><link rel="shortcut icon" href="favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="icon_maskable_180x180.png"/><title>Flood</title><script defer="defer" src="static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/><meta http-equiv="Pragma" content="no-cache"/><meta http-equiv="Expires" content="0"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/><meta name="theme-color" content="#000000"/><meta name="apple-mobile-web-app-title" content="Flood"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="default"/><link rel="manifest" href="manifest.json"/><link rel="shortcut icon" href="favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="icon_maskable_180x180.png"/><title>Flood</title><script defer="defer" src="static/js/main.a467173c.js"></script><link href="static/css/main.0197b3a72d59981aa32b.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="app"></div></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunkflood=globalThis.webpackChunkflood||[]).push([[151],{1434:(e,t,l)=>{l.r(t),l.d(t,{default:()=>_l});var i=l(9670),n=l(4537),r=l(8585),a=l(7264),s=l(4744),d=l(7294),c=l(8441),o=l(1540),u=l(879);const h=e=>{let{start:t,destination:l,tags:i,tab:n}=e;const r={};null!=t&&(r.startTorrentsOnLoad=t),null!=l&&""!==l&&(null==r.torrentDestinations&&(r.torrentDestinations=u.default.floodSettings.torrentDestinations||{}),"string"==typeof i?.[0]?r.torrentDestinations[i[0]]=l:r.torrentDestinations[""]=l),null!=n&&(r.UITorrentsAddTab=n),o.Z.saveSettings(r)};var _=l(9335),m=l(3529),g=l(5747);const p=e=>{const{actions:t}=e,l=t.map(((e,t)=>{let l=()=>{};return e.triggerDismiss&&(l=()=>{m.Z.setActiveModal(null)}),"checkbox"===e.type?(0,g.tZ)(c.XZ,{defaultChecked:e.checked,id:e.id,onClick:t=>{null!=e.clickHandler&&e.clickHandler(t),l()},children:e.content},t):(0,g.tZ)(c.zx,{isLoading:e.isLoading,onClick:t=>{null!=e.clickHandler&&e.clickHandler(t),l()},priority:e.type,type:e.submit?"submit":"button",children:e.content},t)})),i=(0,g.tZ)("div",{className:"modal__button-group",children:l});return(0,g.tZ)("div",{className:"modal__actions",children:i})},f=e=>{let{isAddingTorrents:t,onAddTorrentsClick:l}=e;const{i18n:i}=(0,s.mV)();return(0,g.tZ)(p,{actions:[{checked:Boolean(u.default.floodSettings.startTorrentsOnLoad),clickHandler:null,content:i._("torrents.add.start.label"),id:"start",triggerDismiss:!1,type:"checkbox"},{clickHandler:null,content:i._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:l,content:i._("torrents.add.button.add"),isLoading:t,submit:!0,triggerDismiss:!1,type:"primary"}]})};var Z=l(3279),b=l.n(Z),v=l(4656),y=l(5495),C=l(917),k=l(5896),N=l(172),w=l(4557),S=l(5051),x=l(932);const B="#5E728C",X={name:"1pkdvdx",styles:"padding:3px 9px"},T=(0,C.iv)({borderBottom:`1px solid ${(0,k.$n)(.43,B)}`,marginBottom:"3px",paddingBottom:"3px",opacity:.75,"&:last-child":{marginBottom:0}},"",""),D=(0,C.iv)({opacity:.5,transition:"color 0.25s",whiteSpace:"nowrap",button:[X,{width:"100%",height:"100%",padding:"3px 9px",textAlign:"left","&:disabled":{pointerEvents:"none"}}]},"",""),P=(0,C.iv)({color:(0,k.p_)(.1,(0,k._j)(.15,B)),background:(0,k.m4)(B,.1),button:{":focus":{outline:"none",WebkitTapHighlightColor:"transparent"}}},"",""),E=(0,C.iv)({opacity:1,cursor:"pointer",transition:"background 0.25s, color 0.25s",userSelect:"none","&:hover":P,"&:focus-within":P},"",""),M={EACCES:"filesystem.error.eacces",ENOENT:"filesystem.error.enoent"};var V={name:"kol7nt",styles:"transform:scale(0.75) rotate(180deg)"},I={name:"1089mxj",styles:"white-space:pre-wrap"},R={name:"1ityoz",styles:"font-weight:lighter"};const L=(0,d.memo)((e=>{let{directory:t,selectable:l,onItemSelection:i,onYieldFocus:n}=e;const[r,a]=(0,d.useState)(null),[c,o]=(0,d.useState)(null),[u,h]=(0,d.useState)(t.includes("/")?"/":"\\"),[_,m]=(0,d.useState)(null),[p,f]=(0,d.useState)(null),Z=(0,d.useRef)(null),b=t.lastIndexOf(u)+1,v=b>0?t.substr(0,b):t,k=t.substr(b);(0,d.useEffect)((()=>{v&&(a(null),m(null),f(null),S.Z.fetchDirectoryList(v).then((e=>{let{files:t,directories:l,separator:i}=e;m(l),f(t),h(i),o(null)})).catch((e=>{let{response:t}=e;o(t)})))}),[v]),(0,d.useEffect)((()=>{if(null!=Z.current&&null!=r){const e=Z.current.children[r]?.children[0];0===e?.tabIndex?e.focus():a(Array.from(Z.current.children).findIndex((e=>0===e.children[0].tabIndex)))}}),[r]),(0,w.Z)("ArrowUp",(e=>{e.preventDefault(),a((e=>null==e||e-1<0?(n?.(),null):e-1))})),(0,w.Z)("ArrowDown",(e=>{e.preventDefault(),a((e=>null!=e?e+1:0))}));let P=null,L=[];if((null==_&&"directories"===l||null==p&&"files"===l)&&(P="filesystem.fetching"),c&&c.data&&c.data.code&&(P=M[c.data.code]||"filesystem.error.unknown"),t){const e=`${v.split(u).slice(0,-2).join(u)}${u}`,t=(0,g.tZ)("li",{css:[D,E,{"@media (max-width: 720px)":T},"",""],children:(0,g.BX)("button",{type:"button",onClick:()=>i?.(e,!0),children:[(0,g.tZ)(y.Eh,{css:V}),".."]})},e),n="files"!==l,r=k?(0,x.Z)(_,(e=>e),k):[],a=r.includes(k)||"directories"!==l||!k||P?[]:(()=>{const e=`${v}${k}${u}`;return[(0,g.tZ)("li",{css:[D,E,"font-weight:bold;@media (max-width: 720px){display:none;}",""],children:(0,g.BX)("button",{type:"button",onClick:()=>i?.(e,!1),children:[(0,g.tZ)(y.Pl,{}),(0,g.tZ)("span",{css:I,children:k}),(0,g.BX)("em",{css:R,children:[" - ",(0,g.tZ)(s.cC,{id:"filesystem.error.enoent"})]})]})},e)]})(),d=_?.length&&(0,N.DY)(_.slice()).desc((e=>r.includes(e))).map((e=>{const t=`${v}${e}${u}`;return(0,g.tZ)("li",{css:[D,n?E:void 0,r.includes(e)?{fontWeight:"bold"}:void 0,"",""],children:(0,g.BX)("button",{type:"button",disabled:!n,tabIndex:n?0:-1,onClick:n?()=>i?.(t,!0):void 0,children:[(0,g.tZ)(y.Bm,{}),e]})},t)}))||[],c="directories"!==l,o=k?(0,x.Z)(p,(e=>e),k):[],h=p?.length&&(0,N.DY)(p.slice()).desc((e=>o.includes(e))).map((e=>{const t=`${v}${e}`;return(0,g.tZ)("li",{css:[D,c?E:void 0,o.includes(e)?{fontWeight:"bold"}:void 0,"",""],children:(0,g.BX)("button",{type:"button",disabled:!c,tabIndex:c?0:-1,onClick:c?()=>i?.(t,!1):void 0,children:[(0,g.tZ)(y.$B,{}),e]})},t)}))||[];0!==d.length||0!==h.length||P||(P="filesystem.empty.directory"),L=[t,...a,...d,...h]}else P="filesystem.error.no.input";return(0,g.BX)("div",{css:(0,C.iv)({color:B,listStyle:"none",padding:"3px 0px",".icon":{fill:"currentColor",height:"14px",width:"14px",marginRight:"5px",marginTop:"-3px",verticalAlign:"middle"}},"",""),children:[v&&(0,g.BX)("li",{css:[D,T,X,"white-space:pre-wrap;word-break:break-all;.icon{transform:scale(0.9);margin-top:-2px !important;}@media (max-width: 720px){display:none;}",""],children:[(0,g.tZ)(y.DB,{}),v]}),(0,g.tZ)("ul",{ref:Z,children:L}),P&&(0,g.tZ)("div",{css:[D,X,"opacity:1;",""],children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:P})})})]})}));L.defaultProps={selectable:void 0,onItemSelection:void 0,onYieldFocus:void 0};const F=L,O=(0,d.forwardRef)(((e,t)=>{let{id:l,label:i,selectable:n,suggested:r,showBasePathToggle:a,showCompletedToggle:o,showSequentialToggle:h,onChange:_}=e;const[m,p]=(0,d.useState)(r||u.default.floodSettings.torrentDestinations?.[""]||u.default.clientSettings?.directoryDefault||""),[f,Z]=(0,d.useState)(!1),C=(0,d.useRef)(null),k=(0,v.Z)(t),{i18n:N}=(0,s.mV)();(0,d.useEffect)((()=>{const e=()=>{Z(!1)},t=t=>{C.current?.contains(t.target)||e()};return document.addEventListener("click",t),window.addEventListener("resize",e),()=>{document.removeEventListener("click",t),window.removeEventListener("resize",e)}}),[]);const w=[];return a&&w.push((0,g.tZ)(c.XZ,{grow:!1,id:"isBasePath",children:(0,g.tZ)(s.cC,{id:"torrents.destination.base_path"})},"isBasePath")),o&&w.push((0,g.tZ)(c.XZ,{grow:!1,id:"isCompleted",children:(0,g.tZ)(s.cC,{id:"torrents.destination.completed"})},"isCompleted")),h&&w.push((0,g.tZ)(c.XZ,{grow:!1,id:"isSequential",children:(0,g.tZ)(s.cC,{id:"torrents.destination.sequential"})},"isSequential")),(0,g.BX)(c.y1,{ref:C,children:[(0,g.tZ)(c.p7,{children:(0,g.BX)(c.fE,{autoComplete:f?"off":void 0,addonPlacement:"after",defaultValue:m,id:l,label:i,onChange:b()((()=>{if(null==k.current)return;const e=k.current.value;_&&_(e),p(e)}),100,{leading:!0}),onClick:e=>e.nativeEvent.stopImmediatePropagation(),placeholder:N._("torrents.add.destination.placeholder"),ref:k,children:[(0,g.tZ)(c.G5,{onClick:()=>{null!=k.current&&p(k.current.value),Z(!f)},children:(0,g.tZ)(y.ol,{})}),(0,g.tZ)(c.h_,{children:(0,g.tZ)(c.xV,{isIn:f,onClick:e=>e.nativeEvent.stopImmediatePropagation(),overlayProps:{isInteractive:!1},padding:!1,triggerRef:k,children:(0,g.tZ)(F,{directory:m,selectable:n,onItemSelection:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null!=k.current&&(k.current.value=e),Z(t),p(e)},onYieldFocus:()=>{k.current?.focus()}})})})]})}),w.length>0?(0,g.tZ)(c.p7,{children:w}):null]})}));O.defaultProps={label:void 0,selectable:void 0,suggested:void 0,showBasePathToggle:!1,showCompletedToggle:!1,showSequentialToggle:!1,onChange:void 0};const $=O;var z=l(4184),U=l.n(z),A=l(8232);const j=e=>{let{defaultValue:t,placeholder:l,id:i,label:n,onTagSelected:r}=e;const[o,h]=(0,d.useState)(!1),[_,m]=(0,d.useState)(t??[]),p=(0,d.useRef)(null),f=(0,d.useRef)(null),Z=(0,d.useRef)(null),b=U()("select form__element",{"select--is-open":o});return(0,a.Z)("Escape",(e=>{e.preventDefault(),h(!1)})),(0,d.useEffect)((()=>{const e=e=>{p.current?.contains(e.target)||h(!1)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}),[]),(0,d.useEffect)((()=>{null!=Z.current&&(Z.current.value=_.join()),r&&r(_)}),[_,r]),(0,g.tZ)(c.U2,{ref:p,children:(0,g.tZ)("div",{className:b,children:(0,g.BX)(c.fE,{autoComplete:o?"off":void 0,id:i||"tags",addonPlacement:"after",defaultValue:t,label:n,onChange:()=>{if(null!=Z.current){let e=Z.current.value.split(",").map((e=>e.trim())).filter((e=>e.length>0));Z.current.value.trimEnd().endsWith(",")&&(e.push(""),e=[...new Set(e)]),m(e)}},placeholder:l,ref:Z,children:[(0,g.tZ)(c.G5,{onClick:()=>{h(!o)},className:"select__indicator",children:(0,g.tZ)(y.Tt,{})}),(0,g.tZ)(c.h_,{children:(0,g.tZ)(c.xV,{isIn:o,onClick:e=>{"single"!==u.default.floodSettings.UITagSelectorMode&&e.nativeEvent.stopImmediatePropagation()},overlayProps:{isInteractive:!1},ref:f,triggerRef:Z,children:[...new Set(["untagged",...(0,N.DY)(Object.keys(A.default.taxonomy.tagCounts)).asc(),..._])].reduce(((e,t)=>(""===t||e.push((0,g.tZ)(c.Ql,{id:t,isSelected:_.includes(t),onClick:()=>{"untagged"===t?m([]):_.includes(t)?m(_.filter((e=>e!==t&&""!==e))):m([..._.filter((e=>""!==e)),t])},children:"untagged"===t?(0,g.tZ)(s.cC,{id:"filter.untagged"}):t},t)),e)),[])})})]})})})};j.defaultProps={id:"tags",label:void 0,defaultValue:void 0,placeholder:void 0,onTagSelected:void 0};const H=j,q=(e,t)=>Object.keys(e).reduce(((l,i)=>{if(i.startsWith(t)){const t=e[i];null!=t&&l.push(t)}return l}),[]),G=e=>{let{defaultValues:t,id:l,label:i,placeholder:n}=e;const r=(0,d.useRef)(0),[a,s]=(0,d.useState)(t??[{id:0,value:""}]);return(0,g.tZ)(c.y1,{children:a.map(((e,t)=>{let d=null;return t>0&&(d=(0,g.tZ)(c.G5,{onClick:()=>{const e=a.slice();e.splice(t,1),s(e)},children:(0,g.tZ)(y.eJ,{})})),(0,g.tZ)(c.p7,{children:(0,g.BX)(c.fE,{addonPlacement:"after",id:`${l}-${e.id}`,defaultValue:e.value,label:0===t&&i,placeholder:n,wrapperClassName:"textbox-repeater",children:[(0,g.tZ)(c.G5,{onClick:()=>{r.current+=1;const e=a.slice();e.splice(t+1,0,{id:r.current,value:""}),s(e)},children:(0,g.tZ)(y.Rb,{})}),d]})},e.id)}))})};G.defaultProps={defaultValues:void 0,label:void 0,placeholder:void 0};const Q=G,W=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(!1);return(0,g.BX)(c.l0,{className:"inverse",ref:e,children:[(0,g.tZ)($,{id:"sourcePath",label:t._("torrents.create.source.path.label")}),(0,g.tZ)(Q,{id:"trackers",label:t._("torrents.create.trackers.label"),placeholder:t._("torrents.create.tracker.input.placeholder"),defaultValues:[{id:0,value:""}]}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"name",label:t._("torrents.create.base.name.label"),placeholder:t._("torrents.create.base.name.input.placeholder")})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"comment",label:t._("torrents.create.comment.label"),placeholder:t._("torrents.create.comment.input.placeholder")})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"infoSource",label:t._("torrents.create.info.source.label"),placeholder:t._("torrents.create.info.source.input.placeholder")})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.XZ,{grow:!1,id:"isPrivate",children:t._("torrents.create.is.private.label")})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(H,{id:"tags",label:t._("torrents.add.tags"),placeholder:t._("torrents.create.tags.input.placeholder")})}),(0,g.tZ)(f,{onAddTorrentsClick:()=>{if(null==e.current)return;const t=e.current.getFormData();i(!0),null!=t.sourcePath&&(_.Z.createTorrent({name:t.name,sourcePath:t.sourcePath,trackers:q(t,"trackers"),comment:t.comment,infoSource:t.infoSource,isPrivate:t.isPrivate||!1,start:t.start||!1,tags:null!=t.tags?t.tags.split(","):void 0}).then((()=>{m.Z.setActiveModal(null)})),h({start:t.start,destination:t.sourcePath,tab:"by-creation"}))},isAddingTorrents:l})]})};var Y=l(4977);const J=e=>{let{initialFiles:t,onFilesChanged:l}=e;const[i,n]=(0,d.useState)(t??[]);return(0,d.useEffect)((()=>{l(i)}),[i,l]),(0,g.BX)(c.U2,{children:[(0,g.tZ)("span",{className:"form__element__label",children:(0,g.tZ)(s.cC,{id:"torrents.add.torrents.label"})}),i.length>0?(0,g.tZ)("div",{onClick:e=>{e.stopPropagation()},role:"none",children:(0,g.tZ)("ul",{className:"dropzone__selected-files interactive-list",children:i.map(((e,t)=>(0,g.BX)("li",{className:"dropzone__selected-files__file interactive-list__item",title:e.name,children:[(0,g.tZ)("span",{className:"interactive-list__icon",children:(0,g.tZ)(y.$B,{})}),(0,g.tZ)("span",{className:"interactive-list__label",children:e.name}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>{const e=i.slice();e.splice(t,1),n(e)},children:(0,g.tZ)(y.x8,{})})]},e.name)))})}):null,(0,g.tZ)(Y.ZP,{onDrop:e=>{const t=[];e.forEach((l=>{const r=new FileReader;r.onload=r=>{null!=r.target?.result&&"string"==typeof r.target.result&&t.push({name:l.name,data:r.target.result.split("base64,")[1]}),t.length===e.length&&n(i.concat(t))},r.readAsDataURL(l)}))},children:e=>{let{getRootProps:t,getInputProps:l,isDragActive:i}=e;return(0,g.BX)("div",{...t(),className:"form__dropzone dropzone interactive-list "+(i?"dropzone--is-dragging":""),children:[(0,g.tZ)("input",{...l()}),(0,g.BX)("div",{className:"dropzone__copy",children:[(0,g.tZ)("div",{className:"dropzone__icon",children:(0,g.tZ)(y.hv,{})}),(0,g.tZ)(s.cC,{id:"torrents.add.tab.file.drop"})," ",(0,g.tZ)("span",{className:"dropzone__browse-button",children:(0,g.tZ)(s.cC,{id:"torrents.add.tab.file.browse"})}),"."]})]})}})]})},K=()=>{const e=(0,d.useRef)([]),t=(0,d.useRef)(null),l=(0,d.useRef)(null),[i,n]=(0,d.useState)(!1),{i18n:r}=(0,s.mV)();return(0,g.BX)(c.l0,{className:"inverse",ref:t,children:[(0,g.tZ)(c.p7,{children:(0,g.tZ)(J,{initialFiles:"add-torrents"===m.Z.activeModal?.id&&"by-file"===m.Z.activeModal?.tab&&m.Z.activeModal?.files||[],onFilesChanged:t=>{e.current=t}})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(H,{label:r._("torrents.add.tags"),id:"tags",onTagSelected:e=>{if(null!=l.current){const t=u.default.floodSettings.torrentDestinations?.[e[0]];"string"==typeof t&&null!=l.current&&(l.current.value=t,l.current.dispatchEvent(new Event("input",{bubbles:!0})))}}})}),(0,g.tZ)($,{id:"destination",label:r._("torrents.add.destination.label"),ref:l,selectable:"directories",showBasePathToggle:!0,showCompletedToggle:!0,showSequentialToggle:!0}),(0,g.tZ)(f,{onAddTorrentsClick:()=>{if(null==t.current)return;const l=t.current?.getFormData();n(!0);const{destination:i,start:r,tags:a,isBasePath:s,isCompleted:d,isSequential:c}=l,o=[];if(e.current.forEach((e=>{o.push(e.data)})),0===o.length||null==i)return void n(!1);const u=null!=a?a.split(",").filter((e=>e.length>0)):void 0;_.Z.addTorrentsByFiles({files:o,destination:i,tags:u,isBasePath:s,isCompleted:d,isSequential:c,start:r}).then((()=>{m.Z.setActiveModal(null)})),h({start:r,destination:i,tags:u,tab:"by-file"})},isAddingTorrents:i})]})};var ee=l(4355);var te={name:"izrr19",styles:"float:right;:focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"},le={name:"1rawn5e",styles:"font-size:0.8em"};const ie=()=>{const e=(0,d.useRef)(null),t=(0,d.useRef)(null),[l,i]=(0,d.useState)(!1),{i18n:n}=(0,s.mV)();return(0,g.BX)(c.l0,{className:"inverse",ref:e,children:[(0,g.tZ)(Q,{id:"urls",label:(0,g.BX)("div",{children:[n._("torrents.add.torrents.label"),"function"==typeof navigator.registerProtocolHandler&&(0,g.tZ)("button",{css:te,type:"button",onClick:()=>{"function"==typeof navigator.registerProtocolHandler&&navigator.registerProtocolHandler("magnet",`${ee.default.baseURI}?action=add-urls&url=%s`)},children:(0,g.tZ)("em",{css:le,children:n._("torrents.add.tab.url.register.magnet.handler")})})]}),placeholder:n._("torrents.add.tab.url.input.placeholder"),defaultValues:"add-torrents"===m.Z.activeModal?.id&&"by-url"===m.Z.activeModal?.tab&&m.Z.activeModal?.urls||[{id:0,value:""}]}),(0,g.tZ)(Q,{id:"cookies",label:n._("torrents.add.cookies.label"),placeholder:n._("torrents.add.cookies.input.placeholder")}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(H,{id:"tags",label:n._("torrents.add.tags"),onTagSelected:e=>{if(null!=t.current){const l=u.default.floodSettings.torrentDestinations?.[e[0]];"string"==typeof l&&null!=t.current&&(t.current.value=l,t.current.dispatchEvent(new Event("input",{bubbles:!0})))}}})}),(0,g.tZ)($,{id:"destination",label:n._("torrents.add.destination.label"),ref:t,selectable:"directories",showBasePathToggle:!0,showCompletedToggle:!0,showSequentialToggle:!0}),(0,g.tZ)(f,{onAddTorrentsClick:()=>{if(null==e.current)return;const t=e.current.getFormData();i(!0);const l=q(t,"urls").filter((e=>""!==e));if(0===l.length||null==t.destination)return void i(!1);const n=q(t,"cookies"),r=l[0].startsWith("http")&&l[0].split("/")[2],a=r?{[r]:n}:void 0,s=null!=t.tags?t.tags.split(",").filter((e=>e.length>0)):void 0;_.Z.addTorrentsByUrls({urls:l,cookies:a,destination:t.destination,isBasePath:t.isBasePath,isCompleted:t.isCompleted,isSequential:t.isSequential,start:t.start,tags:s}).then((()=>{m.Z.setActiveModal(null)})),h({start:t.start,destination:t.destination,tags:s,tab:"by-url"})},isAddingTorrents:l})]})};var ne={name:"1gxvag8",styles:":focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"};const re=e=>{const{activeTabId:t,tabs:l={},onTabChange:i}=e;return(0,g.tZ)("ul",{className:"modal__tabs",children:Object.keys(l).map((e=>{const n=l[e];n.id=e;const r=U()("modal__tab",{"is-active":e===t});return(0,g.tZ)("li",{className:r,children:(0,g.tZ)("button",{css:ne,type:"button",onClick:()=>{i&&i(n)},children:n.label})},e)}))})};re.defaultProps={tabs:{}};const ae=re,se=e=>{const{alignment:t,size:l,orientation:i,tabsInBody:n,inverse:r,initialTabId:a,className:s,content:c,heading:o,tabs:u,actions:h}=e,_=U()("modal__content__wrapper",`modal--align-${t}`,`modal--size-${l}`,{"modal--horizontal":"horizontal"===i,"modal--vertical":"vertical"===i,"modal--tabs-in-header":!n,"modal--tabs-in-body":n,inverse:r},s);let m=c;const f=o,Z=U()("modal__header",{"has-tabs":u});let b,v,y;const[C,k]=(0,d.useState)(a??Object.keys(u||{})[0]);if(u){const e=u[C],t=U()("modal__content",e.modalContentClasses),l=e.content,i=e.props,r=(0,g.tZ)(ae,{activeTabId:C,onTabChange:e=>{null!=e.id&&k(e.id)},tabs:u},"modal-tabs");n?b=r:y=r,m=[b,(0,g.tZ)("div",{className:t,children:(0,g.tZ)(l,{...i})},"modal-content")]}return h&&(v=(0,g.tZ)("div",{className:"modal__footer",children:(0,g.tZ)(p,{actions:h})})),(0,g.BX)("div",{className:_,children:[(0,g.BX)("div",{className:Z,children:[f,y]}),(0,g.BX)("div",{className:"modal__body",children:[m,v]})]})};se.defaultProps={alignment:"left",className:null,inverse:!0,size:"medium",orientation:"horizontal",tabsInBody:!1,content:void 0,actions:void 0,tabs:void 0,initialTabId:void 0};const de=se,ce=()=>{const{i18n:e}=(0,s.mV)(),t={"by-url":{content:ie,label:e._("torrents.add.tab.url.title")},"by-file":{content:K,label:e._("torrents.add.tab.file.title")},"by-creation":{content:W,label:e._("torrents.add.tab.create.title")}};return"add-torrents"!==m.Z.activeModal?.id?null:(0,g.tZ)(de,{heading:e._("torrents.add.heading"),tabs:t,initialTabId:m.Z.activeModal.tab??u.default.floodSettings.UITorrentsAddTab??"by-url"})},oe=(0,r.Pi)((()=>{if("confirm"!==m.Z.activeModal?.id)return null;const{actions:e,content:t,heading:l}=m.Z.activeModal||{};return(0,g.tZ)(de,{actions:e,content:(0,g.tZ)("div",{className:"modal__content",children:t}),heading:l})}));var ue=l(9669),he=l.n(ue),_e=l(8949);function me(e,t,l){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var l=e[Symbol.toPrimitive];if(void 0!==l){var i=l.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const ge=new class{constructor(){me(this,"feeds",[]),me(this,"rules",[]),me(this,"items",[]),(0,_e.ky)(this)}setFeeds(e){this.feeds=null!=e?[...e].sort(((e,t)=>e.label.localeCompare(t.label))):[]}setRules(e){this.rules=null!=e?[...e].sort(((e,t)=>e.label.localeCompare(t.label))):[]}handleFeedMonitorsFetchSuccess(e){this.setFeeds(e.feeds),this.setRules(e.rules)}handleItemsFetchSuccess(e){this.items=e}},{baseURI:pe}=ee.default,fe={addFeed:e=>he().put(`${pe}api/feed-monitor/feeds`,e).then((()=>fe.fetchFeedMonitors())),modifyFeed:(e,t)=>he().patch(`${pe}api/feed-monitor/feeds/${e}`,t).then((()=>fe.fetchFeedMonitors())),addRule:e=>he().put(`${pe}api/feed-monitor/rules`,e).then((()=>fe.fetchFeedMonitors())),fetchFeedMonitors:()=>he().get(`${pe}api/feed-monitor`).then((e=>{let{data:t}=e;ge.handleFeedMonitorsFetchSuccess(t)}),(()=>{})),fetchItems:e=>{let{id:t,search:l}=e;return he().get(`${pe}api/feed-monitor/feeds/${t}/items`,{params:{search:l}}).then((e=>{let{data:t}=e;ge.handleItemsFetchSuccess(t)}),(()=>{}))},removeFeedMonitor:e=>he().delete(`${pe}api/feed-monitor/${e}`).then((()=>fe.fetchFeedMonitors()),(()=>{}))},Ze=fe,be=/^(?:https?|ftp):\/\/.{1,}\.{1}.{1,}/,ve=e=>null!=e&&""!==e,ye=e=>{try{new RegExp(e)}catch(e){return!1}return!0},Ce=e=>{let{rule:t,isSubmitting:l,isPatternMatched:i,onCancel:n}=e;const{feeds:r}=ge,{i18n:a}=(0,s.mV)();return(0,g.BX)(c.y1,{children:[(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"label",label:a._("feeds.label"),defaultValue:t.label}),(0,g.tZ)(c.Ph,{disabled:!r.length,id:"feedID",label:a._("feeds.applicable.feed"),defaultID:t.feedIDs?.[0],children:0===r.length?[(0,g.tZ)(c.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:"feeds.no.feeds.available"})})},"empty")]:r.reduce(((e,t)=>e.concat((0,g.tZ)(c.Ql,{id:`${t._id}`,children:t.label},t._id))),[(0,g.tZ)(c.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:"feeds.select.feed"})})},"select-feed")])})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"match",label:a._("feeds.match.pattern"),placeholder:a._("feeds.regEx"),defaultValue:t.match,width:"three-eighths"}),(0,g.tZ)(c.fE,{id:"exclude",label:a._("feeds.exclude.pattern"),placeholder:a._("feeds.regEx"),defaultValue:t.exclude,width:"three-eighths"})]}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{addonPlacement:"after",id:"check",label:a._("feeds.test.match"),placeholder:a._("feeds.check"),children:i&&(0,g.tZ)(c.G5,{children:(0,g.tZ)(y.FV,{})})})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.U2,{children:(0,g.tZ)($,{id:"destination",label:a._("feeds.torrent.destination"),selectable:"directories",suggested:t.destination,showBasePathToggle:!0})}),(0,g.tZ)(H,{id:"tags",label:a._("feeds.apply.tags"),placeholder:a._("feeds.tags"),defaultValue:t.tags})]}),(0,g.BX)(c.p7,{align:"end",justify:"end",children:[(0,g.tZ)("br",{}),(0,g.tZ)(c.XZ,{id:"startOnLoad",defaultChecked:t.startOnLoad,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"feeds.start.on.load"})}),(0,g.tZ)(c.zx,{onClick:n,children:(0,g.tZ)(s.cC,{id:"button.cancel"})}),(0,g.tZ)(c.zx,{type:"submit",isLoading:l,children:(0,g.tZ)(s.cC,{id:"button.save.feed"})})]})]})},ke=e=>{let{children:t}=e;return(0,g.tZ)("h2",{className:"h4",children:t})},Ne=(0,r.Pi)((e=>{let{currentRule:t,onSelect:l,onRemove:i}=e;const{rules:n}=ge;return 0===n.length?(0,g.tZ)("ul",{className:"interactive-list",children:(0,g.tZ)("li",{className:"interactive-list__item",children:(0,g.tZ)(s.cC,{id:"feeds.no.rules.defined"})})}):(0,g.tZ)("ul",{className:"interactive-list",children:n.map((e=>{const n=e.count||0;let r=null,a=null;if(e.exclude&&(r=(0,g.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:[(0,g.tZ)(s.cC,{id:"feeds.exclude"}),": ",e.exclude]})),e.tags&&e.tags.length>0){const t=e.tags.map((e=>(0,g.tZ)("span",{className:"tag",children:e},e)));a=(0,g.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:[(0,g.tZ)(s.cC,{id:"feeds.tags"}),": ",t]})}return(0,g.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content",children:[(0,g.BX)("div",{className:"interactive-list__label",children:[(0,g.BX)("ul",{className:"interactive-list__detail-list",children:[(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:e.label}),(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--secondary",children:(0,g.tZ)(s.cC,{id:"feeds.match.count",values:{count:n}})}),e===t&&(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:"Modifying"})]}),(0,g.BX)("ul",{className:"interactive-list__detail-list",children:[(0,g.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",style:{maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,g.tZ)(s.cC,{id:"feeds.match"}),": ",e.match]}),(0,g.tZ)("div",{style:{width:"100%"}}),r,a]})]}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action",type:"button",onClick:()=>l(e),children:(0,g.tZ)(y.I8,{})}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>i(e),children:(0,g.tZ)(y.x8,{})})]},e._id)}))})})),we=Ne,Se={label:"",feedIDs:[],match:"",exclude:"",tags:[],destination:"",startOnLoad:!1},xe={destination:{isValid:ve,error:"feeds.validation.must.specify.destination"},feedID:{isValid:e=>ve(e)&&"placeholder"!==e,error:"feeds.validation.must.select.feed"},label:{isValid:ve,error:"feeds.validation.must.specify.label"},match:{isValid:e=>ve(e)&&ye(e),error:"feeds.validation.invalid.regular.expression"},exclude:{isValid:e=>!ve(e)||ye(e),error:"feeds.validation.invalid.regular.expression"}},Be=(e,t)=>xe[e]?.isValid(t)?void 0:xe[e]?.error,Xe=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(null),[n,r]=(0,d.useState)({}),[a,o]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1),[_,m]=(0,d.useState)(!1),[p,f]=(0,d.useState)(!1);return(0,g.BX)(c.l0,{className:"inverse",onChange:e=>{let{event:t,formData:l}=e;const i=t.target.name,a=l;r({...n,[i]:Be(i,a[i])}),f((()=>{const{check:e,match:t="",exclude:l=""}=a;if(ve(e)&&ye(t)&&ye(l)){const i=new RegExp(t,"gi").test(e),n=""!==l&&new RegExp(l,"gi").test(e);return i&&!n}return!1})()),m(!0)},onSubmit:async()=>{if(null==e.current)return;const t=e.current.getFormData(),n=Object.keys(xe).reduce(((e,l)=>({...e,[l]:Be(l,t[l])})),{});r(n);const a=Object.keys(n).every((e=>void 0===n[e]));_&&a&&(h(!0),null!=l?._id&&await Ze.removeFeedMonitor(l._id),await Ze.addRule({label:t.label??Se.label,feedIDs:[t.feedID??""],field:t.field,match:t.match??Se.match,exclude:t.exclude??Se.exclude,destination:t.destination??Se.destination,tags:t.tags?.split(",")??Se.tags,startOnLoad:t.startOnLoad??Se.startOnLoad,isBasePath:t.isBasePath??!1}).then((()=>{e.current?.resetForm(),r({}),i(null),o(!1)}),(()=>{r({backend:"general.error.unknown"})})),h(!1))},ref:e,children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"feeds.existing.rules"})}),Object.keys(n).reduce(((e,l)=>(null!=n[l]&&e.push((0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:t._(n?.[l])})},`error-${l}`)),e)),[]),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.U2,{children:(0,g.tZ)(we,{currentRule:l,onSelect:e=>{i(e),o(!0)},onRemove:e=>{null!=e._id&&Ze.removeFeedMonitor(e._id),e===l&&(i(null),o(!1))}})})}),a?(0,g.tZ)(Ce,{rule:l??Se,isPatternMatched:p,isSubmitting:u,onCancel:()=>{i(null),o(!1)}},l?._id||"initial"):(0,g.BX)(c.p7,{align:"end",justify:"end",children:[(0,g.tZ)("br",{}),(0,g.tZ)(c.zx,{onClick:()=>{o(!0)},children:(0,g.tZ)(s.cC,{id:"button.new"})})]})]})},Te=e=>{let{currentFeed:t,defaultFeed:l,intervalMultipliers:i,isSubmitting:n,onCancel:r}=e;const{i18n:a}=(0,s.mV)(),d=t?.interval??l.interval;let o=d,u=1;return i.forEach((e=>{const t=e.value;d%t==0&&(o=d/t,u=t)})),(0,g.BX)(c.y1,{children:[(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"label",label:a._("feeds.label"),placeholder:a._("feeds.label"),defaultValue:t?.label??l.label}),(0,g.tZ)(c.fE,{id:"interval",label:a._("feeds.select.interval"),placeholder:a._("feeds.interval"),defaultValue:o,width:"one-eighth"}),(0,g.tZ)(c.Ph,{labelOffset:!0,defaultID:u,id:"intervalMultiplier",width:"one-eighth",children:i.map((e=>(0,g.tZ)(c.Ql,{id:e.value,children:a._(e.message)},e.value)))})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"url",label:a._("feeds.url"),placeholder:a._("feeds.url"),defaultValue:t?.url??l?.url}),(0,g.tZ)(c.zx,{labelOffset:!0,onClick:r,children:(0,g.tZ)(s.cC,{id:"button.cancel"})}),(0,g.tZ)(c.zx,{labelOffset:!0,type:"submit",isLoading:n,children:(0,g.tZ)(s.cC,{id:"button.save.feed"})})]})]})},De=(0,r.Pi)((e=>{let{selectedFeedID:t}=e;const{items:l}=ge,i=[];if(t){const e={};l.forEach(((t,l)=>{let{title:n}=t;const r=e[n];null==r?e[n]=2:(n=`${n} #${r}`,e[n]+=1),i.push((0,g.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content feed-list__feed",children:[(0,g.tZ)("div",{className:"interactive-list__label feed-list__feed-label",children:n}),(0,g.tZ)(c.XZ,{id:`${l}`})]},n))}))}return(0,g.tZ)(c.p7,{children:0===i.length?(0,g.tZ)("ul",{className:"interactive-list",children:(0,g.tZ)("li",{className:"interactive-list__item",children:(0,g.tZ)("div",{className:"interactive-list__label",children:(0,g.tZ)(s.cC,{id:"feeds.no.items.matching"})})})}):(0,g.tZ)("ul",{className:"interactive-list feed-list",children:i})})})),Pe=De,Ee=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)(),t=(0,d.useRef)(null),[l,i]=(0,d.useState)(null),{feeds:n}=ge;return null!=l&&(n.some((e=>e._id===l))||i(null)),(0,g.BX)(c.l0,{className:"inverse",onChange:e=>{let{event:t,formData:l}=e;const n=l;"checkbox"!==t.target.type&&(i(n.feedID),Ze.fetchItems({id:n.feedID,search:n.search}))},onSubmit:()=>{if(null==t.current)return;const e=t.current.getFormData(),l=ge.items.filter(((t,l)=>e[l])).map(((e,t)=>({id:t,value:e.urls[0]})));m.Z.setActiveModal({id:"add-torrents",tab:"by-url",urls:l})},ref:t,children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"feeds.browse.feeds"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.Ph,{disabled:!n.length,grow:!1,id:"feedID",label:e._("feeds.select.feed"),width:"three-eighths",children:n.length?n.reduce(((e,t)=>null==t._id?e:e.concat((0,g.tZ)(c.Ql,{id:t._id,children:t.label},t._id))),[(0,g.tZ)(c.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:"feeds.select.feed"})})},"select-feed")]):[(0,g.tZ)(c.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:"feeds.no.feeds.available"})})},"empty")]}),l&&(0,g.tZ)(c.fE,{id:"search",label:e._("feeds.search.term"),placeholder:e._("feeds.search")}),l&&(0,g.tZ)(c.zx,{type:"submit",labelOffset:!0,children:(0,g.tZ)(s.cC,{id:"button.download"})},"button")]}),l&&(0,g.tZ)(Pe,{selectedFeedID:l})]})})),Me=Ee,Ve=(0,r.Pi)((e=>{let{currentFeed:t,intervalMultipliers:l,onSelect:i,onRemove:n}=e;const{feeds:r}=ge,{i18n:a}=(0,s.mV)();return 0===r.length?(0,g.tZ)("ul",{className:"interactive-list",children:(0,g.tZ)("li",{className:"interactive-list__item",children:(0,g.tZ)(s.cC,{id:"feeds.no.feeds.defined"})})}):(0,g.tZ)("ul",{className:"interactive-list feed-list",children:r.map((e=>{const r=e.count||0;let d=`${e.interval}`,c=l[0].message;return l.forEach((t=>{e.interval%t.value==0&&(d=""+e.interval/t.value,c=t.message)})),(0,g.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content feed-list__feed",children:[(0,g.BX)("div",{className:"interactive-list__label",children:[(0,g.BX)("ul",{className:"interactive-list__detail-list",children:[(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:e.label}),(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--secondary",children:(0,g.tZ)(s.cC,{id:"feeds.match.count",values:{count:r}})}),e===t&&(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:"Modifying"})]}),(0,g.BX)("ul",{className:"interactive-list__detail-list",children:[(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:`${d} ${a._(c)}`}),(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--tertiary",children:(0,g.tZ)("a",{href:e.url,rel:"noopener noreferrer",target:"_blank",children:e.url})})]})]}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action",type:"button",onClick:()=>i(e),children:(0,g.tZ)(y.I8,{})}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>n(e),children:(0,g.tZ)(y.x8,{})})]},e._id)}))})})),Ie=Ve,Re={url:{isValid:e=>null!=e&&""!==e&&null!==e.match(be),error:"feeds.validation.must.specify.valid.feed.url"},label:{isValid:ve,error:"feeds.validation.must.specify.label"},interval:{isValid:e=>{if(null===e||""===e)return!1;const t=parseInt(`${e}`,10);return!Number.isNaN(t)&&t>0},error:"feeds.validation.interval.not.positive"}},Le=(e,t)=>Re[e]?.isValid(t)?void 0:Re[e]?.error,Fe=[{message:"feeds.time.min",value:1},{message:"feeds.time.hr",value:60},{message:"feeds.time.day",value:1440}],Oe={label:"",interval:5,url:""},$e=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(null),[n,r]=(0,d.useState)({}),[a,o]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1);return(0,g.BX)("div",{children:[(0,g.BX)(c.l0,{className:"inverse",onChange:e=>{let{event:t,formData:l}=e;const i=t.target.name,a=l;r({...n,[i]:Le(i,a[i])})},onSubmit:async()=>{const t=e.current?.getFormData();if(null==e.current||null==t)return;h(!0);const n=Object.keys(Re).reduce(((e,l)=>({...e,[l]:Le(l,t[l])})),{});r(n);if(Object.keys(n).every((e=>void 0===n[e]))){const n={label:t.label,url:t.url,interval:Number(t.interval)*Number(t.intervalMultiplier)};let a=!0;try{null===l?await Ze.addFeed(n):null!=l?._id&&await Ze.modifyFeed(l._id,n)}catch{a=!1}a?(e.current.resetForm(),r({}),i(null),o(!1)):r({backend:"general.error.unknown"})}h(!1)},ref:e,children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"feeds.existing.feeds"})}),Object.keys(n).reduce(((e,l)=>(null!=n[l]&&e.push((0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:t._(n?.[l])})},`error-${l}`)),e)),[]),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.U2,{children:(0,g.tZ)(Ie,{currentFeed:l,intervalMultipliers:Fe,onSelect:e=>{i(e),o(!0)},onRemove:e=>{e===l&&(a&&(r({}),o(!1)),i(null)),null!=e._id&&Ze.removeFeedMonitor(e._id)}})})}),a?(0,g.tZ)(Te,{currentFeed:l,defaultFeed:Oe,intervalMultipliers:Fe,isSubmitting:u,onCancel:()=>{r({}),o(!1),i(null)}},l?._id||"initial"):(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.U2,{width:"auto"}),(0,g.tZ)(c.zx,{onClick:()=>{o(!0)},children:(0,g.tZ)(s.cC,{id:"button.new"})})]})]}),(0,g.tZ)(Me,{})]})},ze=()=>{const{i18n:e}=(0,s.mV)();(0,d.useEffect)((()=>{Ze.fetchFeedMonitors()}),[]);const t={feeds:{content:$e,label:e._("feeds.tabs.feeds")},downloadRules:{content:Xe,label:e._("feeds.tabs.download.rules")}};return(0,g.tZ)(de,{heading:e._("feeds.tabs.heading"),orientation:"horizontal",size:"large",tabs:t})};var Ue=l(4936);let Ae=function(e){return e[e.HTTP=1]="HTTP",e[e.UDP=2]="UDP",e[e.DHT=3]="DHT",e}({});const je=(e,t)=>{let l=`magnet:?xt=urn:btih:${e}`;return t?.length&&t.forEach((e=>{l=`${l}&tr=${encodeURI(e)}`})),l},He=()=>{const e=(0,d.useRef)(null),t=(0,d.useRef)(null),{i18n:l}=(0,s.mV)(),[i,n]=(0,d.useState)(!1),[r,a]=(0,d.useState)(!1),[o,u]=(0,d.useState)({isLoadingTrackers:!0,magnetTrackersLink:""});(0,d.useEffect)((()=>{_.Z.fetchTorrentTrackers(Ue.default.selectedTorrents[0]).then((e=>{null!=e&&u({isLoadingTrackers:!1,magnetTrackersLink:je(Ue.default.selectedTorrents[0],e.filter((e=>e.type!==Ae.DHT)).map((e=>e.url)))})}))}),[]);const h=je(Ue.default.selectedTorrents[0]);return(0,g.tZ)(de,{heading:l._("torrents.generate.magnet.heading"),content:(0,g.tZ)("div",{className:"modal__content inverse",children:(0,g.BX)(c.l0,{children:[Ue.default.torrents[Ue.default.selectedTorrents[0]]?.isPrivate?(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:l._("torrents.generate.magnet.private.torrent")})}):null,(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"magnet",ref:e,addonPlacement:"after",label:l._("torrents.generate.magnet.magnet"),defaultValue:h,readOnly:!0,children:(0,g.tZ)(c.G5,{onClick:()=>{"function"==typeof navigator.clipboard?.writeText?navigator.clipboard.writeText(h).then((()=>{n(!0)})):null!=e.current&&(e.current?.select(),document.execCommand("copy"),n(!0))},children:i?(0,g.tZ)(y.FV,{}):(0,g.tZ)(y.TU,{})})})}),(0,g.tZ)(c.p7,{children:o.isLoadingTrackers?(0,g.tZ)(c.fE,{id:"loading",label:l._("torrents.generate.magnet.magnet.with.trackers"),placeholder:l._("torrents.generate.magnet.loading.trackers"),disabled:!0}):(0,g.tZ)(c.fE,{id:"magnet-trackers",ref:t,addonPlacement:"after",label:l._("torrents.generate.magnet.magnet.with.trackers"),defaultValue:o.magnetTrackersLink,readOnly:!0,children:(0,g.tZ)(c.G5,{onClick:()=>{"function"==typeof navigator.clipboard?.writeText?navigator.clipboard.writeText(o.magnetTrackersLink).then((()=>{a(!0)})):null!=t.current&&(t.current?.select(),document.execCommand("copy"),a(!0))},children:r?(0,g.tZ)(y.FV,{}):(0,g.tZ)(y.TU,{})})})})]})}),actions:[{clickHandler:null,content:l._("button.close"),triggerDismiss:!0,type:"tertiary"}]})},qe=e=>{let t="";for(let l=0;l<e[0].length;l+=1)for(let i=1;i<e.length;i+=1)e[0][l]!==e[i][l]&&(t=e[0].slice(0,l));for(let e=t.length-1;e>=0;e-=1)if("/"===t[e])return t.slice(0,e+1)},Ge=()=>{const{i18n:e}=(0,s.mV)(),[t,l]=(0,d.useState)(!1);return(0,g.tZ)(de,{heading:e._("torrents.move.heading"),content:(0,g.tZ)("div",{className:"modal__content",children:(0,g.BX)(c.l0,{className:"inverse",onSubmit:e=>{let{formData:t}=e;const i=Ue.default.selectedTorrents;i.length>0&&(l(!0),_.Z.moveTorrents({hashes:i,destination:t.destination,isBasePath:t.isBasePath,moveFiles:t.moveFiles,isCheckHash:t.isCheckHash}).then((()=>{m.Z.setActiveModal(null),l(!1)})))},children:[(0,g.tZ)($,{id:"destination",selectable:"directories",suggested:qe(Ue.default.selectedTorrents.map((e=>Ue.default.torrents[e].directory))),showBasePathToggle:!0}),(0,g.tZ)(p,{actions:[{checked:!0,content:e._("torrents.move.data.label"),id:"moveFiles",type:"checkbox"},{checked:!1,content:e._("torrents.move.check_hash.label"),id:"isCheckHash",type:"checkbox"},{content:e._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{content:e._("torrents.move.button.set.location"),isLoading:t,submit:!0,type:"primary"}]})]})})})},Qe=()=>{const{i18n:e}=(0,s.mV)(),[t,l]=(0,d.useState)(!1),{selectedTorrents:i}=Ue.default;return 0===i.length?(0,g.tZ)(de,{heading:e._("torrents.remove"),content:(0,g.tZ)("div",{className:"modal__content inverse",children:(0,g.tZ)(c.l0,{children:(0,g.tZ)(c.p7,{children:(0,g.tZ)(s.cC,{id:"torrents.remove.error.no.torrents.selected"})})})}),actions:[{clickHandler:null,content:e._("button.ok"),triggerDismiss:!0,type:"primary"}]}):(0,g.tZ)(de,{heading:e._("torrents.remove"),content:(0,g.tZ)("div",{className:"modal__content",children:(0,g.BX)(c.l0,{className:"inverse",onSubmit:e=>{let{formData:t}=e;l(!0);const i=t.deleteData;_.Z.deleteTorrents({hashes:Ue.default.selectedTorrents,deleteData:i}).then((()=>{l(!1),(e=>{let{deleteData:t}=e;null!=t&&o.Z.saveSetting("deleteTorrentData",t)})({deleteData:i}),m.Z.setActiveModal(null)}))},children:[(0,g.tZ)(c.p7,{children:(0,g.tZ)(s.cC,{id:"torrents.remove.are.you.sure",values:{count:i.length}})}),(0,g.tZ)(p,{actions:[{checked:u.default.floodSettings.deleteTorrentData,content:e._("torrents.remove.delete.data"),id:"deleteData",type:"checkbox"},{content:e._("button.no"),triggerDismiss:!0,type:"tertiary"},{content:e._("button.yes"),isLoading:t,submit:!0,type:"primary"}]})]})})})},We=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(!1);return(0,g.tZ)(de,{heading:t._("torrents.set.tags.heading"),content:(0,g.tZ)("div",{className:"modal__content inverse",children:(0,g.tZ)(c.l0,{ref:e,children:(0,g.tZ)(c.p7,{children:(0,g.tZ)(H,{defaultValue:Ue.default.selectedTorrents.map((e=>Ue.default.torrents[e].tags))[0].slice(),id:"tags",placeholder:t._("torrents.set.tags.enter.tags")})})})}),actions:[{content:t._("button.cancel"),clickHandler:null,triggerDismiss:!0,type:"tertiary"},{content:t._("torrents.set.tags.button.set"),clickHandler:()=>{if(null==e.current)return;const{selectedTorrents:t}=Ue.default,l=e.current.getFormData(),n=l.tags?l.tags.split(",").filter((e=>!!e)):[];i(!0),t?.length>0&&_.Z.setTags({hashes:t,tags:n})},isLoading:l,triggerDismiss:!1,type:"primary"}]})},Ye=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(!1),[n,r]=(0,d.useState)({isLoadingTrackers:!0,trackerURLs:[]});return(0,d.useEffect)((()=>{_.Z.fetchTorrentTrackers(Ue.default.selectedTorrents[0]).then((e=>{null!=e&&r({isLoadingTrackers:!1,trackerURLs:e.filter((e=>e.type!==Ae.DHT)).map((e=>e.url))})}))}),[]),(0,g.tZ)(de,{heading:t._("torrents.set.trackers.heading"),content:(0,g.tZ)("div",{className:"modal__content inverse",children:(0,g.tZ)(c.l0,{ref:e,children:n.isLoadingTrackers?(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"loading",placeholder:t._("torrents.set.trackers.loading.trackers"),disabled:!0})}):(0,g.tZ)(Q,{id:"trackers",placeholder:t._("torrents.set.trackers.enter.tracker"),defaultValues:0===n.trackerURLs.length?void 0:n.trackerURLs.map(((e,t)=>({id:t,value:e})))})})}),actions:[{clickHandler:null,content:t._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:()=>{if(null==e.current||l||n.isLoadingTrackers)return;i(!0);const t=e.current.getFormData(),r=q(t,"trackers").filter((e=>""!==e));_.Z.setTrackers({hashes:Ue.default.selectedTorrents,trackers:r}).then((()=>{i(!1),m.Z.setActiveModal(null)}))},content:t._("torrents.set.trackers.button.set"),isLoading:l||n.isLoadingTrackers,triggerDismiss:!1,type:"primary"}]})},Je="4.8.0",Ke=(0,d.lazy)((()=>l.e(443).then(l.t.bind(l,6641,23)).then((e=>({default:e.react}))))),et="https://github.com/jesec/flood",tt=()=>(0,g.tZ)(d.Suspense,{fallback:null,children:(0,g.tZ)(Ke,{FloodVersion:()=>Je,CommitBadge:()=>Je.length>8?(0,g.tZ)("a",{href:et,children:(0,g.tZ)("img",{alt:"Latest version of rolling build",src:"https://img.shields.io/npm/v/@jesec/flood?label=HEAD"})}):(0,g.tZ)("a",{href:et,children:(0,g.tZ)("img",{alt:"Commits since user's version",src:`https://img.shields.io/github/commits-since/jesec/flood/v${Je}`})})})});var lt=l(8111),it=l(2552),nt=l(2809),rt=l(4982);const at=(0,r.Pi)((()=>{const e=(0,d.useRef)(null),t=(0,d.useRef)(null),[l,r]=(0,d.useState)(null),[a,o]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1),{i18n:_}=(0,s.mV)();if((0,d.useEffect)((()=>{it.Z.currentUser.isAdmin&<.Z.fetchUsers().then((()=>{o(!0)}))}),[]),!it.Z.currentUser.isAdmin)return(0,g.BX)(c.l0,{children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"auth.user.accounts"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:(0,g.tZ)(s.cC,{id:"auth.message.not.admin"})})})]});const m=!a&&0===it.Z.users.length,p=U()("interactive-list",{"interactive-list--loading":m});return(0,g.BX)(c.l0,{onSubmit:()=>{if(null==e.current||null==t.current)return;const l=e.current.getFormData();if(null==l.username||""===l.username)r("auth.error.username.empty");else if(null==l.password||""===l.password)r("auth.error.password.empty");else{h(!0);const i=t.current;if(null==i)return r("connection.settings.error.empty"),void h(!1);lt.Z.createUser({username:l.username,password:l.password,client:i,level:!0===l.isAdmin?nt.u.ADMINISTRATOR:nt.u.USER}).then((()=>{null!=e.current&&e.current.resetForm(),r(null),h(!1)}),(()=>{r("general.error.unknown"),h(!1)})).then(lt.Z.fetchUsers)}},ref:e,children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"auth.user.accounts"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.U2,{children:(0,g.BX)("ul",{className:p,children:[(0,g.tZ)(n.Z,{children:m&&(0,g.tZ)(i.Z,{classNames:"interactive-list__loading-indicator",timeout:{enter:250,exit:250},children:(0,g.tZ)("div",{className:"interactive-list__loading-indicator",children:(0,g.tZ)(c.$z,{})},"loading-indicator")})}),it.Z.users.slice().sort(((e,t)=>e.username.localeCompare(t.username))).map((e=>{const t=e.username===it.Z.currentUser.username;let l=null,i=null;t?l=(0,g.tZ)("span",{className:"interactive-list__label__tag tag",children:(0,g.tZ)(s.cC,{id:"auth.current.user"})}):i=(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>lt.Z.deleteUser(e.username).then(lt.Z.fetchUsers),children:(0,g.tZ)(y.x8,{})});const n=U()("interactive-list__item",{"interactive-list__item--disabled":t});return(0,g.BX)("li",{className:n,children:[(0,g.BX)("span",{className:"interactive-list__label",children:[(0,g.tZ)("div",{className:"interactive-list__label__text",children:e.username}),l]}),i]},e.username)}))]})})}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"auth.add.user"})}),l&&(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:_._(l)})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"username",label:(0,g.tZ)(s.cC,{id:"auth.username"}),placeholder:_._("auth.username"),autoComplete:"username"}),(0,g.tZ)(c.fE,{id:"password",label:(0,g.tZ)(s.cC,{id:"auth.password"}),placeholder:_._("auth.password"),autoComplete:"new-password"}),(0,g.tZ)(c.XZ,{grow:!1,id:"isAdmin",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"auth.admin"})})]}),(0,g.tZ)(rt.Z,{onSettingsChange:e=>{t.current=e}}),(0,g.tZ)("p",{}),(0,g.tZ)(c.p7,{justify:"end",children:(0,g.tZ)(c.zx,{isLoading:u,priority:"primary",type:"submit",children:(0,g.tZ)(s.cC,{id:"button.add"})})})]})})),st=(e,t)=>null!=e[t]?e[t]:u.default.clientSettings?.[t],dt=e=>{const t=e.target,l=t.name,{value:i,type:n,checked:r}=t;let a={};return a="checkbox"===n?{[l]:r}:{[l]:i},a},ct=e=>{if(e&&0!==e.length)return e.join(", ")},ot=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return""===e?[]:e.replace(/\s/g,"").split(",").map((e=>Number(e)))},ut=e=>{let{onSettingsChange:t,onClientSettingsChange:l}=e;const[i,n]=(0,d.useState)({});return(0,g.BX)(c.l0,{onChange:e=>{let{event:r,formData:a}=e;const s=r.target;if("dropdownPresetDownload"===s.name||"dropdownPresetUpload"===s.name)return void t({speedLimits:{download:ot(a.dropdownPresetDownload),upload:ot(a.dropdownPresetUpload)}});const d={...i,...dt(r)};n(d),l(d)},children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.heading"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:null!=u.default.floodSettings.speedLimits?ct(u.default.floodSettings.speedLimits.download):0,label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.dropdown.preset.download.label"}),id:"dropdownPresetDownload"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:null!=u.default.floodSettings.speedLimits?ct(u.default.floodSettings.speedLimits.upload):0,label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.dropdown.preset.upload.label"}),id:"dropdownPresetUpload"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleGlobalDownSpeed"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.global.throttle.download"}),id:"throttleGlobalDownSpeed"}),(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleGlobalUpSpeed"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.global.throttle.upload"}),id:"throttleGlobalUpSpeed"})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.heading"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleMaxUploads"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.upload.label"}),id:"throttleMaxUploads"}),(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleMaxUploadsGlobal"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.upload.global.label"}),id:"throttleMaxUploadsGlobal"})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleMaxDownloads"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.download.label"}),id:"throttleMaxDownloads"}),(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleMaxDownloadsGlobal"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.download.global.label"}),id:"throttleMaxDownloadsGlobal"})]})]})},ht=e=>{let{onClientSettingsChange:t}=e;const[l,i]=(0,d.useState)({});return(0,g.BX)(c.l0,{onChange:e=>{let{event:n}=e;const r={...l,...dt(n)};i(r),t(r)},children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.connectivity.incoming.heading"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"networkPortRange"),id:"networkPortRange",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.port.range.label"}),width:"one-quarter"}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"networkPortRandom"),grow:!1,id:"networkPortRandom",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.connectivity.port.randomize.label"})}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"networkPortOpen"),grow:!1,id:"networkPortOpen",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.connectivity.port.open.label"})})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"networkLocalAddress"),id:"networkLocalAddress",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.ip.hostname.label"})}),(0,g.tZ)(c.fE,{defaultValue:st(l,"networkHttpMaxOpen"),id:"networkHttpMaxOpen",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.max.http.connections"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.connectivity.dpd.heading"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"dhtPort"),id:"dhtPort",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.dht.port.label"}),width:"one-quarter"}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"dht"),grow:!1,id:"dht",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.connectivity.dht.label"})}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"protocolPex"),grow:!1,id:"protocolPex",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.connectivity.peer.exchange.label"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.heading"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"throttleMinPeersNormal"),id:"throttleMinPeersNormal",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.min.label"})}),(0,g.tZ)(c.fE,{defaultValue:st(l,"throttleMaxPeersNormal"),id:"throttleMaxPeersNormal",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.max.label"})})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"throttleMinPeersSeed"),id:"throttleMinPeersSeed",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.seeding.min.label"})}),(0,g.tZ)(c.fE,{defaultValue:st(l,"throttleMaxPeersSeed"),id:"throttleMaxPeersSeed",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.seeding.max.label"})})]}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:st(l,"trackersNumWant"),id:"trackersNumWant",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.desired.label"}),width:"one-half"})})]})};var _t=l(5181),mt=l(8826),gt=l(5587),pt=l(9752),ft=l(2339),Zt=l(4285);const bt=e=>{const{children:t,id:l,disabled:i}=e,{attributes:n,setNodeRef:r,listeners:a,transform:s,transition:d,isDragging:c}=(0,gt.nB)({id:l,disabled:i}),o={transform:Zt.ux.Transform.toString(s),transition:d};return(0,g.BX)("div",{className:U()("sortable-list__item",{"sortable-list__item--is-dragging":c,"sortable-list__item--is-locked":i}),ref:r,style:o,...n,...a,children:[i?(0,g.tZ)(y.HE,{}):null,t]})};var vt={name:"z45y2s",styles:"width:100%;touch-action:none"};const yt=e=>{let{className:t,items:l,lockedIDs:i,renderItem:n,onMouseDown:r,onDrop:a}=e;const[s,c]=(0,d.useState)(l),o=U()("sortable-list",t),u=(0,pt.VT)(pt.Lg),h=(0,pt.VT)(pt.MA,{activationConstraint:{distance:10}}),_=(0,pt.VT)(pt.LO,{activationConstraint:{distance:10}});return(0,g.tZ)("div",{css:vt,role:"none",onMouseDown:e=>{r&&r(e)},children:(0,g.tZ)(pt.LB,{sensors:[u,h,_],onDragEnd:e=>{let{active:t,over:i}=e;if(null==i)return;if(t.id===i.id)return;const n=(0,gt.Rp)(l,l.findIndex((e=>e===t.id)),l.findIndex((e=>e===i.id)));c(n),a&&a(n)},modifiers:[ft.DL,ft.F4],autoScroll:!1,children:(0,g.tZ)(gt.Fo,{items:s,strategy:gt.qw,children:(0,g.tZ)("ul",{className:o,children:s.map(((e,t)=>(0,g.tZ)(bt,{id:e,disabled:i.includes(e),children:n(e,t)},e)))})})})})};yt.defaultProps={onMouseDown:void 0,onDrop:void 0};const Ct=yt,kt=e=>{let{onSettingsChange:t}=e;const[l,i]=(0,d.useState)((()=>{const{mountPoints:e}=u.default.floodSettings,t=Object.assign({},...mt.default.disks.map((e=>({[e.target]:e}))));return e.filter((e=>e in t)).map((e=>({id:e,visible:!0}))).concat(Object.keys(t).filter((t=>!e.includes(t))).map((e=>({id:e,visible:!1}))))})()),n=l.reduce(((e,t)=>{let{id:l,visible:i}=t;return e[l]=i,e}),{});return(0,g.tZ)(Ct,{className:"sortable-list--disks",items:l.map((e=>{let{id:t}=e;return t})),lockedIDs:[],onDrop:e=>{i(e.map((e=>({id:e,visible:n[e]}))))},renderItem:e=>{const r=(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,g.tZ)(c.XZ,{defaultChecked:n[e],id:e,onClick:r=>{n[e]=r.target.checked;const a=l.map((t=>t.id===e?{...t,visible:r.target.checked}:t));t({mountPoints:a.filter((e=>e.visible)).map((e=>e.id))}),i(a)},children:(0,g.tZ)(s.cC,{id:"settings.diskusage.show"})})});return(0,g.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,g.tZ)("div",{children:e})}),r]})}})},Nt=e=>{let{onSettingsChange:t}=e;return(0,g.BX)(c.l0,{children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.diskusage.mount.points"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(kt,{onSettingsChange:t})})]})},wt=e=>{let{onClientSettingsChange:t}=e;const[l,i]=(0,d.useState)({});return(0,g.BX)(c.l0,{onChange:e=>{let{event:n}=e;const r={...l,...dt(n)};i(r),t(r)},children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.resources.disk.heading"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:st(l,"directoryDefault"),id:"directoryDefault",label:(0,g.tZ)(s.cC,{id:"settings.resources.disk.download.location.label"})})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"networkMaxOpenFiles"),id:"networkMaxOpenFiles",label:(0,g.tZ)(s.cC,{id:"settings.resources.max.open.files"}),width:"one-half"}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"piecesHashOnCompletion"),grow:!1,id:"piecesHashOnCompletion",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.resources.disk.check.hash.label"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.resources.memory.heading"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:st(l,"piecesMemoryMax"),id:"piecesMemoryMax",label:(0,g.BX)("div",{children:[(0,g.tZ)(s.cC,{id:"settings.resources.memory.max.label"})," ",(0,g.tZ)("em",{className:"unit",children:"(MB)"})]}),width:"one-half"})})]})};var St=l(7731);var xt={name:"1d3w5wq",styles:"width:100%"},Bt={name:"15rw530",styles:".sortable-list__item{cursor:default;}"};const Xt=e=>{let{className:t,checkboxLabel:l,items:i}=e;return(0,g.tZ)("div",{css:xt,role:"none",children:(0,g.tZ)("ul",{className:U()("sortable-list",t),css:Bt,children:i.map((e=>{const{id:t,label:i,isLocked:n=!1,defaultChecked:r,onClick:a}=e;return(0,g.BX)("li",{className:U()("sortable-list__item",{"sortable-list__item--is-locked":n}),children:[n?(0,g.tZ)(y.HE,{}):null,(0,g.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,g.tZ)(s.cC,{id:i})}),n?null:(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,g.tZ)(c.XZ,{defaultChecked:r,id:t,onClick:e=>a?.(e.target.checked),children:l&&(0,g.tZ)(s.cC,{id:l})})})]})]},t||i)}))})})};Xt.defaultProps={className:void 0,checkboxLabel:void 0};const Tt=Xt,Dt=e=>{let{onSettingsChange:t}=e;const l=(0,d.useRef)(u.default.floodSettings.UIPageTitleSpeedEnabled);return(0,g.tZ)(Tt,{items:[{label:"settings.ui.page.title.speed",defaultChecked:l.current,onClick:()=>{l.current=!l.current,t({UIPageTitleSpeedEnabled:l.current})}}]})};var Pt=l(8737),Et=l(2433);const Mt=e=>{let{onSettingsChange:t}=e;const l=(0,d.useRef)(Et.Z.torrentContextMenuActions.map((e=>{let{id:t,visible:l}=e;return{id:t,visible:u.default.floodSettings.torrentContextMenuActions.find((e=>e.id===t))?.visible??l}})));return(0,g.tZ)(Tt,{checkboxLabel:"settings.ui.torrent.context.menu.items.show",items:Object.keys(Pt.Z).map((e=>({label:Pt.Z[e],isLocked:"start"===e||"stop"===e||"setTaxonomy"===e||"torrentDetails"===e,defaultChecked:l.current.some((t=>t.id===e&&t.visible)),onClick:()=>{const i=l.current.find((t=>t.id===e));null!=i&&(i.visible=!i.visible),t({torrentContextMenuActions:l.current})}})))})};var Vt=l(882),It=l(9097);const Rt=e=>{let{torrentListViewSize:t,onSettingsChange:l}=e;const i=(0,d.useRef)(null),[n,r]=(0,d.useState)([...u.default.floodSettings.torrentListColumns.filter((e=>null!=Vt.Z[e.id])).slice(),...Object.keys(Vt.Z).filter((e=>u.default.floodSettings.torrentListColumns.every((t=>t.id!==e)))).map((e=>({id:e,visible:!1})))]),a=n.reduce(((e,t)=>{let{id:l,visible:i}=t;return e[l]=i,e}),{}),o="expanded"===t?["name","eta","downRate","percentComplete","downTotal","upRate"]:[];return(0,g.tZ)(Ct,{className:"sortable-list--torrent-details",items:n.map((e=>{let{id:t}=e;return t})),lockedIDs:o,onMouseDown:()=>{i.current?.dismissTooltip()},onDrop:e=>{const t=e.map((e=>({id:e,visible:a[e]})));l({torrentListColumns:t}),r(t)},renderItem:(e,d)=>{let u=null,h=null;if(o.includes(e)||(u=(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,g.tZ)(c.XZ,{defaultChecked:a[e],id:e,onClick:t=>{a[e]=t.target.checked;const i=n.map((l=>({id:l.id,visible:l.id===e?t.target.checked:l.visible})));r(i),l({torrentListColumns:i})},children:(0,g.tZ)(s.cC,{id:"settings.ui.torrent.details.enabled"})})})),"tags"===e&&"expanded"===t&&d<n.length-1){const e=(0,g.tZ)(s.cC,{id:"settings.ui.torrent.details.tags.placement"});h=(0,g.tZ)(It.Z,{className:"tooltip tooltip--is-error",content:e,offset:-5,ref:i,width:200,wrapperClassName:"sortable-list__content sortable-list__content--secondary tooltip__wrapper",wrapText:!0,children:(0,g.tZ)(y.jj,{})})}return(0,g.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[h,(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,g.tZ)(s.cC,{id:Vt.Z[e]})}),u]})}})},Lt=e=>{let{onSettingsChange:t}=e;const{i18n:l}=(0,s.mV)(),[i,n]=(0,d.useState)(u.default.floodSettings.torrentListViewSize),[r,a]=(0,d.useState)(u.default.floodSettings.language),[o,h]=(0,d.useState)(u.default.floodSettings.UITagSelectorMode);return(0,g.BX)(c.l0,{onChange:e=>{let{event:l,formData:r}=e;const s=l.target;if("radio"===s.type&&(n(r["ui-torrent-size"]),h(r["ui-tag-selector-mode"]),t({torrentListViewSize:i,UITagSelectorMode:o})),"language"===s.name){const e=r.language;a(e),t({language:e})}},children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.language"})},"locale-header"),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Ph,{defaultID:r,id:"language",children:Object.keys(St.Z).map((e=>(0,g.tZ)(c.Ql,{id:e,children:"auto"===e?l._(St.Z[e].id):St.Z[e]},e)))})},"locale-selection"),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.tag.selector.mode"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.Y8,{defaultChecked:"single"===o,groupID:"ui-tag-selector-mode",id:"single",width:"auto",children:(0,g.tZ)(s.cC,{id:"settings.ui.tag.selector.mode.single"})}),(0,g.tZ)(c.Y8,{defaultChecked:"multi"===o,groupID:"ui-tag-selector-mode",id:"multi",width:"auto",children:(0,g.tZ)(s.cC,{id:"settings.ui.tag.selector.mode.multi"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.torrent.list"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.Y8,{defaultChecked:"expanded"===i,groupID:"ui-torrent-size",id:"expanded",width:"auto",children:(0,g.tZ)(s.cC,{id:"settings.ui.torrent.size.expanded"})}),(0,g.tZ)(c.Y8,{defaultChecked:"condensed"===i,groupID:"ui-torrent-size",id:"condensed",width:"auto",children:(0,g.tZ)(s.cC,{id:"settings.ui.torrent.size.condensed"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.displayed.details"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(Rt,{torrentListViewSize:i,onSettingsChange:t})}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.displayed.context.menu.items"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(Mt,{onSettingsChange:t})}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.misc"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(Dt,{onSettingsChange:t})})]})},Ft=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)(),[t,l]=(0,d.useState)({}),[i,n]=(0,d.useState)({}),[r,a]=(0,d.useState)(!1),c=e=>{l({...t,...e})},u=e=>{n({...i,...e})},h={bandwidth:{content:ut,props:{onClientSettingsChange:c,onSettingsChange:u},label:e._("settings.tabs.bandwidth")},connectivity:{content:ht,props:{onClientSettingsChange:c},label:e._("settings.tabs.connectivity")},resources:{content:wt,props:{onClientSettingsChange:c},label:e._("settings.tabs.resources")},..."none"!==ee.default.authMethod?{authentication:{content:at,label:e._("settings.tabs.authentication")}}:{},ui:{content:Lt,label:e._("settings.tabs.userinterface"),props:{onSettingsChange:u}},diskusage:{content:Nt,label:e._("settings.tabs.diskusage"),props:{onSettingsChange:u}},about:{content:tt,label:e._("settings.tabs.about")}};return(0,g.tZ)(de,{actions:[{clickHandler:null,content:e._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:()=>{a(!0),Promise.all([o.Z.saveSettings(i,{alert:!0}),_t.Z.saveSettings(t,{alert:!0})]).then((()=>{a(!1),m.Z.setActiveModal(null)}))},isLoading:r,content:e._("button.save"),triggerDismiss:!1,type:"primary"}],size:"large",heading:e._("settings.tabs.heading"),orientation:ee.default.isSmallScreen?"horizontal":"vertical",tabs:h})})),Ot=()=>{const{i18n:e}=(0,s.mV)(),t=(0,d.useRef)(he().CancelToken.source()),l=(0,d.useRef)(null),[i,n]=(0,d.useState)(null),[r,a]=(0,d.useState)(null),[o,u]=(0,d.useState)(!0),[h,p]=(0,d.useState)(!1);(0,d.useEffect)((()=>{const{current:e}=t;return"torrent-details"===m.Z.activeModal?.id&&_.Z.fetchMediainfo(m.Z.activeModal?.hash,t.current.token).then((e=>{n(e.output),u(!1)}),(e=>{he().isCancel(e)||(a(e.response.data),u(!1))})),()=>{e.cancel()}}),[]);let f="mediainfo.heading";return o?f="mediainfo.fetching":r&&(f="mediainfo.execError"),(0,g.BX)("div",{className:"torrent-details__section mediainfo modal__content--nested-scroll__content",children:[(0,g.BX)("div",{className:"mediainfo__toolbar",children:[(0,g.tZ)("div",{className:"mediainfo__toolbar__item",children:(0,g.tZ)("span",{className:"torrent-details__table__heading--tertiary",children:(0,g.tZ)(s.cC,{id:f})})}),i&&(0,g.tZ)(It.Z,{content:e._(h?"general.clipboard.copied":"general.clipboard.copy"),wrapperClassName:"tooltip__wrapper mediainfo__toolbar__item",children:(0,g.tZ)(c.zx,{priority:"tertiary",onClick:()=>{null!=i&&("function"==typeof navigator.clipboard?.writeText?navigator.clipboard.writeText(i).then((()=>{p(!0)})):null!=l.current&&(l.current.value=i,l.current.select(),document.execCommand("copy"),p(!0)))},children:h?(0,g.tZ)(y.MC,{}):(0,g.tZ)(y.TU,{})})})]}),(0,g.tZ)("input",{ref:l,style:{width:"0.1px",height:"1px",position:"absolute",right:0}}),r?(0,g.tZ)("pre",{className:"mediainfo__output mediainfo__output--error",children:r.message}):(0,g.tZ)("pre",{className:"mediainfo__output",children:i})]})},$t=(e,t)=>({...e,...null!=e.directories?{directories:Object.assign({},...Object.keys(e.directories).map((l=>null!=e.directories?{[l]:$t(e.directories[l],t)}:{})))}:{},...null!=e.files?{files:Object.assign({},...Object.keys(e.files).map((l=>null!=e.files?{[l]:{...e.files[l],isSelected:t}}:{})))}:{},isSelected:t}),zt=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const{depth:i,path:n,select:r,type:a}=t,s=n[l];if(l===i-1){if("file"===a&&null!=e.files?.[s]){const t={...e.files,[s]:{...e.files[s],isSelected:r}};return{...e,files:t,isSelected:Object.values(t).every((e=>{let{isSelected:t}=e;return t}))&&(null==e.directories||Object.values(e.directories).every((e=>{let{isSelected:t}=e;return t})))}}if("directory"===a&&null!=e.directories){const t={...e.directories,[s]:$t(e.directories[s],r)};return{...e,directories:t,isSelected:Object.values(t).every((e=>{let{isSelected:t}=e;return t}))&&(null==e.files||Object.values(e.files).every((e=>{let{isSelected:t}=e;return t})))}}return e}if(null!=e.directories){const i=e.directories;return Object.keys(i).forEach((e=>{e===s&&(i[e]=zt(i[e],t,l+1))})),{...e,directories:i,isSelected:Object.values(i).every((e=>{let{isSelected:t}=e;return t}))}}return e},Ut=e=>{const t=[];if(null!=e.files){const{files:l}=e;Object.keys(l).forEach((e=>{const i=l[e];i.isSelected&&t.push(i.index)}))}if(null!=e.directories){const{directories:l}=e;Object.keys(l).forEach((e=>{t.push(...Ut(l[e]))}))}return t},At={selectAll:$t,applySelection:zt,getSelectedItems:Ut,getSelectionTree:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const l={isSelected:t};return e.forEach((e=>{const i=e.path.split("/");let n=l;for(;i.length-1;){const e=i.shift();null==n.directories&&(n.directories={}),null==n.directories[e]&&(n.directories[e]={isSelected:t}),n=n.directories[e]}null==n.files&&(n.files={}),n.files[e.filename]={...e,isSelected:t}})),l}};var jt=l(2036),Ht=l(2104);const qt=e=>{let{depth:t,items:l,hash:i,path:n,onItemSelect:r}=e;const[a,s]=(0,d.useState)(null),o=(0,d.useRef)({});if(null==l)return null;const u=Object.values(l).sort(((e,t)=>e.filename.localeCompare(t.filename))).map((e=>{const d=l&&l[e.filename]&&l[e.filename].isSelected||!1,u=U()("directory-tree__node file","directory-tree__node--file directory-tree__node--selectable",{"directory-tree__node--selected":d});return(0,g.BX)("div",{className:u,title:e.filename,children:[(0,g.BX)("div",{className:"file__label file__detail",children:[(0,g.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,g.tZ)(c.XZ,{checked:d,id:`${e.index}`,onClick:()=>r({type:"file",depth:t,path:[...n,e.filename],select:!d})})}),(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:(0,g.tZ)(y.$B,{})})]}),(0,g.tZ)("div",{className:"file__name",children:(0,g.tZ)("a",{href:`${ee.default.baseURI}api/torrents/${i}/contents/${e.index}/data`,style:{textDecoration:"none"},target:"_blank",rel:"noreferrer",children:e.filename})})]}),(0,g.tZ)("div",{className:"file__detail file__detail--secondary",children:(0,g.tZ)(Ht.Z,{value:e.sizeBytes,precision:1})}),(0,g.BX)("div",{className:"file__detail file__detail--secondary",children:[Math.trunc(e.percentComplete),"%"]}),(0,g.tZ)("div",{className:"file__detail file__detail--secondary file__detail--priority",children:(0,g.tZ)(jt.Z,{level:e.priority,id:e.index,maxLevel:2,onChange:(e,t)=>_.Z.setFilePriority(i,{indices:[Number(e)],priority:t}),priorityType:"file"},`${e.index}-${e.filename}`)}),"function"==typeof navigator.clipboard?.writeText&&(0,g.tZ)("button",{className:"file__detail file__detail--secondary file__detail--clipboard",type:"button",onClick:()=>{const t=t=>{""!==t&&("function"==typeof navigator.share?navigator.share({title:e.filename,url:t}).then((()=>s(e.index))):navigator.clipboard.writeText(t).then((()=>s(e.index))))},l=o.current[e.index];null!=l?t(l):(o.current[e.index]="",_.Z.getTorrentContentsDataPermalink(i,[e.index]).then((l=>{o.current[e.index]=l,t(l)}),(()=>{o.current[e.index]=null})))},children:a===e.index?(0,g.tZ)(y.MC,{}):(0,g.tZ)(y.TU,{})})]},e.filename)}));return(0,g.tZ)("div",{className:"directory-tree__node directory-tree__node--file-list",children:u})};var Gt={name:"r5l0s9",styles:"width:100%;text-align:left;:focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"};const Qt=e=>{let{depth:t,directoryName:l,id:i,itemsTree:n,hash:r,path:a,isSelected:s,onItemSelect:o}=e;const[u,h]=(0,d.useState)(!1),_=[...a,l];return(0,g.BX)("div",{className:U()("directory-tree__branch",`directory-tree__branch--depth-${t}`,{"directory-tree__node--selected":s}),children:[(0,g.tZ)("button",{className:U()("directory-tree__node","directory-tree__node--selectable directory-tree__node--directory",{"is-expanded":u}),css:Gt,type:"button",onClick:()=>h(!u),title:l,children:(0,g.BX)("div",{className:"file__label",children:[(0,g.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,g.tZ)(c.XZ,{checked:s,id:i,onClick:()=>o({type:"directory",depth:t,path:_,select:!s})})}),(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:u?(0,g.tZ)(y.DB,{}):(0,g.tZ)(y.Bm,{})})]}),(0,g.tZ)("div",{className:"file__name",children:l})]})}),u?(0,g.tZ)("div",{className:"directory-tree__node directory-tree__node--group",children:(0,g.tZ)(Wt,{depth:t,hash:r,onItemSelect:o,path:_,itemsTree:n},`${u}-${t}`)}):null]})},Wt=e=>{const{depth:t=0,itemsTree:l,hash:i,path:n,onItemSelect:r}=e,{files:a,directories:s}=l,d=t+1,c=null!=s?Object.keys(s).sort(((e,t)=>e.localeCompare(t))).map(((e,t)=>{const a=l.directories&&l.directories[e],s=`${t}${d}${e}`,c=a&&a.isSelected||!1;return null==a?null:(0,g.tZ)(Qt,{depth:d,directoryName:e,hash:i,id:s,isSelected:c,itemsTree:a,onItemSelect:r,path:n},s)})):[],o=null!=a&&Object.keys(a).length>0?(0,g.tZ)(qt,{depth:d,hash:i,onItemSelect:r,path:n,items:l.files},`files-${d}`):null;return(0,g.tZ)("div",{className:"directory-tree__tree",children:c.concat(o)})},Yt=(0,r.Pi)((()=>{const[e,t]=(0,d.useState)([]),[l,i]=(0,d.useState)({}),[n,r]=(0,d.useState)([]),{i18n:a}=(0,s.mV)();if((0,d.useEffect)((()=>{"torrent-details"===m.Z.activeModal?.id&&_.Z.fetchTorrentContents(m.Z.activeModal?.hash).then((e=>{null!=e&&(t(e),i(At.getSelectionTree(e)))}))}),[]),"torrent-details"!==m.Z.activeModal?.id)return null;const{hash:o}=m.Z?.activeModal;let u=null,h=null,p=!1;e?.length>0?(p=n.length>=e.length,u=(0,g.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.XZ,{checked:p,id:"select-all",onClick:()=>{const t=At.getSelectionTree(e,n.length<e.length);i(t),r(At.getSelectedItems(t))}})})}),(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:(0,g.tZ)(y.Zz,{})})]}),h=(0,g.tZ)(Wt,{depth:0,onItemSelect:e=>{const t=At.applySelection(l,e);i(t),r(At.getSelectedItems(t))},hash:o,path:[],itemsTree:l})):(u=(0,g.tZ)(y.Zz,{}),h=(0,g.tZ)("div",{className:"directory-tree__node directory-tree__node--file",children:(0,g.tZ)(s.cC,{id:"torrents.details.files.loading"})}));const f=U()("directory-tree__node","directory-tree__parent-directory torrent-details__section__heading",{"directory-tree__node--selected":p}),Z=(0,g.tZ)("div",{className:f,children:(0,g.BX)("div",{className:"file__label",children:[u,(0,g.tZ)("div",{className:"file__name",children:Ue.default.torrents?.[o].directory})]})}),b=U()("inverse directory-tree__wrapper",{"directory-tree__wrapper--toolbar-visible":n.length>0});return(0,g.BX)(c.l0,{className:b,onChange:e=>{let{event:t}=e;if(null!=t.target&&"file-priority"===t.target.name){const e=t.target;e.value&&_.Z.setFilePriority(o,{indices:n,priority:Number(e.value)})}},children:[(0,g.tZ)("div",{className:"directory-tree__selection-toolbar",children:(0,g.BX)(c.p7,{align:"center",children:[(0,g.tZ)(c.U2,{width:"one-quarter",grow:!1,shrink:!1,children:(0,g.tZ)(s.cC,{id:"torrents.details.selected.files",values:{count:n.length,countElement:(0,g.tZ)("span",{className:"directory-tree__selection-toolbar__item-count",children:n.length})}})}),(0,g.tZ)(c.zx,{onClick:e=>{e.preventDefault();const{baseURI:t}=ee.default,l=document.createElement("a");l.download="",l.href=`${t}api/torrents/${o}/contents/${n.join(",")}/data`,l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},grow:!1,shrink:!1,children:(0,g.tZ)(s.cC,{id:"torrents.details.files.download.file",values:{count:n.length}})}),(0,g.BX)(c.Ph,{id:"file-priority",persistentPlaceholder:!0,shrink:!1,defaultID:"",children:[(0,g.tZ)(c.Ql,{id:-1,isPlaceholder:!0,children:(0,g.tZ)(s.cC,{id:"torrents.details.selected.files.set.priority"})}),(0,g.tZ)(c.Ql,{id:0,children:a._("priority.dont.download")}),(0,g.tZ)(c.Ql,{id:1,children:a._("priority.normal")}),(0,g.tZ)(c.Ql,{id:2,children:a._("priority.high")})]})]})}),(0,g.BX)("div",{className:"directory-tree torrent-details__section torrent-details__section--file-tree modal__content--nested-scroll__content",children:[Z,h]})]})})),Jt=Yt;const Kt=e=>{let{text:t,className:l}=e;const i=t.split(/([ \n])/).map(((e,t)=>"\n"===e?(0,g.tZ)("br",{},t):function(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}(e)?(0,g.tZ)("a",{href:e.trimEnd(),target:"_blank",rel:"noopener noreferrer",children:e},t):e));return(0,g.tZ)("span",{className:l,children:i})};Kt.defaultProps={className:void 0};const el=Kt,tl=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)();if("torrent-details"!==m.Z.activeModal?.id)return null;const t=Ue.default.torrents[m.Z.activeModal.hash];if(null==t)return null;const l=(0,g.tZ)("span",{className:"not-available",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.none"})});return(0,g.tZ)("div",{className:"torrent-details__section torrent-details__section--general",children:(0,g.tZ)("table",{className:"torrent-details__table table",children:(0,g.BX)("tbody",{children:[(0,g.tZ)("tr",{className:"torrent-details__table__heading",children:(0,g.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,g.tZ)(s.cC,{id:"torrents.details.general.heading.general"})})}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateAdded",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.date.added"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.dateAdded>0?e.date(new Date(1e3*t.dateAdded),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):l})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--location",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.location"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.directory})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--tags",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.tags"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.tags.length?(i=t.tags,i.map((e=>(0,g.tZ)("span",{className:"tag",children:e},e)))):l})]}),(0,g.tZ)("tr",{className:"torrent-details__table__heading",children:(0,g.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,g.tZ)(s.cC,{id:"torrents.details.general.heading.transfer"})})}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateFinished",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.date.finished"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.dateFinished>0?e.date(new Date(1e3*t.dateFinished),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):l})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--downloaded",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.downloaded"})}),(0,g.BX)("td",{className:"torrent-details__detail__value",children:[e.number(t.percentComplete),(0,g.tZ)("em",{className:"unit",children:"%"})]})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--peers",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.peers"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.connected",values:{connectedCount:t.peersConnected,connected:e.number(t.peersConnected),total:e.number(t.peersTotal)}})})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--seeds",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.seeds"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.connected",values:{connectedCount:t.seedsConnected,connected:e.number(t.seedsConnected),total:e.number(t.seedsTotal)}})})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateActive",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.date.active"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:0===t.dateActive?l:-1===t.dateActive?e._("torrents.details.general.date.active.now"):e.date(new Date(1e3*t.dateActive),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"})})]}),(0,g.tZ)("tr",{className:"torrent-details__table__heading",children:(0,g.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,g.tZ)(s.cC,{id:"torrents.details.general.heading.torrent"})})}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--created",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.date.created"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.dateCreated>0?e.date(new Date(1e3*t.dateCreated),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):l})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--hash",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.hash"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.hash})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--size",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.size"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:(0,g.tZ)(Ht.Z,{value:t.sizeBytes})})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--type",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.type"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.isPrivate?e._("torrents.details.general.type.private"):e._("torrents.details.general.type.public")})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--comment",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.comment"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.comment?(0,g.tZ)(el,{text:t.comment.trim()}):l})]}),(0,g.tZ)("tr",{className:"torrent-details__table__heading",children:(0,g.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,g.tZ)(s.cC,{id:"torrents.details.general.heading.tracker"})})}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--tracker-message",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.tracker.message"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.message?t.message:l})]})]})})});var i}));var ll=l(1109),il=l(228),nl=l(6882);const rl=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)(),t="torrent-details"===m.Z.activeModal?.id?Ue.default.torrents[m.Z.activeModal.hash]:void 0,[l,i]=(0,d.useState)("stop");if((0,d.useEffect)((()=>{t?.status.includes("stopped")?i("stop"):i("start")}),[t?.status]),null==t)return null;const n=(0,ll.T)({status:t.status,upRate:t.upRate,downRate:t.downRate},"torrent-details__header");return(0,g.BX)("div",{className:n,children:[(0,g.tZ)("h1",{className:"torrent-details__heading torrent-details--name",children:t.name}),(0,g.BX)("div",{className:"torrent-details__sub-heading",children:[(0,g.BX)("ul",{className:"torrent-details__sub-heading__secondary",children:[(0,g.BX)("li",{className:"torrent-details__sub-heading__tertiary torrent-details__sub-heading__tertiary--download",children:[(0,g.tZ)(y.ki,{}),(0,g.tZ)(Ht.Z,{value:t.downRate,isSpeed:!0})," — ",(0,g.tZ)(Ht.Z,{value:t.bytesDone})]}),(0,g.BX)("li",{className:"torrent-details__sub-heading__tertiary torrent-details__sub-heading__tertiary--upload",children:[(0,g.tZ)(y.u3,{}),(0,g.tZ)(Ht.Z,{value:t.upRate,isSpeed:!0})," — ",(0,g.tZ)(Ht.Z,{value:t.upTotal})]}),(0,g.BX)("li",{className:"torrent-details__sub-heading__tertiary",children:[(0,g.tZ)(y.T_,{}),e.number(t.ratio)]}),(0,g.BX)("li",{className:"torrent-details__sub-heading__tertiary",children:[(0,g.tZ)(y.SU,{}),(0,g.tZ)(il.Z,{value:t.eta})]})]}),(0,g.BX)("ul",{className:"torrent-details__sub-heading__secondary",children:[(0,g.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,g.tZ)(jt.Z,{id:t.hash,level:t.priority,maxLevel:3,priorityType:"torrent",onChange:(e,t)=>{_.Z.setPriority({hashes:[`${e}`],priority:t})}})},"priority-meter"),(0,g.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,g.BX)("button",{className:U()("torrent-details__action",{"is-active":"start"===l}),type:"button",onClick:()=>{i("start"),_.Z.startTorrents({hashes:[t.hash]})},children:[(0,g.tZ)(y.zf,{}),(0,g.tZ)(s.cC,{id:"torrents.details.actions.start"})]})},"start"),(0,g.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,g.BX)("button",{className:U()("torrent-details__action",{"is-active":"stop"===l}),type:"button",onClick:()=>{i("stop"),_.Z.stopTorrents({hashes:[t.hash]})},children:[(0,g.tZ)(y.dV,{}),(0,g.tZ)(s.cC,{id:"torrents.details.actions.stop"})]})},"stop")]})]}),(0,g.tZ)(nl.Z,{percent:(0,_e.Fl)((()=>Math.ceil(t.percentComplete))).get(),status:(0,_e.Fl)((()=>(0,ll.o)(t.status))).get()})]})}));var al=l(3337),sl=l(8447);var dl={name:"17lw7on",styles:"td{max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}"};const cl=()=>{const[e,t]=(0,d.useState)([]),[l,i]=(0,d.useState)(null),n=()=>{i(null),"torrent-details"===m.Z.activeModal?.id&&_.Z.fetchTorrentPeers(m.Z.activeModal?.hash).then((e=>{null!=e&&t(e)})),i(ee.default.pollInterval)};return(0,d.useEffect)((()=>n()),[]),(0,al.Z)((()=>n()),l),(0,g.tZ)("div",{className:"torrent-details__section torrent-details__section--peers",children:(0,g.BX)("table",{className:"torrent-details__table table",css:dl,children:[(0,g.tZ)("thead",{className:"torrent-details__table__heading",children:(0,g.BX)("tr",{children:[(0,g.BX)("th",{className:"torrent-details__table__heading--primary",children:[(0,g.tZ)(s.cC,{id:"torrents.details.peers"}),(0,g.tZ)(sl.Z,{children:e.length})]}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"DL"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"UL"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"%"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"Client"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"Enc"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"In"})]})}),(0,g.tZ)("tbody",{children:e.map((e=>{const{country:t}=e,l=e.isEncrypted?(0,g.tZ)(y.HE,{}):null,i=e.isIncoming?(0,g.tZ)(y.FV,{}):null;return(0,g.BX)("tr",{children:[(0,g.BX)("td",{children:[(0,g.BX)("span",{className:"peers-list__flag",children:[(0,g.tZ)(d.Suspense,{fallback:(0,g.tZ)(y.$j,{}),children:(0,g.tZ)(y.AW,{countryCode:t})}),(0,g.tZ)("span",{className:"peers-list__flag__text",children:t})]}),e.address]}),(0,g.tZ)("td",{children:(0,g.tZ)(Ht.Z,{value:e.downloadRate,isSpeed:!0})}),(0,g.tZ)("td",{children:(0,g.tZ)(Ht.Z,{value:e.uploadRate,isSpeed:!0})}),(0,g.tZ)("td",{children:`${Math.ceil(e.completedPercent)}%`}),(0,g.tZ)("td",{children:e.clientVersion}),(0,g.tZ)("td",{className:"peers-list__encryption",children:l}),(0,g.tZ)("td",{className:"peers-list__incoming",children:i})]},e.address)}))})]})})},ol=()=>{const[e,t]=(0,d.useState)([]),l=e.length,i=["http","udp","dht"],n=e.map((e=>(0,g.BX)("tr",{children:[(0,g.tZ)("td",{children:e.url}),(0,g.tZ)("td",{children:i[e.type-1]})]},e.url)));return(0,d.useEffect)((()=>{"torrent-details"===m.Z.activeModal?.id&&_.Z.fetchTorrentTrackers(m.Z.activeModal?.hash).then((e=>{null!=e&&t(e)}))}),[]),(0,g.tZ)("div",{className:"torrent-details__trackers torrent-details__section",children:(0,g.BX)("table",{className:"torrent-details__table table",children:[(0,g.tZ)("thead",{className:"torrent-details__table__heading",children:(0,g.BX)("tr",{children:[(0,g.BX)("th",{className:"torrent-details__table__heading--primary",children:[(0,g.tZ)(s.cC,{id:"torrents.details.trackers"}),(0,g.tZ)(sl.Z,{children:l})]}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:(0,g.tZ)(s.cC,{id:"torrents.details.trackers.type"})})]})}),(0,g.tZ)("tbody",{children:n})]})})},ul=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)(),{isSmallScreen:t}=ee.default,l={"torrent-details":{content:tl,label:e._("torrents.details.details")},"torrent-contents":{content:Jt,label:e._("torrents.details.files"),modalContentClasses:"modal__content--nested-scroll"},"torrent-peers":{content:cl,label:e._("torrents.details.peers")},"torrent-trackers":{content:ol,label:e._("torrents.details.trackers")},"torrent-mediainfo":{content:Ot,label:e._("torrents.details.mediainfo"),modalContentClasses:"modal__content--nested-scroll"}};return(0,g.tZ)(de,{heading:(0,g.tZ)(rl,{},"torrent-heading"),size:"large",tabs:l,orientation:t?"horizontal":"vertical",tabsInBody:!t})})),hl=e=>{switch(e){case"add-torrents":return(0,g.tZ)(ce,{});case"confirm":return(0,g.tZ)(oe,{});case"feeds":return(0,g.tZ)(ze,{});case"generate-magnet":return(0,g.tZ)(He,{});case"move-torrents":return(0,g.tZ)(Ge,{});case"remove-torrents":return(0,g.tZ)(Qe,{});case"set-taxonomy":return(0,g.tZ)(We,{});case"set-trackers":return(0,g.tZ)(Ye,{});case"settings":return(0,g.tZ)(Ft,{});case"torrent-details":return(0,g.tZ)(ul,{});default:return null}},_l=(0,r.Pi)((()=>{const{id:e}=m.Z.activeModal||{};let t;return(0,a.Z)("Escape",(()=>m.Z.setActiveModal(null))),null!=e&&(t=(0,g.tZ)(i.Z,{classNames:"modal__animation",timeout:{enter:500,exit:500},children:(0,g.BX)("div",{className:"modal",children:[(0,g.tZ)("div",{className:"modal__overlay",role:"none",onClick:()=>{m.Z.setActiveModal(null)}}),hl(e)]})},e)),(0,g.tZ)(n.Z,{children:t})}))}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunkflood=globalThis.webpackChunkflood||[]).push([[151],{1434:(e,t,l)=>{l.r(t),l.d(t,{default:()=>_l});var i=l(9670),n=l(4537),r=l(8585),a=l(7264),s=l(4744),d=l(7294),c=l(8441),o=l(1540),u=l(879);const h=e=>{let{start:t,destination:l,tags:i,tab:n}=e;const r={};null!=t&&(r.startTorrentsOnLoad=t),null!=l&&""!==l&&(null==r.torrentDestinations&&(r.torrentDestinations=u.default.floodSettings.torrentDestinations||{}),"string"==typeof i?.[0]?r.torrentDestinations[i[0]]=l:r.torrentDestinations[""]=l),null!=n&&(r.UITorrentsAddTab=n),o.Z.saveSettings(r)};var _=l(9335),m=l(3529),g=l(5747);const p=e=>{const{actions:t}=e,l=t.map(((e,t)=>{let l=()=>{};return e.triggerDismiss&&(l=()=>{m.Z.setActiveModal(null)}),"checkbox"===e.type?(0,g.tZ)(c.XZ,{defaultChecked:e.checked,id:e.id,onClick:t=>{null!=e.clickHandler&&e.clickHandler(t),l()},children:e.content},t):(0,g.tZ)(c.zx,{isLoading:e.isLoading,onClick:t=>{null!=e.clickHandler&&e.clickHandler(t),l()},priority:e.type,type:e.submit?"submit":"button",children:e.content},t)})),i=(0,g.tZ)("div",{className:"modal__button-group",children:l});return(0,g.tZ)("div",{className:"modal__actions",children:i})},f=e=>{let{isAddingTorrents:t,onAddTorrentsClick:l}=e;const{i18n:i}=(0,s.mV)();return(0,g.tZ)(p,{actions:[{checked:Boolean(u.default.floodSettings.startTorrentsOnLoad),clickHandler:null,content:i._("torrents.add.start.label"),id:"start",triggerDismiss:!1,type:"checkbox"},{clickHandler:null,content:i._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:l,content:i._("torrents.add.button.add"),isLoading:t,submit:!0,triggerDismiss:!1,type:"primary"}]})};var Z=l(3279),b=l.n(Z),v=l(4656),y=l(5495),C=l(917),k=l(5896),N=l(172),w=l(4557),S=l(5051),x=l(932);const B="#5E728C",X={name:"1pkdvdx",styles:"padding:3px 9px"},T=(0,C.iv)({borderBottom:`1px solid ${(0,k.$n)(.43,B)}`,marginBottom:"3px",paddingBottom:"3px",opacity:.75,"&:last-child":{marginBottom:0}},"",""),D=(0,C.iv)({opacity:.5,transition:"color 0.25s",whiteSpace:"nowrap",button:[X,{width:"100%",height:"100%",padding:"3px 9px",textAlign:"left","&:disabled":{pointerEvents:"none"}}]},"",""),P=(0,C.iv)({color:(0,k.p_)(.1,(0,k._j)(.15,B)),background:(0,k.m4)(B,.1),button:{":focus":{outline:"none",WebkitTapHighlightColor:"transparent"}}},"",""),E=(0,C.iv)({opacity:1,cursor:"pointer",transition:"background 0.25s, color 0.25s",userSelect:"none","&:hover":P,"&:focus-within":P},"",""),M={EACCES:"filesystem.error.eacces",ENOENT:"filesystem.error.enoent"};var V={name:"kol7nt",styles:"transform:scale(0.75) rotate(180deg)"},I={name:"1089mxj",styles:"white-space:pre-wrap"},R={name:"1ityoz",styles:"font-weight:lighter"};const L=(0,d.memo)((e=>{let{directory:t,selectable:l,onItemSelection:i,onYieldFocus:n}=e;const[r,a]=(0,d.useState)(null),[c,o]=(0,d.useState)(null),[u,h]=(0,d.useState)(t.includes("/")?"/":"\\"),[_,m]=(0,d.useState)(null),[p,f]=(0,d.useState)(null),Z=(0,d.useRef)(null),b=t.lastIndexOf(u)+1,v=b>0?t.substr(0,b):t,k=t.substr(b);(0,d.useEffect)((()=>{v&&(a(null),m(null),f(null),S.Z.fetchDirectoryList(v).then((e=>{let{files:t,directories:l,separator:i}=e;m(l),f(t),h(i),o(null)})).catch((e=>{let{response:t}=e;o(t)})))}),[v]),(0,d.useEffect)((()=>{if(null!=Z.current&&null!=r){const e=Z.current.children[r]?.children[0];0===e?.tabIndex?e.focus():a(Array.from(Z.current.children).findIndex((e=>0===e.children[0].tabIndex)))}}),[r]),(0,w.Z)("ArrowUp",(e=>{e.preventDefault(),a((e=>null==e||e-1<0?(n?.(),null):e-1))})),(0,w.Z)("ArrowDown",(e=>{e.preventDefault(),a((e=>null!=e?e+1:0))}));let P=null,L=[];if((null==_&&"directories"===l||null==p&&"files"===l)&&(P="filesystem.fetching"),c&&c.data&&c.data.code&&(P=M[c.data.code]||"filesystem.error.unknown"),t){const e=`${v.split(u).slice(0,-2).join(u)}${u}`,t=(0,g.tZ)("li",{css:[D,E,{"@media (max-width: 720px)":T},"",""],children:(0,g.BX)("button",{type:"button",onClick:()=>i?.(e,!0),children:[(0,g.tZ)(y.Eh,{css:V}),".."]})},e),n="files"!==l,r=k?(0,x.Z)(_,(e=>e),k):[],a=r.includes(k)||"directories"!==l||!k||P?[]:(()=>{const e=`${v}${k}${u}`;return[(0,g.tZ)("li",{css:[D,E,"font-weight:bold;@media (max-width: 720px){display:none;}",""],children:(0,g.BX)("button",{type:"button",onClick:()=>i?.(e,!1),children:[(0,g.tZ)(y.Pl,{}),(0,g.tZ)("span",{css:I,children:k}),(0,g.BX)("em",{css:R,children:[" - ",(0,g.tZ)(s.cC,{id:"filesystem.error.enoent"})]})]})},e)]})(),d=_?.length&&(0,N.DY)(_.slice()).desc((e=>r.includes(e))).map((e=>{const t=`${v}${e}${u}`;return(0,g.tZ)("li",{css:[D,n?E:void 0,r.includes(e)?{fontWeight:"bold"}:void 0,"",""],children:(0,g.BX)("button",{type:"button",disabled:!n,tabIndex:n?0:-1,onClick:n?()=>i?.(t,!0):void 0,children:[(0,g.tZ)(y.Bm,{}),e]})},t)}))||[],c="directories"!==l,o=k?(0,x.Z)(p,(e=>e),k):[],h=p?.length&&(0,N.DY)(p.slice()).desc((e=>o.includes(e))).map((e=>{const t=`${v}${e}`;return(0,g.tZ)("li",{css:[D,c?E:void 0,o.includes(e)?{fontWeight:"bold"}:void 0,"",""],children:(0,g.BX)("button",{type:"button",disabled:!c,tabIndex:c?0:-1,onClick:c?()=>i?.(t,!1):void 0,children:[(0,g.tZ)(y.$B,{}),e]})},t)}))||[];0!==d.length||0!==h.length||P||(P="filesystem.empty.directory"),L=[t,...a,...d,...h]}else P="filesystem.error.no.input";return(0,g.BX)("div",{css:(0,C.iv)({color:B,listStyle:"none",padding:"3px 0px",".icon":{fill:"currentColor",height:"14px",width:"14px",marginRight:"5px",marginTop:"-3px",verticalAlign:"middle"}},"",""),children:[v&&(0,g.BX)("li",{css:[D,T,X,"white-space:pre-wrap;word-break:break-all;.icon{transform:scale(0.9);margin-top:-2px !important;}@media (max-width: 720px){display:none;}",""],children:[(0,g.tZ)(y.DB,{}),v]}),(0,g.tZ)("ul",{ref:Z,children:L}),P&&(0,g.tZ)("div",{css:[D,X,"opacity:1;",""],children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:P})})})]})}));L.defaultProps={selectable:void 0,onItemSelection:void 0,onYieldFocus:void 0};const F=L,O=(0,d.forwardRef)(((e,t)=>{let{id:l,label:i,selectable:n,suggested:r,showBasePathToggle:a,showCompletedToggle:o,showSequentialToggle:h,onChange:_}=e;const[m,p]=(0,d.useState)(r||u.default.floodSettings.torrentDestinations?.[""]||u.default.clientSettings?.directoryDefault||""),[f,Z]=(0,d.useState)(!1),C=(0,d.useRef)(null),k=(0,v.Z)(t),{i18n:N}=(0,s.mV)();(0,d.useEffect)((()=>{const e=()=>{Z(!1)},t=t=>{C.current?.contains(t.target)||e()};return document.addEventListener("click",t),window.addEventListener("resize",e),()=>{document.removeEventListener("click",t),window.removeEventListener("resize",e)}}),[]);const w=[];return a&&w.push((0,g.tZ)(c.XZ,{grow:!1,id:"isBasePath",children:(0,g.tZ)(s.cC,{id:"torrents.destination.base_path"})},"isBasePath")),o&&w.push((0,g.tZ)(c.XZ,{grow:!1,id:"isCompleted",children:(0,g.tZ)(s.cC,{id:"torrents.destination.completed"})},"isCompleted")),h&&w.push((0,g.tZ)(c.XZ,{grow:!1,id:"isSequential",children:(0,g.tZ)(s.cC,{id:"torrents.destination.sequential"})},"isSequential")),(0,g.BX)(c.y1,{ref:C,children:[(0,g.tZ)(c.p7,{children:(0,g.BX)(c.fE,{autoComplete:f?"off":void 0,addonPlacement:"after",defaultValue:m,id:l,label:i,onChange:b()((()=>{if(null==k.current)return;const e=k.current.value;_&&_(e),p(e)}),100,{leading:!0}),onClick:e=>e.nativeEvent.stopImmediatePropagation(),placeholder:N._("torrents.add.destination.placeholder"),ref:k,children:[(0,g.tZ)(c.G5,{onClick:()=>{null!=k.current&&p(k.current.value),Z(!f)},children:(0,g.tZ)(y.ol,{})}),(0,g.tZ)(c.h_,{children:(0,g.tZ)(c.xV,{isIn:f,onClick:e=>e.nativeEvent.stopImmediatePropagation(),overlayProps:{isInteractive:!1},padding:!1,triggerRef:k,children:(0,g.tZ)(F,{directory:m,selectable:n,onItemSelection:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null!=k.current&&(k.current.value=e),Z(t),p(e)},onYieldFocus:()=>{k.current?.focus()}})})})]})}),w.length>0?(0,g.tZ)(c.p7,{children:w}):null]})}));O.defaultProps={label:void 0,selectable:void 0,suggested:void 0,showBasePathToggle:!1,showCompletedToggle:!1,showSequentialToggle:!1,onChange:void 0};const $=O;var z=l(4184),U=l.n(z),A=l(8232);const j=e=>{let{defaultValue:t,placeholder:l,id:i,label:n,onTagSelected:r}=e;const[o,h]=(0,d.useState)(!1),[_,m]=(0,d.useState)(t??[]),p=(0,d.useRef)(null),f=(0,d.useRef)(null),Z=(0,d.useRef)(null),b=U()("select form__element",{"select--is-open":o});return(0,a.Z)("Escape",(e=>{e.preventDefault(),h(!1)})),(0,d.useEffect)((()=>{const e=e=>{p.current?.contains(e.target)||h(!1)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}),[]),(0,d.useEffect)((()=>{null!=Z.current&&(Z.current.value=_.join()),r&&r(_)}),[_,r]),(0,g.tZ)(c.U2,{ref:p,children:(0,g.tZ)("div",{className:b,children:(0,g.BX)(c.fE,{autoComplete:o?"off":void 0,id:i||"tags",addonPlacement:"after",defaultValue:t,label:n,onChange:()=>{if(null!=Z.current){let e=Z.current.value.split(",").map((e=>e.trim())).filter((e=>e.length>0));Z.current.value.trimEnd().endsWith(",")&&(e.push(""),e=[...new Set(e)]),m(e)}},placeholder:l,ref:Z,children:[(0,g.tZ)(c.G5,{onClick:()=>{h(!o)},className:"select__indicator",children:(0,g.tZ)(y.Tt,{})}),(0,g.tZ)(c.h_,{children:(0,g.tZ)(c.xV,{isIn:o,onClick:e=>{"single"!==u.default.floodSettings.UITagSelectorMode&&e.nativeEvent.stopImmediatePropagation()},overlayProps:{isInteractive:!1},ref:f,triggerRef:Z,children:[...new Set(["untagged",...(0,N.DY)(Object.keys(A.default.taxonomy.tagCounts)).asc(),..._])].reduce(((e,t)=>(""===t||e.push((0,g.tZ)(c.Ql,{id:t,isSelected:_.includes(t),onClick:()=>{"untagged"===t?m([]):_.includes(t)?m(_.filter((e=>e!==t&&""!==e))):m([..._.filter((e=>""!==e)),t])},children:"untagged"===t?(0,g.tZ)(s.cC,{id:"filter.untagged"}):t},t)),e)),[])})})]})})})};j.defaultProps={id:"tags",label:void 0,defaultValue:void 0,placeholder:void 0,onTagSelected:void 0};const H=j,q=(e,t)=>Object.keys(e).reduce(((l,i)=>{if(i.startsWith(t)){const t=e[i];null!=t&&l.push(t)}return l}),[]),G=e=>{let{defaultValues:t,id:l,label:i,placeholder:n}=e;const r=(0,d.useRef)(0),[a,s]=(0,d.useState)(t??[{id:0,value:""}]);return(0,g.tZ)(c.y1,{children:a.map(((e,t)=>{let d=null;return t>0&&(d=(0,g.tZ)(c.G5,{onClick:()=>{const e=a.slice();e.splice(t,1),s(e)},children:(0,g.tZ)(y.eJ,{})})),(0,g.tZ)(c.p7,{children:(0,g.BX)(c.fE,{addonPlacement:"after",id:`${l}-${e.id}`,defaultValue:e.value,label:0===t&&i,placeholder:n,wrapperClassName:"textbox-repeater",children:[(0,g.tZ)(c.G5,{onClick:()=>{r.current+=1;const e=a.slice();e.splice(t+1,0,{id:r.current,value:""}),s(e)},children:(0,g.tZ)(y.Rb,{})}),d]})},e.id)}))})};G.defaultProps={defaultValues:void 0,label:void 0,placeholder:void 0};const Q=G,W=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(!1);return(0,g.BX)(c.l0,{className:"inverse",ref:e,children:[(0,g.tZ)($,{id:"sourcePath",label:t._("torrents.create.source.path.label")}),(0,g.tZ)(Q,{id:"trackers",label:t._("torrents.create.trackers.label"),placeholder:t._("torrents.create.tracker.input.placeholder"),defaultValues:[{id:0,value:""}]}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"name",label:t._("torrents.create.base.name.label"),placeholder:t._("torrents.create.base.name.input.placeholder")})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"comment",label:t._("torrents.create.comment.label"),placeholder:t._("torrents.create.comment.input.placeholder")})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"infoSource",label:t._("torrents.create.info.source.label"),placeholder:t._("torrents.create.info.source.input.placeholder")})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.XZ,{grow:!1,id:"isPrivate",children:t._("torrents.create.is.private.label")})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(H,{id:"tags",label:t._("torrents.add.tags"),placeholder:t._("torrents.create.tags.input.placeholder")})}),(0,g.tZ)(f,{onAddTorrentsClick:()=>{if(null==e.current)return;const t=e.current.getFormData();i(!0),null!=t.sourcePath&&(_.Z.createTorrent({name:t.name,sourcePath:t.sourcePath,trackers:q(t,"trackers"),comment:t.comment,infoSource:t.infoSource,isPrivate:t.isPrivate||!1,start:t.start||!1,tags:null!=t.tags?t.tags.split(","):void 0}).then((()=>{m.Z.setActiveModal(null)})),h({start:t.start,destination:t.sourcePath,tab:"by-creation"}))},isAddingTorrents:l})]})};var Y=l(4977);const J=e=>{let{initialFiles:t,onFilesChanged:l}=e;const[i,n]=(0,d.useState)(t??[]);return(0,d.useEffect)((()=>{l(i)}),[i,l]),(0,g.BX)(c.U2,{children:[(0,g.tZ)("span",{className:"form__element__label",children:(0,g.tZ)(s.cC,{id:"torrents.add.torrents.label"})}),i.length>0?(0,g.tZ)("div",{onClick:e=>{e.stopPropagation()},role:"none",children:(0,g.tZ)("ul",{className:"dropzone__selected-files interactive-list",children:i.map(((e,t)=>(0,g.BX)("li",{className:"dropzone__selected-files__file interactive-list__item",title:e.name,children:[(0,g.tZ)("span",{className:"interactive-list__icon",children:(0,g.tZ)(y.$B,{})}),(0,g.tZ)("span",{className:"interactive-list__label",children:e.name}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>{const e=i.slice();e.splice(t,1),n(e)},children:(0,g.tZ)(y.x8,{})})]},e.name)))})}):null,(0,g.tZ)(Y.ZP,{onDrop:e=>{const t=[];e.forEach((l=>{const r=new FileReader;r.onload=r=>{null!=r.target?.result&&"string"==typeof r.target.result&&t.push({name:l.name,data:r.target.result.split("base64,")[1]}),t.length===e.length&&n(i.concat(t))},r.readAsDataURL(l)}))},children:e=>{let{getRootProps:t,getInputProps:l,isDragActive:i}=e;return(0,g.BX)("div",{...t(),className:"form__dropzone dropzone interactive-list "+(i?"dropzone--is-dragging":""),children:[(0,g.tZ)("input",{...l()}),(0,g.BX)("div",{className:"dropzone__copy",children:[(0,g.tZ)("div",{className:"dropzone__icon",children:(0,g.tZ)(y.hv,{})}),(0,g.tZ)(s.cC,{id:"torrents.add.tab.file.drop"})," ",(0,g.tZ)("span",{className:"dropzone__browse-button",children:(0,g.tZ)(s.cC,{id:"torrents.add.tab.file.browse"})}),"."]})]})}})]})},K=()=>{const e=(0,d.useRef)([]),t=(0,d.useRef)(null),l=(0,d.useRef)(null),[i,n]=(0,d.useState)(!1),{i18n:r}=(0,s.mV)();return(0,g.BX)(c.l0,{className:"inverse",ref:t,children:[(0,g.tZ)(c.p7,{children:(0,g.tZ)(J,{initialFiles:"add-torrents"===m.Z.activeModal?.id&&"by-file"===m.Z.activeModal?.tab&&m.Z.activeModal?.files||[],onFilesChanged:t=>{e.current=t}})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(H,{label:r._("torrents.add.tags"),id:"tags",onTagSelected:e=>{if(null!=l.current){const t=u.default.floodSettings.torrentDestinations?.[e[0]];"string"==typeof t&&null!=l.current&&(l.current.value=t,l.current.dispatchEvent(new Event("input",{bubbles:!0})))}}})}),(0,g.tZ)($,{id:"destination",label:r._("torrents.add.destination.label"),ref:l,selectable:"directories",showBasePathToggle:!0,showCompletedToggle:!0,showSequentialToggle:!0}),(0,g.tZ)(f,{onAddTorrentsClick:()=>{if(null==t.current)return;const l=t.current?.getFormData();n(!0);const{destination:i,start:r,tags:a,isBasePath:s,isCompleted:d,isSequential:c}=l,o=[];if(e.current.forEach((e=>{o.push(e.data)})),0===o.length||null==i)return void n(!1);const u=null!=a?a.split(",").filter((e=>e.length>0)):void 0;_.Z.addTorrentsByFiles({files:o,destination:i,tags:u,isBasePath:s,isCompleted:d,isSequential:c,start:r}).then((()=>{m.Z.setActiveModal(null)})),h({start:r,destination:i,tags:u,tab:"by-file"})},isAddingTorrents:i})]})};var ee=l(4355);var te={name:"izrr19",styles:"float:right;:focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"},le={name:"1rawn5e",styles:"font-size:0.8em"};const ie=()=>{const e=(0,d.useRef)(null),t=(0,d.useRef)(null),[l,i]=(0,d.useState)(!1),{i18n:n}=(0,s.mV)();return(0,g.BX)(c.l0,{className:"inverse",ref:e,children:[(0,g.tZ)(Q,{id:"urls",label:(0,g.BX)("div",{children:[n._("torrents.add.torrents.label"),"function"==typeof navigator.registerProtocolHandler&&(0,g.tZ)("button",{css:te,type:"button",onClick:()=>{"function"==typeof navigator.registerProtocolHandler&&navigator.registerProtocolHandler("magnet",`${ee.default.baseURI}?action=add-urls&url=%s`)},children:(0,g.tZ)("em",{css:le,children:n._("torrents.add.tab.url.register.magnet.handler")})})]}),placeholder:n._("torrents.add.tab.url.input.placeholder"),defaultValues:"add-torrents"===m.Z.activeModal?.id&&"by-url"===m.Z.activeModal?.tab&&m.Z.activeModal?.urls||[{id:0,value:""}]}),(0,g.tZ)(Q,{id:"cookies",label:n._("torrents.add.cookies.label"),placeholder:n._("torrents.add.cookies.input.placeholder")}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(H,{id:"tags",label:n._("torrents.add.tags"),onTagSelected:e=>{if(null!=t.current){const l=u.default.floodSettings.torrentDestinations?.[e[0]];"string"==typeof l&&null!=t.current&&(t.current.value=l,t.current.dispatchEvent(new Event("input",{bubbles:!0})))}}})}),(0,g.tZ)($,{id:"destination",label:n._("torrents.add.destination.label"),ref:t,selectable:"directories",showBasePathToggle:!0,showCompletedToggle:!0,showSequentialToggle:!0}),(0,g.tZ)(f,{onAddTorrentsClick:()=>{if(null==e.current)return;const t=e.current.getFormData();i(!0);const l=q(t,"urls").filter((e=>""!==e));if(0===l.length||null==t.destination)return void i(!1);const n=q(t,"cookies"),r=l[0].startsWith("http")&&l[0].split("/")[2],a=r?{[r]:n}:void 0,s=null!=t.tags?t.tags.split(",").filter((e=>e.length>0)):void 0;_.Z.addTorrentsByUrls({urls:l,cookies:a,destination:t.destination,isBasePath:t.isBasePath,isCompleted:t.isCompleted,isSequential:t.isSequential,start:t.start,tags:s}).then((()=>{m.Z.setActiveModal(null)})),h({start:t.start,destination:t.destination,tags:s,tab:"by-url"})},isAddingTorrents:l})]})};var ne={name:"1gxvag8",styles:":focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"};const re=e=>{const{activeTabId:t,tabs:l={},onTabChange:i}=e;return(0,g.tZ)("ul",{className:"modal__tabs",children:Object.keys(l).map((e=>{const n=l[e];n.id=e;const r=U()("modal__tab",{"is-active":e===t});return(0,g.tZ)("li",{className:r,children:(0,g.tZ)("button",{css:ne,type:"button",onClick:()=>{i&&i(n)},children:n.label})},e)}))})};re.defaultProps={tabs:{}};const ae=re,se=e=>{const{alignment:t,size:l,orientation:i,tabsInBody:n,inverse:r,initialTabId:a,className:s,content:c,heading:o,tabs:u,actions:h}=e,_=U()("modal__content__wrapper",`modal--align-${t}`,`modal--size-${l}`,{"modal--horizontal":"horizontal"===i,"modal--vertical":"vertical"===i,"modal--tabs-in-header":!n,"modal--tabs-in-body":n,inverse:r},s);let m=c;const f=o,Z=U()("modal__header",{"has-tabs":u});let b,v,y;const[C,k]=(0,d.useState)(a??Object.keys(u||{})[0]);if(u){const e=u[C],t=U()("modal__content",e.modalContentClasses),l=e.content,i=e.props,r=(0,g.tZ)(ae,{activeTabId:C,onTabChange:e=>{null!=e.id&&k(e.id)},tabs:u},"modal-tabs");n?b=r:y=r,m=[b,(0,g.tZ)("div",{className:t,children:(0,g.tZ)(l,{...i})},"modal-content")]}return h&&(v=(0,g.tZ)("div",{className:"modal__footer",children:(0,g.tZ)(p,{actions:h})})),(0,g.BX)("div",{className:_,children:[(0,g.BX)("div",{className:Z,children:[f,y]}),(0,g.BX)("div",{className:"modal__body",children:[m,v]})]})};se.defaultProps={alignment:"left",className:null,inverse:!0,size:"medium",orientation:"horizontal",tabsInBody:!1,content:void 0,actions:void 0,tabs:void 0,initialTabId:void 0};const de=se,ce=()=>{const{i18n:e}=(0,s.mV)(),t={"by-url":{content:ie,label:e._("torrents.add.tab.url.title")},"by-file":{content:K,label:e._("torrents.add.tab.file.title")},"by-creation":{content:W,label:e._("torrents.add.tab.create.title")}};return"add-torrents"!==m.Z.activeModal?.id?null:(0,g.tZ)(de,{heading:e._("torrents.add.heading"),tabs:t,initialTabId:m.Z.activeModal.tab??u.default.floodSettings.UITorrentsAddTab??"by-url"})},oe=(0,r.Pi)((()=>{if("confirm"!==m.Z.activeModal?.id)return null;const{actions:e,content:t,heading:l}=m.Z.activeModal||{};return(0,g.tZ)(de,{actions:e,content:(0,g.tZ)("div",{className:"modal__content",children:t}),heading:l})}));var ue=l(9669),he=l.n(ue),_e=l(8949);function me(e,t,l){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var l=e[Symbol.toPrimitive];if(void 0!==l){var i=l.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}const ge=new class{constructor(){me(this,"feeds",[]),me(this,"rules",[]),me(this,"items",[]),(0,_e.ky)(this)}setFeeds(e){this.feeds=null!=e?[...e].sort(((e,t)=>e.label.localeCompare(t.label))):[]}setRules(e){this.rules=null!=e?[...e].sort(((e,t)=>e.label.localeCompare(t.label))):[]}handleFeedMonitorsFetchSuccess(e){this.setFeeds(e.feeds),this.setRules(e.rules)}handleItemsFetchSuccess(e){this.items=e}},{baseURI:pe}=ee.default,fe={addFeed:e=>he().put(`${pe}api/feed-monitor/feeds`,e).then((()=>fe.fetchFeedMonitors())),modifyFeed:(e,t)=>he().patch(`${pe}api/feed-monitor/feeds/${e}`,t).then((()=>fe.fetchFeedMonitors())),addRule:e=>he().put(`${pe}api/feed-monitor/rules`,e).then((()=>fe.fetchFeedMonitors())),fetchFeedMonitors:()=>he().get(`${pe}api/feed-monitor`).then((e=>{let{data:t}=e;ge.handleFeedMonitorsFetchSuccess(t)}),(()=>{})),fetchItems:e=>{let{id:t,search:l}=e;return he().get(`${pe}api/feed-monitor/feeds/${t}/items`,{params:{search:l}}).then((e=>{let{data:t}=e;ge.handleItemsFetchSuccess(t)}),(()=>{}))},removeFeedMonitor:e=>he().delete(`${pe}api/feed-monitor/${e}`).then((()=>fe.fetchFeedMonitors()),(()=>{}))},Ze=fe,be=/^(?:https?|ftp):\/\/.{1,}\.{1}.{1,}/,ve=e=>null!=e&&""!==e,ye=e=>{try{new RegExp(e)}catch(e){return!1}return!0},Ce=e=>{let{rule:t,isSubmitting:l,isPatternMatched:i,onCancel:n}=e;const{feeds:r}=ge,{i18n:a}=(0,s.mV)();return(0,g.BX)(c.y1,{children:[(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"label",label:a._("feeds.label"),defaultValue:t.label}),(0,g.tZ)(c.Ph,{disabled:!r.length,id:"feedID",label:a._("feeds.applicable.feed"),defaultID:t.feedIDs?.[0],children:0===r.length?[(0,g.tZ)(c.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:"feeds.no.feeds.available"})})},"empty")]:r.reduce(((e,t)=>e.concat((0,g.tZ)(c.Ql,{id:`${t._id}`,children:t.label},t._id))),[(0,g.tZ)(c.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:"feeds.select.feed"})})},"select-feed")])})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"match",label:a._("feeds.match.pattern"),placeholder:a._("feeds.regEx"),defaultValue:t.match,width:"three-eighths"}),(0,g.tZ)(c.fE,{id:"exclude",label:a._("feeds.exclude.pattern"),placeholder:a._("feeds.regEx"),defaultValue:t.exclude,width:"three-eighths"})]}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{addonPlacement:"after",id:"check",label:a._("feeds.test.match"),placeholder:a._("feeds.check"),children:i&&(0,g.tZ)(c.G5,{children:(0,g.tZ)(y.FV,{})})})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.U2,{children:(0,g.tZ)($,{id:"destination",label:a._("feeds.torrent.destination"),selectable:"directories",suggested:t.destination,showBasePathToggle:!0})}),(0,g.tZ)(H,{id:"tags",label:a._("feeds.apply.tags"),placeholder:a._("feeds.tags"),defaultValue:t.tags})]}),(0,g.BX)(c.p7,{align:"end",justify:"end",children:[(0,g.tZ)("br",{}),(0,g.tZ)(c.XZ,{id:"startOnLoad",defaultChecked:t.startOnLoad,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"feeds.start.on.load"})}),(0,g.tZ)(c.zx,{onClick:n,children:(0,g.tZ)(s.cC,{id:"button.cancel"})}),(0,g.tZ)(c.zx,{type:"submit",isLoading:l,children:(0,g.tZ)(s.cC,{id:"button.save.feed"})})]})]})},ke=e=>{let{children:t}=e;return(0,g.tZ)("h2",{className:"h4",children:t})},Ne=(0,r.Pi)((e=>{let{currentRule:t,onSelect:l,onRemove:i}=e;const{rules:n}=ge;return 0===n.length?(0,g.tZ)("ul",{className:"interactive-list",children:(0,g.tZ)("li",{className:"interactive-list__item",children:(0,g.tZ)(s.cC,{id:"feeds.no.rules.defined"})})}):(0,g.tZ)("ul",{className:"interactive-list",children:n.map((e=>{const n=e.count||0;let r=null,a=null;if(e.exclude&&(r=(0,g.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:[(0,g.tZ)(s.cC,{id:"feeds.exclude"}),": ",e.exclude]})),e.tags&&e.tags.length>0){const t=e.tags.map((e=>(0,g.tZ)("span",{className:"tag",children:e},e)));a=(0,g.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:[(0,g.tZ)(s.cC,{id:"feeds.tags"}),": ",t]})}return(0,g.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content",children:[(0,g.BX)("div",{className:"interactive-list__label",children:[(0,g.BX)("ul",{className:"interactive-list__detail-list",children:[(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:e.label}),(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--secondary",children:(0,g.tZ)(s.cC,{id:"feeds.match.count",values:{count:n}})}),e===t&&(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:"Modifying"})]}),(0,g.BX)("ul",{className:"interactive-list__detail-list",children:[(0,g.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",style:{maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,g.tZ)(s.cC,{id:"feeds.match"}),": ",e.match]}),(0,g.tZ)("div",{style:{width:"100%"}}),r,a]})]}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action",type:"button",onClick:()=>l(e),children:(0,g.tZ)(y.I8,{})}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>i(e),children:(0,g.tZ)(y.x8,{})})]},e._id)}))})})),we=Ne,Se={label:"",feedIDs:[],match:"",exclude:"",tags:[],destination:"",startOnLoad:!1},xe={destination:{isValid:ve,error:"feeds.validation.must.specify.destination"},feedID:{isValid:e=>ve(e)&&"placeholder"!==e,error:"feeds.validation.must.select.feed"},label:{isValid:ve,error:"feeds.validation.must.specify.label"},match:{isValid:e=>ve(e)&&ye(e),error:"feeds.validation.invalid.regular.expression"},exclude:{isValid:e=>!ve(e)||ye(e),error:"feeds.validation.invalid.regular.expression"}},Be=(e,t)=>xe[e]?.isValid(t)?void 0:xe[e]?.error,Xe=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(null),[n,r]=(0,d.useState)({}),[a,o]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1),[_,m]=(0,d.useState)(!1),[p,f]=(0,d.useState)(!1);return(0,g.BX)(c.l0,{className:"inverse",onChange:e=>{let{event:t,formData:l}=e;const i=t.target.name,a=l;r({...n,[i]:Be(i,a[i])}),f((()=>{const{check:e,match:t="",exclude:l=""}=a;if(ve(e)&&ye(t)&&ye(l)){const i=new RegExp(t,"gi").test(e),n=""!==l&&new RegExp(l,"gi").test(e);return i&&!n}return!1})()),m(!0)},onSubmit:async()=>{if(null==e.current)return;const t=e.current.getFormData(),n=Object.keys(xe).reduce(((e,l)=>({...e,[l]:Be(l,t[l])})),{});r(n);const a=Object.keys(n).every((e=>void 0===n[e]));_&&a&&(h(!0),null!=l?._id&&await Ze.removeFeedMonitor(l._id),await Ze.addRule({label:t.label??Se.label,feedIDs:[t.feedID??""],field:t.field,match:t.match??Se.match,exclude:t.exclude??Se.exclude,destination:t.destination??Se.destination,tags:t.tags?.split(",")??Se.tags,startOnLoad:t.startOnLoad??Se.startOnLoad,isBasePath:t.isBasePath??!1}).then((()=>{e.current?.resetForm(),r({}),i(null),o(!1)}),(()=>{r({backend:"general.error.unknown"})})),h(!1))},ref:e,children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"feeds.existing.rules"})}),Object.keys(n).reduce(((e,l)=>(null!=n[l]&&e.push((0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:t._(n?.[l])})},`error-${l}`)),e)),[]),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.U2,{children:(0,g.tZ)(we,{currentRule:l,onSelect:e=>{i(e),o(!0)},onRemove:e=>{null!=e._id&&Ze.removeFeedMonitor(e._id),e===l&&(i(null),o(!1))}})})}),a?(0,g.tZ)(Ce,{rule:l??Se,isPatternMatched:p,isSubmitting:u,onCancel:()=>{i(null),o(!1)}},l?._id||"initial"):(0,g.BX)(c.p7,{align:"end",justify:"end",children:[(0,g.tZ)("br",{}),(0,g.tZ)(c.zx,{onClick:()=>{o(!0)},children:(0,g.tZ)(s.cC,{id:"button.new"})})]})]})},Te=e=>{let{currentFeed:t,defaultFeed:l,intervalMultipliers:i,isSubmitting:n,onCancel:r}=e;const{i18n:a}=(0,s.mV)(),d=t?.interval??l.interval;let o=d,u=1;return i.forEach((e=>{const t=e.value;d%t==0&&(o=d/t,u=t)})),(0,g.BX)(c.y1,{children:[(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"label",label:a._("feeds.label"),placeholder:a._("feeds.label"),defaultValue:t?.label??l.label}),(0,g.tZ)(c.fE,{id:"interval",label:a._("feeds.select.interval"),placeholder:a._("feeds.interval"),defaultValue:o,width:"one-eighth"}),(0,g.tZ)(c.Ph,{labelOffset:!0,defaultID:u,id:"intervalMultiplier",width:"one-eighth",children:i.map((e=>(0,g.tZ)(c.Ql,{id:e.value,children:a._(e.message)},e.value)))})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"url",label:a._("feeds.url"),placeholder:a._("feeds.url"),defaultValue:t?.url??l?.url}),(0,g.tZ)(c.zx,{labelOffset:!0,onClick:r,children:(0,g.tZ)(s.cC,{id:"button.cancel"})}),(0,g.tZ)(c.zx,{labelOffset:!0,type:"submit",isLoading:n,children:(0,g.tZ)(s.cC,{id:"button.save.feed"})})]})]})},De=(0,r.Pi)((e=>{let{selectedFeedID:t}=e;const{items:l}=ge,i=[];if(t){const e={};l.forEach(((t,l)=>{let{title:n}=t;const r=e[n];null==r?e[n]=2:(n=`${n} #${r}`,e[n]+=1),i.push((0,g.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content feed-list__feed",children:[(0,g.tZ)("div",{className:"interactive-list__label feed-list__feed-label",children:n}),(0,g.tZ)(c.XZ,{id:`${l}`})]},n))}))}return(0,g.tZ)(c.p7,{children:0===i.length?(0,g.tZ)("ul",{className:"interactive-list",children:(0,g.tZ)("li",{className:"interactive-list__item",children:(0,g.tZ)("div",{className:"interactive-list__label",children:(0,g.tZ)(s.cC,{id:"feeds.no.items.matching"})})})}):(0,g.tZ)("ul",{className:"interactive-list feed-list",children:i})})})),Pe=De,Ee=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)(),t=(0,d.useRef)(null),[l,i]=(0,d.useState)(null),{feeds:n}=ge;return null!=l&&(n.some((e=>e._id===l))||i(null)),(0,g.BX)(c.l0,{className:"inverse",onChange:e=>{let{event:t,formData:l}=e;const n=l;"checkbox"!==t.target.type&&(i(n.feedID),Ze.fetchItems({id:n.feedID,search:n.search}))},onSubmit:()=>{if(null==t.current)return;const e=t.current.getFormData(),l=ge.items.filter(((t,l)=>e[l])).map(((e,t)=>({id:t,value:e.urls[0]})));m.Z.setActiveModal({id:"add-torrents",tab:"by-url",urls:l})},ref:t,children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"feeds.browse.feeds"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.Ph,{disabled:!n.length,grow:!1,id:"feedID",label:e._("feeds.select.feed"),width:"three-eighths",children:n.length?n.reduce(((e,t)=>null==t._id?e:e.concat((0,g.tZ)(c.Ql,{id:t._id,children:t.label},t._id))),[(0,g.tZ)(c.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:"feeds.select.feed"})})},"select-feed")]):[(0,g.tZ)(c.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,g.tZ)("em",{children:(0,g.tZ)(s.cC,{id:"feeds.no.feeds.available"})})},"empty")]}),l&&(0,g.tZ)(c.fE,{id:"search",label:e._("feeds.search.term"),placeholder:e._("feeds.search")}),l&&(0,g.tZ)(c.zx,{type:"submit",labelOffset:!0,children:(0,g.tZ)(s.cC,{id:"button.download"})},"button")]}),l&&(0,g.tZ)(Pe,{selectedFeedID:l})]})})),Me=Ee,Ve=(0,r.Pi)((e=>{let{currentFeed:t,intervalMultipliers:l,onSelect:i,onRemove:n}=e;const{feeds:r}=ge,{i18n:a}=(0,s.mV)();return 0===r.length?(0,g.tZ)("ul",{className:"interactive-list",children:(0,g.tZ)("li",{className:"interactive-list__item",children:(0,g.tZ)(s.cC,{id:"feeds.no.feeds.defined"})})}):(0,g.tZ)("ul",{className:"interactive-list feed-list",children:r.map((e=>{const r=e.count||0;let d=`${e.interval}`,c=l[0].message;return l.forEach((t=>{e.interval%t.value==0&&(d=""+e.interval/t.value,c=t.message)})),(0,g.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content feed-list__feed",children:[(0,g.BX)("div",{className:"interactive-list__label",children:[(0,g.BX)("ul",{className:"interactive-list__detail-list",children:[(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:e.label}),(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--secondary",children:(0,g.tZ)(s.cC,{id:"feeds.match.count",values:{count:r}})}),e===t&&(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:"Modifying"})]}),(0,g.BX)("ul",{className:"interactive-list__detail-list",children:[(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:`${d} ${a._(c)}`}),(0,g.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--tertiary",children:(0,g.tZ)("a",{href:e.url,rel:"noopener noreferrer",target:"_blank",children:e.url})})]})]}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action",type:"button",onClick:()=>i(e),children:(0,g.tZ)(y.I8,{})}),(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>n(e),children:(0,g.tZ)(y.x8,{})})]},e._id)}))})})),Ie=Ve,Re={url:{isValid:e=>null!=e&&""!==e&&null!==e.match(be),error:"feeds.validation.must.specify.valid.feed.url"},label:{isValid:ve,error:"feeds.validation.must.specify.label"},interval:{isValid:e=>{if(null===e||""===e)return!1;const t=parseInt(`${e}`,10);return!Number.isNaN(t)&&t>0},error:"feeds.validation.interval.not.positive"}},Le=(e,t)=>Re[e]?.isValid(t)?void 0:Re[e]?.error,Fe=[{message:"feeds.time.min",value:1},{message:"feeds.time.hr",value:60},{message:"feeds.time.day",value:1440}],Oe={label:"",interval:5,url:""},$e=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(null),[n,r]=(0,d.useState)({}),[a,o]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1);return(0,g.BX)("div",{children:[(0,g.BX)(c.l0,{className:"inverse",onChange:e=>{let{event:t,formData:l}=e;const i=t.target.name,a=l;r({...n,[i]:Le(i,a[i])})},onSubmit:async()=>{const t=e.current?.getFormData();if(null==e.current||null==t)return;h(!0);const n=Object.keys(Re).reduce(((e,l)=>({...e,[l]:Le(l,t[l])})),{});r(n);if(Object.keys(n).every((e=>void 0===n[e]))){const n={label:t.label,url:t.url,interval:Number(t.interval)*Number(t.intervalMultiplier)};let a=!0;try{null===l?await Ze.addFeed(n):null!=l?._id&&await Ze.modifyFeed(l._id,n)}catch{a=!1}a?(e.current.resetForm(),r({}),i(null),o(!1)):r({backend:"general.error.unknown"})}h(!1)},ref:e,children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"feeds.existing.feeds"})}),Object.keys(n).reduce(((e,l)=>(null!=n[l]&&e.push((0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:t._(n?.[l])})},`error-${l}`)),e)),[]),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.U2,{children:(0,g.tZ)(Ie,{currentFeed:l,intervalMultipliers:Fe,onSelect:e=>{i(e),o(!0)},onRemove:e=>{e===l&&(a&&(r({}),o(!1)),i(null)),null!=e._id&&Ze.removeFeedMonitor(e._id)}})})}),a?(0,g.tZ)(Te,{currentFeed:l,defaultFeed:Oe,intervalMultipliers:Fe,isSubmitting:u,onCancel:()=>{r({}),o(!1),i(null)}},l?._id||"initial"):(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.U2,{width:"auto"}),(0,g.tZ)(c.zx,{onClick:()=>{o(!0)},children:(0,g.tZ)(s.cC,{id:"button.new"})})]})]}),(0,g.tZ)(Me,{})]})},ze=()=>{const{i18n:e}=(0,s.mV)();(0,d.useEffect)((()=>{Ze.fetchFeedMonitors()}),[]);const t={feeds:{content:$e,label:e._("feeds.tabs.feeds")},downloadRules:{content:Xe,label:e._("feeds.tabs.download.rules")}};return(0,g.tZ)(de,{heading:e._("feeds.tabs.heading"),orientation:"horizontal",size:"large",tabs:t})};var Ue=l(4936);let Ae=function(e){return e[e.HTTP=1]="HTTP",e[e.UDP=2]="UDP",e[e.DHT=3]="DHT",e}({});const je=(e,t)=>{let l=`magnet:?xt=urn:btih:${e}`;return t?.length&&t.forEach((e=>{l=`${l}&tr=${encodeURI(e)}`})),l},He=()=>{const e=(0,d.useRef)(null),t=(0,d.useRef)(null),{i18n:l}=(0,s.mV)(),[i,n]=(0,d.useState)(!1),[r,a]=(0,d.useState)(!1),[o,u]=(0,d.useState)({isLoadingTrackers:!0,magnetTrackersLink:""});(0,d.useEffect)((()=>{_.Z.fetchTorrentTrackers(Ue.default.selectedTorrents[0]).then((e=>{null!=e&&u({isLoadingTrackers:!1,magnetTrackersLink:je(Ue.default.selectedTorrents[0],e.filter((e=>e.type!==Ae.DHT)).map((e=>e.url)))})}))}),[]);const h=je(Ue.default.selectedTorrents[0]);return(0,g.tZ)(de,{heading:l._("torrents.generate.magnet.heading"),content:(0,g.tZ)("div",{className:"modal__content inverse",children:(0,g.BX)(c.l0,{children:[Ue.default.torrents[Ue.default.selectedTorrents[0]]?.isPrivate?(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:l._("torrents.generate.magnet.private.torrent")})}):null,(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"magnet",ref:e,addonPlacement:"after",label:l._("torrents.generate.magnet.magnet"),defaultValue:h,readOnly:!0,children:(0,g.tZ)(c.G5,{onClick:()=>{"function"==typeof navigator.clipboard?.writeText?navigator.clipboard.writeText(h).then((()=>{n(!0)})):null!=e.current&&(e.current?.select(),document.execCommand("copy"),n(!0))},children:i?(0,g.tZ)(y.FV,{}):(0,g.tZ)(y.TU,{})})})}),(0,g.tZ)(c.p7,{children:o.isLoadingTrackers?(0,g.tZ)(c.fE,{id:"loading",label:l._("torrents.generate.magnet.magnet.with.trackers"),placeholder:l._("torrents.generate.magnet.loading.trackers"),disabled:!0}):(0,g.tZ)(c.fE,{id:"magnet-trackers",ref:t,addonPlacement:"after",label:l._("torrents.generate.magnet.magnet.with.trackers"),defaultValue:o.magnetTrackersLink,readOnly:!0,children:(0,g.tZ)(c.G5,{onClick:()=>{"function"==typeof navigator.clipboard?.writeText?navigator.clipboard.writeText(o.magnetTrackersLink).then((()=>{a(!0)})):null!=t.current&&(t.current?.select(),document.execCommand("copy"),a(!0))},children:r?(0,g.tZ)(y.FV,{}):(0,g.tZ)(y.TU,{})})})})]})}),actions:[{clickHandler:null,content:l._("button.close"),triggerDismiss:!0,type:"tertiary"}]})},qe=e=>{let t="";for(let l=0;l<e[0].length;l+=1)for(let i=1;i<e.length;i+=1)e[0][l]!==e[i][l]&&(t=e[0].slice(0,l));for(let e=t.length-1;e>=0;e-=1)if("/"===t[e])return t.slice(0,e+1)},Ge=()=>{const{i18n:e}=(0,s.mV)(),[t,l]=(0,d.useState)(!1);return(0,g.tZ)(de,{heading:e._("torrents.move.heading"),content:(0,g.tZ)("div",{className:"modal__content",children:(0,g.BX)(c.l0,{className:"inverse",onSubmit:e=>{let{formData:t}=e;const i=Ue.default.selectedTorrents;i.length>0&&(l(!0),_.Z.moveTorrents({hashes:i,destination:t.destination,isBasePath:t.isBasePath,moveFiles:t.moveFiles,isCheckHash:t.isCheckHash}).then((()=>{m.Z.setActiveModal(null),l(!1)})))},children:[(0,g.tZ)($,{id:"destination",selectable:"directories",suggested:qe(Ue.default.selectedTorrents.map((e=>Ue.default.torrents[e].directory))),showBasePathToggle:!0}),(0,g.tZ)(p,{actions:[{checked:!0,content:e._("torrents.move.data.label"),id:"moveFiles",type:"checkbox"},{checked:!1,content:e._("torrents.move.check_hash.label"),id:"isCheckHash",type:"checkbox"},{content:e._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{content:e._("torrents.move.button.set.location"),isLoading:t,submit:!0,type:"primary"}]})]})})})},Qe=()=>{const{i18n:e}=(0,s.mV)(),[t,l]=(0,d.useState)(!1),{selectedTorrents:i}=Ue.default;return 0===i.length?(0,g.tZ)(de,{heading:e._("torrents.remove"),content:(0,g.tZ)("div",{className:"modal__content inverse",children:(0,g.tZ)(c.l0,{children:(0,g.tZ)(c.p7,{children:(0,g.tZ)(s.cC,{id:"torrents.remove.error.no.torrents.selected"})})})}),actions:[{clickHandler:null,content:e._("button.ok"),triggerDismiss:!0,type:"primary"}]}):(0,g.tZ)(de,{heading:e._("torrents.remove"),content:(0,g.tZ)("div",{className:"modal__content",children:(0,g.BX)(c.l0,{className:"inverse",onSubmit:e=>{let{formData:t}=e;l(!0);const i=t.deleteData;_.Z.deleteTorrents({hashes:Ue.default.selectedTorrents,deleteData:i}).then((()=>{l(!1),(e=>{let{deleteData:t}=e;null!=t&&o.Z.saveSetting("deleteTorrentData",t)})({deleteData:i}),m.Z.setActiveModal(null)}))},children:[(0,g.tZ)(c.p7,{children:(0,g.tZ)(s.cC,{id:"torrents.remove.are.you.sure",values:{count:i.length}})}),(0,g.tZ)(p,{actions:[{checked:u.default.floodSettings.deleteTorrentData,content:e._("torrents.remove.delete.data"),id:"deleteData",type:"checkbox"},{content:e._("button.no"),triggerDismiss:!0,type:"tertiary"},{content:e._("button.yes"),isLoading:t,submit:!0,type:"primary"}]})]})})})},We=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(!1);return(0,g.tZ)(de,{heading:t._("torrents.set.tags.heading"),content:(0,g.tZ)("div",{className:"modal__content inverse",children:(0,g.tZ)(c.l0,{ref:e,children:(0,g.tZ)(c.p7,{children:(0,g.tZ)(H,{defaultValue:Ue.default.selectedTorrents.map((e=>Ue.default.torrents[e].tags))[0].slice(),id:"tags",placeholder:t._("torrents.set.tags.enter.tags")})})})}),actions:[{content:t._("button.cancel"),clickHandler:null,triggerDismiss:!0,type:"tertiary"},{content:t._("torrents.set.tags.button.set"),clickHandler:()=>{if(null==e.current)return;const{selectedTorrents:t}=Ue.default,l=e.current.getFormData(),n=l.tags?l.tags.split(",").filter((e=>!!e)):[];i(!0),t?.length>0&&_.Z.setTags({hashes:t,tags:n})},isLoading:l,triggerDismiss:!1,type:"primary"}]})},Ye=()=>{const e=(0,d.useRef)(null),{i18n:t}=(0,s.mV)(),[l,i]=(0,d.useState)(!1),[n,r]=(0,d.useState)({isLoadingTrackers:!0,trackerURLs:[]});return(0,d.useEffect)((()=>{_.Z.fetchTorrentTrackers(Ue.default.selectedTorrents[0]).then((e=>{null!=e&&r({isLoadingTrackers:!1,trackerURLs:e.filter((e=>e.type!==Ae.DHT)).map((e=>e.url))})}))}),[]),(0,g.tZ)(de,{heading:t._("torrents.set.trackers.heading"),content:(0,g.tZ)("div",{className:"modal__content inverse",children:(0,g.tZ)(c.l0,{ref:e,children:n.isLoadingTrackers?(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{id:"loading",placeholder:t._("torrents.set.trackers.loading.trackers"),disabled:!0})}):(0,g.tZ)(Q,{id:"trackers",placeholder:t._("torrents.set.trackers.enter.tracker"),defaultValues:0===n.trackerURLs.length?void 0:n.trackerURLs.map(((e,t)=>({id:t,value:e})))})})}),actions:[{clickHandler:null,content:t._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:()=>{if(null==e.current||l||n.isLoadingTrackers)return;i(!0);const t=e.current.getFormData(),r=q(t,"trackers").filter((e=>""!==e));_.Z.setTrackers({hashes:Ue.default.selectedTorrents,trackers:r}).then((()=>{i(!1),m.Z.setActiveModal(null)}))},content:t._("torrents.set.trackers.button.set"),isLoading:l||n.isLoadingTrackers,triggerDismiss:!1,type:"primary"}]})},Je="4.8.2",Ke=(0,d.lazy)((()=>l.e(443).then(l.t.bind(l,6641,23)).then((e=>({default:e.react}))))),et="https://github.com/jesec/flood",tt=()=>(0,g.tZ)(d.Suspense,{fallback:null,children:(0,g.tZ)(Ke,{FloodVersion:()=>Je,CommitBadge:()=>Je.length>8?(0,g.tZ)("a",{href:et,children:(0,g.tZ)("img",{alt:"Latest version of rolling build",src:"https://img.shields.io/npm/v/@jesec/flood?label=HEAD"})}):(0,g.tZ)("a",{href:et,children:(0,g.tZ)("img",{alt:"Commits since user's version",src:`https://img.shields.io/github/commits-since/jesec/flood/v${Je}`})})})});var lt=l(8111),it=l(2552),nt=l(2809),rt=l(4982);const at=(0,r.Pi)((()=>{const e=(0,d.useRef)(null),t=(0,d.useRef)(null),[l,r]=(0,d.useState)(null),[a,o]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1),{i18n:_}=(0,s.mV)();if((0,d.useEffect)((()=>{it.Z.currentUser.isAdmin&<.Z.fetchUsers().then((()=>{o(!0)}))}),[]),!it.Z.currentUser.isAdmin)return(0,g.BX)(c.l0,{children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"auth.user.accounts"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:(0,g.tZ)(s.cC,{id:"auth.message.not.admin"})})})]});const m=!a&&0===it.Z.users.length,p=U()("interactive-list",{"interactive-list--loading":m});return(0,g.BX)(c.l0,{onSubmit:()=>{if(null==e.current||null==t.current)return;const l=e.current.getFormData();if(null==l.username||""===l.username)r("auth.error.username.empty");else if(null==l.password||""===l.password)r("auth.error.password.empty");else{h(!0);const i=t.current;if(null==i)return r("connection.settings.error.empty"),void h(!1);lt.Z.createUser({username:l.username,password:l.password,client:i,level:!0===l.isAdmin?nt.u.ADMINISTRATOR:nt.u.USER}).then((()=>{null!=e.current&&e.current.resetForm(),r(null),h(!1)}),(()=>{r("general.error.unknown"),h(!1)})).then(lt.Z.fetchUsers)}},ref:e,children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"auth.user.accounts"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.U2,{children:(0,g.BX)("ul",{className:p,children:[(0,g.tZ)(n.Z,{children:m&&(0,g.tZ)(i.Z,{classNames:"interactive-list__loading-indicator",timeout:{enter:250,exit:250},children:(0,g.tZ)("div",{className:"interactive-list__loading-indicator",children:(0,g.tZ)(c.$z,{})},"loading-indicator")})}),it.Z.users.slice().sort(((e,t)=>e.username.localeCompare(t.username))).map((e=>{const t=e.username===it.Z.currentUser.username;let l=null,i=null;t?l=(0,g.tZ)("span",{className:"interactive-list__label__tag tag",children:(0,g.tZ)(s.cC,{id:"auth.current.user"})}):i=(0,g.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>lt.Z.deleteUser(e.username).then(lt.Z.fetchUsers),children:(0,g.tZ)(y.x8,{})});const n=U()("interactive-list__item",{"interactive-list__item--disabled":t});return(0,g.BX)("li",{className:n,children:[(0,g.BX)("span",{className:"interactive-list__label",children:[(0,g.tZ)("div",{className:"interactive-list__label__text",children:e.username}),l]}),i]},e.username)}))]})})}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"auth.add.user"})}),l&&(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Xq,{children:_._(l)})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{id:"username",label:(0,g.tZ)(s.cC,{id:"auth.username"}),placeholder:_._("auth.username"),autoComplete:"username"}),(0,g.tZ)(c.fE,{id:"password",label:(0,g.tZ)(s.cC,{id:"auth.password"}),placeholder:_._("auth.password"),autoComplete:"new-password"}),(0,g.tZ)(c.XZ,{grow:!1,id:"isAdmin",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"auth.admin"})})]}),(0,g.tZ)(rt.Z,{onSettingsChange:e=>{t.current=e}}),(0,g.tZ)("p",{}),(0,g.tZ)(c.p7,{justify:"end",children:(0,g.tZ)(c.zx,{isLoading:u,priority:"primary",type:"submit",children:(0,g.tZ)(s.cC,{id:"button.add"})})})]})})),st=(e,t)=>null!=e[t]?e[t]:u.default.clientSettings?.[t],dt=e=>{const t=e.target,l=t.name,{value:i,type:n,checked:r}=t;let a={};return a="checkbox"===n?{[l]:r}:{[l]:i},a},ct=e=>{if(e&&0!==e.length)return e.join(", ")},ot=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return""===e?[]:e.replace(/\s/g,"").split(",").map((e=>Number(e)))},ut=e=>{let{onSettingsChange:t,onClientSettingsChange:l}=e;const[i,n]=(0,d.useState)({});return(0,g.BX)(c.l0,{onChange:e=>{let{event:r,formData:a}=e;const s=r.target;if("dropdownPresetDownload"===s.name||"dropdownPresetUpload"===s.name)return void t({speedLimits:{download:ot(a.dropdownPresetDownload),upload:ot(a.dropdownPresetUpload)}});const d={...i,...dt(r)};n(d),l(d)},children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.heading"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:null!=u.default.floodSettings.speedLimits?ct(u.default.floodSettings.speedLimits.download):0,label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.dropdown.preset.download.label"}),id:"dropdownPresetDownload"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:null!=u.default.floodSettings.speedLimits?ct(u.default.floodSettings.speedLimits.upload):0,label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.dropdown.preset.upload.label"}),id:"dropdownPresetUpload"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleGlobalDownSpeed"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.global.throttle.download"}),id:"throttleGlobalDownSpeed"}),(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleGlobalUpSpeed"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.transferrate.global.throttle.upload"}),id:"throttleGlobalUpSpeed"})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.heading"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleMaxUploads"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.upload.label"}),id:"throttleMaxUploads"}),(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleMaxUploadsGlobal"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.upload.global.label"}),id:"throttleMaxUploadsGlobal"})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleMaxDownloads"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.download.label"}),id:"throttleMaxDownloads"}),(0,g.tZ)(c.fE,{defaultValue:st(i,"throttleMaxDownloadsGlobal"),label:(0,g.tZ)(s.cC,{id:"settings.bandwidth.slots.download.global.label"}),id:"throttleMaxDownloadsGlobal"})]})]})},ht=e=>{let{onClientSettingsChange:t}=e;const[l,i]=(0,d.useState)({});return(0,g.BX)(c.l0,{onChange:e=>{let{event:n}=e;const r={...l,...dt(n)};i(r),t(r)},children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.connectivity.incoming.heading"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"networkPortRange"),id:"networkPortRange",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.port.range.label"}),width:"one-quarter"}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"networkPortRandom"),grow:!1,id:"networkPortRandom",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.connectivity.port.randomize.label"})}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"networkPortOpen"),grow:!1,id:"networkPortOpen",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.connectivity.port.open.label"})})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"networkLocalAddress"),id:"networkLocalAddress",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.ip.hostname.label"})}),(0,g.tZ)(c.fE,{defaultValue:st(l,"networkHttpMaxOpen"),id:"networkHttpMaxOpen",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.max.http.connections"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.connectivity.dpd.heading"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"dhtPort"),id:"dhtPort",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.dht.port.label"}),width:"one-quarter"}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"dht"),grow:!1,id:"dht",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.connectivity.dht.label"})}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"protocolPex"),grow:!1,id:"protocolPex",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.connectivity.peer.exchange.label"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.heading"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"throttleMinPeersNormal"),id:"throttleMinPeersNormal",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.min.label"})}),(0,g.tZ)(c.fE,{defaultValue:st(l,"throttleMaxPeersNormal"),id:"throttleMaxPeersNormal",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.max.label"})})]}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"throttleMinPeersSeed"),id:"throttleMinPeersSeed",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.seeding.min.label"})}),(0,g.tZ)(c.fE,{defaultValue:st(l,"throttleMaxPeersSeed"),id:"throttleMaxPeersSeed",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.seeding.max.label"})})]}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:st(l,"trackersNumWant"),id:"trackersNumWant",label:(0,g.tZ)(s.cC,{id:"settings.connectivity.peers.desired.label"}),width:"one-half"})})]})};var _t=l(5181),mt=l(8826),gt=l(5587),pt=l(9752),ft=l(2339),Zt=l(4285);const bt=e=>{const{children:t,id:l,disabled:i}=e,{attributes:n,setNodeRef:r,listeners:a,transform:s,transition:d,isDragging:c}=(0,gt.nB)({id:l,disabled:i}),o={transform:Zt.ux.Transform.toString(s),transition:d};return(0,g.BX)("div",{className:U()("sortable-list__item",{"sortable-list__item--is-dragging":c,"sortable-list__item--is-locked":i}),ref:r,style:o,...n,...a,children:[i?(0,g.tZ)(y.HE,{}):null,t]})};var vt={name:"z45y2s",styles:"width:100%;touch-action:none"};const yt=e=>{let{className:t,items:l,lockedIDs:i,renderItem:n,onMouseDown:r,onDrop:a}=e;const[s,c]=(0,d.useState)(l),o=U()("sortable-list",t),u=(0,pt.VT)(pt.Lg),h=(0,pt.VT)(pt.MA,{activationConstraint:{distance:10}}),_=(0,pt.VT)(pt.LO,{activationConstraint:{distance:10}});return(0,g.tZ)("div",{css:vt,role:"none",onMouseDown:e=>{r&&r(e)},children:(0,g.tZ)(pt.LB,{sensors:[u,h,_],onDragEnd:e=>{let{active:t,over:i}=e;if(null==i)return;if(t.id===i.id)return;const n=(0,gt.Rp)(l,l.findIndex((e=>e===t.id)),l.findIndex((e=>e===i.id)));c(n),a&&a(n)},modifiers:[ft.DL,ft.F4],autoScroll:!1,children:(0,g.tZ)(gt.Fo,{items:s,strategy:gt.qw,children:(0,g.tZ)("ul",{className:o,children:s.map(((e,t)=>(0,g.tZ)(bt,{id:e,disabled:i.includes(e),children:n(e,t)},e)))})})})})};yt.defaultProps={onMouseDown:void 0,onDrop:void 0};const Ct=yt,kt=e=>{let{onSettingsChange:t}=e;const[l,i]=(0,d.useState)((()=>{const{mountPoints:e}=u.default.floodSettings,t=Object.assign({},...mt.default.disks.map((e=>({[e.target]:e}))));return e.filter((e=>e in t)).map((e=>({id:e,visible:!0}))).concat(Object.keys(t).filter((t=>!e.includes(t))).map((e=>({id:e,visible:!1}))))})()),n=l.reduce(((e,t)=>{let{id:l,visible:i}=t;return e[l]=i,e}),{});return(0,g.tZ)(Ct,{className:"sortable-list--disks",items:l.map((e=>{let{id:t}=e;return t})),lockedIDs:[],onDrop:e=>{i(e.map((e=>({id:e,visible:n[e]}))))},renderItem:e=>{const r=(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,g.tZ)(c.XZ,{defaultChecked:n[e],id:e,onClick:r=>{n[e]=r.target.checked;const a=l.map((t=>t.id===e?{...t,visible:r.target.checked}:t));t({mountPoints:a.filter((e=>e.visible)).map((e=>e.id))}),i(a)},children:(0,g.tZ)(s.cC,{id:"settings.diskusage.show"})})});return(0,g.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,g.tZ)("div",{children:e})}),r]})}})},Nt=e=>{let{onSettingsChange:t}=e;return(0,g.BX)(c.l0,{children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.diskusage.mount.points"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(kt,{onSettingsChange:t})})]})},wt=e=>{let{onClientSettingsChange:t}=e;const[l,i]=(0,d.useState)({});return(0,g.BX)(c.l0,{onChange:e=>{let{event:n}=e;const r={...l,...dt(n)};i(r),t(r)},children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.resources.disk.heading"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:st(l,"directoryDefault"),id:"directoryDefault",label:(0,g.tZ)(s.cC,{id:"settings.resources.disk.download.location.label"})})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.fE,{defaultValue:st(l,"networkMaxOpenFiles"),id:"networkMaxOpenFiles",label:(0,g.tZ)(s.cC,{id:"settings.resources.max.open.files"}),width:"one-half"}),(0,g.tZ)(c.XZ,{defaultChecked:st(l,"piecesHashOnCompletion"),grow:!1,id:"piecesHashOnCompletion",labelOffset:!0,matchTextboxHeight:!0,children:(0,g.tZ)(s.cC,{id:"settings.resources.disk.check.hash.label"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.resources.memory.heading"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.fE,{defaultValue:st(l,"piecesMemoryMax"),id:"piecesMemoryMax",label:(0,g.BX)("div",{children:[(0,g.tZ)(s.cC,{id:"settings.resources.memory.max.label"})," ",(0,g.tZ)("em",{className:"unit",children:"(MB)"})]}),width:"one-half"})})]})};var St=l(7731);var xt={name:"1d3w5wq",styles:"width:100%"},Bt={name:"15rw530",styles:".sortable-list__item{cursor:default;}"};const Xt=e=>{let{className:t,checkboxLabel:l,items:i}=e;return(0,g.tZ)("div",{css:xt,role:"none",children:(0,g.tZ)("ul",{className:U()("sortable-list",t),css:Bt,children:i.map((e=>{const{id:t,label:i,isLocked:n=!1,defaultChecked:r,onClick:a}=e;return(0,g.BX)("li",{className:U()("sortable-list__item",{"sortable-list__item--is-locked":n}),children:[n?(0,g.tZ)(y.HE,{}):null,(0,g.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,g.tZ)(s.cC,{id:i})}),n?null:(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,g.tZ)(c.XZ,{defaultChecked:r,id:t,onClick:e=>a?.(e.target.checked),children:l&&(0,g.tZ)(s.cC,{id:l})})})]})]},t||i)}))})})};Xt.defaultProps={className:void 0,checkboxLabel:void 0};const Tt=Xt,Dt=e=>{let{onSettingsChange:t}=e;const l=(0,d.useRef)(u.default.floodSettings.UIPageTitleSpeedEnabled);return(0,g.tZ)(Tt,{items:[{label:"settings.ui.page.title.speed",defaultChecked:l.current,onClick:()=>{l.current=!l.current,t({UIPageTitleSpeedEnabled:l.current})}}]})};var Pt=l(8737),Et=l(2433);const Mt=e=>{let{onSettingsChange:t}=e;const l=(0,d.useRef)(Et.Z.torrentContextMenuActions.map((e=>{let{id:t,visible:l}=e;return{id:t,visible:u.default.floodSettings.torrentContextMenuActions.find((e=>e.id===t))?.visible??l}})));return(0,g.tZ)(Tt,{checkboxLabel:"settings.ui.torrent.context.menu.items.show",items:Object.keys(Pt.Z).map((e=>({label:Pt.Z[e],isLocked:"start"===e||"stop"===e||"setTaxonomy"===e||"torrentDetails"===e,defaultChecked:l.current.some((t=>t.id===e&&t.visible)),onClick:()=>{const i=l.current.find((t=>t.id===e));null!=i&&(i.visible=!i.visible),t({torrentContextMenuActions:l.current})}})))})};var Vt=l(882),It=l(9097);const Rt=e=>{let{torrentListViewSize:t,onSettingsChange:l}=e;const i=(0,d.useRef)(null),[n,r]=(0,d.useState)([...u.default.floodSettings.torrentListColumns.filter((e=>null!=Vt.Z[e.id])).slice(),...Object.keys(Vt.Z).filter((e=>u.default.floodSettings.torrentListColumns.every((t=>t.id!==e)))).map((e=>({id:e,visible:!1})))]),a=n.reduce(((e,t)=>{let{id:l,visible:i}=t;return e[l]=i,e}),{}),o="expanded"===t?["name","eta","downRate","percentComplete","downTotal","upRate"]:[];return(0,g.tZ)(Ct,{className:"sortable-list--torrent-details",items:n.map((e=>{let{id:t}=e;return t})),lockedIDs:o,onMouseDown:()=>{i.current?.dismissTooltip()},onDrop:e=>{const t=e.map((e=>({id:e,visible:a[e]})));l({torrentListColumns:t}),r(t)},renderItem:(e,d)=>{let u=null,h=null;if(o.includes(e)||(u=(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,g.tZ)(c.XZ,{defaultChecked:a[e],id:e,onClick:t=>{a[e]=t.target.checked;const i=n.map((l=>({id:l.id,visible:l.id===e?t.target.checked:l.visible})));r(i),l({torrentListColumns:i})},children:(0,g.tZ)(s.cC,{id:"settings.ui.torrent.details.enabled"})})})),"tags"===e&&"expanded"===t&&d<n.length-1){const e=(0,g.tZ)(s.cC,{id:"settings.ui.torrent.details.tags.placement"});h=(0,g.tZ)(It.Z,{className:"tooltip tooltip--is-error",content:e,offset:-5,ref:i,width:200,wrapperClassName:"sortable-list__content sortable-list__content--secondary tooltip__wrapper",wrapText:!0,children:(0,g.tZ)(y.jj,{})})}return(0,g.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[h,(0,g.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,g.tZ)(s.cC,{id:Vt.Z[e]})}),u]})}})},Lt=e=>{let{onSettingsChange:t}=e;const{i18n:l}=(0,s.mV)(),[i,n]=(0,d.useState)(u.default.floodSettings.torrentListViewSize),[r,a]=(0,d.useState)(u.default.floodSettings.language),[o,h]=(0,d.useState)(u.default.floodSettings.UITagSelectorMode);return(0,g.BX)(c.l0,{onChange:e=>{let{event:l,formData:r}=e;const s=l.target;if("radio"===s.type&&(n(r["ui-torrent-size"]),h(r["ui-tag-selector-mode"]),t({torrentListViewSize:i,UITagSelectorMode:o})),"language"===s.name){const e=r.language;a(e),t({language:e})}},children:[(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.language"})},"locale-header"),(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.Ph,{defaultID:r,id:"language",children:Object.keys(St.Z).map((e=>(0,g.tZ)(c.Ql,{id:e,children:"auto"===e?l._(St.Z[e].id):St.Z[e]},e)))})},"locale-selection"),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.tag.selector.mode"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.Y8,{defaultChecked:"single"===o,groupID:"ui-tag-selector-mode",id:"single",width:"auto",children:(0,g.tZ)(s.cC,{id:"settings.ui.tag.selector.mode.single"})}),(0,g.tZ)(c.Y8,{defaultChecked:"multi"===o,groupID:"ui-tag-selector-mode",id:"multi",width:"auto",children:(0,g.tZ)(s.cC,{id:"settings.ui.tag.selector.mode.multi"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.torrent.list"})}),(0,g.BX)(c.p7,{children:[(0,g.tZ)(c.Y8,{defaultChecked:"expanded"===i,groupID:"ui-torrent-size",id:"expanded",width:"auto",children:(0,g.tZ)(s.cC,{id:"settings.ui.torrent.size.expanded"})}),(0,g.tZ)(c.Y8,{defaultChecked:"condensed"===i,groupID:"ui-torrent-size",id:"condensed",width:"auto",children:(0,g.tZ)(s.cC,{id:"settings.ui.torrent.size.condensed"})})]}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.displayed.details"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(Rt,{torrentListViewSize:i,onSettingsChange:t})}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.displayed.context.menu.items"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(Mt,{onSettingsChange:t})}),(0,g.tZ)(ke,{children:(0,g.tZ)(s.cC,{id:"settings.ui.misc"})}),(0,g.tZ)(c.p7,{children:(0,g.tZ)(Dt,{onSettingsChange:t})})]})},Ft=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)(),[t,l]=(0,d.useState)({}),[i,n]=(0,d.useState)({}),[r,a]=(0,d.useState)(!1),c=e=>{l({...t,...e})},u=e=>{n({...i,...e})},h={bandwidth:{content:ut,props:{onClientSettingsChange:c,onSettingsChange:u},label:e._("settings.tabs.bandwidth")},connectivity:{content:ht,props:{onClientSettingsChange:c},label:e._("settings.tabs.connectivity")},resources:{content:wt,props:{onClientSettingsChange:c},label:e._("settings.tabs.resources")},..."none"!==ee.default.authMethod?{authentication:{content:at,label:e._("settings.tabs.authentication")}}:{},ui:{content:Lt,label:e._("settings.tabs.userinterface"),props:{onSettingsChange:u}},diskusage:{content:Nt,label:e._("settings.tabs.diskusage"),props:{onSettingsChange:u}},about:{content:tt,label:e._("settings.tabs.about")}};return(0,g.tZ)(de,{actions:[{clickHandler:null,content:e._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:()=>{a(!0),Promise.all([o.Z.saveSettings(i,{alert:!0}),_t.Z.saveSettings(t,{alert:!0})]).then((()=>{a(!1),m.Z.setActiveModal(null)}))},isLoading:r,content:e._("button.save"),triggerDismiss:!1,type:"primary"}],size:"large",heading:e._("settings.tabs.heading"),orientation:ee.default.isSmallScreen?"horizontal":"vertical",tabs:h})})),Ot=()=>{const{i18n:e}=(0,s.mV)(),t=(0,d.useRef)(he().CancelToken.source()),l=(0,d.useRef)(null),[i,n]=(0,d.useState)(null),[r,a]=(0,d.useState)(null),[o,u]=(0,d.useState)(!0),[h,p]=(0,d.useState)(!1);(0,d.useEffect)((()=>{const{current:e}=t;return"torrent-details"===m.Z.activeModal?.id&&_.Z.fetchMediainfo(m.Z.activeModal?.hash,t.current.token).then((e=>{n(e.output),u(!1)}),(e=>{he().isCancel(e)||(a(e.response.data),u(!1))})),()=>{e.cancel()}}),[]);let f="mediainfo.heading";return o?f="mediainfo.fetching":r&&(f="mediainfo.execError"),(0,g.BX)("div",{className:"torrent-details__section mediainfo modal__content--nested-scroll__content",children:[(0,g.BX)("div",{className:"mediainfo__toolbar",children:[(0,g.tZ)("div",{className:"mediainfo__toolbar__item",children:(0,g.tZ)("span",{className:"torrent-details__table__heading--tertiary",children:(0,g.tZ)(s.cC,{id:f})})}),i&&(0,g.tZ)(It.Z,{content:e._(h?"general.clipboard.copied":"general.clipboard.copy"),wrapperClassName:"tooltip__wrapper mediainfo__toolbar__item",children:(0,g.tZ)(c.zx,{priority:"tertiary",onClick:()=>{null!=i&&("function"==typeof navigator.clipboard?.writeText?navigator.clipboard.writeText(i).then((()=>{p(!0)})):null!=l.current&&(l.current.value=i,l.current.select(),document.execCommand("copy"),p(!0)))},children:h?(0,g.tZ)(y.MC,{}):(0,g.tZ)(y.TU,{})})})]}),(0,g.tZ)("input",{ref:l,style:{width:"0.1px",height:"1px",position:"absolute",right:0}}),r?(0,g.tZ)("pre",{className:"mediainfo__output mediainfo__output--error",children:r.message}):(0,g.tZ)("pre",{className:"mediainfo__output",children:i})]})},$t=(e,t)=>({...e,...null!=e.directories?{directories:Object.assign({},...Object.keys(e.directories).map((l=>null!=e.directories?{[l]:$t(e.directories[l],t)}:{})))}:{},...null!=e.files?{files:Object.assign({},...Object.keys(e.files).map((l=>null!=e.files?{[l]:{...e.files[l],isSelected:t}}:{})))}:{},isSelected:t}),zt=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const{depth:i,path:n,select:r,type:a}=t,s=n[l];if(l===i-1){if("file"===a&&null!=e.files?.[s]){const t={...e.files,[s]:{...e.files[s],isSelected:r}};return{...e,files:t,isSelected:Object.values(t).every((e=>{let{isSelected:t}=e;return t}))&&(null==e.directories||Object.values(e.directories).every((e=>{let{isSelected:t}=e;return t})))}}if("directory"===a&&null!=e.directories){const t={...e.directories,[s]:$t(e.directories[s],r)};return{...e,directories:t,isSelected:Object.values(t).every((e=>{let{isSelected:t}=e;return t}))&&(null==e.files||Object.values(e.files).every((e=>{let{isSelected:t}=e;return t})))}}return e}if(null!=e.directories){const i=e.directories;return Object.keys(i).forEach((e=>{e===s&&(i[e]=zt(i[e],t,l+1))})),{...e,directories:i,isSelected:Object.values(i).every((e=>{let{isSelected:t}=e;return t}))}}return e},Ut=e=>{const t=[];if(null!=e.files){const{files:l}=e;Object.keys(l).forEach((e=>{const i=l[e];i.isSelected&&t.push(i.index)}))}if(null!=e.directories){const{directories:l}=e;Object.keys(l).forEach((e=>{t.push(...Ut(l[e]))}))}return t},At={selectAll:$t,applySelection:zt,getSelectedItems:Ut,getSelectionTree:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const l={isSelected:t};return e.forEach((e=>{const i=e.path.split("/");let n=l;for(;i.length-1;){const e=i.shift();null==n.directories&&(n.directories={}),null==n.directories[e]&&(n.directories[e]={isSelected:t}),n=n.directories[e]}null==n.files&&(n.files={}),n.files[e.filename]={...e,isSelected:t}})),l}};var jt=l(2036),Ht=l(2104);const qt=e=>{let{depth:t,items:l,hash:i,path:n,onItemSelect:r}=e;const[a,s]=(0,d.useState)(null),o=(0,d.useRef)({});if(null==l)return null;const u=Object.values(l).sort(((e,t)=>e.filename.localeCompare(t.filename))).map((e=>{const d=l&&l[e.filename]&&l[e.filename].isSelected||!1,u=U()("directory-tree__node file","directory-tree__node--file directory-tree__node--selectable",{"directory-tree__node--selected":d});return(0,g.BX)("div",{className:u,title:e.filename,children:[(0,g.BX)("div",{className:"file__label file__detail",children:[(0,g.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,g.tZ)(c.XZ,{checked:d,id:`${e.index}`,onClick:()=>r({type:"file",depth:t,path:[...n,e.filename],select:!d})})}),(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:(0,g.tZ)(y.$B,{})})]}),(0,g.tZ)("div",{className:"file__name",children:(0,g.tZ)("a",{href:`${ee.default.baseURI}api/torrents/${i}/contents/${e.index}/data`,style:{textDecoration:"none"},target:"_blank",rel:"noreferrer",children:e.filename})})]}),(0,g.tZ)("div",{className:"file__detail file__detail--secondary",children:(0,g.tZ)(Ht.Z,{value:e.sizeBytes,precision:1})}),(0,g.BX)("div",{className:"file__detail file__detail--secondary",children:[Math.trunc(e.percentComplete),"%"]}),(0,g.tZ)("div",{className:"file__detail file__detail--secondary file__detail--priority",children:(0,g.tZ)(jt.Z,{level:e.priority,id:e.index,maxLevel:2,onChange:(e,t)=>_.Z.setFilePriority(i,{indices:[Number(e)],priority:t}),priorityType:"file"},`${e.index}-${e.filename}`)}),"function"==typeof navigator.clipboard?.writeText&&(0,g.tZ)("button",{className:"file__detail file__detail--secondary file__detail--clipboard",type:"button",onClick:()=>{const t=t=>{""!==t&&("function"==typeof navigator.share?navigator.share({title:e.filename,url:t}).then((()=>s(e.index))):navigator.clipboard.writeText(t).then((()=>s(e.index))))},l=o.current[e.index];null!=l?t(l):(o.current[e.index]="",_.Z.getTorrentContentsDataPermalink(i,[e.index]).then((l=>{o.current[e.index]=l,t(l)}),(()=>{o.current[e.index]=null})))},children:a===e.index?(0,g.tZ)(y.MC,{}):(0,g.tZ)(y.TU,{})})]},e.filename)}));return(0,g.tZ)("div",{className:"directory-tree__node directory-tree__node--file-list",children:u})};var Gt={name:"r5l0s9",styles:"width:100%;text-align:left;:focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"};const Qt=e=>{let{depth:t,directoryName:l,id:i,itemsTree:n,hash:r,path:a,isSelected:s,onItemSelect:o}=e;const[u,h]=(0,d.useState)(!1),_=[...a,l];return(0,g.BX)("div",{className:U()("directory-tree__branch",`directory-tree__branch--depth-${t}`,{"directory-tree__node--selected":s}),children:[(0,g.tZ)("button",{className:U()("directory-tree__node","directory-tree__node--selectable directory-tree__node--directory",{"is-expanded":u}),css:Gt,type:"button",onClick:()=>h(!u),title:l,children:(0,g.BX)("div",{className:"file__label",children:[(0,g.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,g.tZ)(c.XZ,{checked:s,id:i,onClick:()=>o({type:"directory",depth:t,path:_,select:!s})})}),(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:u?(0,g.tZ)(y.DB,{}):(0,g.tZ)(y.Bm,{})})]}),(0,g.tZ)("div",{className:"file__name",children:l})]})}),u?(0,g.tZ)("div",{className:"directory-tree__node directory-tree__node--group",children:(0,g.tZ)(Wt,{depth:t,hash:r,onItemSelect:o,path:_,itemsTree:n},`${u}-${t}`)}):null]})},Wt=e=>{const{depth:t=0,itemsTree:l,hash:i,path:n,onItemSelect:r}=e,{files:a,directories:s}=l,d=t+1,c=null!=s?Object.keys(s).sort(((e,t)=>e.localeCompare(t))).map(((e,t)=>{const a=l.directories&&l.directories[e],s=`${t}${d}${e}`,c=a&&a.isSelected||!1;return null==a?null:(0,g.tZ)(Qt,{depth:d,directoryName:e,hash:i,id:s,isSelected:c,itemsTree:a,onItemSelect:r,path:n},s)})):[],o=null!=a&&Object.keys(a).length>0?(0,g.tZ)(qt,{depth:d,hash:i,onItemSelect:r,path:n,items:l.files},`files-${d}`):null;return(0,g.tZ)("div",{className:"directory-tree__tree",children:c.concat(o)})},Yt=(0,r.Pi)((()=>{const[e,t]=(0,d.useState)([]),[l,i]=(0,d.useState)({}),[n,r]=(0,d.useState)([]),{i18n:a}=(0,s.mV)();if((0,d.useEffect)((()=>{"torrent-details"===m.Z.activeModal?.id&&_.Z.fetchTorrentContents(m.Z.activeModal?.hash).then((e=>{null!=e&&(t(e),i(At.getSelectionTree(e)))}))}),[]),"torrent-details"!==m.Z.activeModal?.id)return null;const{hash:o}=m.Z?.activeModal;let u=null,h=null,p=!1;e?.length>0?(p=n.length>=e.length,u=(0,g.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,g.tZ)(c.p7,{children:(0,g.tZ)(c.XZ,{checked:p,id:"select-all",onClick:()=>{const t=At.getSelectionTree(e,n.length<e.length);i(t),r(At.getSelectedItems(t))}})})}),(0,g.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:(0,g.tZ)(y.Zz,{})})]}),h=(0,g.tZ)(Wt,{depth:0,onItemSelect:e=>{const t=At.applySelection(l,e);i(t),r(At.getSelectedItems(t))},hash:o,path:[],itemsTree:l})):(u=(0,g.tZ)(y.Zz,{}),h=(0,g.tZ)("div",{className:"directory-tree__node directory-tree__node--file",children:(0,g.tZ)(s.cC,{id:"torrents.details.files.loading"})}));const f=U()("directory-tree__node","directory-tree__parent-directory torrent-details__section__heading",{"directory-tree__node--selected":p}),Z=(0,g.tZ)("div",{className:f,children:(0,g.BX)("div",{className:"file__label",children:[u,(0,g.tZ)("div",{className:"file__name",children:Ue.default.torrents?.[o].directory})]})}),b=U()("inverse directory-tree__wrapper",{"directory-tree__wrapper--toolbar-visible":n.length>0});return(0,g.BX)(c.l0,{className:b,onChange:e=>{let{event:t}=e;if(null!=t.target&&"file-priority"===t.target.name){const e=t.target;e.value&&_.Z.setFilePriority(o,{indices:n,priority:Number(e.value)})}},children:[(0,g.tZ)("div",{className:"directory-tree__selection-toolbar",children:(0,g.BX)(c.p7,{align:"center",children:[(0,g.tZ)(c.U2,{width:"one-quarter",grow:!1,shrink:!1,children:(0,g.tZ)(s.cC,{id:"torrents.details.selected.files",values:{count:n.length,countElement:(0,g.tZ)("span",{className:"directory-tree__selection-toolbar__item-count",children:n.length})}})}),(0,g.tZ)(c.zx,{onClick:e=>{e.preventDefault();const{baseURI:t}=ee.default,l=document.createElement("a");l.download="",l.href=`${t}api/torrents/${o}/contents/${n.join(",")}/data`,l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l)},grow:!1,shrink:!1,children:(0,g.tZ)(s.cC,{id:"torrents.details.files.download.file",values:{count:n.length}})}),(0,g.BX)(c.Ph,{id:"file-priority",persistentPlaceholder:!0,shrink:!1,defaultID:"",children:[(0,g.tZ)(c.Ql,{id:-1,isPlaceholder:!0,children:(0,g.tZ)(s.cC,{id:"torrents.details.selected.files.set.priority"})}),(0,g.tZ)(c.Ql,{id:0,children:a._("priority.dont.download")}),(0,g.tZ)(c.Ql,{id:1,children:a._("priority.normal")}),(0,g.tZ)(c.Ql,{id:2,children:a._("priority.high")})]})]})}),(0,g.BX)("div",{className:"directory-tree torrent-details__section torrent-details__section--file-tree modal__content--nested-scroll__content",children:[Z,h]})]})})),Jt=Yt;const Kt=e=>{let{text:t,className:l}=e;const i=t.split(/([ \n])/).map(((e,t)=>"\n"===e?(0,g.tZ)("br",{},t):function(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}(e)?(0,g.tZ)("a",{href:e.trimEnd(),target:"_blank",rel:"noopener noreferrer",children:e},t):e));return(0,g.tZ)("span",{className:l,children:i})};Kt.defaultProps={className:void 0};const el=Kt,tl=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)();if("torrent-details"!==m.Z.activeModal?.id)return null;const t=Ue.default.torrents[m.Z.activeModal.hash];if(null==t)return null;const l=(0,g.tZ)("span",{className:"not-available",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.none"})});return(0,g.tZ)("div",{className:"torrent-details__section torrent-details__section--general",children:(0,g.tZ)("table",{className:"torrent-details__table table",children:(0,g.BX)("tbody",{children:[(0,g.tZ)("tr",{className:"torrent-details__table__heading",children:(0,g.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,g.tZ)(s.cC,{id:"torrents.details.general.heading.general"})})}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateAdded",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.date.added"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.dateAdded>0?e.date(new Date(1e3*t.dateAdded),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):l})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--location",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.location"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.directory})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--tags",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.tags"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.tags.length?(i=t.tags,i.map((e=>(0,g.tZ)("span",{className:"tag",children:e},e)))):l})]}),(0,g.tZ)("tr",{className:"torrent-details__table__heading",children:(0,g.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,g.tZ)(s.cC,{id:"torrents.details.general.heading.transfer"})})}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateFinished",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.date.finished"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.dateFinished>0?e.date(new Date(1e3*t.dateFinished),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):l})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--downloaded",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.downloaded"})}),(0,g.BX)("td",{className:"torrent-details__detail__value",children:[e.number(t.percentComplete),(0,g.tZ)("em",{className:"unit",children:"%"})]})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--peers",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.peers"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.connected",values:{connectedCount:t.peersConnected,connected:e.number(t.peersConnected),total:e.number(t.peersTotal)}})})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--seeds",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.seeds"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.connected",values:{connectedCount:t.seedsConnected,connected:e.number(t.seedsConnected),total:e.number(t.seedsTotal)}})})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateActive",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.date.active"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:0===t.dateActive?l:-1===t.dateActive?e._("torrents.details.general.date.active.now"):e.date(new Date(1e3*t.dateActive),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"})})]}),(0,g.tZ)("tr",{className:"torrent-details__table__heading",children:(0,g.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,g.tZ)(s.cC,{id:"torrents.details.general.heading.torrent"})})}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--created",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.date.created"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.dateCreated>0?e.date(new Date(1e3*t.dateCreated),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):l})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--hash",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.hash"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.hash})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--size",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.size"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:(0,g.tZ)(Ht.Z,{value:t.sizeBytes})})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--type",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.type"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.isPrivate?e._("torrents.details.general.type.private"):e._("torrents.details.general.type.public")})]}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--comment",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.comment"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.comment?(0,g.tZ)(el,{text:t.comment.trim()}):l})]}),(0,g.tZ)("tr",{className:"torrent-details__table__heading",children:(0,g.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,g.tZ)(s.cC,{id:"torrents.details.general.heading.tracker"})})}),(0,g.BX)("tr",{className:"torrent-details__detail torrent-details__detail--tracker-message",children:[(0,g.tZ)("td",{className:"torrent-details__detail__label",children:(0,g.tZ)(s.cC,{id:"torrents.details.general.tracker.message"})}),(0,g.tZ)("td",{className:"torrent-details__detail__value",children:t.message?t.message:l})]})]})})});var i}));var ll=l(1109),il=l(228),nl=l(6882);const rl=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)(),t="torrent-details"===m.Z.activeModal?.id?Ue.default.torrents[m.Z.activeModal.hash]:void 0,[l,i]=(0,d.useState)("stop");if((0,d.useEffect)((()=>{t?.status.includes("stopped")?i("stop"):i("start")}),[t?.status]),null==t)return null;const n=(0,ll.T)({status:t.status,upRate:t.upRate,downRate:t.downRate},"torrent-details__header");return(0,g.BX)("div",{className:n,children:[(0,g.tZ)("h1",{className:"torrent-details__heading torrent-details--name",children:t.name}),(0,g.BX)("div",{className:"torrent-details__sub-heading",children:[(0,g.BX)("ul",{className:"torrent-details__sub-heading__secondary",children:[(0,g.BX)("li",{className:"torrent-details__sub-heading__tertiary torrent-details__sub-heading__tertiary--download",children:[(0,g.tZ)(y.ki,{}),(0,g.tZ)(Ht.Z,{value:t.downRate,isSpeed:!0})," — ",(0,g.tZ)(Ht.Z,{value:t.bytesDone})]}),(0,g.BX)("li",{className:"torrent-details__sub-heading__tertiary torrent-details__sub-heading__tertiary--upload",children:[(0,g.tZ)(y.u3,{}),(0,g.tZ)(Ht.Z,{value:t.upRate,isSpeed:!0})," — ",(0,g.tZ)(Ht.Z,{value:t.upTotal})]}),(0,g.BX)("li",{className:"torrent-details__sub-heading__tertiary",children:[(0,g.tZ)(y.T_,{}),e.number(t.ratio)]}),(0,g.BX)("li",{className:"torrent-details__sub-heading__tertiary",children:[(0,g.tZ)(y.SU,{}),(0,g.tZ)(il.Z,{value:t.eta})]})]}),(0,g.BX)("ul",{className:"torrent-details__sub-heading__secondary",children:[(0,g.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,g.tZ)(jt.Z,{id:t.hash,level:t.priority,maxLevel:3,priorityType:"torrent",onChange:(e,t)=>{_.Z.setPriority({hashes:[`${e}`],priority:t})}})},"priority-meter"),(0,g.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,g.BX)("button",{className:U()("torrent-details__action",{"is-active":"start"===l}),type:"button",onClick:()=>{i("start"),_.Z.startTorrents({hashes:[t.hash]})},children:[(0,g.tZ)(y.zf,{}),(0,g.tZ)(s.cC,{id:"torrents.details.actions.start"})]})},"start"),(0,g.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,g.BX)("button",{className:U()("torrent-details__action",{"is-active":"stop"===l}),type:"button",onClick:()=>{i("stop"),_.Z.stopTorrents({hashes:[t.hash]})},children:[(0,g.tZ)(y.dV,{}),(0,g.tZ)(s.cC,{id:"torrents.details.actions.stop"})]})},"stop")]})]}),(0,g.tZ)(nl.Z,{percent:(0,_e.Fl)((()=>Math.ceil(t.percentComplete))).get(),status:(0,_e.Fl)((()=>(0,ll.o)(t.status))).get()})]})}));var al=l(3337),sl=l(8447);var dl={name:"17lw7on",styles:"td{max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}"};const cl=()=>{const[e,t]=(0,d.useState)([]),[l,i]=(0,d.useState)(null),n=()=>{i(null),"torrent-details"===m.Z.activeModal?.id&&_.Z.fetchTorrentPeers(m.Z.activeModal?.hash).then((e=>{null!=e&&t(e)})),i(ee.default.pollInterval)};return(0,d.useEffect)((()=>n()),[]),(0,al.Z)((()=>n()),l),(0,g.tZ)("div",{className:"torrent-details__section torrent-details__section--peers",children:(0,g.BX)("table",{className:"torrent-details__table table",css:dl,children:[(0,g.tZ)("thead",{className:"torrent-details__table__heading",children:(0,g.BX)("tr",{children:[(0,g.BX)("th",{className:"torrent-details__table__heading--primary",children:[(0,g.tZ)(s.cC,{id:"torrents.details.peers"}),(0,g.tZ)(sl.Z,{children:e.length})]}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"DL"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"UL"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"%"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"Client"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"Enc"}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"In"})]})}),(0,g.tZ)("tbody",{children:e.map((e=>{const{country:t}=e,l=e.isEncrypted?(0,g.tZ)(y.HE,{}):null,i=e.isIncoming?(0,g.tZ)(y.FV,{}):null;return(0,g.BX)("tr",{children:[(0,g.BX)("td",{children:[(0,g.BX)("span",{className:"peers-list__flag",children:[(0,g.tZ)(d.Suspense,{fallback:(0,g.tZ)(y.$j,{}),children:(0,g.tZ)(y.AW,{countryCode:t})}),(0,g.tZ)("span",{className:"peers-list__flag__text",children:t})]}),e.address]}),(0,g.tZ)("td",{children:(0,g.tZ)(Ht.Z,{value:e.downloadRate,isSpeed:!0})}),(0,g.tZ)("td",{children:(0,g.tZ)(Ht.Z,{value:e.uploadRate,isSpeed:!0})}),(0,g.tZ)("td",{children:`${Math.ceil(e.completedPercent)}%`}),(0,g.tZ)("td",{children:e.clientVersion}),(0,g.tZ)("td",{className:"peers-list__encryption",children:l}),(0,g.tZ)("td",{className:"peers-list__incoming",children:i})]},e.address)}))})]})})},ol=()=>{const[e,t]=(0,d.useState)([]),l=e.length,i=["http","udp","dht"],n=e.map((e=>(0,g.BX)("tr",{children:[(0,g.tZ)("td",{children:e.url}),(0,g.tZ)("td",{children:i[e.type-1]})]},e.url)));return(0,d.useEffect)((()=>{"torrent-details"===m.Z.activeModal?.id&&_.Z.fetchTorrentTrackers(m.Z.activeModal?.hash).then((e=>{null!=e&&t(e)}))}),[]),(0,g.tZ)("div",{className:"torrent-details__trackers torrent-details__section",children:(0,g.BX)("table",{className:"torrent-details__table table",children:[(0,g.tZ)("thead",{className:"torrent-details__table__heading",children:(0,g.BX)("tr",{children:[(0,g.BX)("th",{className:"torrent-details__table__heading--primary",children:[(0,g.tZ)(s.cC,{id:"torrents.details.trackers"}),(0,g.tZ)(sl.Z,{children:l})]}),(0,g.tZ)("th",{className:"torrent-details__table__heading--secondary",children:(0,g.tZ)(s.cC,{id:"torrents.details.trackers.type"})})]})}),(0,g.tZ)("tbody",{children:n})]})})},ul=(0,r.Pi)((()=>{const{i18n:e}=(0,s.mV)(),{isSmallScreen:t}=ee.default,l={"torrent-details":{content:tl,label:e._("torrents.details.details")},"torrent-contents":{content:Jt,label:e._("torrents.details.files"),modalContentClasses:"modal__content--nested-scroll"},"torrent-peers":{content:cl,label:e._("torrents.details.peers")},"torrent-trackers":{content:ol,label:e._("torrents.details.trackers")},"torrent-mediainfo":{content:Ot,label:e._("torrents.details.mediainfo"),modalContentClasses:"modal__content--nested-scroll"}};return(0,g.tZ)(de,{heading:(0,g.tZ)(rl,{},"torrent-heading"),size:"large",tabs:l,orientation:t?"horizontal":"vertical",tabsInBody:!t})})),hl=e=>{switch(e){case"add-torrents":return(0,g.tZ)(ce,{});case"confirm":return(0,g.tZ)(oe,{});case"feeds":return(0,g.tZ)(ze,{});case"generate-magnet":return(0,g.tZ)(He,{});case"move-torrents":return(0,g.tZ)(Ge,{});case"remove-torrents":return(0,g.tZ)(Qe,{});case"set-taxonomy":return(0,g.tZ)(We,{});case"set-trackers":return(0,g.tZ)(Ye,{});case"settings":return(0,g.tZ)(Ft,{});case"torrent-details":return(0,g.tZ)(ul,{});default:return null}},_l=(0,r.Pi)((()=>{const{id:e}=m.Z.activeModal||{};let t;return(0,a.Z)("Escape",(()=>m.Z.setActiveModal(null))),null!=e&&(t=(0,g.tZ)(i.Z,{classNames:"modal__animation",timeout:{enter:500,exit:500},children:(0,g.BX)("div",{className:"modal",children:[(0,g.tZ)("div",{className:"modal__overlay",role:"none",onClick:()=>{m.Z.setActiveModal(null)}}),hl(e)]})},e)),(0,g.tZ)(n.Z,{children:t})}))}}]);
|