diff --git a/crates/librqbit/webui/dist/assets/index.js b/crates/librqbit/webui/dist/assets/index.js index 437cba41..815947b7 100644 --- a/crates/librqbit/webui/dist/assets/index.js +++ b/crates/librqbit/webui/dist/assets/index.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();var xr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ki(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ws={exports:{}},kl={},Qs={exports:{}},O={};/** +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();var kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function El(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xs={exports:{}},Cl={},Js={exports:{}},O={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var dr=Symbol.for("react.element"),xd=Symbol.for("react.portal"),wd=Symbol.for("react.fragment"),kd=Symbol.for("react.strict_mode"),Sd=Symbol.for("react.profiler"),Ed=Symbol.for("react.provider"),Cd=Symbol.for("react.context"),_d=Symbol.for("react.forward_ref"),jd=Symbol.for("react.suspense"),Nd=Symbol.for("react.memo"),Td=Symbol.for("react.lazy"),Eu=Symbol.iterator;function Pd(e){return e===null||typeof e!="object"?null:(e=Eu&&e[Eu]||e["@@iterator"],typeof e=="function"?e:null)}var Zs={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ks=Object.assign,Gs={};function En(e,t,n){this.props=e,this.context=t,this.refs=Gs,this.updater=n||Zs}En.prototype.isReactComponent={};En.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};En.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ys(){}Ys.prototype=En.prototype;function Si(e,t,n){this.props=e,this.context=t,this.refs=Gs,this.updater=n||Zs}var Ei=Si.prototype=new Ys;Ei.constructor=Si;Ks(Ei,En.prototype);Ei.isPureReactComponent=!0;var Cu=Array.isArray,Xs=Object.prototype.hasOwnProperty,Ci={current:null},Js={key:!0,ref:!0,__self:!0,__source:!0};function qs(e,t,n){var r,l={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Xs.call(t,r)&&!Js.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,Z=C[$];if(0>>1;$l(Lt,z))Qel(Kt,Lt)?(C[$]=Kt,C[Qe]=z,$=Qe):(C[$]=Lt,C[$e]=z,$=$e);else if(Qel(Kt,z))C[$]=Kt,C[Qe]=z,$=Qe;else break e}}return P}function l(C,P){var z=C.sortIndex-P.sortIndex;return z!==0?z:C.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,u=i.now();e.unstable_now=function(){return i.now()-u}}var s=[],a=[],v=1,h=null,f=3,y=!1,g=!1,S=!1,L=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(C){for(var P=n(a);P!==null;){if(P.callback===null)r(a);else if(P.startTime<=C)r(a),P.sortIndex=P.expirationTime,t(s,P);else break;P=n(a)}}function w(C){if(S=!1,m(C),!g)if(n(s)!==null)g=!0,Re(_);else{var P=n(a);P!==null&&rt(w,P.startTime-C)}}function _(C,P){g=!1,S&&(S=!1,p(T),T=-1),y=!0;var z=f;try{for(m(P),h=n(s);h!==null&&(!(h.expirationTime>P)||C&&!ge());){var $=h.callback;if(typeof $=="function"){h.callback=null,f=h.priorityLevel;var Z=$(h.expirationTime<=P);P=e.unstable_now(),typeof Z=="function"?h.callback=Z:h===n(s)&&r(s),m(P)}else r(s);h=n(s)}if(h!==null)var We=!0;else{var $e=n(a);$e!==null&&rt(w,$e.startTime-P),We=!1}return We}finally{h=null,f=z,y=!1}}var E=!1,j=null,T=-1,D=5,M=-1;function ge(){return!(e.unstable_now()-MC||125$?(C.sortIndex=z,t(a,C),n(s)===null&&C===n(a)&&(S?(p(T),T=-1):S=!0,rt(w,z-$))):(C.sortIndex=Z,t(s,C),g||y||(g=!0,Re(_))),C},e.unstable_shouldYield=ge,e.unstable_wrapCallback=function(C){var P=f;return function(){var z=f;f=P;try{return C.apply(this,arguments)}finally{f=z}}}})(na);ta.exports=na;var Ud=ta.exports;/** + */(function(e){function t(C,P){var z=C.length;C.push(P);e:for(;0>>1,Z=C[$];if(0>>1;$l(Pt,z))Qel(Gt,Pt)?(C[$]=Gt,C[Qe]=z,$=Qe):(C[$]=Pt,C[$e]=z,$=$e);else if(Qel(Gt,z))C[$]=Gt,C[Qe]=z,$=Qe;else break e}}return P}function l(C,P){var z=C.sortIndex-P.sortIndex;return z!==0?z:C.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,u=i.now();e.unstable_now=function(){return i.now()-u}}var s=[],a=[],v=1,h=null,f=3,g=!1,y=!1,S=!1,L=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(C){for(var P=n(a);P!==null;){if(P.callback===null)r(a);else if(P.startTime<=C)r(a),P.sortIndex=P.expirationTime,t(s,P);else break;P=n(a)}}function w(C){if(S=!1,m(C),!y)if(n(s)!==null)y=!0,Re(_);else{var P=n(a);P!==null&<(w,P.startTime-C)}}function _(C,P){y=!1,S&&(S=!1,p(T),T=-1),g=!0;var z=f;try{for(m(P),h=n(s);h!==null&&(!(h.expirationTime>P)||C&&!ge());){var $=h.callback;if(typeof $=="function"){h.callback=null,f=h.priorityLevel;var Z=$(h.expirationTime<=P);P=e.unstable_now(),typeof Z=="function"?h.callback=Z:h===n(s)&&r(s),m(P)}else r(s);h=n(s)}if(h!==null)var We=!0;else{var $e=n(a);$e!==null&<(w,$e.startTime-P),We=!1}return We}finally{h=null,f=z,g=!1}}var E=!1,j=null,T=-1,D=5,M=-1;function ge(){return!(e.unstable_now()-MC||125$?(C.sortIndex=z,t(a,C),n(s)===null&&C===n(a)&&(S?(p(T),T=-1):S=!0,lt(w,z-$))):(C.sortIndex=Z,t(s,C),y||g||(y=!0,Re(_))),C},e.unstable_shouldYield=ge,e.unstable_wrapCallback=function(C){var P=f;return function(){var z=f;f=P;try{return C.apply(this,arguments)}finally{f=z}}}})(sa);ua.exports=sa;var Jd=ua.exports;/** * @license React * react-dom.production.min.js * @@ -30,11 +30,27 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ra=x,ke=Ud;function k(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jo=Object.prototype.hasOwnProperty,Bd=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ju={},Nu={};function Vd(e){return jo.call(Nu,e)?!0:jo.call(ju,e)?!1:Bd.test(e)?Nu[e]=!0:(ju[e]=!0,!1)}function Hd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Wd(e,t,n,r){if(t===null||typeof t>"u"||Hd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function de(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var re={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){re[e]=new de(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];re[t]=new de(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){re[e]=new de(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){re[e]=new de(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){re[e]=new de(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){re[e]=new de(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){re[e]=new de(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){re[e]=new de(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){re[e]=new de(e,5,!1,e.toLowerCase(),null,!1,!1)});var ji=/[\-:]([a-z])/g;function Ni(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ji,Ni);re[t]=new de(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ji,Ni);re[t]=new de(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ji,Ni);re[t]=new de(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!1,!1)});re.xlinkHref=new de("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ti(e,t,n,r){var l=re.hasOwnProperty(t)?re[t]:null;(l!==null?l.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zo=Object.prototype.hasOwnProperty,qd=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Pu={},zu={};function bd(e){return zo.call(zu,e)?!0:zo.call(Pu,e)?!1:qd.test(e)?zu[e]=!0:(Pu[e]=!0,!1)}function ef(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function tf(e,t,n,r){if(t===null||typeof t>"u"||ef(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function de(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var re={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){re[e]=new de(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];re[t]=new de(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){re[e]=new de(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){re[e]=new de(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){re[e]=new de(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){re[e]=new de(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){re[e]=new de(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){re[e]=new de(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){re[e]=new de(e,5,!1,e.toLowerCase(),null,!1,!1)});var Pi=/[\-:]([a-z])/g;function zi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Pi,zi);re[t]=new de(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Pi,zi);re[t]=new de(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Pi,zi);re[t]=new de(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!1,!1)});re.xlinkHref=new de("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mi(e,t,n,r){var l=re.hasOwnProperty(t)?re[t]:null;(l!==null?l.type!==0:r||!(2u||l[i]!==o[u]){var s=` -`+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=u);break}}}finally{Yl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Fn(e):""}function Qd(e){switch(e.tag){case 5:return Fn(e.type);case 16:return Fn("Lazy");case 13:return Fn("Suspense");case 19:return Fn("SuspenseList");case 0:case 2:case 15:return e=Xl(e.type,!1),e;case 11:return e=Xl(e.type.render,!1),e;case 1:return e=Xl(e.type,!0),e;default:return""}}function Lo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Jt:return"Fragment";case Xt:return"Portal";case No:return"Profiler";case Pi:return"StrictMode";case To:return"Suspense";case Po:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ia:return(e.displayName||"Context")+".Consumer";case oa:return(e._context.displayName||"Context")+".Provider";case Li:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case zi:return t=e.displayName||null,t!==null?t:Lo(e.type)||"Memo";case ot:t=e._payload,e=e._init;try{return Lo(e(t))}catch{}}return null}function Zd(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Lo(t);case 8:return t===Pi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function kt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function sa(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Kd(e){var t=sa(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sr(e){e._valueTracker||(e._valueTracker=Kd(e))}function aa(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=sa(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Xr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function zo(e,t){var n=t.checked;return W({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Pu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=kt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function ca(e,t){t=t.checked,t!=null&&Ti(e,"checked",t,!1)}function Mo(e,t){ca(e,t);var n=kt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Oo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Oo(e,t.type,kt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Lu(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Oo(e,t,n){(t!=="number"||Xr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var In=Array.isArray;function an(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Er.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Gn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $n={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Gd=["Webkit","ms","Moz","O"];Object.keys($n).forEach(function(e){Gd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),$n[t]=$n[e]})});function ma(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||$n.hasOwnProperty(e)&&$n[e]?(""+t).trim():t+"px"}function ha(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=ma(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Yd=W({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Do(e,t){if(t){if(Yd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(k(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(k(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(k(61))}if(t.style!=null&&typeof t.style!="object")throw Error(k(62))}}function Ro(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var $o=null;function Mi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ao=null,cn=null,dn=null;function Ou(e){if(e=mr(e)){if(typeof Ao!="function")throw Error(k(280));var t=e.stateNode;t&&(t=jl(t),Ao(e.stateNode,e.type,t))}}function va(e){cn?dn?dn.push(e):dn=[e]:cn=e}function ga(){if(cn){var e=cn,t=dn;if(dn=cn=null,Ou(e),t)for(e=0;e>>=0,e===0?32:31-(uf(e)/sf|0)|0}var Cr=64,_r=4194304;function Dn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function el(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=Dn(u):(o&=i,o!==0&&(r=Dn(o)))}else i=n&~l,i!==0?r=Dn(i):o!==0&&(r=Dn(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function fr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Fe(t),e[t]=n}function ff(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Un),Vu=String.fromCharCode(32),Hu=!1;function Ra(e,t){switch(e){case"keyup":return Uf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $a(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qt=!1;function Vf(e,t){switch(e){case"compositionend":return $a(t);case"keypress":return t.which!==32?null:(Hu=!0,Vu);case"textInput":return e=t.data,e===Vu&&Hu?null:e;default:return null}}function Hf(e,t){if(qt)return e==="compositionend"||!Ui&&Ra(e,t)?(e=Ia(),Br=Ri=at=null,qt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ku(n)}}function Va(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Va(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ha(){for(var e=window,t=Xr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Xr(e.document)}return t}function Bi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function qf(e){var t=Ha(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Va(n.ownerDocument.documentElement,n)){if(r!==null&&Bi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=Gu(n,o);var i=Gu(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,bt=null,Qo=null,Vn=null,Zo=!1;function Yu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Zo||bt==null||bt!==Xr(r)||(r=bt,"selectionStart"in r&&Bi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vn&&er(Vn,r)||(Vn=r,r=rl(Qo,"onSelect"),0nn||(e.current=qo[nn],qo[nn]=null,nn--)}function R(e,t){nn++,qo[nn]=e.current,e.current=t}var St={},ue=_t(St),me=_t(!1),At=St;function gn(e,t){var n=e.type.contextTypes;if(!n)return St;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function he(e){return e=e.childContextTypes,e!=null}function ol(){U(me),U(ue)}function ns(e,t,n){if(ue.current!==St)throw Error(k(168));R(ue,t),R(me,n)}function qa(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(k(108,Zd(e)||"Unknown",l));return W({},n,r)}function il(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||St,At=ue.current,R(ue,e),R(me,me.current),!0}function rs(e,t,n){var r=e.stateNode;if(!r)throw Error(k(169));n?(e=qa(e,t,At),r.__reactInternalMemoizedMergedChildContext=e,U(me),U(ue),R(ue,e)):U(me),R(me,n)}var Ge=null,Nl=!1,co=!1;function ba(e){Ge===null?Ge=[e]:Ge.push(e)}function c0(e){Nl=!0,ba(e)}function jt(){if(!co&&Ge!==null){co=!0;var e=0,t=I;try{var n=Ge;for(I=1;e>=i,l-=i,Ye=1<<32-Fe(t)+l|n<T?(D=j,j=null):D=j.sibling;var M=f(p,j,m[T],w);if(M===null){j===null&&(j=D);break}e&&j&&M.alternate===null&&t(p,j),d=o(M,d,T),E===null?_=M:E.sibling=M,E=M,j=D}if(T===m.length)return n(p,j),B&&zt(p,T),_;if(j===null){for(;TT?(D=j,j=null):D=j.sibling;var ge=f(p,j,M.value,w);if(ge===null){j===null&&(j=D);break}e&&j&&ge.alternate===null&&t(p,j),d=o(ge,d,T),E===null?_=ge:E.sibling=ge,E=ge,j=D}if(M.done)return n(p,j),B&&zt(p,T),_;if(j===null){for(;!M.done;T++,M=m.next())M=h(p,M.value,w),M!==null&&(d=o(M,d,T),E===null?_=M:E.sibling=M,E=M);return B&&zt(p,T),_}for(j=r(p,j);!M.done;T++,M=m.next())M=y(j,p,T,M.value,w),M!==null&&(e&&M.alternate!==null&&j.delete(M.key===null?T:M.key),d=o(M,d,T),E===null?_=M:E.sibling=M,E=M);return e&&j.forEach(function(Tt){return t(p,Tt)}),B&&zt(p,T),_}function L(p,d,m,w){if(typeof m=="object"&&m!==null&&m.type===Jt&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case kr:e:{for(var _=m.key,E=d;E!==null;){if(E.key===_){if(_=m.type,_===Jt){if(E.tag===7){n(p,E.sibling),d=l(E,m.props.children),d.return=p,p=d;break e}}else if(E.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===ot&&cs(_)===E.type){n(p,E.sibling),d=l(E,m.props),d.ref=zn(p,E,m),d.return=p,p=d;break e}n(p,E);break}else t(p,E);E=E.sibling}m.type===Jt?(d=$t(m.props.children,p.mode,w,m.key),d.return=p,p=d):(w=Yr(m.type,m.key,m.props,null,p.mode,w),w.ref=zn(p,d,m),w.return=p,p=w)}return i(p);case Xt:e:{for(E=m.key;d!==null;){if(d.key===E)if(d.tag===4&&d.stateNode.containerInfo===m.containerInfo&&d.stateNode.implementation===m.implementation){n(p,d.sibling),d=l(d,m.children||[]),d.return=p,p=d;break e}else{n(p,d);break}else t(p,d);d=d.sibling}d=xo(m,p.mode,w),d.return=p,p=d}return i(p);case ot:return E=m._init,L(p,d,E(m._payload),w)}if(In(m))return g(p,d,m,w);if(jn(m))return S(p,d,m,w);Mr(p,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,d!==null&&d.tag===6?(n(p,d.sibling),d=l(d,m),d.return=p,p=d):(n(p,d),d=yo(m,p.mode,w),d.return=p,p=d),i(p)):n(p,d)}return L}var xn=uc(!0),sc=uc(!1),hr={},He=_t(hr),lr=_t(hr),or=_t(hr);function Dt(e){if(e===hr)throw Error(k(174));return e}function Xi(e,t){switch(R(or,t),R(lr,e),R(He,hr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Io(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Io(t,e)}U(He),R(He,t)}function wn(){U(He),U(lr),U(or)}function ac(e){Dt(or.current);var t=Dt(He.current),n=Io(t,e.type);t!==n&&(R(lr,e),R(He,n))}function Ji(e){lr.current===e&&(U(He),U(lr))}var V=_t(0);function fl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var fo=[];function qi(){for(var e=0;en?n:4,e(!0);var r=po.transition;po.transition={};try{e(!1),t()}finally{I=n,po.transition=r}}function _c(){return Pe().memoizedState}function m0(e,t,n){var r=yt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},jc(e))Nc(t,n);else if(n=rc(e,t,n,r),n!==null){var l=ae();Ie(n,e,r,l),Tc(n,t,r)}}function h0(e,t,n){var r=yt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(jc(e))Nc(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,u=o(i,n);if(l.hasEagerState=!0,l.eagerState=u,De(u,i)){var s=t.interleaved;s===null?(l.next=l,Gi(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=rc(e,t,l,r),n!==null&&(l=ae(),Ie(n,e,r,l),Tc(n,t,r))}}function jc(e){var t=e.alternate;return e===H||t!==null&&t===H}function Nc(e,t){Hn=pl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Tc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fi(e,n)}}var ml={readContext:Te,useCallback:le,useContext:le,useEffect:le,useImperativeHandle:le,useInsertionEffect:le,useLayoutEffect:le,useMemo:le,useReducer:le,useRef:le,useState:le,useDebugValue:le,useDeferredValue:le,useTransition:le,useMutableSource:le,useSyncExternalStore:le,useId:le,unstable_isNewReconciler:!1},v0={readContext:Te,useCallback:function(e,t){return Ue().memoizedState=[e,t===void 0?null:t],e},useContext:Te,useEffect:fs,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Qr(4194308,4,wc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Qr(4,2,e,t)},useMemo:function(e,t){var n=Ue();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ue();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=m0.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Ue();return e={current:e},t.memoizedState=e},useState:ds,useDebugValue:ru,useDeferredValue:function(e){return Ue().memoizedState=e},useTransition:function(){var e=ds(!1),t=e[0];return e=p0.bind(null,e[1]),Ue().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Ue();if(B){if(n===void 0)throw Error(k(407));n=n()}else{if(n=t(),b===null)throw Error(k(349));Bt&30||fc(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,fs(mc.bind(null,r,o,e),[e]),r.flags|=2048,sr(9,pc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ue(),t=b.identifierPrefix;if(B){var n=Xe,r=Ye;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ir++,0")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=u);break}}}finally{bl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Rn(e):""}function nf(e){switch(e.tag){case 5:return Rn(e.type);case 16:return Rn("Lazy");case 13:return Rn("Suspense");case 19:return Rn("SuspenseList");case 0:case 2:case 15:return e=eo(e.type,!1),e;case 11:return e=eo(e.type.render,!1),e;case 1:return e=eo(e.type,!0),e;default:return""}}function Fo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case qt:return"Fragment";case Jt:return"Portal";case Mo:return"Profiler";case Oi:return"StrictMode";case Oo:return"Suspense";case Io:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case fa:return(e.displayName||"Context")+".Consumer";case da:return(e._context.displayName||"Context")+".Provider";case Ii:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Fi:return t=e.displayName||null,t!==null?t:Fo(e.type)||"Memo";case it:t=e._payload,e=e._init;try{return Fo(e(t))}catch{}}return null}function rf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Fo(t);case 8:return t===Oi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function kt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ha(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function lf(e){var t=ha(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Cr(e){e._valueTracker||(e._valueTracker=lf(e))}function ma(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ha(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function qr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Do(e,t){var n=t.checked;return W({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ou(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=kt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function va(e,t){t=t.checked,t!=null&&Mi(e,"checked",t,!1)}function Ro(e,t){va(e,t);var n=kt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?$o(e,t.type,n):t.hasOwnProperty("defaultValue")&&$o(e,t.type,kt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Iu(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function $o(e,t,n){(t!=="number"||qr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var $n=Array.isArray;function cn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=_r.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Jn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},of=["Webkit","ms","Moz","O"];Object.keys(Bn).forEach(function(e){of.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Bn[t]=Bn[e]})});function wa(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Bn.hasOwnProperty(e)&&Bn[e]?(""+t).trim():t+"px"}function ka(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=wa(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var uf=W({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Bo(e,t){if(t){if(uf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(k(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(k(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(k(61))}if(t.style!=null&&typeof t.style!="object")throw Error(k(62))}}function Vo(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ho=null;function Di(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wo=null,dn=null,fn=null;function Ru(e){if(e=gr(e)){if(typeof Wo!="function")throw Error(k(280));var t=e.stateNode;t&&(t=Ll(t),Wo(e.stateNode,e.type,t))}}function Sa(e){dn?fn?fn.push(e):fn=[e]:dn=e}function Ea(){if(dn){var e=dn,t=fn;if(fn=dn=null,Ru(e),t)for(e=0;e>>=0,e===0?32:31-(yf(e)/xf|0)|0}var jr=64,Nr=4194304;function An(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=An(u):(o&=i,o!==0&&(r=An(o)))}else i=n&~l,i!==0?r=An(i):o!==0&&(r=An(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function mr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ie(t),e[t]=n}function Ef(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Hn),Zu=String.fromCharCode(32),Ku=!1;function Ha(e,t){switch(e){case"keyup":return Jf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wa(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var bt=!1;function bf(e,t){switch(e){case"compositionend":return Wa(t);case"keypress":return t.which!==32?null:(Ku=!0,Zu);case"textInput":return e=t.data,e===Zu&&Ku?null:e;default:return null}}function e0(e,t){if(bt)return e==="compositionend"||!Wi&&Ha(e,t)?(e=Ba(),Hr=Bi=ct=null,bt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ju(n)}}function Ga(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ga(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ya(){for(var e=window,t=qr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=qr(e.document)}return t}function Qi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function a0(e){var t=Ya(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ga(n.ownerDocument.documentElement,n)){if(r!==null&&Qi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=qu(n,o);var i=qu(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,en=null,Xo=null,Qn=null,Jo=!1;function bu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jo||en==null||en!==qr(r)||(r=en,"selectionStart"in r&&Qi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Qn&&rr(Qn,r)||(Qn=r,r=ol(Xo,"onSelect"),0rn||(e.current=ri[rn],ri[rn]=null,rn--)}function R(e,t){rn++,ri[rn]=e.current,e.current=t}var St={},ue=_t(St),he=_t(!1),Ut=St;function xn(e,t){var n=e.type.contextTypes;if(!n)return St;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function me(e){return e=e.childContextTypes,e!=null}function ul(){U(he),U(ue)}function is(e,t,n){if(ue.current!==St)throw Error(k(168));R(ue,t),R(he,n)}function lc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(k(108,rf(e)||"Unknown",l));return W({},n,r)}function sl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||St,Ut=ue.current,R(ue,e),R(he,he.current),!0}function us(e,t,n){var r=e.stateNode;if(!r)throw Error(k(169));n?(e=lc(e,t,Ut),r.__reactInternalMemoizedMergedChildContext=e,U(he),U(ue),R(ue,e)):U(he),R(he,n)}var Ge=null,Pl=!1,mo=!1;function oc(e){Ge===null?Ge=[e]:Ge.push(e)}function k0(e){Pl=!0,oc(e)}function jt(){if(!mo&&Ge!==null){mo=!0;var e=0,t=F;try{var n=Ge;for(F=1;e>=i,l-=i,Ye=1<<32-Ie(t)+l|n<T?(D=j,j=null):D=j.sibling;var M=f(p,j,m[T],w);if(M===null){j===null&&(j=D);break}e&&j&&M.alternate===null&&t(p,j),d=o(M,d,T),E===null?_=M:E.sibling=M,E=M,j=D}if(T===m.length)return n(p,j),B&&zt(p,T),_;if(j===null){for(;TT?(D=j,j=null):D=j.sibling;var ge=f(p,j,M.value,w);if(ge===null){j===null&&(j=D);break}e&&j&&ge.alternate===null&&t(p,j),d=o(ge,d,T),E===null?_=ge:E.sibling=ge,E=ge,j=D}if(M.done)return n(p,j),B&&zt(p,T),_;if(j===null){for(;!M.done;T++,M=m.next())M=h(p,M.value,w),M!==null&&(d=o(M,d,T),E===null?_=M:E.sibling=M,E=M);return B&&zt(p,T),_}for(j=r(p,j);!M.done;T++,M=m.next())M=g(j,p,T,M.value,w),M!==null&&(e&&M.alternate!==null&&j.delete(M.key===null?T:M.key),d=o(M,d,T),E===null?_=M:E.sibling=M,E=M);return e&&j.forEach(function(Tt){return t(p,Tt)}),B&&zt(p,T),_}function L(p,d,m,w){if(typeof m=="object"&&m!==null&&m.type===qt&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Er:e:{for(var _=m.key,E=d;E!==null;){if(E.key===_){if(_=m.type,_===qt){if(E.tag===7){n(p,E.sibling),d=l(E,m.props.children),d.return=p,p=d;break e}}else if(E.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===it&&hs(_)===E.type){n(p,E.sibling),d=l(E,m.props),d.ref=In(p,E,m),d.return=p,p=d;break e}n(p,E);break}else t(p,E);E=E.sibling}m.type===qt?(d=$t(m.props.children,p.mode,w,m.key),d.return=p,p=d):(w=Jr(m.type,m.key,m.props,null,p.mode,w),w.ref=In(p,d,m),w.return=p,p=w)}return i(p);case Jt:e:{for(E=m.key;d!==null;){if(d.key===E)if(d.tag===4&&d.stateNode.containerInfo===m.containerInfo&&d.stateNode.implementation===m.implementation){n(p,d.sibling),d=l(d,m.children||[]),d.return=p,p=d;break e}else{n(p,d);break}else t(p,d);d=d.sibling}d=Eo(m,p.mode,w),d.return=p,p=d}return i(p);case it:return E=m._init,L(p,d,E(m._payload),w)}if($n(m))return y(p,d,m,w);if(Ln(m))return S(p,d,m,w);Ir(p,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,d!==null&&d.tag===6?(n(p,d.sibling),d=l(d,m),d.return=p,p=d):(n(p,d),d=So(m,p.mode,w),d.return=p,p=d),i(p)):n(p,d)}return L}var kn=pc(!0),hc=pc(!1),yr={},He=_t(yr),ur=_t(yr),sr=_t(yr);function Dt(e){if(e===yr)throw Error(k(174));return e}function eu(e,t){switch(R(sr,t),R(ur,e),R(He,yr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Uo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Uo(t,e)}U(He),R(He,t)}function Sn(){U(He),U(ur),U(sr)}function mc(e){Dt(sr.current);var t=Dt(He.current),n=Uo(t,e.type);t!==n&&(R(ur,e),R(He,n))}function tu(e){ur.current===e&&(U(He),U(ur))}var V=_t(0);function hl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var vo=[];function nu(){for(var e=0;en?n:4,e(!0);var r=go.transition;go.transition={};try{e(!1),t()}finally{F=n,go.transition=r}}function zc(){return Le().memoizedState}function _0(e,t,n){var r=yt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Mc(e))Oc(t,n);else if(n=ac(e,t,n,r),n!==null){var l=ae();Fe(n,e,r,l),Ic(n,t,r)}}function j0(e,t,n){var r=yt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Mc(e))Oc(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,u=o(i,n);if(l.hasEagerState=!0,l.eagerState=u,De(u,i)){var s=t.interleaved;s===null?(l.next=l,qi(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=ac(e,t,l,r),n!==null&&(l=ae(),Fe(n,e,r,l),Ic(n,t,r))}}function Mc(e){var t=e.alternate;return e===H||t!==null&&t===H}function Oc(e,t){Zn=ml=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ic(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$i(e,n)}}var vl={readContext:Te,useCallback:le,useContext:le,useEffect:le,useImperativeHandle:le,useInsertionEffect:le,useLayoutEffect:le,useMemo:le,useReducer:le,useRef:le,useState:le,useDebugValue:le,useDeferredValue:le,useTransition:le,useMutableSource:le,useSyncExternalStore:le,useId:le,unstable_isNewReconciler:!1},N0={readContext:Te,useCallback:function(e,t){return Ue().memoizedState=[e,t===void 0?null:t],e},useContext:Te,useEffect:vs,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Kr(4194308,4,jc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Kr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Kr(4,2,e,t)},useMemo:function(e,t){var n=Ue();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ue();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=_0.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Ue();return e={current:e},t.memoizedState=e},useState:ms,useDebugValue:uu,useDeferredValue:function(e){return Ue().memoizedState=e},useTransition:function(){var e=ms(!1),t=e[0];return e=C0.bind(null,e[1]),Ue().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Ue();if(B){if(n===void 0)throw Error(k(407));n=n()}else{if(n=t(),b===null)throw Error(k(349));Vt&30||yc(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,vs(wc.bind(null,r,o,e),[e]),r.flags|=2048,dr(9,xc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ue(),t=b.identifierPrefix;if(B){var n=Xe,r=Ye;n=(r&~(1<<32-Ie(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ar++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Be]=t,e[rr]=r,Rc(e,t,!1,!1),t.stateNode=e;e:{switch(i=Ro(n,r),n){case"dialog":A("cancel",e),A("close",e),l=r;break;case"iframe":case"object":case"embed":A("load",e),l=r;break;case"video":case"audio":for(l=0;lSn&&(t.flags|=128,r=!0,Mn(o,!1),t.lanes=4194304)}else{if(!r)if(e=fl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Mn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!B)return oe(t),null}else 2*G()-o.renderingStartTime>Sn&&n!==1073741824&&(t.flags|=128,r=!0,Mn(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=G(),t.sibling=null,n=V.current,R(V,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return au(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ye&1073741824&&(oe(t),t.subtreeFlags&6&&(t.flags|=8192)):oe(t),null;case 24:return null;case 25:return null}throw Error(k(156,t.tag))}function C0(e,t){switch(Hi(t),t.tag){case 1:return he(t.type)&&ol(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return wn(),U(me),U(ue),qi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ji(t),null;case 13:if(U(V),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(k(340));yn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(V),null;case 4:return wn(),null;case 10:return Ki(t.type._context),null;case 22:case 23:return au(),null;case 24:return null;default:return null}}var Fr=!1,ie=!1,_0=typeof WeakSet=="function"?WeakSet:Set,N=null;function un(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Q(e,t,r)}else n.current=null}function ci(e,t,n){try{n()}catch(r){Q(e,t,r)}}var ks=!1;function j0(e,t){if(Ko=tl,e=Ha(),Bi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,u=-1,s=-1,a=0,v=0,h=e,f=null;t:for(;;){for(var y;h!==n||l!==0&&h.nodeType!==3||(u=i+l),h!==o||r!==0&&h.nodeType!==3||(s=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(y=h.firstChild)!==null;)f=h,h=y;for(;;){if(h===e)break t;if(f===n&&++a===l&&(u=i),f===o&&++v===r&&(s=i),(y=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=y}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Go={focusedElem:e,selectionRange:n},tl=!1,N=t;N!==null;)if(t=N,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,N=e;else for(;N!==null;){t=N;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var S=g.memoizedProps,L=g.memoizedState,p=t.stateNode,d=p.getSnapshotBeforeUpdate(t.elementType===t.type?S:ze(t.type,S),L);p.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(k(163))}}catch(w){Q(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,N=e;break}N=t.return}return g=ks,ks=!1,g}function Wn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&ci(t,n,o)}l=l.next}while(l!==r)}}function Ll(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function di(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Uc(e){var t=e.alternate;t!==null&&(e.alternate=null,Uc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Be],delete t[rr],delete t[Jo],delete t[s0],delete t[a0])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Bc(e){return e.tag===5||e.tag===3||e.tag===4}function Ss(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Bc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function fi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ll));else if(r!==4&&(e=e.child,e!==null))for(fi(e,t,n),e=e.sibling;e!==null;)fi(e,t,n),e=e.sibling}function pi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(pi(e,t,n),e=e.sibling;e!==null;)pi(e,t,n),e=e.sibling}var te=null,Me=!1;function lt(e,t,n){for(n=n.child;n!==null;)Vc(e,t,n),n=n.sibling}function Vc(e,t,n){if(Ve&&typeof Ve.onCommitFiberUnmount=="function")try{Ve.onCommitFiberUnmount(Sl,n)}catch{}switch(n.tag){case 5:ie||un(n,t);case 6:var r=te,l=Me;te=null,lt(e,t,n),te=r,Me=l,te!==null&&(Me?(e=te,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):te.removeChild(n.stateNode));break;case 18:te!==null&&(Me?(e=te,n=n.stateNode,e.nodeType===8?ao(e.parentNode,n):e.nodeType===1&&ao(e,n),qn(e)):ao(te,n.stateNode));break;case 4:r=te,l=Me,te=n.stateNode.containerInfo,Me=!0,lt(e,t,n),te=r,Me=l;break;case 0:case 11:case 14:case 15:if(!ie&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&ci(n,t,i),l=l.next}while(l!==r)}lt(e,t,n);break;case 1:if(!ie&&(un(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){Q(n,t,u)}lt(e,t,n);break;case 21:lt(e,t,n);break;case 22:n.mode&1?(ie=(r=ie)||n.memoizedState!==null,lt(e,t,n),ie=r):lt(e,t,n);break;default:lt(e,t,n)}}function Es(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _0),t.forEach(function(r){var l=I0.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Le(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=G()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*T0(r/1960))-r,10e?16:e,ct===null)var r=!1;else{if(e=ct,ct=null,gl=0,F&6)throw Error(k(331));var l=F;for(F|=4,N=e.current;N!==null;){var o=N,i=o.child;if(N.flags&16){var u=o.deletions;if(u!==null){for(var s=0;sG()-uu?Rt(e,0):iu|=n),ve(e,t)}function Xc(e,t){t===0&&(e.mode&1?(t=_r,_r<<=1,!(_r&130023424)&&(_r=4194304)):t=1);var n=ae();e=et(e,t),e!==null&&(fr(e,t,n),ve(e,n))}function F0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xc(e,n)}function I0(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(k(314))}r!==null&&r.delete(t),Xc(e,n)}var Jc;Jc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||me.current)pe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return pe=!1,S0(e,t,n);pe=!!(e.flags&131072)}else pe=!1,B&&t.flags&1048576&&ec(t,sl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Zr(e,t),e=t.pendingProps;var l=gn(t,ue.current);pn(t,n),l=eu(null,t,r,e,l,n);var o=tu();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,he(r)?(o=!0,il(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Yi(t),l.updater=Tl,t.stateNode=l,l._reactInternals=t,ri(t,r,e,n),t=ii(null,t,r,!0,o,n)):(t.tag=0,B&&o&&Vi(t),se(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Zr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=R0(r),e=ze(r,e),l){case 0:t=oi(null,t,r,e,n);break e;case 1:t=ys(null,t,r,e,n);break e;case 11:t=vs(null,t,r,e,n);break e;case 14:t=gs(null,t,r,ze(r.type,e),n);break e}throw Error(k(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),oi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ys(e,t,r,l,n);case 3:e:{if(Fc(t),e===null)throw Error(k(387));r=t.pendingProps,o=t.memoizedState,l=o.element,lc(e,t),dl(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=kn(Error(k(423)),t),t=xs(e,t,r,n,l);break e}else if(r!==l){l=kn(Error(k(424)),t),t=xs(e,t,r,n,l);break e}else for(xe=ht(t.stateNode.containerInfo.firstChild),we=t,B=!0,Oe=null,n=sc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(yn(),r===l){t=tt(e,t,n);break e}se(e,t,r,n)}t=t.child}return t;case 5:return ac(t),e===null&&ei(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Yo(r,l)?i=null:o!==null&&Yo(r,o)&&(t.flags|=32),Oc(e,t),se(e,t,i,n),t.child;case 6:return e===null&&ei(t),null;case 13:return Ic(e,t,n);case 4:return Xi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=xn(t,null,r,n):se(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),vs(e,t,r,l,n);case 7:return se(e,t,t.pendingProps,n),t.child;case 8:return se(e,t,t.pendingProps.children,n),t.child;case 12:return se(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,R(al,r._currentValue),r._currentValue=i,o!==null)if(De(o.value,i)){if(o.children===l.children&&!me.current){t=tt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=Je(-1,n&-n),s.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var v=a.pending;v===null?s.next=s:(s.next=v.next,v.next=s),a.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),ti(o.return,n,t),u.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(k(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ti(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}se(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,pn(t,n),l=Te(l),r=r(l),t.flags|=1,se(e,t,r,n),t.child;case 14:return r=t.type,l=ze(r,t.pendingProps),l=ze(r.type,l),gs(e,t,r,l,n);case 15:return zc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Zr(e,t),t.tag=1,he(r)?(e=!0,il(t)):e=!1,pn(t,n),ic(t,r,l),ri(t,r,l,n),ii(null,t,r,!0,e,n);case 19:return Dc(e,t,n);case 22:return Mc(e,t,n)}throw Error(k(156,t.tag))};function qc(e,t){return Ca(e,t)}function D0(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function je(e,t,n,r){return new D0(e,t,n,r)}function du(e){return e=e.prototype,!(!e||!e.isReactComponent)}function R0(e){if(typeof e=="function")return du(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Li)return 11;if(e===zi)return 14}return 2}function xt(e,t){var n=e.alternate;return n===null?(n=je(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Yr(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")du(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Jt:return $t(n.children,l,o,t);case Pi:i=8,l|=8;break;case No:return e=je(12,n,t,l|2),e.elementType=No,e.lanes=o,e;case To:return e=je(13,n,t,l),e.elementType=To,e.lanes=o,e;case Po:return e=je(19,n,t,l),e.elementType=Po,e.lanes=o,e;case ua:return Ml(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case oa:i=10;break e;case ia:i=9;break e;case Li:i=11;break e;case zi:i=14;break e;case ot:i=16,r=null;break e}throw Error(k(130,e==null?e:typeof e,""))}return t=je(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function $t(e,t,n,r){return e=je(7,e,r,t),e.lanes=n,e}function Ml(e,t,n,r){return e=je(22,e,r,t),e.elementType=ua,e.lanes=n,e.stateNode={isHidden:!1},e}function yo(e,t,n){return e=je(6,e,null,t),e.lanes=n,e}function xo(e,t,n){return t=je(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $0(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ql(0),this.expirationTimes=ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ql(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function fu(e,t,n,r,l,o,i,u,s){return e=new $0(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=je(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yi(o),e}function A0(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(nd)}catch(e){console.error(e)}}nd(),ea.exports=Se;var rd=ea.exports;const W0=ki(rd);var zs=rd;_o.createRoot=zs.createRoot,_o.hydrateRoot=zs.hydrateRoot;const Nt=x.createContext({listTorrents:()=>{throw new Error("Function not implemented.")},getTorrentDetails:()=>{throw new Error("Function not implemented.")},getTorrentStats:()=>{throw new Error("Function not implemented.")},uploadTorrent:()=>{throw new Error("Function not implemented.")},pause:()=>{throw new Error("Function not implemented.")},start:()=>{throw new Error("Function not implemented.")},forget:()=>{throw new Error("Function not implemented.")},delete:()=>{throw new Error("Function not implemented.")},getStreamLogsUrl:()=>null}),vr=x.createContext({setCloseableError:e=>{},refreshTorrents:()=>{}}),ld=x.createContext({refresh:()=>{}}),wl=({label:e,className:t})=>c.jsxs("div",{className:`flex gap-2 items-center ${t}`,children:[c.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),c.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),e?c.jsxs("span",{className:"text-sm",children:[e," ..."]}):c.jsx("span",{className:"sr-only",children:"Loading..."})]}),vu="initializing",Q0="paused",Z0="live",K0="error";function gu(e,t){let n,r=t;const l=async()=>{if(r=await e(),r==null)throw"asyncCallback returned null or undefined";o()};let o=()=>{n=setTimeout(l,r)};return o(),()=>{clearTimeout(n)}}function od(e,t){let n;const r=async()=>{await e().then(()=>!1,()=>!0)&&l()};let l=o=>{n=setTimeout(r,o!==void 0?o:t)};return l(0),()=>clearTimeout(n)}var id={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ms=dt.createContext&&dt.createContext(id),wt=globalThis&&globalThis.__assign||function(){return wt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{onClick:t,disabled:n,color:r,children:l,className:o,...i}=e,u=a=>{a.stopPropagation(),!n&&t()},s=r?`text-${r}`:"";return c.jsx("a",{className:`block p-1 text-blue-500 flex items-center justify-center ${s} ${o}`,onClick:u,href:"#",...i,children:l})};function b0(e){return ee({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M0 .5A.5.5 0 0 1 .5 0h4a.5.5 0 0 1 0 1h-4A.5.5 0 0 1 0 .5Zm0 2A.5.5 0 0 1 .5 2h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm9 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-9 2A.5.5 0 0 1 .5 4h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm5 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm-12 2A.5.5 0 0 1 .5 6h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm8 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-8 2A.5.5 0 0 1 .5 8h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm-7 2a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 0 1h-8a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5Z"}}]})(e)}function e1(e){return ee({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278zM4.858 1.311A7.269 7.269 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.316 7.316 0 0 0 5.205-2.162c-.337.042-.68.063-1.029.063-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286z"}}]})(e)}function sd(e){return ee({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}}]})(e)}const t1=({title:e,children:t,onClose:n})=>c.jsxs("div",{className:"bg-red-200 p-3 rounded-md mb-3 dark:bg-red-800/60",children:[c.jsxs("div",{className:"flex justify-between mb-2",children:[c.jsx("h2",{className:"text-lg font-semibold",children:e}),n&&c.jsx("button",{onClick:n,children:c.jsx(sd,{})})]}),t]}),Wt=e=>{var r,l,o;let{error:t,remove:n}=e;return t==null?null:c.jsxs(t1,{onClose:n,title:t.text,children:[((r=t.details)==null?void 0:r.statusText)&&c.jsx("div",{className:"pb-2 text-md",children:(l=t.details)==null?void 0:l.statusText}),c.jsx("div",{className:"whitespace-pre-wrap text-sm",children:(o=t.details)==null?void 0:o.text})]})};function yu(e){return e&&e.ownerDocument||document}function wo(e){e===void 0&&(e=yu());try{var t=e.activeElement;return!t||!t.nodeName?null:t}catch{return e.body}}function Os(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}const Rl=!!(typeof window<"u"&&window.document&&window.document.createElement);var yi=!1,xi=!1;try{var ko={get passive(){return yi=!0},get once(){return xi=yi=!0}};Rl&&(window.addEventListener("test",ko,ko),window.removeEventListener("test",ko,!0))}catch{}function n1(e,t,n,r){if(r&&typeof r!="boolean"&&!xi){var l=r.once,o=r.capture,i=n;!xi&&l&&(i=n.__once||function u(s){this.removeEventListener(t,u,o),n.call(this,s)},n.__once=i),e.addEventListener(t,i,yi?r:o)}e.addEventListener(t,n,r)}function r1(e,t,n,r){var l=r&&typeof r!="boolean"?r.capture:r;e.removeEventListener(t,n,l),n.__once&&e.removeEventListener(t,n.__once,l)}function Fs(e,t,n,r){return n1(e,t,n,r),function(){r1(e,t,n,r)}}function l1(){const e=x.useRef(!0),t=x.useRef(()=>e.current);return x.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),t.current}function o1(e){const t=x.useRef(e);return t.current=e,t}function i1(e){const t=o1(e);x.useEffect(()=>()=>t.current(),[])}function u1(e){const t=x.useRef(null);return x.useEffect(()=>{t.current=e}),t.current}function s1(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e},[e]),t}function Ot(e){const t=s1(e);return x.useCallback(function(...n){return t.current&&t.current(...n)},[t])}function a1(e){var t=yu(e);return t&&t.defaultView||window}function c1(e,t){return a1(e).getComputedStyle(e,t)}var d1=/([A-Z])/g;function f1(e){return e.replace(d1,"-$1").toLowerCase()}var p1=/^ms-/;function Rr(e){return f1(e).replace(p1,"-ms-")}var m1=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function h1(e){return!!(e&&m1.test(e))}function Is(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(Rr(t))||c1(e).getPropertyValue(Rr(t));Object.keys(t).forEach(function(l){var o=t[l];!o&&o!==0?e.style.removeProperty(Rr(l)):h1(l)?r+=l+"("+o+") ":n+=Rr(l)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}const v1="data-rr-ui-";function g1(e){return`${v1}${e}`}function y1(e=document){const t=e.defaultView;return Math.abs(t.innerWidth-e.documentElement.clientWidth)}const Ds=g1("modal-open");class x1{constructor({ownerDocument:t,handleContainerOverflow:n=!0,isRTL:r=!1}={}){this.handleContainerOverflow=n,this.isRTL=r,this.modals=[],this.ownerDocument=t}getScrollbarWidth(){return y1(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(t){}removeModalAttributes(t){}setContainerStyle(t){const n={overflow:"hidden"},r=this.isRTL?"paddingLeft":"paddingRight",l=this.getElement();t.style={overflow:l.style.overflow,[r]:l.style[r]},t.scrollBarWidth&&(n[r]=`${parseInt(Is(l,r)||"0",10)+t.scrollBarWidth}px`),l.setAttribute(Ds,""),Is(l,n)}reset(){[...this.modals].forEach(t=>this.remove(t))}removeContainerStyle(t){const n=this.getElement();n.removeAttribute(Ds),Object.assign(n.style,t.style)}add(t){let n=this.modals.indexOf(t);return n!==-1||(n=this.modals.length,this.modals.push(t),this.setModalAttributes(t),n!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),n}remove(t){const n=this.modals.indexOf(t);n!==-1&&(this.modals.splice(n,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(t))}isTopModal(t){return!!this.modals.length&&this.modals[this.modals.length-1]===t}}const ad=x1,cd=x.createContext(Rl?window:void 0);cd.Provider;function xu(){return x.useContext(cd)}const So=(e,t)=>Rl?e==null?(t||yu()).body:(typeof e=="function"&&(e=e()),e&&"current"in e&&(e=e.current),e&&("nodeType"in e||e.getBoundingClientRect)?e:null):null;function w1(e,t){const n=xu(),[r,l]=x.useState(()=>So(e,n==null?void 0:n.document));if(!r){const o=So(e);o&&l(o)}return x.useEffect(()=>{t&&r&&t(r)},[t,r]),x.useEffect(()=>{const o=So(e);o!==r&&l(o)},[e,r]),r}const Rs=e=>!e||typeof e=="function"?e:t=>{e.current=t};function k1(e,t){const n=Rs(e),r=Rs(t);return l=>{n&&n(l),r&&r(l)}}function dd(e,t){return x.useMemo(()=>k1(e,t),[e,t])}const S1=typeof global<"u"&&global.navigator&&global.navigator.product==="ReactNative",E1=typeof document<"u",$s=E1||S1?x.useLayoutEffect:x.useEffect;function C1({children:e,in:t,onExited:n,mountOnEnter:r,unmountOnExit:l}){const o=x.useRef(null),i=x.useRef(t),u=Ot(n);x.useEffect(()=>{t?i.current=!0:u(o.current)},[t,u]);const s=dd(o,e.ref),a=x.cloneElement(e,{ref:s});return t?a:l||!i.current&&r?null:a}function _1({in:e,onTransition:t}){const n=x.useRef(null),r=x.useRef(!0),l=Ot(t);return $s(()=>{if(!n.current)return;let o=!1;return l({in:e,element:n.current,initial:r.current,isStale:()=>o}),()=>{o=!0}},[e,l]),$s(()=>(r.current=!1,()=>{r.current=!0}),[]),n}function j1({children:e,in:t,onExited:n,onEntered:r,transition:l}){const[o,i]=x.useState(!t);t&&o&&i(!1);const u=_1({in:!!t,onTransition:a=>{const v=()=>{a.isStale()||(a.in?r==null||r(a.element,a.initial):(i(!0),n==null||n(a.element)))};Promise.resolve(l(a)).then(v,h=>{throw a.in||i(!0),h})}}),s=dd(u,e.ref);return o&&!t?null:x.cloneElement(e,{ref:s})}function As(e,t,n){return e?c.jsx(e,Object.assign({},n)):t?c.jsx(j1,Object.assign({},n,{transition:t})):c.jsx(C1,Object.assign({},n))}function N1(e){return e.code==="Escape"||e.keyCode===27}const T1=["show","role","className","style","children","backdrop","keyboard","onBackdropClick","onEscapeKeyDown","transition","runTransition","backdropTransition","runBackdropTransition","autoFocus","enforceFocus","restoreFocus","restoreFocusOptions","renderDialog","renderBackdrop","manager","container","onShow","onHide","onExit","onExited","onExiting","onEnter","onEntering","onEntered"];function P1(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,o;for(o=0;o=0)&&(n[l]=e[l]);return n}let Eo;function L1(e){return Eo||(Eo=new ad({ownerDocument:e==null?void 0:e.document})),Eo}function z1(e){const t=xu(),n=e||L1(t),r=x.useRef({dialog:null,backdrop:null});return Object.assign(r.current,{add:()=>n.add(r.current),remove:()=>n.remove(r.current),isTopModal:()=>n.isTopModal(r.current),setDialogRef:x.useCallback(l=>{r.current.dialog=l},[]),setBackdropRef:x.useCallback(l=>{r.current.backdrop=l},[])})}const fd=x.forwardRef((e,t)=>{let{show:n=!1,role:r="dialog",className:l,style:o,children:i,backdrop:u=!0,keyboard:s=!0,onBackdropClick:a,onEscapeKeyDown:v,transition:h,runTransition:f,backdropTransition:y,runBackdropTransition:g,autoFocus:S=!0,enforceFocus:L=!0,restoreFocus:p=!0,restoreFocusOptions:d,renderDialog:m,renderBackdrop:w=K=>c.jsx("div",Object.assign({},K)),manager:_,container:E,onShow:j,onHide:T=()=>{},onExit:D,onExited:M,onExiting:ge,onEnter:Tt,onEntering:Pt,onEntered:gr}=e,Vl=P1(e,T1);const Re=xu(),rt=w1(E),C=z1(_),P=l1(),z=u1(n),[$,Z]=x.useState(!n),We=x.useRef(null);x.useImperativeHandle(t,()=>C,[C]),Rl&&!z&&n&&(We.current=wo(Re==null?void 0:Re.document)),n&&$&&Z(!1);const $e=Ot(()=>{if(C.add(),Wl.current=Fs(document,"keydown",gd),Hl.current=Fs(document,"focus",()=>setTimeout(Qe),!0),j&&j(),S){var K,Su;const Zl=wo((K=(Su=C.dialog)==null?void 0:Su.ownerDocument)!=null?K:Re==null?void 0:Re.document);C.dialog&&Zl&&!Os(C.dialog,Zl)&&(We.current=Zl,C.dialog.focus())}}),Lt=Ot(()=>{if(C.remove(),Wl.current==null||Wl.current(),Hl.current==null||Hl.current(),p){var K;(K=We.current)==null||K.focus==null||K.focus(d),We.current=null}});x.useEffect(()=>{!n||!rt||$e()},[n,rt,$e]),x.useEffect(()=>{$&&Lt()},[$,Lt]),i1(()=>{Lt()});const Qe=Ot(()=>{if(!L||!P()||!C.isTopModal())return;const K=wo(Re==null?void 0:Re.document);C.dialog&&K&&!Os(C.dialog,K)&&C.dialog.focus()}),Kt=Ot(K=>{K.target===K.currentTarget&&(a==null||a(K),u===!0&&T())}),gd=Ot(K=>{s&&N1(K)&&C.isTopModal()&&(v==null||v(K),K.defaultPrevented||T())}),Hl=x.useRef(),Wl=x.useRef(),yd=(...K)=>{Z(!0),M==null||M(...K)};if(!rt)return null;const ku=Object.assign({role:r,ref:C.setDialogRef,"aria-modal":r==="dialog"?!0:void 0},Vl,{style:o,className:l,tabIndex:-1});let Ql=m?m(ku):c.jsx("div",Object.assign({},ku,{children:x.cloneElement(i,{role:"document"})}));Ql=As(h,f,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!n,onExit:D,onExiting:ge,onExited:yd,onEnter:Tt,onEntering:Pt,onEntered:gr,children:Ql});let yr=null;return u&&(yr=w({ref:C.setBackdropRef,onClick:Kt}),yr=As(y,g,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:yr})),c.jsx(c.Fragment,{children:W0.createPortal(c.jsxs(c.Fragment,{children:[yr,Ql]}),rt)})});fd.displayName="Modal";const M1=Object.assign(fd,{Manager:ad}),O1=({onClose:e,title:t})=>c.jsxs("div",{className:"flex p-3 justify-between items-center border-b dark:border-slate-600",children:[c.jsx("h2",{className:"text-xl font-semibold dark:slate-300",children:t}),e&&c.jsx("button",{className:"text-gray-500 hover:text-gray-700",onClick:e,"aria-label":"Close modal",children:c.jsx(sd,{className:"w-5 h-5"})})]}),$l=({isOpen:e,onClose:t,title:n,children:r,className:l})=>{const o=()=>c.jsx("div",{className:"fixed inset-0 bg-black/30 z-[300] dark:bg-black/60 backdrop-blur"});return c.jsx(M1,{show:e,onHide:t,renderBackdrop:o,className:"fixed z-[301] top-0 left-0 w-full h-full block overflow-x-hidden overflow-y-auto",children:c.jsxs("div",{className:`bg-white shadow-lg my-8 mx-auto max-w-2xl rounded ${l} dark:bg-slate-800 dark:text-gray-50`,children:[c.jsx(O1,{onClose:t,title:n}),r]})})},Al=({children:e})=>c.jsx("div",{className:"p-3 border-b dark:border-slate-500",children:e}),Ul=({children:e,className:t})=>c.jsx("div",{className:`p-3 flex justify-end gap-2 ${t}`,children:e}),Et=({onClick:e,children:t,className:n,disabled:r,variant:l})=>{let o={secondary:"hover:bg-blue-500 transition-colors hover:text-white dark:hover:bg-blue-900/50",danger:"bg-red-400 text-white border-green-50 hover:border-red-700 hover:bg-red-600 dark:bg-red-800 dark:border-none dark:hover:bg-red-900",primary:"bg-blue-600 text-white hover:bg-blue-800 disabled:bg-blue-200 dark:disabled:bg-slate-600 dark:disabled:text-slate-300 dark:border-none",cancel:"hover:bg-slate-200 dark:bg-slate-600 dark:hover:bg-slate-700 dark:border-none",none:""}[l??"secondary"];return c.jsx("button",{disabled:r,onClick:i=>{i.preventDefault(),e()},className:`inline-flex items-center gap-1 border rounded-lg disabled:cursor-not-allowed px-2 py-1 dark:border-slate-700 ${o} ${n}`,children:t})},F1=({id:e,show:t,onHide:n})=>{if(!t)return null;const[r,l]=x.useState(!1),[o,i]=x.useState(null),[u,s]=x.useState(!1),a=x.useContext(vr),v=x.useContext(Nt),h=()=>{l(!1),i(null),s(!1),n()},f=()=>{s(!0),(r?v.delete:v.forget)(e).then(()=>{a.refreshTorrents(),h()}).catch(g=>{i({text:`Error deleting torrent id=${e}`,details:g}),s(!1)})};return c.jsxs($l,{isOpen:t,onClose:n,title:"Delete torrent",children:[c.jsxs(Al,{children:[c.jsx("p",{className:"text-gray-700 dark:text-slate-300",children:"Are you sure you want to delete the torrent?"}),c.jsxs("div",{className:"mt-4 flex items-center",children:[c.jsx("input",{type:"checkbox",id:"deleteFiles",className:"form-checkbox h-4 w-4 text-blue-500",onChange:()=>l(!r),checked:r,placeholder:"Also delete files"}),c.jsx("label",{htmlFor:"deleteFiles",className:"ml-2 text-gray-700 dark:text-slate-300",children:"Also delete files"})]}),o&&c.jsx(Wt,{error:o})]}),c.jsxs(Ul,{children:[u&&c.jsx(wl,{}),c.jsx(Et,{variant:"cancel",onClick:h,children:"Cancel"}),c.jsx(Et,{variant:"danger",onClick:f,disabled:u,children:"Delete Torrent"})]})]})};function I1(e){return ee({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"}}]})(e)}function D1(e){return ee({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function R1(e){return ee({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}const $1=({id:e,statsResponse:t})=>{let n=t.state,[r,l]=x.useState(!1),[o,i]=x.useState(!1),u=x.useContext(ld);const s=n=="live",a=n=="paused"||n=="error",v=x.useContext(vr),h=x.useContext(Nt),f=()=>{l(!0),h.start(e).then(()=>{u.refresh()},L=>{v.setCloseableError({text:`Error starting torrent id=${e}`,details:L})}).finally(()=>l(!1))},y=()=>{l(!0),h.pause(e).then(()=>{u.refresh()},L=>{v.setCloseableError({text:`Error pausing torrent id=${e}`,details:L})}).finally(()=>l(!1))},g=()=>{l(!0),i(!0)},S=()=>{l(!1),i(!1)};return c.jsxs("div",{className:"flex w-full justify-center gap-2 dark:text-slate-300",children:[a&&c.jsx(hn,{onClick:f,disabled:r,children:c.jsx(D1,{className:"hover:text-green-600"})}),s&&c.jsx(hn,{onClick:y,disabled:r,children:c.jsx(I1,{className:"hover:text-amber-500"})}),c.jsx(hn,{onClick:g,disabled:r,children:c.jsx(R1,{className:"hover:text-red-500"})}),c.jsx(F1,{id:e,show:o,onHide:S})]})},A1=({now:e,variant:t,label:n})=>{const r=n??`${e.toFixed(2)}%`,l={warn:"bg-amber-500",info:"bg-blue-500 text-white",success:"bg-green-700 text-white",error:"bg-red-500 text-white"}[t??"info"];return c.jsx("div",{className:"w-full bg-gray-200 rounded-full dark:bg-gray-500",children:c.jsx("div",{className:`text-xs bg-blue-500 text-white font-medium transition-all text-center p-0.5 leading-none rounded-full ${l}`,style:{width:`${e}%`},children:r})})};function cr(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+n[r]}const U1=({statsResponse:e})=>{var t,n;switch(e.state){case Q0:return"Paused";case vu:return"Checking files";case K0:return"Error"}return e.state!="live"||e.live===null?e.state:c.jsxs(c.Fragment,{children:[!e.finished&&c.jsxs("div",{className:"download-speed",children:["↓ ",(t=e.live.download_speed)==null?void 0:t.human_readable]}),c.jsxs("div",{className:"upload-speed",children:["↑ ",(n=e.live.upload_speed)==null?void 0:n.human_readable,e.live.snapshot.uploaded_bytes>0&&c.jsxs("span",{children:["(",cr(e.live.snapshot.uploaded_bytes),")"]})]})]})};function B1(e){return e.files.filter(n=>n.included).reduce((n,r)=>n.length>r.length?n:r).name}function V1(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,l=(o,i)=>o>0?`${o}${i}`:"";return t>0?`${l(t,"h")} ${l(n,"m")}`.trim():n>0?`${l(n,"m")} ${l(r,"s")}`.trim():`${l(r,"s")}`.trim()}function H1(e){var n,r,l;let t=(l=(r=(n=e==null?void 0:e.live)==null?void 0:n.time_remaining)==null?void 0:r.duration)==null?void 0:l.secs;return t==null?"N/A":V1(t)}function W1(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}}]})(e)}function Q1(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}}]})(e)}function Z1(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}}]})(e)}function K1(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M9 16h6v-6h4l-7-7-7 7h4v6zm3-10.17L14.17 8H13v6h-2V8H9.83L12 5.83zM5 18h14v2H5z"}}]})(e)}function G1(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 12c0 5.52-4.48 10-10 10S2 17.52 2 12c0-1.19.22-2.32.6-3.38l1.88.68C4.17 10.14 4 11.05 4 12c0 4.41 3.59 8 8 8s8-3.59 8-8-3.59-8-8-8c-.95 0-1.85.17-2.69.48l-.68-1.89C9.69 2.22 10.82 2 12 2c5.52 0 10 4.48 10 10zM5.5 4C4.67 4 4 4.67 4 5.5S4.67 7 5.5 7 7 6.33 7 5.5 6.33 4 5.5 4zM11 16V8H9v8h2zm4 0V8h-2v8h2z"}}]})(e)}const Y1=({className:e,finished:t,live:n,error:r})=>{const l=t&&n;return r?c.jsx(Q1,{className:e,color:"red"}):l?c.jsx(K1,{className:e,color:"green"}):t?c.jsx(W1,{className:e,color:"green"}):n?c.jsx(Z1,{className:`text-blue-500 ${e}`}):c.jsx(G1,{className:e})},X1=({id:e,detailsResponse:t,statsResponse:n})=>{const r=(n==null?void 0:n.state)??"",l=(n==null?void 0:n.error)??null,o=(n==null?void 0:n.total_bytes)??1,i=(n==null?void 0:n.progress_bytes)??0,u=(n==null?void 0:n.finished)||!1,s=l?100:i/o*100,a=()=>{var f;let h=(f=n==null?void 0:n.live)==null?void 0:f.snapshot.peer_stats;return h?`${h.live} / ${h.seen}`:""},v=h=>c.jsx(Y1,{className:h,error:!!l,live:!!(n!=null&&n.live),finished:u});return c.jsxs("section",{className:"flex flex-col sm:flex-row items-center gap-2 border p-2 border-gray-200 rounded-xl shadow-xs hover:drop-shadow-sm dark:bg-slate-800 dark:border-slate-900",children:[c.jsx("div",{className:"hidden md:block",children:v("w-10 h-10")}),c.jsxs("div",{className:"w-full flex flex-col gap-2",children:[t&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"md:hidden",children:v("w-5 h-5")}),c.jsx("div",{className:"text-left text-lg text-gray-900 text-ellipsis break-all dark:text-slate-200",children:B1(t)})]}),l?c.jsxs("p",{className:"text-red-500 text-sm",children:[c.jsx("strong",{children:"Error:"})," ",l]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{children:c.jsx(A1,{now:s,label:l,variant:r==vu?"warn":u?"success":"info"})}),c.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2 sm:flex-wrap items-center text-sm text-nowrap font-medium text-gray-500",children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(q0,{})," ",a().toString()]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(J0,{}),c.jsxs("div",{children:[cr(i),"/",cr(o)]})]}),n&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(X0,{}),H1(n)]}),c.jsx("div",{className:"flex gap-2 items-center",children:c.jsx(U1,{statsResponse:n})})]})]})]})]}),n&&c.jsx("div",{className:"",children:c.jsx($1,{id:e,statsResponse:n})})]})},J1=({id:e,torrent:t})=>{const[n,r]=x.useState(null),[l,o]=x.useState(null),[i,u]=x.useState(0),s=x.useContext(Nt),a=()=>{u(i+1)};return x.useEffect(()=>{if(n===null)return od(async()=>{await s.getTorrentDetails(t.id).then(r)},1e3)},[n]),x.useEffect(()=>gu(async()=>s.getTorrentStats(t.id).then(y=>(o(y),y)).then(y=>y.state==vu||y.state==Z0?1e3:1e4,()=>1e4),0),[i]),c.jsx(ld.Provider,{value:{refresh:a},children:c.jsx(X1,{id:e,detailsResponse:n,statsResponse:l})})},q1=e=>c.jsx("div",{className:"flex flex-col gap-2 mx-2 pb-3 sm:px-7",children:e.torrents===null?e.loading?c.jsx(wl,{className:"justify-center m-5",label:"Loading torrent list"}):null:e.torrents.length===0?c.jsx("p",{className:"text-center",children:"No existing torrents found."}):e.torrents.map(t=>c.jsx(J1,{id:t.id,torrent:t},t.id))}),b1=e=>{let t=x.useContext(vr);return c.jsxs("div",{className:"container mx-auto",children:[c.jsx(Wt,{error:e.closeableError,remove:()=>t.setCloseableError(null)}),c.jsx(Wt,{error:e.otherError}),c.jsx(q1,{torrents:e.torrents,loading:e.torrentsLoading})]})};var ep="Expected a function",Us=0/0,tp="[object Symbol]",np=/^\s+|\s+$/g,rp=/^[-+]0x[0-9a-f]+$/i,lp=/^0b[01]+$/i,op=/^0o[0-7]+$/i,ip=parseInt,up=typeof xr=="object"&&xr&&xr.Object===Object&&xr,sp=typeof self=="object"&&self&&self.Object===Object&&self,ap=up||sp||Function("return this")(),cp=Object.prototype,dp=cp.toString,fp=Math.max,pp=Math.min,Co=function(){return ap.Date.now()};function mp(e,t,n){var r,l,o,i,u,s,a=0,v=!1,h=!1,f=!0;if(typeof e!="function")throw new TypeError(ep);t=Bs(t)||0,wi(n)&&(v=!!n.leading,h="maxWait"in n,o=h?fp(Bs(n.maxWait)||0,t):o,f="trailing"in n?!!n.trailing:f);function y(E){var j=r,T=l;return r=l=void 0,a=E,i=e.apply(T,j),i}function g(E){return a=E,u=setTimeout(p,t),v?y(E):i}function S(E){var j=E-s,T=E-a,D=t-j;return h?pp(D,o-T):D}function L(E){var j=E-s,T=E-a;return s===void 0||j>=t||j<0||h&&T>=o}function p(){var E=Co();if(L(E))return d(E);u=setTimeout(p,S(E))}function d(E){return u=void 0,f&&r?y(E):(r=l=void 0,i)}function m(){u!==void 0&&clearTimeout(u),a=0,r=s=l=u=void 0}function w(){return u===void 0?i:d(Co())}function _(){var E=Co(),j=L(E);if(r=arguments,l=this,s=E,j){if(u===void 0)return g(s);if(h)return u=setTimeout(p,t),y(s)}return u===void 0&&(u=setTimeout(p,t)),i}return _.cancel=m,_.flush=w,_}function wi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function hp(e){return!!e&&typeof e=="object"}function vp(e){return typeof e=="symbol"||hp(e)&&dp.call(e)==tp}function Bs(e){if(typeof e=="number")return e;if(vp(e))return Us;if(wi(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=wi(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(np,"");var n=lp.test(e);return n||op.test(e)?ip(e.slice(2),n?2:8):rp.test(e)?Us:+e}var gp=mp;const yp=ki(gp),xp=({span:e})=>{let t=Object.entries(e).filter(([n,r])=>n!="name");return t.length==0?null:c.jsxs(c.Fragment,{children:["{",t.map(([n,r])=>c.jsxs("span",{children:[n," = ",r]},n)).reduce((n,r)=>c.jsxs(c.Fragment,{children:[n,", ",r]})),"}"]})},wp=({span:e})=>c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"font-bold",children:e.name}),c.jsx(xp,{span:e}),c.jsx("span",{className:"font-bold",children:":"})]}),kp=({fields:e})=>c.jsxs("span",{className:`m-1 ${e.message.match(/error|fail/g)?"text-red-500":"text-slate-500 dark:text-slate-200"}`,children:[e.message,Object.entries(e).filter(([t,n])=>t!="message").map(([t,n])=>c.jsxs("span",{className:"m-1",children:[c.jsx("span",{className:"italic font-bold",children:t}),"=",n]},t))]}),Sp=dt.memo(({line:e})=>{var r;const t=e,n=l=>{switch(l){case"DEBUG":return"text-blue-500";case"INFO":return"text-green-500";case"WARN":return"text-amber-500";case"ERROR":return"text-red-500";default:return"text-slate-500"}};return c.jsxs("p",{className:"font-mono m-0 text-break text-[10px]",children:[c.jsx("span",{className:"m-1 text-slate-500 dark:text-slate-400",children:t.timestamp}),c.jsx("span",{className:`m-1 ${n(t.level)}`,children:t.level}),c.jsx("span",{className:"m-1",children:(r=t.spans)==null?void 0:r.map((l,o)=>c.jsx(wp,{span:l},o))}),c.jsx("span",{className:"m-1 text-slate-500 dark:text-slate-400",children:t.target}),c.jsx(kp,{fields:t.fields})]})}),pd=({children:e})=>c.jsx("form",{children:e}),wu=({autoFocus:e,value:t,name:n,disabled:r,onChange:l,onKeyDown:o,label:i,help:u,inputType:s,placeholder:a})=>c.jsxs("div",{className:"flex flex-col gap-2 text-sm mb-2",children:[c.jsx("label",{htmlFor:n,className:"dark:text-white",children:i}),c.jsx("input",{autoFocus:e,type:s,className:"block border rounded bg-transparent py-1.5 pl-2 text-gray-800 focus:ring-0 sm:text-sm sm:leading-6 dark:text-slate-300",id:n,name:n,disabled:r,placeholder:a,value:t,onKeyDown:o,onChange:l}),u&&c.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-300",children:u})]}),Ep=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n},Cp=(e,t,n)=>{const r=new AbortController,l=r.signal;let o=!1;const i=()=>{console.log("cancelling fetch"),o=!0,r.abort()},u=async()=>{let a=await fetch(e,{signal:l});if(!a.ok){let f=await a.text();throw n({text:"error fetching logs",details:{statusText:a.statusText,text:f}}),null}if(!a.body){n({text:"error fetching logs: ReadableStream not supported."});return}n(null);const v=a.body.getReader();let h=new Uint8Array;for(;;){const{done:f,value:y}=await v.read();if(f)throw n({text:"log stream terminated"}),null;h=Ep(h,y);for(let g;(g=h.indexOf(10))!==-1;){let S=h.slice(0,g),L=new TextDecoder().decode(S);t(L),h=h.slice(g+1)}}};let s=od(()=>u().then(()=>{},a=>{if(!o&&a!==null)throw n({text:"error streaming logs",details:{text:a.toString()}}),a}),1e3);return()=>{i(),s()}},_p=({url:e,maxLines:t})=>{const[n,r]=x.useState([]),[l,o]=x.useState(null),[i,u]=x.useState(""),s=x.useRef(null),a=t??1e3,v=x.useCallback(g=>{r(S=>[{id:S.length==0?0:S[0].id+1,content:g,parsed:JSON.parse(g),show:s.current?!!g.match(s.current):!0},...S.slice(0,a-1)])},[s.current,t]),h=x.useRef(v);h.current=v;const f=yp(g=>{let S=null;try{S=new RegExp(g)}catch{return}s.current=S,r(L=>{let p=[...L];for(let d of p)d.show=!!d.content.match(S);return p})},200),y=g=>{u(g),f(g)};return x.useEffect(()=>f.cancel,[]),x.useEffect(()=>Cp(e,g=>h.current(g),o),[e]),c.jsxs("div",{children:[c.jsx(Wt,{error:l}),c.jsxs("div",{className:"mb-3",children:["Showing last ",a," logs since this window was opened"]}),c.jsx(pd,{children:c.jsx(wu,{value:i,name:"filter",placeholder:"Enter filter (regex)",onChange:g=>y(g.target.value)})}),n.map(g=>c.jsx("div",{hidden:!g.show,children:c.jsx(Sp,{line:g.parsed})},g.id))]})},jp=({show:e,onClose:t})=>{let r=x.useContext(Nt).getStreamLogsUrl();return c.jsxs($l,{isOpen:e,onClose:t,title:"rqbit server logs",className:"max-w-7xl",children:[c.jsx(Al,{children:r?c.jsx(_p,{url:r}):c.jsx(Wt,{error:{text:"HTTP API not available to stream logs"}})}),c.jsx(Ul,{children:c.jsx(Et,{variant:"primary",onClick:t,children:"Close"})})]})},Np=({children:e,label:t,help:n,className:r})=>c.jsxs("fieldset",{className:`mb-4 ${r}`,children:[t&&c.jsx("label",{className:"text-md font-md mb-3 block pb-1 border-b",children:t}),e]}),Vs=({checked:e,name:t,disabled:n,onChange:r,label:l,help:o,inputType:i})=>c.jsxs("div",{className:"flex gap-3 items-start",children:[c.jsx("div",{className:"flex",children:c.jsx("input",{type:i||"checkbox",className:"block mt-1",id:t,name:t,disabled:n,checked:e,onChange:r})}),c.jsxs("div",{className:"text-sm flex flex-col gap-1",children:[c.jsx("label",{htmlFor:t,children:l}),o&&c.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-300 mb-3",children:o})]})]});function Tp(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.438,20.938H5.564a2.5,2.5,0,0,1-2.5-2.5V5.564a2.5,2.5,0,0,1,2.5-2.5H18.438a2.5,2.5,0,0,1,2.5,2.5V18.438A2.5,2.5,0,0,1,18.438,20.938ZM5.564,4.064a1.5,1.5,0,0,0-1.5,1.5V18.438a1.5,1.5,0,0,0,1.5,1.5H18.438a1.5,1.5,0,0,0,1.5-1.5V5.564a1.5,1.5,0,0,0-1.5-1.5Z"}},{tag:"path",attr:{d:"M9,12.5a.5.5,0,0,1,0-1h6a.5.5,0,0,1,0,1Z"}}]}]}]})(e)}function Pp(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.438,20.938H5.563a2.5,2.5,0,0,1-2.5-2.5V5.564a2.5,2.5,0,0,1,2.5-2.5H18.438a2.5,2.5,0,0,1,2.5,2.5V18.438A2.5,2.5,0,0,1,18.438,20.938ZM5.563,4.064a1.5,1.5,0,0,0-1.5,1.5V18.438a1.5,1.5,0,0,0,1.5,1.5H18.438a1.5,1.5,0,0,0,1.5-1.5V5.564a1.5,1.5,0,0,0-1.5-1.5Z"}},{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"}}]}]}]})(e)}const Lp=(e,t)=>e.indexOf(t)===-1?[e,void 0]:[e.slice(0,e.indexOf(t)),e.slice(e.indexOf(t)+1)],zp=e=>{const t="/",n=(r,l,o)=>{let i=[],u=[],s={};const a=h=>(s[h]=s[h]||[],s[h]);o.forEach(h=>{let[f,y]=Lp(h.name,t);if(y===void 0){i.push(h);return}a(f).push({id:h.id,name:y,length:h.length})});let v=0;for(const[h,f]of Object.entries(s))u.push(n(h,l+"."+v,f)),v+=1;return{name:r,id:l,dirs:u,files:i}};return n("","filetree-root",e.details.files.map((r,l)=>({id:l,name:r.name,length:r.length})))},md=({tree:e,selectedFiles:t,setSelectedFiles:n,initialExpanded:r,listTorrentResponse:l})=>{let[o,i]=x.useState(r),u=x.useMemo(()=>{let f=y=>{let g=y.dirs.flatMap(f);return g.push(...y.files.map(S=>S.id)),g};return f(e)},[e]);const s=f=>{if(f.target.checked){let y=new Set(t);u.forEach(g=>y.add(g)),n(y)}else{let y=new Set(t);u.forEach(g=>y.delete(g)),n(y)}},a=f=>{if(t.has(f)){let y=new Set(t);y.delete(f),n(y)}else{let y=new Set(t);y.add(f),n(y)}},v=()=>u.filter(f=>t.has(f)).length,h=()=>u.filter(f=>t.has(f)).map(f=>l.details.files[f].length).reduce((f,y)=>f+y,0);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center",children:[c.jsx(hn,{onClick:()=>i(!o),children:o?c.jsx(Tp,{}):c.jsx(Pp,{})}),c.jsx(Vs,{checked:u.every(f=>t.has(f)),label:`${e.name?e.name+", ":""} ${v()} files, ${cr(h())}`,name:e.id,onChange:s})]}),c.jsxs("div",{className:"pl-5",hidden:!o,children:[e.dirs.map(f=>c.jsx(md,{listTorrentResponse:l,tree:f,selectedFiles:t,setSelectedFiles:n,initialExpanded:!1},f.name)),c.jsx("div",{className:"pl-1",children:e.files.map(f=>c.jsx(Vs,{checked:t.has(f.id),label:`${f.name} (${cr(f.length)})`,name:`file-${f.id}`,onChange:()=>a(f.id)},f.id))})]})]})},Mp=({listTorrentResponse:e,selectedFiles:t,setSelectedFiles:n})=>{let r=x.useMemo(()=>zp(e),[e]);return c.jsx(c.Fragment,{children:c.jsx(md,{listTorrentResponse:e,tree:r,selectedFiles:t,setSelectedFiles:n,initialExpanded:!0})})},Op=e=>{let{onHide:t,listTorrentResponse:n,listTorrentError:r,listTorrentLoading:l,data:o}=e;const[i,u]=x.useState(new Set),[s,a]=x.useState(!1),[v,h]=x.useState(null),[f,y]=x.useState(!1),[g,S]=x.useState(""),L=x.useContext(vr),p=x.useContext(Nt);x.useEffect(()=>{console.log(n),u(new Set(n==null?void 0:n.details.files.map((_,E)=>E))),S((n==null?void 0:n.output_folder)||"")},[n]);const d=()=>{t(),u(new Set),h(null),a(!1)},m=async()=>{if(!n)return;a(!0);let _=n.seen_peers?n.seen_peers.slice(0,32):null,E={overwrite:!0,only_files:Array.from(i),initial_peers:_,output_folder:g};f&&(E.peer_opts={connect_timeout:20,read_write_timeout:60}),p.uploadTorrent(o,E).then(()=>{t(),L.refreshTorrents()},j=>{h({text:"Error starting torrent",details:j})}).finally(()=>a(!1))},w=()=>{if(l)return c.jsx(wl,{label:"Loading torrent contents"});if(r)return c.jsx(Wt,{error:r});if(n)return c.jsxs(pd,{children:[c.jsx(wu,{label:"Output folder",name:"output_folder",inputType:"text",value:g,onChange:_=>S(_.target.value)}),c.jsx(Np,{children:c.jsx(Mp,{selectedFiles:i,setSelectedFiles:u,listTorrentResponse:n})})]})};return c.jsxs($l,{isOpen:!0,onClose:d,title:"Add Torrent",children:[c.jsxs(Al,{children:[w(),c.jsx(Wt,{error:v})]}),c.jsxs(Ul,{children:[s&&c.jsx(wl,{}),c.jsx(Et,{onClick:d,variant:"cancel",children:"Cancel"}),c.jsx(Et,{onClick:m,variant:"primary",disabled:l||s||i.size==0,children:"OK"})]})]})},hd=({onClick:e,data:t,resetData:n,children:r,className:l})=>{const[o,i]=x.useState(!1),[u,s]=x.useState(null),[a,v]=x.useState(null),h=x.useContext(Nt);x.useEffect(()=>{if(t===null)return;let y=setTimeout(async()=>{i(!0);try{const g=await h.uploadTorrent(t,{list_only:!0});s(g)}catch(g){v({text:"Error listing torrent files",details:g})}finally{i(!1)}},0);return()=>clearTimeout(y)},[t]);const f=()=>{n(),v(null),s(null),i(!1)};return c.jsxs(c.Fragment,{children:[c.jsx(Et,{onClick:e,className:l,children:r}),t&&c.jsx(Op,{onHide:f,listTorrentError:a,listTorrentResponse:u,data:t,listTorrentLoading:o})]})};function Fp(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M10 18V16H8V14H10V12H12V14H14V16H12V18H10Z",fill:"currentColor"}},{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2C4.34315 2 3 3.34315 3 5V19C3 20.6569 4.34315 22 6 22H18C19.6569 22 21 20.6569 21 19V9C21 5.13401 17.866 2 14 2H6ZM6 4H13V9H19V19C19 19.5523 18.5523 20 18 20H6C5.44772 20 5 19.5523 5 19V5C5 4.44772 5.44772 4 6 4ZM15 4.10002C16.6113 4.4271 17.9413 5.52906 18.584 7H15V4.10002Z",fill:"currentColor"}}]})(e)}function Ip(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M14.8284 12L16.2426 13.4142L19.071 10.5858C20.6331 9.02365 20.6331 6.49099 19.071 4.9289C17.509 3.3668 14.9763 3.3668 13.4142 4.9289L10.5858 7.75732L12 9.17154L14.8284 6.34311C15.6095 5.56206 16.8758 5.56206 17.6568 6.34311C18.4379 7.12416 18.4379 8.39049 17.6568 9.17154L14.8284 12Z",fill:"currentColor"}},{tag:"path",attr:{d:"M12 14.8285L13.4142 16.2427L10.5858 19.0711C9.02372 20.6332 6.49106 20.6332 4.92896 19.0711C3.36686 17.509 3.36686 14.9764 4.92896 13.4143L7.75739 10.5858L9.1716 12L6.34317 14.8285C5.56212 15.6095 5.56212 16.8758 6.34317 17.6569C7.12422 18.4379 8.39055 18.4379 9.1716 17.6569L12 14.8285Z",fill:"currentColor"}},{tag:"path",attr:{d:"M14.8285 10.5857C15.219 10.1952 15.219 9.56199 14.8285 9.17147C14.4379 8.78094 13.8048 8.78094 13.4142 9.17147L9.1716 13.4141C8.78107 13.8046 8.78107 14.4378 9.1716 14.8283C9.56212 15.2188 10.1953 15.2188 10.5858 14.8283L14.8285 10.5857Z",fill:"currentColor"}}]})(e)}const Dp=({className:e})=>{const t=x.useRef(),[n,r]=x.useState(null),l=async()=>{var s;if(!((s=t==null?void 0:t.current)!=null&&s.files))return;const u=t.current.files[0];r(u)},o=()=>{t!=null&&t.current&&(t.current.value="",r(null))},i=()=>{t!=null&&t.current&&t.current.click()};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"file",ref:t,accept:".torrent",onChange:l,hidden:!0}),c.jsxs(hd,{onClick:i,data:n,resetData:o,className:`group ${e}`,children:[c.jsx(Fp,{className:"text-blue-500 group-hover:text-white dark:text-white"}),c.jsx("div",{children:"Upload .torrent File"})]})]})},Rp=({className:e})=>{const[t,n]=x.useState(null),[r,l]=x.useState(""),[o,i]=x.useState(!1),u=()=>{n(r),l(""),i(!1)},s=()=>{i(!1),n(null)};return c.jsxs(c.Fragment,{children:[c.jsxs(hd,{onClick:()=>{i(!0)},data:t,className:`group ${e}`,resetData:()=>n(null),children:[c.jsx(Ip,{className:"text-blue-500 group-hover:text-white dark:text-white"}),c.jsx("div",{children:"Add Torrent from Magnet / URL"})]}),c.jsxs($l,{isOpen:o,onClose:s,title:"Add torrent",children:[c.jsx(Al,{children:c.jsx(wu,{autoFocus:!0,value:r,name:"magnet",onChange:a=>l(a.target.value),onKeyDown:a=>{a.key==="Enter"&&r&&u()},placeholder:"magnet:?xt=urn:btih:...",help:"Enter magnet or HTTP(S) URL to the .torrent"})}),c.jsxs(Ul,{children:[c.jsx(Et,{variant:"cancel",onClick:s,children:"Cancel"}),c.jsx(Et,{disabled:!r,variant:"primary",onClick:u,children:"Add"})]})]})]})},$p=e=>x.createElement("svg",{width:"64mm",height:"64mm",viewBox:"0 0 64 64",id:"svg1",xmlSpace:"preserve","inkscape:version":"1.3.1 (91b66b0, 2023-11-16)","sodipodi:docname":"logo.svg","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...e},x.createElement("sodipodi:namedview",{id:"namedview1",pagecolor:"#ffffff",bordercolor:"#000000",borderopacity:.25,"inkscape:showpageshadow":2,"inkscape:pageopacity":0,"inkscape:pagecheckerboard":0,"inkscape:deskcolor":"#d1d1d1","inkscape:document-units":"mm","inkscape:zoom":1.4936372,"inkscape:cx":134.90559,"inkscape:cy":139.92689,"inkscape:window-width":1440,"inkscape:window-height":847,"inkscape:window-x":0,"inkscape:window-y":25,"inkscape:window-maximized":0,"inkscape:current-layer":"layer1"}),x.createElement("defs",{id:"defs1"},x.createElement("inkscape:perspective",{"sodipodi:type":"inkscape:persp3d","inkscape:vp_x":"3.1042448 : 18.147022 : 1","inkscape:vp_y":"0 : 999.99994 : 0","inkscape:vp_z":"303.94612 : 54.05812 : 1","inkscape:persp3d-origin":"105 : -134 : 1",id:"perspective4"})),x.createElement("g",{"inkscape:label":"Layer 1","inkscape:groupmode":"layer",id:"layer1",transform:"translate(-56.674541,-85.911432)"},x.createElement("path",{style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.610041},d:"m 81.603814,145.5382 -7.433116,-4.36986 -6.018097,-3.54529 -6.018099,-3.54529 -0.09405,-0.35761 -0.09406,-0.3576 v -15.31979 -15.31979 l 0.09451,-0.35939 0.09451,-0.35938 6.017643,-3.544433 6.017641,-3.544428 7.432805,-4.369167 7.432803,-4.369166 0.240089,0.09331 0.240083,0.09331 13.292394,7.826122 13.29241,7.826122 0.093,0.35355 0.093,0.35355 v 15.31979 15.31979 l -0.0928,0.35267 -0.0928,0.35266 -13.29682,7.82802 -13.296819,7.82803 -0.235583,0.0921 -0.235588,0.0921 z m 19.758596,-5.88315 12.13185,-7.15306 v -14.45996 -14.45994 l -5.11526,-3.01603 -5.11526,-3.016035 -7.017048,-4.136312 -7.017053,-4.13631 h -0.112738 -0.11273 l -7.097035,4.182089 -7.09703,4.18209 -5.035336,2.971548 -5.035335,2.97155 v 14.45761 14.45762 l 5.275113,3.11051 5.275113,3.11051 6.793709,4.02813 6.793702,4.02812 0.176743,0.0155 0.176742,0.0155 z",id:"path15","sodipodi:nodetypes":"cccccccccccccccccccccccccccccccccccccccccccccccccccc"}),x.createElement("path",{style:{fill:"#000000"},id:"path1",d:""}),x.createElement("path",{d:"m 84.161856,133.76725 -4.567369,-2.5483 -0.700367,0.28585 -0.700376,0.28584 -0.495731,0.11427 -0.495731,0.11426 -3.168791,-1.75603 -3.168782,-1.75603 -0.515321,-0.57002 -0.515323,-0.57002 0.0161,-3.59449 0.0161,-3.59448 0.164041,-0.41611 0.164042,-0.41611 1.480342,-0.85565 1.480346,-0.85565 0.06276,-3.67919 0.06276,-3.67921 0.39653,-0.35884 0.396521,-0.35886 3.663275,-2.04111 3.663267,-2.04112 0.114523,-1.62785 0.114506,-1.62786 0.229029,-0.21764 0.229038,-0.21765 3.341459,-1.854383 3.341467,-1.854382 h 0.301682 0.301682 l 2.476951,1.380374 2.476959,1.380381 1.151673,0.57845 1.151674,0.57845 0.02969,0.27424 0.02969,0.27423 0.02753,1.46272 0.02753,1.46273 3.663258,2.04521 3.66327,2.04521 0.40205,0.36386 0.40206,0.36385 v 3.60098 3.60097 l 0.28629,0.23408 0.28628,0.23408 1.43146,0.72479 1.43145,0.72479 v 3.9806 3.98059 l -0.51533,0.56995 -0.51532,0.56994 -3.19072,1.75191 -3.19072,1.75191 -0.47379,-0.11007 -0.473797,-0.11007 -0.699654,-0.28558 -0.699656,-0.28558 -4.589745,2.5527 -4.589746,2.55269 -0.321886,-0.004 -0.321886,-0.004 z m 8.681258,-1.65766 3.426793,-1.91645 0.06536,-0.19784 0.06535,-0.19785 -1.315884,-0.68709 -1.315885,-0.6871 -0.401264,-0.40081 -0.401265,-0.4008 v -3.79409 -3.79409 l 0.221568,-0.41401 0.221567,-0.414 3.411065,-1.86126 3.411061,-1.86126 h 0.38456 0.38455 l 0.91435,0.46646 0.91435,0.46646 -0.0646,-2.66249 -0.0646,-2.66248 -2.829977,-1.58148 -2.829984,-1.58149 -0.204696,0.12651 -0.204688,0.12651 v 1.11999 1.11999 l -0.744359,0.54975 -0.744358,0.54977 -2.773906,1.52318 -2.773906,1.52319 h -0.526565 -0.526565 l -3.34145,-1.85945 -3.341467,-1.85945 -0.168271,-0.2591 -0.16827,-0.25909 -0.0035,-1.07439 -0.0035,-1.07439 -0.204688,-0.12651 -0.204697,-0.12651 -2.82999,1.58149 -2.829982,1.58148 -0.06458,2.66248 -0.06458,2.66249 0.914351,-0.46646 0.914343,-0.46646 h 0.378551 0.37855 l 3.638639,1.97495 3.63864,1.97495 v 4.0944 4.09441 l -0.401265,0.4008 -0.401264,0.40081 -1.315885,0.6871 -1.315884,0.68709 0.06535,0.19785 0.06536,0.19784 3.426792,1.91645 3.426785,1.91644 h 0.343552 0.343544 z m -16.416873,-5.4431 -0.06475,-2.55838 -2.046125,-1.10985 -2.046124,-1.10984 -0.195677,0.19567 -0.195685,0.19568 0.06596,2.2656 0.06596,2.2656 2.06129,1.18713 2.06129,1.18713 0.179282,0.0198 0.179273,0.0198 z m 4.515881,1.34369 2.061291,-1.19456 0.06527,-2.48747 0.06527,-2.48748 -0.408821,0.15589 -0.408848,0.15589 -1.889514,1.02885 -1.889514,1.02885 v 2.50736 2.50736 l 0.171777,-0.01 0.171767,-0.01 z m 18.666131,-1.29267 v -2.50736 l -1.889509,-1.02885 -1.889522,-1.02885 -0.40883,-0.15589 -0.408839,-0.15589 0.06527,2.48748 0.06527,2.48747 2.061291,1.19456 2.061288,1.19456 0.171777,0.01 0.171774,0.01 z m 4.466127,1.28059 2.06129,-1.18713 0.0661,-2.2656 0.066,-2.2656 -0.19568,-0.19568 -0.19568,-0.19567 -2.04613,1.10984 -2.04612,1.10985 -0.0647,2.55838 -0.0648,2.55838 0.17927,-0.0198 0.17927,-0.0198 z m -24.281888,-6.71835 1.960418,-1.07415 -0.07566,-0.22693 -0.07566,-0.22691 -2.049423,-1.09443 -2.049431,-1.09442 -2.116604,1.14523 -2.116613,1.14523 v 0.17781 0.17782 l 2.004029,1.06709 2.004037,1.06711 0.277236,0.005 0.277237,0.005 z m 23.056528,4.3e-4 2.03643,-1.07372 -0.0708,-0.21245 -0.0708,-0.21244 -2.09332,-1.13015 -2.09332,-1.13016 -2.077692,1.17124 -2.077685,1.17123 v 0.17384 0.17386 l 1.889522,1.0551 1.889505,1.0551 0.31588,0.0161 0.31587,0.0161 z m -14.742004,-11.90808 0.06492,-2.2946 -0.293917,-0.23052 -0.293926,-0.2305 -2.011741,-1.08631 -2.01175,-1.08629 0.06501,2.57478 0.06501,2.57476 1.946776,1.09773 1.946767,1.09773 0.229038,-0.0611 0.229029,-0.0611 z m 4.401245,1.31989 1.946767,-1.09857 0.06501,-2.57476 0.06501,-2.57478 -2.01175,1.08629 -2.011741,1.08631 -0.286291,0.22417 -0.286291,0.22418 v 2.22411 2.2241 l 0.152689,0.15269 0.152689,0.15269 0.133602,-0.0139 0.133602,-0.0139 z m -1.021015,-6.79999 1.952048,-1.05546 -0.224347,-0.26147 -0.224337,-0.26149 -1.958921,-1.03065 -1.958911,-1.03064 -1.958912,1.03064 -1.958912,1.03065 -0.224303,0.26142 -0.224277,0.26141 1.896915,1.04261 1.896906,1.04261 0.517494,0.0129 0.517501,0.0129 z",style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.865634},id:"path1-8"}))),Ap=({title:e})=>{const[t,n]=e.split("-");return c.jsxs("header",{className:"bg-slate-50 drop-shadow-lg flex flex-wrap justify-center lg:justify-between items-center dark:bg-slate-800 mb-3",children:[c.jsxs("div",{className:"flex flex-nowrap items-center justify-between m-2",children:[c.jsx($p,{className:"w-10 h-10 p-1",alt:"logo"}),c.jsxs("h1",{className:"flex items-center dark:text-white",children:[c.jsx("div",{className:"text-3xl",children:t}),c.jsx("div",{className:"bg-blue-100 text-blue-800 text-xl font-semibold me-2 px-2.5 py-0.5 rounded ms-2 dark:bg-blue-900 dark:text-white",children:n})]})]}),c.jsxs("div",{className:"flex flex-wrap gap-1 m-2",children:[c.jsx(Rp,{className:"flex-grow justify-center dark:text-white"}),c.jsx(Dp,{className:"flex-grow justify-center dark:text-white"})]})]})};let Yt=window.matchMedia("(prefers-color-scheme: dark)").matches;window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{Bl.setDark(e.matches)});const Bl={isDark:()=>Yt,setDark:e=>(Yt=e,document.body.classList.toggle("dark",Yt),Yt),toggle:()=>{Bl.setDark(!Yt)}};Bl.setDark(Yt);const Up=e=>{const[t,n]=x.useState(null),[r,l]=x.useState(null),[o,i]=x.useState(null),[u,s]=x.useState(!1);let[a,v]=x.useState(!1);const h=x.useContext(Nt),f=async()=>{s(!0);let g=await h.listTorrents().finally(()=>s(!1));i(g.torrents)};x.useEffect(()=>gu(async()=>f().then(()=>(l(null),5e3),g=>(l({text:"Error refreshing torrents",details:g}),console.error(g),5e3)),0),[]);const y={setCloseableError:n,refreshTorrents:f};return c.jsx(vr.Provider,{value:y,children:c.jsxs("div",{className:"dark:bg-gray-900 dark:text-gray-200 min-h-screen",children:[c.jsx(Ap,{title:e.title}),c.jsxs("div",{className:"relative",children:[c.jsxs("div",{className:"absolute top-0 start-0 pl-2 z-10",children:[e.menuButtons&&e.menuButtons.map((g,S)=>c.jsx("span",{children:g},S)),c.jsx(hn,{onClick:()=>v(!0),children:c.jsx(b0,{})}),c.jsx(hn,{onClick:Bl.toggle,children:c.jsx(e1,{})})]}),c.jsx(b1,{closeableError:t,otherError:r,torrents:o,torrentsLoading:u})]}),c.jsx(jp,{show:a,onClose:()=>v(!1)})]})})},vd=window.origin==="null"||window.origin==="http://localhost:3031"?"http://localhost:3030":"",Ze=async(e,t,n)=>{console.log(e,t);const r=vd+t,l={method:e,headers:{Accept:"application/json"},body:n};let o={method:e,path:t,text:""},i;try{i=await fetch(r,l)}catch{return o.text="network error",Promise.reject(o)}if(o.status=i.status,o.statusText=`${i.status} ${i.statusText}`,!i.ok){const s=await i.text();try{const a=JSON.parse(s);o.text=a.human_readable!==void 0?a.human_readable:JSON.stringify(a,null,2)}catch{o.text=s}return Promise.reject(o)}return await i.json()},Hs={getStreamLogsUrl:()=>vd+"/stream_logs",listTorrents:()=>Ze("GET","/torrents"),getTorrentDetails:e=>Ze("GET",`/torrents/${e}`),getTorrentStats:e=>Ze("GET",`/torrents/${e}/stats/v1`),uploadTorrent:(e,t)=>{var r,l;let n="/torrents?&overwrite=true";return t!=null&&t.list_only&&(n+="&list_only=true"),(t==null?void 0:t.only_files)!=null&&(n+=`&only_files=${t.only_files.join(",")}`),(r=t==null?void 0:t.peer_opts)!=null&&r.connect_timeout&&(n+=`&peer_connect_timeout=${t.peer_opts.connect_timeout}`),(l=t==null?void 0:t.peer_opts)!=null&&l.read_write_timeout&&(n+=`&peer_read_write_timeout=${t.peer_opts.read_write_timeout}`),t!=null&&t.initial_peers&&(n+=`&initial_peers=${t.initial_peers.join(",")}`),t!=null&&t.output_folder&&(n+=`&output_folder=${t.output_folder}`),typeof e=="string"&&(n+="&is_url=true"),Ze("POST",n,e)},pause:e=>Ze("POST",`/torrents/${e}/pause`),start:e=>Ze("POST",`/torrents/${e}/start`),forget:e=>Ze("POST",`/torrents/${e}/forget`),delete:e=>Ze("POST",`/torrents/${e}/delete`),getVersion:async()=>(await Ze("GET","/")).version},Bp=()=>{let[e,t]=x.useState("rqbit web UI");return x.useEffect(()=>gu(()=>Hs.getVersion().then(r=>{const l=`rqbit web UI - v${r}`;return t(l),document.title=l,1e4},r=>1e3),0),[]),c.jsx(x.StrictMode,{children:c.jsx(Nt.Provider,{value:Hs,children:c.jsx(Up,{title:e})})})};_o.createRoot(document.getElementById("app")).render(c.jsx(Bp,{})); +`+o.stack}return{value:e,source:t,stack:l,digest:null}}function wo(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ai(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var P0=typeof WeakMap=="function"?WeakMap:Map;function Fc(e,t,n){n=qe(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){yl||(yl=!0,xi=r),ai(e,t)},n}function Dc(e,t,n){n=qe(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){ai(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){ai(e,t),typeof r!="function"&&(gt===null?gt=new Set([this]):gt.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function gs(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new P0;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=W0.bind(null,e,t,n),t.then(e,e))}function ys(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function xs(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=qe(-1,1),t.tag=2,vt(n,t,1))),n.lanes|=1),e)}var z0=rt.ReactCurrentOwner,pe=!1;function se(e,t,n,r){t.child=e===null?hc(t,null,n,r):kn(t,e.child,n,r)}function ws(e,t,n,r,l){n=n.render;var o=t.ref;return hn(t,l),r=lu(e,t,n,r,o,l),n=ou(),e!==null&&!pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,nt(e,t,l)):(B&&n&&Zi(t),t.flags|=1,se(e,t,r,l),t.child)}function ks(e,t,n,r,l){if(e===null){var o=n.type;return typeof o=="function"&&!mu(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Rc(e,t,o,r,l)):(e=Jr(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&l)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:rr,n(i,r)&&e.ref===t.ref)return nt(e,t,l)}return t.flags|=1,e=xt(o,r),e.ref=t.ref,e.return=t,t.child=e}function Rc(e,t,n,r,l){if(e!==null){var o=e.memoizedProps;if(rr(o,r)&&e.ref===t.ref)if(pe=!1,t.pendingProps=r=o,(e.lanes&l)!==0)e.flags&131072&&(pe=!0);else return t.lanes=e.lanes,nt(e,t,l)}return ci(e,t,n,r,l)}function $c(e,t,n){var r=t.pendingProps,l=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},R(an,ye),ye|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,R(an,ye),ye|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,R(an,ye),ye|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,R(an,ye),ye|=r;return se(e,t,l,n),t.child}function Ac(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ci(e,t,n,r,l){var o=me(n)?Ut:ue.current;return o=xn(t,o),hn(t,l),n=lu(e,t,n,r,o,l),r=ou(),e!==null&&!pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,nt(e,t,l)):(B&&r&&Zi(t),t.flags|=1,se(e,t,n,l),t.child)}function Ss(e,t,n,r,l){if(me(n)){var o=!0;sl(t)}else o=!1;if(hn(t,l),t.stateNode===null)Gr(e,t),fc(t,n,r),si(t,n,r,l),r=!0;else if(e===null){var i=t.stateNode,u=t.memoizedProps;i.props=u;var s=i.context,a=n.contextType;typeof a=="object"&&a!==null?a=Te(a):(a=me(n)?Ut:ue.current,a=xn(t,a));var v=n.getDerivedStateFromProps,h=typeof v=="function"||typeof i.getSnapshotBeforeUpdate=="function";h||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==r||s!==a)&&ps(t,i,r,a),ut=!1;var f=t.memoizedState;i.state=f,pl(t,r,i,l),s=t.memoizedState,u!==r||f!==s||he.current||ut?(typeof v=="function"&&(ui(t,n,v,r),s=t.memoizedState),(u=ut||fs(t,n,u,r,f,s,a))?(h||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=s),i.props=r,i.state=s,i.context=a,r=u):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,cc(e,t),u=t.memoizedProps,a=t.type===t.elementType?u:ze(t.type,u),i.props=a,h=t.pendingProps,f=i.context,s=n.contextType,typeof s=="object"&&s!==null?s=Te(s):(s=me(n)?Ut:ue.current,s=xn(t,s));var g=n.getDerivedStateFromProps;(v=typeof g=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==h||f!==s)&&ps(t,i,r,s),ut=!1,f=t.memoizedState,i.state=f,pl(t,r,i,l);var y=t.memoizedState;u!==h||f!==y||he.current||ut?(typeof g=="function"&&(ui(t,n,g,r),y=t.memoizedState),(a=ut||fs(t,n,a,r,f,y,s)||!1)?(v||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,y,s),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,y,s)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),i.props=r,i.state=y,i.context=s,r=a):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return di(e,t,n,r,o,l)}function di(e,t,n,r,l,o){Ac(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return l&&us(t,n,!1),nt(e,t,o);r=t.stateNode,z0.current=t;var u=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=kn(t,e.child,null,o),t.child=kn(t,null,u,o)):se(e,t,u,o),t.memoizedState=r.state,l&&us(t,n,!0),t.child}function Uc(e){var t=e.stateNode;t.pendingContext?is(e,t.pendingContext,t.pendingContext!==t.context):t.context&&is(e,t.context,!1),eu(e,t.containerInfo)}function Es(e,t,n,r,l){return wn(),Gi(l),t.flags|=256,se(e,t,n,r),t.child}var fi={dehydrated:null,treeContext:null,retryLane:0};function pi(e){return{baseLanes:e,cachePool:null,transitions:null}}function Bc(e,t,n){var r=t.pendingProps,l=V.current,o=!1,i=(t.flags&128)!==0,u;if((u=i)||(u=e!==null&&e.memoizedState===null?!1:(l&2)!==0),u?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),R(V,l&1),e===null)return oi(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=Fl(i,r,0,null),e=$t(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=pi(n),t.memoizedState=fi,e):su(t,i));if(l=e.memoizedState,l!==null&&(u=l.dehydrated,u!==null))return M0(e,t,i,r,u,l,n);if(o){o=r.fallback,i=t.mode,l=e.child,u=l.sibling;var s={mode:"hidden",children:r.children};return!(i&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=s,t.deletions=null):(r=xt(l,s),r.subtreeFlags=l.subtreeFlags&14680064),u!==null?o=xt(u,o):(o=$t(o,i,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?pi(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=fi,r}return o=e.child,e=o.sibling,r=xt(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function su(e,t){return t=Fl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Fr(e,t,n,r){return r!==null&&Gi(r),kn(t,e.child,null,n),e=su(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function M0(e,t,n,r,l,o,i){if(n)return t.flags&256?(t.flags&=-257,r=wo(Error(k(422))),Fr(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,l=t.mode,r=Fl({mode:"visible",children:r.children},l,0,null),o=$t(o,l,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&kn(t,e.child,null,i),t.child.memoizedState=pi(i),t.memoizedState=fi,o);if(!(t.mode&1))return Fr(e,t,i,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var u=r.dgst;return r=u,o=Error(k(419)),r=wo(o,r,void 0),Fr(e,t,i,r)}if(u=(i&e.childLanes)!==0,pe||u){if(r=b,r!==null){switch(i&-i){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|i)?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,tt(e,l),Fe(r,e,l,-1))}return hu(),r=wo(Error(k(421))),Fr(e,t,i,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Q0.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,xe=mt(l.nextSibling),we=t,B=!0,Oe=null,e!==null&&(Ce[_e++]=Ye,Ce[_e++]=Xe,Ce[_e++]=Bt,Ye=e.id,Xe=e.overflow,Bt=t),t=su(t,r.children),t.flags|=4096,t)}function Cs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ii(e.return,t,n)}function ko(e,t,n,r,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=l)}function Vc(e,t,n){var r=t.pendingProps,l=r.revealOrder,o=r.tail;if(se(e,t,r.children,n),r=V.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cs(e,n,t);else if(e.tag===19)Cs(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(R(V,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&hl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),ko(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&hl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}ko(t,!0,n,null,o);break;case"together":ko(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Gr(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function nt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ht|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(k(153));if(t.child!==null){for(e=t.child,n=xt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function O0(e,t,n){switch(t.tag){case 3:Uc(t),wn();break;case 5:mc(t);break;case 1:me(t.type)&&sl(t);break;case 4:eu(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;R(dl,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(R(V,V.current&1),t.flags|=128,null):n&t.child.childLanes?Bc(e,t,n):(R(V,V.current&1),e=nt(e,t,n),e!==null?e.sibling:null);R(V,V.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Vc(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),R(V,V.current),r)break;return null;case 22:case 23:return t.lanes=0,$c(e,t,n)}return nt(e,t,n)}var Hc,hi,Wc,Qc;Hc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};hi=function(){};Wc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,Dt(He.current);var o=null;switch(n){case"input":l=Do(e,l),r=Do(e,r),o=[];break;case"select":l=W({},l,{value:void 0}),r=W({},r,{value:void 0}),o=[];break;case"textarea":l=Ao(e,l),r=Ao(e,r),o=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=il)}Bo(n,r);var i;n=null;for(a in l)if(!r.hasOwnProperty(a)&&l.hasOwnProperty(a)&&l[a]!=null)if(a==="style"){var u=l[a];for(i in u)u.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Xn.hasOwnProperty(a)?o||(o=[]):(o=o||[]).push(a,null));for(a in r){var s=r[a];if(u=l!=null?l[a]:void 0,r.hasOwnProperty(a)&&s!==u&&(s!=null||u!=null))if(a==="style")if(u){for(i in u)!u.hasOwnProperty(i)||s&&s.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in s)s.hasOwnProperty(i)&&u[i]!==s[i]&&(n||(n={}),n[i]=s[i])}else n||(o||(o=[]),o.push(a,n)),n=s;else a==="dangerouslySetInnerHTML"?(s=s?s.__html:void 0,u=u?u.__html:void 0,s!=null&&u!==s&&(o=o||[]).push(a,s)):a==="children"?typeof s!="string"&&typeof s!="number"||(o=o||[]).push(a,""+s):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(Xn.hasOwnProperty(a)?(s!=null&&a==="onScroll"&&A("scroll",e),o||u===s||(o=[])):(o=o||[]).push(a,s))}n&&(o=o||[]).push("style",n);var a=o;(t.updateQueue=a)&&(t.flags|=4)}};Qc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Fn(e,t){if(!B)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function oe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function I0(e,t,n){var r=t.pendingProps;switch(Ki(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return oe(t),null;case 1:return me(t.type)&&ul(),oe(t),null;case 3:return r=t.stateNode,Sn(),U(he),U(ue),nu(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Or(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Oe!==null&&(Si(Oe),Oe=null))),hi(e,t),oe(t),null;case 5:tu(t);var l=Dt(sr.current);if(n=t.type,e!==null&&t.stateNode!=null)Wc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(k(166));return oe(t),null}if(e=Dt(He.current),Or(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Be]=t,r[ir]=o,e=(t.mode&1)!==0,n){case"dialog":A("cancel",r),A("close",r);break;case"iframe":case"object":case"embed":A("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Be]=t,e[ir]=r,Hc(e,t,!1,!1),t.stateNode=e;e:{switch(i=Vo(n,r),n){case"dialog":A("cancel",e),A("close",e),l=r;break;case"iframe":case"object":case"embed":A("load",e),l=r;break;case"video":case"audio":for(l=0;lCn&&(t.flags|=128,r=!0,Fn(o,!1),t.lanes=4194304)}else{if(!r)if(e=hl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Fn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!B)return oe(t),null}else 2*G()-o.renderingStartTime>Cn&&n!==1073741824&&(t.flags|=128,r=!0,Fn(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=G(),t.sibling=null,n=V.current,R(V,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return pu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ye&1073741824&&(oe(t),t.subtreeFlags&6&&(t.flags|=8192)):oe(t),null;case 24:return null;case 25:return null}throw Error(k(156,t.tag))}function F0(e,t){switch(Ki(t),t.tag){case 1:return me(t.type)&&ul(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sn(),U(he),U(ue),nu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return tu(t),null;case 13:if(U(V),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(k(340));wn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(V),null;case 4:return Sn(),null;case 10:return Ji(t.type._context),null;case 22:case 23:return pu(),null;case 24:return null;default:return null}}var Dr=!1,ie=!1,D0=typeof WeakSet=="function"?WeakSet:Set,N=null;function sn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Q(e,t,r)}else n.current=null}function mi(e,t,n){try{n()}catch(r){Q(e,t,r)}}var _s=!1;function R0(e,t){if(qo=rl,e=Ya(),Qi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,u=-1,s=-1,a=0,v=0,h=e,f=null;t:for(;;){for(var g;h!==n||l!==0&&h.nodeType!==3||(u=i+l),h!==o||r!==0&&h.nodeType!==3||(s=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(g=h.firstChild)!==null;)f=h,h=g;for(;;){if(h===e)break t;if(f===n&&++a===l&&(u=i),f===o&&++v===r&&(s=i),(g=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=g}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(bo={focusedElem:e,selectionRange:n},rl=!1,N=t;N!==null;)if(t=N,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,N=e;else for(;N!==null;){t=N;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var S=y.memoizedProps,L=y.memoizedState,p=t.stateNode,d=p.getSnapshotBeforeUpdate(t.elementType===t.type?S:ze(t.type,S),L);p.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(k(163))}}catch(w){Q(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,N=e;break}N=t.return}return y=_s,_s=!1,y}function Kn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&mi(t,n,o)}l=l.next}while(l!==r)}}function Ol(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function vi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Zc(e){var t=e.alternate;t!==null&&(e.alternate=null,Zc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Be],delete t[ir],delete t[ni],delete t[x0],delete t[w0])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Kc(e){return e.tag===5||e.tag===3||e.tag===4}function js(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function gi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=il));else if(r!==4&&(e=e.child,e!==null))for(gi(e,t,n),e=e.sibling;e!==null;)gi(e,t,n),e=e.sibling}function yi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(yi(e,t,n),e=e.sibling;e!==null;)yi(e,t,n),e=e.sibling}var te=null,Me=!1;function ot(e,t,n){for(n=n.child;n!==null;)Gc(e,t,n),n=n.sibling}function Gc(e,t,n){if(Ve&&typeof Ve.onCommitFiberUnmount=="function")try{Ve.onCommitFiberUnmount(_l,n)}catch{}switch(n.tag){case 5:ie||sn(n,t);case 6:var r=te,l=Me;te=null,ot(e,t,n),te=r,Me=l,te!==null&&(Me?(e=te,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):te.removeChild(n.stateNode));break;case 18:te!==null&&(Me?(e=te,n=n.stateNode,e.nodeType===8?ho(e.parentNode,n):e.nodeType===1&&ho(e,n),tr(e)):ho(te,n.stateNode));break;case 4:r=te,l=Me,te=n.stateNode.containerInfo,Me=!0,ot(e,t,n),te=r,Me=l;break;case 0:case 11:case 14:case 15:if(!ie&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&mi(n,t,i),l=l.next}while(l!==r)}ot(e,t,n);break;case 1:if(!ie&&(sn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){Q(n,t,u)}ot(e,t,n);break;case 21:ot(e,t,n);break;case 22:n.mode&1?(ie=(r=ie)||n.memoizedState!==null,ot(e,t,n),ie=r):ot(e,t,n);break;default:ot(e,t,n)}}function Ns(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new D0),t.forEach(function(r){var l=Z0.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Pe(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=G()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*A0(r/1960))-r,10e?16:e,dt===null)var r=!1;else{if(e=dt,dt=null,xl=0,I&6)throw Error(k(331));var l=I;for(I|=4,N=e.current;N!==null;){var o=N,i=o.child;if(N.flags&16){var u=o.deletions;if(u!==null){for(var s=0;sG()-du?Rt(e,0):cu|=n),ve(e,t)}function nd(e,t){t===0&&(e.mode&1?(t=Nr,Nr<<=1,!(Nr&130023424)&&(Nr=4194304)):t=1);var n=ae();e=tt(e,t),e!==null&&(mr(e,t,n),ve(e,n))}function Q0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),nd(e,n)}function Z0(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(k(314))}r!==null&&r.delete(t),nd(e,n)}var rd;rd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||he.current)pe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return pe=!1,O0(e,t,n);pe=!!(e.flags&131072)}else pe=!1,B&&t.flags&1048576&&ic(t,cl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Gr(e,t),e=t.pendingProps;var l=xn(t,ue.current);hn(t,n),l=lu(null,t,r,e,l,n);var o=ou();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,me(r)?(o=!0,sl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,bi(t),l.updater=zl,t.stateNode=l,l._reactInternals=t,si(t,r,e,n),t=di(null,t,r,!0,o,n)):(t.tag=0,B&&o&&Zi(t),se(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Gr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=G0(r),e=ze(r,e),l){case 0:t=ci(null,t,r,e,n);break e;case 1:t=Ss(null,t,r,e,n);break e;case 11:t=ws(null,t,r,e,n);break e;case 14:t=ks(null,t,r,ze(r.type,e),n);break e}throw Error(k(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ci(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Ss(e,t,r,l,n);case 3:e:{if(Uc(t),e===null)throw Error(k(387));r=t.pendingProps,o=t.memoizedState,l=o.element,cc(e,t),pl(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=En(Error(k(423)),t),t=Es(e,t,r,n,l);break e}else if(r!==l){l=En(Error(k(424)),t),t=Es(e,t,r,n,l);break e}else for(xe=mt(t.stateNode.containerInfo.firstChild),we=t,B=!0,Oe=null,n=hc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wn(),r===l){t=nt(e,t,n);break e}se(e,t,r,n)}t=t.child}return t;case 5:return mc(t),e===null&&oi(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,ei(r,l)?i=null:o!==null&&ei(r,o)&&(t.flags|=32),Ac(e,t),se(e,t,i,n),t.child;case 6:return e===null&&oi(t),null;case 13:return Bc(e,t,n);case 4:return eu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=kn(t,null,r,n):se(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ws(e,t,r,l,n);case 7:return se(e,t,t.pendingProps,n),t.child;case 8:return se(e,t,t.pendingProps.children,n),t.child;case 12:return se(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,R(dl,r._currentValue),r._currentValue=i,o!==null)if(De(o.value,i)){if(o.children===l.children&&!he.current){t=nt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=qe(-1,n&-n),s.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var v=a.pending;v===null?s.next=s:(s.next=v.next,v.next=s),a.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),ii(o.return,n,t),u.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(k(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ii(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}se(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,hn(t,n),l=Te(l),r=r(l),t.flags|=1,se(e,t,r,n),t.child;case 14:return r=t.type,l=ze(r,t.pendingProps),l=ze(r.type,l),ks(e,t,r,l,n);case 15:return Rc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Gr(e,t),t.tag=1,me(r)?(e=!0,sl(t)):e=!1,hn(t,n),fc(t,r,l),si(t,r,l,n),di(null,t,r,!0,e,n);case 19:return Vc(e,t,n);case 22:return $c(e,t,n)}throw Error(k(156,t.tag))};function ld(e,t){return Pa(e,t)}function K0(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function je(e,t,n,r){return new K0(e,t,n,r)}function mu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function G0(e){if(typeof e=="function")return mu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ii)return 11;if(e===Fi)return 14}return 2}function xt(e,t){var n=e.alternate;return n===null?(n=je(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Jr(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")mu(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case qt:return $t(n.children,l,o,t);case Oi:i=8,l|=8;break;case Mo:return e=je(12,n,t,l|2),e.elementType=Mo,e.lanes=o,e;case Oo:return e=je(13,n,t,l),e.elementType=Oo,e.lanes=o,e;case Io:return e=je(19,n,t,l),e.elementType=Io,e.lanes=o,e;case pa:return Fl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case da:i=10;break e;case fa:i=9;break e;case Ii:i=11;break e;case Fi:i=14;break e;case it:i=16,r=null;break e}throw Error(k(130,e==null?e:typeof e,""))}return t=je(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function $t(e,t,n,r){return e=je(7,e,r,t),e.lanes=n,e}function Fl(e,t,n,r){return e=je(22,e,r,t),e.elementType=pa,e.lanes=n,e.stateNode={isHidden:!1},e}function So(e,t,n){return e=je(6,e,null,t),e.lanes=n,e}function Eo(e,t,n){return t=je(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Y0(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=no(0),this.expirationTimes=no(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=no(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function vu(e,t,n,r,l,o,i,u,s){return e=new Y0(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=je(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},bi(o),e}function X0(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sd)}catch(e){console.error(e)}}sd(),ia.exports=Se;var ad=ia.exports;const t1=El(ad);var Fs=ad;Po.createRoot=Fs.createRoot,Po.hydrateRoot=Fs.hydrateRoot;const Nt=x.createContext({listTorrents:()=>{throw new Error("Function not implemented.")},getTorrentDetails:()=>{throw new Error("Function not implemented.")},getTorrentStats:()=>{throw new Error("Function not implemented.")},uploadTorrent:()=>{throw new Error("Function not implemented.")},pause:()=>{throw new Error("Function not implemented.")},start:()=>{throw new Error("Function not implemented.")},forget:()=>{throw new Error("Function not implemented.")},delete:()=>{throw new Error("Function not implemented.")},getStreamLogsUrl:()=>null}),cd=x.createContext({refresh:()=>{}}),Sl=({label:e,className:t})=>c.jsxs("div",{className:`flex gap-2 items-center ${t}`,children:[c.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),c.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),e?c.jsxs("span",{className:"text-sm",children:[e," ..."]}):c.jsx("span",{className:"sr-only",children:"Loading..."})]}),wu="initializing",n1="paused",r1="live",l1="error";function ku(e,t){let n,r=t;const l=async()=>{if(r=await e(),r==null)throw"asyncCallback returned null or undefined";o()};let o=()=>{n=setTimeout(l,r)};return o(),()=>{clearTimeout(n)}}function dd(e,t){let n;const r=async()=>{await e().then(()=>!1,()=>!0)&&l()};let l=o=>{n=setTimeout(r,o!==void 0?o:t)};return l(0),()=>clearTimeout(n)}var fd={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ds=Je.createContext&&Je.createContext(fd),wt=globalThis&&globalThis.__assign||function(){return wt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{onClick:t,disabled:n,color:r,children:l,className:o,...i}=e,u=a=>{a.stopPropagation(),!n&&t()},s=r?`text-${r}`:"";return c.jsx("a",{className:`block p-1 text-blue-500 flex items-center justify-center ${s} ${o}`,onClick:u,href:"#",...i,children:l})};function c1(e){return ee({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M0 .5A.5.5 0 0 1 .5 0h4a.5.5 0 0 1 0 1h-4A.5.5 0 0 1 0 .5Zm0 2A.5.5 0 0 1 .5 2h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm9 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-9 2A.5.5 0 0 1 .5 4h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm5 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm-12 2A.5.5 0 0 1 .5 6h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm8 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-8 2A.5.5 0 0 1 .5 8h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm-7 2a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 0 1h-8a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5Z"}}]})(e)}function d1(e){return ee({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278zM4.858 1.311A7.269 7.269 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.316 7.316 0 0 0 5.205-2.162c-.337.042-.68.063-1.029.063-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286z"}}]})(e)}function hd(e){return ee({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}}]})(e)}const f1=({title:e,children:t,onClose:n})=>c.jsxs("div",{className:"bg-red-200 p-3 rounded-md mb-3 dark:bg-red-800/60",children:[c.jsxs("div",{className:"flex justify-between mb-2",children:[c.jsx("h2",{className:"text-lg font-semibold",children:e}),n&&c.jsx("button",{onClick:n,children:c.jsx(hd,{})})]}),t]}),Qt=e=>{var r,l,o;let{error:t,remove:n}=e;return t==null?null:c.jsxs(f1,{onClose:n,title:t.text,children:[((r=t.details)==null?void 0:r.statusText)&&c.jsx("div",{className:"pb-2 text-md",children:(l=t.details)==null?void 0:l.statusText}),c.jsx("div",{className:"whitespace-pre-wrap text-sm",children:(o=t.details)==null?void 0:o.text})]})};function Su(e){return e&&e.ownerDocument||document}function Co(e){e===void 0&&(e=Su());try{var t=e.activeElement;return!t||!t.nodeName?null:t}catch{return e.body}}function Rs(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}const Ul=!!(typeof window<"u"&&window.document&&window.document.createElement);var Ei=!1,Ci=!1;try{var _o={get passive(){return Ei=!0},get once(){return Ci=Ei=!0}};Ul&&(window.addEventListener("test",_o,_o),window.removeEventListener("test",_o,!0))}catch{}function p1(e,t,n,r){if(r&&typeof r!="boolean"&&!Ci){var l=r.once,o=r.capture,i=n;!Ci&&l&&(i=n.__once||function u(s){this.removeEventListener(t,u,o),n.call(this,s)},n.__once=i),e.addEventListener(t,i,Ei?r:o)}e.addEventListener(t,n,r)}function h1(e,t,n,r){var l=r&&typeof r!="boolean"?r.capture:r;e.removeEventListener(t,n,l),n.__once&&e.removeEventListener(t,n.__once,l)}function $s(e,t,n,r){return p1(e,t,n,r),function(){h1(e,t,n,r)}}function m1(){const e=x.useRef(!0),t=x.useRef(()=>e.current);return x.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),t.current}function v1(e){const t=x.useRef(e);return t.current=e,t}function g1(e){const t=v1(e);x.useEffect(()=>()=>t.current(),[])}function y1(e){const t=x.useRef(null);return x.useEffect(()=>{t.current=e}),t.current}function x1(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e},[e]),t}function Ot(e){const t=x1(e);return x.useCallback(function(...n){return t.current&&t.current(...n)},[t])}function w1(e){var t=Su(e);return t&&t.defaultView||window}function k1(e,t){return w1(e).getComputedStyle(e,t)}var S1=/([A-Z])/g;function E1(e){return e.replace(S1,"-$1").toLowerCase()}var C1=/^ms-/;function Ar(e){return E1(e).replace(C1,"-ms-")}var _1=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function j1(e){return!!(e&&_1.test(e))}function As(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(Ar(t))||k1(e).getPropertyValue(Ar(t));Object.keys(t).forEach(function(l){var o=t[l];!o&&o!==0?e.style.removeProperty(Ar(l)):j1(l)?r+=l+"("+o+") ":n+=Ar(l)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}const N1="data-rr-ui-";function T1(e){return`${N1}${e}`}function L1(e=document){const t=e.defaultView;return Math.abs(t.innerWidth-e.documentElement.clientWidth)}const Us=T1("modal-open");class P1{constructor({ownerDocument:t,handleContainerOverflow:n=!0,isRTL:r=!1}={}){this.handleContainerOverflow=n,this.isRTL=r,this.modals=[],this.ownerDocument=t}getScrollbarWidth(){return L1(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(t){}removeModalAttributes(t){}setContainerStyle(t){const n={overflow:"hidden"},r=this.isRTL?"paddingLeft":"paddingRight",l=this.getElement();t.style={overflow:l.style.overflow,[r]:l.style[r]},t.scrollBarWidth&&(n[r]=`${parseInt(As(l,r)||"0",10)+t.scrollBarWidth}px`),l.setAttribute(Us,""),As(l,n)}reset(){[...this.modals].forEach(t=>this.remove(t))}removeContainerStyle(t){const n=this.getElement();n.removeAttribute(Us),Object.assign(n.style,t.style)}add(t){let n=this.modals.indexOf(t);return n!==-1||(n=this.modals.length,this.modals.push(t),this.setModalAttributes(t),n!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),n}remove(t){const n=this.modals.indexOf(t);n!==-1&&(this.modals.splice(n,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(t))}isTopModal(t){return!!this.modals.length&&this.modals[this.modals.length-1]===t}}const md=P1,vd=x.createContext(Ul?window:void 0);vd.Provider;function Eu(){return x.useContext(vd)}const jo=(e,t)=>Ul?e==null?(t||Su()).body:(typeof e=="function"&&(e=e()),e&&"current"in e&&(e=e.current),e&&("nodeType"in e||e.getBoundingClientRect)?e:null):null;function z1(e,t){const n=Eu(),[r,l]=x.useState(()=>jo(e,n==null?void 0:n.document));if(!r){const o=jo(e);o&&l(o)}return x.useEffect(()=>{t&&r&&t(r)},[t,r]),x.useEffect(()=>{const o=jo(e);o!==r&&l(o)},[e,r]),r}const Bs=e=>!e||typeof e=="function"?e:t=>{e.current=t};function M1(e,t){const n=Bs(e),r=Bs(t);return l=>{n&&n(l),r&&r(l)}}function gd(e,t){return x.useMemo(()=>M1(e,t),[e,t])}const O1=typeof global<"u"&&global.navigator&&global.navigator.product==="ReactNative",I1=typeof document<"u",Vs=I1||O1?x.useLayoutEffect:x.useEffect;function F1({children:e,in:t,onExited:n,mountOnEnter:r,unmountOnExit:l}){const o=x.useRef(null),i=x.useRef(t),u=Ot(n);x.useEffect(()=>{t?i.current=!0:u(o.current)},[t,u]);const s=gd(o,e.ref),a=x.cloneElement(e,{ref:s});return t?a:l||!i.current&&r?null:a}function D1({in:e,onTransition:t}){const n=x.useRef(null),r=x.useRef(!0),l=Ot(t);return Vs(()=>{if(!n.current)return;let o=!1;return l({in:e,element:n.current,initial:r.current,isStale:()=>o}),()=>{o=!0}},[e,l]),Vs(()=>(r.current=!1,()=>{r.current=!0}),[]),n}function R1({children:e,in:t,onExited:n,onEntered:r,transition:l}){const[o,i]=x.useState(!t);t&&o&&i(!1);const u=D1({in:!!t,onTransition:a=>{const v=()=>{a.isStale()||(a.in?r==null||r(a.element,a.initial):(i(!0),n==null||n(a.element)))};Promise.resolve(l(a)).then(v,h=>{throw a.in||i(!0),h})}}),s=gd(u,e.ref);return o&&!t?null:x.cloneElement(e,{ref:s})}function Hs(e,t,n){return e?c.jsx(e,Object.assign({},n)):t?c.jsx(R1,Object.assign({},n,{transition:t})):c.jsx(F1,Object.assign({},n))}function $1(e){return e.code==="Escape"||e.keyCode===27}const A1=["show","role","className","style","children","backdrop","keyboard","onBackdropClick","onEscapeKeyDown","transition","runTransition","backdropTransition","runBackdropTransition","autoFocus","enforceFocus","restoreFocus","restoreFocusOptions","renderDialog","renderBackdrop","manager","container","onShow","onHide","onExit","onExited","onExiting","onEnter","onEntering","onEntered"];function U1(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,o;for(o=0;o=0)&&(n[l]=e[l]);return n}let No;function B1(e){return No||(No=new md({ownerDocument:e==null?void 0:e.document})),No}function V1(e){const t=Eu(),n=e||B1(t),r=x.useRef({dialog:null,backdrop:null});return Object.assign(r.current,{add:()=>n.add(r.current),remove:()=>n.remove(r.current),isTopModal:()=>n.isTopModal(r.current),setDialogRef:x.useCallback(l=>{r.current.dialog=l},[]),setBackdropRef:x.useCallback(l=>{r.current.backdrop=l},[])})}const yd=x.forwardRef((e,t)=>{let{show:n=!1,role:r="dialog",className:l,style:o,children:i,backdrop:u=!0,keyboard:s=!0,onBackdropClick:a,onEscapeKeyDown:v,transition:h,runTransition:f,backdropTransition:g,runBackdropTransition:y,autoFocus:S=!0,enforceFocus:L=!0,restoreFocus:p=!0,restoreFocusOptions:d,renderDialog:m,renderBackdrop:w=K=>c.jsx("div",Object.assign({},K)),manager:_,container:E,onShow:j,onHide:T=()=>{},onExit:D,onExited:M,onExiting:ge,onEnter:Tt,onEntering:Lt,onEntered:xr}=e,Zl=U1(e,A1);const Re=Eu(),lt=z1(E),C=V1(_),P=m1(),z=y1(n),[$,Z]=x.useState(!n),We=x.useRef(null);x.useImperativeHandle(t,()=>C,[C]),Ul&&!z&&n&&(We.current=Co(Re==null?void 0:Re.document)),n&&$&&Z(!1);const $e=Ot(()=>{if(C.add(),Gl.current=$s(document,"keydown",Td),Kl.current=$s(document,"focus",()=>setTimeout(Qe),!0),j&&j(),S){var K,ju;const Xl=Co((K=(ju=C.dialog)==null?void 0:ju.ownerDocument)!=null?K:Re==null?void 0:Re.document);C.dialog&&Xl&&!Rs(C.dialog,Xl)&&(We.current=Xl,C.dialog.focus())}}),Pt=Ot(()=>{if(C.remove(),Gl.current==null||Gl.current(),Kl.current==null||Kl.current(),p){var K;(K=We.current)==null||K.focus==null||K.focus(d),We.current=null}});x.useEffect(()=>{!n||!lt||$e()},[n,lt,$e]),x.useEffect(()=>{$&&Pt()},[$,Pt]),g1(()=>{Pt()});const Qe=Ot(()=>{if(!L||!P()||!C.isTopModal())return;const K=Co(Re==null?void 0:Re.document);C.dialog&&K&&!Rs(C.dialog,K)&&C.dialog.focus()}),Gt=Ot(K=>{K.target===K.currentTarget&&(a==null||a(K),u===!0&&T())}),Td=Ot(K=>{s&&$1(K)&&C.isTopModal()&&(v==null||v(K),K.defaultPrevented||T())}),Kl=x.useRef(),Gl=x.useRef(),Ld=(...K)=>{Z(!0),M==null||M(...K)};if(!lt)return null;const _u=Object.assign({role:r,ref:C.setDialogRef,"aria-modal":r==="dialog"?!0:void 0},Zl,{style:o,className:l,tabIndex:-1});let Yl=m?m(_u):c.jsx("div",Object.assign({},_u,{children:x.cloneElement(i,{role:"document"})}));Yl=Hs(h,f,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!n,onExit:D,onExiting:ge,onExited:Ld,onEnter:Tt,onEntering:Lt,onEntered:xr,children:Yl});let wr=null;return u&&(wr=w({ref:C.setBackdropRef,onClick:Gt}),wr=Hs(g,y,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:wr})),c.jsx(c.Fragment,{children:t1.createPortal(c.jsxs(c.Fragment,{children:[wr,Yl]}),lt)})});yd.displayName="Modal";const H1=Object.assign(yd,{Manager:md}),W1=({onClose:e,title:t})=>c.jsxs("div",{className:"flex p-3 justify-between items-center border-b dark:border-slate-600",children:[c.jsx("h2",{className:"text-xl font-semibold dark:slate-300",children:t}),e&&c.jsx("button",{className:"text-gray-500 hover:text-gray-700",onClick:e,"aria-label":"Close modal",children:c.jsx(hd,{className:"w-5 h-5"})})]}),Bl=({isOpen:e,onClose:t,title:n,children:r,className:l})=>{const o=()=>c.jsx("div",{className:"fixed inset-0 bg-black/30 z-[300] dark:bg-black/60 backdrop-blur"});return c.jsx(H1,{show:e,onHide:t,renderBackdrop:o,className:"fixed z-[301] top-0 left-0 w-full h-full block overflow-x-hidden overflow-y-auto",children:c.jsxs("div",{className:`bg-white shadow-lg my-8 mx-auto max-w-2xl rounded ${l} dark:bg-slate-800 dark:text-gray-50`,children:[c.jsx(W1,{onClose:t,title:n}),r]})})},Vl=({children:e})=>c.jsx("div",{className:"p-3 border-b dark:border-slate-500",children:e}),Hl=({children:e,className:t})=>c.jsx("div",{className:`p-3 flex justify-end gap-2 ${t}`,children:e}),Et=({onClick:e,children:t,className:n,disabled:r,variant:l})=>{let o={secondary:"hover:bg-blue-500 transition-colors hover:text-white dark:hover:bg-blue-900/50",danger:"bg-red-400 text-white border-green-50 hover:border-red-700 hover:bg-red-600 dark:bg-red-800 dark:border-none dark:hover:bg-red-900",primary:"bg-blue-600 text-white hover:bg-blue-800 disabled:bg-blue-200 dark:disabled:bg-slate-600 dark:disabled:text-slate-300 dark:border-none",cancel:"hover:bg-slate-200 dark:bg-slate-600 dark:hover:bg-slate-700 dark:border-none",none:""}[l??"secondary"];return c.jsx("button",{disabled:r,onClick:i=>{i.preventDefault(),e()},className:`inline-flex items-center gap-1 border rounded-lg disabled:cursor-not-allowed px-2 py-1 dark:border-slate-700 ${o} ${n}`,children:t})},Ws=e=>{let t;const n=new Set,r=(s,a)=>{const v=typeof s=="function"?s(t):s;if(!Object.is(v,t)){const h=t;t=a??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(f=>f(t,h))}},l=()=>t,u={setState:r,getState:l,subscribe:s=>(n.add(s),()=>n.delete(s)),destroy:()=>{n.clear()}};return t=e(r,l,u),u},Q1=e=>e?Ws(e):Ws;var xd={exports:{}},wd={},kd={exports:{}},Sd={};/** + * @license React + * use-sync-external-store-shim.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var _n=x;function Z1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var K1=typeof Object.is=="function"?Object.is:Z1,G1=_n.useState,Y1=_n.useEffect,X1=_n.useLayoutEffect,J1=_n.useDebugValue;function q1(e,t){var n=t(),r=G1({inst:{value:n,getSnapshot:t}}),l=r[0].inst,o=r[1];return X1(function(){l.value=n,l.getSnapshot=t,To(l)&&o({inst:l})},[e,n,t]),Y1(function(){return To(l)&&o({inst:l}),e(function(){To(l)&&o({inst:l})})},[e]),J1(n),n}function To(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!K1(e,n)}catch{return!0}}function b1(e,t){return t()}var ep=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?b1:q1;Sd.useSyncExternalStore=_n.useSyncExternalStore!==void 0?_n.useSyncExternalStore:ep;kd.exports=Sd;var tp=kd.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Wl=x,np=tp;function rp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lp=typeof Object.is=="function"?Object.is:rp,op=np.useSyncExternalStore,ip=Wl.useRef,up=Wl.useEffect,sp=Wl.useMemo,ap=Wl.useDebugValue;wd.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var o=ip(null);if(o.current===null){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=sp(function(){function s(g){if(!a){if(a=!0,v=g,g=r(g),l!==void 0&&i.hasValue){var y=i.value;if(l(y,g))return h=y}return h=g}if(y=h,lp(v,g))return y;var S=r(g);return l!==void 0&&l(y,S)?y:(v=g,h=S)}var a=!1,v,h,f=n===void 0?null:n;return[function(){return s(t())},f===null?void 0:function(){return s(f())}]},[t,n,r,l]);var u=op(e,o[0],o[1]);return up(function(){i.hasValue=!0,i.value=u},[u]),ap(u),u};xd.exports=wd;var cp=xd.exports;const dp=El(cp),{useDebugValue:fp}=Je,{useSyncExternalStoreWithSelector:pp}=dp;function hp(e,t=e.getState,n){const r=pp(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return fp(r),r}const Qs=e=>{const t=typeof e=="function"?Q1(e):e,n=(r,l)=>hp(t,r,l);return Object.assign(n,t),n},Ed=e=>e?Qs(e):Qs,mp=(e,t)=>e.id==t.id&&e.info_hash==t.info_hash,vp=(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.length===t.length&&e.every((n,r)=>mp(n,t[r])),At=Ed(e=>({torrents:null,torrentsLoading:!1,torrentsInitiallyLoading:!1,setTorrentsLoading:t=>e(n=>n.torrents==null?{torrentsInitiallyLoading:t,torrentsLoading:t}:{torrentsInitiallyLoading:!1,torrentsLoading:t}),setTorrents:t=>e(n=>vp(n.torrents,t)?{}:{torrents:t}),refreshTorrents:()=>{},setRefreshTorrents:t=>e({refreshTorrents:t})})),gp=({id:e,show:t,onHide:n})=>{if(!t)return null;const[r,l]=x.useState(!1),[o,i]=x.useState(null),[u,s]=x.useState(!1),a=x.useContext(Nt),v=At(g=>g.refreshTorrents),h=()=>{l(!1),i(null),s(!1),n()},f=()=>{s(!0),(r?a.delete:a.forget)(e).then(()=>{v(),h()}).catch(y=>{i({text:`Error deleting torrent id=${e}`,details:y}),s(!1)})};return c.jsxs(Bl,{isOpen:t,onClose:n,title:"Delete torrent",children:[c.jsxs(Vl,{children:[c.jsx("p",{className:"text-gray-700 dark:text-slate-300",children:"Are you sure you want to delete the torrent?"}),c.jsxs("div",{className:"mt-4 flex items-center",children:[c.jsx("input",{type:"checkbox",id:"deleteFiles",className:"form-checkbox h-4 w-4 text-blue-500",onChange:()=>l(!r),checked:r,placeholder:"Also delete files"}),c.jsx("label",{htmlFor:"deleteFiles",className:"ml-2 text-gray-700 dark:text-slate-300",children:"Also delete files"})]}),o&&c.jsx(Qt,{error:o})]}),c.jsxs(Hl,{children:[u&&c.jsx(Sl,{}),c.jsx(Et,{variant:"cancel",onClick:h,children:"Cancel"}),c.jsx(Et,{variant:"danger",onClick:f,disabled:u,children:"Delete Torrent"})]})]})};function yp(e){return ee({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"}}]})(e)}function xp(e){return ee({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function wp(e){return ee({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}const gn=Ed(e=>({closeableError:null,setCloseableError:t=>e(()=>({closeableError:t})),otherError:null,setOtherError:t=>e(()=>({otherError:t}))})),kp=({id:e,statsResponse:t})=>{let n=t.state,[r,l]=x.useState(!1),[o,i]=x.useState(!1),u=x.useContext(cd);const s=n=="live",a=n=="paused"||n=="error",v=gn(L=>L.setCloseableError),h=x.useContext(Nt),f=()=>{l(!0),h.start(e).then(()=>{u.refresh()},L=>{v({text:`Error starting torrent id=${e}`,details:L})}).finally(()=>l(!1))},g=()=>{l(!0),h.pause(e).then(()=>{u.refresh()},L=>{v({text:`Error pausing torrent id=${e}`,details:L})}).finally(()=>l(!1))},y=()=>{l(!0),i(!0)},S=()=>{l(!1),i(!1)};return c.jsxs("div",{className:"flex w-full justify-center gap-2 dark:text-slate-300",children:[a&&c.jsx(vn,{onClick:f,disabled:r,children:c.jsx(xp,{className:"hover:text-green-600"})}),s&&c.jsx(vn,{onClick:g,disabled:r,children:c.jsx(yp,{className:"hover:text-amber-500"})}),c.jsx(vn,{onClick:y,disabled:r,children:c.jsx(wp,{className:"hover:text-red-500"})}),c.jsx(gp,{id:e,show:o,onHide:S})]})},Sp=({now:e,variant:t,label:n})=>{const r=n??`${e.toFixed(2)}%`,l={warn:"bg-amber-500",info:"bg-blue-500 text-white",success:"bg-green-700 text-white",error:"bg-red-500 text-white"}[t??"info"];return c.jsx("div",{className:"w-full bg-gray-200 rounded-full dark:bg-gray-500",children:c.jsx("div",{className:`text-xs bg-blue-500 text-white font-medium transition-all text-center p-0.5 leading-none rounded-full ${l}`,style:{width:`${e}%`},children:r})})};function pr(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+n[r]}const Ep=({statsResponse:e})=>{var t,n;switch(e.state){case n1:return"Paused";case wu:return"Checking files";case l1:return"Error"}return e.state!="live"||e.live===null?e.state:c.jsxs(c.Fragment,{children:[!e.finished&&c.jsxs("div",{className:"download-speed",children:["↓ ",(t=e.live.download_speed)==null?void 0:t.human_readable]}),c.jsxs("div",{className:"upload-speed",children:["↑ ",(n=e.live.upload_speed)==null?void 0:n.human_readable,e.live.snapshot.uploaded_bytes>0&&c.jsxs("span",{children:["(",pr(e.live.snapshot.uploaded_bytes),")"]})]})]})};function Cp(e){return e.files.filter(n=>n.included).reduce((n,r)=>n.length>r.length?n:r).name}function _p(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,l=(o,i)=>o>0?`${o}${i}`:"";return t>0?`${l(t,"h")} ${l(n,"m")}`.trim():n>0?`${l(n,"m")} ${l(r,"s")}`.trim():`${l(r,"s")}`.trim()}function jp(e){var n,r,l;let t=(l=(r=(n=e==null?void 0:e.live)==null?void 0:n.time_remaining)==null?void 0:r.duration)==null?void 0:l.secs;return t==null?"N/A":_p(t)}function Np(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}}]})(e)}function Tp(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}}]})(e)}function Lp(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}}]})(e)}function Pp(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M9 16h6v-6h4l-7-7-7 7h4v6zm3-10.17L14.17 8H13v6h-2V8H9.83L12 5.83zM5 18h14v2H5z"}}]})(e)}function zp(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 12c0 5.52-4.48 10-10 10S2 17.52 2 12c0-1.19.22-2.32.6-3.38l1.88.68C4.17 10.14 4 11.05 4 12c0 4.41 3.59 8 8 8s8-3.59 8-8-3.59-8-8-8c-.95 0-1.85.17-2.69.48l-.68-1.89C9.69 2.22 10.82 2 12 2c5.52 0 10 4.48 10 10zM5.5 4C4.67 4 4 4.67 4 5.5S4.67 7 5.5 7 7 6.33 7 5.5 6.33 4 5.5 4zM11 16V8H9v8h2zm4 0V8h-2v8h2z"}}]})(e)}const Mp=({className:e,finished:t,live:n,error:r})=>{const l=t&&n;return r?c.jsx(Tp,{className:e,color:"red"}):l?c.jsx(Pp,{className:e,color:"green"}):t?c.jsx(Np,{className:e,color:"green"}):n?c.jsx(Lp,{className:`text-blue-500 ${e}`}):c.jsx(zp,{className:e})},Op=({id:e,detailsResponse:t,statsResponse:n})=>{const r=(n==null?void 0:n.state)??"",l=(n==null?void 0:n.error)??null,o=(n==null?void 0:n.total_bytes)??1,i=(n==null?void 0:n.progress_bytes)??0,u=(n==null?void 0:n.finished)||!1,s=l?100:i/o*100,a=()=>{var f;let h=(f=n==null?void 0:n.live)==null?void 0:f.snapshot.peer_stats;return h?`${h.live} / ${h.seen}`:""},v=h=>c.jsx(Mp,{className:h,error:!!l,live:!!(n!=null&&n.live),finished:u});return c.jsxs("section",{className:"flex flex-col sm:flex-row items-center gap-2 border p-2 border-gray-200 rounded-xl shadow-xs hover:drop-shadow-sm dark:bg-slate-800 dark:border-slate-900",children:[c.jsx("div",{className:"hidden md:block",children:v("w-10 h-10")}),c.jsxs("div",{className:"w-full flex flex-col gap-2",children:[t&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"md:hidden",children:v("w-5 h-5")}),c.jsx("div",{className:"text-left text-lg text-gray-900 text-ellipsis break-all dark:text-slate-200",children:Cp(t)})]}),l?c.jsxs("p",{className:"text-red-500 text-sm",children:[c.jsx("strong",{children:"Error:"})," ",l]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{children:c.jsx(Sp,{now:s,label:l,variant:r==wu?"warn":u?"success":"info"})}),c.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2 sm:flex-wrap items-center text-sm text-nowrap font-medium text-gray-500",children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(a1,{})," ",a().toString()]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(s1,{}),c.jsxs("div",{children:[pr(i),"/",pr(o)]})]}),n&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(u1,{}),jp(n)]}),c.jsx("div",{className:"flex gap-2 items-center",children:c.jsx(Ep,{statsResponse:n})})]})]})]})]}),n&&c.jsx("div",{className:"",children:c.jsx(kp,{id:e,statsResponse:n})})]})},Ip=({id:e,torrent:t})=>{const[n,r]=x.useState(null),[l,o]=x.useState(null),[i,u]=x.useState(0),s=x.useContext(Nt),a=()=>{u(i+1)};return x.useEffect(()=>{if(n===null)return dd(async()=>{await s.getTorrentDetails(t.id).then(r)},1e3)},[n]),x.useEffect(()=>ku(async()=>s.getTorrentStats(t.id).then(g=>(o(g),g)).then(g=>g.state==wu||g.state==r1?1e3:1e4,()=>1e4),0),[i]),c.jsx(cd.Provider,{value:{refresh:a},children:c.jsx(Op,{id:e,detailsResponse:n,statsResponse:l})})},Fp=e=>c.jsx("div",{className:"flex flex-col gap-2 mx-2 pb-3 sm:px-7",children:e.torrents===null?e.loading?c.jsx(Sl,{className:"justify-center m-5",label:"Loading torrent list"}):null:e.torrents.length===0?c.jsx("p",{className:"text-center",children:"No existing torrents found."}):e.torrents.map(t=>c.jsx(Ip,{id:t.id,torrent:t},t.id))}),Dp=e=>{let t=gn(i=>i.closeableError),n=gn(i=>i.setCloseableError),r=gn(i=>i.otherError),l=At(i=>i.torrents),o=At(i=>i.torrentsInitiallyLoading);return c.jsxs("div",{className:"container mx-auto",children:[c.jsx(Qt,{error:t,remove:()=>n(null)}),c.jsx(Qt,{error:r}),c.jsx(Fp,{torrents:l,loading:o})]})};var Rp="Expected a function",Zs=0/0,$p="[object Symbol]",Ap=/^\s+|\s+$/g,Up=/^[-+]0x[0-9a-f]+$/i,Bp=/^0b[01]+$/i,Vp=/^0o[0-7]+$/i,Hp=parseInt,Wp=typeof kr=="object"&&kr&&kr.Object===Object&&kr,Qp=typeof self=="object"&&self&&self.Object===Object&&self,Zp=Wp||Qp||Function("return this")(),Kp=Object.prototype,Gp=Kp.toString,Yp=Math.max,Xp=Math.min,Lo=function(){return Zp.Date.now()};function Jp(e,t,n){var r,l,o,i,u,s,a=0,v=!1,h=!1,f=!0;if(typeof e!="function")throw new TypeError(Rp);t=Ks(t)||0,_i(n)&&(v=!!n.leading,h="maxWait"in n,o=h?Yp(Ks(n.maxWait)||0,t):o,f="trailing"in n?!!n.trailing:f);function g(E){var j=r,T=l;return r=l=void 0,a=E,i=e.apply(T,j),i}function y(E){return a=E,u=setTimeout(p,t),v?g(E):i}function S(E){var j=E-s,T=E-a,D=t-j;return h?Xp(D,o-T):D}function L(E){var j=E-s,T=E-a;return s===void 0||j>=t||j<0||h&&T>=o}function p(){var E=Lo();if(L(E))return d(E);u=setTimeout(p,S(E))}function d(E){return u=void 0,f&&r?g(E):(r=l=void 0,i)}function m(){u!==void 0&&clearTimeout(u),a=0,r=s=l=u=void 0}function w(){return u===void 0?i:d(Lo())}function _(){var E=Lo(),j=L(E);if(r=arguments,l=this,s=E,j){if(u===void 0)return y(s);if(h)return u=setTimeout(p,t),g(s)}return u===void 0&&(u=setTimeout(p,t)),i}return _.cancel=m,_.flush=w,_}function _i(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function qp(e){return!!e&&typeof e=="object"}function bp(e){return typeof e=="symbol"||qp(e)&&Gp.call(e)==$p}function Ks(e){if(typeof e=="number")return e;if(bp(e))return Zs;if(_i(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=_i(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Ap,"");var n=Bp.test(e);return n||Vp.test(e)?Hp(e.slice(2),n?2:8):Up.test(e)?Zs:+e}var eh=Jp;const th=El(eh),nh=({span:e})=>{let t=Object.entries(e).filter(([n,r])=>n!="name");return t.length==0?null:c.jsxs(c.Fragment,{children:["{",t.map(([n,r])=>c.jsxs("span",{children:[n," = ",r]},n)).reduce((n,r)=>c.jsxs(c.Fragment,{children:[n,", ",r]})),"}"]})},rh=({span:e})=>c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"font-bold",children:e.name}),c.jsx(nh,{span:e}),c.jsx("span",{className:"font-bold",children:":"})]}),lh=({fields:e})=>c.jsxs("span",{className:`m-1 ${e.message.match(/error|fail/g)?"text-red-500":"text-slate-500 dark:text-slate-200"}`,children:[e.message,Object.entries(e).filter(([t,n])=>t!="message").map(([t,n])=>c.jsxs("span",{className:"m-1",children:[c.jsx("span",{className:"italic font-bold",children:t}),"=",n]},t))]}),oh=Je.memo(({line:e})=>{var r;const t=e,n=l=>{switch(l){case"DEBUG":return"text-blue-500";case"INFO":return"text-green-500";case"WARN":return"text-amber-500";case"ERROR":return"text-red-500";default:return"text-slate-500"}};return c.jsxs("p",{className:"font-mono m-0 text-break text-[10px]",children:[c.jsx("span",{className:"m-1 text-slate-500 dark:text-slate-400",children:t.timestamp}),c.jsx("span",{className:`m-1 ${n(t.level)}`,children:t.level}),c.jsx("span",{className:"m-1",children:(r=t.spans)==null?void 0:r.map((l,o)=>c.jsx(rh,{span:l},o))}),c.jsx("span",{className:"m-1 text-slate-500 dark:text-slate-400",children:t.target}),c.jsx(lh,{fields:t.fields})]})}),Cd=({children:e})=>c.jsx("form",{children:e}),Cu=({autoFocus:e,value:t,name:n,disabled:r,onChange:l,onKeyDown:o,label:i,help:u,inputType:s,placeholder:a})=>c.jsxs("div",{className:"flex flex-col gap-2 text-sm mb-2",children:[c.jsx("label",{htmlFor:n,className:"dark:text-white",children:i}),c.jsx("input",{autoFocus:e,type:s,className:"block border rounded bg-transparent py-1.5 pl-2 text-gray-800 focus:ring-0 sm:text-sm sm:leading-6 dark:text-slate-300",id:n,name:n,disabled:r,placeholder:a,value:t,onKeyDown:o,onChange:l}),u&&c.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-300",children:u})]}),ih=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n},uh=(e,t,n)=>{const r=new AbortController,l=r.signal;let o=!1;const i=()=>{console.log("cancelling fetch"),o=!0,r.abort()},u=async()=>{let a=await fetch(e,{signal:l});if(!a.ok){let f=await a.text();throw n({text:"error fetching logs",details:{statusText:a.statusText,text:f}}),null}if(!a.body){n({text:"error fetching logs: ReadableStream not supported."});return}n(null);const v=a.body.getReader();let h=new Uint8Array;for(;;){const{done:f,value:g}=await v.read();if(f)throw n({text:"log stream terminated"}),null;h=ih(h,g);for(let y;(y=h.indexOf(10))!==-1;){let S=h.slice(0,y),L=new TextDecoder().decode(S);t(L),h=h.slice(y+1)}}};let s=dd(()=>u().then(()=>{},a=>{if(!o&&a!==null)throw n({text:"error streaming logs",details:{text:a.toString()}}),a}),1e3);return()=>{i(),s()}},sh=({url:e,maxLines:t})=>{const[n,r]=x.useState([]),[l,o]=x.useState(null),[i,u]=x.useState(""),s=x.useRef(null),a=t??1e3,v=x.useCallback(y=>{r(S=>[{id:S.length==0?0:S[0].id+1,content:y,parsed:JSON.parse(y),show:s.current?!!y.match(s.current):!0},...S.slice(0,a-1)])},[s.current,t]),h=x.useRef(v);h.current=v;const f=th(y=>{let S=null;try{S=new RegExp(y)}catch{return}s.current=S,r(L=>{let p=[...L];for(let d of p)d.show=!!d.content.match(S);return p})},200),g=y=>{u(y),f(y)};return x.useEffect(()=>f.cancel,[]),x.useEffect(()=>uh(e,y=>h.current(y),o),[e]),c.jsxs("div",{children:[c.jsx(Qt,{error:l}),c.jsxs("div",{className:"mb-3",children:["Showing last ",a," logs since this window was opened"]}),c.jsx(Cd,{children:c.jsx(Cu,{value:i,name:"filter",placeholder:"Enter filter (regex)",onChange:y=>g(y.target.value)})}),n.map(y=>c.jsx("div",{hidden:!y.show,children:c.jsx(oh,{line:y.parsed})},y.id))]})},ah=({show:e,onClose:t})=>{let r=x.useContext(Nt).getStreamLogsUrl();return c.jsxs(Bl,{isOpen:e,onClose:t,title:"rqbit server logs",className:"max-w-7xl",children:[c.jsx(Vl,{children:r?c.jsx(sh,{url:r}):c.jsx(Qt,{error:{text:"HTTP API not available to stream logs"}})}),c.jsx(Hl,{children:c.jsx(Et,{variant:"primary",onClick:t,children:"Close"})})]})},ch=({children:e,label:t,help:n,className:r})=>c.jsxs("fieldset",{className:`mb-4 ${r}`,children:[t&&c.jsx("label",{className:"text-md font-md mb-3 block pb-1 border-b",children:t}),e]}),Gs=({checked:e,name:t,disabled:n,onChange:r,label:l,help:o,inputType:i})=>c.jsxs("div",{className:"flex gap-3 items-start",children:[c.jsx("div",{className:"flex",children:c.jsx("input",{type:i||"checkbox",className:"block mt-1",id:t,name:t,disabled:n,checked:e,onChange:r})}),c.jsxs("div",{className:"text-sm flex flex-col gap-1",children:[c.jsx("label",{htmlFor:t,children:l}),o&&c.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-300 mb-3",children:o})]})]});function dh(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.438,20.938H5.564a2.5,2.5,0,0,1-2.5-2.5V5.564a2.5,2.5,0,0,1,2.5-2.5H18.438a2.5,2.5,0,0,1,2.5,2.5V18.438A2.5,2.5,0,0,1,18.438,20.938ZM5.564,4.064a1.5,1.5,0,0,0-1.5,1.5V18.438a1.5,1.5,0,0,0,1.5,1.5H18.438a1.5,1.5,0,0,0,1.5-1.5V5.564a1.5,1.5,0,0,0-1.5-1.5Z"}},{tag:"path",attr:{d:"M9,12.5a.5.5,0,0,1,0-1h6a.5.5,0,0,1,0,1Z"}}]}]}]})(e)}function fh(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.438,20.938H5.563a2.5,2.5,0,0,1-2.5-2.5V5.564a2.5,2.5,0,0,1,2.5-2.5H18.438a2.5,2.5,0,0,1,2.5,2.5V18.438A2.5,2.5,0,0,1,18.438,20.938ZM5.563,4.064a1.5,1.5,0,0,0-1.5,1.5V18.438a1.5,1.5,0,0,0,1.5,1.5H18.438a1.5,1.5,0,0,0,1.5-1.5V5.564a1.5,1.5,0,0,0-1.5-1.5Z"}},{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"}}]}]}]})(e)}const ph=(e,t)=>e.indexOf(t)===-1?[e,void 0]:[e.slice(0,e.indexOf(t)),e.slice(e.indexOf(t)+1)],hh=e=>{const t="/",n=(r,l,o)=>{let i=[],u=[],s={};const a=h=>(s[h]=s[h]||[],s[h]);o.forEach(h=>{let[f,g]=ph(h.name,t);if(g===void 0){i.push(h);return}a(f).push({id:h.id,name:g,length:h.length})});let v=0;for(const[h,f]of Object.entries(s))u.push(n(h,l+"."+v,f)),v+=1;return{name:r,id:l,dirs:u,files:i}};return n("","filetree-root",e.details.files.map((r,l)=>({id:l,name:r.name,length:r.length})))},_d=({tree:e,selectedFiles:t,setSelectedFiles:n,initialExpanded:r,listTorrentResponse:l})=>{let[o,i]=x.useState(r),u=x.useMemo(()=>{let f=g=>{let y=g.dirs.flatMap(f);return y.push(...g.files.map(S=>S.id)),y};return f(e)},[e]);const s=f=>{if(f.target.checked){let g=new Set(t);u.forEach(y=>g.add(y)),n(g)}else{let g=new Set(t);u.forEach(y=>g.delete(y)),n(g)}},a=f=>{if(t.has(f)){let g=new Set(t);g.delete(f),n(g)}else{let g=new Set(t);g.add(f),n(g)}},v=()=>u.filter(f=>t.has(f)).length,h=()=>u.filter(f=>t.has(f)).map(f=>l.details.files[f].length).reduce((f,g)=>f+g,0);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center",children:[c.jsx(vn,{onClick:()=>i(!o),children:o?c.jsx(dh,{}):c.jsx(fh,{})}),c.jsx(Gs,{checked:u.every(f=>t.has(f)),label:`${e.name?e.name+", ":""} ${v()} files, ${pr(h())}`,name:e.id,onChange:s})]}),c.jsxs("div",{className:"pl-5",hidden:!o,children:[e.dirs.map(f=>c.jsx(_d,{listTorrentResponse:l,tree:f,selectedFiles:t,setSelectedFiles:n,initialExpanded:!1},f.name)),c.jsx("div",{className:"pl-1",children:e.files.map(f=>c.jsx(Gs,{checked:t.has(f.id),label:`${f.name} (${pr(f.length)})`,name:`file-${f.id}`,onChange:()=>a(f.id)},f.id))})]})]})},mh=({listTorrentResponse:e,selectedFiles:t,setSelectedFiles:n})=>{let r=x.useMemo(()=>hh(e),[e]);return c.jsx(c.Fragment,{children:c.jsx(_d,{listTorrentResponse:e,tree:r,selectedFiles:t,setSelectedFiles:n,initialExpanded:!0})})},vh=e=>{let{onHide:t,listTorrentResponse:n,listTorrentError:r,listTorrentLoading:l,data:o}=e;const[i,u]=x.useState(new Set),[s,a]=x.useState(!1),[v,h]=x.useState(null),[f,g]=x.useState(!1),[y,S]=x.useState(""),L=At(_=>_.refreshTorrents),p=x.useContext(Nt);x.useEffect(()=>{u(new Set(n==null?void 0:n.details.files.map((_,E)=>E))),S((n==null?void 0:n.output_folder)||"")},[n]);const d=()=>{t(),u(new Set),h(null),a(!1)},m=async()=>{if(!n)return;a(!0);let _=n.seen_peers?n.seen_peers.slice(0,32):null,E={overwrite:!0,only_files:Array.from(i),initial_peers:_,output_folder:y};f&&(E.peer_opts={connect_timeout:20,read_write_timeout:60}),p.uploadTorrent(o,E).then(()=>{t(),L()},j=>{h({text:"Error starting torrent",details:j})}).finally(()=>a(!1))},w=()=>{if(l)return c.jsx(Sl,{label:"Loading torrent contents"});if(r)return c.jsx(Qt,{error:r});if(n)return c.jsxs(Cd,{children:[c.jsx(Cu,{label:"Output folder",name:"output_folder",inputType:"text",value:y,onChange:_=>S(_.target.value)}),c.jsx(ch,{children:c.jsx(mh,{selectedFiles:i,setSelectedFiles:u,listTorrentResponse:n})})]})};return c.jsxs(Bl,{isOpen:!0,onClose:d,title:"Add Torrent",children:[c.jsxs(Vl,{children:[w(),c.jsx(Qt,{error:v})]}),c.jsxs(Hl,{children:[s&&c.jsx(Sl,{}),c.jsx(Et,{onClick:d,variant:"cancel",children:"Cancel"}),c.jsx(Et,{onClick:m,variant:"primary",disabled:l||s||i.size==0,children:"OK"})]})]})},jd=({onClick:e,data:t,resetData:n,children:r,className:l})=>{const[o,i]=x.useState(!1),[u,s]=x.useState(null),[a,v]=x.useState(null),h=x.useContext(Nt);x.useEffect(()=>{if(t===null)return;let g=setTimeout(async()=>{i(!0);try{const y=await h.uploadTorrent(t,{list_only:!0});s(y)}catch(y){v({text:"Error listing torrent files",details:y})}finally{i(!1)}},0);return()=>clearTimeout(g)},[t]);const f=()=>{n(),v(null),s(null),i(!1)};return c.jsxs(c.Fragment,{children:[c.jsx(Et,{onClick:e,className:l,children:r}),t&&c.jsx(vh,{onHide:f,listTorrentError:a,listTorrentResponse:u,data:t,listTorrentLoading:o})]})};function gh(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M10 18V16H8V14H10V12H12V14H14V16H12V18H10Z",fill:"currentColor"}},{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2C4.34315 2 3 3.34315 3 5V19C3 20.6569 4.34315 22 6 22H18C19.6569 22 21 20.6569 21 19V9C21 5.13401 17.866 2 14 2H6ZM6 4H13V9H19V19C19 19.5523 18.5523 20 18 20H6C5.44772 20 5 19.5523 5 19V5C5 4.44772 5.44772 4 6 4ZM15 4.10002C16.6113 4.4271 17.9413 5.52906 18.584 7H15V4.10002Z",fill:"currentColor"}}]})(e)}function yh(e){return ee({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M14.8284 12L16.2426 13.4142L19.071 10.5858C20.6331 9.02365 20.6331 6.49099 19.071 4.9289C17.509 3.3668 14.9763 3.3668 13.4142 4.9289L10.5858 7.75732L12 9.17154L14.8284 6.34311C15.6095 5.56206 16.8758 5.56206 17.6568 6.34311C18.4379 7.12416 18.4379 8.39049 17.6568 9.17154L14.8284 12Z",fill:"currentColor"}},{tag:"path",attr:{d:"M12 14.8285L13.4142 16.2427L10.5858 19.0711C9.02372 20.6332 6.49106 20.6332 4.92896 19.0711C3.36686 17.509 3.36686 14.9764 4.92896 13.4143L7.75739 10.5858L9.1716 12L6.34317 14.8285C5.56212 15.6095 5.56212 16.8758 6.34317 17.6569C7.12422 18.4379 8.39055 18.4379 9.1716 17.6569L12 14.8285Z",fill:"currentColor"}},{tag:"path",attr:{d:"M14.8285 10.5857C15.219 10.1952 15.219 9.56199 14.8285 9.17147C14.4379 8.78094 13.8048 8.78094 13.4142 9.17147L9.1716 13.4141C8.78107 13.8046 8.78107 14.4378 9.1716 14.8283C9.56212 15.2188 10.1953 15.2188 10.5858 14.8283L14.8285 10.5857Z",fill:"currentColor"}}]})(e)}const xh=({className:e})=>{const t=x.useRef(),[n,r]=x.useState(null),l=async()=>{var s;if(!((s=t==null?void 0:t.current)!=null&&s.files))return;const u=t.current.files[0];r(u)},o=()=>{t!=null&&t.current&&(t.current.value="",r(null))},i=()=>{t!=null&&t.current&&t.current.click()};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"file",ref:t,accept:".torrent",onChange:l,hidden:!0}),c.jsxs(jd,{onClick:i,data:n,resetData:o,className:`group ${e}`,children:[c.jsx(gh,{className:"text-blue-500 group-hover:text-white dark:text-white"}),c.jsx("div",{children:"Upload .torrent File"})]})]})},wh=({className:e})=>{const[t,n]=x.useState(null),[r,l]=x.useState(""),[o,i]=x.useState(!1),u=()=>{n(r),l(""),i(!1)},s=()=>{i(!1),n(null)};return c.jsxs(c.Fragment,{children:[c.jsxs(jd,{onClick:()=>{i(!0)},data:t,className:`group ${e}`,resetData:()=>n(null),children:[c.jsx(yh,{className:"text-blue-500 group-hover:text-white dark:text-white"}),c.jsx("div",{children:"Add Torrent from Magnet / URL"})]}),c.jsxs(Bl,{isOpen:o,onClose:s,title:"Add torrent",children:[c.jsx(Vl,{children:c.jsx(Cu,{autoFocus:!0,value:r,name:"magnet",onChange:a=>l(a.target.value),onKeyDown:a=>{a.key==="Enter"&&r&&u()},placeholder:"magnet:?xt=urn:btih:...",help:"Enter magnet or HTTP(S) URL to the .torrent"})}),c.jsxs(Hl,{children:[c.jsx(Et,{variant:"cancel",onClick:s,children:"Cancel"}),c.jsx(Et,{disabled:!r,variant:"primary",onClick:u,children:"Add"})]})]})]})},kh=e=>x.createElement("svg",{width:"64mm",height:"64mm",viewBox:"0 0 64 64",id:"svg1",xmlSpace:"preserve","inkscape:version":"1.3.1 (91b66b0, 2023-11-16)","sodipodi:docname":"logo.svg","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...e},x.createElement("sodipodi:namedview",{id:"namedview1",pagecolor:"#ffffff",bordercolor:"#000000",borderopacity:.25,"inkscape:showpageshadow":2,"inkscape:pageopacity":0,"inkscape:pagecheckerboard":0,"inkscape:deskcolor":"#d1d1d1","inkscape:document-units":"mm","inkscape:zoom":1.4936372,"inkscape:cx":134.90559,"inkscape:cy":139.92689,"inkscape:window-width":1440,"inkscape:window-height":847,"inkscape:window-x":0,"inkscape:window-y":25,"inkscape:window-maximized":0,"inkscape:current-layer":"layer1"}),x.createElement("defs",{id:"defs1"},x.createElement("inkscape:perspective",{"sodipodi:type":"inkscape:persp3d","inkscape:vp_x":"3.1042448 : 18.147022 : 1","inkscape:vp_y":"0 : 999.99994 : 0","inkscape:vp_z":"303.94612 : 54.05812 : 1","inkscape:persp3d-origin":"105 : -134 : 1",id:"perspective4"})),x.createElement("g",{"inkscape:label":"Layer 1","inkscape:groupmode":"layer",id:"layer1",transform:"translate(-56.674541,-85.911432)"},x.createElement("path",{style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.610041},d:"m 81.603814,145.5382 -7.433116,-4.36986 -6.018097,-3.54529 -6.018099,-3.54529 -0.09405,-0.35761 -0.09406,-0.3576 v -15.31979 -15.31979 l 0.09451,-0.35939 0.09451,-0.35938 6.017643,-3.544433 6.017641,-3.544428 7.432805,-4.369167 7.432803,-4.369166 0.240089,0.09331 0.240083,0.09331 13.292394,7.826122 13.29241,7.826122 0.093,0.35355 0.093,0.35355 v 15.31979 15.31979 l -0.0928,0.35267 -0.0928,0.35266 -13.29682,7.82802 -13.296819,7.82803 -0.235583,0.0921 -0.235588,0.0921 z m 19.758596,-5.88315 12.13185,-7.15306 v -14.45996 -14.45994 l -5.11526,-3.01603 -5.11526,-3.016035 -7.017048,-4.136312 -7.017053,-4.13631 h -0.112738 -0.11273 l -7.097035,4.182089 -7.09703,4.18209 -5.035336,2.971548 -5.035335,2.97155 v 14.45761 14.45762 l 5.275113,3.11051 5.275113,3.11051 6.793709,4.02813 6.793702,4.02812 0.176743,0.0155 0.176742,0.0155 z",id:"path15","sodipodi:nodetypes":"cccccccccccccccccccccccccccccccccccccccccccccccccccc"}),x.createElement("path",{style:{fill:"#000000"},id:"path1",d:""}),x.createElement("path",{d:"m 84.161856,133.76725 -4.567369,-2.5483 -0.700367,0.28585 -0.700376,0.28584 -0.495731,0.11427 -0.495731,0.11426 -3.168791,-1.75603 -3.168782,-1.75603 -0.515321,-0.57002 -0.515323,-0.57002 0.0161,-3.59449 0.0161,-3.59448 0.164041,-0.41611 0.164042,-0.41611 1.480342,-0.85565 1.480346,-0.85565 0.06276,-3.67919 0.06276,-3.67921 0.39653,-0.35884 0.396521,-0.35886 3.663275,-2.04111 3.663267,-2.04112 0.114523,-1.62785 0.114506,-1.62786 0.229029,-0.21764 0.229038,-0.21765 3.341459,-1.854383 3.341467,-1.854382 h 0.301682 0.301682 l 2.476951,1.380374 2.476959,1.380381 1.151673,0.57845 1.151674,0.57845 0.02969,0.27424 0.02969,0.27423 0.02753,1.46272 0.02753,1.46273 3.663258,2.04521 3.66327,2.04521 0.40205,0.36386 0.40206,0.36385 v 3.60098 3.60097 l 0.28629,0.23408 0.28628,0.23408 1.43146,0.72479 1.43145,0.72479 v 3.9806 3.98059 l -0.51533,0.56995 -0.51532,0.56994 -3.19072,1.75191 -3.19072,1.75191 -0.47379,-0.11007 -0.473797,-0.11007 -0.699654,-0.28558 -0.699656,-0.28558 -4.589745,2.5527 -4.589746,2.55269 -0.321886,-0.004 -0.321886,-0.004 z m 8.681258,-1.65766 3.426793,-1.91645 0.06536,-0.19784 0.06535,-0.19785 -1.315884,-0.68709 -1.315885,-0.6871 -0.401264,-0.40081 -0.401265,-0.4008 v -3.79409 -3.79409 l 0.221568,-0.41401 0.221567,-0.414 3.411065,-1.86126 3.411061,-1.86126 h 0.38456 0.38455 l 0.91435,0.46646 0.91435,0.46646 -0.0646,-2.66249 -0.0646,-2.66248 -2.829977,-1.58148 -2.829984,-1.58149 -0.204696,0.12651 -0.204688,0.12651 v 1.11999 1.11999 l -0.744359,0.54975 -0.744358,0.54977 -2.773906,1.52318 -2.773906,1.52319 h -0.526565 -0.526565 l -3.34145,-1.85945 -3.341467,-1.85945 -0.168271,-0.2591 -0.16827,-0.25909 -0.0035,-1.07439 -0.0035,-1.07439 -0.204688,-0.12651 -0.204697,-0.12651 -2.82999,1.58149 -2.829982,1.58148 -0.06458,2.66248 -0.06458,2.66249 0.914351,-0.46646 0.914343,-0.46646 h 0.378551 0.37855 l 3.638639,1.97495 3.63864,1.97495 v 4.0944 4.09441 l -0.401265,0.4008 -0.401264,0.40081 -1.315885,0.6871 -1.315884,0.68709 0.06535,0.19785 0.06536,0.19784 3.426792,1.91645 3.426785,1.91644 h 0.343552 0.343544 z m -16.416873,-5.4431 -0.06475,-2.55838 -2.046125,-1.10985 -2.046124,-1.10984 -0.195677,0.19567 -0.195685,0.19568 0.06596,2.2656 0.06596,2.2656 2.06129,1.18713 2.06129,1.18713 0.179282,0.0198 0.179273,0.0198 z m 4.515881,1.34369 2.061291,-1.19456 0.06527,-2.48747 0.06527,-2.48748 -0.408821,0.15589 -0.408848,0.15589 -1.889514,1.02885 -1.889514,1.02885 v 2.50736 2.50736 l 0.171777,-0.01 0.171767,-0.01 z m 18.666131,-1.29267 v -2.50736 l -1.889509,-1.02885 -1.889522,-1.02885 -0.40883,-0.15589 -0.408839,-0.15589 0.06527,2.48748 0.06527,2.48747 2.061291,1.19456 2.061288,1.19456 0.171777,0.01 0.171774,0.01 z m 4.466127,1.28059 2.06129,-1.18713 0.0661,-2.2656 0.066,-2.2656 -0.19568,-0.19568 -0.19568,-0.19567 -2.04613,1.10984 -2.04612,1.10985 -0.0647,2.55838 -0.0648,2.55838 0.17927,-0.0198 0.17927,-0.0198 z m -24.281888,-6.71835 1.960418,-1.07415 -0.07566,-0.22693 -0.07566,-0.22691 -2.049423,-1.09443 -2.049431,-1.09442 -2.116604,1.14523 -2.116613,1.14523 v 0.17781 0.17782 l 2.004029,1.06709 2.004037,1.06711 0.277236,0.005 0.277237,0.005 z m 23.056528,4.3e-4 2.03643,-1.07372 -0.0708,-0.21245 -0.0708,-0.21244 -2.09332,-1.13015 -2.09332,-1.13016 -2.077692,1.17124 -2.077685,1.17123 v 0.17384 0.17386 l 1.889522,1.0551 1.889505,1.0551 0.31588,0.0161 0.31587,0.0161 z m -14.742004,-11.90808 0.06492,-2.2946 -0.293917,-0.23052 -0.293926,-0.2305 -2.011741,-1.08631 -2.01175,-1.08629 0.06501,2.57478 0.06501,2.57476 1.946776,1.09773 1.946767,1.09773 0.229038,-0.0611 0.229029,-0.0611 z m 4.401245,1.31989 1.946767,-1.09857 0.06501,-2.57476 0.06501,-2.57478 -2.01175,1.08629 -2.011741,1.08631 -0.286291,0.22417 -0.286291,0.22418 v 2.22411 2.2241 l 0.152689,0.15269 0.152689,0.15269 0.133602,-0.0139 0.133602,-0.0139 z m -1.021015,-6.79999 1.952048,-1.05546 -0.224347,-0.26147 -0.224337,-0.26149 -1.958921,-1.03065 -1.958911,-1.03064 -1.958912,1.03064 -1.958912,1.03065 -0.224303,0.26142 -0.224277,0.26141 1.896915,1.04261 1.896906,1.04261 0.517494,0.0129 0.517501,0.0129 z",style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.865634},id:"path1-8"}))),Sh=({title:e})=>{const[t,n]=e.split("-");return c.jsxs("header",{className:"bg-slate-50 drop-shadow-lg flex flex-wrap justify-center lg:justify-between items-center dark:bg-slate-800 mb-3",children:[c.jsxs("div",{className:"flex flex-nowrap items-center justify-between m-2",children:[c.jsx(kh,{className:"w-10 h-10 p-1",alt:"logo"}),c.jsxs("h1",{className:"flex items-center dark:text-white",children:[c.jsx("div",{className:"text-3xl",children:t}),c.jsx("div",{className:"bg-blue-100 text-blue-800 text-xl font-semibold me-2 px-2.5 py-0.5 rounded ms-2 dark:bg-blue-900 dark:text-white",children:n})]})]}),c.jsxs("div",{className:"flex flex-wrap gap-1 m-2",children:[c.jsx(wh,{className:"flex-grow justify-center dark:text-white"}),c.jsx(xh,{className:"flex-grow justify-center dark:text-white"})]})]})};let Xt=window.matchMedia("(prefers-color-scheme: dark)").matches;window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{Ql.setDark(e.matches)});const Ql={isDark:()=>Xt,setDark:e=>(Xt=e,document.body.classList.toggle("dark",Xt),Xt),toggle:()=>{Ql.setDark(!Xt)}};Ql.setDark(Xt);const Eh=e=>{let[t,n]=x.useState(!1);gn(a=>a.setCloseableError);const r=gn(a=>a.setOtherError),l=x.useContext(Nt),o=At(a=>a.setTorrents),i=At(a=>a.setTorrentsLoading),u=At(a=>a.setRefreshTorrents),s=async()=>{i(!0);let a=await l.listTorrents().finally(()=>i(!1));o(a.torrents)};return u(s),x.useEffect(()=>ku(async()=>s().then(()=>(r(null),5e3),a=>(r({text:"Error refreshing torrents",details:a}),console.error(a),5e3)),0),[]),c.jsxs("div",{className:"dark:bg-gray-900 dark:text-gray-200 min-h-screen",children:[c.jsx(Sh,{title:e.title}),c.jsxs("div",{className:"relative",children:[c.jsxs("div",{className:"absolute top-0 start-0 pl-2 z-10",children:[e.menuButtons&&e.menuButtons.map((a,v)=>c.jsx("span",{children:a},v)),c.jsx(vn,{onClick:()=>n(!0),children:c.jsx(c1,{})}),c.jsx(vn,{onClick:Ql.toggle,children:c.jsx(d1,{})})]}),c.jsx(Dp,{})]}),c.jsx(ah,{show:t,onClose:()=>n(!1)})]})},Nd=window.origin==="null"||window.origin==="http://localhost:3031"?"http://localhost:3030":"",Ze=async(e,t,n)=>{console.log(e,t);const r=Nd+t,l={method:e,headers:{Accept:"application/json"},body:n};let o={method:e,path:t,text:""},i;try{i=await fetch(r,l)}catch{return o.text="network error",Promise.reject(o)}if(o.status=i.status,o.statusText=`${i.status} ${i.statusText}`,!i.ok){const s=await i.text();try{const a=JSON.parse(s);o.text=a.human_readable!==void 0?a.human_readable:JSON.stringify(a,null,2)}catch{o.text=s}return Promise.reject(o)}return await i.json()},Ys={getStreamLogsUrl:()=>Nd+"/stream_logs",listTorrents:()=>Ze("GET","/torrents"),getTorrentDetails:e=>Ze("GET",`/torrents/${e}`),getTorrentStats:e=>Ze("GET",`/torrents/${e}/stats/v1`),uploadTorrent:(e,t)=>{var r,l;let n="/torrents?&overwrite=true";return t!=null&&t.list_only&&(n+="&list_only=true"),(t==null?void 0:t.only_files)!=null&&(n+=`&only_files=${t.only_files.join(",")}`),(r=t==null?void 0:t.peer_opts)!=null&&r.connect_timeout&&(n+=`&peer_connect_timeout=${t.peer_opts.connect_timeout}`),(l=t==null?void 0:t.peer_opts)!=null&&l.read_write_timeout&&(n+=`&peer_read_write_timeout=${t.peer_opts.read_write_timeout}`),t!=null&&t.initial_peers&&(n+=`&initial_peers=${t.initial_peers.join(",")}`),t!=null&&t.output_folder&&(n+=`&output_folder=${t.output_folder}`),typeof e=="string"&&(n+="&is_url=true"),Ze("POST",n,e)},pause:e=>Ze("POST",`/torrents/${e}/pause`),start:e=>Ze("POST",`/torrents/${e}/start`),forget:e=>Ze("POST",`/torrents/${e}/forget`),delete:e=>Ze("POST",`/torrents/${e}/delete`),getVersion:async()=>(await Ze("GET","/")).version},Ch=()=>{let[e,t]=x.useState("rqbit web UI");return x.useEffect(()=>ku(()=>Ys.getVersion().then(r=>{const l=`rqbit web UI - v${r}`;return t(l),document.title=l,1e4},r=>1e3),0),[]),c.jsx(Nt.Provider,{value:Ys,children:c.jsx(Eh,{title:e})})};Po.createRoot(document.getElementById("app")).render(c.jsx(x.StrictMode,{children:c.jsx(Ch,{})})); diff --git a/crates/librqbit/webui/dist/manifest.json b/crates/librqbit/webui/dist/manifest.json index 3d1ad630..aeeac282 100644 --- a/crates/librqbit/webui/dist/manifest.json +++ b/crates/librqbit/webui/dist/manifest.json @@ -11,7 +11,7 @@ "css": [ "assets/index-d46108e9.css" ], - "file": "assets/index-c93d50ee.js", + "file": "assets/index-e6c23bc1.js", "isEntry": true, "src": "index.html" } diff --git a/crates/librqbit/webui/node_modules/.package-lock.json b/crates/librqbit/webui/node_modules/.package-lock.json index f42c95c4..0080b763 100644 --- a/crates/librqbit/webui/node_modules/.package-lock.json +++ b/crates/librqbit/webui/node_modules/.package-lock.json @@ -836,13 +836,13 @@ "version": "15.7.11", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==", - "dev": true + "devOptional": true }, "node_modules/@types/react": { "version": "18.2.42", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.42.tgz", "integrity": "sha512-c1zEr96MjakLYus/wPnuWDo1/zErfdU9rNsIGmE+NV71nx88FG9Ttgo5dqorXTu/LImX2f63WBP986gJkMPNbA==", - "dev": true, + "devOptional": true, "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -862,7 +862,7 @@ "version": "0.16.8", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==", - "dev": true + "devOptional": true }, "node_modules/@types/warning": { "version": "3.0.3", @@ -2485,6 +2485,14 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -2588,6 +2596,33 @@ "engines": { "node": ">= 14" } + }, + "node_modules/zustand": { + "version": "4.4.7", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.4.7.tgz", + "integrity": "sha512-QFJWJMdlETcI69paJwhSMJz7PPWjVP8Sjhclxmxmxv/RYI7ZOvR5BHX+ktH0we9gTWQMxcne8q1OY8xxz604gw==", + "dependencies": { + "use-sync-external-store": "1.2.0" + }, + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@types/react": ">=16.8", + "immer": ">=9.0", + "react": ">=16.8" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + } + } } } } diff --git a/crates/librqbit/webui/package-lock.json b/crates/librqbit/webui/package-lock.json index 95a5057d..188e3fa3 100644 --- a/crates/librqbit/webui/package-lock.json +++ b/crates/librqbit/webui/package-lock.json @@ -10,7 +10,8 @@ "lodash.debounce": "^4.0.8", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-icons": "^4.12.0" + "react-icons": "^4.12.0", + "zustand": "^4.4.7" }, "devDependencies": { "@types/lodash.debounce": "^4.0.9", @@ -1195,13 +1196,13 @@ "version": "15.7.11", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==", - "dev": true + "devOptional": true }, "node_modules/@types/react": { "version": "18.2.42", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.42.tgz", "integrity": "sha512-c1zEr96MjakLYus/wPnuWDo1/zErfdU9rNsIGmE+NV71nx88FG9Ttgo5dqorXTu/LImX2f63WBP986gJkMPNbA==", - "dev": true, + "devOptional": true, "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -1221,7 +1222,7 @@ "version": "0.16.8", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==", - "dev": true + "devOptional": true }, "node_modules/@types/warning": { "version": "3.0.3", @@ -2844,6 +2845,14 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -2947,6 +2956,33 @@ "engines": { "node": ">= 14" } + }, + "node_modules/zustand": { + "version": "4.4.7", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.4.7.tgz", + "integrity": "sha512-QFJWJMdlETcI69paJwhSMJz7PPWjVP8Sjhclxmxmxv/RYI7ZOvR5BHX+ktH0we9gTWQMxcne8q1OY8xxz604gw==", + "dependencies": { + "use-sync-external-store": "1.2.0" + }, + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@types/react": ">=16.8", + "immer": ">=9.0", + "react": ">=16.8" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + } + } } } } diff --git a/crates/librqbit/webui/package.json b/crates/librqbit/webui/package.json index 5a2dab31..280b2b6d 100644 --- a/crates/librqbit/webui/package.json +++ b/crates/librqbit/webui/package.json @@ -12,7 +12,8 @@ "lodash.debounce": "^4.0.8", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-icons": "^4.12.0" + "react-icons": "^4.12.0", + "zustand": "^4.4.7" }, "devDependencies": { "@types/lodash.debounce": "^4.0.9", diff --git a/crates/librqbit/webui/src/components/RootContent.tsx b/crates/librqbit/webui/src/components/RootContent.tsx index 51769626..f1387e41 100644 --- a/crates/librqbit/webui/src/components/RootContent.tsx +++ b/crates/librqbit/webui/src/components/RootContent.tsx @@ -1,24 +1,25 @@ -import { useContext } from "react"; -import { TorrentId, ErrorDetails as ApiErrorDetails } from "../api-types"; -import { AppContext } from "../context"; import { TorrentsList } from "./TorrentsList"; import { ErrorComponent } from "./ErrorComponent"; +import { useTorrentStore } from "../stores/torrentStore"; +import { useErrorStore } from "../stores/errorStore"; + +export const RootContent = (props: {}) => { + let closeableError = useErrorStore((state) => state.closeableError); + let setCloseableError = useErrorStore((state) => state.setCloseableError); + let otherError = useErrorStore((state) => state.otherError); + let torrents = useTorrentStore((state) => state.torrents); + let torrentsInitiallyLoading = useTorrentStore( + (state) => state.torrentsInitiallyLoading + ); -export const RootContent = (props: { - closeableError: ApiErrorDetails | null; - otherError: ApiErrorDetails | null; - torrents: Array | null; - torrentsLoading: boolean; -}) => { - let ctx = useContext(AppContext); return (
ctx.setCloseableError(null)} + error={closeableError} + remove={() => setCloseableError(null)} /> - - + +
); }; diff --git a/crates/librqbit/webui/src/components/buttons/TorrentActions.tsx b/crates/librqbit/webui/src/components/buttons/TorrentActions.tsx index 4fbac0cb..a6ea9da2 100644 --- a/crates/librqbit/webui/src/components/buttons/TorrentActions.tsx +++ b/crates/librqbit/webui/src/components/buttons/TorrentActions.tsx @@ -1,13 +1,10 @@ import { useContext, useState } from "react"; import { TorrentStats } from "../../api-types"; -import { - AppContext, - APIContext, - RefreshTorrentStatsContext, -} from "../../context"; +import { APIContext, RefreshTorrentStatsContext } from "../../context"; import { IconButton } from "./IconButton"; import { DeleteTorrentModal } from "../modal/DeleteTorrentModal"; import { FaPause, FaPlay, FaTrash } from "react-icons/fa"; +import { useErrorStore } from "../../stores/errorStore"; export const TorrentActions: React.FC<{ id: number; @@ -23,7 +20,8 @@ export const TorrentActions: React.FC<{ const canPause = state == "live"; const canUnpause = state == "paused" || state == "error"; - const ctx = useContext(AppContext); + const setCloseableError = useErrorStore((state) => state.setCloseableError); + const API = useContext(APIContext); const unpause = () => { @@ -34,7 +32,7 @@ export const TorrentActions: React.FC<{ refreshCtx.refresh(); }, (e) => { - ctx.setCloseableError({ + setCloseableError({ text: `Error starting torrent id=${id}`, details: e, }); @@ -51,7 +49,7 @@ export const TorrentActions: React.FC<{ refreshCtx.refresh(); }, (e) => { - ctx.setCloseableError({ + setCloseableError({ text: `Error pausing torrent id=${id}`, details: e, }); diff --git a/crates/librqbit/webui/src/components/modal/DeleteTorrentModal.tsx b/crates/librqbit/webui/src/components/modal/DeleteTorrentModal.tsx index 1338c417..39d691cb 100644 --- a/crates/librqbit/webui/src/components/modal/DeleteTorrentModal.tsx +++ b/crates/librqbit/webui/src/components/modal/DeleteTorrentModal.tsx @@ -1,5 +1,5 @@ import { useContext, useState } from "react"; -import { AppContext, APIContext } from "../../context"; +import { APIContext } from "../../context"; import { ErrorWithLabel } from "../../rqbit-web"; import { ErrorComponent } from "../ErrorComponent"; import { Spinner } from "../Spinner"; @@ -7,6 +7,7 @@ import { Modal } from "./Modal"; import { ModalBody } from "./ModalBody"; import { ModalFooter } from "./ModalFooter"; import { Button } from "../buttons/Button"; +import { useTorrentStore } from "../../stores/torrentStore"; export const DeleteTorrentModal: React.FC<{ id: number; @@ -20,8 +21,8 @@ export const DeleteTorrentModal: React.FC<{ const [error, setError] = useState(null); const [deleting, setDeleting] = useState(false); - const ctx = useContext(AppContext); const API = useContext(APIContext); + const refreshTorrents = useTorrentStore((state) => state.refreshTorrents); const close = () => { setDeleteFiles(false); @@ -37,7 +38,7 @@ export const DeleteTorrentModal: React.FC<{ call(id) .then(() => { - ctx.refreshTorrents(); + refreshTorrents(); close(); }) .catch((e) => { diff --git a/crates/librqbit/webui/src/components/modal/FileSelectionModal.tsx b/crates/librqbit/webui/src/components/modal/FileSelectionModal.tsx index 0daca7ac..2a339fbf 100644 --- a/crates/librqbit/webui/src/components/modal/FileSelectionModal.tsx +++ b/crates/librqbit/webui/src/components/modal/FileSelectionModal.tsx @@ -1,19 +1,18 @@ -import { useCallback, useContext, useEffect, useState } from "react"; +import { useContext, useEffect, useState } from "react"; import { AddTorrentResponse, AddTorrentOptions } from "../../api-types"; -import { AppContext, APIContext } from "../../context"; +import { APIContext } from "../../context"; import { ErrorComponent } from "../ErrorComponent"; -import { formatBytes } from "../../helper/formatBytes"; import { ErrorWithLabel } from "../../rqbit-web"; import { Spinner } from "../Spinner"; import { Modal } from "./Modal"; import { ModalBody } from "./ModalBody"; import { ModalFooter } from "./ModalFooter"; import { Button } from "../buttons/Button"; -import { FormCheckbox } from "../forms/FormCheckbox"; import { Fieldset } from "../forms/Fieldset"; import { FormInput } from "../forms/FormInput"; import { Form } from "../forms/Form"; import { FileListInput } from "../FileListInput"; +import { useTorrentStore } from "../../stores/torrentStore"; export const FileSelectionModal = (props: { onHide: () => void; @@ -35,11 +34,10 @@ export const FileSelectionModal = (props: { const [uploadError, setUploadError] = useState(null); const [unpopularTorrent, setUnpopularTorrent] = useState(false); const [outputFolder, setOutputFolder] = useState(""); - const ctx = useContext(AppContext); + const refreshTorrents = useTorrentStore((state) => state.refreshTorrents); const API = useContext(APIContext); useEffect(() => { - console.log(listTorrentResponse); setSelectedFiles( new Set(listTorrentResponse?.details.files.map((_, i) => i)) ); @@ -77,7 +75,7 @@ export const FileSelectionModal = (props: { .then( () => { onHide(); - ctx.refreshTorrents(); + refreshTorrents(); }, (e) => { setUploadError({ text: "Error starting torrent", details: e }); diff --git a/crates/librqbit/webui/src/context.tsx b/crates/librqbit/webui/src/context.tsx index 10d33f63..d021f45b 100644 --- a/crates/librqbit/webui/src/context.tsx +++ b/crates/librqbit/webui/src/context.tsx @@ -31,8 +31,4 @@ export const APIContext = createContext({ return null; }, }); -export const AppContext = createContext({ - setCloseableError: (_) => {}, - refreshTorrents: () => {}, -}); export const RefreshTorrentStatsContext = createContext({ refresh: () => {} }); diff --git a/crates/librqbit/webui/src/main.tsx b/crates/librqbit/webui/src/main.tsx index 8d54c4f3..2ef734b7 100644 --- a/crates/librqbit/webui/src/main.tsx +++ b/crates/librqbit/webui/src/main.tsx @@ -25,14 +25,14 @@ const RootWithVersion = () => { }, []); return ( - - - - - + + + ); }; ReactDOM.createRoot(document.getElementById("app") as HTMLInputElement).render( - + + + ); diff --git a/crates/librqbit/webui/src/rqbit-web.tsx b/crates/librqbit/webui/src/rqbit-web.tsx index a8743c1a..88bdd79a 100644 --- a/crates/librqbit/webui/src/rqbit-web.tsx +++ b/crates/librqbit/webui/src/rqbit-web.tsx @@ -1,6 +1,6 @@ import { useContext, useEffect, useState } from "react"; -import { TorrentId, ErrorDetails as ApiErrorDetails } from "./api-types"; -import { AppContext, APIContext } from "./context"; +import { ErrorDetails as ApiErrorDetails } from "./api-types"; +import { APIContext } from "./context"; import { RootContent } from "./components/RootContent"; import { customSetInterval } from "./helper/customSetInterval"; import { IconButton } from "./components/buttons/IconButton"; @@ -8,6 +8,8 @@ import { BsBodyText, BsMoon } from "react-icons/bs"; import { LogStreamModal } from "./components/modal/LogStreamModal"; import { Header } from "./components/Header"; import { DarkMode } from "./helper/darkMode"; +import { useTorrentStore } from "./stores/torrentStore"; +import { useErrorStore } from "./stores/errorStore"; export interface ErrorWithLabel { text: string; @@ -23,17 +25,20 @@ export const RqbitWebUI = (props: { title: string; menuButtons?: JSX.Element[]; }) => { - const [closeableError, setCloseableError] = useState( - null - ); - const [otherError, setOtherError] = useState(null); - - const [torrents, setTorrents] = useState | null>(null); - const [torrentsLoading, setTorrentsLoading] = useState(false); let [logsOpened, setLogsOpened] = useState(false); + const setCloseableError = useErrorStore((state) => state.setCloseableError); + const setOtherError = useErrorStore((state) => state.setOtherError); const API = useContext(APIContext); + const setTorrents = useTorrentStore((state) => state.setTorrents); + const setTorrentsLoading = useTorrentStore( + (state) => state.setTorrentsLoading + ); + const setRefreshTorrents = useTorrentStore( + (state) => state.setRefreshTorrents + ); + const refreshTorrents = async () => { setTorrentsLoading(true); let torrents = await API.listTorrents().finally(() => @@ -41,6 +46,7 @@ export const RqbitWebUI = (props: { ); setTorrents(torrents.torrents); }; + setRefreshTorrents(refreshTorrents); useEffect(() => { return customSetInterval( @@ -66,35 +72,25 @@ export const RqbitWebUI = (props: { }; return ( - -
-
-
- {/* Menu buttons */} -
- {props.menuButtons && - props.menuButtons.map((b, i) => {b})} - setLogsOpened(true)}> - - - - - -
- - +
+
+
+ {/* Menu buttons */} +
+ {props.menuButtons && + props.menuButtons.map((b, i) => {b})} + setLogsOpened(true)}> + + + + +
- setLogsOpened(false)} - /> +
- + + setLogsOpened(false)} /> +
); }; diff --git a/crates/librqbit/webui/src/stores/errorStore.ts b/crates/librqbit/webui/src/stores/errorStore.ts new file mode 100644 index 00000000..648be2fc --- /dev/null +++ b/crates/librqbit/webui/src/stores/errorStore.ts @@ -0,0 +1,21 @@ +import { create } from "zustand"; +import { ErrorDetails } from "../api-types"; + +export interface ErrorWithLabel { + text: string; + details?: ErrorDetails; +} + +export const useErrorStore = create<{ + closeableError: ErrorWithLabel | null; + setCloseableError: (error: ErrorWithLabel | null) => void; + + otherError: ErrorWithLabel | null; + setOtherError: (error: ErrorWithLabel | null) => void; +}>((set) => ({ + closeableError: null, + setCloseableError: (closeableError) => set(() => ({ closeableError })), + + otherError: null, + setOtherError: (otherError) => set(() => ({ otherError })), +})); diff --git a/crates/librqbit/webui/src/stores/torrentStore.ts b/crates/librqbit/webui/src/stores/torrentStore.ts new file mode 100644 index 00000000..0fd9a712 --- /dev/null +++ b/crates/librqbit/webui/src/stores/torrentStore.ts @@ -0,0 +1,54 @@ +import { create } from "zustand"; +import { TorrentId } from "../api-types"; + +export interface TorrentStore { + torrents: Array | null; + setTorrents: (torrents: Array) => void; + + torrentsInitiallyLoading: boolean; + torrentsLoading: boolean; + setTorrentsLoading: (loading: boolean) => void; + + refreshTorrents: () => void; + setRefreshTorrents: (callback: () => void) => void; +} + +const torrentIdEquals = (t1: TorrentId, t2: TorrentId): boolean => { + return t1.id == t2.id && t1.info_hash == t2.info_hash; +}; + +const torrentsEquals = (t1: TorrentId[] | null, t2: TorrentId[] | null) => { + if (t1 === null && t2 === null) { + return true; + } + + if (t1 === null || t2 === null) { + return false; + } + + return ( + t1.length === t2.length && t1.every((t, i) => torrentIdEquals(t, t2[i])) + ); +}; + +export const useTorrentStore = create((set) => ({ + torrents: null, + torrentsLoading: false, + torrentsInitiallyLoading: false, + setTorrentsLoading: (loading: boolean) => + set((prev) => { + if (prev.torrents == null) { + return { torrentsInitiallyLoading: loading, torrentsLoading: loading }; + } + return { torrentsInitiallyLoading: false, torrentsLoading: loading }; + }), + setTorrents: (torrents) => + set((prev) => { + if (torrentsEquals(prev.torrents, torrents)) { + return {}; + } + return { torrents }; + }), + refreshTorrents: () => {}, + setRefreshTorrents: (callback) => set({ refreshTorrents: callback }), +})); diff --git a/desktop/package-lock.json b/desktop/package-lock.json index 3c53e409..40c26b77 100644 --- a/desktop/package-lock.json +++ b/desktop/package-lock.json @@ -34,7 +34,8 @@ "lodash.debounce": "^4.0.8", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-icons": "^4.12.0" + "react-icons": "^4.12.0", + "zustand": "^4.4.7" }, "devDependencies": { "@types/lodash.debounce": "^4.0.9", diff --git a/desktop/src-tauri/Cargo.lock b/desktop/src-tauri/Cargo.lock index 61a19413..a954ff64 100644 --- a/desktop/src-tauri/Cargo.lock +++ b/desktop/src-tauri/Cargo.lock @@ -1867,7 +1867,7 @@ dependencies = [ [[package]] name = "librqbit" -version = "5.3.0" +version = "5.4.0" dependencies = [ "anyhow", "axum", @@ -1894,6 +1894,7 @@ dependencies = [ "rand 0.8.5", "regex", "reqwest", + "rlimit", "serde", "serde_json", "serde_urlencoded", @@ -3010,9 +3011,18 @@ dependencies = [ "winreg 0.50.0", ] +[[package]] +name = "rlimit" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3560f70f30a0f16d11d01ed078a07740fe6b489667abc7c7b029155d9f21c3d8" +dependencies = [ + "libc", +] + [[package]] name = "rqbit-desktop" -version = "5.3.0" +version = "5.4.0" dependencies = [ "anyhow", "base64 0.21.5",