(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 jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qs={exports:{}},Nl={},bs={exports:{}},O={};/** * @license React * react.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 mr=Symbol.for("react.element"),Md=Symbol.for("react.portal"),Od=Symbol.for("react.fragment"),Fd=Symbol.for("react.strict_mode"),Id=Symbol.for("react.profiler"),Dd=Symbol.for("react.provider"),Rd=Symbol.for("react.context"),$d=Symbol.for("react.forward_ref"),Ad=Symbol.for("react.suspense"),Ud=Symbol.for("react.memo"),Bd=Symbol.for("react.lazy"),Tu=Symbol.iterator;function Vd(e){return e===null||typeof e!="object"?null:(e=Tu&&e[Tu]||e["@@iterator"],typeof e=="function"?e:null)}var ea={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ta=Object.assign,na={};function _n(e,t,n){this.props=e,this.context=t,this.refs=na,this.updater=n||ea}_n.prototype.isReactComponent={};_n.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")};_n.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ra(){}ra.prototype=_n.prototype;function _i(e,t,n){this.props=e,this.context=t,this.refs=na,this.updater=n||ea}var Ni=_i.prototype=new ra;Ni.constructor=_i;ta(Ni,_n.prototype);Ni.isPureReactComponent=!0;var Lu=Array.isArray,la=Object.prototype.hasOwnProperty,Ti={current:null},oa={key:!0,ref:!0,__self:!0,__source:!0};function ia(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)la.call(t,r)&&!oa.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,Z=j[$];if(0>>1;$l(zt,z))Kel(Yt,zt)?(j[$]=Yt,j[Ke]=z,$=Ke):(j[$]=zt,j[$e]=z,$=$e);else if(Kel(Yt,z))j[$]=Yt,j[Ke]=z,$=Ke;else break e}}return L}function l(j,L){var z=j.sortIndex-L.sortIndex;return z!==0?z:j.id-L.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,m=null,f=3,g=!1,y=!1,S=!1,P=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 h(j){for(var L=n(a);L!==null;){if(L.callback===null)r(a);else if(L.startTime<=j)r(a),L.sortIndex=L.expirationTime,t(s,L);else break;L=n(a)}}function w(j){if(S=!1,h(j),!y)if(n(s)!==null)y=!0,Re(C);else{var L=n(a);L!==null&&it(w,L.startTime-j)}}function C(j,L){y=!1,S&&(S=!1,p(T),T=-1),g=!0;var z=f;try{for(h(L),m=n(s);m!==null&&(!(m.expirationTime>L)||j&&!ge());){var $=m.callback;if(typeof $=="function"){m.callback=null,f=m.priorityLevel;var Z=$(m.expirationTime<=L);L=e.unstable_now(),typeof Z=="function"?m.callback=Z:m===n(s)&&r(s),h(L)}else r(s);m=n(s)}if(m!==null)var Ze=!0;else{var $e=n(a);$e!==null&&it(w,$e.startTime-L),Ze=!1}return Ze}finally{m=null,f=z,g=!1}}var E=!1,_=null,T=-1,D=5,M=-1;function ge(){return!(e.unstable_now()-Mj||125$?(j.sortIndex=z,t(a,j),n(s)===null&&j===n(a)&&(S?(p(T),T=-1):S=!0,it(w,z-$))):(j.sortIndex=Z,t(s,j),y||g||(y=!0,Re(C))),j},e.unstable_shouldYield=ge,e.unstable_wrapCallback=function(j){var L=f;return function(){var z=f;f=L;try{return j.apply(this,arguments)}finally{f=z}}}})(ca);aa.exports=ca;var bd=aa.exports;/** * @license React * react-dom.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 da=x,Se=bd;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"),zo=Object.prototype.hasOwnProperty,ef=/^[: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]*$/,zu={},Mu={};function tf(e){return zo.call(Mu,e)?!0:zo.call(zu,e)?!1:ef.test(e)?Mu[e]=!0:(zu[e]=!0,!1)}function nf(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 rf(e,t,n,r){if(t===null||typeof t>"u"||nf(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{bl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Rn(e):""}function lf(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 Io(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 bt:return"Fragment";case qt:return"Portal";case Mo:return"Profiler";case Oi:return"StrictMode";case Oo:return"Suspense";case Fo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ha:return(e.displayName||"Context")+".Consumer";case pa:return(e._context.displayName||"Context")+".Provider";case Fi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ii:return t=e.displayName||null,t!==null?t:Io(e.type)||"Memo";case st:t=e._payload,e=e._init;try{return Io(e(t))}catch{}}return null}function of(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 Io(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 Et(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function va(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function uf(e){var t=va(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 Tr(e){e._valueTracker||(e._valueTracker=uf(e))}function ga(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=va(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function nl(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 Fu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Et(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 ya(e,t){t=t.checked,t!=null&&Mi(e,"checked",t,!1)}function Ro(e,t){ya(e,t);var n=Et(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,Et(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"||nl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var $n=Array.isArray;function dn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Lr.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},sf=["Webkit","ms","Moz","O"];Object.keys(Bn).forEach(function(e){sf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Bn[t]=Bn[e]})});function ka(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 Ea(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=ka(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var af=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(af[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,fn=null,pn=null;function $u(e){if(e=yr(e)){if(typeof Wo!="function")throw Error(k(280));var t=e.stateNode;t&&(t=Ml(t),Wo(e.stateNode,e.type,t))}}function Ca(e){fn?pn?pn.push(e):pn=[e]:fn=e}function ja(){if(fn){var e=fn,t=pn;if(pn=fn=null,$u(e),t)for(e=0;e>>=0,e===0?32:31-(wf(e)/Sf|0)|0}var Pr=64,zr=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 il(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 vr(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 jf(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),Ku=String.fromCharCode(32),Gu=!1;function Qa(e,t){switch(e){case"keyup":return bf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Za(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var en=!1;function t0(e,t){switch(e){case"compositionend":return Za(t);case"keypress":return t.which!==32?null:(Gu=!0,Ku);case"textInput":return e=t.data,e===Ku&&Gu?null:e;default:return null}}function n0(e,t){if(en)return e==="compositionend"||!Wi&&Qa(e,t)?(e=Ha(),Kr=Bi=ft=null,en=!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=qu(n)}}function Xa(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Xa(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ja(){for(var e=window,t=nl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=nl(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 d0(e){var t=Ja(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Xa(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=bu(n,o);var i=bu(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,tn=null,Xo=null,Qn=null,Jo=!1;function es(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jo||tn==null||tn!==nl(r)||(r=tn,"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=al(Xo,"onSelect"),0ln||(e.current=ri[ln],ri[ln]=null,ln--)}function R(e,t){ln++,ri[ln]=e.current,e.current=t}var Ct={},ue=Nt(Ct),he=Nt(!1),Vt=Ct;function xn(e,t){var n=e.type.contextTypes;if(!n)return Ct;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 dl(){U(he),U(ue)}function us(e,t,n){if(ue.current!==Ct)throw Error(k(168));R(ue,t),R(he,n)}function ic(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,of(e)||"Unknown",l));return W({},n,r)}function fl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ct,Vt=ue.current,R(ue,e),R(he,he.current),!0}function ss(e,t,n){var r=e.stateNode;if(!r)throw Error(k(169));n?(e=ic(e,t,Vt),r.__reactInternalMemoizedMergedChildContext=e,U(he),U(ue),R(ue,e)):U(he),R(he,n)}var Ye=null,Ol=!1,mo=!1;function uc(e){Ye===null?Ye=[e]:Ye.push(e)}function E0(e){Ol=!0,uc(e)}function Tt(){if(!mo&&Ye!==null){mo=!0;var e=0,t=I;try{var n=Ye;for(I=1;e>=i,l-=i,Xe=1<<32-Fe(t)+l|n<T?(D=_,_=null):D=_.sibling;var M=f(p,_,h[T],w);if(M===null){_===null&&(_=D);break}e&&_&&M.alternate===null&&t(p,_),d=o(M,d,T),E===null?C=M:E.sibling=M,E=M,_=D}if(T===h.length)return n(p,_),B&&Mt(p,T),C;if(_===null){for(;TT?(D=_,_=null):D=_.sibling;var ge=f(p,_,M.value,w);if(ge===null){_===null&&(_=D);break}e&&_&&ge.alternate===null&&t(p,_),d=o(ge,d,T),E===null?C=ge:E.sibling=ge,E=ge,_=D}if(M.done)return n(p,_),B&&Mt(p,T),C;if(_===null){for(;!M.done;T++,M=h.next())M=m(p,M.value,w),M!==null&&(d=o(M,d,T),E===null?C=M:E.sibling=M,E=M);return B&&Mt(p,T),C}for(_=r(p,_);!M.done;T++,M=h.next())M=g(_,p,T,M.value,w),M!==null&&(e&&M.alternate!==null&&_.delete(M.key===null?T:M.key),d=o(M,d,T),E===null?C=M:E.sibling=M,E=M);return e&&_.forEach(function(Lt){return t(p,Lt)}),B&&Mt(p,T),C}function P(p,d,h,w){if(typeof h=="object"&&h!==null&&h.type===bt&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case Nr:e:{for(var C=h.key,E=d;E!==null;){if(E.key===C){if(C=h.type,C===bt){if(E.tag===7){n(p,E.sibling),d=l(E,h.props.children),d.return=p,p=d;break e}}else if(E.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===st&&ms(C)===E.type){n(p,E.sibling),d=l(E,h.props),d.ref=Fn(p,E,h),d.return=p,p=d;break e}n(p,E);break}else t(p,E);E=E.sibling}h.type===bt?(d=Ut(h.props.children,p.mode,w,h.key),d.return=p,p=d):(w=tl(h.type,h.key,h.props,null,p.mode,w),w.ref=Fn(p,d,h),w.return=p,p=w)}return i(p);case qt:e:{for(E=h.key;d!==null;){if(d.key===E)if(d.tag===4&&d.stateNode.containerInfo===h.containerInfo&&d.stateNode.implementation===h.implementation){n(p,d.sibling),d=l(d,h.children||[]),d.return=p,p=d;break e}else{n(p,d);break}else t(p,d);d=d.sibling}d=Eo(h,p.mode,w),d.return=p,p=d}return i(p);case st:return E=h._init,P(p,d,E(h._payload),w)}if($n(h))return y(p,d,h,w);if(Ln(h))return S(p,d,h,w);$r(p,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,d!==null&&d.tag===6?(n(p,d.sibling),d=l(d,h),d.return=p,p=d):(n(p,d),d=ko(h,p.mode,w),d.return=p,p=d),i(p)):n(p,d)}return P}var Sn=mc(!0),vc=mc(!1),xr={},We=Nt(xr),ur=Nt(xr),sr=Nt(xr);function Rt(e){if(e===xr)throw Error(k(174));return e}function eu(e,t){switch(R(sr,t),R(ur,e),R(We,xr),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(We),R(We,t)}function kn(){U(We),U(ur),U(sr)}function gc(e){Rt(sr.current);var t=Rt(We.current),n=Uo(t,e.type);t!==n&&(R(ur,e),R(We,n))}function tu(e){ur.current===e&&(U(We),U(ur))}var V=Nt(0);function yl(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{I=n,go.transition=r}}function Oc(){return Le().memoizedState}function N0(e,t,n){var r=wt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Fc(e))Ic(t,n);else if(n=dc(e,t,n,r),n!==null){var l=ae();Ie(n,e,r,l),Dc(n,t,r)}}function T0(e,t,n){var r=wt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fc(e))Ic(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=dc(e,t,l,r),n!==null&&(l=ae(),Ie(n,e,r,l),Dc(n,t,r))}}function Fc(e){var t=e.alternate;return e===H||t!==null&&t===H}function Ic(e,t){Zn=xl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Dc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$i(e,n)}}var wl={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},L0={readContext:Te,useCallback:function(e,t){return Be().memoizedState=[e,t===void 0?null:t],e},useContext:Te,useEffect:gs,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Jr(4194308,4,Tc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Jr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Jr(4,2,e,t)},useMemo:function(e,t){var n=Be();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Be();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=N0.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Be();return e={current:e},t.memoizedState=e},useState:vs,useDebugValue:uu,useDeferredValue:function(e){return Be().memoizedState=e},useTransition:function(){var e=vs(!1),t=e[0];return e=_0.bind(null,e[1]),Be().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Be();if(B){if(n===void 0)throw Error(k(407));n=n()}else{if(n=t(),ee===null)throw Error(k(349));Wt&30||wc(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,gs(kc.bind(null,r,o,e),[e]),r.flags|=2048,dr(9,Sc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Be(),t=ee.identifierPrefix;if(B){var n=Je,r=Xe;n=(r&~(1<<32-Fe(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[Ve]=t,e[ir]=r,Qc(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,In(o,!1),t.lanes=4194304)}else{if(!r)if(e=yl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),In(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,In(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 R0(e,t){switch(Ki(t),t.tag){case 1:return me(t.type)&&dl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kn(),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 kn(),null;case 10:return Ji(t.type._context),null;case 22:case 23:return pu(),null;case 24:return null;default:return null}}var Ur=!1,ie=!1,$0=typeof WeakSet=="function"?WeakSet:Set,N=null;function an(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 A0(e,t){if(qo=ul,e=Ja(),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,m=e,f=null;t:for(;;){for(var g;m!==n||l!==0&&m.nodeType!==3||(u=i+l),m!==o||r!==0&&m.nodeType!==3||(s=i+r),m.nodeType===3&&(i+=m.nodeValue.length),(g=m.firstChild)!==null;)f=m,m=g;for(;;){if(m===e)break t;if(f===n&&++a===l&&(u=i),f===o&&++v===r&&(s=i),(g=m.nextSibling)!==null)break;m=f,f=m.parentNode}m=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},ul=!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,P=y.memoizedState,p=t.stateNode,d=p.getSnapshotBeforeUpdate(t.elementType===t.type?S:ze(t.type,S),P);p.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.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 Dl(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 Gc(e){var t=e.alternate;t!==null&&(e.alternate=null,Gc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ve],delete t[ir],delete t[ni],delete t[S0],delete t[k0])),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 Yc(e){return e.tag===5||e.tag===3||e.tag===4}function Ns(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(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=cl));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 ut(e,t,n){for(n=n.child;n!==null;)Xc(e,t,n),n=n.sibling}function Xc(e,t,n){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(Tl,n)}catch{}switch(n.tag){case 5:ie||an(n,t);case 6:var r=te,l=Me;te=null,ut(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,ut(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)}ut(e,t,n);break;case 1:if(!ie&&(an(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)}ut(e,t,n);break;case 21:ut(e,t,n);break;case 22:n.mode&1?(ie=(r=ie)||n.memoizedState!==null,ut(e,t,n),ie=r):ut(e,t,n);break;default:ut(e,t,n)}}function Ts(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=G0.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*B0(r/1960))-r,10e?16:e,pt===null)var r=!1;else{if(e=pt,pt=null,El=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()-du?At(e,0):cu|=n),ve(e,t)}function ld(e,t){t===0&&(e.mode&1?(t=zr,zr<<=1,!(zr&130023424)&&(zr=4194304)):t=1);var n=ae();e=nt(e,t),e!==null&&(vr(e,t,n),ve(e,n))}function K0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ld(e,n)}function G0(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),ld(e,n)}var od;od=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,I0(e,t,n);pe=!!(e.flags&131072)}else pe=!1,B&&t.flags&1048576&&sc(t,hl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;qr(e,t),e=t.pendingProps;var l=xn(t,ue.current);mn(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,fl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,bi(t),l.updater=Fl,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(qr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=X0(r),e=ze(r,e),l){case 0:t=ci(null,t,r,e,n);break e;case 1:t=Es(null,t,r,e,n);break e;case 11:t=Ss(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),Es(e,t,r,l,n);case 3:e:{if(Vc(t),e===null)throw Error(k(387));r=t.pendingProps,o=t.memoizedState,l=o.element,fc(e,t),gl(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=Cs(e,t,r,n,l);break e}else if(r!==l){l=En(Error(k(424)),t),t=Cs(e,t,r,n,l);break e}else for(xe=gt(t.stateNode.containerInfo.firstChild),we=t,B=!0,Oe=null,n=vc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wn(),r===l){t=rt(e,t,n);break e}se(e,t,r,n)}t=t.child}return t;case 5:return gc(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),Bc(e,t),se(e,t,i,n),t.child;case 6:return e===null&&oi(t),null;case 13:return Hc(e,t,n);case 4:return eu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Sn(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),Ss(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(ml,r._currentValue),r._currentValue=i,o!==null)if(De(o.value,i)){if(o.children===l.children&&!he.current){t=rt(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=be(-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,mn(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 Ac(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),qr(e,t),t.tag=1,me(r)?(e=!0,fl(t)):e=!1,mn(t,n),hc(t,r,l),si(t,r,l,n),di(null,t,r,!0,e,n);case 19:return Wc(e,t,n);case 22:return Uc(e,t,n)}throw Error(k(156,t.tag))};function id(e,t){return Ma(e,t)}function Y0(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 _e(e,t,n,r){return new Y0(e,t,n,r)}function mu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function X0(e){if(typeof e=="function")return mu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Fi)return 11;if(e===Ii)return 14}return 2}function St(e,t){var n=e.alternate;return n===null?(n=_e(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 tl(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 bt:return Ut(n.children,l,o,t);case Oi:i=8,l|=8;break;case Mo:return e=_e(12,n,t,l|2),e.elementType=Mo,e.lanes=o,e;case Oo:return e=_e(13,n,t,l),e.elementType=Oo,e.lanes=o,e;case Fo:return e=_e(19,n,t,l),e.elementType=Fo,e.lanes=o,e;case ma:return $l(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pa:i=10;break e;case ha:i=9;break e;case Fi:i=11;break e;case Ii:i=14;break e;case st:i=16,r=null;break e}throw Error(k(130,e==null?e:typeof e,""))}return t=_e(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Ut(e,t,n,r){return e=_e(7,e,r,t),e.lanes=n,e}function $l(e,t,n,r){return e=_e(22,e,r,t),e.elementType=ma,e.lanes=n,e.stateNode={isHidden:!1},e}function ko(e,t,n){return e=_e(6,e,null,t),e.lanes=n,e}function Eo(e,t,n){return t=_e(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function J0(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 J0(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=_e(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 q0(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(cd)}catch(e){console.error(e)}}cd(),sa.exports=ke;var dd=sa.exports;const r1=_l(dd);var Ds=dd;Po.createRoot=Ds.createRoot,Po.hydrateRoot=Ds.hydrateRoot;const ot=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.")},updateOnlyFiles:()=>{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}),wu=x.createContext({refresh:()=>{}}),pr=({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..."})]}),Su="initializing",l1="paused",o1="live",i1="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 fd(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 pd={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Rs=qe.createContext&&qe.createContext(pd),kt=globalThis&&globalThis.__assign||function(){return kt=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 f1(e){return q({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 p1(e){return q({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 md(e){return q({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 h1=({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(md,{})})]}),t]}),jt=e=>{var r,l,o;let{error:t,remove:n}=e;return t==null?null:c.jsxs(h1,{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 Eu(e){return e&&e.ownerDocument||document}function Co(e){e===void 0&&(e=Eu());try{var t=e.activeElement;return!t||!t.nodeName?null:t}catch{return e.body}}function $s(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}const Hl=!!(typeof window<"u"&&window.document&&window.document.createElement);var Ei=!1,Ci=!1;try{var jo={get passive(){return Ei=!0},get once(){return Ci=Ei=!0}};Hl&&(window.addEventListener("test",jo,jo),window.removeEventListener("test",jo,!0))}catch{}function m1(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 v1(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 As(e,t,n,r){return m1(e,t,n,r),function(){v1(e,t,n,r)}}function g1(){const e=x.useRef(!0),t=x.useRef(()=>e.current);return x.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),t.current}function y1(e){const t=x.useRef(e);return t.current=e,t}function x1(e){const t=y1(e);x.useEffect(()=>()=>t.current(),[])}function w1(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 Ft(e){const t=S1(e);return x.useCallback(function(...n){return t.current&&t.current(...n)},[t])}function k1(e){var t=Eu(e);return t&&t.defaultView||window}function E1(e,t){return k1(e).getComputedStyle(e,t)}var C1=/([A-Z])/g;function j1(e){return e.replace(C1,"-$1").toLowerCase()}var _1=/^ms-/;function Hr(e){return j1(e).replace(_1,"-ms-")}var N1=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function T1(e){return!!(e&&N1.test(e))}function Us(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(Hr(t))||E1(e).getPropertyValue(Hr(t));Object.keys(t).forEach(function(l){var o=t[l];!o&&o!==0?e.style.removeProperty(Hr(l)):T1(l)?r+=l+"("+o+") ":n+=Hr(l)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}const L1="data-rr-ui-";function P1(e){return`${L1}${e}`}function z1(e=document){const t=e.defaultView;return Math.abs(t.innerWidth-e.documentElement.clientWidth)}const Bs=P1("modal-open");class M1{constructor({ownerDocument:t,handleContainerOverflow:n=!0,isRTL:r=!1}={}){this.handleContainerOverflow=n,this.isRTL=r,this.modals=[],this.ownerDocument=t}getScrollbarWidth(){return z1(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(Us(l,r)||"0",10)+t.scrollBarWidth}px`),l.setAttribute(Bs,""),Us(l,n)}reset(){[...this.modals].forEach(t=>this.remove(t))}removeContainerStyle(t){const n=this.getElement();n.removeAttribute(Bs),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 vd=M1,gd=x.createContext(Hl?window:void 0);gd.Provider;function Cu(){return x.useContext(gd)}const _o=(e,t)=>Hl?e==null?(t||Eu()).body:(typeof e=="function"&&(e=e()),e&&"current"in e&&(e=e.current),e&&("nodeType"in e||e.getBoundingClientRect)?e:null):null;function O1(e,t){const n=Cu(),[r,l]=x.useState(()=>_o(e,n==null?void 0:n.document));if(!r){const o=_o(e);o&&l(o)}return x.useEffect(()=>{t&&r&&t(r)},[t,r]),x.useEffect(()=>{const o=_o(e);o!==r&&l(o)},[e,r]),r}const Vs=e=>!e||typeof e=="function"?e:t=>{e.current=t};function F1(e,t){const n=Vs(e),r=Vs(t);return l=>{n&&n(l),r&&r(l)}}function yd(e,t){return x.useMemo(()=>F1(e,t),[e,t])}const I1=typeof global<"u"&&global.navigator&&global.navigator.product==="ReactNative",D1=typeof document<"u",Hs=D1||I1?x.useLayoutEffect:x.useEffect;function R1({children:e,in:t,onExited:n,mountOnEnter:r,unmountOnExit:l}){const o=x.useRef(null),i=x.useRef(t),u=Ft(n);x.useEffect(()=>{t?i.current=!0:u(o.current)},[t,u]);const s=yd(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=Ft(t);return Hs(()=>{if(!n.current)return;let o=!1;return l({in:e,element:n.current,initial:r.current,isStale:()=>o}),()=>{o=!0}},[e,l]),Hs(()=>(r.current=!1,()=>{r.current=!0}),[]),n}function A1({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,m=>{throw a.in||i(!0),m})}}),s=yd(u,e.ref);return o&&!t?null:x.cloneElement(e,{ref:s})}function Ws(e,t,n){return e?c.jsx(e,Object.assign({},n)):t?c.jsx(A1,Object.assign({},n,{transition:t})):c.jsx(R1,Object.assign({},n))}function U1(e){return e.code==="Escape"||e.keyCode===27}const B1=["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 V1(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 H1(e){return No||(No=new vd({ownerDocument:e==null?void 0:e.document})),No}function W1(e){const t=Cu(),n=e||H1(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 xd=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:m,runTransition:f,backdropTransition:g,runBackdropTransition:y,autoFocus:S=!0,enforceFocus:P=!0,restoreFocus:p=!0,restoreFocusOptions:d,renderDialog:h,renderBackdrop:w=K=>c.jsx("div",Object.assign({},K)),manager:C,container:E,onShow:_,onHide:T=()=>{},onExit:D,onExited:M,onExiting:ge,onEnter:Lt,onEntering:Pt,onEntered:Er}=e,Zl=V1(e,B1);const Re=Cu(),it=O1(E),j=W1(C),L=g1(),z=w1(n),[$,Z]=x.useState(!n),Ze=x.useRef(null);x.useImperativeHandle(t,()=>j,[j]),Hl&&!z&&n&&(Ze.current=Co(Re==null?void 0:Re.document)),n&&$&&Z(!1);const $e=Ft(()=>{if(j.add(),Gl.current=As(document,"keydown",Pd),Kl.current=As(document,"focus",()=>setTimeout(Ke),!0),_&&_(),S){var K,Nu;const Xl=Co((K=(Nu=j.dialog)==null?void 0:Nu.ownerDocument)!=null?K:Re==null?void 0:Re.document);j.dialog&&Xl&&!$s(j.dialog,Xl)&&(Ze.current=Xl,j.dialog.focus())}}),zt=Ft(()=>{if(j.remove(),Gl.current==null||Gl.current(),Kl.current==null||Kl.current(),p){var K;(K=Ze.current)==null||K.focus==null||K.focus(d),Ze.current=null}});x.useEffect(()=>{!n||!it||$e()},[n,it,$e]),x.useEffect(()=>{$&&zt()},[$,zt]),x1(()=>{zt()});const Ke=Ft(()=>{if(!P||!L()||!j.isTopModal())return;const K=Co(Re==null?void 0:Re.document);j.dialog&&K&&!$s(j.dialog,K)&&j.dialog.focus()}),Yt=Ft(K=>{K.target===K.currentTarget&&(a==null||a(K),u===!0&&T())}),Pd=Ft(K=>{s&&U1(K)&&j.isTopModal()&&(v==null||v(K),K.defaultPrevented||T())}),Kl=x.useRef(),Gl=x.useRef(),zd=(...K)=>{Z(!0),M==null||M(...K)};if(!it)return null;const _u=Object.assign({role:r,ref:j.setDialogRef,"aria-modal":r==="dialog"?!0:void 0},Zl,{style:o,className:l,tabIndex:-1});let Yl=h?h(_u):c.jsx("div",Object.assign({},_u,{children:x.cloneElement(i,{role:"document"})}));Yl=Ws(m,f,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!n,onExit:D,onExiting:ge,onExited:zd,onEnter:Lt,onEntering:Pt,onEntered:Er,children:Yl});let Cr=null;return u&&(Cr=w({ref:j.setBackdropRef,onClick:Yt}),Cr=Ws(g,y,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:Cr})),c.jsx(c.Fragment,{children:r1.createPortal(c.jsxs(c.Fragment,{children:[Cr,Yl]}),it)})});xd.displayName="Modal";const Q1=Object.assign(xd,{Manager:vd}),Z1=({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(md,{className:"w-5 h-5"})})]}),wr=({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(Q1,{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(Z1,{onClose:t,title:n}),r]})})},Sr=({children:e})=>c.jsx("div",{className:"p-3 border-b dark:border-slate-500",children:e}),kr=({children:e,className:t})=>c.jsx("div",{className:`p-3 flex justify-end gap-2 ${t}`,children:e}),Qe=({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})},Qs=e=>{let t;const n=new Set,r=(s,a)=>{const v=typeof s=="function"?s(t):s;if(!Object.is(v,t)){const m=t;t=a??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(f=>f(t,m))}},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},K1=e=>e?Qs(e):Qs;var wd={exports:{}},Sd={},kd={exports:{}},Ed={};/** * @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 jn=x;function G1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Y1=typeof Object.is=="function"?Object.is:G1,X1=jn.useState,J1=jn.useEffect,q1=jn.useLayoutEffect,b1=jn.useDebugValue;function ep(e,t){var n=t(),r=X1({inst:{value:n,getSnapshot:t}}),l=r[0].inst,o=r[1];return q1(function(){l.value=n,l.getSnapshot=t,To(l)&&o({inst:l})},[e,n,t]),J1(function(){return To(l)&&o({inst:l}),e(function(){To(l)&&o({inst:l})})},[e]),b1(n),n}function To(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Y1(e,n)}catch{return!0}}function tp(e,t){return t()}var np=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?tp:ep;Ed.useSyncExternalStore=jn.useSyncExternalStore!==void 0?jn.useSyncExternalStore:np;kd.exports=Ed;var rp=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,lp=rp;function op(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ip=typeof Object.is=="function"?Object.is:op,up=lp.useSyncExternalStore,sp=Wl.useRef,ap=Wl.useEffect,cp=Wl.useMemo,dp=Wl.useDebugValue;Sd.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var o=sp(null);if(o.current===null){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=cp(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 m=y}return m=g}if(y=m,ip(v,g))return y;var S=r(g);return l!==void 0&&l(y,S)?y:(v=g,m=S)}var a=!1,v,m,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=up(e,o[0],o[1]);return ap(function(){i.hasValue=!0,i.value=u},[u]),dp(u),u};wd.exports=Sd;var fp=wd.exports;const pp=_l(fp),{useDebugValue:hp}=qe,{useSyncExternalStoreWithSelector:mp}=pp;function vp(e,t=e.getState,n){const r=mp(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return hp(r),r}const Zs=e=>{const t=typeof e=="function"?K1(e):e,n=(r,l)=>vp(t,r,l);return Object.assign(n,t),n},Cd=e=>e?Zs(e):Zs,gp=(e,t)=>e.id==t.id&&e.info_hash==t.info_hash,yp=(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.length===t.length&&e.every((n,r)=>gp(n,t[r])),Bt=Cd(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=>yp(n.torrents,t)?{}:{torrents:t}),refreshTorrents:()=>{},setRefreshTorrents:t=>e({refreshTorrents:t})})),xp=({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(ot),v=Bt(g=>g.refreshTorrents),m=()=>{l(!1),i(null),s(!1),n()},f=()=>{s(!0),(r?a.delete:a.forget)(e).then(()=>{v(),m()}).catch(y=>{i({text:`Error deleting torrent id=${e}`,details:y}),s(!1)})};return c.jsxs(wr,{isOpen:t,onClose:n,title:"Delete torrent",children:[c.jsxs(Sr,{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(jt,{error:o})]}),c.jsxs(kr,{children:[u&&c.jsx(pr,{}),c.jsx(Qe,{variant:"cancel",onClick:m,children:"Cancel"}),c.jsx(Qe,{variant:"danger",onClick:f,disabled:u,children:"Delete Torrent"})]})]})},Ks=({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 wp(e){return q({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 Sp(e){return q({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)}function hr(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 kp=e=>{const t=(n,r,l,o)=>{let i=[],u=[],s={};const a=m=>(s[m]=s[m]||[],s[m]);l.forEach(m=>{if(o==m.pathComponents.length-1){i.push(m);return}a(m.pathComponents[0]).push(m)});let v=0;for(const[m,f]of Object.entries(s))u.push(t(m,r+"."+v,f,o+1)),v+=1;return{name:n,id:r,dirs:u,files:i}};return t("","filetree-root",e.files.map((n,r)=>({id:r,filename:n.components[n.components.length-1],pathComponents:n.components,length:n.length})),0)},jd=({tree:e,selectedFiles:t,setSelectedFiles:n,initialExpanded:r,torrentDetails: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,m=()=>u.filter(f=>t.has(f)).map(f=>l.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($t,{onClick:()=>i(!o),children:o?c.jsx(wp,{}):c.jsx(Sp,{})}),c.jsx(Ks,{checked:u.every(f=>t.has(f)),label:`${e.name?e.name+", ":""} ${v()} files, ${hr(m())}`,name:e.id,onChange:s})]}),c.jsxs("div",{className:"pl-5",hidden:!o,children:[e.dirs.map(f=>c.jsx(jd,{torrentDetails:l,tree:f,selectedFiles:t,setSelectedFiles:n,initialExpanded:!1},f.name)),c.jsx("div",{className:"pl-1",children:e.files.map(f=>c.jsx(Ks,{checked:t.has(f.id),label:`${f.filename} (${hr(f.length)})`,name:`file-${f.id}`,onChange:()=>a(f.id)},f.id))})]})]})},_d=({torrentDetails:e,selectedFiles:t,setSelectedFiles:n})=>{let r=x.useMemo(()=>kp(e),[e]);return c.jsx(c.Fragment,{children:c.jsx(jd,{torrentDetails:e,tree:r,selectedFiles:t,setSelectedFiles:n,initialExpanded:!0})})},Ep=({id:e,show:t,onHide:n,details:r})=>{let l=new Set,o=x.useContext(wu);r.files.forEach((S,P)=>{S.included&&l.add(P)});const i=x.useContext(ot),[u,s]=x.useState(l),[a,v]=x.useState(!1),[m,f]=x.useState(null),g=()=>{s(l),n()},y=()=>{v(!0),i.updateOnlyFiles(e,Array.from(u)).then(()=>{v(!1),o.refresh(),g(),f(null)},S=>{v(!1),f({text:"Error configuring torrent",details:S})})};return c.jsxs(wr,{isOpen:t,onClose:g,title:"Configure torrent",children:[c.jsxs(Sr,{children:[c.jsx(jt,{error:m}),c.jsx(_d,{torrentDetails:r,selectedFiles:u,setSelectedFiles:s})]}),c.jsxs(kr,{children:[a&&c.jsx(pr,{}),c.jsx(Qe,{onClick:g,variant:"cancel",children:"Cancel"}),c.jsx(Qe,{onClick:y,variant:"primary",disabled:a||u.size==0,children:"OK"})]})]})};function Cp(e){return q({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"}}]})(e)}function jp(e){return q({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 _p(e){return q({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 Np(e){return q({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=Cd(e=>({closeableError:null,setCloseableError:t=>e(()=>({closeableError:t})),otherError:null,setOtherError:t=>e(()=>({otherError:t}))})),Tp=({id:e,detailsResponse:t,statsResponse:n})=>{let r=n.state,[l,o]=x.useState(!1),[i,u]=x.useState(!1),[s,a]=x.useState(!1),v=x.useContext(wu);const m=r=="live",f=r=="paused"||r=="error",g=r=="paused"||r=="live",y=gn(C=>C.setCloseableError),S=x.useContext(ot),P=()=>{o(!0),S.start(e).then(()=>{v.refresh()},C=>{y({text:`Error starting torrent id=${e}`,details:C})}).finally(()=>o(!1))},p=()=>{o(!0),S.pause(e).then(()=>{v.refresh()},C=>{y({text:`Error pausing torrent id=${e}`,details:C})}).finally(()=>o(!1))},d=()=>{a(!0)},h=()=>{o(!0),u(!0)},w=()=>{o(!1),u(!1)};return c.jsxs("div",{className:"flex w-full justify-center gap-2 dark:text-slate-300",children:[f&&c.jsx($t,{onClick:P,disabled:l,children:c.jsx(_p,{className:"hover:text-green-600"})}),m&&c.jsx($t,{onClick:p,disabled:l,children:c.jsx(jp,{className:"hover:text-amber-500"})}),g&&c.jsx($t,{onClick:d,disabled:l,children:c.jsx(Cp,{className:"hover:text-green-600"})}),c.jsx($t,{onClick:h,disabled:l,children:c.jsx(Np,{className:"hover:text-red-500"})}),c.jsx(xp,{id:e,show:i,onHide:w}),t&&s&&c.jsx(Ep,{id:e,show:s,details:t,onHide:()=>a(!1)})]})},Gs={warn:"bg-amber-500 text-white",info:"bg-blue-500 text-white",success:"bg-green-700 text-white",error:"bg-red-500 text-white"},Lp=({now:e,variant:t,label:n})=>{const r=n??`${e.toFixed(2)}%`,l=Gs[t??"info"]??Gs.info;return c.jsx("div",{className:"w-full bg-gray-200 rounded-full dark:bg-gray-500",children:c.jsx("div",{className:`text-xs font-medium transition-all text-center p-0.5 leading-none rounded-full ${l}`,style:{width:`${e}%`},children:r})})},Pp=({statsResponse:e})=>{var t,n;switch(e.state){case l1:return"Paused";case Su:return"Checking files";case i1: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:["(",hr(e.live.snapshot.uploaded_bytes),")"]})]})]})};function zp(e){return e.files.filter(n=>n.included).reduce((n,r)=>n.length>r.length?n:r).name}function Mp(e){return e.name??zp(e)}function Op(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 Fp(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":Op(t)}function Ip(e){return q({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 Dp(e){return q({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 Rp(e){return q({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 $p(e){return q({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 Ap(e){return q({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 Up=({className:e,finished:t,live:n,error:r})=>{const l=t&&n;return r?c.jsx(Dp,{className:e,color:"red"}):l?c.jsx($p,{className:e,color:"green"}):t?c.jsx(Ip,{className:e,color:"green"}):n?c.jsx(Rp,{className:`text-blue-500 ${e}`}):c.jsx(Ap,{className:e})},Bp=({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 m=(f=n==null?void 0:n.live)==null?void 0:f.snapshot.peer_stats;return m?`${m.live} / ${m.seen}`:""},v=m=>c.jsx(Up,{className:m,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:Mp(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(Lp,{now:s,label:l,variant:r==Su?"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(d1,{})," ",a().toString()]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(c1,{}),c.jsxs("div",{children:[hr(i),"/",hr(o)]})]}),n&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(a1,{}),Fp(n)]}),c.jsx("div",{className:"flex gap-2 items-center",children:c.jsx(Pp,{statsResponse:n})})]})]})]})]}),n&&c.jsx("div",{className:"",children:c.jsx(Tp,{id:e,detailsResponse:t,statsResponse:n})})]})},Vp=({id:e,torrent:t})=>{const[n,r]=x.useState(null),[l,o]=x.useState(null),[i,u]=x.useState(0),s=x.useContext(ot),a=()=>{u(i+1)};return x.useEffect(()=>fd(async()=>{await s.getTorrentDetails(t.id).then(r)},1e3),[i]),x.useEffect(()=>ku(async()=>s.getTorrentStats(t.id).then(g=>(o(g),g)).then(g=>g.state==Su||g.state==o1?1e3:1e4,()=>1e4),0),[i]),c.jsx(wu.Provider,{value:{refresh:a},children:c.jsx(Bp,{id:e,detailsResponse:n,statsResponse:l})})},Hp=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(pr,{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(Vp,{id:t.id,torrent:t},t.id))}),Wp=e=>{let t=gn(i=>i.closeableError),n=gn(i=>i.setCloseableError),r=gn(i=>i.otherError),l=Bt(i=>i.torrents),o=Bt(i=>i.torrentsInitiallyLoading);return c.jsxs("div",{className:"container mx-auto",children:[c.jsx(jt,{error:t,remove:()=>n(null)}),c.jsx(jt,{error:r}),c.jsx(Hp,{torrents:l,loading:o})]})};var Qp="Expected a function",Ys=0/0,Zp="[object Symbol]",Kp=/^\s+|\s+$/g,Gp=/^[-+]0x[0-9a-f]+$/i,Yp=/^0b[01]+$/i,Xp=/^0o[0-7]+$/i,Jp=parseInt,qp=typeof jr=="object"&&jr&&jr.Object===Object&&jr,bp=typeof self=="object"&&self&&self.Object===Object&&self,eh=qp||bp||Function("return this")(),th=Object.prototype,nh=th.toString,rh=Math.max,lh=Math.min,Lo=function(){return eh.Date.now()};function oh(e,t,n){var r,l,o,i,u,s,a=0,v=!1,m=!1,f=!0;if(typeof e!="function")throw new TypeError(Qp);t=Xs(t)||0,ji(n)&&(v=!!n.leading,m="maxWait"in n,o=m?rh(Xs(n.maxWait)||0,t):o,f="trailing"in n?!!n.trailing:f);function g(E){var _=r,T=l;return r=l=void 0,a=E,i=e.apply(T,_),i}function y(E){return a=E,u=setTimeout(p,t),v?g(E):i}function S(E){var _=E-s,T=E-a,D=t-_;return m?lh(D,o-T):D}function P(E){var _=E-s,T=E-a;return s===void 0||_>=t||_<0||m&&T>=o}function p(){var E=Lo();if(P(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 h(){u!==void 0&&clearTimeout(u),a=0,r=s=l=u=void 0}function w(){return u===void 0?i:d(Lo())}function C(){var E=Lo(),_=P(E);if(r=arguments,l=this,s=E,_){if(u===void 0)return y(s);if(m)return u=setTimeout(p,t),g(s)}return u===void 0&&(u=setTimeout(p,t)),i}return C.cancel=h,C.flush=w,C}function ji(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function ih(e){return!!e&&typeof e=="object"}function uh(e){return typeof e=="symbol"||ih(e)&&nh.call(e)==Zp}function Xs(e){if(typeof e=="number")return e;if(uh(e))return Ys;if(ji(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ji(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Kp,"");var n=Yp.test(e);return n||Xp.test(e)?Jp(e.slice(2),n?2:8):Gp.test(e)?Ys:+e}var sh=oh;const ah=_l(sh),ch=({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]})),"}"]})},dh=({span:e})=>c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"font-bold",children:e.name}),c.jsx(ch,{span:e}),c.jsx("span",{className:"font-bold",children:":"})]}),fh=({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))]}),ph=qe.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(dh,{span:l},o))}),c.jsx("span",{className:"m-1 text-slate-500 dark:text-slate-400",children:t.target}),c.jsx(fh,{fields:t.fields})]})}),Nd=({children:e})=>c.jsx("form",{children:e}),ju=({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})]}),hh=(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},mh=(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 m=new Uint8Array;for(;;){const{done:f,value:g}=await v.read();if(f)throw n({text:"log stream terminated"}),null;m=hh(m,g);for(let y;(y=m.indexOf(10))!==-1;){let S=m.slice(0,y),P=new TextDecoder().decode(S);t(P),m=m.slice(y+1)}}};let s=fd(()=>u().then(()=>{},a=>{if(!o&&a!==null)throw n({text:"error streaming logs",details:{text:a.toString()}}),a}),1e3);return()=>{i(),s()}},vh=({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]),m=x.useRef(v);m.current=v;const f=ah(y=>{let S=null;try{S=new RegExp(y)}catch{return}s.current=S,r(P=>{let p=[...P];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(()=>mh(e,y=>m.current(y),o),[e]),c.jsxs("div",{children:[c.jsx(jt,{error:l}),c.jsxs("div",{className:"mb-3",children:["Showing last ",a," logs since this window was opened"]}),c.jsx(Nd,{children:c.jsx(ju,{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(ph,{line:y.parsed})},y.id))]})},gh=({show:e,onClose:t})=>{let r=x.useContext(ot).getStreamLogsUrl();return c.jsxs(wr,{isOpen:e,onClose:t,title:"rqbit server logs",className:"max-w-7xl",children:[c.jsx(Sr,{children:r?c.jsx(vh,{url:r}):c.jsx(jt,{error:{text:"HTTP API not available to stream logs"}})}),c.jsx(kr,{children:c.jsx(Qe,{variant:"primary",onClick:t,children:"Close"})})]})},yh=({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]}),xh=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,m]=x.useState(null),[f,g]=x.useState(!1),[y,S]=x.useState(""),P=Bt(C=>C.refreshTorrents),p=x.useContext(ot);x.useEffect(()=>{u(new Set(n==null?void 0:n.details.files.map((C,E)=>E))),S((n==null?void 0:n.output_folder)||"")},[n]);const d=()=>{t(),u(new Set),m(null),a(!1)},h=async()=>{if(!n)return;a(!0);let C=n.seen_peers?n.seen_peers.slice(0,32):null,E={overwrite:!0,only_files:Array.from(i),initial_peers:C,output_folder:y};f&&(E.peer_opts={connect_timeout:20,read_write_timeout:60}),p.uploadTorrent(o,E).then(()=>{t(),P()},_=>{m({text:"Error starting torrent",details:_})}).finally(()=>a(!1))},w=()=>{if(l)return c.jsx(pr,{label:"Loading torrent contents"});if(r)return c.jsx(jt,{error:r});if(n)return c.jsxs(Nd,{children:[c.jsx(ju,{label:"Output folder",name:"output_folder",inputType:"text",value:y,onChange:C=>S(C.target.value)}),c.jsx(yh,{children:c.jsx(_d,{selectedFiles:i,setSelectedFiles:u,torrentDetails:n.details})})]})};return c.jsxs(wr,{isOpen:!0,onClose:d,title:"Add Torrent",children:[c.jsxs(Sr,{children:[w(),c.jsx(jt,{error:v})]}),c.jsxs(kr,{children:[s&&c.jsx(pr,{}),c.jsx(Qe,{onClick:d,variant:"cancel",children:"Cancel"}),c.jsx(Qe,{onClick:h,variant:"primary",disabled:l||s||i.size==0,children:"OK"})]})]})},Td=({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),m=x.useContext(ot);x.useEffect(()=>{if(t===null)return;let g=setTimeout(async()=>{i(!0);try{const y=await m.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(Qe,{onClick:e,className:l,children:r}),t&&c.jsx(xh,{onHide:f,listTorrentError:a,listTorrentResponse:u,data:t,listTorrentLoading:o})]})};function wh(e){return q({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 Sh(e){return q({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 kh=({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(Td,{onClick:i,data:n,resetData:o,className:`group ${e}`,children:[c.jsx(wh,{className:"text-blue-500 group-hover:text-white dark:text-white"}),c.jsx("div",{children:"Upload .torrent File"})]})]})},Eh=({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(Td,{onClick:()=>{i(!0)},data:t,className:`group ${e}`,resetData:()=>n(null),children:[c.jsx(Sh,{className:"text-blue-500 group-hover:text-white dark:text-white"}),c.jsx("div",{children:"Add Torrent from Magnet / URL"})]}),c.jsxs(wr,{isOpen:o,onClose:s,title:"Add torrent",children:[c.jsx(Sr,{children:c.jsx(ju,{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(kr,{children:[c.jsx(Qe,{variant:"cancel",onClick:s,children:"Cancel"}),c.jsx(Qe,{disabled:!r,variant:"primary",onClick:u,children:"Add"})]})]})]})},Ch=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"}))),jh=({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(Ch,{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(Eh,{className:"flex-grow justify-center dark:text-white"}),c.jsx(kh,{className:"flex-grow justify-center dark:text-white"})]})]})};let Jt=window.matchMedia("(prefers-color-scheme: dark)").matches;window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{Ql.setDark(e.matches)});const Ql={isDark:()=>Jt,setDark:e=>(Jt=e,document.body.classList.toggle("dark",Jt),Jt),toggle:()=>{Ql.setDark(!Jt)}};Ql.setDark(Jt);const _h=e=>{let[t,n]=x.useState(!1);gn(a=>a.setCloseableError);const r=gn(a=>a.setOtherError),l=x.useContext(ot),o=Bt(a=>a.setTorrents),i=Bt(a=>a.setTorrentsLoading),u=Bt(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(jh,{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($t,{onClick:()=>n(!0),children:c.jsx(f1,{})}),c.jsx($t,{onClick:Ql.toggle,children:c.jsx(p1,{})})]}),c.jsx(Wp,{})]}),c.jsx(gh,{show:t,onClose:()=>n(!1)})]})},Ld=window.origin==="null"||window.origin==="http://localhost:3031"?"http://localhost:3030":"",Ue=async(e,t,n,r)=>{console.log(e,t);const l=Ld+t;let o={method:e,headers:{Accept:"application/json"}};r?(o.headers={Accept:"application/json","Content-Type":"application/json"},o.body=JSON.stringify(n)):o.body=n;let i={method:e,path:t,text:""},u;try{u=await fetch(l,o)}catch{return i.text="network error",Promise.reject(i)}if(i.status=u.status,i.statusText=`${u.status} ${u.statusText}`,!u.ok){const a=await u.text();try{const v=JSON.parse(a);i.text=v.human_readable!==void 0?v.human_readable:JSON.stringify(v,null,2)}catch{i.text=a}return Promise.reject(i)}return await u.json()},Js={getStreamLogsUrl:()=>Ld+"/stream_logs",listTorrents:()=>Ue("GET","/torrents"),getTorrentDetails:e=>Ue("GET",`/torrents/${e}`),getTorrentStats:e=>Ue("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"),Ue("POST",n,e)},updateOnlyFiles:(e,t)=>{let n=`/torrents/${e}/update_only_files`;return Ue("POST",n,{only_files:t},!0)},pause:e=>Ue("POST",`/torrents/${e}/pause`),start:e=>Ue("POST",`/torrents/${e}/start`),forget:e=>Ue("POST",`/torrents/${e}/forget`),delete:e=>Ue("POST",`/torrents/${e}/delete`),getVersion:async()=>(await Ue("GET","/")).version},Nh=()=>{let[e,t]=x.useState("rqbit web UI");return x.useEffect(()=>ku(()=>Js.getVersion().then(r=>{const l=`rqbit web UI - v${r}`;return t(l),document.title=l,1e4},r=>1e3),0),[]),c.jsx(ot.Provider,{value:Js,children:c.jsx(_h,{title:e})})};Po.createRoot(document.getElementById("app")).render(c.jsx(x.StrictMode,{children:c.jsx(Nh,{})}));