qBitrr2 5.4.4__py3-none-any.whl → 5.5.0__py3-none-any.whl

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.
@@ -1,11 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProcessesView.js","assets/table.js","assets/vendor.js","assets/useInterval.js","assets/LogsView.js","assets/react-select.esm.js","assets/ArrView.js","assets/ConfigView.js"])))=>i.map(i=>d[i]);
2
- import{r as Ee,a as Re}from"./vendor.js";import{r as o}from"./table.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const f of a.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var F={exports:{}},A={};/**
3
- * @license React
4
- * react-jsx-runtime.production.min.js
5
- *
6
- * Copyright (c) Facebook, Inc. and its affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var se;function Ne(){if(se)return A;se=1;var e=Ee(),r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function f(h,m,c){var g,v={},u=null,p=null;c!==void 0&&(u=""+c),m.key!==void 0&&(u=""+m.key),m.ref!==void 0&&(p=m.ref);for(g in m)i.call(m,g)&&!a.hasOwnProperty(g)&&(v[g]=m[g]);if(h&&h.defaultProps)for(g in m=h.defaultProps,m)v[g]===void 0&&(v[g]=m[g]);return{$$typeof:r,type:h,key:u,ref:p,props:v,_owner:s.current}}return A.Fragment=n,A.jsx=f,A.jsxs=f,A}var ne;function Le(){return ne||(ne=1,F.exports=Ne()),F.exports}var t=Le(),W={},oe;function Ie(){if(oe)return W;oe=1;var e=Re();return W.createRoot=e.createRoot,W.hydrateRoot=e.hydrateRoot,W}var Te=Ie();const Ue="modulepreload",Pe=function(e){return"/static/"+e},ae={},z=function(r,n,i){let s=Promise.resolve();if(n&&n.length>0){let m=function(c){return Promise.all(c.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=f?.nonce||f?.getAttribute("nonce");s=m(n.map(c=>{if(c=Pe(c),c in ae)return;ae[c]=!0;const g=c.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${v}`))return;const u=document.createElement("link");if(u.rel=g?"stylesheet":Ue,g||(u.as="script"),u.crossOrigin="",u.href=c,h&&u.setAttribute("nonce",h),document.head.appendChild(u),g)return new Promise((p,w)=>{u.addEventListener("load",p),u.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return s.then(f=>{for(const h of f||[])h.status==="rejected"&&a(h.reason);return r().catch(a)})},de=o.createContext(void 0);let $e=0;function Ae({children:e}){const[r,n]=o.useState([]),i=o.useCallback(f=>{n(h=>h.filter(m=>m.id!==f))},[]),s=o.useCallback((f,h="info")=>{const m=++$e;n(c=>[...c,{id:m,message:f,kind:h}]),window.setTimeout(()=>i(m),3500)},[i]),a=o.useMemo(()=>({toasts:r,push:s,dismiss:i}),[r,s,i]);return t.jsx(de.Provider,{value:a,children:e})}function ue(){const e=o.useContext(de);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}function Oe(){const{toasts:e,dismiss:r}=ue();return e.length?t.jsx("div",{className:"toasts",children:e.map(n=>t.jsx("div",{className:`toast ${n.kind!=="info"?n.kind:""}`,role:"status",onClick:()=>r(n.id),children:n.message},n.id))}):null}const fe=o.createContext(void 0);function De({children:e}){const[r,n]=o.useState(""),i=o.useRef(new Set),s=o.useCallback(m=>{n(m),i.current.forEach(c=>{c?.(m)})},[]),a=o.useCallback(m=>{m&&i.current.add(m)},[]),f=o.useCallback(m=>{i.current.delete(m)},[]),h=o.useMemo(()=>({value:r,setValue:s,register:a,clearHandler:f}),[r,s,a,f]);return t.jsx(fe.Provider,{value:h,children:e})}function Ve(){const e=o.useContext(fe);if(!e)throw new Error("useSearch must be used within a SearchProvider");return e}const Me={"Content-Type":"application/json"},Y=["token","webui-token","webui_token"],qe=1,J=new Map;function Be(e,r){const n=e instanceof Request?e.url:String(e),i=r?.method||"GET",s=r?.body?String(r.body):"";return`${i}:${n}:${s}`}function me(){for(const e of Y){const r=localStorage.getItem(e)||sessionStorage.getItem(e);if(r)return e!=="token"&&localStorage.setItem("token",r),r}try{const r=new URLSearchParams(window.location.search).get("token");if(r)return localStorage.setItem("token",r),r}catch{}return null}function We(){for(const e of Y)localStorage.removeItem(e);try{for(const e of Y)sessionStorage.removeItem(e)}catch{}}function he(e,r){const n=new Headers(e?.headers||{});return Object.entries(Me).forEach(([i,s])=>{n.has(i)||n.set(i,s)}),r&&!n.has("Authorization")&&n.set("Authorization",`Bearer ${r}`),{...e,headers:n}}async function G(e,r,n,i=qe){const s=me(),a=await fetch(e,he(r,s));return a.status===401&&i>0&&s?(We(),G(e,r,n,i-1)):n(a)}async function j(e,r){if((r?.method||"GET")==="GET"){const i=Be(e,r),s=J.get(i);if(s)return s;const a=G(e,r,f=>ce(f)).finally(()=>{J.delete(i)});return J.set(i,a),a}return G(e,r,i=>ce(i))}async function Ge(e,r){return G(e,r,n=>ze(n))}async function ce(e){if(!e.ok){let r=null;try{r=await e.json()}catch{}let n=`${e.status} ${e.statusText}`;if(r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"){const i=r.error;i.trim()&&(n=i)}throw new Error(n)}return await e.json()}async function ze(e){if(!e.ok)throw new Error(`${e.status} ${e.statusText}`);return e.text()}async function ie(e){const r=e?.force?"?force=1":"";return j(`/web/meta${r}`)}async function le(){return j("/web/status")}async function pt(){return j("/web/processes")}async function vt(e,r){const n=`/web/processes/${encodeURIComponent(e)}/${encodeURIComponent(r)}/restart`;return j(n,{method:"POST"})}async function yt(){return j("/web/processes/restart_all",{method:"POST"})}async function wt(){return j("/web/arr/rebuild",{method:"POST"})}async function bt(){return j("/web/logs")}async function xt(e){return Ge(`/web/logs/${encodeURIComponent(e)}`)}function _t(e){return`/web/logs/${encodeURIComponent(e)}/download`}async function jt(){return j("/web/arr")}async function kt(e,r,n,i){const s=new URLSearchParams;return s.set("page",String(r)),s.set("page_size",String(n)),i&&s.set("q",i),j(`/web/radarr/${encodeURIComponent(e)}/movies?${s}`)}async function Ct(e,r,n,i,s){const a=new URLSearchParams;return a.set("page",String(r)),a.set("page_size",String(n)),i&&a.set("q",i),s?.missingOnly&&a.set("missing","1"),j(`/web/sonarr/${encodeURIComponent(e)}/series?${a}`)}async function St(e,r,n,i){const s=new URLSearchParams;return s.set("page",r.toString()),s.set("page_size",n.toString()),i&&s.set("q",i),s.set("include_tracks","true"),j(`/web/lidarr/${encodeURIComponent(e)}/albums?${s}`)}async function Et(e){await j(`/web/arr/${encodeURIComponent(e)}/restart`,{method:"POST"})}async function He(){return j("/web/config")}async function Fe(e){const r=me(),n=await fetch("/web/config",he({method:"POST",body:JSON.stringify(e)},r));if(!n.ok){let s=null;try{s=await n.json()}catch{}let a=`${n.status} ${n.statusText}`;if(s&&typeof s=="object"&&"error"in s&&typeof s.error=="string"){const f=s.error;f.trim()&&(a=f)}throw new Error(a)}return await n.json()}async function Je(){await j("/web/update",{method:"POST"})}const ge=o.createContext(null);function Ke({children:e}){const[r,n]=o.useState({liveArr:!0,groupSonarr:!0,groupLidarr:!0,viewDensity:"comfortable",theme:"dark"}),[i,s]=o.useState(!0);o.useEffect(()=>{(async()=>{try{const w=(await He())?.WebUI,L=localStorage.getItem("viewDensity"),I=localStorage.getItem("theme"),N=w?.Theme,E=I||N?.toLowerCase()||"dark";n({liveArr:w?.LiveArr===!0,groupSonarr:w?.GroupSonarr===!0,groupLidarr:w?.GroupLidarr===!0,viewDensity:L||"comfortable",theme:E}),document.documentElement.setAttribute("data-theme",E)}catch(p){console.error("Failed to load WebUI settings:",p)}finally{s(!1)}})()},[]);const a=o.useCallback(async(u,p)=>{try{const w={WebUI:{[u]:p}};await Fe({changes:w})}catch(w){console.error(`Failed to save ${u}:`,w)}},[]),f=o.useCallback(u=>{n(p=>({...p,liveArr:u})),a("LiveArr",u)},[a]),h=o.useCallback(u=>{n(p=>({...p,groupSonarr:u})),a("GroupSonarr",u)},[a]),m=o.useCallback(u=>{n(p=>({...p,groupLidarr:u})),a("GroupLidarr",u)},[a]),c=o.useCallback(u=>{n(p=>({...p,viewDensity:u})),localStorage.setItem("viewDensity",u)},[]),g=o.useCallback(u=>{n(w=>({...w,theme:u})),localStorage.setItem("theme",u),document.documentElement.setAttribute("data-theme",u),a("Theme",u==="light"?"Light":"Dark")},[a]),v={liveArr:r.liveArr,groupSonarr:r.groupSonarr,groupLidarr:r.groupLidarr,viewDensity:r.viewDensity,theme:r.theme,setLiveArr:f,setGroupSonarr:h,setGroupLidarr:m,setViewDensity:c,setTheme:g,loading:i};return t.jsx(ge.Provider,{value:v,children:e})}function Ye(){const e=o.useContext(ge);if(!e)throw new Error("useWebUI must be used within WebUIProvider");return e}function Qe(){const[e,r]=o.useState(navigator.onLine);return o.useEffect(()=>{const n=()=>r(!0),i=()=>r(!1);return window.addEventListener("online",n),window.addEventListener("offline",i),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",i)}},[]),e}function R({src:e,alt:r,className:n,...i}){return t.jsx("img",{src:e,alt:r??"",className:n?`icon ${n}`:"icon","aria-hidden":r?void 0:!0,...i})}const Xe="/static/assets/close.svg",Q="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20viewBox='0%200%20512%20512'%3e%3cpath%20d='M256%206.3C114.6%206.3%200%20120.9%200%20262.3c0%20113.3%2073.3%20209%20175%20242.9%2012.8%202.2%2017.6-5.4%2017.6-12.2%200-6.1-.3-26.2-.3-47.7-64.3%2011.8-81-15.7-86.1-30.1-2.9-7.4-15.4-30.1-26.2-36.2-9-4.8-21.8-16.6-.3-17%2020.2-.3%2034.6%2018.6%2039.4%2026.2%2023%2038.7%2059.8%2027.8%2074.6%2021.1%202.2-16.6%209-27.8%2016.3-34.2-57-6.4-116.5-28.5-116.5-126.4%200-27.8%209.9-50.9%2026.2-68.8-2.6-6.4-11.5-32.6%202.6-67.8%200%200%2021.4-6.7%2070.4%2026.2%2020.5-5.8%2042.2-8.6%2064-8.6s43.5%202.9%2064%208.6c49-33.3%2070.4-26.2%2070.4-26.2%2014.1%2035.2%205.1%2061.4%202.6%2067.8%2016.3%2017.9%2026.2%2040.6%2026.2%2068.8%200%2098.2-59.8%20120-116.8%20126.4%209.3%208%2017.3%2023.4%2017.3%2047.4%200%2034.2-.3%2061.8-.3%2070.4%200%206.7%204.8%2014.7%2017.6%2012.2C438.7%20471.3%20512%20375.3%20512%20262.3c0-141.4-114.6-256-256-256'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%231b1f23'/%3e%3c/svg%3e",Ze="/static/assets/refresh-arrow.svg",pe="/static/assets/up-arrow.svg",et="/static/assets/download.svg",tt="/static/assets/process.svg",rt="/static/assets/log.svg",st="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20id='Layer_1'%20x='0'%20y='0'%20version='1.1'%20viewBox='0%200%20512%20512'%3e%3cstyle%3e.st0{fill:%2324292e}%3c/style%3e%3cg%20id='Group-Copy'%20transform='translate(70%2021)'%3e%3cpath%20id='Shape'%20d='m10.3%2059.8%203.9%20372.4c-31.4%203.9-54.9-11.8-54.9-43.1l-3.9-309.7c0-98%2090.2-121.5%20145.1-82.3l278.3%20160.7c39.2%2027.4%2047%2078.4%2027.4%20113.7-3.9-27.4-15.7-43.1-39.2-58.8L53.4%2036.2C29.9%2020.6%2010.3%2024.5%2010.3%2059.8'%20class='st0'/%3e%3cpath%20id='Shape_00000114049535938561773820000018271523940913105341_'%20d='M-13.2%20451.8c23.5%207.8%2047%203.9%2066.6-7.8l321.5-188.2c19.6%2027.4%2015.7%2054.9-7.8%2070.6L96.5%20483.2c-39.2%2019.6-90.1%200-109.7-31.4'%20class='st0'/%3e%3cpath%20id='Shape_00000165935924413286433040000003668002807793862576_'%20d='M80.9%20342%20273%20232.3%2084.8%20126.4z'%20style='fill:%23ffc230'/%3e%3c/g%3e%3c/svg%3e",nt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20viewBox='0%200%20512%20512'%3e%3cpath%20d='M511.8%20256c0%2070.4-24.9%20130.8-74.6%20181.1-1.7%202-3.5%203.8-5.5%205.4-8.2%208-16.8%2015.3-26%2021.8Q341.05%20512%20256.3%20512c-56.6%200-106.3-15.9-149.2-47.7-11.3-8-22-17.1-31.9-27.3C36.5%20398.7%2012.8%20354%204%20303.2c-1.7-9.9-2.9-20-3.4-30.2-.2-5.7-.4-11.3-.4-17%200-6%20.1-11.7.4-17.1%200-.6.2-1.1.5-1.7%203.7-62.8%2028.4-117%2074.1-162.8C125.5%2024.8%20185.8%200%20256.2%200c70.7%200%20131%2024.8%20180.9%2074.5q74.7%2075.9%2074.7%20181.5'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23eee'/%3e%3cpath%20d='m459.7%20100.3-52.9%2052.9c-30.9%2030.9-33.6%2057.8-33.6%20105.3%200%2042.3%206.7%2081.1%2038.2%20112.6%2023%2023%2044.9%2044.7%2044.9%2044.7-5.9%207.2-12.3%2014.3-19.1%2021.2-1.7%202-3.5%203.8-5.5%205.4-6%205.9-12.2%2011.4-18.6%2016.4l-41.4-41.4C334.9%20380.6%20305.6%20377%20257%20377c-46.7%200-78.4%204.3-112.6%2038.5-20.4%2020.4-43.8%2043.9-43.8%2043.9-8.9-6.8-17.3-14.2-25.3-22.4-6.6-6.6-12.8-13.4-18.5-20.3%200%200%2023.1-23.2%2045.2-45.3%2032.7-32.7%2038-70.6%2038-113%200-41.3-6.8-79.8-36.8-109.9C82.2%20127.7%2053.3%2099%2053.3%2099c6.7-8.5%2014-16.7%2021.8-24.5%206.9-6.8%2014-13.1%2021.2-19l48%2048c30.7%2030.7%2070%2038.6%20112.4%2038.6%2043.6%200%2082.8-8.4%20114.7-40.4C391%2082.1%20417%2056.3%20417%2056.3c6.8%205.6%2013.5%2011.6%2020.1%2018.2%208.3%208.3%2015.8%2016.9%2022.6%2025.8'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%233a3f51'/%3e%3cpath%20d='M186%20269.1c-.5-2.8-.8-5.5-.9-8.4-.1-1.6-.1-3.1-.1-4.7%200-1.7%200-3.2.1-4.7%200-.2%200-.3.1-.5%201-17.4%207.9-32.4%2020.5-45.1%2013.9-13.8%2030.6-20.7%2050.2-20.7s36.3%206.9%2050.2%2020.7c13.8%2014%2020.7%2030.8%2020.7%2050.3s-6.9%2036.2-20.7%2050.2c-.5.5-1%201.1-1.5%201.5q-3.45%203.3-7.2%206-18%2013.2-41.4%2013.2c-23.4%200-29.4-4.4-41.3-13.2-3.1-2.2-6.1-4.7-8.9-7.6-10.8-10.6-17.3-22.9-19.8-37'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%230cf'/%3e%3cpath%20d='m372.7%20141-35.4%2034.6M72.9%2076.8l96.5%2096.1m199.7%20198.9%2065.6%2067.9m4.4-363.3L372.7%20141M76.6%20438.5l64.6-64.7'%20style='fill:none;stroke:%230cf;stroke-width:2;stroke-miterlimit:1'/%3e%3cpath%20d='m372.7%20141-40%2040.6m-193.3-38.5%2040.6%2040.5M141%20374l39.5-41.1m146.2-3.3%2042.6%2042.4'%20style='fill:none;stroke:%230cf;stroke-width:7;stroke-miterlimit:1'/%3e%3c/svg%3e",ot="/static/assets/lidarr.svg",at="/static/assets/gear.svg",ct=o.lazy(()=>z(()=>import("./ProcessesView.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.ProcessesView}))),it=o.lazy(()=>z(()=>import("./LogsView.js"),__vite__mapDeps([4,1,2,5,3])).then(e=>({default:e.LogsView}))),K=o.lazy(()=>z(()=>import("./ArrView.js"),__vite__mapDeps([6,1,2,3])).then(e=>({default:e.ArrView}))),lt=o.lazy(()=>z(()=>import("./ConfigView.js"),__vite__mapDeps([7,1,2,5])).then(e=>({default:e.ConfigView})));function O(e){if(!e)return"unknown";const r=e.trim();return r?r[0]==="v"||r[0]==="V"?r:`v${r}`:"unknown"}function dt({currentVersion:e,changelog:r,changelogUrl:n,repositoryUrl:i,onClose:s}){return t.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:s,children:t.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"welcome-title",onClick:a=>a.stopPropagation(),children:[t.jsx("div",{className:"modal-header",children:t.jsxs("h2",{id:"welcome-title",children:["🎉 Welcome to qBitrr ",O(e),"!"]})}),t.jsxs("div",{className:"modal-body changelog-modal__body",children:[t.jsx("div",{className:"changelog-meta",children:t.jsxs("p",{style:{marginBottom:"1rem",color:"var(--text-secondary)"},children:["You've been updated to version ",t.jsx("strong",{children:O(e)}),". Here's what's new in this release:"]})}),t.jsxs("div",{className:"changelog-section",children:[t.jsx("h3",{children:"Release Notes"}),t.jsx("pre",{className:"changelog-body",children:r?.trim()?r.trim():"No changelog available for this version."})]})]}),t.jsxs("div",{className:"modal-footer",children:[t.jsx("div",{className:"changelog-links",children:(n||i)&&t.jsxs("a",{className:"btn ghost small",href:n??i,target:"_blank",rel:"noreferrer",children:[t.jsx(R,{src:Q}),"View Full Release on GitHub"]})}),t.jsx("div",{className:"changelog-buttons",children:t.jsx("button",{className:"btn primary",type:"button",onClick:s,children:"Got it!"})})]})]})})}function ut({currentVersion:e,latestVersion:r,changelog:n,changelogUrl:i,repositoryUrl:s,updateState:a,updating:f,installationType:h,binaryDownloadUrl:m,binaryDownloadName:c,binaryDownloadSize:g,binaryDownloadError:v,onClose:u,onUpdate:p}){const[w,L]=o.useState(null),I=f||!!a?.in_progress,N=a?.completed_at?new Date(a.completed_at).toLocaleString():null,E=h==="binary";o.useEffect(()=>{if(a?.last_result==="success"&&a?.completed_at){let k=10;L(k);const T=setInterval(()=>{k-=1,k<=0?(clearInterval(T),window.location.reload()):L(k)},1e3);return()=>clearInterval(T)}},[a?.last_result,a?.completed_at]);let C="",S=null;if(a?.in_progress)C="text-info",S="⏳ Update in progress...";else if(a?.last_result==="success")C="text-success",w!==null?S=`✓ Update completed! Reloading in ${w}s...`:(S="✓ Update completed successfully",N&&(S=`${S} (${N})`));else if(a?.last_result==="error"){C="text-danger";const k=a.last_error?a.last_error.trim():"";S=k?`✗ Update failed: ${k}`:"✗ Update failed"}return t.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:u,children:t.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"changelog-title",onClick:k=>k.stopPropagation(),children:[t.jsxs("div",{className:"modal-header",children:[t.jsx("h2",{id:"changelog-title",children:a?.in_progress?"⚙️ Updating...":"🚀 Update Available"}),t.jsxs("button",{className:"btn ghost",type:"button",onClick:u,disabled:a?.in_progress,children:[t.jsx(R,{src:Xe}),"Close"]})]}),t.jsxs("div",{className:"modal-body changelog-modal__body",children:[t.jsxs("div",{className:"changelog-meta",children:[t.jsxs("div",{className:"version-comparison",children:[t.jsxs("span",{className:"version-item",children:[t.jsx("strong",{children:"Current:"})," ",t.jsx("span",{className:"version-badge version-current",children:O(e)})]}),t.jsx("span",{className:"version-arrow",children:"→"}),t.jsxs("span",{className:"version-item",children:[t.jsx("strong",{children:"Latest:"})," ",t.jsx("span",{className:"version-badge version-latest",children:r?O(r):"Unknown"})]})]}),S?t.jsx("div",{className:`update-status ${C}`,children:S}):null]}),t.jsxs("div",{className:"changelog-section",children:[t.jsx("h3",{children:"What's New"}),t.jsx("pre",{className:"changelog-body",children:n?.trim()?n.trim():"No changelog provided."})]})]}),t.jsxs("div",{className:"modal-footer",children:[t.jsx("div",{className:"changelog-links",children:(i||s)&&t.jsxs("a",{className:"btn ghost small",href:i??s,target:"_blank",rel:"noreferrer",children:[t.jsx(R,{src:Q}),"View on GitHub"]})}),t.jsx("div",{className:"changelog-buttons",children:E?v?t.jsx("div",{className:"update-status text-danger",style:{marginBottom:"0.5rem"},children:v}):m?t.jsxs(t.Fragment,{children:[t.jsxs("a",{className:"btn primary",href:"/web/download-update",download:c??void 0,target:"_blank",rel:"noreferrer",children:[t.jsx(R,{src:et}),"Download Update",g&&g>0?t.jsxs("span",{style:{marginLeft:"0.5rem",opacity:.8,fontSize:"0.875rem"},children:["(",(g/(1024*1024)).toFixed(1)," MB)"]}):null]}),t.jsx("div",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginTop:"0.5rem"},children:"Binary installation detected. Download and manually replace the executable."})]}):t.jsx("div",{className:"update-status text-danger",children:"Unable to fetch binary download URL. Please update manually."}):t.jsxs("button",{className:"btn primary",type:"button",onClick:p,disabled:I,children:[t.jsx(R,{src:pe}),I?"Updating...":"Update Now"]})})]})]})})}function ft(){const[e,r]=o.useState("processes"),[n,i]=o.useState(!1),{push:s}=ue(),{setValue:a}=Ve(),{viewDensity:f,setViewDensity:h}=Ye(),m=Qe(),[c,g]=o.useState(null),[v,u]=o.useState(!1),[p,w]=o.useState(!1),[L,I]=o.useState(!1),[N,E]=o.useState(!1),C=o.useRef(0),S=o.useRef(null),k=o.useRef(!1),T=o.useRef(!1),U=o.useRef(null),[P,X]=o.useState(0),[Z,ee]=o.useState(null),[ve,te]=o.useState(!1);o.useEffect(()=>{(async()=>{if("caches"in window)try{const l=await caches.keys();await Promise.all(l.map(b=>caches.delete(b))),console.log("Cache cleared on page load")}catch(l){console.error("Failed to clear cache:",l)}})()},[]);const x=o.useCallback(async d=>{const l=d?.force??!1,b=d?.silent??!l;b||u(!0);try{const _=await ie({force:l});g(_)}catch(_){if(!b){const y=_ instanceof Error?_.message:"Failed to fetch version information";s(y,"error")}}finally{b||u(!1)}},[s]);o.useEffect(()=>{x({force:!0})},[x]),o.useEffect(()=>{if(!c?.current_version)return;const d=localStorage.getItem("lastSeenVersion"),l=c.current_version;d&&d!==l&&(!c.current_version_changelog&&!c.changelog&&x({force:!0,silent:!0}),te(!0)),d||localStorage.setItem("lastSeenVersion",l)},[c?.current_version,c?.changelog,x]),o.useEffect(()=>{m||s("You are offline. Some features may not work.","warning")},[m,s]),o.useEffect(()=>{const d=l=>{if(l.target instanceof HTMLInputElement||l.target instanceof HTMLTextAreaElement||l.target instanceof HTMLSelectElement)return;const b=l.ctrlKey||l.metaKey;if(b&&l.key==="k"){l.preventDefault(),document.querySelector('input[type="text"][placeholder*="Search"]')?.focus();return}if(l.key==="r"||l.key==="R"){l.preventDefault(),X(_=>_+1),s("Refreshed","success");return}if(l.key==="Escape"){a("");return}if(l.key>="1"&&l.key<="6"&&!b){l.preventDefault();const _=parseInt(l.key)-1,y=["processes","logs","radarr","sonarr","lidarr","config"];_<y.length&&r(y[_]);return}};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[a,s]),o.useEffect(()=>{const d=window.setInterval(()=>{x()},3e5);return()=>window.clearInterval(d)},[x]),o.useEffect(()=>{const d=()=>{document.visibilityState==="visible"&&(X(l=>l+1),x({force:!0}),D())};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[x]);const D=o.useCallback(async()=>{try{const d=await le();ee(d)}catch{}},[]);o.useEffect(()=>{D();const d=window.setInterval(()=>{D()},5*1e3);return()=>window.clearInterval(d)},[D]),o.useEffect(()=>{if(!c?.update_state?.in_progress&&!N){C.current=0;return}const d=window.setInterval(async()=>{try{const l=await ie({force:!0});g(l),N&&window.location.reload(),C.current=0}catch{if(C.current+=1,C.current>20){E(!1),C.current=0,s("Update completed but backend restart timed out. Please refresh the page manually.","warning");return}c?.update_state?.in_progress&&E(!0)}},3e3);return()=>window.clearInterval(d)},[c?.update_state?.in_progress,N,c,s]),o.useEffect(()=>{const d=c?.update_state;if(!d){S.current=null;return}const l=d.last_result??null;l&&l!==S.current&&(l==="success"?(s("Update completed successfully. Restarting...","success"),E(!0),C.current=0):l==="error"&&s(d.last_error||"Update failed.","error")),S.current=l},[c?.update_state,s]),o.useEffect(()=>{let d=!1,l=0;const b=y=>{U.current!==null&&window.clearTimeout(U.current),U.current=window.setTimeout(()=>{_()},y)},_=async()=>{if(!(d||k.current)){l+=1;try{const y=await le();if(d)return;if(ee(y),y.ready??(Array.isArray(y.arrs)&&y.arrs.length>0)){k.current=!0;return}y.ready===!1&&l>=3&&!T.current&&(T.current=!0,s("qBitrr backend is still initialising. Check the logs if this persists.","warning"))}catch(y){if(!T.current&&l>=3){T.current=!0;const B=y instanceof Error?y.message:"Unknown backend error";s(`Unable to confirm qBitrr readiness (${B}). Please inspect the logs.`,"warning")}}finally{if(!d&&!k.current){const y=l<3?3e3:1e4;b(y)}}}};return b(0),()=>{d=!0,U.current!==null&&(window.clearTimeout(U.current),U.current=null)}},[s]);const V=o.useMemo(()=>{const d=[{id:"processes",label:"Processes",icon:tt},{id:"logs",label:"Logs",icon:rt}],l=[],b=Z?.arrs??[],_=b.some($=>$.type==="radarr"),y=b.some($=>$.type==="sonarr"),B=b.some($=>$.type==="lidarr");return _&&l.push({id:"radarr",label:"Radarr",icon:st}),y&&l.push({id:"sonarr",label:"Sonarr",icon:nt}),B&&l.push({id:"lidarr",label:"Lidarr",icon:ot}),[...d,...l,{id:"config",label:"Config",icon:at}]},[Z]),M=c?.repository_url??"https://github.com/Feramance/qBitrr",ye=c?.current_version?O(c.current_version):"...",we=c?.latest_version??null,be=!!c?.update_available,H=c?.update_state,re=c?.changelog_url??M,q=[];c?.last_checked&&q.push(`Last checked ${new Date(c.last_checked).toLocaleString()}`),c?.error&&q.push(`Update check failed: ${c.error}`);const xe=q.length?q.join(" • "):void 0;o.useEffect(()=>{!V.some(l=>l.id===e)&&V.length>0&&r("processes")},[V,e]);const _e=o.useCallback(()=>{x({force:!0})},[x]),je=o.useCallback(()=>{w(!0),c?.changelog||x({force:!0,silent:!0})},[c?.changelog,x]),ke=o.useCallback(()=>{w(!1)},[]),Ce=o.useCallback(()=>{te(!1),c?.current_version&&localStorage.setItem("lastSeenVersion",c.current_version)},[c?.current_version]),Se=o.useCallback(async()=>{I(!0),E(!1),C.current=0;try{await Je(),s("Update started in the background.","info"),await x({force:!0,silent:!0})}catch(d){const l=d instanceof Error?d.message:"Failed to start update";s(l,"error")}finally{I(!1)}},[s,x]);return t.jsxs("div",{"data-density":f,children:[t.jsx("header",{className:"appbar",children:t.jsxs("div",{className:"appbar__inner",children:[t.jsxs("div",{className:"appbar__title",children:[t.jsx("h1",{children:"qBitrr"}),t.jsx("span",{className:"appbar__version",title:xe,children:ye}),v?t.jsx("span",{className:"spinner","aria-hidden":"true"}):null,H?.in_progress?t.jsx("span",{className:"appbar__status text-info",children:"Updating..."}):null,be?t.jsxs("button",{type:"button",className:"btn small primary appbar__update",onClick:je,disabled:L||!!H?.in_progress,children:[t.jsx("span",{className:"appbar__update-indicator","aria-hidden":"true"}),t.jsx(R,{src:pe}),"Update available"]}):null]}),t.jsxs("div",{className:"appbar__actions",children:[!m&&t.jsx("span",{className:"badge",style:{background:"rgba(239, 68, 68, 0.15)",borderColor:"rgba(239, 68, 68, 0.3)",color:"var(--danger)"},children:"Offline"}),t.jsxs("div",{className:"view-density-toggle",children:[t.jsx("button",{type:"button",className:f==="comfortable"?"active":"",onClick:()=>h("comfortable"),title:"Comfortable view",children:"Comfortable"}),t.jsx("button",{type:"button",className:f==="compact"?"active":"",onClick:()=>h("compact"),title:"Compact view",children:"Compact"})]}),t.jsxs("button",{type:"button",className:"btn small ghost",onClick:_e,disabled:v,children:[t.jsx(R,{src:Ze}),v?"Checking...":"Check Updates"]}),t.jsxs("a",{href:M,target:"_blank",rel:"noreferrer",className:"btn small ghost",children:[t.jsx(R,{src:Q}),"GitHub"]})]})]})}),t.jsxs("main",{className:"container",children:[t.jsx("nav",{className:"nav",children:V.map(d=>t.jsxs("button",{type:"button",className:e===d.id?"active":"",onClick:()=>{e==="config"&&d.id!=="config"&&n&&!window.confirm("You have unsaved configuration changes. Leave without saving?")||(r(d.id),a(""))},children:[t.jsx(R,{src:d.icon}),t.jsx("span",{children:d.label})]},d.id))}),t.jsxs(o.Suspense,{fallback:t.jsx("div",{className:"loading",children:"Loading..."}),children:[e==="processes"&&t.jsx(ct,{active:!0},`processes-${P}`),e==="logs"&&t.jsx(it,{active:!0},`logs-${P}`),e==="radarr"&&t.jsx(K,{type:"radarr",active:!0},`radarr-${P}`),e==="sonarr"&&t.jsx(K,{type:"sonarr",active:!0},`sonarr-${P}`),e==="lidarr"&&t.jsx(K,{type:"lidarr",active:!0},`lidarr-${P}`),e==="config"&&t.jsx(lt,{onDirtyChange:i},`config-${P}`)]})]}),p&&c?t.jsx(ut,{currentVersion:c.current_version,latestVersion:we,changelog:c.changelog,changelogUrl:re,repositoryUrl:M,updateState:H,updating:L,installationType:c.installation_type,binaryDownloadUrl:c.binary_download_url,binaryDownloadName:c.binary_download_name,binaryDownloadSize:c.binary_download_size,binaryDownloadError:c.binary_download_error,onClose:ke,onUpdate:Se}):null,ve&&c?t.jsx(dt,{currentVersion:c.current_version,changelog:c.current_version_changelog||c.changelog,changelogUrl:re,repositoryUrl:M,onClose:Ce}):null]})}function mt(){return t.jsx(Ae,{children:t.jsx(De,{children:t.jsxs(Ke,{children:[t.jsx(ft,{}),t.jsx(Oe,{})]})})})}Te.createRoot(document.getElementById("root")).render(t.jsx(o.StrictMode,{children:t.jsx(mt,{})}));export{Xe as C,et as D,R as I,Ze as R,le as a,yt as b,wt as c,bt as d,xt as e,_t as f,pt as g,Ve as h,Ye as i,t as j,jt as k,kt as l,Et as m,Ct as n,St as o,He as p,Fe as q,vt as r,at as s,ue as u};
2
+ import{r as Ee,a as Ne}from"./vendor.js";import{r as n}from"./table.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))c(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const u of i.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&c(u)}).observe(document,{childList:!0,subtree:!0});function o(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function c(s){if(s.ep)return;s.ep=!0;const i=o(s);fetch(s.href,i)}})();var H={exports:{}},A={};var se;function Re(){if(se)return A;se=1;var e=Ee(),r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function u(g,f,a){var h,w={},v=null,m=null;a!==void 0&&(v=""+a),f.key!==void 0&&(v=""+f.key),f.ref!==void 0&&(m=f.ref);for(h in f)c.call(f,h)&&!i.hasOwnProperty(h)&&(w[h]=f[h]);if(g&&g.defaultProps)for(h in f=g.defaultProps,f)w[h]===void 0&&(w[h]=f[h]);return{$$typeof:r,type:g,key:v,ref:m,props:w,_owner:s.current}}return A.Fragment=o,A.jsx=u,A.jsxs=u,A}var ne;function Le(){return ne||(ne=1,H.exports=Re()),H.exports}var t=Le(),W={},oe;function Ie(){if(oe)return W;oe=1;var e=Ne();return W.createRoot=e.createRoot,W.hydrateRoot=e.hydrateRoot,W}var Te=Ie();const Ue="modulepreload",Pe=function(e){return"/static/"+e},ae={},G=function(r,o,c){let s=Promise.resolve();if(o&&o.length>0){let f=function(a){return Promise.all(a.map(h=>Promise.resolve(h).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),g=u?.nonce||u?.getAttribute("nonce");s=f(o.map(a=>{if(a=Pe(a),a in ae)return;ae[a]=!0;const h=a.endsWith(".css"),w=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${w}`))return;const v=document.createElement("link");if(v.rel=h?"stylesheet":Ue,h||(v.as="script"),v.crossOrigin="",v.href=a,g&&v.setAttribute("nonce",g),document.head.appendChild(v),h)return new Promise((m,p)=>{v.addEventListener("load",m),v.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${a}`)))})}))}function i(u){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=u,window.dispatchEvent(g),!g.defaultPrevented)throw u}return s.then(u=>{for(const g of u||[])g.status==="rejected"&&i(g.reason);return r().catch(i)})},de=n.createContext(void 0);let $e=0;function Ae({children:e}){const[r,o]=n.useState([]),c=n.useCallback(u=>{o(g=>g.filter(f=>f.id!==u))},[]),s=n.useCallback((u,g="info")=>{const f=++$e;o(h=>[...h,{id:f,message:u,kind:g}]);const a=g==="error"?8e3:3500;window.setTimeout(()=>c(f),a)},[c]),i=n.useMemo(()=>({toasts:r,push:s,dismiss:c}),[r,s,c]);return t.jsx(de.Provider,{value:i,children:e})}function Q(){const e=n.useContext(de);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}function Oe(){const{toasts:e,dismiss:r}=Q();return e.length?t.jsx("div",{className:"toasts",children:e.map(o=>t.jsx("div",{className:`toast ${o.kind!=="info"?o.kind:""}`,role:"status",onClick:()=>r(o.id),children:o.message},o.id))}):null}const ue=n.createContext(void 0);function De({children:e}){const[r,o]=n.useState(""),c=n.useRef(new Set),s=n.useCallback(f=>{o(f),c.current.forEach(a=>{a?.(f)})},[]),i=n.useCallback(f=>{f&&c.current.add(f)},[]),u=n.useCallback(f=>{c.current.delete(f)},[]),g=n.useMemo(()=>({value:r,setValue:s,register:i,clearHandler:u}),[r,s,i,u]);return t.jsx(ue.Provider,{value:g,children:e})}function Ve(){const e=n.useContext(ue);if(!e)throw new Error("useSearch must be used within a SearchProvider");return e}const Me={"Content-Type":"application/json"},K=["token","webui-token","webui_token"],qe=1,F=new Map;function Be(e,r){const o=e instanceof Request?e.url:String(e),c=r?.method||"GET",s=r?.body?String(r.body):"";return`${c}:${o}:${s}`}function fe(){for(const e of K){const r=localStorage.getItem(e)||sessionStorage.getItem(e);if(r)return e!=="token"&&localStorage.setItem("token",r),r}try{const r=new URLSearchParams(window.location.search).get("token");if(r)return localStorage.setItem("token",r),r}catch{}return null}function We(){for(const e of K)localStorage.removeItem(e);try{for(const e of K)sessionStorage.removeItem(e)}catch{}}function me(e,r){const o=new Headers(e?.headers||{});return Object.entries(Me).forEach(([c,s])=>{o.has(c)||o.set(c,s)}),r&&!o.has("Authorization")&&o.set("Authorization",`Bearer ${r}`),{...e,headers:o}}async function Y(e,r,o,c=qe){const s=fe(),i=await fetch(e,me(r,s));return i.status===401&&c>0&&s?(We(),Y(e,r,o,c-1)):o(i)}async function j(e,r){if((r?.method||"GET")==="GET"){const c=Be(e,r),s=F.get(c);if(s)return s;const i=Y(e,r,u=>ie(u)).finally(()=>{F.delete(c)});return F.set(c,i),i}return Y(e,r,c=>ie(c))}async function ie(e){if(!e.ok){let r=null;try{r=await e.json()}catch{}let o=`${e.status} ${e.statusText}`;if(r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"){const c=r.error;c.trim()&&(o=c)}throw new Error(o)}return await e.json()}async function ce(e){const r=e?.force?"?force=1":"";return j(`/web/meta${r}`)}async function le(){return j("/web/status")}async function gt(){return j("/web/processes")}async function ht(e,r){const o=`/web/processes/${encodeURIComponent(e)}/${encodeURIComponent(r)}/restart`;return j(o,{method:"POST"})}async function pt(){return j("/web/processes/restart_all",{method:"POST"})}async function vt(){return j("/web/arr/rebuild",{method:"POST"})}async function wt(){return j("/web/logs")}function yt(e){return`/web/logs/${encodeURIComponent(e)}/download`}async function bt(){return j("/web/arr")}async function xt(e,r,o,c){const s=new URLSearchParams;return s.set("page",String(r)),s.set("page_size",String(o)),c&&s.set("q",c),j(`/web/radarr/${encodeURIComponent(e)}/movies?${s}`)}async function _t(e,r,o,c,s){const i=new URLSearchParams;return i.set("page",String(r)),i.set("page_size",String(o)),c&&i.set("q",c),s?.missingOnly&&i.set("missing","1"),j(`/web/sonarr/${encodeURIComponent(e)}/series?${i}`)}async function jt(e,r,o,c){const s=new URLSearchParams;return s.set("page",r.toString()),s.set("page_size",o.toString()),c&&s.set("q",c),s.set("include_tracks","true"),j(`/web/lidarr/${encodeURIComponent(e)}/albums?${s}`)}async function St(e){await j(`/web/arr/${encodeURIComponent(e)}/restart`,{method:"POST"})}async function Ge(){const e=await j("/web/config");if(e&&typeof e=="object"&&"warning"in e&&"config"in e){const r=e;return r.warning?.message&&sessionStorage.setItem("config_version_warning",r.warning.message),r.config}return e}async function ze(e){const r=fe(),o=await fetch("/web/config",me({method:"POST",body:JSON.stringify(e)},r));if(!o.ok){let s=null;try{s=await o.json()}catch{}let i=`${o.status} ${o.statusText}`;if(s&&typeof s=="object"&&"error"in s&&typeof s.error=="string"){const u=s.error;u.trim()&&(i=u)}throw new Error(i)}return await o.json()}async function He(){await j("/web/update",{method:"POST"})}async function Ct(e){return j("/web/arr/test-connection",{method:"POST",body:JSON.stringify(e)})}const ge=n.createContext(null);function Fe({children:e}){const[r,o]=n.useState({liveArr:!0,groupSonarr:!0,groupLidarr:!0,viewDensity:"comfortable",theme:"dark"}),[c,s]=n.useState(!0),i=Q();n.useEffect(()=>{(async()=>{try{const b=(await Ge())?.WebUI,R=sessionStorage.getItem("config_version_warning");R&&(i.push(R,"error"),sessionStorage.removeItem("config_version_warning"));const L=localStorage.getItem("viewDensity"),I=localStorage.getItem("theme"),S=b?.Theme,x=I||S?.toLowerCase()||"dark";o({liveArr:b?.LiveArr===!0,groupSonarr:b?.GroupSonarr===!0,groupLidarr:b?.GroupLidarr===!0,viewDensity:L||"comfortable",theme:x}),document.documentElement.setAttribute("data-theme",x)}catch(p){console.error("Failed to load WebUI settings:",p)}finally{s(!1)}})()},[i]);const u=n.useCallback(async(m,p)=>{try{const b={WebUI:{[m]:p}};await ze({changes:b})}catch(b){console.error(`Failed to save ${m}:`,b)}},[]),g=n.useCallback(m=>{o(p=>({...p,liveArr:m})),u("LiveArr",m)},[u]),f=n.useCallback(m=>{o(p=>({...p,groupSonarr:m})),u("GroupSonarr",m)},[u]),a=n.useCallback(m=>{o(p=>({...p,groupLidarr:m})),u("GroupLidarr",m)},[u]),h=n.useCallback(m=>{o(p=>({...p,viewDensity:m})),localStorage.setItem("viewDensity",m)},[]),w=n.useCallback(m=>{o(b=>({...b,theme:m})),localStorage.setItem("theme",m),document.documentElement.setAttribute("data-theme",m),u("Theme",m==="light"?"Light":"Dark")},[u]),v={liveArr:r.liveArr,groupSonarr:r.groupSonarr,groupLidarr:r.groupLidarr,viewDensity:r.viewDensity,theme:r.theme,setLiveArr:g,setGroupSonarr:f,setGroupLidarr:a,setViewDensity:h,setTheme:w,loading:c};return t.jsx(ge.Provider,{value:v,children:e})}function Je(){const e=n.useContext(ge);if(!e)throw new Error("useWebUI must be used within WebUIProvider");return e}function Ke(){const[e,r]=n.useState(navigator.onLine);return n.useEffect(()=>{const o=()=>r(!0),c=()=>r(!1);return window.addEventListener("online",o),window.addEventListener("offline",c),()=>{window.removeEventListener("online",o),window.removeEventListener("offline",c)}},[]),e}function N({src:e,alt:r,className:o,...c}){return t.jsx("img",{src:e,alt:r??"",className:o?`icon ${o}`:"icon","aria-hidden":r?void 0:!0,...c})}const Ye="/static/assets/close.svg",X="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20viewBox='0%200%20512%20512'%3e%3cpath%20d='M256%206.3C114.6%206.3%200%20120.9%200%20262.3c0%20113.3%2073.3%20209%20175%20242.9%2012.8%202.2%2017.6-5.4%2017.6-12.2%200-6.1-.3-26.2-.3-47.7-64.3%2011.8-81-15.7-86.1-30.1-2.9-7.4-15.4-30.1-26.2-36.2-9-4.8-21.8-16.6-.3-17%2020.2-.3%2034.6%2018.6%2039.4%2026.2%2023%2038.7%2059.8%2027.8%2074.6%2021.1%202.2-16.6%209-27.8%2016.3-34.2-57-6.4-116.5-28.5-116.5-126.4%200-27.8%209.9-50.9%2026.2-68.8-2.6-6.4-11.5-32.6%202.6-67.8%200%200%2021.4-6.7%2070.4%2026.2%2020.5-5.8%2042.2-8.6%2064-8.6s43.5%202.9%2064%208.6c49-33.3%2070.4-26.2%2070.4-26.2%2014.1%2035.2%205.1%2061.4%202.6%2067.8%2016.3%2017.9%2026.2%2040.6%2026.2%2068.8%200%2098.2-59.8%20120-116.8%20126.4%209.3%208%2017.3%2023.4%2017.3%2047.4%200%2034.2-.3%2061.8-.3%2070.4%200%206.7%204.8%2014.7%2017.6%2012.2C438.7%20471.3%20512%20375.3%20512%20262.3c0-141.4-114.6-256-256-256'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%231b1f23'/%3e%3c/svg%3e",Qe="/static/assets/refresh-arrow.svg",he="/static/assets/up-arrow.svg",Xe="/static/assets/download.svg",Ze="/static/assets/process.svg",et="/static/assets/log.svg",tt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20id='Layer_1'%20x='0'%20y='0'%20version='1.1'%20viewBox='0%200%20512%20512'%3e%3cstyle%3e.st0{fill:%2324292e}%3c/style%3e%3cg%20id='Group-Copy'%20transform='translate(70%2021)'%3e%3cpath%20id='Shape'%20d='m10.3%2059.8%203.9%20372.4c-31.4%203.9-54.9-11.8-54.9-43.1l-3.9-309.7c0-98%2090.2-121.5%20145.1-82.3l278.3%20160.7c39.2%2027.4%2047%2078.4%2027.4%20113.7-3.9-27.4-15.7-43.1-39.2-58.8L53.4%2036.2C29.9%2020.6%2010.3%2024.5%2010.3%2059.8'%20class='st0'/%3e%3cpath%20id='Shape_00000114049535938561773820000018271523940913105341_'%20d='M-13.2%20451.8c23.5%207.8%2047%203.9%2066.6-7.8l321.5-188.2c19.6%2027.4%2015.7%2054.9-7.8%2070.6L96.5%20483.2c-39.2%2019.6-90.1%200-109.7-31.4'%20class='st0'/%3e%3cpath%20id='Shape_00000165935924413286433040000003668002807793862576_'%20d='M80.9%20342%20273%20232.3%2084.8%20126.4z'%20style='fill:%23ffc230'/%3e%3c/g%3e%3c/svg%3e",rt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20viewBox='0%200%20512%20512'%3e%3cpath%20d='M511.8%20256c0%2070.4-24.9%20130.8-74.6%20181.1-1.7%202-3.5%203.8-5.5%205.4-8.2%208-16.8%2015.3-26%2021.8Q341.05%20512%20256.3%20512c-56.6%200-106.3-15.9-149.2-47.7-11.3-8-22-17.1-31.9-27.3C36.5%20398.7%2012.8%20354%204%20303.2c-1.7-9.9-2.9-20-3.4-30.2-.2-5.7-.4-11.3-.4-17%200-6%20.1-11.7.4-17.1%200-.6.2-1.1.5-1.7%203.7-62.8%2028.4-117%2074.1-162.8C125.5%2024.8%20185.8%200%20256.2%200c70.7%200%20131%2024.8%20180.9%2074.5q74.7%2075.9%2074.7%20181.5'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%23eee'/%3e%3cpath%20d='m459.7%20100.3-52.9%2052.9c-30.9%2030.9-33.6%2057.8-33.6%20105.3%200%2042.3%206.7%2081.1%2038.2%20112.6%2023%2023%2044.9%2044.7%2044.9%2044.7-5.9%207.2-12.3%2014.3-19.1%2021.2-1.7%202-3.5%203.8-5.5%205.4-6%205.9-12.2%2011.4-18.6%2016.4l-41.4-41.4C334.9%20380.6%20305.6%20377%20257%20377c-46.7%200-78.4%204.3-112.6%2038.5-20.4%2020.4-43.8%2043.9-43.8%2043.9-8.9-6.8-17.3-14.2-25.3-22.4-6.6-6.6-12.8-13.4-18.5-20.3%200%200%2023.1-23.2%2045.2-45.3%2032.7-32.7%2038-70.6%2038-113%200-41.3-6.8-79.8-36.8-109.9C82.2%20127.7%2053.3%2099%2053.3%2099c6.7-8.5%2014-16.7%2021.8-24.5%206.9-6.8%2014-13.1%2021.2-19l48%2048c30.7%2030.7%2070%2038.6%20112.4%2038.6%2043.6%200%2082.8-8.4%20114.7-40.4C391%2082.1%20417%2056.3%20417%2056.3c6.8%205.6%2013.5%2011.6%2020.1%2018.2%208.3%208.3%2015.8%2016.9%2022.6%2025.8'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%233a3f51'/%3e%3cpath%20d='M186%20269.1c-.5-2.8-.8-5.5-.9-8.4-.1-1.6-.1-3.1-.1-4.7%200-1.7%200-3.2.1-4.7%200-.2%200-.3.1-.5%201-17.4%207.9-32.4%2020.5-45.1%2013.9-13.8%2030.6-20.7%2050.2-20.7s36.3%206.9%2050.2%2020.7c13.8%2014%2020.7%2030.8%2020.7%2050.3s-6.9%2036.2-20.7%2050.2c-.5.5-1%201.1-1.5%201.5q-3.45%203.3-7.2%206-18%2013.2-41.4%2013.2c-23.4%200-29.4-4.4-41.3-13.2-3.1-2.2-6.1-4.7-8.9-7.6-10.8-10.6-17.3-22.9-19.8-37'%20style='fill-rule:evenodd;clip-rule:evenodd;fill:%230cf'/%3e%3cpath%20d='m372.7%20141-35.4%2034.6M72.9%2076.8l96.5%2096.1m199.7%20198.9%2065.6%2067.9m4.4-363.3L372.7%20141M76.6%20438.5l64.6-64.7'%20style='fill:none;stroke:%230cf;stroke-width:2;stroke-miterlimit:1'/%3e%3cpath%20d='m372.7%20141-40%2040.6m-193.3-38.5%2040.6%2040.5M141%20374l39.5-41.1m146.2-3.3%2042.6%2042.4'%20style='fill:none;stroke:%230cf;stroke-width:7;stroke-miterlimit:1'/%3e%3c/svg%3e",st="/static/assets/lidarr.svg",nt="/static/assets/gear.svg",ot=n.lazy(()=>G(()=>import("./ProcessesView.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.ProcessesView}))),at=n.lazy(()=>G(()=>import("./LogsView.js"),__vite__mapDeps([4,1,2,5,3])).then(e=>({default:e.LogsView}))),J=n.lazy(()=>G(()=>import("./ArrView.js"),__vite__mapDeps([6,1,2,3])).then(e=>({default:e.ArrView}))),it=n.lazy(()=>G(()=>import("./ConfigView.js"),__vite__mapDeps([7,1,2,5])).then(e=>({default:e.ConfigView})));function O(e){if(!e)return"unknown";const r=e.trim();return r?r[0]==="v"||r[0]==="V"?r:`v${r}`:"unknown"}function ct({currentVersion:e,changelog:r,changelogUrl:o,repositoryUrl:c,onClose:s}){return t.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:s,children:t.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"welcome-title",onClick:i=>i.stopPropagation(),children:[t.jsx("div",{className:"modal-header",children:t.jsxs("h2",{id:"welcome-title",children:["🎉 Welcome to qBitrr ",O(e),"!"]})}),t.jsxs("div",{className:"modal-body changelog-modal__body",children:[t.jsx("div",{className:"changelog-meta",children:t.jsxs("p",{style:{marginBottom:"1rem",color:"var(--text-secondary)"},children:["You've been updated to version ",t.jsx("strong",{children:O(e)}),". Here's what's new in this release:"]})}),t.jsxs("div",{className:"changelog-section",children:[t.jsx("h3",{children:"Release Notes"}),t.jsx("pre",{className:"changelog-body",children:r?.trim()?r.trim():"No changelog available for this version."})]})]}),t.jsxs("div",{className:"modal-footer",children:[t.jsx("div",{className:"changelog-links",children:(o||c)&&t.jsxs("a",{className:"btn ghost small",href:o??c,target:"_blank",rel:"noreferrer",children:[t.jsx(N,{src:X}),"View Full Release on GitHub"]})}),t.jsx("div",{className:"changelog-buttons",children:t.jsx("button",{className:"btn primary",type:"button",onClick:s,children:"Got it!"})})]})]})})}function lt({currentVersion:e,latestVersion:r,changelog:o,changelogUrl:c,repositoryUrl:s,updateState:i,updating:u,installationType:g,binaryDownloadUrl:f,binaryDownloadName:a,binaryDownloadSize:h,binaryDownloadError:w,onClose:v,onUpdate:m}){const[p,b]=n.useState(null),R=u||!!i?.in_progress,L=i?.completed_at?new Date(i.completed_at).toLocaleString():null,I=g==="binary";n.useEffect(()=>{if(i?.last_result==="success"&&i?.completed_at){let k=10;b(k);const T=setInterval(()=>{k-=1,k<=0?(clearInterval(T),window.location.reload()):b(k)},1e3);return()=>clearInterval(T)}},[i?.last_result,i?.completed_at]);let S="",x=null;if(i?.in_progress)S="text-info",x="⏳ Update in progress...";else if(i?.last_result==="success")S="text-success",p!==null?x=`✓ Update completed! Reloading in ${p}s...`:(x="✓ Update completed successfully",L&&(x=`${x} (${L})`));else if(i?.last_result==="error"){S="text-danger";const k=i.last_error?i.last_error.trim():"";x=k?`✗ Update failed: ${k}`:"✗ Update failed"}return t.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:v,children:t.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-labelledby":"changelog-title",onClick:k=>k.stopPropagation(),children:[t.jsxs("div",{className:"modal-header",children:[t.jsx("h2",{id:"changelog-title",children:i?.in_progress?"⚙️ Updating...":"🚀 Update Available"}),t.jsxs("button",{className:"btn ghost",type:"button",onClick:v,disabled:i?.in_progress,children:[t.jsx(N,{src:Ye}),"Close"]})]}),t.jsxs("div",{className:"modal-body changelog-modal__body",children:[t.jsxs("div",{className:"changelog-meta",children:[t.jsxs("div",{className:"version-comparison",children:[t.jsxs("span",{className:"version-item",children:[t.jsx("strong",{children:"Current:"})," ",t.jsx("span",{className:"version-badge version-current",children:O(e)})]}),t.jsx("span",{className:"version-arrow",children:"→"}),t.jsxs("span",{className:"version-item",children:[t.jsx("strong",{children:"Latest:"})," ",t.jsx("span",{className:"version-badge version-latest",children:r?O(r):"Unknown"})]})]}),x?t.jsx("div",{className:`update-status ${S}`,children:x}):null]}),t.jsxs("div",{className:"changelog-section",children:[t.jsx("h3",{children:"What's New"}),t.jsx("pre",{className:"changelog-body",children:o?.trim()?o.trim():"No changelog provided."})]})]}),t.jsxs("div",{className:"modal-footer",children:[t.jsx("div",{className:"changelog-links",children:(c||s)&&t.jsxs("a",{className:"btn ghost small",href:c??s,target:"_blank",rel:"noreferrer",children:[t.jsx(N,{src:X}),"View on GitHub"]})}),t.jsx("div",{className:"changelog-buttons",children:I?w?t.jsx("div",{className:"update-status text-danger",style:{marginBottom:"0.5rem"},children:w}):f?t.jsxs(t.Fragment,{children:[t.jsxs("a",{className:"btn primary",href:"/web/download-update",download:a??void 0,target:"_blank",rel:"noreferrer",children:[t.jsx(N,{src:Xe}),"Download Update",h&&h>0?t.jsxs("span",{style:{marginLeft:"0.5rem",opacity:.8,fontSize:"0.875rem"},children:["(",(h/(1024*1024)).toFixed(1)," MB)"]}):null]}),t.jsx("div",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginTop:"0.5rem"},children:"Binary installation detected. Download and manually replace the executable."})]}):t.jsx("div",{className:"update-status text-danger",children:"Unable to fetch binary download URL. Please update manually."}):t.jsxs("button",{className:"btn primary",type:"button",onClick:m,disabled:R,children:[t.jsx(N,{src:he}),R?"Updating...":"Update Now"]})})]})]})})}function dt(){const[e,r]=n.useState("processes"),[o,c]=n.useState(!1),{push:s}=Q(),{setValue:i}=Ve(),{viewDensity:u,setViewDensity:g}=Je(),f=Ke(),[a,h]=n.useState(null),[w,v]=n.useState(!1),[m,p]=n.useState(!1),[b,R]=n.useState(!1),[L,I]=n.useState(!1),S=n.useRef(0),x=n.useRef(null),k=n.useRef(!1),T=n.useRef(!1),U=n.useRef(null),[P,pe]=n.useState(0),[Z,ee]=n.useState(null),[ve,te]=n.useState(!1);n.useEffect(()=>{(async()=>{if("caches"in window)try{const l=await caches.keys();await Promise.all(l.map(_=>caches.delete(_))),console.log("Cache cleared on page load")}catch(l){console.error("Failed to clear cache:",l)}})()},[]);const C=n.useCallback(async d=>{const l=d?.force??!1,_=d?.silent??!l;_||v(!0);try{const E=await ce({force:l});h(E)}catch(E){if(!_){const y=E instanceof Error?E.message:"Failed to fetch version information";s(y,"error")}}finally{_||v(!1)}},[s]);n.useEffect(()=>{C({force:!0})},[C]),n.useEffect(()=>{if(!a?.current_version)return;const d=localStorage.getItem("lastSeenVersion"),l=a.current_version;d&&d!==l&&(!a.current_version_changelog&&!a.changelog&&C({force:!0,silent:!0}),te(!0)),d||localStorage.setItem("lastSeenVersion",l)},[a?.current_version,a?.changelog,C]),n.useEffect(()=>{f||s("You are offline. Some features may not work.","warning")},[f,s]),n.useEffect(()=>{const d=l=>{if(l.target instanceof HTMLInputElement||l.target instanceof HTMLTextAreaElement||l.target instanceof HTMLSelectElement)return;const _=l.ctrlKey||l.metaKey;if(_&&l.key==="k"){l.preventDefault(),document.querySelector('input[type="text"][placeholder*="Search"]')?.focus();return}if(l.key==="Escape"){i("");return}if(l.key>="1"&&l.key<="6"&&!_){l.preventDefault();const E=parseInt(l.key)-1,y=["processes","logs","radarr","sonarr","lidarr","config"];E<y.length&&r(y[E]);return}};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[i,s]),n.useEffect(()=>{const d=window.setInterval(()=>{C()},3e5);return()=>window.clearInterval(d)},[C]),n.useEffect(()=>{const d=()=>{document.visibilityState==="visible"&&(pe(l=>l+1),C({force:!0}),D())};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[C]);const D=n.useCallback(async()=>{try{const d=await le();ee(d)}catch{}},[]);n.useEffect(()=>{D();const d=window.setInterval(()=>{D()},5*1e3);return()=>window.clearInterval(d)},[D]),n.useEffect(()=>{if(!a?.update_state?.in_progress&&!L){S.current=0;return}const d=window.setInterval(async()=>{try{const l=await ce({force:!0});h(l),L&&window.location.reload(),S.current=0}catch{if(S.current+=1,S.current>20){I(!1),S.current=0,s("Update completed but backend restart timed out. Please refresh the page manually.","warning");return}a?.update_state?.in_progress&&I(!0)}},3e3);return()=>window.clearInterval(d)},[a?.update_state?.in_progress,L,a,s]),n.useEffect(()=>{const d=a?.update_state;if(!d){x.current=null;return}const l=d.last_result??null;l&&l!==x.current&&(l==="success"?(s("Update completed successfully. Restarting...","success"),I(!0),S.current=0):l==="error"&&s(d.last_error||"Update failed.","error")),x.current=l},[a?.update_state,s]),n.useEffect(()=>{let d=!1,l=0;const _=y=>{U.current!==null&&window.clearTimeout(U.current),U.current=window.setTimeout(()=>{E()},y)},E=async()=>{if(!(d||k.current)){l+=1;try{const y=await le();if(d)return;if(ee(y),y.ready??(Array.isArray(y.arrs)&&y.arrs.length>0)){k.current=!0;return}y.ready===!1&&l>=3&&!T.current&&(T.current=!0,s("qBitrr backend is still initialising. Check the logs if this persists.","warning"))}catch(y){if(!T.current&&l>=3){T.current=!0;const B=y instanceof Error?y.message:"Unknown backend error";s(`Unable to confirm qBitrr readiness (${B}). Please inspect the logs.`,"warning")}}finally{if(!d&&!k.current){const y=l<3?3e3:1e4;_(y)}}}};return _(0),()=>{d=!0,U.current!==null&&(window.clearTimeout(U.current),U.current=null)}},[s]);const V=n.useMemo(()=>{const d=[{id:"processes",label:"Processes",icon:Ze},{id:"logs",label:"Logs",icon:et}],l=[],_=Z?.arrs??[],E=_.some($=>$.type==="radarr"),y=_.some($=>$.type==="sonarr"),B=_.some($=>$.type==="lidarr");return E&&l.push({id:"radarr",label:"Radarr",icon:tt}),y&&l.push({id:"sonarr",label:"Sonarr",icon:rt}),B&&l.push({id:"lidarr",label:"Lidarr",icon:st}),[...d,...l,{id:"config",label:"Config",icon:nt}]},[Z]),M=a?.repository_url??"https://github.com/Feramance/qBitrr",we=a?.current_version?O(a.current_version):"...",ye=a?.latest_version??null,be=!!a?.update_available,z=a?.update_state,re=a?.changelog_url??M,q=[];a?.last_checked&&q.push(`Last checked ${new Date(a.last_checked).toLocaleString()}`),a?.error&&q.push(`Update check failed: ${a.error}`);const xe=q.length?q.join(" • "):void 0;n.useEffect(()=>{!V.some(l=>l.id===e)&&V.length>0&&r("processes")},[V,e]);const _e=n.useCallback(()=>{C({force:!0})},[C]),je=n.useCallback(()=>{p(!0),a?.changelog||C({force:!0,silent:!0})},[a?.changelog,C]),Se=n.useCallback(()=>{p(!1)},[]),Ce=n.useCallback(()=>{te(!1),a?.current_version&&localStorage.setItem("lastSeenVersion",a.current_version)},[a?.current_version]),ke=n.useCallback(async()=>{R(!0),I(!1),S.current=0;try{await He(),s("Update started in the background.","info"),await C({force:!0,silent:!0})}catch(d){const l=d instanceof Error?d.message:"Failed to start update";s(l,"error")}finally{R(!1)}},[s,C]);return t.jsxs("div",{"data-density":u,children:[t.jsx("header",{className:"appbar",children:t.jsxs("div",{className:"appbar__inner",children:[t.jsxs("div",{className:"appbar__title",children:[t.jsx("h1",{children:"qBitrr"}),t.jsx("span",{className:"appbar__version",title:xe,children:we}),w?t.jsx("span",{className:"spinner","aria-hidden":"true"}):null,z?.in_progress?t.jsx("span",{className:"appbar__status text-info",children:"Updating..."}):null,be?t.jsxs("button",{type:"button",className:"btn small primary appbar__update",onClick:je,disabled:b||!!z?.in_progress,children:[t.jsx("span",{className:"appbar__update-indicator","aria-hidden":"true"}),t.jsx(N,{src:he}),"Update available"]}):null]}),t.jsxs("div",{className:"appbar__actions",children:[!f&&t.jsx("span",{className:"badge",style:{background:"rgba(239, 68, 68, 0.15)",borderColor:"rgba(239, 68, 68, 0.3)",color:"var(--danger)"},children:"Offline"}),t.jsxs("div",{className:"view-density-toggle",children:[t.jsx("button",{type:"button",className:u==="comfortable"?"active":"",onClick:()=>g("comfortable"),title:"Comfortable view",children:"Comfortable"}),t.jsx("button",{type:"button",className:u==="compact"?"active":"",onClick:()=>g("compact"),title:"Compact view",children:"Compact"})]}),t.jsxs("button",{type:"button",className:"btn small ghost",onClick:_e,disabled:w,children:[t.jsx(N,{src:Qe}),w?"Checking...":"Check Updates"]}),t.jsxs("a",{href:M,target:"_blank",rel:"noreferrer",className:"btn small ghost",children:[t.jsx(N,{src:X}),"GitHub"]})]})]})}),t.jsxs("main",{className:"container",children:[t.jsx("nav",{className:"nav",children:V.map(d=>t.jsxs("button",{type:"button",className:e===d.id?"active":"",onClick:()=>{e==="config"&&d.id!=="config"&&o&&!window.confirm("You have unsaved configuration changes. Leave without saving?")||(r(d.id),i(""))},children:[t.jsx(N,{src:d.icon}),t.jsx("span",{children:d.label})]},d.id))}),t.jsxs(n.Suspense,{fallback:t.jsx("div",{className:"loading",children:"Loading..."}),children:[e==="processes"&&t.jsx(ot,{active:!0},`processes-${P}`),e==="logs"&&t.jsx(at,{active:!0},`logs-${P}`),e==="radarr"&&t.jsx(J,{type:"radarr",active:!0},`radarr-${P}`),e==="sonarr"&&t.jsx(J,{type:"sonarr",active:!0},`sonarr-${P}`),e==="lidarr"&&t.jsx(J,{type:"lidarr",active:!0},`lidarr-${P}`),e==="config"&&t.jsx(it,{onDirtyChange:c},`config-${P}`)]})]}),m&&a?t.jsx(lt,{currentVersion:a.current_version,latestVersion:ye,changelog:a.changelog,changelogUrl:re,repositoryUrl:M,updateState:z,updating:b,installationType:a.installation_type,binaryDownloadUrl:a.binary_download_url,binaryDownloadName:a.binary_download_name,binaryDownloadSize:a.binary_download_size,binaryDownloadError:a.binary_download_error,onClose:Se,onUpdate:ke}):null,ve&&a?t.jsx(ct,{currentVersion:a.current_version,changelog:a.current_version_changelog||a.changelog,changelogUrl:re,repositoryUrl:M,onClose:Ce}):null]})}function ut(){return t.jsx(Ae,{children:t.jsx(De,{children:t.jsxs(Fe,{children:[t.jsx(dt,{}),t.jsx(Oe,{})]})})})}Te.createRoot(document.getElementById("root")).render(t.jsx(n.StrictMode,{children:t.jsx(ut,{})}));export{Ye as C,Xe as D,N as I,Qe as R,le as a,pt as b,vt as c,wt as d,yt as e,Ge as f,gt as g,Ve as h,Je as i,t as j,bt as k,xt as l,St as m,_t as n,jt as o,ze as p,nt as q,ht as r,Ct as t,Q as u};
11
3
  //# sourceMappingURL=app.js.map