@jesec/flood 0.0.0-master.652f7d6 → 0.0.0-master.657a94d
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/dist/assets/index.html +1 -1
- package/dist/assets/static/js/{128.2ebf0be4.chunk.js → 128.aa761b6e.chunk.js} +0 -0
- package/dist/assets/static/js/{151.7783141b.chunk.js → 151.5e7f3370.chunk.js} +1 -1
- package/dist/assets/static/js/{26.c7a8c3c9.chunk.js → 26.4661ea85.chunk.js} +0 -0
- package/dist/assets/static/js/{300.5f2dfeea.chunk.js → 300.a89d9e37.chunk.js} +0 -0
- package/dist/assets/static/js/{about.02356772.chunk.js → about.230425ec.chunk.js} +0 -0
- package/dist/assets/static/js/main.6b2e3be1.js +1 -0
- package/dist/index.js +1 -1
- package/node_modules/geoip-country/data/geoip-country.dat +0 -0
- package/node_modules/geoip-country/data/geoip-country6.dat +0 -0
- package/node_modules/geoip-country/package.json +1 -1
- package/package.json +12 -12
- package/dist/assets/static/js/main.2c0d6c3a.js +0 -1
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.6b2e3be1.js"></script><link href="static/css/main.fd54d83a7797b2e58761.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="app"></div></body></html>
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_jesec_flood=globalThis.webpackChunk_jesec_flood||[]).push([[151],{1434:(e,t,n)=>{n.r(t),n.d(t,{default:()=>qn});var r=n(8983),i=n(4537),l=n(1647),a=n(7264),s=n(3799),o=n(7294),d=n(8441),c=n(1540),u=n(879);const h=e=>{let{start:t,destination:n,tags:r,tab:i}=e;const l={};null!=t&&(l.startTorrentsOnLoad=t),null!=n&&""!==n&&(null==l.torrentDestinations&&(l.torrentDestinations=u.Z.floodSettings.torrentDestinations||{}),"string"==typeof(null==r?void 0:r[0])?l.torrentDestinations[r[0]]=n:l.torrentDestinations[""]=n),null!=i&&(l.UITorrentsAddTab=i),c.Z.saveSettings(l)};var m=n(9335),_=n(3529),p=n(5436);const f=e=>{const{actions:t}=e,n=t.map(((e,t)=>{let n=()=>{};return e.triggerDismiss&&(n=()=>{_.Z.setActiveModal(null)}),"checkbox"===e.type?(0,p.tZ)(d.XZ,{defaultChecked:e.checked,id:e.id,onClick:t=>{null!=e.clickHandler&&e.clickHandler(t),n()},children:e.content},t):(0,p.tZ)(d.zx,{isLoading:e.isLoading,onClick:t=>{null!=e.clickHandler&&e.clickHandler(t),n()},priority:e.type,type:e.submit?"submit":"button",children:e.content},t)})),r=(0,p.tZ)("div",{className:"modal__button-group",children:n});return(0,p.tZ)("div",{className:"modal__actions",children:r})},g=e=>{let{isAddingTorrents:t,onAddTorrentsClick:n}=e;const{i18n:r}=(0,s.mV)();return(0,p.tZ)(f,{actions:[{checked:Boolean(u.Z.floodSettings.startTorrentsOnLoad),clickHandler:null,content:r._("torrents.add.start.label"),id:"start",triggerDismiss:!1,type:"checkbox"},{clickHandler:null,content:r._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:n,content:r._("torrents.add.button.add"),isLoading:t,submit:!0,triggerDismiss:!1,type:"primary"}]})};var b=n(3279),Z=n.n(b),v=n(4656),y=n(4916),C=n(917),w=n(4166),k=n(6281),O=n(4557),N=n(5051),S=n(932);const P="#5E728C",x={name:"1pkdvdx",styles:"padding:3px 9px"},j=(0,C.iv)({borderBottom:`1px solid ${(0,w.$n)(.43,P)}`,marginBottom:"3px",paddingBottom:"3px",opacity:.75,"&:last-child":{marginBottom:0}},"",""),B=(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"}}]},"",""),D=(0,C.iv)({color:(0,w.p_)(.1,(0,w._j)(.15,P)),background:(0,w.m4)(P,.1),button:{":focus":{outline:"none",WebkitTapHighlightColor:"transparent"}}},"",""),X=(0,C.iv)({opacity:1,cursor:"pointer",transition:"background 0.25s, color 0.25s",userSelect:"none","&:hover":D,"&:focus-within":D},"",""),T={EACCES:"filesystem.error.eacces",ENOENT:"filesystem.error.enoent"};var E={name:"kol7nt",styles:"transform:scale(0.75) rotate(180deg)"},M={name:"1089mxj",styles:"white-space:pre-wrap"},V={name:"1ityoz",styles:"font-weight:lighter"};const I=(0,o.memo)((e=>{let{directory:t,selectable:n,onItemSelection:r,onYieldFocus:i}=e;const[l,a]=(0,o.useState)(null),[d,c]=(0,o.useState)(null),[u,h]=(0,o.useState)(t.includes("/")?"/":"\\"),[m,_]=(0,o.useState)(null),[f,g]=(0,o.useState)(null),b=(0,o.useRef)(null),Z=t.lastIndexOf(u)+1,v=Z>0?t.substr(0,Z):t,w=t.substr(Z);(0,o.useEffect)((()=>{v&&(a(null),_(null),g(null),N.Z.fetchDirectoryList(v).then((e=>{let{files:t,directories:n,separator:r}=e;_(n),g(t),h(r),c(null)})).catch((e=>{let{response:t}=e;c(t)})))}),[v]),(0,o.useEffect)((()=>{if(null!=b.current&&null!=l){var e;const t=null===(e=b.current.children[l])||void 0===e?void 0:e.children[0];0===(null==t?void 0:t.tabIndex)?t.focus():a(Array.from(b.current.children).findIndex((e=>0===e.children[0].tabIndex)))}}),[l]),(0,O.Z)("ArrowUp",(e=>{e.preventDefault(),a((e=>null==e||e-1<0?(null==i||i(),null):e-1))})),(0,O.Z)("ArrowDown",(e=>{e.preventDefault(),a((e=>null!=e?e+1:0))}));let D=null,I=[];if((null==m&&"directories"===n||null==f&&"files"===n)&&(D="filesystem.fetching"),d&&d.data&&d.data.code&&(D=T[d.data.code]||"filesystem.error.unknown"),t){const e=`${v.split(u).slice(0,-2).join(u)}${u}`,t=(0,p.tZ)("li",{css:[B,X,{"@media (max-width: 720px)":j},"",""],children:(0,p.BX)("button",{type:"button",onClick:()=>null==r?void 0:r(e,!0),children:[(0,p.tZ)(y.Eh,{css:E}),".."]})},e),i="files"!==n,l=w?(0,S.Z)(m,(e=>e),w):[],a=l.includes(w)||"directories"!==n||!w||D?[]:(()=>{const e=`${v}${w}${u}`;return[(0,p.tZ)("li",{css:[B,X,"font-weight:bold;@media (max-width: 720px){display:none;}",""],children:(0,p.BX)("button",{type:"button",onClick:()=>null==r?void 0:r(e,!1),children:[(0,p.tZ)(y.Pl,{}),(0,p.tZ)("span",{css:M,children:w}),(0,p.BX)("em",{css:V,children:[" - ",(0,p.tZ)(s.cC,{id:"filesystem.error.enoent"})]})]})},e)]})(),o=(null==m?void 0:m.length)&&(0,k.DY)(m.slice()).desc((e=>l.includes(e))).map((e=>{const t=`${v}${e}${u}`;return(0,p.tZ)("li",{css:[B,i?X:void 0,l.includes(e)?{fontWeight:"bold"}:void 0,"",""],children:(0,p.BX)("button",{type:"button",disabled:!i,tabIndex:i?0:-1,onClick:i?()=>null==r?void 0:r(t,!0):void 0,children:[(0,p.tZ)(y.Bm,{}),e]})},t)}))||[],d="directories"!==n,c=w?(0,S.Z)(f,(e=>e),w):[],h=(null==f?void 0:f.length)&&(0,k.DY)(f.slice()).desc((e=>c.includes(e))).map((e=>{const t=`${v}${e}`;return(0,p.tZ)("li",{css:[B,d?X:void 0,c.includes(e)?{fontWeight:"bold"}:void 0,"",""],children:(0,p.BX)("button",{type:"button",disabled:!d,tabIndex:d?0:-1,onClick:d?()=>null==r?void 0:r(t,!1):void 0,children:[(0,p.tZ)(y.$B,{}),e]})},t)}))||[];0!==o.length||0!==h.length||D||(D="filesystem.empty.directory"),I=[t,...a,...o,...h]}else D="filesystem.error.no.input";return(0,p.BX)("div",{css:(0,C.iv)({color:P,listStyle:"none",padding:"3px 0px",".icon":{fill:"currentColor",height:"14px",width:"14px",marginRight:"5px",marginTop:"-3px",verticalAlign:"middle"}},"",""),children:[v&&(0,p.BX)("li",{css:[B,j,x,"white-space:pre-wrap;.icon{transform:scale(0.9);margin-top:-2px !important;}@media (max-width: 720px){display:none;}",""],children:[(0,p.tZ)(y.DB,{}),v]}),(0,p.tZ)("ul",{ref:b,children:I}),D&&(0,p.tZ)("div",{css:[B,x,"opacity:1;",""],children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:D})})})]})}));I.defaultProps={selectable:void 0,onItemSelection:void 0,onYieldFocus:void 0};const R=I,L=(0,o.forwardRef)(((e,t)=>{var n,r;let{id:i,label:l,selectable:a,suggested:c,showBasePathToggle:h,showCompletedToggle:m,showSequentialToggle:_,onChange:f}=e;const[g,b]=(0,o.useState)(c||(null===(n=u.Z.floodSettings.torrentDestinations)||void 0===n?void 0:n[""])||(null===(r=u.Z.clientSettings)||void 0===r?void 0:r.directoryDefault)||""),[C,w]=(0,o.useState)(!1),k=(0,o.useRef)(null),O=(0,v.Z)(t),{i18n:N}=(0,s.mV)();(0,o.useEffect)((()=>{const e=()=>{w(!1)},t=t=>{var n;null!==(n=k.current)&&void 0!==n&&n.contains(t.target)||e()};return document.addEventListener("click",t),window.addEventListener("resize",e),()=>{document.removeEventListener("click",t),window.removeEventListener("resize",e)}}),[]);const S=[];return h&&S.push((0,p.tZ)(d.XZ,{grow:!1,id:"isBasePath",children:(0,p.tZ)(s.cC,{id:"torrents.destination.base_path"})},"isBasePath")),m&&S.push((0,p.tZ)(d.XZ,{grow:!1,id:"isCompleted",children:(0,p.tZ)(s.cC,{id:"torrents.destination.completed"})},"isCompleted")),_&&S.push((0,p.tZ)(d.XZ,{grow:!1,id:"isSequential",children:(0,p.tZ)(s.cC,{id:"torrents.destination.sequential"})},"isSequential")),(0,p.BX)(d.y1,{ref:k,children:[(0,p.tZ)(d.p7,{children:(0,p.BX)(d.fE,{autoComplete:C?"off":void 0,addonPlacement:"after",defaultValue:g,id:i,label:l,onChange:Z()((()=>{if(null==O.current)return;const e=O.current.value;f&&f(e),b(e)}),100,{leading:!0}),onClick:e=>e.nativeEvent.stopImmediatePropagation(),placeholder:N._("torrents.add.destination.placeholder"),ref:O,children:[(0,p.tZ)(d.G5,{onClick:()=>{null!=O.current&&b(O.current.value),w(!C)},children:(0,p.tZ)(y.ol,{})}),(0,p.tZ)(d.h_,{children:(0,p.tZ)(d.xV,{isIn:C,onClick:e=>e.nativeEvent.stopImmediatePropagation(),overlayProps:{isInteractive:!1},padding:!1,triggerRef:O,children:(0,p.tZ)(R,{directory:g,selectable:a,onItemSelection:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null!=O.current&&(O.current.value=e),w(t),b(e)},onYieldFocus:()=>{var e;null===(e=O.current)||void 0===e||e.focus()}})})})]})}),S.length>0?(0,p.tZ)(d.p7,{children:S}):null]})}));L.defaultProps={label:void 0,selectable:void 0,suggested:void 0,showBasePathToggle:!1,showCompletedToggle:!1,showSequentialToggle:!1,onChange:void 0};const F=L;var $=n(4184),U=n.n($),z=n(8232);const A=e=>{let{defaultValue:t,placeholder:n,id:r,label:i,onTagSelected:l}=e;const[c,h]=(0,o.useState)(!1),[m,_]=(0,o.useState)(t??[]),f=(0,o.useRef)(null),g=(0,o.useRef)(null),b=(0,o.useRef)(null),Z=U()("select form__element",{"select--is-open":c});return(0,a.Z)("Escape",(e=>{e.preventDefault(),h(!1)})),(0,o.useEffect)((()=>{const e=e=>{var t;null!==(t=f.current)&&void 0!==t&&t.contains(e.target)||h(!1)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}),[]),(0,o.useEffect)((()=>{null!=b.current&&(b.current.value=m.join()),l&&l(m)}),[m,l]),(0,p.tZ)(d.U2,{ref:f,children:(0,p.tZ)("div",{className:Z,children:(0,p.BX)(d.fE,{autoComplete:c?"off":void 0,id:r||"tags",addonPlacement:"after",defaultValue:t,label:i,onChange:()=>{if(null!=b.current){let e=b.current.value.split(",").map((e=>e.trim())).filter((e=>e.length>0));b.current.value.trimEnd().endsWith(",")&&(e.push(""),e=[...new Set(e)]),_(e)}},placeholder:n,ref:b,children:[(0,p.tZ)(d.G5,{onClick:()=>{h(!c)},className:"select__indicator",children:(0,p.tZ)(y.Tt,{})}),(0,p.tZ)(d.h_,{children:(0,p.tZ)(d.xV,{isIn:c,onClick:e=>{"single"!==u.Z.floodSettings.UITagSelectorMode&&e.nativeEvent.stopImmediatePropagation()},overlayProps:{isInteractive:!1},ref:g,triggerRef:b,children:[...new Set(["untagged",...(0,k.DY)(Object.keys(z.Z.taxonomy.tagCounts)).asc(),...m])].reduce(((e,t)=>(""===t||e.push((0,p.tZ)(d.Ql,{id:t,isSelected:m.includes(t),onClick:()=>{"untagged"===t?_([]):m.includes(t)?_(m.filter((e=>e!==t&&""!==e))):_([...m.filter((e=>""!==e)),t])},children:"untagged"===t?(0,p.tZ)(s.cC,{id:"filter.untagged"}):t},t)),e)),[])})})]})})})};A.defaultProps={id:"tags",label:void 0,defaultValue:void 0,placeholder:void 0,onTagSelected:void 0};const H=A,q=(e,t)=>Object.keys(e).reduce(((n,r)=>{if(r.startsWith(t)){const t=e[r];null!=t&&n.push(t)}return n}),[]),G=e=>{let{defaultValues:t,id:n,label:r,placeholder:i}=e;const l=(0,o.useRef)(0),[a,s]=(0,o.useState)(t??[{id:0,value:""}]);return(0,p.tZ)(d.y1,{children:a.map(((e,t)=>{let o=null;return t>0&&(o=(0,p.tZ)(d.G5,{onClick:()=>{const e=a.slice();e.splice(t,1),s(e)},children:(0,p.tZ)(y.eJ,{})})),(0,p.tZ)(d.p7,{children:(0,p.BX)(d.fE,{addonPlacement:"after",id:`${n}-${e.id}`,defaultValue:e.value,label:0===t&&r,placeholder:i,wrapperClassName:"textbox-repeater",children:[(0,p.tZ)(d.G5,{onClick:()=>{l.current+=1;const e=a.slice();e.splice(t+1,0,{id:l.current,value:""}),s(e)},children:(0,p.tZ)(y.Rb,{})}),o]})},e.id)}))})};G.defaultProps={defaultValues:void 0,label:void 0,placeholder:void 0};const Q=G,W=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(!1);return(0,p.BX)(d.l0,{className:"inverse",ref:e,children:[(0,p.tZ)(F,{id:"sourcePath",label:t._("torrents.create.source.path.label")}),(0,p.tZ)(Q,{id:"trackers",label:t._("torrents.create.trackers.label"),placeholder:t._("torrents.create.tracker.input.placeholder"),defaultValues:[{id:0,value:""}]}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"name",label:t._("torrents.create.base.name.label"),placeholder:t._("torrents.create.base.name.input.placeholder")})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"comment",label:t._("torrents.create.comment.label"),placeholder:t._("torrents.create.comment.input.placeholder")})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"infoSource",label:t._("torrents.create.info.source.label"),placeholder:t._("torrents.create.info.source.input.placeholder")})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.XZ,{grow:!1,id:"isPrivate",children:t._("torrents.create.is.private.label")})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(H,{id:"tags",label:t._("torrents.add.tags"),placeholder:t._("torrents.create.tags.input.placeholder")})}),(0,p.tZ)(g,{onAddTorrentsClick:()=>{if(null==e.current)return;const t=e.current.getFormData();r(!0),null!=t.sourcePath&&(m.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((()=>{_.Z.setActiveModal(null)})),h({start:t.start,destination:t.sourcePath,tab:"by-creation"}))},isAddingTorrents:n})]})};var Y=n(463);function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){ee(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const te=e=>{let{onFilesChanged:t}=e;const[n,r]=(0,o.useState)([]);return(0,o.useEffect)((()=>{t(n)}),[n,t]),(0,p.BX)(d.U2,{children:[(0,p.tZ)("span",{className:"form__element__label",children:(0,p.tZ)(s.cC,{id:"torrents.add.torrents.label"})}),n.length>0?(0,p.tZ)("div",{onClick:e=>{e.stopPropagation()},role:"none",children:(0,p.tZ)("ul",{className:"dropzone__selected-files interactive-list",children:n.map(((e,t)=>(0,p.BX)("li",{className:"dropzone__selected-files__file interactive-list__item",title:e.name,children:[(0,p.tZ)("span",{className:"interactive-list__icon",children:(0,p.tZ)(y.$B,{})}),(0,p.tZ)("span",{className:"interactive-list__label",children:e.name}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>{const e=n.slice();e.splice(t,1),r(e)},children:(0,p.tZ)(y.x8,{})})]},e.name)))})}):null,(0,p.tZ)(Y.ZP,{onDrop:e=>{const t=[];e.forEach((i=>{const l=new FileReader;l.onload=l=>{var a;null!=(null===(a=l.target)||void 0===a?void 0:a.result)&&"string"==typeof l.target.result&&t.push({name:i.name,data:l.target.result.split("base64,")[1]}),t.length===e.length&&r(n.concat(t))},l.readAsDataURL(i)}))},children:e=>{let{getRootProps:t,getInputProps:n,isDragActive:r}=e;return(0,p.BX)("div",K(K({},t()),{},{className:"form__dropzone dropzone interactive-list "+(r?"dropzone--is-dragging":""),children:[(0,p.tZ)("input",K({},n())),(0,p.BX)("div",{className:"dropzone__copy",children:[(0,p.tZ)("div",{className:"dropzone__icon",children:(0,p.tZ)(y.hv,{})}),(0,p.tZ)(s.cC,{id:"torrents.add.tab.file.drop"})," ",(0,p.tZ)("span",{className:"dropzone__browse-button",children:(0,p.tZ)(s.cC,{id:"torrents.add.tab.file.browse"})}),"."]})]}))}})]})},ne=()=>{const e=(0,o.useRef)([]),t=(0,o.useRef)(null),n=(0,o.useRef)(null),[r,i]=(0,o.useState)(!1),{i18n:l}=(0,s.mV)();return(0,p.BX)(d.l0,{className:"inverse",ref:t,children:[(0,p.tZ)(d.p7,{children:(0,p.tZ)(te,{onFilesChanged:t=>{e.current=t}})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(H,{label:l._("torrents.add.tags"),id:"tags",onTagSelected:e=>{if(null!=n.current){var t;const r=null===(t=u.Z.floodSettings.torrentDestinations)||void 0===t?void 0:t[e[0]];"string"==typeof r&&null!=n.current&&(n.current.value=r,n.current.dispatchEvent(new Event("input",{bubbles:!0})))}}})}),(0,p.tZ)(F,{id:"destination",label:l._("torrents.add.destination.label"),ref:n,selectable:"directories",showBasePathToggle:!0,showCompletedToggle:!0,showSequentialToggle:!0}),(0,p.tZ)(g,{onAddTorrentsClick:()=>{var n;if(null==t.current)return;const r=null===(n=t.current)||void 0===n?void 0:n.getFormData();i(!0);const{destination:l,start:a,tags:s,isBasePath:o,isCompleted:d,isSequential:c}=r,u=[];if(e.current.forEach((e=>{u.push(e.data)})),0===u.length||null==l)return void i(!1);const p=null!=s?s.split(",").filter((e=>e.length>0)):void 0;m.Z.addTorrentsByFiles({files:u,destination:l,tags:p,isBasePath:o,isCompleted:d,isSequential:c,start:a}).then((()=>{_.Z.setActiveModal(null)})),h({start:a,destination:l,tags:p,tab:"by-file"})},isAddingTorrents:r})]})};var re=n(4355);var ie={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 ae=()=>{var e,t;const n=(0,o.useRef)(null),r=(0,o.useRef)(null),[i,l]=(0,o.useState)(!1),{i18n:a}=(0,s.mV)();return(0,p.BX)(d.l0,{className:"inverse",ref:n,children:[(0,p.tZ)(Q,{id:"urls",label:(0,p.BX)("div",{children:[a._("torrents.add.torrents.label"),"function"==typeof navigator.registerProtocolHandler&&(0,p.tZ)("button",{css:ie,type:"button",onClick:()=>{"function"==typeof navigator.registerProtocolHandler&&navigator.registerProtocolHandler("magnet",`${re.Z.baseURI}?action=add-urls&url=%s`)},children:(0,p.tZ)("em",{css:le,children:a._("torrents.add.tab.url.register.magnet.handler")})})]}),placeholder:a._("torrents.add.tab.url.input.placeholder"),defaultValues:"add-torrents"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)&&(null===(t=_.Z.activeModal)||void 0===t?void 0:t.initialURLs)||[{id:0,value:""}]}),(0,p.tZ)(Q,{id:"cookies",label:a._("torrents.add.cookies.label"),placeholder:a._("torrents.add.cookies.input.placeholder")}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(H,{id:"tags",label:a._("torrents.add.tags"),onTagSelected:e=>{if(null!=r.current){var t;const n=null===(t=u.Z.floodSettings.torrentDestinations)||void 0===t?void 0:t[e[0]];"string"==typeof n&&null!=r.current&&(r.current.value=n,r.current.dispatchEvent(new Event("input",{bubbles:!0})))}}})}),(0,p.tZ)(F,{id:"destination",label:a._("torrents.add.destination.label"),ref:r,selectable:"directories",showBasePathToggle:!0,showCompletedToggle:!0,showSequentialToggle:!0}),(0,p.tZ)(g,{onAddTorrentsClick:()=>{if(null==n.current)return;const e=n.current.getFormData();l(!0);const t=q(e,"urls").filter((e=>""!==e));if(0===t.length||null==e.destination)return void l(!1);const r=q(e,"cookies"),i=t[0].startsWith("http")&&t[0].split("/")[2],a=i?{[i]:r}:void 0,s=null!=e.tags?e.tags.split(",").filter((e=>e.length>0)):void 0;m.Z.addTorrentsByUrls({urls:t,cookies:a,destination:e.destination,isBasePath:e.isBasePath,isCompleted:e.isCompleted,isSequential:e.isSequential,start:e.start,tags:s}).then((()=>{_.Z.setActiveModal(null)})),h({start:e.start,destination:e.destination,tags:s,tab:"by-url"})},isAddingTorrents:i})]})};var se={name:"1gxvag8",styles:":focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"};const oe=e=>{const{activeTabId:t,tabs:n={},onTabChange:r}=e;return(0,p.tZ)("ul",{className:"modal__tabs",children:Object.keys(n).map((e=>{const i=n[e];i.id=e;const l=U()("modal__tab",{"is-active":e===t});return(0,p.tZ)("li",{className:l,children:(0,p.tZ)("button",{css:se,type:"button",onClick:()=>{r&&r(i)},children:i.label})},e)}))})};oe.defaultProps={tabs:{}};const de=oe;function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach((function(t){he(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function he(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const me=e=>{const{alignment:t,size:n,orientation:r,tabsInBody:i,inverse:l,initialTabId:a,className:s,content:d,heading:c,tabs:u,actions:h}=e,m=U()("modal__content__wrapper",`modal--align-${t}`,`modal--size-${n}`,{"modal--horizontal":"horizontal"===r,"modal--vertical":"vertical"===r,"modal--tabs-in-header":!i,"modal--tabs-in-body":i,inverse:l},s);let _=d;const g=c,b=U()("modal__header",{"has-tabs":u});let Z,v,y;const[C,w]=(0,o.useState)(a??Object.keys(u||{})[0]);if(u){const e=u[C],t=U()("modal__content",e.modalContentClasses),n=e.content,r=e.props,l=(0,p.tZ)(de,{activeTabId:C,onTabChange:e=>{null!=e.id&&w(e.id)},tabs:u},"modal-tabs");i?Z=l:y=l,_=[Z,(0,p.tZ)("div",{className:t,children:(0,p.tZ)(n,ue({},r))},"modal-content")]}return h&&(v=(0,p.tZ)("div",{className:"modal__footer",children:(0,p.tZ)(f,{actions:h})})),(0,p.BX)("div",{className:m,children:[(0,p.BX)("div",{className:b,children:[g,y]}),(0,p.BX)("div",{className:"modal__body",children:[_,v]})]})};me.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 _e=me,pe=()=>{var e,t;const{i18n:n}=(0,s.mV)(),r={"by-url":{content:ae,label:n._("torrents.add.tab.url.title")},"by-file":{content:ne,label:n._("torrents.add.tab.file.title")},"by-creation":{content:W,label:n._("torrents.add.tab.create.title")}};if("add-torrents"!==(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))return null;let i="by-url";return null!==(t=_.Z.activeModal.initialURLs)&&void 0!==t&&t.length||(i=u.Z.floodSettings.UITorrentsAddTab??i),(0,p.tZ)(_e,{heading:n._("torrents.add.heading"),tabs:r,initialTabId:i})},fe=(0,l.Pi)((()=>{var e;if("confirm"!==(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))return null;const{actions:t,content:n,heading:r}=_.Z.activeModal||{};return(0,p.tZ)(_e,{actions:t,content:(0,p.tZ)("div",{className:"modal__content",children:n}),heading:r})}));var ge=n(9669),be=n.n(ge),Ze=n(8949);function ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ye=new class{constructor(){ve(this,"feeds",[]),ve(this,"rules",[]),ve(this,"items",[]),(0,Ze.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:Ce}=re.Z,we={addFeed:e=>be().put(`${Ce}api/feed-monitor/feeds`,e).then((()=>we.fetchFeedMonitors())),modifyFeed:(e,t)=>be().patch(`${Ce}api/feed-monitor/feeds/${e}`,t).then((()=>we.fetchFeedMonitors())),addRule:e=>be().put(`${Ce}api/feed-monitor/rules`,e).then((()=>we.fetchFeedMonitors())),fetchFeedMonitors:()=>be().get(`${Ce}api/feed-monitor`).then((e=>{let{data:t}=e;ye.handleFeedMonitorsFetchSuccess(t)}),(()=>{})),fetchItems:e=>{let{id:t,search:n}=e;return be().get(`${Ce}api/feed-monitor/feeds/${t}/items`,{params:{search:n}}).then((e=>{let{data:t}=e;ye.handleItemsFetchSuccess(t)}),(()=>{}))},removeFeedMonitor:e=>be().delete(`${Ce}api/feed-monitor/${e}`).then((()=>we.fetchFeedMonitors()),(()=>{}))},ke=we,Oe=/^(?:https?|ftp):\/\/.{1,}\.{1}.{1,}/,Ne=e=>null!=e&&""!==e,Se=e=>{try{new RegExp(e)}catch(e){return!1}return!0},Pe=e=>{var t;let{rule:n,isSubmitting:r,isPatternMatched:i,onCancel:l}=e;const{feeds:a}=ye,{i18n:o}=(0,s.mV)();return(0,p.BX)(d.y1,{children:[(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"label",label:o._("feeds.label"),defaultValue:n.label}),(0,p.tZ)(d.Ph,{disabled:!a.length,id:"feedID",label:o._("feeds.applicable.feed"),defaultID:null===(t=n.feedIDs)||void 0===t?void 0:t[0],children:0===a.length?[(0,p.tZ)(d.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:"feeds.no.feeds.available"})})},"empty")]:a.reduce(((e,t)=>e.concat((0,p.tZ)(d.Ql,{id:`${t._id}`,children:t.label},t._id))),[(0,p.tZ)(d.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:"feeds.select.feed"})})},"select-feed")])})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"match",label:o._("feeds.match.pattern"),placeholder:o._("feeds.regEx"),defaultValue:n.match,width:"three-eighths"}),(0,p.tZ)(d.fE,{id:"exclude",label:o._("feeds.exclude.pattern"),placeholder:o._("feeds.regEx"),defaultValue:n.exclude,width:"three-eighths"})]}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{addonPlacement:"after",id:"check",label:o._("feeds.test.match"),placeholder:o._("feeds.check"),children:i&&(0,p.tZ)(d.G5,{children:(0,p.tZ)(y.FV,{})})})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.U2,{children:(0,p.tZ)(F,{id:"destination",label:o._("feeds.torrent.destination"),selectable:"directories",suggested:n.destination,showBasePathToggle:!0})}),(0,p.tZ)(H,{id:"tags",label:o._("feeds.apply.tags"),placeholder:o._("feeds.tags"),defaultValue:n.tags})]}),(0,p.BX)(d.p7,{align:"end",justify:"end",children:[(0,p.tZ)("br",{}),(0,p.tZ)(d.XZ,{id:"startOnLoad",defaultChecked:n.startOnLoad,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"feeds.start.on.load"})}),(0,p.tZ)(d.zx,{onClick:l,children:(0,p.tZ)(s.cC,{id:"button.cancel"})}),(0,p.tZ)(d.zx,{type:"submit",isLoading:r,children:(0,p.tZ)(s.cC,{id:"button.save.feed"})})]})]})},xe=e=>{let{children:t}=e;return(0,p.tZ)("h2",{className:"h4",children:t})},je=(0,l.Pi)((e=>{let{currentRule:t,onSelect:n,onRemove:r}=e;const{rules:i}=ye;return 0===i.length?(0,p.tZ)("ul",{className:"interactive-list",children:(0,p.tZ)("li",{className:"interactive-list__item",children:(0,p.tZ)(s.cC,{id:"feeds.no.rules.defined"})})}):(0,p.tZ)("ul",{className:"interactive-list",children:i.map((e=>{const i=e.count||0;let l=null,a=null;if(e.exclude&&(l=(0,p.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:[(0,p.tZ)(s.cC,{id:"feeds.exclude"}),": ",e.exclude]})),e.tags&&e.tags.length>0){const t=e.tags.map((e=>(0,p.tZ)("span",{className:"tag",children:e},e)));a=(0,p.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:[(0,p.tZ)(s.cC,{id:"feeds.tags"}),": ",t]})}return(0,p.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content",children:[(0,p.BX)("div",{className:"interactive-list__label",children:[(0,p.BX)("ul",{className:"interactive-list__detail-list",children:[(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:e.label}),(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--secondary",children:(0,p.tZ)(s.cC,{id:"feeds.match.count",values:{count:i}})}),e===t&&(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:"Modifying"})]}),(0,p.BX)("ul",{className:"interactive-list__detail-list",children:[(0,p.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",style:{maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,p.tZ)(s.cC,{id:"feeds.match"}),": ",e.match]}),(0,p.tZ)("div",{style:{width:"100%"}}),l,a]})]}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action",type:"button",onClick:()=>n(e),children:(0,p.tZ)(y.I8,{})}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>r(e),children:(0,p.tZ)(y.x8,{})})]},e._id)}))})})),Be=je;function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){Te(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Te(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ee={label:"",feedIDs:[],match:"",exclude:"",tags:[],destination:"",startOnLoad:!1},Me={destination:{isValid:Ne,error:"feeds.validation.must.specify.destination"},feedID:{isValid:e=>Ne(e)&&"placeholder"!==e,error:"feeds.validation.must.select.feed"},label:{isValid:Ne,error:"feeds.validation.must.specify.label"},match:{isValid:e=>Ne(e)&&Se(e),error:"feeds.validation.invalid.regular.expression"},exclude:{isValid:e=>!Ne(e)||Se(e),error:"feeds.validation.invalid.regular.expression"}},Ve=(e,t)=>{var n,r;return null!==(n=Me[e])&&void 0!==n&&n.isValid(t)||null===(r=Me[e])||void 0===r?void 0:r.error},Ie=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(null),[i,l]=(0,o.useState)({}),[a,c]=(0,o.useState)(!1),[u,h]=(0,o.useState)(!1),[m,_]=(0,o.useState)(!1),[f,g]=(0,o.useState)(!1);return(0,p.BX)(d.l0,{className:"inverse",onChange:e=>{let{event:t,formData:n}=e;const r=t.target.name,a=n;l(Xe(Xe({},i),{},{[r]:Ve(r,a[r])})),g((()=>{const{check:e,match:t="",exclude:n=""}=a;if(Ne(e)&&Se(t)&&Se(n)){const r=new RegExp(t,"gi").test(e),i=""!==n&&new RegExp(n,"gi").test(e);return r&&!i}return!1})()),_(!0)},onSubmit:async()=>{if(null==e.current)return;const t=e.current.getFormData(),i=Object.keys(Me).reduce(((e,n)=>{const r=n;return Xe(Xe({},e),{},{[r]:Ve(r,t[r])})}),{});l(i);const a=Object.keys(i).every((e=>void 0===i[e]));var s;m&&a&&(h(!0),null!=(null==n?void 0:n._id)&&await ke.removeFeedMonitor(n._id),await ke.addRule({label:t.label??Ee.label,feedIDs:[t.feedID??""],field:t.field,match:t.match??Ee.match,exclude:t.exclude??Ee.exclude,destination:t.destination??Ee.destination,tags:(null===(s=t.tags)||void 0===s?void 0:s.split(","))??Ee.tags,startOnLoad:t.startOnLoad??Ee.startOnLoad,isBasePath:t.isBasePath??!1}).then((()=>{var t;null===(t=e.current)||void 0===t||t.resetForm(),l({}),r(null),c(!1)}),(()=>{l({backend:"general.error.unknown"})})),h(!1))},ref:e,children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"feeds.existing.rules"})}),Object.keys(i).reduce(((e,n)=>(null!=i[n]&&e.push((0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:t._(null==i?void 0:i[n])})},`error-${n}`)),e)),[]),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.U2,{children:(0,p.tZ)(Be,{currentRule:n,onSelect:e=>{r(e),c(!0)},onRemove:e=>{null!=e._id&&ke.removeFeedMonitor(e._id),e===n&&(r(null),c(!1))}})})}),a?(0,p.tZ)(Pe,{rule:n??Ee,isPatternMatched:f,isSubmitting:u,onCancel:()=>{r(null),c(!1)}},(null==n?void 0:n._id)||"initial"):(0,p.BX)(d.p7,{align:"end",justify:"end",children:[(0,p.tZ)("br",{}),(0,p.tZ)(d.zx,{onClick:()=>{c(!0)},children:(0,p.tZ)(s.cC,{id:"button.new"})})]})]})},Re=e=>{let{currentFeed:t,defaultFeed:n,intervalMultipliers:r,isSubmitting:i,onCancel:l}=e;const{i18n:a}=(0,s.mV)(),o=(null==t?void 0:t.interval)??n.interval;let c=o,u=1;return r.forEach((e=>{const t=e.value;o%t==0&&(c=o/t,u=t)})),(0,p.BX)(d.y1,{children:[(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"label",label:a._("feeds.label"),placeholder:a._("feeds.label"),defaultValue:(null==t?void 0:t.label)??n.label}),(0,p.tZ)(d.fE,{id:"interval",label:a._("feeds.select.interval"),placeholder:a._("feeds.interval"),defaultValue:c,width:"one-eighth"}),(0,p.tZ)(d.Ph,{labelOffset:!0,defaultID:u,id:"intervalMultiplier",width:"one-eighth",children:r.map((e=>(0,p.tZ)(d.Ql,{id:e.value,children:a._(e.message)},e.value)))})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"url",label:a._("feeds.url"),placeholder:a._("feeds.url"),defaultValue:(null==t?void 0:t.url)??(null==n?void 0:n.url)}),(0,p.tZ)(d.zx,{labelOffset:!0,onClick:l,children:(0,p.tZ)(s.cC,{id:"button.cancel"})}),(0,p.tZ)(d.zx,{labelOffset:!0,type:"submit",isLoading:i,children:(0,p.tZ)(s.cC,{id:"button.save.feed"})})]})]})},Le=(0,l.Pi)((e=>{let{selectedFeedID:t}=e;const{items:n}=ye,r=[];if(t){const e={};n.forEach(((t,n)=>{let{title:i}=t;const l=e[i];null==l?e[i]=2:(i=`${i} #${l}`,e[i]+=1),r.push((0,p.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content feed-list__feed",children:[(0,p.tZ)("div",{className:"interactive-list__label feed-list__feed-label",children:i}),(0,p.tZ)(d.XZ,{id:`${n}`})]},i))}))}return(0,p.tZ)(d.p7,{children:0===r.length?(0,p.tZ)("ul",{className:"interactive-list",children:(0,p.tZ)("li",{className:"interactive-list__item",children:(0,p.tZ)("div",{className:"interactive-list__label",children:(0,p.tZ)(s.cC,{id:"feeds.no.items.matching"})})})}):(0,p.tZ)("ul",{className:"interactive-list feed-list",children:r})})})),Fe=Le,$e=(0,l.Pi)((()=>{const{i18n:e}=(0,s.mV)(),t=(0,o.useRef)(null),[n,r]=(0,o.useState)(null),{feeds:i}=ye;return null!=n&&(i.some((e=>e._id===n))||r(null)),(0,p.BX)(d.l0,{className:"inverse",onChange:e=>{let{event:t,formData:n}=e;const i=n;"checkbox"!==t.target.type&&(r(i.feedID),ke.fetchItems({id:i.feedID,search:i.search}))},onSubmit:()=>{if(null==t.current)return;const e=t.current.getFormData(),n=ye.items.filter(((t,n)=>e[n])).map(((e,t)=>({id:t,value:e.urls[0]})));_.Z.setActiveModal({id:"add-torrents",initialURLs:n})},ref:t,children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"feeds.browse.feeds"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.Ph,{disabled:!i.length,grow:!1,id:"feedID",label:e._("feeds.select.feed"),width:"three-eighths",children:i.length?i.reduce(((e,t)=>null==t._id?e:e.concat((0,p.tZ)(d.Ql,{id:t._id,children:t.label},t._id))),[(0,p.tZ)(d.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:"feeds.select.feed"})})},"select-feed")]):[(0,p.tZ)(d.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:"feeds.no.feeds.available"})})},"empty")]}),n&&(0,p.tZ)(d.fE,{id:"search",label:e._("feeds.search.term"),placeholder:e._("feeds.search")}),n&&(0,p.tZ)(d.zx,{type:"submit",labelOffset:!0,children:(0,p.tZ)(s.cC,{id:"button.download"})},"button")]}),n&&(0,p.tZ)(Fe,{selectedFeedID:n})]})})),Ue=$e,ze=(0,l.Pi)((e=>{let{currentFeed:t,intervalMultipliers:n,onSelect:r,onRemove:i}=e;const{feeds:l}=ye,{i18n:a}=(0,s.mV)();return 0===l.length?(0,p.tZ)("ul",{className:"interactive-list",children:(0,p.tZ)("li",{className:"interactive-list__item",children:(0,p.tZ)(s.cC,{id:"feeds.no.feeds.defined"})})}):(0,p.tZ)("ul",{className:"interactive-list feed-list",children:l.map((e=>{const l=e.count||0;let o=`${e.interval}`,d=n[0].message;return n.forEach((t=>{e.interval%t.value==0&&(o=""+e.interval/t.value,d=t.message)})),(0,p.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content feed-list__feed",children:[(0,p.BX)("div",{className:"interactive-list__label",children:[(0,p.BX)("ul",{className:"interactive-list__detail-list",children:[(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:e.label}),(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--secondary",children:(0,p.tZ)(s.cC,{id:"feeds.match.count",values:{count:l}})}),e===t&&(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:"Modifying"})]}),(0,p.BX)("ul",{className:"interactive-list__detail-list",children:[(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:`${o} ${a._(d)}`}),(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--tertiary",children:(0,p.tZ)("a",{href:e.url,rel:"noopener noreferrer",target:"_blank",children:e.url})})]})]}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action",type:"button",onClick:()=>r(e),children:(0,p.tZ)(y.I8,{})}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>i(e),children:(0,p.tZ)(y.x8,{})})]},e._id)}))})})),Ae=ze;function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?He(Object(n),!0).forEach((function(t){Ge(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):He(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qe={url:{isValid:e=>null!=e&&""!==e&&null!==e.match(Oe),error:"feeds.validation.must.specify.valid.feed.url"},label:{isValid:Ne,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"}},We=(e,t)=>{var n,r;return null!==(n=Qe[e])&&void 0!==n&&n.isValid(t)||null===(r=Qe[e])||void 0===r?void 0:r.error},Ye=[{message:"feeds.time.min",value:1},{message:"feeds.time.hr",value:60},{message:"feeds.time.day",value:1440}],Je={label:"",interval:5,url:""},Ke=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(null),[i,l]=(0,o.useState)({}),[a,c]=(0,o.useState)(!1),[u,h]=(0,o.useState)(!1);return(0,p.BX)("div",{children:[(0,p.BX)(d.l0,{className:"inverse",onChange:e=>{let{event:t,formData:n}=e;const r=t.target.name,a=n;l(qe(qe({},i),{},{[r]:We(r,a[r])}))},onSubmit:async()=>{var t;const i=null===(t=e.current)||void 0===t?void 0:t.getFormData();if(null==e.current||null==i)return;h(!0);const a=Object.keys(Qe).reduce(((e,t)=>{const n=t;return qe(qe({},e),{},{[n]:We(n,i[n])})}),{});l(a);if(Object.keys(a).every((e=>void 0===a[e]))){const t={label:i.label,url:i.url,interval:Number(i.interval)*Number(i.intervalMultiplier)};let a=!0;try{null===n?await ke.addFeed(t):null!=(null==n?void 0:n._id)&&await ke.modifyFeed(n._id,t)}catch{a=!1}a?(e.current.resetForm(),l({}),r(null),c(!1)):l({backend:"general.error.unknown"})}h(!1)},ref:e,children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"feeds.existing.feeds"})}),Object.keys(i).reduce(((e,n)=>(null!=i[n]&&e.push((0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:t._(null==i?void 0:i[n])})},`error-${n}`)),e)),[]),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.U2,{children:(0,p.tZ)(Ae,{currentFeed:n,intervalMultipliers:Ye,onSelect:e=>{r(e),c(!0)},onRemove:e=>{e===n&&(a&&(l({}),c(!1)),r(null)),null!=e._id&&ke.removeFeedMonitor(e._id)}})})}),a?(0,p.tZ)(Re,{currentFeed:n,defaultFeed:Je,intervalMultipliers:Ye,isSubmitting:u,onCancel:()=>{l({}),c(!1),r(null)}},(null==n?void 0:n._id)||"initial"):(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.U2,{width:"auto"}),(0,p.tZ)(d.zx,{onClick:()=>{c(!0)},children:(0,p.tZ)(s.cC,{id:"button.new"})})]})]}),(0,p.tZ)(Ue,{})]})},et=()=>{const{i18n:e}=(0,s.mV)();(0,o.useEffect)((()=>{ke.fetchFeedMonitors()}),[]);const t={feeds:{content:Ke,label:e._("feeds.tabs.feeds")},downloadRules:{content:Ie,label:e._("feeds.tabs.download.rules")}};return(0,p.tZ)(_e,{heading:e._("feeds.tabs.heading"),orientation:"horizontal",size:"large",tabs:t})};var tt=n(4936);let nt;!function(e){e[e.HTTP=1]="HTTP",e[e.UDP=2]="UDP",e[e.DHT=3]="DHT"}(nt||(nt={}));const rt=(e,t)=>{let n=`magnet:?xt=urn:btih:${e}`;return null!=t&&t.length&&t.forEach((e=>{n=`${n}&tr=${encodeURI(e)}`})),n},it=()=>{var e;const t=(0,o.useRef)(null),n=(0,o.useRef)(null),{i18n:r}=(0,s.mV)(),[i,l]=(0,o.useState)(!1),[a,c]=(0,o.useState)(!1),[u,h]=(0,o.useState)({isLoadingTrackers:!0,magnetTrackersLink:""});(0,o.useEffect)((()=>{m.Z.fetchTorrentTrackers(tt.Z.selectedTorrents[0]).then((e=>{null!=e&&h({isLoadingTrackers:!1,magnetTrackersLink:rt(tt.Z.selectedTorrents[0],e.filter((e=>e.type!==nt.DHT)).map((e=>e.url)))})}))}),[]);const _=rt(tt.Z.selectedTorrents[0]);return(0,p.tZ)(_e,{heading:r._("torrents.generate.magnet.heading"),content:(0,p.tZ)("div",{className:"modal__content inverse",children:(0,p.BX)(d.l0,{children:[null!==(e=tt.Z.torrents[tt.Z.selectedTorrents[0]])&&void 0!==e&&e.isPrivate?(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:r._("torrents.generate.magnet.private.torrent")})}):null,(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"magnet",ref:t,addonPlacement:"after",label:r._("torrents.generate.magnet.magnet"),defaultValue:_,readOnly:!0,children:(0,p.tZ)(d.G5,{onClick:()=>{var e;if("function"==typeof(null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText))navigator.clipboard.writeText(_).then((()=>{l(!0)}));else if(null!=t.current){var n;null===(n=t.current)||void 0===n||n.select(),document.execCommand("copy"),l(!0)}},children:i?(0,p.tZ)(y.FV,{}):(0,p.tZ)(y.TU,{})})})}),(0,p.tZ)(d.p7,{children:u.isLoadingTrackers?(0,p.tZ)(d.fE,{id:"loading",label:r._("torrents.generate.magnet.magnet.with.trackers"),placeholder:r._("torrents.generate.magnet.loading.trackers"),disabled:!0}):(0,p.tZ)(d.fE,{id:"magnet-trackers",ref:n,addonPlacement:"after",label:r._("torrents.generate.magnet.magnet.with.trackers"),defaultValue:u.magnetTrackersLink,readOnly:!0,children:(0,p.tZ)(d.G5,{onClick:()=>{var e;if("function"==typeof(null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText))navigator.clipboard.writeText(u.magnetTrackersLink).then((()=>{c(!0)}));else if(null!=n.current){var t;null===(t=n.current)||void 0===t||t.select(),document.execCommand("copy"),c(!0)}},children:a?(0,p.tZ)(y.FV,{}):(0,p.tZ)(y.TU,{})})})})]})}),actions:[{clickHandler:null,content:r._("button.close"),triggerDismiss:!0,type:"tertiary"}]})},lt=e=>{const t=e[0];if(!e.some((e=>!e.includes(t))))return t},at=()=>{const{i18n:e}=(0,s.mV)(),[t,n]=(0,o.useState)(!1);return(0,p.tZ)(_e,{heading:e._("torrents.move.heading"),content:(0,p.tZ)("div",{className:"modal__content",children:(0,p.BX)(d.l0,{className:"inverse",onSubmit:e=>{let{formData:t}=e;const r=tt.Z.selectedTorrents;r.length>0&&(n(!0),m.Z.moveTorrents({hashes:r,destination:t.destination,isBasePath:t.isBasePath,moveFiles:t.moveFiles,isCheckHash:t.isCheckHash}).then((()=>{_.Z.setActiveModal(null),n(!1)})))},children:[(0,p.tZ)(F,{id:"destination",selectable:"directories",suggested:lt(tt.Z.selectedTorrents.map((e=>tt.Z.torrents[e].directory))),showBasePathToggle:!0}),(0,p.tZ)(f,{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"}]})]})})})},st=()=>{const{i18n:e}=(0,s.mV)(),[t,n]=(0,o.useState)(!1),{selectedTorrents:r}=tt.Z;return 0===r.length?(0,p.tZ)(_e,{heading:e._("torrents.remove"),content:(0,p.tZ)("div",{className:"modal__content inverse",children:(0,p.tZ)(d.l0,{children:(0,p.tZ)(d.p7,{children:(0,p.tZ)(s.cC,{id:"torrents.remove.error.no.torrents.selected"})})})}),actions:[{clickHandler:null,content:e._("button.ok"),triggerDismiss:!0,type:"primary"}]}):(0,p.tZ)(_e,{heading:e._("torrents.remove"),content:(0,p.tZ)("div",{className:"modal__content",children:(0,p.BX)(d.l0,{className:"inverse",onSubmit:e=>{let{formData:t}=e;n(!0);const r=t.deleteData;m.Z.deleteTorrents({hashes:tt.Z.selectedTorrents,deleteData:r}).then((()=>{n(!1),(e=>{let{deleteData:t}=e;null!=t&&c.Z.saveSetting("deleteTorrentData",t)})({deleteData:r}),_.Z.setActiveModal(null)}))},children:[(0,p.tZ)(d.p7,{children:(0,p.tZ)(s.cC,{id:"torrents.remove.are.you.sure",values:{count:r.length}})}),(0,p.tZ)(f,{actions:[{checked:u.Z.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"}]})]})})})},ot=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(!1);return(0,p.tZ)(_e,{heading:t._("torrents.set.tags.heading"),content:(0,p.tZ)("div",{className:"modal__content inverse",children:(0,p.tZ)(d.l0,{ref:e,children:(0,p.tZ)(d.p7,{children:(0,p.tZ)(H,{defaultValue:tt.Z.selectedTorrents.map((e=>tt.Z.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}=tt.Z,n=e.current.getFormData(),i=n.tags?n.tags.split(","):[];r(!0),(null==t?void 0:t.length)>0&&m.Z.setTags({hashes:t,tags:i})},isLoading:n,triggerDismiss:!1,type:"primary"}]})},dt=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(!1),[i,l]=(0,o.useState)({isLoadingTrackers:!0,trackerURLs:[]});return(0,o.useEffect)((()=>{m.Z.fetchTorrentTrackers(tt.Z.selectedTorrents[0]).then((e=>{null!=e&&l({isLoadingTrackers:!1,trackerURLs:e.filter((e=>e.type!==nt.DHT)).map((e=>e.url))})}))}),[]),(0,p.tZ)(_e,{heading:t._("torrents.set.trackers.heading"),content:(0,p.tZ)("div",{className:"modal__content inverse",children:(0,p.tZ)(d.l0,{ref:e,children:i.isLoadingTrackers?(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"loading",placeholder:t._("torrents.set.trackers.loading.trackers"),disabled:!0})}):(0,p.tZ)(Q,{id:"trackers",placeholder:t._("torrents.set.trackers.enter.tracker"),defaultValues:0===i.trackerURLs.length?void 0:i.trackerURLs.map(((e,t)=>({id:t,value:e})))})})}),actions:[{clickHandler:null,content:t._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:()=>{if(null==e.current||n||i.isLoadingTrackers)return;r(!0);const t=e.current.getFormData(),l=q(t,"trackers").filter((e=>""!==e));m.Z.setTrackers({hashes:tt.Z.selectedTorrents,trackers:l}).then((()=>{r(!1),_.Z.setActiveModal(null)}))},content:t._("torrents.set.trackers.button.set"),isLoading:n||i.isLoadingTrackers,triggerDismiss:!1,type:"primary"}]})},ct=JSON.parse('{"i8":"0.0.0-master.652f7d6"}'),ut=(0,o.lazy)((()=>n.e(443).then(n.t.bind(n,6641,23)).then((e=>({default:e.react}))))),ht="https://github.com/jesec/flood",mt=()=>(0,p.tZ)(o.Suspense,{fallback:null,children:(0,p.tZ)(ut,{FloodVersion:()=>ct.i8,CommitBadge:()=>ct.i8.length>8?(0,p.tZ)("a",{href:ht,children:(0,p.tZ)("img",{alt:"Latest version of rolling build",src:"https://img.shields.io/npm/v/@jesec/flood?label=HEAD"})}):(0,p.tZ)("a",{href:ht,children:(0,p.tZ)("img",{alt:"Commits since user's version",src:`https://img.shields.io/github/commits-since/jesec/flood/v${ct.i8}`})})})});var _t=n(8111),pt=n(2552),ft=n(2809),gt=n(4982);const bt=(0,l.Pi)((()=>{const e=(0,o.useRef)(null),t=(0,o.useRef)(null),[n,l]=(0,o.useState)(null),[a,c]=(0,o.useState)(!1),[u,h]=(0,o.useState)(!1),{i18n:m}=(0,s.mV)();if((0,o.useEffect)((()=>{pt.Z.currentUser.isAdmin&&_t.Z.fetchUsers().then((()=>{c(!0)}))}),[]),!pt.Z.currentUser.isAdmin)return(0,p.BX)(d.l0,{children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"auth.user.accounts"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:(0,p.tZ)(s.cC,{id:"auth.message.not.admin"})})})]});const _=!a&&0===pt.Z.users.length,f=U()("interactive-list",{"interactive-list--loading":_});return(0,p.BX)(d.l0,{onSubmit:()=>{if(null==e.current||null==t.current)return;const n=e.current.getFormData();if(null==n.username||""===n.username)l("auth.error.username.empty");else if(null==n.password||""===n.password)l("auth.error.password.empty");else{h(!0);const r=t.current;if(null==r)return l("connection.settings.error.empty"),void h(!1);_t.Z.createUser({username:n.username,password:n.password,client:r,level:!0===n.isAdmin?ft.u.ADMINISTRATOR:ft.u.USER}).then((()=>{null!=e.current&&e.current.resetForm(),l(null),h(!1)}),(()=>{l("general.error.unknown"),h(!1)})).then(_t.Z.fetchUsers)}},ref:e,children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"auth.user.accounts"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.U2,{children:(0,p.BX)("ul",{className:f,children:[(0,p.tZ)(i.Z,{children:_&&(0,p.tZ)(r.Z,{classNames:"interactive-list__loading-indicator",timeout:{enter:250,exit:250},children:(0,p.tZ)("div",{className:"interactive-list__loading-indicator",children:(0,p.tZ)(d.$z,{})},"loading-indicator")})}),pt.Z.users.slice().sort(((e,t)=>e.username.localeCompare(t.username))).map((e=>{const t=e.username===pt.Z.currentUser.username;let n=null,r=null;t?n=(0,p.tZ)("span",{className:"interactive-list__label__tag tag",children:(0,p.tZ)(s.cC,{id:"auth.current.user"})}):r=(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>_t.Z.deleteUser(e.username).then(_t.Z.fetchUsers),children:(0,p.tZ)(y.x8,{})});const i=U()("interactive-list__item",{"interactive-list__item--disabled":t});return(0,p.BX)("li",{className:i,children:[(0,p.BX)("span",{className:"interactive-list__label",children:[(0,p.tZ)("div",{className:"interactive-list__label__text",children:e.username}),n]}),r]},e.username)}))]})})}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"auth.add.user"})}),n&&(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:m._(n)})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"username",label:(0,p.tZ)(s.cC,{id:"auth.username"}),placeholder:m._("auth.username"),autoComplete:"username"}),(0,p.tZ)(d.fE,{id:"password",label:(0,p.tZ)(s.cC,{id:"auth.password"}),placeholder:m._("auth.password"),autoComplete:"new-password"}),(0,p.tZ)(d.XZ,{grow:!1,id:"isAdmin",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"auth.admin"})})]}),(0,p.tZ)(gt.Z,{onSettingsChange:e=>{t.current=e}}),(0,p.tZ)("p",{}),(0,p.tZ)(d.p7,{justify:"end",children:(0,p.tZ)(d.zx,{isLoading:u,priority:"primary",type:"submit",children:(0,p.tZ)(s.cC,{id:"button.add"})})})]})})),Zt=(e,t)=>{var n;return null!=e[t]?e[t]:null===(n=u.Z.clientSettings)||void 0===n?void 0:n[t]},vt=e=>{const t=e.target,n=t.name,{value:r,type:i,checked:l}=t;let a={};return a="checkbox"===i?{[n]:l}:{[n]:r},a};function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ct(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){wt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const kt=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)))},Nt=e=>{let{onSettingsChange:t,onClientSettingsChange:n}=e;const[r,i]=(0,o.useState)({});return(0,p.BX)(d.l0,{onChange:e=>{let{event:l,formData:a}=e;const s=l.target;if("dropdownPresetDownload"===s.name||"dropdownPresetUpload"===s.name)return void t({speedLimits:{download:Ot(a.dropdownPresetDownload),upload:Ot(a.dropdownPresetUpload)}});const o=Ct(Ct({},r),vt(l));i(o),n(o)},children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.heading"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:null!=u.Z.floodSettings.speedLimits?kt(u.Z.floodSettings.speedLimits.download):0,label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.dropdown.preset.download.label"}),id:"dropdownPresetDownload"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:null!=u.Z.floodSettings.speedLimits?kt(u.Z.floodSettings.speedLimits.upload):0,label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.dropdown.preset.upload.label"}),id:"dropdownPresetUpload"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleGlobalDownSpeed"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.global.throttle.download"}),id:"throttleGlobalDownSpeed"}),(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleGlobalUpSpeed"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.global.throttle.upload"}),id:"throttleGlobalUpSpeed"})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.heading"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleMaxUploads"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.upload.label"}),id:"throttleMaxUploads"}),(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleMaxUploadsGlobal"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.upload.global.label"}),id:"throttleMaxUploadsGlobal"})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleMaxDownloads"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.download.label"}),id:"throttleMaxDownloads"}),(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleMaxDownloadsGlobal"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.download.global.label"}),id:"throttleMaxDownloadsGlobal"})]})]})};function St(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?St(Object(n),!0).forEach((function(t){xt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):St(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const jt=e=>{let{onClientSettingsChange:t}=e;const[n,r]=(0,o.useState)({});return(0,p.BX)(d.l0,{onChange:e=>{let{event:i}=e;const l=Pt(Pt({},n),vt(i));r(l),t(l)},children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.connectivity.incoming.heading"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"networkPortRange"),id:"networkPortRange",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.port.range.label"}),width:"one-quarter"}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"networkPortRandom"),grow:!1,id:"networkPortRandom",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.connectivity.port.randomize.label"})}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"networkPortOpen"),grow:!1,id:"networkPortOpen",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.connectivity.port.open.label"})})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"networkLocalAddress"),id:"networkLocalAddress",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.ip.hostname.label"})}),(0,p.tZ)(d.fE,{defaultValue:Zt(n,"networkHttpMaxOpen"),id:"networkHttpMaxOpen",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.max.http.connections"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.connectivity.dpd.heading"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"dhtPort"),id:"dhtPort",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.dht.port.label"}),width:"one-quarter"}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"dht"),grow:!1,id:"dht",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.connectivity.dht.label"})}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"protocolPex"),grow:!1,id:"protocolPex",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.connectivity.peer.exchange.label"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.heading"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"throttleMinPeersNormal"),id:"throttleMinPeersNormal",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.min.label"})}),(0,p.tZ)(d.fE,{defaultValue:Zt(n,"throttleMaxPeersNormal"),id:"throttleMaxPeersNormal",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.max.label"})})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"throttleMinPeersSeed"),id:"throttleMinPeersSeed",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.seeding.min.label"})}),(0,p.tZ)(d.fE,{defaultValue:Zt(n,"throttleMaxPeersSeed"),id:"throttleMaxPeersSeed",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.seeding.max.label"})})]}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:Zt(n,"trackersNumWant"),id:"trackersNumWant",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.desired.label"}),width:"one-half"})})]})};var Bt=n(5181),Dt=n(8826),Xt=n(5587),Tt=n(9752),Et=n(2339),Mt=n(4285);function Vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function It(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(n),!0).forEach((function(t){Rt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Lt=e=>{const{children:t,id:n,disabled:r}=e,{attributes:i,setNodeRef:l,listeners:a,transform:s,transition:o,isDragging:d}=(0,Xt.nB)({id:n,disabled:r}),c={transform:Mt.ux.Transform.toString(s),transition:o};return(0,p.BX)("div",It(It(It({className:U()("sortable-list__item",{"sortable-list__item--is-dragging":d,"sortable-list__item--is-locked":r}),ref:l,style:c},i),a),{},{children:[r?(0,p.tZ)(y.HE,{}):null,t]}))};var Ft={name:"z45y2s",styles:"width:100%;touch-action:none"};const $t=e=>{let{className:t,items:n,lockedIDs:r,renderItem:i,onMouseDown:l,onDrop:a}=e;const[s,d]=(0,o.useState)(n),c=U()("sortable-list",t),u=(0,Tt.VT)(Tt.Lg),h=(0,Tt.VT)(Tt.MA,{activationConstraint:{distance:10}}),m=(0,Tt.VT)(Tt.LO,{activationConstraint:{distance:10}});return(0,p.tZ)("div",{css:Ft,role:"none",onMouseDown:e=>{l&&l(e)},children:(0,p.tZ)(Tt.LB,{sensors:[u,h,m],onDragEnd:e=>{let{active:t,over:r}=e;if(null==r)return;if(t.id===r.id)return;const i=(0,Xt.Rp)(n,n.findIndex((e=>e===t.id)),n.findIndex((e=>e===r.id)));d(i),a&&a(i)},modifiers:[Et.DL,Et.F4],autoScroll:!1,children:(0,p.tZ)(Xt.Fo,{items:s,strategy:Xt.qw,children:(0,p.tZ)("ul",{className:c,children:s.map(((e,t)=>(0,p.tZ)(Lt,{id:e,disabled:r.includes(e),children:i(e,t)},e)))})})})})};$t.defaultProps={onMouseDown:void 0,onDrop:void 0};const Ut=$t;function zt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function At(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zt(Object(n),!0).forEach((function(t){Ht(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const qt=e=>{let{onSettingsChange:t}=e;const[n,r]=(0,o.useState)((()=>{const{mountPoints:e}=u.Z.floodSettings,t=Object.assign({},...Dt.Z.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}))))})()),i=n.reduce(((e,t)=>{let{id:n,visible:r}=t;return e[n]=r,e}),{});return(0,p.tZ)(Ut,{className:"sortable-list--disks",items:n.map((e=>{let{id:t}=e;return t})),lockedIDs:[],onDrop:e=>{r(e.map((e=>({id:e,visible:i[e]}))))},renderItem:e=>{const l=(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,p.tZ)(d.XZ,{defaultChecked:i[e],id:e,onClick:l=>{i[e]=l.target.checked;const a=n.map((t=>t.id===e?At(At({},t),{},{visible:l.target.checked}):t));t({mountPoints:a.filter((e=>e.visible)).map((e=>e.id))}),r(a)},children:(0,p.tZ)(s.cC,{id:"settings.diskusage.show"})})});return(0,p.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,p.tZ)("div",{children:e})}),l]})}})},Gt=e=>{let{onSettingsChange:t}=e;return(0,p.BX)(d.l0,{children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.diskusage.mount.points"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(qt,{onSettingsChange:t})})]})};function Qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qt(Object(n),!0).forEach((function(t){Yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Jt=e=>{let{onClientSettingsChange:t}=e;const[n,r]=(0,o.useState)({});return(0,p.BX)(d.l0,{onChange:e=>{let{event:i}=e;const l=Wt(Wt({},n),vt(i));r(l),t(l)},children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.resources.disk.heading"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:Zt(n,"directoryDefault"),id:"directoryDefault",label:(0,p.tZ)(s.cC,{id:"settings.resources.disk.download.location.label"})})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"networkMaxOpenFiles"),id:"networkMaxOpenFiles",label:(0,p.tZ)(s.cC,{id:"settings.resources.max.open.files"}),width:"one-half"}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"piecesHashOnCompletion"),grow:!1,id:"piecesHashOnCompletion",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.resources.disk.check.hash.label"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.resources.memory.heading"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:Zt(n,"piecesMemoryMax"),id:"piecesMemoryMax",label:(0,p.BX)("div",{children:[(0,p.tZ)(s.cC,{id:"settings.resources.memory.max.label"})," ",(0,p.tZ)("em",{className:"unit",children:"(MB)"})]}),width:"one-half"})})]})};var Kt=n(7731);var en={name:"1d3w5wq",styles:"width:100%"},tn={name:"15rw530",styles:".sortable-list__item{cursor:default;}"};const nn=e=>{let{className:t,checkboxLabel:n,items:r}=e;return(0,p.tZ)("div",{css:en,role:"none",children:(0,p.tZ)("ul",{className:U()("sortable-list",t),css:tn,children:r.map((e=>{const{id:t,label:r,isLocked:i=!1,defaultChecked:l,onClick:a}=e;return(0,p.BX)("li",{className:U()("sortable-list__item",{"sortable-list__item--is-locked":i}),children:[i?(0,p.tZ)(y.HE,{}):null,(0,p.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,p.tZ)(s.cC,{id:r})}),i?null:(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,p.tZ)(d.XZ,{defaultChecked:l,id:t,onClick:e=>null==a?void 0:a(e.target.checked),children:n&&(0,p.tZ)(s.cC,{id:n})})})]})]},t||r)}))})})};nn.defaultProps={className:void 0,checkboxLabel:void 0};const rn=nn,ln=e=>{let{onSettingsChange:t}=e;const n=(0,o.useRef)(u.Z.floodSettings.UIPageTitleSpeedEnabled);return(0,p.tZ)(rn,{items:[{label:"settings.ui.page.title.speed",defaultChecked:n.current,onClick:()=>{n.current=!n.current,t({UIPageTitleSpeedEnabled:n.current})}}]})};var an=n(8737),sn=n(2433);const on=e=>{let{onSettingsChange:t}=e;const n=(0,o.useRef)(sn.Z.torrentContextMenuActions.map((e=>{var t;let{id:n,visible:r}=e;return{id:n,visible:(null===(t=u.Z.floodSettings.torrentContextMenuActions.find((e=>e.id===n)))||void 0===t?void 0:t.visible)??r}})));return(0,p.tZ)(rn,{checkboxLabel:"settings.ui.torrent.context.menu.items.show",items:Object.keys(an.Z).map((e=>({label:an.Z[e],isLocked:"start"===e||"stop"===e||"setTaxonomy"===e||"torrentDetails"===e,defaultChecked:n.current.some((t=>t.id===e&&t.visible)),onClick:()=>{const r=n.current.find((t=>t.id===e));null!=r&&(r.visible=!r.visible),t({torrentContextMenuActions:n.current})}})))})};var dn=n(882),cn=n(9097);const un=e=>{let{torrentListViewSize:t,onSettingsChange:n}=e;const r=(0,o.useRef)(null),[i,l]=(0,o.useState)([...u.Z.floodSettings.torrentListColumns.filter((e=>null!=dn.Z[e.id])).slice(),...Object.keys(dn.Z).filter((e=>u.Z.floodSettings.torrentListColumns.every((t=>t.id!==e)))).map((e=>({id:e,visible:!1})))]),a=i.reduce(((e,t)=>{let{id:n,visible:r}=t;return e[n]=r,e}),{}),c="expanded"===t?["name","eta","downRate","percentComplete","downTotal","upRate"]:[];return(0,p.tZ)(Ut,{className:"sortable-list--torrent-details",items:i.map((e=>{let{id:t}=e;return t})),lockedIDs:c,onMouseDown:()=>{var e;null===(e=r.current)||void 0===e||e.dismissTooltip()},onDrop:e=>{const t=e.map((e=>({id:e,visible:a[e]})));n({torrentListColumns:t}),l(t)},renderItem:(e,o)=>{let u=null,h=null;if(c.includes(e)||(u=(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,p.tZ)(d.XZ,{defaultChecked:a[e],id:e,onClick:t=>{a[e]=t.target.checked;const r=i.map((n=>({id:n.id,visible:n.id===e?t.target.checked:n.visible})));l(r),n({torrentListColumns:r})},children:(0,p.tZ)(s.cC,{id:"settings.ui.torrent.details.enabled"})})})),"tags"===e&&"expanded"===t&&o<i.length-1){const e=(0,p.tZ)(s.cC,{id:"settings.ui.torrent.details.tags.placement"});h=(0,p.tZ)(cn.Z,{className:"tooltip tooltip--is-error",content:e,offset:-5,ref:r,width:200,wrapperClassName:"sortable-list__content sortable-list__content--secondary tooltip__wrapper",wrapText:!0,children:(0,p.tZ)(y.jj,{})})}return(0,p.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[h,(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,p.tZ)(s.cC,{id:dn.Z[e]})}),u]})}})},hn=e=>{let{onSettingsChange:t}=e;const{i18n:n}=(0,s.mV)(),[r,i]=(0,o.useState)(u.Z.floodSettings.torrentListViewSize),[l,a]=(0,o.useState)(u.Z.floodSettings.language),[c,h]=(0,o.useState)(u.Z.floodSettings.UITagSelectorMode);return(0,p.BX)(d.l0,{onChange:e=>{let{event:n,formData:l}=e;const s=n.target;if("radio"===s.type&&(i(l["ui-torrent-size"]),h(l["ui-tag-selector-mode"]),t({torrentListViewSize:r,UITagSelectorMode:c})),"language"===s.name){const e=l.language;a(e),t({language:e})}},children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.language"})},"locale-header"),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Ph,{defaultID:l,id:"language",children:Object.keys(Kt.Z).map((e=>(0,p.tZ)(d.Ql,{id:e,children:null!=Kt.Z[e].id?n._(Kt.Z[e].id):Kt.Z[e]},e)))})},"locale-selection"),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.tag.selector.mode"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.Y8,{defaultChecked:"single"===c,groupID:"ui-tag-selector-mode",id:"single",width:"auto",children:(0,p.tZ)(s.cC,{id:"settings.ui.tag.selector.mode.single"})}),(0,p.tZ)(d.Y8,{defaultChecked:"multi"===c,groupID:"ui-tag-selector-mode",id:"multi",width:"auto",children:(0,p.tZ)(s.cC,{id:"settings.ui.tag.selector.mode.multi"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.torrent.list"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.Y8,{defaultChecked:"expanded"===r,groupID:"ui-torrent-size",id:"expanded",width:"auto",children:(0,p.tZ)(s.cC,{id:"settings.ui.torrent.size.expanded"})}),(0,p.tZ)(d.Y8,{defaultChecked:"condensed"===r,groupID:"ui-torrent-size",id:"condensed",width:"auto",children:(0,p.tZ)(s.cC,{id:"settings.ui.torrent.size.condensed"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.displayed.details"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(un,{torrentListViewSize:r,onSettingsChange:t})}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.displayed.context.menu.items"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(on,{onSettingsChange:t})}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.misc"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(ln,{onSettingsChange:t})})]})};function mn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mn(Object(n),!0).forEach((function(t){pn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const fn=(0,l.Pi)((()=>{const{i18n:e}=(0,s.mV)(),[t,n]=(0,o.useState)({}),[r,i]=(0,o.useState)({}),[l,a]=(0,o.useState)(!1),d=e=>{n(_n(_n({},t),e))},u=e=>{i(_n(_n({},r),e))},h=_n(_n({bandwidth:{content:Nt,props:{onClientSettingsChange:d,onSettingsChange:u},label:e._("settings.tabs.bandwidth")},connectivity:{content:jt,props:{onClientSettingsChange:d},label:e._("settings.tabs.connectivity")},resources:{content:Jt,props:{onClientSettingsChange:d},label:e._("settings.tabs.resources")}},"none"!==re.Z.authMethod?{authentication:{content:bt,label:e._("settings.tabs.authentication")}}:{}),{},{ui:{content:hn,label:e._("settings.tabs.userinterface"),props:{onSettingsChange:u}},diskusage:{content:Gt,label:e._("settings.tabs.diskusage"),props:{onSettingsChange:u}},about:{content:mt,label:e._("settings.tabs.about")}});return(0,p.tZ)(_e,{actions:[{clickHandler:null,content:e._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:()=>{a(!0),Promise.all([c.Z.saveSettings(r,{alert:!0}),Bt.Z.saveSettings(t,{alert:!0})]).then((()=>{a(!1),_.Z.setActiveModal(null)}))},isLoading:l,content:e._("button.save"),triggerDismiss:!1,type:"primary"}],size:"large",heading:e._("settings.tabs.heading"),orientation:re.Z.isSmallScreen?"horizontal":"vertical",tabs:h})})),gn=()=>{const{i18n:e}=(0,s.mV)(),t=(0,o.useRef)(be().CancelToken.source()),n=(0,o.useRef)(null),[r,i]=(0,o.useState)(null),[l,a]=(0,o.useState)(null),[c,u]=(0,o.useState)(!0),[h,f]=(0,o.useState)(!1);(0,o.useEffect)((()=>{var e;const{current:n}=t;var r;"torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)&&m.Z.fetchMediainfo(null===(r=_.Z.activeModal)||void 0===r?void 0:r.hash,t.current.token).then((e=>{i(e.output),u(!1)}),(e=>{be().isCancel(e)||(a(e.response.data),u(!1))}));return()=>{n.cancel()}}),[]);let g="mediainfo.heading";return c?g="mediainfo.fetching":l&&(g="mediainfo.execError"),(0,p.BX)("div",{className:"torrent-details__section mediainfo modal__content--nested-scroll__content",children:[(0,p.BX)("div",{className:"mediainfo__toolbar",children:[(0,p.tZ)("div",{className:"mediainfo__toolbar__item",children:(0,p.tZ)("span",{className:"torrent-details__table__heading--tertiary",children:(0,p.tZ)(s.cC,{id:g})})}),r&&(0,p.tZ)(cn.Z,{content:e._(h?"general.clipboard.copied":"general.clipboard.copy"),wrapperClassName:"tooltip__wrapper mediainfo__toolbar__item",children:(0,p.tZ)(d.zx,{priority:"tertiary",onClick:()=>{var e;null!=r&&("function"==typeof(null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText)?navigator.clipboard.writeText(r).then((()=>{f(!0)})):null!=n.current&&(n.current.value=r,n.current.select(),document.execCommand("copy"),f(!0)))},children:h?(0,p.tZ)(y.MC,{}):(0,p.tZ)(y.TU,{})})})]}),(0,p.tZ)("input",{ref:n,style:{width:"0.1px",height:"1px",position:"absolute",right:0}}),l?(0,p.tZ)("pre",{className:"mediainfo__output mediainfo__output--error",children:l.message}):(0,p.tZ)("pre",{className:"mediainfo__output",children:r})]})};function bn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bn(Object(n),!0).forEach((function(t){vn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const yn=(e,t)=>Zn(Zn(Zn(Zn({},e),null!=e.directories?{directories:Object.assign({},...Object.keys(e.directories).map((n=>null!=e.directories?{[n]:yn(e.directories[n],t)}:{})))}:{}),null!=e.files?{files:Object.assign({},...Object.keys(e.files).map((n=>null!=e.files?{[n]:Zn(Zn({},e.files[n]),{},{isSelected:t})}:{})))}:{}),{},{isSelected:t}),Cn=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const{depth:r,path:i,select:l,type:a}=t,s=i[n];if(n===r-1){var o;if("file"===a&&null!=(null===(o=e.files)||void 0===o?void 0:o[s])){const t=Zn(Zn({},e.files),{},{[s]:Zn(Zn({},e.files[s]),{},{isSelected:l})});return Zn(Zn({},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=Zn(Zn({},e.directories),{},{[s]:yn(e.directories[s],l)});return Zn(Zn({},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 r=e.directories;return Object.keys(r).forEach((e=>{e===s&&(r[e]=Cn(r[e],t,n+1))})),Zn(Zn({},e),{},{directories:r,isSelected:Object.values(r).every((e=>{let{isSelected:t}=e;return t}))})}return e},wn=e=>{const t=[];if(null!=e.files){const{files:n}=e;Object.keys(n).forEach((e=>{const r=n[e];r.isSelected&&t.push(r.index)}))}if(null!=e.directories){const{directories:n}=e;Object.keys(n).forEach((e=>{t.push(...wn(n[e]))}))}return t},kn={selectAll:yn,applySelection:Cn,getSelectedItems:wn,getSelectionTree:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n={isSelected:t};return e.forEach((e=>{const r=e.path.split("/");let i=n;for(;r.length-1;){const e=r.shift();null==i.directories&&(i.directories={}),null==i.directories[e]&&(i.directories[e]={isSelected:t}),i=i.directories[e]}null==i.files&&(i.files={}),i.files[e.filename]=Zn(Zn({},e),{},{isSelected:t})})),n}};var On=n(2036),Nn=n(2104);const Sn=e=>{let{depth:t,items:n,hash:r,path:i,onItemSelect:l}=e;const[a,s]=(0,o.useState)(null),c=(0,o.useRef)({});if(null==n)return null;const u=Object.values(n).sort(((e,t)=>e.filename.localeCompare(t.filename))).map((e=>{var o;const u=n&&n[e.filename]&&n[e.filename].isSelected||!1,h=U()("directory-tree__node file","directory-tree__node--file directory-tree__node--selectable",{"directory-tree__node--selected":u});return(0,p.BX)("div",{className:h,title:e.filename,children:[(0,p.BX)("div",{className:"file__label file__detail",children:[(0,p.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,p.tZ)(d.XZ,{checked:u,id:`${e.index}`,onClick:()=>l({type:"file",depth:t,path:[...i,e.filename],select:!u})})}),(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:(0,p.tZ)(y.$B,{})})]}),(0,p.tZ)("div",{className:"file__name",children:(0,p.tZ)("a",{href:`${re.Z.baseURI}api/torrents/${r}/contents/${e.index}/data`,style:{textDecoration:"none"},target:"_blank",rel:"noreferrer",children:e.filename})})]}),(0,p.tZ)("div",{className:"file__detail file__detail--secondary",children:(0,p.tZ)(Nn.Z,{value:e.sizeBytes,precision:1})}),(0,p.BX)("div",{className:"file__detail file__detail--secondary",children:[Math.trunc(e.percentComplete),"%"]}),(0,p.tZ)("div",{className:"file__detail file__detail--secondary file__detail--priority",children:(0,p.tZ)(On.Z,{level:e.priority,id:e.index,maxLevel:2,onChange:(e,t)=>m.Z.setFilePriority(r,{indices:[Number(e)],priority:t}),priorityType:"file"},`${e.index}-${e.filename}`)}),"function"==typeof(null===(o=navigator.clipboard)||void 0===o?void 0:o.writeText)&&(0,p.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))))},n=c.current[e.index];null!=n?t(n):(c.current[e.index]="",m.Z.getTorrentContentsDataPermalink(r,[e.index]).then((n=>{c.current[e.index]=n,t(n)}),(()=>{c.current[e.index]=null})))},children:a===e.index?(0,p.tZ)(y.MC,{}):(0,p.tZ)(y.TU,{})})]},e.filename)}));return(0,p.tZ)("div",{className:"directory-tree__node directory-tree__node--file-list",children:u})};var Pn={name:"r5l0s9",styles:"width:100%;text-align:left;:focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"};const xn=e=>{let{depth:t,directoryName:n,id:r,itemsTree:i,hash:l,path:a,isSelected:s,onItemSelect:c}=e;const[u,h]=(0,o.useState)(!1),m=[...a,n];return(0,p.BX)("div",{className:U()("directory-tree__branch",`directory-tree__branch--depth-${t}`,{"directory-tree__node--selected":s}),children:[(0,p.tZ)("button",{className:U()("directory-tree__node","directory-tree__node--selectable directory-tree__node--directory",{"is-expanded":u}),css:Pn,type:"button",onClick:()=>h(!u),title:n,children:(0,p.BX)("div",{className:"file__label",children:[(0,p.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,p.tZ)(d.XZ,{checked:s,id:r,onClick:()=>c({type:"directory",depth:t,path:m,select:!s})})}),(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:u?(0,p.tZ)(y.DB,{}):(0,p.tZ)(y.Bm,{})})]}),(0,p.tZ)("div",{className:"file__name",children:n})]})}),u?(0,p.tZ)("div",{className:"directory-tree__node directory-tree__node--group",children:(0,p.tZ)(jn,{depth:t,hash:l,onItemSelect:c,path:m,itemsTree:i},`${u}-${t}`)}):null]})},jn=e=>{const{depth:t=0,itemsTree:n,hash:r,path:i,onItemSelect:l}=e,{files:a,directories:s}=n,o=t+1,d=null!=s?Object.keys(s).sort(((e,t)=>e.localeCompare(t))).map(((e,t)=>{const a=n.directories&&n.directories[e],s=`${t}${o}${e}`,d=a&&a.isSelected||!1;return null==a?null:(0,p.tZ)(xn,{depth:o,directoryName:e,hash:r,id:s,isSelected:d,itemsTree:a,onItemSelect:l,path:i},s)})):[],c=null!=a&&Object.keys(a).length>0?(0,p.tZ)(Sn,{depth:o,hash:r,onItemSelect:l,path:i,items:n.files},`files-${o}`):null;return(0,p.tZ)("div",{className:"directory-tree__tree",children:d.concat(c)})},Bn=(0,l.Pi)((()=>{var e,t;const[n,r]=(0,o.useState)([]),[i,l]=(0,o.useState)({}),[a,c]=(0,o.useState)([]),{i18n:u}=(0,s.mV)();if((0,o.useEffect)((()=>{var e,t;"torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)&&m.Z.fetchTorrentContents(null===(t=_.Z.activeModal)||void 0===t?void 0:t.hash).then((e=>{null!=e&&(r(e),l(kn.getSelectionTree(e)))}))}),[]),"torrent-details"!==(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))return null;const{hash:h}=null===_.Z||void 0===_.Z?void 0:_.Z.activeModal;let f=null,g=null,b=!1;(null==n?void 0:n.length)>0?(b=a.length>=n.length,f=(0,p.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.XZ,{checked:b,id:"select-all",onClick:()=>{const e=kn.getSelectionTree(n,a.length<n.length);l(e),c(kn.getSelectedItems(e))}})})}),(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:(0,p.tZ)(y.Zz,{})})]}),g=(0,p.tZ)(jn,{depth:0,onItemSelect:e=>{const t=kn.applySelection(i,e);l(t),c(kn.getSelectedItems(t))},hash:h,path:[],itemsTree:i})):(f=(0,p.tZ)(y.Zz,{}),g=(0,p.tZ)("div",{className:"directory-tree__node directory-tree__node--file",children:(0,p.tZ)(s.cC,{id:"torrents.details.files.loading"})}));const Z=U()("directory-tree__node","directory-tree__parent-directory torrent-details__section__heading",{"directory-tree__node--selected":b}),v=(0,p.tZ)("div",{className:Z,children:(0,p.BX)("div",{className:"file__label",children:[f,(0,p.tZ)("div",{className:"file__name",children:null===(t=tt.Z.torrents)||void 0===t?void 0:t[h].directory})]})}),C=U()("inverse directory-tree__wrapper",{"directory-tree__wrapper--toolbar-visible":a.length>0});return(0,p.BX)(d.l0,{className:C,onChange:e=>{let{event:t}=e;if(null!=t.target&&"file-priority"===t.target.name){const e=t.target;e.value&&m.Z.setFilePriority(h,{indices:a,priority:Number(e.value)})}},children:[(0,p.tZ)("div",{className:"directory-tree__selection-toolbar",children:(0,p.BX)(d.p7,{align:"center",children:[(0,p.tZ)(d.U2,{width:"one-quarter",grow:!1,shrink:!1,children:(0,p.tZ)(s.cC,{id:"torrents.details.selected.files",values:{count:a.length,countElement:(0,p.tZ)("span",{className:"directory-tree__selection-toolbar__item-count",children:a.length})}})}),(0,p.tZ)(d.zx,{onClick:e=>{e.preventDefault();const{baseURI:t}=re.Z,n=document.createElement("a");n.download="",n.href=`${t}api/torrents/${h}/contents/${a.join(",")}/data`,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},grow:!1,shrink:!1,children:(0,p.tZ)(s.cC,{id:"torrents.details.files.download.file",values:{count:a.length}})}),(0,p.BX)(d.Ph,{id:"file-priority",persistentPlaceholder:!0,shrink:!1,defaultID:"",children:[(0,p.tZ)(d.Ql,{id:-1,isPlaceholder:!0,children:(0,p.tZ)(s.cC,{id:"torrents.details.selected.files.set.priority"})}),(0,p.tZ)(d.Ql,{id:0,children:u._("priority.dont.download")}),(0,p.tZ)(d.Ql,{id:1,children:u._("priority.normal")}),(0,p.tZ)(d.Ql,{id:2,children:u._("priority.high")})]})]})}),(0,p.BX)("div",{className:"directory-tree torrent-details__section torrent-details__section--file-tree modal__content--nested-scroll__content",children:[v,g]})]})})),Dn=Bn;const Xn=e=>{let{text:t,className:n}=e;const r=t.split(/\s/).map((e=>function(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}(e.trimEnd())?(0,p.tZ)("a",{href:e.trimEnd(),target:"_blank",rel:"noopener noreferrer",children:e}):e));return(0,p.tZ)("span",{className:n,children:r})};Xn.defaultProps={className:void 0};const Tn=Xn,En=(0,l.Pi)((()=>{var e;const{i18n:t}=(0,s.mV)();if("torrent-details"!==(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))return null;const n=tt.Z.torrents[_.Z.activeModal.hash];if(null==n)return null;const r=(0,p.tZ)("span",{className:"not-available",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.none"})});return(0,p.tZ)("div",{className:"torrent-details__section torrent-details__section--general",children:(0,p.tZ)("table",{className:"torrent-details__table table",children:(0,p.BX)("tbody",{children:[(0,p.tZ)("tr",{className:"torrent-details__table__heading",children:(0,p.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,p.tZ)(s.cC,{id:"torrents.details.general.heading.general"})})}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateAdded",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.date.added"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.dateAdded>0?t.date(new Date(1e3*n.dateAdded),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):r})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--location",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.location"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.directory})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--tags",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.tags"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.tags.length?(i=n.tags,i.map((e=>(0,p.tZ)("span",{className:"tag",children:e},e)))):r})]}),(0,p.tZ)("tr",{className:"torrent-details__table__heading",children:(0,p.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,p.tZ)(s.cC,{id:"torrents.details.general.heading.transfer"})})}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateFinished",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.date.finished"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.dateFinished>0?t.date(new Date(1e3*n.dateFinished),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):r})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--downloaded",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.downloaded"})}),(0,p.BX)("td",{className:"torrent-details__detail__value",children:[t.number(n.percentComplete),(0,p.tZ)("em",{className:"unit",children:"%"})]})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--peers",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.peers"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.connected",values:{connectedCount:n.peersConnected,connected:t.number(n.peersConnected),total:t.number(n.peersTotal)}})})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--seeds",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.seeds"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.connected",values:{connectedCount:n.seedsConnected,connected:t.number(n.seedsConnected),total:t.number(n.seedsTotal)}})})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateActive",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.date.active"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:0===n.dateActive?r:-1===n.dateActive?t._("torrents.details.general.date.active.now"):t.date(new Date(1e3*n.dateActive),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"})})]}),(0,p.tZ)("tr",{className:"torrent-details__table__heading",children:(0,p.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,p.tZ)(s.cC,{id:"torrents.details.general.heading.torrent"})})}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--created",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.date.created"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.dateCreated>0?t.date(new Date(1e3*n.dateCreated),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):r})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--hash",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.hash"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.hash})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--size",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.size"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:(0,p.tZ)(Nn.Z,{value:n.sizeBytes})})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--type",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.type"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.isPrivate?t._("torrents.details.general.type.private"):t._("torrents.details.general.type.public")})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--comment",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.comment"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.comment?(0,p.tZ)(Tn,{text:n.comment}):r})]}),(0,p.tZ)("tr",{className:"torrent-details__table__heading",children:(0,p.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,p.tZ)(s.cC,{id:"torrents.details.general.heading.tracker"})})}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--tracker-message",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.tracker.message"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.message?n.message:r})]})]})})});var i}));var Mn=n(1109),Vn=n(228),In=n(6882);const Rn=(0,l.Pi)((()=>{var e;const{i18n:t}=(0,s.mV)(),n="torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)?tt.Z.torrents[_.Z.activeModal.hash]:void 0,[r,i]=(0,o.useState)("stop");if((0,o.useEffect)((()=>{null!=n&&n.status.includes("stopped")?i("stop"):i("start")}),[null==n?void 0:n.status]),null==n)return null;const l=(0,Mn.T)({status:n.status,upRate:n.upRate,downRate:n.downRate},"torrent-details__header");return(0,p.BX)("div",{className:l,children:[(0,p.tZ)("h1",{className:"torrent-details__heading torrent-details--name",children:n.name}),(0,p.BX)("div",{className:"torrent-details__sub-heading",children:[(0,p.BX)("ul",{className:"torrent-details__sub-heading__secondary",children:[(0,p.BX)("li",{className:"torrent-details__sub-heading__tertiary torrent-details__sub-heading__tertiary--download",children:[(0,p.tZ)(y.ki,{}),(0,p.tZ)(Nn.Z,{value:n.downRate,isSpeed:!0})," — ",(0,p.tZ)(Nn.Z,{value:n.bytesDone})]}),(0,p.BX)("li",{className:"torrent-details__sub-heading__tertiary torrent-details__sub-heading__tertiary--upload",children:[(0,p.tZ)(y.u3,{}),(0,p.tZ)(Nn.Z,{value:n.upRate,isSpeed:!0})," — ",(0,p.tZ)(Nn.Z,{value:n.upTotal})]}),(0,p.BX)("li",{className:"torrent-details__sub-heading__tertiary",children:[(0,p.tZ)(y.T_,{}),t.number(n.ratio)]}),(0,p.BX)("li",{className:"torrent-details__sub-heading__tertiary",children:[(0,p.tZ)(y.SU,{}),(0,p.tZ)(Vn.Z,{value:n.eta})]})]}),(0,p.BX)("ul",{className:"torrent-details__sub-heading__secondary",children:[(0,p.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,p.tZ)(On.Z,{id:n.hash,level:n.priority,maxLevel:3,priorityType:"torrent",onChange:(e,t)=>{m.Z.setPriority({hashes:[`${e}`],priority:t})}})},"priority-meter"),(0,p.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,p.BX)("button",{className:U()("torrent-details__action",{"is-active":"start"===r}),type:"button",onClick:()=>{i("start"),m.Z.startTorrents({hashes:[n.hash]})},children:[(0,p.tZ)(y.zf,{}),(0,p.tZ)(s.cC,{id:"torrents.details.actions.start"})]})},"start"),(0,p.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,p.BX)("button",{className:U()("torrent-details__action",{"is-active":"stop"===r}),type:"button",onClick:()=>{i("stop"),m.Z.stopTorrents({hashes:[n.hash]})},children:[(0,p.tZ)(y.dV,{}),(0,p.tZ)(s.cC,{id:"torrents.details.actions.stop"})]})},"stop")]})]}),(0,p.tZ)(In.Z,{percent:(0,Ze.Fl)((()=>Math.ceil(n.percentComplete))).get(),status:(0,Ze.Fl)((()=>(0,Mn.o)(n.status))).get()})]})}));var Ln=n(3337),Fn=n(8447);var $n={name:"17lw7on",styles:"td{max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}"};const Un=()=>{const[e,t]=(0,o.useState)([]),[n,r]=(0,o.useState)(null),i=()=>{var e,n;(r(null),"torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))&&m.Z.fetchTorrentPeers(null===(n=_.Z.activeModal)||void 0===n?void 0:n.hash).then((e=>{null!=e&&t(e)}));r(re.Z.pollInterval)};return(0,o.useEffect)((()=>i()),[]),(0,Ln.Z)((()=>i()),n),(0,p.tZ)("div",{className:"torrent-details__section torrent-details__section--peers",children:(0,p.BX)("table",{className:"torrent-details__table table",css:$n,children:[(0,p.tZ)("thead",{className:"torrent-details__table__heading",children:(0,p.BX)("tr",{children:[(0,p.BX)("th",{className:"torrent-details__table__heading--primary",children:[(0,p.tZ)(s.cC,{id:"torrents.details.peers"}),(0,p.tZ)(Fn.Z,{children:e.length})]}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"DL"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"UL"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"%"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"Client"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"Enc"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"In"})]})}),(0,p.tZ)("tbody",{children:e.map((e=>{const{country:t}=e,n=e.isEncrypted?(0,p.tZ)(y.HE,{}):null,r=e.isIncoming?(0,p.tZ)(y.FV,{}):null;return(0,p.BX)("tr",{children:[(0,p.BX)("td",{children:[(0,p.BX)("span",{className:"peers-list__flag",children:[(0,p.tZ)(o.Suspense,{fallback:(0,p.tZ)(y.$j,{}),children:(0,p.tZ)(y.AW,{countryCode:t})}),(0,p.tZ)("span",{className:"peers-list__flag__text",children:t})]}),e.address]}),(0,p.tZ)("td",{children:(0,p.tZ)(Nn.Z,{value:e.downloadRate,isSpeed:!0})}),(0,p.tZ)("td",{children:(0,p.tZ)(Nn.Z,{value:e.uploadRate,isSpeed:!0})}),(0,p.tZ)("td",{children:`${Math.ceil(e.completedPercent)}%`}),(0,p.tZ)("td",{children:e.clientVersion}),(0,p.tZ)("td",{className:"peers-list__encryption",children:n}),(0,p.tZ)("td",{className:"peers-list__incoming",children:r})]},e.address)}))})]})})},zn=()=>{const[e,t]=(0,o.useState)([]),n=e.length,r=["http","udp","dht"],i=e.map((e=>(0,p.BX)("tr",{children:[(0,p.tZ)("td",{children:e.url}),(0,p.tZ)("td",{children:r[e.type-1]})]},e.url)));return(0,o.useEffect)((()=>{var e,n;"torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)&&m.Z.fetchTorrentTrackers(null===(n=_.Z.activeModal)||void 0===n?void 0:n.hash).then((e=>{null!=e&&t(e)}))}),[]),(0,p.tZ)("div",{className:"torrent-details__trackers torrent-details__section",children:(0,p.BX)("table",{className:"torrent-details__table table",children:[(0,p.tZ)("thead",{className:"torrent-details__table__heading",children:(0,p.BX)("tr",{children:[(0,p.BX)("th",{className:"torrent-details__table__heading--primary",children:[(0,p.tZ)(s.cC,{id:"torrents.details.trackers"}),(0,p.tZ)(Fn.Z,{children:n})]}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:(0,p.tZ)(s.cC,{id:"torrents.details.trackers.type"})})]})}),(0,p.tZ)("tbody",{children:i})]})})},An=(0,l.Pi)((()=>{const{i18n:e}=(0,s.mV)(),{isSmallScreen:t}=re.Z,n={"torrent-details":{content:En,label:e._("torrents.details.details")},"torrent-contents":{content:Dn,label:e._("torrents.details.files"),modalContentClasses:"modal__content--nested-scroll"},"torrent-peers":{content:Un,label:e._("torrents.details.peers")},"torrent-trackers":{content:zn,label:e._("torrents.details.trackers")},"torrent-mediainfo":{content:gn,label:e._("torrents.details.mediainfo"),modalContentClasses:"modal__content--nested-scroll"}};return(0,p.tZ)(_e,{heading:(0,p.tZ)(Rn,{},"torrent-heading"),size:"large",tabs:n,orientation:t?"horizontal":"vertical",tabsInBody:!t})})),Hn=e=>{switch(e){case"add-torrents":return(0,p.tZ)(pe,{});case"confirm":return(0,p.tZ)(fe,{});case"feeds":return(0,p.tZ)(et,{});case"generate-magnet":return(0,p.tZ)(it,{});case"move-torrents":return(0,p.tZ)(at,{});case"remove-torrents":return(0,p.tZ)(st,{});case"set-taxonomy":return(0,p.tZ)(ot,{});case"set-trackers":return(0,p.tZ)(dt,{});case"settings":return(0,p.tZ)(fn,{});case"torrent-details":return(0,p.tZ)(An,{});default:return null}},qn=(0,l.Pi)((()=>{const{id:e}=_.Z.activeModal||{};let t;return(0,a.Z)("Escape",(()=>_.Z.setActiveModal(null))),null!=e&&(t=(0,p.tZ)(r.Z,{classNames:"modal__animation",timeout:{enter:500,exit:500},children:(0,p.BX)("div",{className:"modal",children:[(0,p.tZ)("div",{className:"modal__overlay",role:"none",onClick:()=>{_.Z.setActiveModal(null)}}),Hn(e)]})},e)),(0,p.tZ)(i.Z,{children:t})}))}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_jesec_flood=globalThis.webpackChunk_jesec_flood||[]).push([[151],{1434:(e,t,n)=>{n.r(t),n.d(t,{default:()=>qn});var r=n(8983),i=n(4537),l=n(1647),a=n(7264),s=n(3799),o=n(7294),d=n(8441),c=n(1540),u=n(879);const h=e=>{let{start:t,destination:n,tags:r,tab:i}=e;const l={};null!=t&&(l.startTorrentsOnLoad=t),null!=n&&""!==n&&(null==l.torrentDestinations&&(l.torrentDestinations=u.Z.floodSettings.torrentDestinations||{}),"string"==typeof(null==r?void 0:r[0])?l.torrentDestinations[r[0]]=n:l.torrentDestinations[""]=n),null!=i&&(l.UITorrentsAddTab=i),c.Z.saveSettings(l)};var m=n(9335),_=n(3529),p=n(5436);const f=e=>{const{actions:t}=e,n=t.map(((e,t)=>{let n=()=>{};return e.triggerDismiss&&(n=()=>{_.Z.setActiveModal(null)}),"checkbox"===e.type?(0,p.tZ)(d.XZ,{defaultChecked:e.checked,id:e.id,onClick:t=>{null!=e.clickHandler&&e.clickHandler(t),n()},children:e.content},t):(0,p.tZ)(d.zx,{isLoading:e.isLoading,onClick:t=>{null!=e.clickHandler&&e.clickHandler(t),n()},priority:e.type,type:e.submit?"submit":"button",children:e.content},t)})),r=(0,p.tZ)("div",{className:"modal__button-group",children:n});return(0,p.tZ)("div",{className:"modal__actions",children:r})},g=e=>{let{isAddingTorrents:t,onAddTorrentsClick:n}=e;const{i18n:r}=(0,s.mV)();return(0,p.tZ)(f,{actions:[{checked:Boolean(u.Z.floodSettings.startTorrentsOnLoad),clickHandler:null,content:r._("torrents.add.start.label"),id:"start",triggerDismiss:!1,type:"checkbox"},{clickHandler:null,content:r._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:n,content:r._("torrents.add.button.add"),isLoading:t,submit:!0,triggerDismiss:!1,type:"primary"}]})};var b=n(3279),Z=n.n(b),v=n(4656),y=n(4916),C=n(917),w=n(4166),k=n(6281),O=n(4557),N=n(5051),S=n(932);const P="#5E728C",x={name:"1pkdvdx",styles:"padding:3px 9px"},j=(0,C.iv)({borderBottom:`1px solid ${(0,w.$n)(.43,P)}`,marginBottom:"3px",paddingBottom:"3px",opacity:.75,"&:last-child":{marginBottom:0}},"",""),B=(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"}}]},"",""),D=(0,C.iv)({color:(0,w.p_)(.1,(0,w._j)(.15,P)),background:(0,w.m4)(P,.1),button:{":focus":{outline:"none",WebkitTapHighlightColor:"transparent"}}},"",""),X=(0,C.iv)({opacity:1,cursor:"pointer",transition:"background 0.25s, color 0.25s",userSelect:"none","&:hover":D,"&:focus-within":D},"",""),T={EACCES:"filesystem.error.eacces",ENOENT:"filesystem.error.enoent"};var E={name:"kol7nt",styles:"transform:scale(0.75) rotate(180deg)"},M={name:"1089mxj",styles:"white-space:pre-wrap"},V={name:"1ityoz",styles:"font-weight:lighter"};const I=(0,o.memo)((e=>{let{directory:t,selectable:n,onItemSelection:r,onYieldFocus:i}=e;const[l,a]=(0,o.useState)(null),[d,c]=(0,o.useState)(null),[u,h]=(0,o.useState)(t.includes("/")?"/":"\\"),[m,_]=(0,o.useState)(null),[f,g]=(0,o.useState)(null),b=(0,o.useRef)(null),Z=t.lastIndexOf(u)+1,v=Z>0?t.substr(0,Z):t,w=t.substr(Z);(0,o.useEffect)((()=>{v&&(a(null),_(null),g(null),N.Z.fetchDirectoryList(v).then((e=>{let{files:t,directories:n,separator:r}=e;_(n),g(t),h(r),c(null)})).catch((e=>{let{response:t}=e;c(t)})))}),[v]),(0,o.useEffect)((()=>{if(null!=b.current&&null!=l){var e;const t=null===(e=b.current.children[l])||void 0===e?void 0:e.children[0];0===(null==t?void 0:t.tabIndex)?t.focus():a(Array.from(b.current.children).findIndex((e=>0===e.children[0].tabIndex)))}}),[l]),(0,O.Z)("ArrowUp",(e=>{e.preventDefault(),a((e=>null==e||e-1<0?(null==i||i(),null):e-1))})),(0,O.Z)("ArrowDown",(e=>{e.preventDefault(),a((e=>null!=e?e+1:0))}));let D=null,I=[];if((null==m&&"directories"===n||null==f&&"files"===n)&&(D="filesystem.fetching"),d&&d.data&&d.data.code&&(D=T[d.data.code]||"filesystem.error.unknown"),t){const e=`${v.split(u).slice(0,-2).join(u)}${u}`,t=(0,p.tZ)("li",{css:[B,X,{"@media (max-width: 720px)":j},"",""],children:(0,p.BX)("button",{type:"button",onClick:()=>null==r?void 0:r(e,!0),children:[(0,p.tZ)(y.Eh,{css:E}),".."]})},e),i="files"!==n,l=w?(0,S.Z)(m,(e=>e),w):[],a=l.includes(w)||"directories"!==n||!w||D?[]:(()=>{const e=`${v}${w}${u}`;return[(0,p.tZ)("li",{css:[B,X,"font-weight:bold;@media (max-width: 720px){display:none;}",""],children:(0,p.BX)("button",{type:"button",onClick:()=>null==r?void 0:r(e,!1),children:[(0,p.tZ)(y.Pl,{}),(0,p.tZ)("span",{css:M,children:w}),(0,p.BX)("em",{css:V,children:[" - ",(0,p.tZ)(s.cC,{id:"filesystem.error.enoent"})]})]})},e)]})(),o=(null==m?void 0:m.length)&&(0,k.DY)(m.slice()).desc((e=>l.includes(e))).map((e=>{const t=`${v}${e}${u}`;return(0,p.tZ)("li",{css:[B,i?X:void 0,l.includes(e)?{fontWeight:"bold"}:void 0,"",""],children:(0,p.BX)("button",{type:"button",disabled:!i,tabIndex:i?0:-1,onClick:i?()=>null==r?void 0:r(t,!0):void 0,children:[(0,p.tZ)(y.Bm,{}),e]})},t)}))||[],d="directories"!==n,c=w?(0,S.Z)(f,(e=>e),w):[],h=(null==f?void 0:f.length)&&(0,k.DY)(f.slice()).desc((e=>c.includes(e))).map((e=>{const t=`${v}${e}`;return(0,p.tZ)("li",{css:[B,d?X:void 0,c.includes(e)?{fontWeight:"bold"}:void 0,"",""],children:(0,p.BX)("button",{type:"button",disabled:!d,tabIndex:d?0:-1,onClick:d?()=>null==r?void 0:r(t,!1):void 0,children:[(0,p.tZ)(y.$B,{}),e]})},t)}))||[];0!==o.length||0!==h.length||D||(D="filesystem.empty.directory"),I=[t,...a,...o,...h]}else D="filesystem.error.no.input";return(0,p.BX)("div",{css:(0,C.iv)({color:P,listStyle:"none",padding:"3px 0px",".icon":{fill:"currentColor",height:"14px",width:"14px",marginRight:"5px",marginTop:"-3px",verticalAlign:"middle"}},"",""),children:[v&&(0,p.BX)("li",{css:[B,j,x,"white-space:pre-wrap;.icon{transform:scale(0.9);margin-top:-2px !important;}@media (max-width: 720px){display:none;}",""],children:[(0,p.tZ)(y.DB,{}),v]}),(0,p.tZ)("ul",{ref:b,children:I}),D&&(0,p.tZ)("div",{css:[B,x,"opacity:1;",""],children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:D})})})]})}));I.defaultProps={selectable:void 0,onItemSelection:void 0,onYieldFocus:void 0};const R=I,L=(0,o.forwardRef)(((e,t)=>{var n,r;let{id:i,label:l,selectable:a,suggested:c,showBasePathToggle:h,showCompletedToggle:m,showSequentialToggle:_,onChange:f}=e;const[g,b]=(0,o.useState)(c||(null===(n=u.Z.floodSettings.torrentDestinations)||void 0===n?void 0:n[""])||(null===(r=u.Z.clientSettings)||void 0===r?void 0:r.directoryDefault)||""),[C,w]=(0,o.useState)(!1),k=(0,o.useRef)(null),O=(0,v.Z)(t),{i18n:N}=(0,s.mV)();(0,o.useEffect)((()=>{const e=()=>{w(!1)},t=t=>{var n;null!==(n=k.current)&&void 0!==n&&n.contains(t.target)||e()};return document.addEventListener("click",t),window.addEventListener("resize",e),()=>{document.removeEventListener("click",t),window.removeEventListener("resize",e)}}),[]);const S=[];return h&&S.push((0,p.tZ)(d.XZ,{grow:!1,id:"isBasePath",children:(0,p.tZ)(s.cC,{id:"torrents.destination.base_path"})},"isBasePath")),m&&S.push((0,p.tZ)(d.XZ,{grow:!1,id:"isCompleted",children:(0,p.tZ)(s.cC,{id:"torrents.destination.completed"})},"isCompleted")),_&&S.push((0,p.tZ)(d.XZ,{grow:!1,id:"isSequential",children:(0,p.tZ)(s.cC,{id:"torrents.destination.sequential"})},"isSequential")),(0,p.BX)(d.y1,{ref:k,children:[(0,p.tZ)(d.p7,{children:(0,p.BX)(d.fE,{autoComplete:C?"off":void 0,addonPlacement:"after",defaultValue:g,id:i,label:l,onChange:Z()((()=>{if(null==O.current)return;const e=O.current.value;f&&f(e),b(e)}),100,{leading:!0}),onClick:e=>e.nativeEvent.stopImmediatePropagation(),placeholder:N._("torrents.add.destination.placeholder"),ref:O,children:[(0,p.tZ)(d.G5,{onClick:()=>{null!=O.current&&b(O.current.value),w(!C)},children:(0,p.tZ)(y.ol,{})}),(0,p.tZ)(d.h_,{children:(0,p.tZ)(d.xV,{isIn:C,onClick:e=>e.nativeEvent.stopImmediatePropagation(),overlayProps:{isInteractive:!1},padding:!1,triggerRef:O,children:(0,p.tZ)(R,{directory:g,selectable:a,onItemSelection:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];null!=O.current&&(O.current.value=e),w(t),b(e)},onYieldFocus:()=>{var e;null===(e=O.current)||void 0===e||e.focus()}})})})]})}),S.length>0?(0,p.tZ)(d.p7,{children:S}):null]})}));L.defaultProps={label:void 0,selectable:void 0,suggested:void 0,showBasePathToggle:!1,showCompletedToggle:!1,showSequentialToggle:!1,onChange:void 0};const F=L;var $=n(4184),U=n.n($),z=n(8232);const A=e=>{let{defaultValue:t,placeholder:n,id:r,label:i,onTagSelected:l}=e;const[c,h]=(0,o.useState)(!1),[m,_]=(0,o.useState)(t??[]),f=(0,o.useRef)(null),g=(0,o.useRef)(null),b=(0,o.useRef)(null),Z=U()("select form__element",{"select--is-open":c});return(0,a.Z)("Escape",(e=>{e.preventDefault(),h(!1)})),(0,o.useEffect)((()=>{const e=e=>{var t;null!==(t=f.current)&&void 0!==t&&t.contains(e.target)||h(!1)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}),[]),(0,o.useEffect)((()=>{null!=b.current&&(b.current.value=m.join()),l&&l(m)}),[m,l]),(0,p.tZ)(d.U2,{ref:f,children:(0,p.tZ)("div",{className:Z,children:(0,p.BX)(d.fE,{autoComplete:c?"off":void 0,id:r||"tags",addonPlacement:"after",defaultValue:t,label:i,onChange:()=>{if(null!=b.current){let e=b.current.value.split(",").map((e=>e.trim())).filter((e=>e.length>0));b.current.value.trimEnd().endsWith(",")&&(e.push(""),e=[...new Set(e)]),_(e)}},placeholder:n,ref:b,children:[(0,p.tZ)(d.G5,{onClick:()=>{h(!c)},className:"select__indicator",children:(0,p.tZ)(y.Tt,{})}),(0,p.tZ)(d.h_,{children:(0,p.tZ)(d.xV,{isIn:c,onClick:e=>{"single"!==u.Z.floodSettings.UITagSelectorMode&&e.nativeEvent.stopImmediatePropagation()},overlayProps:{isInteractive:!1},ref:g,triggerRef:b,children:[...new Set(["untagged",...(0,k.DY)(Object.keys(z.Z.taxonomy.tagCounts)).asc(),...m])].reduce(((e,t)=>(""===t||e.push((0,p.tZ)(d.Ql,{id:t,isSelected:m.includes(t),onClick:()=>{"untagged"===t?_([]):m.includes(t)?_(m.filter((e=>e!==t&&""!==e))):_([...m.filter((e=>""!==e)),t])},children:"untagged"===t?(0,p.tZ)(s.cC,{id:"filter.untagged"}):t},t)),e)),[])})})]})})})};A.defaultProps={id:"tags",label:void 0,defaultValue:void 0,placeholder:void 0,onTagSelected:void 0};const H=A,q=(e,t)=>Object.keys(e).reduce(((n,r)=>{if(r.startsWith(t)){const t=e[r];null!=t&&n.push(t)}return n}),[]),G=e=>{let{defaultValues:t,id:n,label:r,placeholder:i}=e;const l=(0,o.useRef)(0),[a,s]=(0,o.useState)(t??[{id:0,value:""}]);return(0,p.tZ)(d.y1,{children:a.map(((e,t)=>{let o=null;return t>0&&(o=(0,p.tZ)(d.G5,{onClick:()=>{const e=a.slice();e.splice(t,1),s(e)},children:(0,p.tZ)(y.eJ,{})})),(0,p.tZ)(d.p7,{children:(0,p.BX)(d.fE,{addonPlacement:"after",id:`${n}-${e.id}`,defaultValue:e.value,label:0===t&&r,placeholder:i,wrapperClassName:"textbox-repeater",children:[(0,p.tZ)(d.G5,{onClick:()=>{l.current+=1;const e=a.slice();e.splice(t+1,0,{id:l.current,value:""}),s(e)},children:(0,p.tZ)(y.Rb,{})}),o]})},e.id)}))})};G.defaultProps={defaultValues:void 0,label:void 0,placeholder:void 0};const Q=G,W=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(!1);return(0,p.BX)(d.l0,{className:"inverse",ref:e,children:[(0,p.tZ)(F,{id:"sourcePath",label:t._("torrents.create.source.path.label")}),(0,p.tZ)(Q,{id:"trackers",label:t._("torrents.create.trackers.label"),placeholder:t._("torrents.create.tracker.input.placeholder"),defaultValues:[{id:0,value:""}]}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"name",label:t._("torrents.create.base.name.label"),placeholder:t._("torrents.create.base.name.input.placeholder")})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"comment",label:t._("torrents.create.comment.label"),placeholder:t._("torrents.create.comment.input.placeholder")})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"infoSource",label:t._("torrents.create.info.source.label"),placeholder:t._("torrents.create.info.source.input.placeholder")})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.XZ,{grow:!1,id:"isPrivate",children:t._("torrents.create.is.private.label")})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(H,{id:"tags",label:t._("torrents.add.tags"),placeholder:t._("torrents.create.tags.input.placeholder")})}),(0,p.tZ)(g,{onAddTorrentsClick:()=>{if(null==e.current)return;const t=e.current.getFormData();r(!0),null!=t.sourcePath&&(m.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((()=>{_.Z.setActiveModal(null)})),h({start:t.start,destination:t.sourcePath,tab:"by-creation"}))},isAddingTorrents:n})]})};var Y=n(463);function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){ee(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const te=e=>{let{onFilesChanged:t}=e;const[n,r]=(0,o.useState)([]);return(0,o.useEffect)((()=>{t(n)}),[n,t]),(0,p.BX)(d.U2,{children:[(0,p.tZ)("span",{className:"form__element__label",children:(0,p.tZ)(s.cC,{id:"torrents.add.torrents.label"})}),n.length>0?(0,p.tZ)("div",{onClick:e=>{e.stopPropagation()},role:"none",children:(0,p.tZ)("ul",{className:"dropzone__selected-files interactive-list",children:n.map(((e,t)=>(0,p.BX)("li",{className:"dropzone__selected-files__file interactive-list__item",title:e.name,children:[(0,p.tZ)("span",{className:"interactive-list__icon",children:(0,p.tZ)(y.$B,{})}),(0,p.tZ)("span",{className:"interactive-list__label",children:e.name}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>{const e=n.slice();e.splice(t,1),r(e)},children:(0,p.tZ)(y.x8,{})})]},e.name)))})}):null,(0,p.tZ)(Y.ZP,{onDrop:e=>{const t=[];e.forEach((i=>{const l=new FileReader;l.onload=l=>{var a;null!=(null===(a=l.target)||void 0===a?void 0:a.result)&&"string"==typeof l.target.result&&t.push({name:i.name,data:l.target.result.split("base64,")[1]}),t.length===e.length&&r(n.concat(t))},l.readAsDataURL(i)}))},children:e=>{let{getRootProps:t,getInputProps:n,isDragActive:r}=e;return(0,p.BX)("div",K(K({},t()),{},{className:"form__dropzone dropzone interactive-list "+(r?"dropzone--is-dragging":""),children:[(0,p.tZ)("input",K({},n())),(0,p.BX)("div",{className:"dropzone__copy",children:[(0,p.tZ)("div",{className:"dropzone__icon",children:(0,p.tZ)(y.hv,{})}),(0,p.tZ)(s.cC,{id:"torrents.add.tab.file.drop"})," ",(0,p.tZ)("span",{className:"dropzone__browse-button",children:(0,p.tZ)(s.cC,{id:"torrents.add.tab.file.browse"})}),"."]})]}))}})]})},ne=()=>{const e=(0,o.useRef)([]),t=(0,o.useRef)(null),n=(0,o.useRef)(null),[r,i]=(0,o.useState)(!1),{i18n:l}=(0,s.mV)();return(0,p.BX)(d.l0,{className:"inverse",ref:t,children:[(0,p.tZ)(d.p7,{children:(0,p.tZ)(te,{onFilesChanged:t=>{e.current=t}})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(H,{label:l._("torrents.add.tags"),id:"tags",onTagSelected:e=>{if(null!=n.current){var t;const r=null===(t=u.Z.floodSettings.torrentDestinations)||void 0===t?void 0:t[e[0]];"string"==typeof r&&null!=n.current&&(n.current.value=r,n.current.dispatchEvent(new Event("input",{bubbles:!0})))}}})}),(0,p.tZ)(F,{id:"destination",label:l._("torrents.add.destination.label"),ref:n,selectable:"directories",showBasePathToggle:!0,showCompletedToggle:!0,showSequentialToggle:!0}),(0,p.tZ)(g,{onAddTorrentsClick:()=>{var n;if(null==t.current)return;const r=null===(n=t.current)||void 0===n?void 0:n.getFormData();i(!0);const{destination:l,start:a,tags:s,isBasePath:o,isCompleted:d,isSequential:c}=r,u=[];if(e.current.forEach((e=>{u.push(e.data)})),0===u.length||null==l)return void i(!1);const p=null!=s?s.split(",").filter((e=>e.length>0)):void 0;m.Z.addTorrentsByFiles({files:u,destination:l,tags:p,isBasePath:o,isCompleted:d,isSequential:c,start:a}).then((()=>{_.Z.setActiveModal(null)})),h({start:a,destination:l,tags:p,tab:"by-file"})},isAddingTorrents:r})]})};var re=n(4355);var ie={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 ae=()=>{var e,t;const n=(0,o.useRef)(null),r=(0,o.useRef)(null),[i,l]=(0,o.useState)(!1),{i18n:a}=(0,s.mV)();return(0,p.BX)(d.l0,{className:"inverse",ref:n,children:[(0,p.tZ)(Q,{id:"urls",label:(0,p.BX)("div",{children:[a._("torrents.add.torrents.label"),"function"==typeof navigator.registerProtocolHandler&&(0,p.tZ)("button",{css:ie,type:"button",onClick:()=>{"function"==typeof navigator.registerProtocolHandler&&navigator.registerProtocolHandler("magnet",`${re.Z.baseURI}?action=add-urls&url=%s`)},children:(0,p.tZ)("em",{css:le,children:a._("torrents.add.tab.url.register.magnet.handler")})})]}),placeholder:a._("torrents.add.tab.url.input.placeholder"),defaultValues:"add-torrents"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)&&(null===(t=_.Z.activeModal)||void 0===t?void 0:t.initialURLs)||[{id:0,value:""}]}),(0,p.tZ)(Q,{id:"cookies",label:a._("torrents.add.cookies.label"),placeholder:a._("torrents.add.cookies.input.placeholder")}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(H,{id:"tags",label:a._("torrents.add.tags"),onTagSelected:e=>{if(null!=r.current){var t;const n=null===(t=u.Z.floodSettings.torrentDestinations)||void 0===t?void 0:t[e[0]];"string"==typeof n&&null!=r.current&&(r.current.value=n,r.current.dispatchEvent(new Event("input",{bubbles:!0})))}}})}),(0,p.tZ)(F,{id:"destination",label:a._("torrents.add.destination.label"),ref:r,selectable:"directories",showBasePathToggle:!0,showCompletedToggle:!0,showSequentialToggle:!0}),(0,p.tZ)(g,{onAddTorrentsClick:()=>{if(null==n.current)return;const e=n.current.getFormData();l(!0);const t=q(e,"urls").filter((e=>""!==e));if(0===t.length||null==e.destination)return void l(!1);const r=q(e,"cookies"),i=t[0].startsWith("http")&&t[0].split("/")[2],a=i?{[i]:r}:void 0,s=null!=e.tags?e.tags.split(",").filter((e=>e.length>0)):void 0;m.Z.addTorrentsByUrls({urls:t,cookies:a,destination:e.destination,isBasePath:e.isBasePath,isCompleted:e.isCompleted,isSequential:e.isSequential,start:e.start,tags:s}).then((()=>{_.Z.setActiveModal(null)})),h({start:e.start,destination:e.destination,tags:s,tab:"by-url"})},isAddingTorrents:i})]})};var se={name:"1gxvag8",styles:":focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"};const oe=e=>{const{activeTabId:t,tabs:n={},onTabChange:r}=e;return(0,p.tZ)("ul",{className:"modal__tabs",children:Object.keys(n).map((e=>{const i=n[e];i.id=e;const l=U()("modal__tab",{"is-active":e===t});return(0,p.tZ)("li",{className:l,children:(0,p.tZ)("button",{css:se,type:"button",onClick:()=>{r&&r(i)},children:i.label})},e)}))})};oe.defaultProps={tabs:{}};const de=oe;function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach((function(t){he(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function he(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const me=e=>{const{alignment:t,size:n,orientation:r,tabsInBody:i,inverse:l,initialTabId:a,className:s,content:d,heading:c,tabs:u,actions:h}=e,m=U()("modal__content__wrapper",`modal--align-${t}`,`modal--size-${n}`,{"modal--horizontal":"horizontal"===r,"modal--vertical":"vertical"===r,"modal--tabs-in-header":!i,"modal--tabs-in-body":i,inverse:l},s);let _=d;const g=c,b=U()("modal__header",{"has-tabs":u});let Z,v,y;const[C,w]=(0,o.useState)(a??Object.keys(u||{})[0]);if(u){const e=u[C],t=U()("modal__content",e.modalContentClasses),n=e.content,r=e.props,l=(0,p.tZ)(de,{activeTabId:C,onTabChange:e=>{null!=e.id&&w(e.id)},tabs:u},"modal-tabs");i?Z=l:y=l,_=[Z,(0,p.tZ)("div",{className:t,children:(0,p.tZ)(n,ue({},r))},"modal-content")]}return h&&(v=(0,p.tZ)("div",{className:"modal__footer",children:(0,p.tZ)(f,{actions:h})})),(0,p.BX)("div",{className:m,children:[(0,p.BX)("div",{className:b,children:[g,y]}),(0,p.BX)("div",{className:"modal__body",children:[_,v]})]})};me.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 _e=me,pe=()=>{var e,t;const{i18n:n}=(0,s.mV)(),r={"by-url":{content:ae,label:n._("torrents.add.tab.url.title")},"by-file":{content:ne,label:n._("torrents.add.tab.file.title")},"by-creation":{content:W,label:n._("torrents.add.tab.create.title")}};if("add-torrents"!==(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))return null;let i="by-url";return null!==(t=_.Z.activeModal.initialURLs)&&void 0!==t&&t.length||(i=u.Z.floodSettings.UITorrentsAddTab??i),(0,p.tZ)(_e,{heading:n._("torrents.add.heading"),tabs:r,initialTabId:i})},fe=(0,l.Pi)((()=>{var e;if("confirm"!==(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))return null;const{actions:t,content:n,heading:r}=_.Z.activeModal||{};return(0,p.tZ)(_e,{actions:t,content:(0,p.tZ)("div",{className:"modal__content",children:n}),heading:r})}));var ge=n(9669),be=n.n(ge),Ze=n(8949);function ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ye=new class{constructor(){ve(this,"feeds",[]),ve(this,"rules",[]),ve(this,"items",[]),(0,Ze.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:Ce}=re.Z,we={addFeed:e=>be().put(`${Ce}api/feed-monitor/feeds`,e).then((()=>we.fetchFeedMonitors())),modifyFeed:(e,t)=>be().patch(`${Ce}api/feed-monitor/feeds/${e}`,t).then((()=>we.fetchFeedMonitors())),addRule:e=>be().put(`${Ce}api/feed-monitor/rules`,e).then((()=>we.fetchFeedMonitors())),fetchFeedMonitors:()=>be().get(`${Ce}api/feed-monitor`).then((e=>{let{data:t}=e;ye.handleFeedMonitorsFetchSuccess(t)}),(()=>{})),fetchItems:e=>{let{id:t,search:n}=e;return be().get(`${Ce}api/feed-monitor/feeds/${t}/items`,{params:{search:n}}).then((e=>{let{data:t}=e;ye.handleItemsFetchSuccess(t)}),(()=>{}))},removeFeedMonitor:e=>be().delete(`${Ce}api/feed-monitor/${e}`).then((()=>we.fetchFeedMonitors()),(()=>{}))},ke=we,Oe=/^(?:https?|ftp):\/\/.{1,}\.{1}.{1,}/,Ne=e=>null!=e&&""!==e,Se=e=>{try{new RegExp(e)}catch(e){return!1}return!0},Pe=e=>{var t;let{rule:n,isSubmitting:r,isPatternMatched:i,onCancel:l}=e;const{feeds:a}=ye,{i18n:o}=(0,s.mV)();return(0,p.BX)(d.y1,{children:[(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"label",label:o._("feeds.label"),defaultValue:n.label}),(0,p.tZ)(d.Ph,{disabled:!a.length,id:"feedID",label:o._("feeds.applicable.feed"),defaultID:null===(t=n.feedIDs)||void 0===t?void 0:t[0],children:0===a.length?[(0,p.tZ)(d.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:"feeds.no.feeds.available"})})},"empty")]:a.reduce(((e,t)=>e.concat((0,p.tZ)(d.Ql,{id:`${t._id}`,children:t.label},t._id))),[(0,p.tZ)(d.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:"feeds.select.feed"})})},"select-feed")])})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"match",label:o._("feeds.match.pattern"),placeholder:o._("feeds.regEx"),defaultValue:n.match,width:"three-eighths"}),(0,p.tZ)(d.fE,{id:"exclude",label:o._("feeds.exclude.pattern"),placeholder:o._("feeds.regEx"),defaultValue:n.exclude,width:"three-eighths"})]}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{addonPlacement:"after",id:"check",label:o._("feeds.test.match"),placeholder:o._("feeds.check"),children:i&&(0,p.tZ)(d.G5,{children:(0,p.tZ)(y.FV,{})})})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.U2,{children:(0,p.tZ)(F,{id:"destination",label:o._("feeds.torrent.destination"),selectable:"directories",suggested:n.destination,showBasePathToggle:!0})}),(0,p.tZ)(H,{id:"tags",label:o._("feeds.apply.tags"),placeholder:o._("feeds.tags"),defaultValue:n.tags})]}),(0,p.BX)(d.p7,{align:"end",justify:"end",children:[(0,p.tZ)("br",{}),(0,p.tZ)(d.XZ,{id:"startOnLoad",defaultChecked:n.startOnLoad,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"feeds.start.on.load"})}),(0,p.tZ)(d.zx,{onClick:l,children:(0,p.tZ)(s.cC,{id:"button.cancel"})}),(0,p.tZ)(d.zx,{type:"submit",isLoading:r,children:(0,p.tZ)(s.cC,{id:"button.save.feed"})})]})]})},xe=e=>{let{children:t}=e;return(0,p.tZ)("h2",{className:"h4",children:t})},je=(0,l.Pi)((e=>{let{currentRule:t,onSelect:n,onRemove:r}=e;const{rules:i}=ye;return 0===i.length?(0,p.tZ)("ul",{className:"interactive-list",children:(0,p.tZ)("li",{className:"interactive-list__item",children:(0,p.tZ)(s.cC,{id:"feeds.no.rules.defined"})})}):(0,p.tZ)("ul",{className:"interactive-list",children:i.map((e=>{const i=e.count||0;let l=null,a=null;if(e.exclude&&(l=(0,p.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:[(0,p.tZ)(s.cC,{id:"feeds.exclude"}),": ",e.exclude]})),e.tags&&e.tags.length>0){const t=e.tags.map((e=>(0,p.tZ)("span",{className:"tag",children:e},e)));a=(0,p.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:[(0,p.tZ)(s.cC,{id:"feeds.tags"}),": ",t]})}return(0,p.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content",children:[(0,p.BX)("div",{className:"interactive-list__label",children:[(0,p.BX)("ul",{className:"interactive-list__detail-list",children:[(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:e.label}),(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--secondary",children:(0,p.tZ)(s.cC,{id:"feeds.match.count",values:{count:i}})}),e===t&&(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:"Modifying"})]}),(0,p.BX)("ul",{className:"interactive-list__detail-list",children:[(0,p.BX)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",style:{maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,p.tZ)(s.cC,{id:"feeds.match"}),": ",e.match]}),(0,p.tZ)("div",{style:{width:"100%"}}),l,a]})]}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action",type:"button",onClick:()=>n(e),children:(0,p.tZ)(y.I8,{})}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>r(e),children:(0,p.tZ)(y.x8,{})})]},e._id)}))})})),Be=je;function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){Te(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Te(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ee={label:"",feedIDs:[],match:"",exclude:"",tags:[],destination:"",startOnLoad:!1},Me={destination:{isValid:Ne,error:"feeds.validation.must.specify.destination"},feedID:{isValid:e=>Ne(e)&&"placeholder"!==e,error:"feeds.validation.must.select.feed"},label:{isValid:Ne,error:"feeds.validation.must.specify.label"},match:{isValid:e=>Ne(e)&&Se(e),error:"feeds.validation.invalid.regular.expression"},exclude:{isValid:e=>!Ne(e)||Se(e),error:"feeds.validation.invalid.regular.expression"}},Ve=(e,t)=>{var n,r;return null!==(n=Me[e])&&void 0!==n&&n.isValid(t)||null===(r=Me[e])||void 0===r?void 0:r.error},Ie=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(null),[i,l]=(0,o.useState)({}),[a,c]=(0,o.useState)(!1),[u,h]=(0,o.useState)(!1),[m,_]=(0,o.useState)(!1),[f,g]=(0,o.useState)(!1);return(0,p.BX)(d.l0,{className:"inverse",onChange:e=>{let{event:t,formData:n}=e;const r=t.target.name,a=n;l(Xe(Xe({},i),{},{[r]:Ve(r,a[r])})),g((()=>{const{check:e,match:t="",exclude:n=""}=a;if(Ne(e)&&Se(t)&&Se(n)){const r=new RegExp(t,"gi").test(e),i=""!==n&&new RegExp(n,"gi").test(e);return r&&!i}return!1})()),_(!0)},onSubmit:async()=>{if(null==e.current)return;const t=e.current.getFormData(),i=Object.keys(Me).reduce(((e,n)=>{const r=n;return Xe(Xe({},e),{},{[r]:Ve(r,t[r])})}),{});l(i);const a=Object.keys(i).every((e=>void 0===i[e]));var s;m&&a&&(h(!0),null!=(null==n?void 0:n._id)&&await ke.removeFeedMonitor(n._id),await ke.addRule({label:t.label??Ee.label,feedIDs:[t.feedID??""],field:t.field,match:t.match??Ee.match,exclude:t.exclude??Ee.exclude,destination:t.destination??Ee.destination,tags:(null===(s=t.tags)||void 0===s?void 0:s.split(","))??Ee.tags,startOnLoad:t.startOnLoad??Ee.startOnLoad,isBasePath:t.isBasePath??!1}).then((()=>{var t;null===(t=e.current)||void 0===t||t.resetForm(),l({}),r(null),c(!1)}),(()=>{l({backend:"general.error.unknown"})})),h(!1))},ref:e,children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"feeds.existing.rules"})}),Object.keys(i).reduce(((e,n)=>(null!=i[n]&&e.push((0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:t._(null==i?void 0:i[n])})},`error-${n}`)),e)),[]),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.U2,{children:(0,p.tZ)(Be,{currentRule:n,onSelect:e=>{r(e),c(!0)},onRemove:e=>{null!=e._id&&ke.removeFeedMonitor(e._id),e===n&&(r(null),c(!1))}})})}),a?(0,p.tZ)(Pe,{rule:n??Ee,isPatternMatched:f,isSubmitting:u,onCancel:()=>{r(null),c(!1)}},(null==n?void 0:n._id)||"initial"):(0,p.BX)(d.p7,{align:"end",justify:"end",children:[(0,p.tZ)("br",{}),(0,p.tZ)(d.zx,{onClick:()=>{c(!0)},children:(0,p.tZ)(s.cC,{id:"button.new"})})]})]})},Re=e=>{let{currentFeed:t,defaultFeed:n,intervalMultipliers:r,isSubmitting:i,onCancel:l}=e;const{i18n:a}=(0,s.mV)(),o=(null==t?void 0:t.interval)??n.interval;let c=o,u=1;return r.forEach((e=>{const t=e.value;o%t==0&&(c=o/t,u=t)})),(0,p.BX)(d.y1,{children:[(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"label",label:a._("feeds.label"),placeholder:a._("feeds.label"),defaultValue:(null==t?void 0:t.label)??n.label}),(0,p.tZ)(d.fE,{id:"interval",label:a._("feeds.select.interval"),placeholder:a._("feeds.interval"),defaultValue:c,width:"one-eighth"}),(0,p.tZ)(d.Ph,{labelOffset:!0,defaultID:u,id:"intervalMultiplier",width:"one-eighth",children:r.map((e=>(0,p.tZ)(d.Ql,{id:e.value,children:a._(e.message)},e.value)))})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"url",label:a._("feeds.url"),placeholder:a._("feeds.url"),defaultValue:(null==t?void 0:t.url)??(null==n?void 0:n.url)}),(0,p.tZ)(d.zx,{labelOffset:!0,onClick:l,children:(0,p.tZ)(s.cC,{id:"button.cancel"})}),(0,p.tZ)(d.zx,{labelOffset:!0,type:"submit",isLoading:i,children:(0,p.tZ)(s.cC,{id:"button.save.feed"})})]})]})},Le=(0,l.Pi)((e=>{let{selectedFeedID:t}=e;const{items:n}=ye,r=[];if(t){const e={};n.forEach(((t,n)=>{let{title:i}=t;const l=e[i];null==l?e[i]=2:(i=`${i} #${l}`,e[i]+=1),r.push((0,p.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content feed-list__feed",children:[(0,p.tZ)("div",{className:"interactive-list__label feed-list__feed-label",children:i}),(0,p.tZ)(d.XZ,{id:`${n}`})]},i))}))}return(0,p.tZ)(d.p7,{children:0===r.length?(0,p.tZ)("ul",{className:"interactive-list",children:(0,p.tZ)("li",{className:"interactive-list__item",children:(0,p.tZ)("div",{className:"interactive-list__label",children:(0,p.tZ)(s.cC,{id:"feeds.no.items.matching"})})})}):(0,p.tZ)("ul",{className:"interactive-list feed-list",children:r})})})),Fe=Le,$e=(0,l.Pi)((()=>{const{i18n:e}=(0,s.mV)(),t=(0,o.useRef)(null),[n,r]=(0,o.useState)(null),{feeds:i}=ye;return null!=n&&(i.some((e=>e._id===n))||r(null)),(0,p.BX)(d.l0,{className:"inverse",onChange:e=>{let{event:t,formData:n}=e;const i=n;"checkbox"!==t.target.type&&(r(i.feedID),ke.fetchItems({id:i.feedID,search:i.search}))},onSubmit:()=>{if(null==t.current)return;const e=t.current.getFormData(),n=ye.items.filter(((t,n)=>e[n])).map(((e,t)=>({id:t,value:e.urls[0]})));_.Z.setActiveModal({id:"add-torrents",initialURLs:n})},ref:t,children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"feeds.browse.feeds"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.Ph,{disabled:!i.length,grow:!1,id:"feedID",label:e._("feeds.select.feed"),width:"three-eighths",children:i.length?i.reduce(((e,t)=>null==t._id?e:e.concat((0,p.tZ)(d.Ql,{id:t._id,children:t.label},t._id))),[(0,p.tZ)(d.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:"feeds.select.feed"})})},"select-feed")]):[(0,p.tZ)(d.Ql,{id:"placeholder",isPlaceholder:!0,children:(0,p.tZ)("em",{children:(0,p.tZ)(s.cC,{id:"feeds.no.feeds.available"})})},"empty")]}),n&&(0,p.tZ)(d.fE,{id:"search",label:e._("feeds.search.term"),placeholder:e._("feeds.search")}),n&&(0,p.tZ)(d.zx,{type:"submit",labelOffset:!0,children:(0,p.tZ)(s.cC,{id:"button.download"})},"button")]}),n&&(0,p.tZ)(Fe,{selectedFeedID:n})]})})),Ue=$e,ze=(0,l.Pi)((e=>{let{currentFeed:t,intervalMultipliers:n,onSelect:r,onRemove:i}=e;const{feeds:l}=ye,{i18n:a}=(0,s.mV)();return 0===l.length?(0,p.tZ)("ul",{className:"interactive-list",children:(0,p.tZ)("li",{className:"interactive-list__item",children:(0,p.tZ)(s.cC,{id:"feeds.no.feeds.defined"})})}):(0,p.tZ)("ul",{className:"interactive-list feed-list",children:l.map((e=>{const l=e.count||0;let o=`${e.interval}`,d=n[0].message;return n.forEach((t=>{e.interval%t.value==0&&(o=""+e.interval/t.value,d=t.message)})),(0,p.BX)("li",{className:"interactive-list__item interactive-list__item--stacked-content feed-list__feed",children:[(0,p.BX)("div",{className:"interactive-list__label",children:[(0,p.BX)("ul",{className:"interactive-list__detail-list",children:[(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:e.label}),(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--secondary",children:(0,p.tZ)(s.cC,{id:"feeds.match.count",values:{count:l}})}),e===t&&(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail--primary",children:"Modifying"})]}),(0,p.BX)("ul",{className:"interactive-list__detail-list",children:[(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail interactive-list__detail--tertiary",children:`${o} ${a._(d)}`}),(0,p.tZ)("li",{className:"interactive-list__detail-list__item interactive-list__detail-list__item--overflow interactive-list__detail interactive-list__detail--tertiary",children:(0,p.tZ)("a",{href:e.url,rel:"noopener noreferrer",target:"_blank",children:e.url})})]})]}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action",type:"button",onClick:()=>r(e),children:(0,p.tZ)(y.I8,{})}),(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>i(e),children:(0,p.tZ)(y.x8,{})})]},e._id)}))})})),Ae=ze;function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?He(Object(n),!0).forEach((function(t){Ge(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):He(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qe={url:{isValid:e=>null!=e&&""!==e&&null!==e.match(Oe),error:"feeds.validation.must.specify.valid.feed.url"},label:{isValid:Ne,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"}},We=(e,t)=>{var n,r;return null!==(n=Qe[e])&&void 0!==n&&n.isValid(t)||null===(r=Qe[e])||void 0===r?void 0:r.error},Ye=[{message:"feeds.time.min",value:1},{message:"feeds.time.hr",value:60},{message:"feeds.time.day",value:1440}],Je={label:"",interval:5,url:""},Ke=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(null),[i,l]=(0,o.useState)({}),[a,c]=(0,o.useState)(!1),[u,h]=(0,o.useState)(!1);return(0,p.BX)("div",{children:[(0,p.BX)(d.l0,{className:"inverse",onChange:e=>{let{event:t,formData:n}=e;const r=t.target.name,a=n;l(qe(qe({},i),{},{[r]:We(r,a[r])}))},onSubmit:async()=>{var t;const i=null===(t=e.current)||void 0===t?void 0:t.getFormData();if(null==e.current||null==i)return;h(!0);const a=Object.keys(Qe).reduce(((e,t)=>{const n=t;return qe(qe({},e),{},{[n]:We(n,i[n])})}),{});l(a);if(Object.keys(a).every((e=>void 0===a[e]))){const t={label:i.label,url:i.url,interval:Number(i.interval)*Number(i.intervalMultiplier)};let a=!0;try{null===n?await ke.addFeed(t):null!=(null==n?void 0:n._id)&&await ke.modifyFeed(n._id,t)}catch{a=!1}a?(e.current.resetForm(),l({}),r(null),c(!1)):l({backend:"general.error.unknown"})}h(!1)},ref:e,children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"feeds.existing.feeds"})}),Object.keys(i).reduce(((e,n)=>(null!=i[n]&&e.push((0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:t._(null==i?void 0:i[n])})},`error-${n}`)),e)),[]),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.U2,{children:(0,p.tZ)(Ae,{currentFeed:n,intervalMultipliers:Ye,onSelect:e=>{r(e),c(!0)},onRemove:e=>{e===n&&(a&&(l({}),c(!1)),r(null)),null!=e._id&&ke.removeFeedMonitor(e._id)}})})}),a?(0,p.tZ)(Re,{currentFeed:n,defaultFeed:Je,intervalMultipliers:Ye,isSubmitting:u,onCancel:()=>{l({}),c(!1),r(null)}},(null==n?void 0:n._id)||"initial"):(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.U2,{width:"auto"}),(0,p.tZ)(d.zx,{onClick:()=>{c(!0)},children:(0,p.tZ)(s.cC,{id:"button.new"})})]})]}),(0,p.tZ)(Ue,{})]})},et=()=>{const{i18n:e}=(0,s.mV)();(0,o.useEffect)((()=>{ke.fetchFeedMonitors()}),[]);const t={feeds:{content:Ke,label:e._("feeds.tabs.feeds")},downloadRules:{content:Ie,label:e._("feeds.tabs.download.rules")}};return(0,p.tZ)(_e,{heading:e._("feeds.tabs.heading"),orientation:"horizontal",size:"large",tabs:t})};var tt=n(4936);let nt;!function(e){e[e.HTTP=1]="HTTP",e[e.UDP=2]="UDP",e[e.DHT=3]="DHT"}(nt||(nt={}));const rt=(e,t)=>{let n=`magnet:?xt=urn:btih:${e}`;return null!=t&&t.length&&t.forEach((e=>{n=`${n}&tr=${encodeURI(e)}`})),n},it=()=>{var e;const t=(0,o.useRef)(null),n=(0,o.useRef)(null),{i18n:r}=(0,s.mV)(),[i,l]=(0,o.useState)(!1),[a,c]=(0,o.useState)(!1),[u,h]=(0,o.useState)({isLoadingTrackers:!0,magnetTrackersLink:""});(0,o.useEffect)((()=>{m.Z.fetchTorrentTrackers(tt.Z.selectedTorrents[0]).then((e=>{null!=e&&h({isLoadingTrackers:!1,magnetTrackersLink:rt(tt.Z.selectedTorrents[0],e.filter((e=>e.type!==nt.DHT)).map((e=>e.url)))})}))}),[]);const _=rt(tt.Z.selectedTorrents[0]);return(0,p.tZ)(_e,{heading:r._("torrents.generate.magnet.heading"),content:(0,p.tZ)("div",{className:"modal__content inverse",children:(0,p.BX)(d.l0,{children:[null!==(e=tt.Z.torrents[tt.Z.selectedTorrents[0]])&&void 0!==e&&e.isPrivate?(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:r._("torrents.generate.magnet.private.torrent")})}):null,(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"magnet",ref:t,addonPlacement:"after",label:r._("torrents.generate.magnet.magnet"),defaultValue:_,readOnly:!0,children:(0,p.tZ)(d.G5,{onClick:()=>{var e;if("function"==typeof(null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText))navigator.clipboard.writeText(_).then((()=>{l(!0)}));else if(null!=t.current){var n;null===(n=t.current)||void 0===n||n.select(),document.execCommand("copy"),l(!0)}},children:i?(0,p.tZ)(y.FV,{}):(0,p.tZ)(y.TU,{})})})}),(0,p.tZ)(d.p7,{children:u.isLoadingTrackers?(0,p.tZ)(d.fE,{id:"loading",label:r._("torrents.generate.magnet.magnet.with.trackers"),placeholder:r._("torrents.generate.magnet.loading.trackers"),disabled:!0}):(0,p.tZ)(d.fE,{id:"magnet-trackers",ref:n,addonPlacement:"after",label:r._("torrents.generate.magnet.magnet.with.trackers"),defaultValue:u.magnetTrackersLink,readOnly:!0,children:(0,p.tZ)(d.G5,{onClick:()=>{var e;if("function"==typeof(null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText))navigator.clipboard.writeText(u.magnetTrackersLink).then((()=>{c(!0)}));else if(null!=n.current){var t;null===(t=n.current)||void 0===t||t.select(),document.execCommand("copy"),c(!0)}},children:a?(0,p.tZ)(y.FV,{}):(0,p.tZ)(y.TU,{})})})})]})}),actions:[{clickHandler:null,content:r._("button.close"),triggerDismiss:!0,type:"tertiary"}]})},lt=e=>{const t=e[0];if(!e.some((e=>!e.includes(t))))return t},at=()=>{const{i18n:e}=(0,s.mV)(),[t,n]=(0,o.useState)(!1);return(0,p.tZ)(_e,{heading:e._("torrents.move.heading"),content:(0,p.tZ)("div",{className:"modal__content",children:(0,p.BX)(d.l0,{className:"inverse",onSubmit:e=>{let{formData:t}=e;const r=tt.Z.selectedTorrents;r.length>0&&(n(!0),m.Z.moveTorrents({hashes:r,destination:t.destination,isBasePath:t.isBasePath,moveFiles:t.moveFiles,isCheckHash:t.isCheckHash}).then((()=>{_.Z.setActiveModal(null),n(!1)})))},children:[(0,p.tZ)(F,{id:"destination",selectable:"directories",suggested:lt(tt.Z.selectedTorrents.map((e=>tt.Z.torrents[e].directory))),showBasePathToggle:!0}),(0,p.tZ)(f,{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"}]})]})})})},st=()=>{const{i18n:e}=(0,s.mV)(),[t,n]=(0,o.useState)(!1),{selectedTorrents:r}=tt.Z;return 0===r.length?(0,p.tZ)(_e,{heading:e._("torrents.remove"),content:(0,p.tZ)("div",{className:"modal__content inverse",children:(0,p.tZ)(d.l0,{children:(0,p.tZ)(d.p7,{children:(0,p.tZ)(s.cC,{id:"torrents.remove.error.no.torrents.selected"})})})}),actions:[{clickHandler:null,content:e._("button.ok"),triggerDismiss:!0,type:"primary"}]}):(0,p.tZ)(_e,{heading:e._("torrents.remove"),content:(0,p.tZ)("div",{className:"modal__content",children:(0,p.BX)(d.l0,{className:"inverse",onSubmit:e=>{let{formData:t}=e;n(!0);const r=t.deleteData;m.Z.deleteTorrents({hashes:tt.Z.selectedTorrents,deleteData:r}).then((()=>{n(!1),(e=>{let{deleteData:t}=e;null!=t&&c.Z.saveSetting("deleteTorrentData",t)})({deleteData:r}),_.Z.setActiveModal(null)}))},children:[(0,p.tZ)(d.p7,{children:(0,p.tZ)(s.cC,{id:"torrents.remove.are.you.sure",values:{count:r.length}})}),(0,p.tZ)(f,{actions:[{checked:u.Z.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"}]})]})})})},ot=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(!1);return(0,p.tZ)(_e,{heading:t._("torrents.set.tags.heading"),content:(0,p.tZ)("div",{className:"modal__content inverse",children:(0,p.tZ)(d.l0,{ref:e,children:(0,p.tZ)(d.p7,{children:(0,p.tZ)(H,{defaultValue:tt.Z.selectedTorrents.map((e=>tt.Z.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}=tt.Z,n=e.current.getFormData(),i=n.tags?n.tags.split(","):[];r(!0),(null==t?void 0:t.length)>0&&m.Z.setTags({hashes:t,tags:i})},isLoading:n,triggerDismiss:!1,type:"primary"}]})},dt=()=>{const e=(0,o.useRef)(null),{i18n:t}=(0,s.mV)(),[n,r]=(0,o.useState)(!1),[i,l]=(0,o.useState)({isLoadingTrackers:!0,trackerURLs:[]});return(0,o.useEffect)((()=>{m.Z.fetchTorrentTrackers(tt.Z.selectedTorrents[0]).then((e=>{null!=e&&l({isLoadingTrackers:!1,trackerURLs:e.filter((e=>e.type!==nt.DHT)).map((e=>e.url))})}))}),[]),(0,p.tZ)(_e,{heading:t._("torrents.set.trackers.heading"),content:(0,p.tZ)("div",{className:"modal__content inverse",children:(0,p.tZ)(d.l0,{ref:e,children:i.isLoadingTrackers?(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{id:"loading",placeholder:t._("torrents.set.trackers.loading.trackers"),disabled:!0})}):(0,p.tZ)(Q,{id:"trackers",placeholder:t._("torrents.set.trackers.enter.tracker"),defaultValues:0===i.trackerURLs.length?void 0:i.trackerURLs.map(((e,t)=>({id:t,value:e})))})})}),actions:[{clickHandler:null,content:t._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:()=>{if(null==e.current||n||i.isLoadingTrackers)return;r(!0);const t=e.current.getFormData(),l=q(t,"trackers").filter((e=>""!==e));m.Z.setTrackers({hashes:tt.Z.selectedTorrents,trackers:l}).then((()=>{r(!1),_.Z.setActiveModal(null)}))},content:t._("torrents.set.trackers.button.set"),isLoading:n||i.isLoadingTrackers,triggerDismiss:!1,type:"primary"}]})},ct=JSON.parse('{"i8":"0.0.0-master.657a94d"}'),ut=(0,o.lazy)((()=>n.e(443).then(n.t.bind(n,6641,23)).then((e=>({default:e.react}))))),ht="https://github.com/jesec/flood",mt=()=>(0,p.tZ)(o.Suspense,{fallback:null,children:(0,p.tZ)(ut,{FloodVersion:()=>ct.i8,CommitBadge:()=>ct.i8.length>8?(0,p.tZ)("a",{href:ht,children:(0,p.tZ)("img",{alt:"Latest version of rolling build",src:"https://img.shields.io/npm/v/@jesec/flood?label=HEAD"})}):(0,p.tZ)("a",{href:ht,children:(0,p.tZ)("img",{alt:"Commits since user's version",src:`https://img.shields.io/github/commits-since/jesec/flood/v${ct.i8}`})})})});var _t=n(8111),pt=n(2552),ft=n(2809),gt=n(4982);const bt=(0,l.Pi)((()=>{const e=(0,o.useRef)(null),t=(0,o.useRef)(null),[n,l]=(0,o.useState)(null),[a,c]=(0,o.useState)(!1),[u,h]=(0,o.useState)(!1),{i18n:m}=(0,s.mV)();if((0,o.useEffect)((()=>{pt.Z.currentUser.isAdmin&&_t.Z.fetchUsers().then((()=>{c(!0)}))}),[]),!pt.Z.currentUser.isAdmin)return(0,p.BX)(d.l0,{children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"auth.user.accounts"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:(0,p.tZ)(s.cC,{id:"auth.message.not.admin"})})})]});const _=!a&&0===pt.Z.users.length,f=U()("interactive-list",{"interactive-list--loading":_});return(0,p.BX)(d.l0,{onSubmit:()=>{if(null==e.current||null==t.current)return;const n=e.current.getFormData();if(null==n.username||""===n.username)l("auth.error.username.empty");else if(null==n.password||""===n.password)l("auth.error.password.empty");else{h(!0);const r=t.current;if(null==r)return l("connection.settings.error.empty"),void h(!1);_t.Z.createUser({username:n.username,password:n.password,client:r,level:!0===n.isAdmin?ft.u.ADMINISTRATOR:ft.u.USER}).then((()=>{null!=e.current&&e.current.resetForm(),l(null),h(!1)}),(()=>{l("general.error.unknown"),h(!1)})).then(_t.Z.fetchUsers)}},ref:e,children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"auth.user.accounts"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.U2,{children:(0,p.BX)("ul",{className:f,children:[(0,p.tZ)(i.Z,{children:_&&(0,p.tZ)(r.Z,{classNames:"interactive-list__loading-indicator",timeout:{enter:250,exit:250},children:(0,p.tZ)("div",{className:"interactive-list__loading-indicator",children:(0,p.tZ)(d.$z,{})},"loading-indicator")})}),pt.Z.users.slice().sort(((e,t)=>e.username.localeCompare(t.username))).map((e=>{const t=e.username===pt.Z.currentUser.username;let n=null,r=null;t?n=(0,p.tZ)("span",{className:"interactive-list__label__tag tag",children:(0,p.tZ)(s.cC,{id:"auth.current.user"})}):r=(0,p.tZ)("button",{className:"interactive-list__icon interactive-list__icon--action interactive-list__icon--action--warning",type:"button",onClick:()=>_t.Z.deleteUser(e.username).then(_t.Z.fetchUsers),children:(0,p.tZ)(y.x8,{})});const i=U()("interactive-list__item",{"interactive-list__item--disabled":t});return(0,p.BX)("li",{className:i,children:[(0,p.BX)("span",{className:"interactive-list__label",children:[(0,p.tZ)("div",{className:"interactive-list__label__text",children:e.username}),n]}),r]},e.username)}))]})})}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"auth.add.user"})}),n&&(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Xq,{children:m._(n)})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{id:"username",label:(0,p.tZ)(s.cC,{id:"auth.username"}),placeholder:m._("auth.username"),autoComplete:"username"}),(0,p.tZ)(d.fE,{id:"password",label:(0,p.tZ)(s.cC,{id:"auth.password"}),placeholder:m._("auth.password"),autoComplete:"new-password"}),(0,p.tZ)(d.XZ,{grow:!1,id:"isAdmin",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"auth.admin"})})]}),(0,p.tZ)(gt.Z,{onSettingsChange:e=>{t.current=e}}),(0,p.tZ)("p",{}),(0,p.tZ)(d.p7,{justify:"end",children:(0,p.tZ)(d.zx,{isLoading:u,priority:"primary",type:"submit",children:(0,p.tZ)(s.cC,{id:"button.add"})})})]})})),Zt=(e,t)=>{var n;return null!=e[t]?e[t]:null===(n=u.Z.clientSettings)||void 0===n?void 0:n[t]},vt=e=>{const t=e.target,n=t.name,{value:r,type:i,checked:l}=t;let a={};return a="checkbox"===i?{[n]:l}:{[n]:r},a};function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ct(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){wt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const kt=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)))},Nt=e=>{let{onSettingsChange:t,onClientSettingsChange:n}=e;const[r,i]=(0,o.useState)({});return(0,p.BX)(d.l0,{onChange:e=>{let{event:l,formData:a}=e;const s=l.target;if("dropdownPresetDownload"===s.name||"dropdownPresetUpload"===s.name)return void t({speedLimits:{download:Ot(a.dropdownPresetDownload),upload:Ot(a.dropdownPresetUpload)}});const o=Ct(Ct({},r),vt(l));i(o),n(o)},children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.heading"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:null!=u.Z.floodSettings.speedLimits?kt(u.Z.floodSettings.speedLimits.download):0,label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.dropdown.preset.download.label"}),id:"dropdownPresetDownload"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:null!=u.Z.floodSettings.speedLimits?kt(u.Z.floodSettings.speedLimits.upload):0,label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.dropdown.preset.upload.label"}),id:"dropdownPresetUpload"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleGlobalDownSpeed"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.global.throttle.download"}),id:"throttleGlobalDownSpeed"}),(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleGlobalUpSpeed"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.transferrate.global.throttle.upload"}),id:"throttleGlobalUpSpeed"})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.heading"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleMaxUploads"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.upload.label"}),id:"throttleMaxUploads"}),(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleMaxUploadsGlobal"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.upload.global.label"}),id:"throttleMaxUploadsGlobal"})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleMaxDownloads"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.download.label"}),id:"throttleMaxDownloads"}),(0,p.tZ)(d.fE,{defaultValue:Zt(r,"throttleMaxDownloadsGlobal"),label:(0,p.tZ)(s.cC,{id:"settings.bandwidth.slots.download.global.label"}),id:"throttleMaxDownloadsGlobal"})]})]})};function St(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?St(Object(n),!0).forEach((function(t){xt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):St(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const jt=e=>{let{onClientSettingsChange:t}=e;const[n,r]=(0,o.useState)({});return(0,p.BX)(d.l0,{onChange:e=>{let{event:i}=e;const l=Pt(Pt({},n),vt(i));r(l),t(l)},children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.connectivity.incoming.heading"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"networkPortRange"),id:"networkPortRange",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.port.range.label"}),width:"one-quarter"}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"networkPortRandom"),grow:!1,id:"networkPortRandom",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.connectivity.port.randomize.label"})}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"networkPortOpen"),grow:!1,id:"networkPortOpen",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.connectivity.port.open.label"})})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"networkLocalAddress"),id:"networkLocalAddress",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.ip.hostname.label"})}),(0,p.tZ)(d.fE,{defaultValue:Zt(n,"networkHttpMaxOpen"),id:"networkHttpMaxOpen",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.max.http.connections"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.connectivity.dpd.heading"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"dhtPort"),id:"dhtPort",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.dht.port.label"}),width:"one-quarter"}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"dht"),grow:!1,id:"dht",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.connectivity.dht.label"})}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"protocolPex"),grow:!1,id:"protocolPex",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.connectivity.peer.exchange.label"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.heading"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"throttleMinPeersNormal"),id:"throttleMinPeersNormal",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.min.label"})}),(0,p.tZ)(d.fE,{defaultValue:Zt(n,"throttleMaxPeersNormal"),id:"throttleMaxPeersNormal",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.max.label"})})]}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"throttleMinPeersSeed"),id:"throttleMinPeersSeed",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.seeding.min.label"})}),(0,p.tZ)(d.fE,{defaultValue:Zt(n,"throttleMaxPeersSeed"),id:"throttleMaxPeersSeed",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.seeding.max.label"})})]}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:Zt(n,"trackersNumWant"),id:"trackersNumWant",label:(0,p.tZ)(s.cC,{id:"settings.connectivity.peers.desired.label"}),width:"one-half"})})]})};var Bt=n(5181),Dt=n(8826),Xt=n(5587),Tt=n(9752),Et=n(2339),Mt=n(4285);function Vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function It(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(n),!0).forEach((function(t){Rt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Lt=e=>{const{children:t,id:n,disabled:r}=e,{attributes:i,setNodeRef:l,listeners:a,transform:s,transition:o,isDragging:d}=(0,Xt.nB)({id:n,disabled:r}),c={transform:Mt.ux.Transform.toString(s),transition:o};return(0,p.BX)("div",It(It(It({className:U()("sortable-list__item",{"sortable-list__item--is-dragging":d,"sortable-list__item--is-locked":r}),ref:l,style:c},i),a),{},{children:[r?(0,p.tZ)(y.HE,{}):null,t]}))};var Ft={name:"z45y2s",styles:"width:100%;touch-action:none"};const $t=e=>{let{className:t,items:n,lockedIDs:r,renderItem:i,onMouseDown:l,onDrop:a}=e;const[s,d]=(0,o.useState)(n),c=U()("sortable-list",t),u=(0,Tt.VT)(Tt.Lg),h=(0,Tt.VT)(Tt.MA,{activationConstraint:{distance:10}}),m=(0,Tt.VT)(Tt.LO,{activationConstraint:{distance:10}});return(0,p.tZ)("div",{css:Ft,role:"none",onMouseDown:e=>{l&&l(e)},children:(0,p.tZ)(Tt.LB,{sensors:[u,h,m],onDragEnd:e=>{let{active:t,over:r}=e;if(null==r)return;if(t.id===r.id)return;const i=(0,Xt.Rp)(n,n.findIndex((e=>e===t.id)),n.findIndex((e=>e===r.id)));d(i),a&&a(i)},modifiers:[Et.DL,Et.F4],autoScroll:!1,children:(0,p.tZ)(Xt.Fo,{items:s,strategy:Xt.qw,children:(0,p.tZ)("ul",{className:c,children:s.map(((e,t)=>(0,p.tZ)(Lt,{id:e,disabled:r.includes(e),children:i(e,t)},e)))})})})})};$t.defaultProps={onMouseDown:void 0,onDrop:void 0};const Ut=$t;function zt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function At(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zt(Object(n),!0).forEach((function(t){Ht(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const qt=e=>{let{onSettingsChange:t}=e;const[n,r]=(0,o.useState)((()=>{const{mountPoints:e}=u.Z.floodSettings,t=Object.assign({},...Dt.Z.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}))))})()),i=n.reduce(((e,t)=>{let{id:n,visible:r}=t;return e[n]=r,e}),{});return(0,p.tZ)(Ut,{className:"sortable-list--disks",items:n.map((e=>{let{id:t}=e;return t})),lockedIDs:[],onDrop:e=>{r(e.map((e=>({id:e,visible:i[e]}))))},renderItem:e=>{const l=(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,p.tZ)(d.XZ,{defaultChecked:i[e],id:e,onClick:l=>{i[e]=l.target.checked;const a=n.map((t=>t.id===e?At(At({},t),{},{visible:l.target.checked}):t));t({mountPoints:a.filter((e=>e.visible)).map((e=>e.id))}),r(a)},children:(0,p.tZ)(s.cC,{id:"settings.diskusage.show"})})});return(0,p.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,p.tZ)("div",{children:e})}),l]})}})},Gt=e=>{let{onSettingsChange:t}=e;return(0,p.BX)(d.l0,{children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.diskusage.mount.points"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(qt,{onSettingsChange:t})})]})};function Qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qt(Object(n),!0).forEach((function(t){Yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Jt=e=>{let{onClientSettingsChange:t}=e;const[n,r]=(0,o.useState)({});return(0,p.BX)(d.l0,{onChange:e=>{let{event:i}=e;const l=Wt(Wt({},n),vt(i));r(l),t(l)},children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.resources.disk.heading"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:Zt(n,"directoryDefault"),id:"directoryDefault",label:(0,p.tZ)(s.cC,{id:"settings.resources.disk.download.location.label"})})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.fE,{defaultValue:Zt(n,"networkMaxOpenFiles"),id:"networkMaxOpenFiles",label:(0,p.tZ)(s.cC,{id:"settings.resources.max.open.files"}),width:"one-half"}),(0,p.tZ)(d.XZ,{defaultChecked:Zt(n,"piecesHashOnCompletion"),grow:!1,id:"piecesHashOnCompletion",labelOffset:!0,matchTextboxHeight:!0,children:(0,p.tZ)(s.cC,{id:"settings.resources.disk.check.hash.label"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.resources.memory.heading"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.fE,{defaultValue:Zt(n,"piecesMemoryMax"),id:"piecesMemoryMax",label:(0,p.BX)("div",{children:[(0,p.tZ)(s.cC,{id:"settings.resources.memory.max.label"})," ",(0,p.tZ)("em",{className:"unit",children:"(MB)"})]}),width:"one-half"})})]})};var Kt=n(7731);var en={name:"1d3w5wq",styles:"width:100%"},tn={name:"15rw530",styles:".sortable-list__item{cursor:default;}"};const nn=e=>{let{className:t,checkboxLabel:n,items:r}=e;return(0,p.tZ)("div",{css:en,role:"none",children:(0,p.tZ)("ul",{className:U()("sortable-list",t),css:tn,children:r.map((e=>{const{id:t,label:r,isLocked:i=!1,defaultChecked:l,onClick:a}=e;return(0,p.BX)("li",{className:U()("sortable-list__item",{"sortable-list__item--is-locked":i}),children:[i?(0,p.tZ)(y.HE,{}):null,(0,p.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,p.tZ)(s.cC,{id:r})}),i?null:(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,p.tZ)(d.XZ,{defaultChecked:l,id:t,onClick:e=>null==a?void 0:a(e.target.checked),children:n&&(0,p.tZ)(s.cC,{id:n})})})]})]},t||r)}))})})};nn.defaultProps={className:void 0,checkboxLabel:void 0};const rn=nn,ln=e=>{let{onSettingsChange:t}=e;const n=(0,o.useRef)(u.Z.floodSettings.UIPageTitleSpeedEnabled);return(0,p.tZ)(rn,{items:[{label:"settings.ui.page.title.speed",defaultChecked:n.current,onClick:()=>{n.current=!n.current,t({UIPageTitleSpeedEnabled:n.current})}}]})};var an=n(8737),sn=n(2433);const on=e=>{let{onSettingsChange:t}=e;const n=(0,o.useRef)(sn.Z.torrentContextMenuActions.map((e=>{var t;let{id:n,visible:r}=e;return{id:n,visible:(null===(t=u.Z.floodSettings.torrentContextMenuActions.find((e=>e.id===n)))||void 0===t?void 0:t.visible)??r}})));return(0,p.tZ)(rn,{checkboxLabel:"settings.ui.torrent.context.menu.items.show",items:Object.keys(an.Z).map((e=>({label:an.Z[e],isLocked:"start"===e||"stop"===e||"setTaxonomy"===e||"torrentDetails"===e,defaultChecked:n.current.some((t=>t.id===e&&t.visible)),onClick:()=>{const r=n.current.find((t=>t.id===e));null!=r&&(r.visible=!r.visible),t({torrentContextMenuActions:n.current})}})))})};var dn=n(882),cn=n(9097);const un=e=>{let{torrentListViewSize:t,onSettingsChange:n}=e;const r=(0,o.useRef)(null),[i,l]=(0,o.useState)([...u.Z.floodSettings.torrentListColumns.filter((e=>null!=dn.Z[e.id])).slice(),...Object.keys(dn.Z).filter((e=>u.Z.floodSettings.torrentListColumns.every((t=>t.id!==e)))).map((e=>({id:e,visible:!1})))]),a=i.reduce(((e,t)=>{let{id:n,visible:r}=t;return e[n]=r,e}),{}),c="expanded"===t?["name","eta","downRate","percentComplete","downTotal","upRate"]:[];return(0,p.tZ)(Ut,{className:"sortable-list--torrent-details",items:i.map((e=>{let{id:t}=e;return t})),lockedIDs:c,onMouseDown:()=>{var e;null===(e=r.current)||void 0===e||e.dismissTooltip()},onDrop:e=>{const t=e.map((e=>({id:e,visible:a[e]})));n({torrentListColumns:t}),l(t)},renderItem:(e,o)=>{let u=null,h=null;if(c.includes(e)||(u=(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--secondary",children:(0,p.tZ)(d.XZ,{defaultChecked:a[e],id:e,onClick:t=>{a[e]=t.target.checked;const r=i.map((n=>({id:n.id,visible:n.id===e?t.target.checked:n.visible})));l(r),n({torrentListColumns:r})},children:(0,p.tZ)(s.cC,{id:"settings.ui.torrent.details.enabled"})})})),"tags"===e&&"expanded"===t&&o<i.length-1){const e=(0,p.tZ)(s.cC,{id:"settings.ui.torrent.details.tags.placement"});h=(0,p.tZ)(cn.Z,{className:"tooltip tooltip--is-error",content:e,offset:-5,ref:r,width:200,wrapperClassName:"sortable-list__content sortable-list__content--secondary tooltip__wrapper",wrapText:!0,children:(0,p.tZ)(y.jj,{})})}return(0,p.BX)("div",{className:"sortable-list__content sortable-list__content__wrapper",children:[h,(0,p.tZ)("span",{className:"sortable-list__content sortable-list__content--primary",children:(0,p.tZ)(s.cC,{id:dn.Z[e]})}),u]})}})},hn=e=>{let{onSettingsChange:t}=e;const{i18n:n}=(0,s.mV)(),[r,i]=(0,o.useState)(u.Z.floodSettings.torrentListViewSize),[l,a]=(0,o.useState)(u.Z.floodSettings.language),[c,h]=(0,o.useState)(u.Z.floodSettings.UITagSelectorMode);return(0,p.BX)(d.l0,{onChange:e=>{let{event:n,formData:l}=e;const s=n.target;if("radio"===s.type&&(i(l["ui-torrent-size"]),h(l["ui-tag-selector-mode"]),t({torrentListViewSize:r,UITagSelectorMode:c})),"language"===s.name){const e=l.language;a(e),t({language:e})}},children:[(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.language"})},"locale-header"),(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.Ph,{defaultID:l,id:"language",children:Object.keys(Kt.Z).map((e=>(0,p.tZ)(d.Ql,{id:e,children:"auto"===e?n._(Kt.Z[e].id):Kt.Z[e]},e)))})},"locale-selection"),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.tag.selector.mode"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.Y8,{defaultChecked:"single"===c,groupID:"ui-tag-selector-mode",id:"single",width:"auto",children:(0,p.tZ)(s.cC,{id:"settings.ui.tag.selector.mode.single"})}),(0,p.tZ)(d.Y8,{defaultChecked:"multi"===c,groupID:"ui-tag-selector-mode",id:"multi",width:"auto",children:(0,p.tZ)(s.cC,{id:"settings.ui.tag.selector.mode.multi"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.torrent.list"})}),(0,p.BX)(d.p7,{children:[(0,p.tZ)(d.Y8,{defaultChecked:"expanded"===r,groupID:"ui-torrent-size",id:"expanded",width:"auto",children:(0,p.tZ)(s.cC,{id:"settings.ui.torrent.size.expanded"})}),(0,p.tZ)(d.Y8,{defaultChecked:"condensed"===r,groupID:"ui-torrent-size",id:"condensed",width:"auto",children:(0,p.tZ)(s.cC,{id:"settings.ui.torrent.size.condensed"})})]}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.displayed.details"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(un,{torrentListViewSize:r,onSettingsChange:t})}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.displayed.context.menu.items"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(on,{onSettingsChange:t})}),(0,p.tZ)(xe,{children:(0,p.tZ)(s.cC,{id:"settings.ui.misc"})}),(0,p.tZ)(d.p7,{children:(0,p.tZ)(ln,{onSettingsChange:t})})]})};function mn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mn(Object(n),!0).forEach((function(t){pn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const fn=(0,l.Pi)((()=>{const{i18n:e}=(0,s.mV)(),[t,n]=(0,o.useState)({}),[r,i]=(0,o.useState)({}),[l,a]=(0,o.useState)(!1),d=e=>{n(_n(_n({},t),e))},u=e=>{i(_n(_n({},r),e))},h=_n(_n({bandwidth:{content:Nt,props:{onClientSettingsChange:d,onSettingsChange:u},label:e._("settings.tabs.bandwidth")},connectivity:{content:jt,props:{onClientSettingsChange:d},label:e._("settings.tabs.connectivity")},resources:{content:Jt,props:{onClientSettingsChange:d},label:e._("settings.tabs.resources")}},"none"!==re.Z.authMethod?{authentication:{content:bt,label:e._("settings.tabs.authentication")}}:{}),{},{ui:{content:hn,label:e._("settings.tabs.userinterface"),props:{onSettingsChange:u}},diskusage:{content:Gt,label:e._("settings.tabs.diskusage"),props:{onSettingsChange:u}},about:{content:mt,label:e._("settings.tabs.about")}});return(0,p.tZ)(_e,{actions:[{clickHandler:null,content:e._("button.cancel"),triggerDismiss:!0,type:"tertiary"},{clickHandler:()=>{a(!0),Promise.all([c.Z.saveSettings(r,{alert:!0}),Bt.Z.saveSettings(t,{alert:!0})]).then((()=>{a(!1),_.Z.setActiveModal(null)}))},isLoading:l,content:e._("button.save"),triggerDismiss:!1,type:"primary"}],size:"large",heading:e._("settings.tabs.heading"),orientation:re.Z.isSmallScreen?"horizontal":"vertical",tabs:h})})),gn=()=>{const{i18n:e}=(0,s.mV)(),t=(0,o.useRef)(be().CancelToken.source()),n=(0,o.useRef)(null),[r,i]=(0,o.useState)(null),[l,a]=(0,o.useState)(null),[c,u]=(0,o.useState)(!0),[h,f]=(0,o.useState)(!1);(0,o.useEffect)((()=>{var e;const{current:n}=t;var r;"torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)&&m.Z.fetchMediainfo(null===(r=_.Z.activeModal)||void 0===r?void 0:r.hash,t.current.token).then((e=>{i(e.output),u(!1)}),(e=>{be().isCancel(e)||(a(e.response.data),u(!1))}));return()=>{n.cancel()}}),[]);let g="mediainfo.heading";return c?g="mediainfo.fetching":l&&(g="mediainfo.execError"),(0,p.BX)("div",{className:"torrent-details__section mediainfo modal__content--nested-scroll__content",children:[(0,p.BX)("div",{className:"mediainfo__toolbar",children:[(0,p.tZ)("div",{className:"mediainfo__toolbar__item",children:(0,p.tZ)("span",{className:"torrent-details__table__heading--tertiary",children:(0,p.tZ)(s.cC,{id:g})})}),r&&(0,p.tZ)(cn.Z,{content:e._(h?"general.clipboard.copied":"general.clipboard.copy"),wrapperClassName:"tooltip__wrapper mediainfo__toolbar__item",children:(0,p.tZ)(d.zx,{priority:"tertiary",onClick:()=>{var e;null!=r&&("function"==typeof(null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText)?navigator.clipboard.writeText(r).then((()=>{f(!0)})):null!=n.current&&(n.current.value=r,n.current.select(),document.execCommand("copy"),f(!0)))},children:h?(0,p.tZ)(y.MC,{}):(0,p.tZ)(y.TU,{})})})]}),(0,p.tZ)("input",{ref:n,style:{width:"0.1px",height:"1px",position:"absolute",right:0}}),l?(0,p.tZ)("pre",{className:"mediainfo__output mediainfo__output--error",children:l.message}):(0,p.tZ)("pre",{className:"mediainfo__output",children:r})]})};function bn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bn(Object(n),!0).forEach((function(t){vn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const yn=(e,t)=>Zn(Zn(Zn(Zn({},e),null!=e.directories?{directories:Object.assign({},...Object.keys(e.directories).map((n=>null!=e.directories?{[n]:yn(e.directories[n],t)}:{})))}:{}),null!=e.files?{files:Object.assign({},...Object.keys(e.files).map((n=>null!=e.files?{[n]:Zn(Zn({},e.files[n]),{},{isSelected:t})}:{})))}:{}),{},{isSelected:t}),Cn=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const{depth:r,path:i,select:l,type:a}=t,s=i[n];if(n===r-1){var o;if("file"===a&&null!=(null===(o=e.files)||void 0===o?void 0:o[s])){const t=Zn(Zn({},e.files),{},{[s]:Zn(Zn({},e.files[s]),{},{isSelected:l})});return Zn(Zn({},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=Zn(Zn({},e.directories),{},{[s]:yn(e.directories[s],l)});return Zn(Zn({},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 r=e.directories;return Object.keys(r).forEach((e=>{e===s&&(r[e]=Cn(r[e],t,n+1))})),Zn(Zn({},e),{},{directories:r,isSelected:Object.values(r).every((e=>{let{isSelected:t}=e;return t}))})}return e},wn=e=>{const t=[];if(null!=e.files){const{files:n}=e;Object.keys(n).forEach((e=>{const r=n[e];r.isSelected&&t.push(r.index)}))}if(null!=e.directories){const{directories:n}=e;Object.keys(n).forEach((e=>{t.push(...wn(n[e]))}))}return t},kn={selectAll:yn,applySelection:Cn,getSelectedItems:wn,getSelectionTree:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n={isSelected:t};return e.forEach((e=>{const r=e.path.split("/");let i=n;for(;r.length-1;){const e=r.shift();null==i.directories&&(i.directories={}),null==i.directories[e]&&(i.directories[e]={isSelected:t}),i=i.directories[e]}null==i.files&&(i.files={}),i.files[e.filename]=Zn(Zn({},e),{},{isSelected:t})})),n}};var On=n(2036),Nn=n(2104);const Sn=e=>{let{depth:t,items:n,hash:r,path:i,onItemSelect:l}=e;const[a,s]=(0,o.useState)(null),c=(0,o.useRef)({});if(null==n)return null;const u=Object.values(n).sort(((e,t)=>e.filename.localeCompare(t.filename))).map((e=>{var o;const u=n&&n[e.filename]&&n[e.filename].isSelected||!1,h=U()("directory-tree__node file","directory-tree__node--file directory-tree__node--selectable",{"directory-tree__node--selected":u});return(0,p.BX)("div",{className:h,title:e.filename,children:[(0,p.BX)("div",{className:"file__label file__detail",children:[(0,p.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,p.tZ)(d.XZ,{checked:u,id:`${e.index}`,onClick:()=>l({type:"file",depth:t,path:[...i,e.filename],select:!u})})}),(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:(0,p.tZ)(y.$B,{})})]}),(0,p.tZ)("div",{className:"file__name",children:(0,p.tZ)("a",{href:`${re.Z.baseURI}api/torrents/${r}/contents/${e.index}/data`,style:{textDecoration:"none"},target:"_blank",rel:"noreferrer",children:e.filename})})]}),(0,p.tZ)("div",{className:"file__detail file__detail--secondary",children:(0,p.tZ)(Nn.Z,{value:e.sizeBytes,precision:1})}),(0,p.BX)("div",{className:"file__detail file__detail--secondary",children:[Math.trunc(e.percentComplete),"%"]}),(0,p.tZ)("div",{className:"file__detail file__detail--secondary file__detail--priority",children:(0,p.tZ)(On.Z,{level:e.priority,id:e.index,maxLevel:2,onChange:(e,t)=>m.Z.setFilePriority(r,{indices:[Number(e)],priority:t}),priorityType:"file"},`${e.index}-${e.filename}`)}),"function"==typeof(null===(o=navigator.clipboard)||void 0===o?void 0:o.writeText)&&(0,p.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))))},n=c.current[e.index];null!=n?t(n):(c.current[e.index]="",m.Z.getTorrentContentsDataPermalink(r,[e.index]).then((n=>{c.current[e.index]=n,t(n)}),(()=>{c.current[e.index]=null})))},children:a===e.index?(0,p.tZ)(y.MC,{}):(0,p.tZ)(y.TU,{})})]},e.filename)}));return(0,p.tZ)("div",{className:"directory-tree__node directory-tree__node--file-list",children:u})};var Pn={name:"r5l0s9",styles:"width:100%;text-align:left;:focus{outline:none;-webkit-tap-highlight-color:transparent;}:focus-visible{outline:dashed;}"};const xn=e=>{let{depth:t,directoryName:n,id:r,itemsTree:i,hash:l,path:a,isSelected:s,onItemSelect:c}=e;const[u,h]=(0,o.useState)(!1),m=[...a,n];return(0,p.BX)("div",{className:U()("directory-tree__branch",`directory-tree__branch--depth-${t}`,{"directory-tree__node--selected":s}),children:[(0,p.tZ)("button",{className:U()("directory-tree__node","directory-tree__node--selectable directory-tree__node--directory",{"is-expanded":u}),css:Pn,type:"button",onClick:()=>h(!u),title:n,children:(0,p.BX)("div",{className:"file__label",children:[(0,p.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,p.tZ)(d.XZ,{checked:s,id:r,onClick:()=>c({type:"directory",depth:t,path:m,select:!s})})}),(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:u?(0,p.tZ)(y.DB,{}):(0,p.tZ)(y.Bm,{})})]}),(0,p.tZ)("div",{className:"file__name",children:n})]})}),u?(0,p.tZ)("div",{className:"directory-tree__node directory-tree__node--group",children:(0,p.tZ)(jn,{depth:t,hash:l,onItemSelect:c,path:m,itemsTree:i},`${u}-${t}`)}):null]})},jn=e=>{const{depth:t=0,itemsTree:n,hash:r,path:i,onItemSelect:l}=e,{files:a,directories:s}=n,o=t+1,d=null!=s?Object.keys(s).sort(((e,t)=>e.localeCompare(t))).map(((e,t)=>{const a=n.directories&&n.directories[e],s=`${t}${o}${e}`,d=a&&a.isSelected||!1;return null==a?null:(0,p.tZ)(xn,{depth:o,directoryName:e,hash:r,id:s,isSelected:d,itemsTree:a,onItemSelect:l,path:i},s)})):[],c=null!=a&&Object.keys(a).length>0?(0,p.tZ)(Sn,{depth:o,hash:r,onItemSelect:l,path:i,items:n.files},`files-${o}`):null;return(0,p.tZ)("div",{className:"directory-tree__tree",children:d.concat(c)})},Bn=(0,l.Pi)((()=>{var e,t;const[n,r]=(0,o.useState)([]),[i,l]=(0,o.useState)({}),[a,c]=(0,o.useState)([]),{i18n:u}=(0,s.mV)();if((0,o.useEffect)((()=>{var e,t;"torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)&&m.Z.fetchTorrentContents(null===(t=_.Z.activeModal)||void 0===t?void 0:t.hash).then((e=>{null!=e&&(r(e),l(kn.getSelectionTree(e)))}))}),[]),"torrent-details"!==(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))return null;const{hash:h}=null===_.Z||void 0===_.Z?void 0:_.Z.activeModal;let f=null,g=null,b=!1;(null==n?void 0:n.length)>0?(b=a.length>=n.length,f=(0,p.BX)("div",{className:"file__checkbox directory-tree__checkbox",children:[(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--checkbox",children:(0,p.tZ)(d.p7,{children:(0,p.tZ)(d.XZ,{checked:b,id:"select-all",onClick:()=>{const e=kn.getSelectionTree(n,a.length<n.length);l(e),c(kn.getSelectedItems(e))}})})}),(0,p.tZ)("div",{className:"directory-tree__checkbox__item directory-tree__checkbox__item--icon",children:(0,p.tZ)(y.Zz,{})})]}),g=(0,p.tZ)(jn,{depth:0,onItemSelect:e=>{const t=kn.applySelection(i,e);l(t),c(kn.getSelectedItems(t))},hash:h,path:[],itemsTree:i})):(f=(0,p.tZ)(y.Zz,{}),g=(0,p.tZ)("div",{className:"directory-tree__node directory-tree__node--file",children:(0,p.tZ)(s.cC,{id:"torrents.details.files.loading"})}));const Z=U()("directory-tree__node","directory-tree__parent-directory torrent-details__section__heading",{"directory-tree__node--selected":b}),v=(0,p.tZ)("div",{className:Z,children:(0,p.BX)("div",{className:"file__label",children:[f,(0,p.tZ)("div",{className:"file__name",children:null===(t=tt.Z.torrents)||void 0===t?void 0:t[h].directory})]})}),C=U()("inverse directory-tree__wrapper",{"directory-tree__wrapper--toolbar-visible":a.length>0});return(0,p.BX)(d.l0,{className:C,onChange:e=>{let{event:t}=e;if(null!=t.target&&"file-priority"===t.target.name){const e=t.target;e.value&&m.Z.setFilePriority(h,{indices:a,priority:Number(e.value)})}},children:[(0,p.tZ)("div",{className:"directory-tree__selection-toolbar",children:(0,p.BX)(d.p7,{align:"center",children:[(0,p.tZ)(d.U2,{width:"one-quarter",grow:!1,shrink:!1,children:(0,p.tZ)(s.cC,{id:"torrents.details.selected.files",values:{count:a.length,countElement:(0,p.tZ)("span",{className:"directory-tree__selection-toolbar__item-count",children:a.length})}})}),(0,p.tZ)(d.zx,{onClick:e=>{e.preventDefault();const{baseURI:t}=re.Z,n=document.createElement("a");n.download="",n.href=`${t}api/torrents/${h}/contents/${a.join(",")}/data`,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},grow:!1,shrink:!1,children:(0,p.tZ)(s.cC,{id:"torrents.details.files.download.file",values:{count:a.length}})}),(0,p.BX)(d.Ph,{id:"file-priority",persistentPlaceholder:!0,shrink:!1,defaultID:"",children:[(0,p.tZ)(d.Ql,{id:-1,isPlaceholder:!0,children:(0,p.tZ)(s.cC,{id:"torrents.details.selected.files.set.priority"})}),(0,p.tZ)(d.Ql,{id:0,children:u._("priority.dont.download")}),(0,p.tZ)(d.Ql,{id:1,children:u._("priority.normal")}),(0,p.tZ)(d.Ql,{id:2,children:u._("priority.high")})]})]})}),(0,p.BX)("div",{className:"directory-tree torrent-details__section torrent-details__section--file-tree modal__content--nested-scroll__content",children:[v,g]})]})})),Dn=Bn;const Xn=e=>{let{text:t,className:n}=e;const r=t.split(/\s/).map((e=>function(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}(e.trimEnd())?(0,p.tZ)("a",{href:e.trimEnd(),target:"_blank",rel:"noopener noreferrer",children:e}):e));return(0,p.tZ)("span",{className:n,children:r})};Xn.defaultProps={className:void 0};const Tn=Xn,En=(0,l.Pi)((()=>{var e;const{i18n:t}=(0,s.mV)();if("torrent-details"!==(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))return null;const n=tt.Z.torrents[_.Z.activeModal.hash];if(null==n)return null;const r=(0,p.tZ)("span",{className:"not-available",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.none"})});return(0,p.tZ)("div",{className:"torrent-details__section torrent-details__section--general",children:(0,p.tZ)("table",{className:"torrent-details__table table",children:(0,p.BX)("tbody",{children:[(0,p.tZ)("tr",{className:"torrent-details__table__heading",children:(0,p.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,p.tZ)(s.cC,{id:"torrents.details.general.heading.general"})})}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateAdded",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.date.added"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.dateAdded>0?t.date(new Date(1e3*n.dateAdded),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):r})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--location",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.location"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.directory})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--tags",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.tags"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.tags.length?(i=n.tags,i.map((e=>(0,p.tZ)("span",{className:"tag",children:e},e)))):r})]}),(0,p.tZ)("tr",{className:"torrent-details__table__heading",children:(0,p.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,p.tZ)(s.cC,{id:"torrents.details.general.heading.transfer"})})}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateFinished",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.date.finished"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.dateFinished>0?t.date(new Date(1e3*n.dateFinished),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):r})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--downloaded",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.downloaded"})}),(0,p.BX)("td",{className:"torrent-details__detail__value",children:[t.number(n.percentComplete),(0,p.tZ)("em",{className:"unit",children:"%"})]})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--peers",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.peers"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.connected",values:{connectedCount:n.peersConnected,connected:t.number(n.peersConnected),total:t.number(n.peersTotal)}})})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--seeds",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.seeds"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.connected",values:{connectedCount:n.seedsConnected,connected:t.number(n.seedsConnected),total:t.number(n.seedsTotal)}})})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--dateActive",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.date.active"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:0===n.dateActive?r:-1===n.dateActive?t._("torrents.details.general.date.active.now"):t.date(new Date(1e3*n.dateActive),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"})})]}),(0,p.tZ)("tr",{className:"torrent-details__table__heading",children:(0,p.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,p.tZ)(s.cC,{id:"torrents.details.general.heading.torrent"})})}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--created",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.date.created"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.dateCreated>0?t.date(new Date(1e3*n.dateCreated),{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"numeric"}):r})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--hash",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.hash"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.hash})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--size",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.size"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:(0,p.tZ)(Nn.Z,{value:n.sizeBytes})})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--type",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.type"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.isPrivate?t._("torrents.details.general.type.private"):t._("torrents.details.general.type.public")})]}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--comment",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.comment"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.comment?(0,p.tZ)(Tn,{text:n.comment}):r})]}),(0,p.tZ)("tr",{className:"torrent-details__table__heading",children:(0,p.tZ)("td",{className:"torrent-details__table__heading--tertiary",colSpan:2,children:(0,p.tZ)(s.cC,{id:"torrents.details.general.heading.tracker"})})}),(0,p.BX)("tr",{className:"torrent-details__detail torrent-details__detail--tracker-message",children:[(0,p.tZ)("td",{className:"torrent-details__detail__label",children:(0,p.tZ)(s.cC,{id:"torrents.details.general.tracker.message"})}),(0,p.tZ)("td",{className:"torrent-details__detail__value",children:n.message?n.message:r})]})]})})});var i}));var Mn=n(1109),Vn=n(228),In=n(6882);const Rn=(0,l.Pi)((()=>{var e;const{i18n:t}=(0,s.mV)(),n="torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)?tt.Z.torrents[_.Z.activeModal.hash]:void 0,[r,i]=(0,o.useState)("stop");if((0,o.useEffect)((()=>{null!=n&&n.status.includes("stopped")?i("stop"):i("start")}),[null==n?void 0:n.status]),null==n)return null;const l=(0,Mn.T)({status:n.status,upRate:n.upRate,downRate:n.downRate},"torrent-details__header");return(0,p.BX)("div",{className:l,children:[(0,p.tZ)("h1",{className:"torrent-details__heading torrent-details--name",children:n.name}),(0,p.BX)("div",{className:"torrent-details__sub-heading",children:[(0,p.BX)("ul",{className:"torrent-details__sub-heading__secondary",children:[(0,p.BX)("li",{className:"torrent-details__sub-heading__tertiary torrent-details__sub-heading__tertiary--download",children:[(0,p.tZ)(y.ki,{}),(0,p.tZ)(Nn.Z,{value:n.downRate,isSpeed:!0})," — ",(0,p.tZ)(Nn.Z,{value:n.bytesDone})]}),(0,p.BX)("li",{className:"torrent-details__sub-heading__tertiary torrent-details__sub-heading__tertiary--upload",children:[(0,p.tZ)(y.u3,{}),(0,p.tZ)(Nn.Z,{value:n.upRate,isSpeed:!0})," — ",(0,p.tZ)(Nn.Z,{value:n.upTotal})]}),(0,p.BX)("li",{className:"torrent-details__sub-heading__tertiary",children:[(0,p.tZ)(y.T_,{}),t.number(n.ratio)]}),(0,p.BX)("li",{className:"torrent-details__sub-heading__tertiary",children:[(0,p.tZ)(y.SU,{}),(0,p.tZ)(Vn.Z,{value:n.eta})]})]}),(0,p.BX)("ul",{className:"torrent-details__sub-heading__secondary",children:[(0,p.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,p.tZ)(On.Z,{id:n.hash,level:n.priority,maxLevel:3,priorityType:"torrent",onChange:(e,t)=>{m.Z.setPriority({hashes:[`${e}`],priority:t})}})},"priority-meter"),(0,p.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,p.BX)("button",{className:U()("torrent-details__action",{"is-active":"start"===r}),type:"button",onClick:()=>{i("start"),m.Z.startTorrents({hashes:[n.hash]})},children:[(0,p.tZ)(y.zf,{}),(0,p.tZ)(s.cC,{id:"torrents.details.actions.start"})]})},"start"),(0,p.tZ)("li",{className:"torrent-details__sub-heading__tertiary",children:(0,p.BX)("button",{className:U()("torrent-details__action",{"is-active":"stop"===r}),type:"button",onClick:()=>{i("stop"),m.Z.stopTorrents({hashes:[n.hash]})},children:[(0,p.tZ)(y.dV,{}),(0,p.tZ)(s.cC,{id:"torrents.details.actions.stop"})]})},"stop")]})]}),(0,p.tZ)(In.Z,{percent:(0,Ze.Fl)((()=>Math.ceil(n.percentComplete))).get(),status:(0,Ze.Fl)((()=>(0,Mn.o)(n.status))).get()})]})}));var Ln=n(3337),Fn=n(8447);var $n={name:"17lw7on",styles:"td{max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}"};const Un=()=>{const[e,t]=(0,o.useState)([]),[n,r]=(0,o.useState)(null),i=()=>{var e,n;(r(null),"torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id))&&m.Z.fetchTorrentPeers(null===(n=_.Z.activeModal)||void 0===n?void 0:n.hash).then((e=>{null!=e&&t(e)}));r(re.Z.pollInterval)};return(0,o.useEffect)((()=>i()),[]),(0,Ln.Z)((()=>i()),n),(0,p.tZ)("div",{className:"torrent-details__section torrent-details__section--peers",children:(0,p.BX)("table",{className:"torrent-details__table table",css:$n,children:[(0,p.tZ)("thead",{className:"torrent-details__table__heading",children:(0,p.BX)("tr",{children:[(0,p.BX)("th",{className:"torrent-details__table__heading--primary",children:[(0,p.tZ)(s.cC,{id:"torrents.details.peers"}),(0,p.tZ)(Fn.Z,{children:e.length})]}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"DL"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"UL"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"%"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"Client"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"Enc"}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:"In"})]})}),(0,p.tZ)("tbody",{children:e.map((e=>{const{country:t}=e,n=e.isEncrypted?(0,p.tZ)(y.HE,{}):null,r=e.isIncoming?(0,p.tZ)(y.FV,{}):null;return(0,p.BX)("tr",{children:[(0,p.BX)("td",{children:[(0,p.BX)("span",{className:"peers-list__flag",children:[(0,p.tZ)(o.Suspense,{fallback:(0,p.tZ)(y.$j,{}),children:(0,p.tZ)(y.AW,{countryCode:t})}),(0,p.tZ)("span",{className:"peers-list__flag__text",children:t})]}),e.address]}),(0,p.tZ)("td",{children:(0,p.tZ)(Nn.Z,{value:e.downloadRate,isSpeed:!0})}),(0,p.tZ)("td",{children:(0,p.tZ)(Nn.Z,{value:e.uploadRate,isSpeed:!0})}),(0,p.tZ)("td",{children:`${Math.ceil(e.completedPercent)}%`}),(0,p.tZ)("td",{children:e.clientVersion}),(0,p.tZ)("td",{className:"peers-list__encryption",children:n}),(0,p.tZ)("td",{className:"peers-list__incoming",children:r})]},e.address)}))})]})})},zn=()=>{const[e,t]=(0,o.useState)([]),n=e.length,r=["http","udp","dht"],i=e.map((e=>(0,p.BX)("tr",{children:[(0,p.tZ)("td",{children:e.url}),(0,p.tZ)("td",{children:r[e.type-1]})]},e.url)));return(0,o.useEffect)((()=>{var e,n;"torrent-details"===(null===(e=_.Z.activeModal)||void 0===e?void 0:e.id)&&m.Z.fetchTorrentTrackers(null===(n=_.Z.activeModal)||void 0===n?void 0:n.hash).then((e=>{null!=e&&t(e)}))}),[]),(0,p.tZ)("div",{className:"torrent-details__trackers torrent-details__section",children:(0,p.BX)("table",{className:"torrent-details__table table",children:[(0,p.tZ)("thead",{className:"torrent-details__table__heading",children:(0,p.BX)("tr",{children:[(0,p.BX)("th",{className:"torrent-details__table__heading--primary",children:[(0,p.tZ)(s.cC,{id:"torrents.details.trackers"}),(0,p.tZ)(Fn.Z,{children:n})]}),(0,p.tZ)("th",{className:"torrent-details__table__heading--secondary",children:(0,p.tZ)(s.cC,{id:"torrents.details.trackers.type"})})]})}),(0,p.tZ)("tbody",{children:i})]})})},An=(0,l.Pi)((()=>{const{i18n:e}=(0,s.mV)(),{isSmallScreen:t}=re.Z,n={"torrent-details":{content:En,label:e._("torrents.details.details")},"torrent-contents":{content:Dn,label:e._("torrents.details.files"),modalContentClasses:"modal__content--nested-scroll"},"torrent-peers":{content:Un,label:e._("torrents.details.peers")},"torrent-trackers":{content:zn,label:e._("torrents.details.trackers")},"torrent-mediainfo":{content:gn,label:e._("torrents.details.mediainfo"),modalContentClasses:"modal__content--nested-scroll"}};return(0,p.tZ)(_e,{heading:(0,p.tZ)(Rn,{},"torrent-heading"),size:"large",tabs:n,orientation:t?"horizontal":"vertical",tabsInBody:!t})})),Hn=e=>{switch(e){case"add-torrents":return(0,p.tZ)(pe,{});case"confirm":return(0,p.tZ)(fe,{});case"feeds":return(0,p.tZ)(et,{});case"generate-magnet":return(0,p.tZ)(it,{});case"move-torrents":return(0,p.tZ)(at,{});case"remove-torrents":return(0,p.tZ)(st,{});case"set-taxonomy":return(0,p.tZ)(ot,{});case"set-trackers":return(0,p.tZ)(dt,{});case"settings":return(0,p.tZ)(fn,{});case"torrent-details":return(0,p.tZ)(An,{});default:return null}},qn=(0,l.Pi)((()=>{const{id:e}=_.Z.activeModal||{};let t;return(0,a.Z)("Escape",(()=>_.Z.setActiveModal(null))),null!=e&&(t=(0,p.tZ)(r.Z,{classNames:"modal__animation",timeout:{enter:500,exit:500},children:(0,p.BX)("div",{className:"modal",children:[(0,p.tZ)("div",{className:"modal__overlay",role:"none",onClick:()=>{_.Z.setActiveModal(null)}}),Hn(e)]})},e)),(0,p.tZ)(i.Z,{children:t})}))}}]);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|