(function(){const w=document.createElement("link").relList;if(w&&w.supports&&w.supports("modulepreload"))return;for(const z of document.querySelectorAll('link[rel="modulepreload"]'))T(z);new MutationObserver(z=>{for(const A of z)if(A.type==="childList")for(const D of A.addedNodes)D.tagName==="LINK"&&D.rel==="modulepreload"&&T(D)}).observe(document,{childList:!0,subtree:!0});function p(z){const A={};return z.integrity&&(A.integrity=z.integrity),z.referrerPolicy&&(A.referrerPolicy=z.referrerPolicy),z.crossOrigin==="use-credentials"?A.credentials="include":z.crossOrigin==="anonymous"?A.credentials="omit":A.credentials="same-origin",A}function T(z){if(z.ep)return;z.ep=!0;const A=p(z);fetch(z.href,A)}})();function Ua(g){return g&&g.__esModule&&Object.prototype.hasOwnProperty.call(g,"default")?g.default:g}var Pi={exports:{}},Sr={},Ti={exports:{}},Y={};var Pa;function Od(){if(Pa)return Y;Pa=1;var g=Symbol.for("react.element"),w=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),D=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),M=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),W=Symbol.iterator;function q(d){return d===null||typeof d!="object"?null:(d=W&&d[W]||d["@@iterator"],typeof d=="function"?d:null)}var X={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ne=Object.assign,oe={};function b(d,v,K){this.props=d,this.context=v,this.refs=oe,this.updater=K||X}b.prototype.isReactComponent={},b.prototype.setState=function(d,v){if(typeof d!="object"&&typeof d!="function"&&d!=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,d,v,"setState")},b.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function te(){}te.prototype=b.prototype;function de(d,v,K){this.props=d,this.context=v,this.refs=oe,this.updater=K||X}var ue=de.prototype=new te;ue.constructor=de,Ne(ue,b.prototype),ue.isPureReactComponent=!0;var me=Array.isArray,E=Object.prototype.hasOwnProperty,Q={current:null},he={key:!0,ref:!0,__self:!0,__source:!0};function Ve(d,v,K){var G,ne={},re=null,ae=null;if(v!=null)for(G in v.ref!==void 0&&(ae=v.ref),v.key!==void 0&&(re=""+v.key),v)E.call(v,G)&&!he.hasOwnProperty(G)&&(ne[G]=v[G]);var ie=arguments.length-2;if(ie===1)ne.children=K;else if(1>>1,v=N[d];if(0>>1;dz(ne,C))rez(ae,ne)?(N[d]=ae,N[re]=C,d=re):(N[d]=ne,N[G]=C,d=G);else if(rez(ae,C))N[d]=ae,N[re]=C,d=re;else break e}}return O}function z(N,O){var C=N.sortIndex-O.sortIndex;return C!==0?C:N.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var A=performance;g.unstable_now=function(){return A.now()}}else{var D=Date,V=D.now();g.unstable_now=function(){return D.now()-V}}var H=[],M=[],J=1,W=null,q=3,X=!1,Ne=!1,oe=!1,b=typeof setTimeout=="function"?setTimeout:null,te=typeof clearTimeout=="function"?clearTimeout:null,de=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function ue(N){for(var O=p(M);O!==null;){if(O.callback===null)T(M);else if(O.startTime<=N)T(M),O.sortIndex=O.expirationTime,w(H,O);else break;O=p(M)}}function me(N){if(oe=!1,ue(N),!Ne)if(p(H)!==null)Ne=!0,_(E);else{var O=p(M);O!==null&&Z(me,O.startTime-N)}}function E(N,O){Ne=!1,oe&&(oe=!1,te(Ve),Ve=-1),X=!0;var C=q;try{for(ue(O),W=p(H);W!==null&&(!(W.expirationTime>O)||N&&!St());){var d=W.callback;if(typeof d=="function"){W.callback=null,q=W.priorityLevel;var v=d(W.expirationTime<=O);O=g.unstable_now(),typeof v=="function"?W.callback=v:W===p(H)&&T(H),ue(O)}else T(H);W=p(H)}if(W!==null)var K=!0;else{var G=p(M);G!==null&&Z(me,G.startTime-O),K=!1}return K}finally{W=null,q=C,X=!1}}var Q=!1,he=null,Ve=-1,ut=5,at=-1;function St(){return!(g.unstable_now()-atN||125d?(N.sortIndex=C,w(M,N),p(H)===null&&N===p(M)&&(oe?(te(Ve),Ve=-1):oe=!0,Z(me,C-d))):(N.sortIndex=v,w(H,N),Ne||X||(Ne=!0,_(E))),N},g.unstable_shouldYield=St,g.unstable_wrapCallback=function(N){var O=q;return function(){var C=q;q=O;try{return N.apply(this,arguments)}finally{q=C}}}})(Ri)),Ri}var Fa;function Vd(){return Fa||(Fa=1,zi.exports=$d()),zi.exports}var Da;function Bd(){if(Da)return Ge;Da=1;var g=Fi(),w=Vd();function p(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"),H=Object.prototype.hasOwnProperty,M=/^[: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]*$/,J={},W={};function q(e){return H.call(W,e)?!0:H.call(J,e)?!1:M.test(e)?W[e]=!0:(J[e]=!0,!1)}function X(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 Ne(e,t,n,r){if(t===null||typeof t>"u"||X(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 oe(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 b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){b[e]=new oe(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];b[t]=new oe(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){b[e]=new oe(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){b[e]=new oe(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){b[e]=new oe(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){b[e]=new oe(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){b[e]=new oe(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){b[e]=new oe(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){b[e]=new oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var te=/[\-:]([a-z])/g;function de(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(te,de);b[t]=new oe(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(te,de);b[t]=new oe(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(te,de);b[t]=new oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){b[e]=new oe(e,1,!1,e.toLowerCase(),null,!1,!1)}),b.xlinkHref=new oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){b[e]=new oe(e,1,!1,e.toLowerCase(),null,!0,!0)});function ue(e,t,n,r){var l=b.hasOwnProperty(t)?b[t]:null;(l!==null?l.type!==0:r||!(2u||l[i]!==o[u]){var a=` `+l[i].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=i&&0<=u);break}}}finally{K=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?v(e):""}function ne(e){switch(e.tag){case 5:return v(e.type);case 16:return v("Lazy");case 13:return v("Suspense");case 19:return v("SuspenseList");case 0:case 2:case 15:return e=G(e.type,!1),e;case 11:return e=G(e.type.render,!1),e;case 1:return e=G(e.type,!0),e;default:return""}}function re(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 he:return"Fragment";case Q:return"Portal";case ut:return"Profiler";case Ve:return"StrictMode";case Ue:return"Suspense";case Be:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case St:return(e.displayName||"Context")+".Consumer";case at:return(e._context.displayName||"Context")+".Provider";case tt:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Je:return t=e.displayName||null,t!==null?t:re(e.type)||"Memo";case _:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}function ae(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 re(t);case 8:return t===Ve?"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 ie(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ge(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xe(e){var t=ge(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 Nr(e){e._valueTracker||(e._valueTracker=Xe(e))}function Di(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ge(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function _r(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 Dl(e,t){var n=t.checked;return C({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Mi(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ie(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 Oi(e,t){t=t.checked,t!=null&&ue(e,"checked",t,!1)}function Ml(e,t){Oi(e,t);var n=ie(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")?Ol(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ol(e,t.type,ie(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ii(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 Ol(e,t,n){(t!=="number"||_r(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var In=Array.isArray;function dn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=jr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Un(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var An={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},$a=["Webkit","ms","Moz","O"];Object.keys(An).forEach(function(e){$a.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),An[t]=An[e]})});function Hi(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||An.hasOwnProperty(e)&&An[e]?(""+t).trim():t+"px"}function Wi(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Hi(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Va=C({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 Al(e,t){if(t){if(Va[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(p(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(p(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(p(61))}if(t.style!=null&&typeof t.style!="object")throw Error(p(62))}}function $l(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 Vl=null;function Bl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Hl=null,fn=null,pn=null;function Qi(e){if(e=sr(e)){if(typeof Hl!="function")throw Error(p(280));var t=e.stateNode;t&&(t=Gr(t),Hl(e.stateNode,e.type,t))}}function Ki(e){fn?pn?pn.push(e):pn=[e]:fn=e}function Yi(){if(fn){var e=fn,t=pn;if(pn=fn=null,Qi(e),t)for(e=0;e>>=0,e===0?32:31-(qa(e)/ba|0)|0}var Lr=64,zr=4194304;function Hn(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 Rr(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=Hn(u):(o&=i,o!==0&&(r=Hn(o)))}else i=n&~l,i!==0?r=Hn(i):o!==0&&(r=Hn(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Wn(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ct(t),e[t]=n}function rc(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=qn),ks=" ",Ss=!1;function Ns(e,t){switch(e){case"keyup":return zc.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _s(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gn=!1;function Fc(e,t){switch(e){case"compositionend":return _s(t);case"keypress":return t.which!==32?null:(Ss=!0,ks);case"textInput":return e=t.data,e===ks&&Ss?null:e;default:return null}}function Dc(e,t){if(gn)return e==="compositionend"||!so&&Ns(e,t)?(e=hs(),Ir=to=Mt=null,gn=!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=zs(n)}}function Fs(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fs(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ds(){for(var e=window,t=_r();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=_r(e.document)}return t}function co(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 Hc(e){var t=Ds(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Fs(n.ownerDocument.documentElement,n)){if(r!==null&&co(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=Rs(n,o);var i=Rs(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,yn=null,fo=null,nr=null,po=!1;function Ms(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;po||yn==null||yn!==_r(r)||(r=yn,"selectionStart"in r&&co(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}),nr&&tr(nr,r)||(nr=r,r=Qr(fo,"onSelect"),0Sn||(e.current=jo[Sn],jo[Sn]=null,Sn--)}function ce(e,t){Sn++,jo[Sn]=e.current,e.current=t}var At={},De=Ut(At),He=Ut(!1),qt=At;function Nn(e,t){var n=e.type.contextTypes;if(!n)return At;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 We(e){return e=e.childContextTypes,e!=null}function Jr(){pe(He),pe(De)}function Xs(e,t,n){if(De.current!==At)throw Error(p(168));ce(De,t),ce(He,n)}function Zs(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(p(108,ae(e)||"Unknown",l));return C({},n,r)}function Xr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||At,qt=De.current,ce(De,e),ce(He,He.current),!0}function qs(e,t,n){var r=e.stateNode;if(!r)throw Error(p(169));n?(e=Zs(e,t,qt),r.__reactInternalMemoizedMergedChildContext=e,pe(He),pe(De),ce(De,e)):pe(He),ce(He,n)}var _t=null,Zr=!1,Eo=!1;function bs(e){_t===null?_t=[e]:_t.push(e)}function td(e){Zr=!0,bs(e)}function $t(){if(!Eo&&_t!==null){Eo=!0;var e=0,t=se;try{var n=_t;for(se=1;e>=i,l-=i,jt=1<<32-ct(t)+l|n<$?(ze=U,U=null):ze=U.sibling;var le=y(f,U,m[$],S);if(le===null){U===null&&(U=ze);break}e&&U&&le.alternate===null&&t(f,U),c=o(le,c,$),I===null?F=le:I.sibling=le,I=le,U=ze}if($===m.length)return n(f,U),ye&&en(f,$),F;if(U===null){for(;$$?(ze=U,U=null):ze=U.sibling;var Jt=y(f,U,le.value,S);if(Jt===null){U===null&&(U=ze);break}e&&U&&Jt.alternate===null&&t(f,U),c=o(Jt,c,$),I===null?F=Jt:I.sibling=Jt,I=Jt,U=ze}if(le.done)return n(f,U),ye&&en(f,$),F;if(U===null){for(;!le.done;$++,le=m.next())le=k(f,le.value,S),le!==null&&(c=o(le,c,$),I===null?F=le:I.sibling=le,I=le);return ye&&en(f,$),F}for(U=r(f,U);!le.done;$++,le=m.next())le=j(U,f,$,le.value,S),le!==null&&(e&&le.alternate!==null&&U.delete(le.key===null?$:le.key),c=o(le,c,$),I===null?F=le:I.sibling=le,I=le);return e&&U.forEach(function(Md){return t(f,Md)}),ye&&en(f,$),F}function Se(f,c,m,S){if(typeof m=="object"&&m!==null&&m.type===he&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case E:e:{for(var F=m.key,I=c;I!==null;){if(I.key===F){if(F=m.type,F===he){if(I.tag===7){n(f,I.sibling),c=l(I,m.props.children),c.return=f,f=c;break e}}else if(I.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===_&&ou(F)===I.type){n(f,I.sibling),c=l(I,m.props),c.ref=ur(f,I,m),c.return=f,f=c;break e}n(f,I);break}else t(f,I);I=I.sibling}m.type===he?(c=an(m.props.children,f.mode,S,m.key),c.return=f,f=c):(S=jl(m.type,m.key,m.props,null,f.mode,S),S.ref=ur(f,c,m),S.return=f,f=S)}return i(f);case Q:e:{for(I=m.key;c!==null;){if(c.key===I)if(c.tag===4&&c.stateNode.containerInfo===m.containerInfo&&c.stateNode.implementation===m.implementation){n(f,c.sibling),c=l(c,m.children||[]),c.return=f,f=c;break e}else{n(f,c);break}else t(f,c);c=c.sibling}c=Ni(m,f.mode,S),c.return=f,f=c}return i(f);case _:return I=m._init,Se(f,c,I(m._payload),S)}if(In(m))return L(f,c,m,S);if(O(m))return R(f,c,m,S);tl(f,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,c!==null&&c.tag===6?(n(f,c.sibling),c=l(c,m),c.return=f,f=c):(n(f,c),c=Si(m,f.mode,S),c.return=f,f=c),i(f)):n(f,c)}return Se}var Cn=iu(!0),su=iu(!1),nl=Ut(null),rl=null,Pn=null,Ro=null;function Fo(){Ro=Pn=rl=null}function Do(e){var t=nl.current;pe(nl),e._currentValue=t}function Mo(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Tn(e,t){rl=e,Ro=Pn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Qe=!0),e.firstContext=null)}function lt(e){var t=e._currentValue;if(Ro!==e)if(e={context:e,memoizedValue:t,next:null},Pn===null){if(rl===null)throw Error(p(308));Pn=e,rl.dependencies={lanes:0,firstContext:e}}else Pn=Pn.next=e;return t}var tn=null;function Oo(e){tn===null?tn=[e]:tn.push(e)}function uu(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Oo(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ct(e,r)}function Ct(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Vt=!1;function Io(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function au(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Pt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Bt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(ee&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ct(e,n)}return l=r.interleaved,l===null?(t.next=t,Oo(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ct(e,n)}function ll(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xl(e,n)}}function cu(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ol(e,t,n,r){var l=e.updateQueue;Vt=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var a=u,h=a.next;a.next=null,i===null?o=h:i.next=h,i=a;var x=e.alternate;x!==null&&(x=x.updateQueue,u=x.lastBaseUpdate,u!==i&&(u===null?x.firstBaseUpdate=h:u.next=h,x.lastBaseUpdate=a))}if(o!==null){var k=l.baseState;i=0,x=h=a=null,u=o;do{var y=u.lane,j=u.eventTime;if((r&y)===y){x!==null&&(x=x.next={eventTime:j,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var L=e,R=u;switch(y=t,j=n,R.tag){case 1:if(L=R.payload,typeof L=="function"){k=L.call(j,k,y);break e}k=L;break e;case 3:L.flags=L.flags&-65537|128;case 0:if(L=R.payload,y=typeof L=="function"?L.call(j,k,y):L,y==null)break e;k=C({},k,y);break e;case 2:Vt=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,y=l.effects,y===null?l.effects=[u]:y.push(u))}else j={eventTime:j,lane:y,tag:u.tag,payload:u.payload,callback:u.callback,next:null},x===null?(h=x=j,a=k):x=x.next=j,i|=y;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;y=u,u=y.next,y.next=null,l.lastBaseUpdate=y,l.shared.pending=null}}while(!0);if(x===null&&(a=k),l.baseState=a,l.firstBaseUpdate=h,l.lastBaseUpdate=x,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);ln|=i,e.lanes=i,e.memoizedState=k}}function du(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Bo.transition;Bo.transition={};try{e(!1),t()}finally{se=n,Bo.transition=r}}function Lu(){return ot().memoizedState}function od(e,t,n){var r=Kt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},zu(e))Ru(t,n);else if(n=uu(e,t,n,r),n!==null){var l=$e();gt(n,e,r,l),Fu(n,t,r)}}function id(e,t,n){var r=Kt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(zu(e))Ru(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,dt(u,i)){var a=t.interleaved;a===null?(l.next=l,Oo(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=uu(e,t,l,r),n!==null&&(l=$e(),gt(n,e,r,l),Fu(n,t,r))}}function zu(e){var t=e.alternate;return e===xe||t!==null&&t===xe}function Ru(e,t){fr=ul=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xl(e,n)}}var dl={readContext:lt,useCallback:Me,useContext:Me,useEffect:Me,useImperativeHandle:Me,useInsertionEffect:Me,useLayoutEffect:Me,useMemo:Me,useReducer:Me,useRef:Me,useState:Me,useDebugValue:Me,useDeferredValue:Me,useTransition:Me,useMutableSource:Me,useSyncExternalStore:Me,useId:Me,unstable_isNewReconciler:!1},sd={readContext:lt,useCallback:function(e,t){return wt().memoizedState=[e,t===void 0?null:t],e},useContext:lt,useEffect:Su,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,al(4194308,4,ju.bind(null,t,e),n)},useLayoutEffect:function(e,t){return al(4194308,4,e,t)},useInsertionEffect:function(e,t){return al(4,2,e,t)},useMemo:function(e,t){var n=wt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=wt();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=od.bind(null,xe,e),[r.memoizedState,e]},useRef:function(e){var t=wt();return e={current:e},t.memoizedState=e},useState:wu,useDebugValue:Jo,useDeferredValue:function(e){return wt().memoizedState=e},useTransition:function(){var e=wu(!1),t=e[0];return e=ld.bind(null,e[1]),wt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=xe,l=wt();if(ye){if(n===void 0)throw Error(p(407));n=n()}else{if(n=t(),Le===null)throw Error(p(349));(rn&30)!==0||hu(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Su(yu.bind(null,r,o,e),[e]),r.flags|=2048,hr(9,gu.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=wt(),t=Le.identifierPrefix;if(ye){var n=Et,r=jt;n=(r&~(1<<32-ct(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=pr++,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[vt]=t,e[ir]=r,bu(e,t,!1,!1),t.stateNode=e;e:{switch(i=$l(n,r),n){case"dialog":fe("cancel",e),fe("close",e),l=r;break;case"iframe":case"object":case"embed":fe("load",e),l=r;break;case"video":case"audio":for(l=0;lDn&&(t.flags|=128,r=!0,gr(o,!1),t.lanes=4194304)}else{if(!r)if(e=il(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),gr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!ye)return Oe(t),null}else 2*ke()-o.renderingStartTime>Dn&&n!==1073741824&&(t.flags|=128,r=!0,gr(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=ke(),t.sibling=null,n=ve.current,ce(ve,r?n&1|2:n&1),t):(Oe(t),null);case 22:case 23:return xi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(et&1073741824)!==0&&(Oe(t),t.subtreeFlags&6&&(t.flags|=8192)):Oe(t),null;case 24:return null;case 25:return null}throw Error(p(156,t.tag))}function hd(e,t){switch(Po(t),t.tag){case 1:return We(t.type)&&Jr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ln(),pe(He),pe(De),Vo(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ao(t),null;case 13:if(pe(ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(p(340));En()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pe(ve),null;case 4:return Ln(),null;case 10:return Do(t.type._context),null;case 22:case 23:return xi(),null;case 24:return null;default:return null}}var hl=!1,Ie=!1,gd=typeof WeakSet=="function"?WeakSet:Set,P=null;function Rn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){we(e,t,r)}else n.current=null}function si(e,t,n){try{n()}catch(r){we(e,t,r)}}var na=!1;function yd(e,t){if(xo=Mr,e=Ds(),co(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,a=-1,h=0,x=0,k=e,y=null;t:for(;;){for(var j;k!==n||l!==0&&k.nodeType!==3||(u=i+l),k!==o||r!==0&&k.nodeType!==3||(a=i+r),k.nodeType===3&&(i+=k.nodeValue.length),(j=k.firstChild)!==null;)y=k,k=j;for(;;){if(k===e)break t;if(y===n&&++h===l&&(u=i),y===o&&++x===r&&(a=i),(j=k.nextSibling)!==null)break;k=y,y=k.parentNode}k=j}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(wo={focusedElem:e,selectionRange:n},Mr=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var L=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(L!==null){var R=L.memoizedProps,Se=L.memoizedState,f=t.stateNode,c=f.getSnapshotBeforeUpdate(t.elementType===t.type?R:pt(t.type,R),Se);f.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch(S){we(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return L=na,na=!1,L}function yr(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&&si(t,n,o)}l=l.next}while(l!==r)}}function gl(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 ui(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 ra(e){var t=e.alternate;t!==null&&(e.alternate=null,ra(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vt],delete t[ir],delete t[_o],delete t[bc],delete t[ed])),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 la(e){return e.tag===5||e.tag===3||e.tag===4}function oa(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||la(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 ai(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=Yr));else if(r!==4&&(e=e.child,e!==null))for(ai(e,t,n),e=e.sibling;e!==null;)ai(e,t,n),e=e.sibling}function ci(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(ci(e,t,n),e=e.sibling;e!==null;)ci(e,t,n),e=e.sibling}var Re=null,mt=!1;function Ht(e,t,n){for(n=n.child;n!==null;)ia(e,t,n),n=n.sibling}function ia(e,t,n){if(yt&&typeof yt.onCommitFiberUnmount=="function")try{yt.onCommitFiberUnmount(Tr,n)}catch{}switch(n.tag){case 5:Ie||Rn(n,t);case 6:var r=Re,l=mt;Re=null,Ht(e,t,n),Re=r,mt=l,Re!==null&&(mt?(e=Re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Re.removeChild(n.stateNode));break;case 18:Re!==null&&(mt?(e=Re,n=n.stateNode,e.nodeType===8?No(e.parentNode,n):e.nodeType===1&&No(e,n),Jn(e)):No(Re,n.stateNode));break;case 4:r=Re,l=mt,Re=n.stateNode.containerInfo,mt=!0,Ht(e,t,n),Re=r,mt=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)!==0||(o&4)!==0)&&si(n,t,i),l=l.next}while(l!==r)}Ht(e,t,n);break;case 1:if(!Ie&&(Rn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){we(n,t,u)}Ht(e,t,n);break;case 21:Ht(e,t,n);break;case 22:n.mode&1?(Ie=(r=Ie)||n.memoizedState!==null,Ht(e,t,n),Ie=r):Ht(e,t,n);break;default:Ht(e,t,n)}}function sa(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gd),t.forEach(function(r){var l=Ed.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ht(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=ke()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*xd(r/1960))-r,10e?16:e,Qt===null)var r=!1;else{if(e=Qt,Qt=null,kl=0,(ee&6)!==0)throw Error(p(331));var l=ee;for(ee|=4,P=e.current;P!==null;){var o=P,i=o.child;if((P.flags&16)!==0){var u=o.deletions;if(u!==null){for(var a=0;ake()-pi?sn(e,0):fi|=n),Ye(e,t)}function wa(e,t){t===0&&((e.mode&1)===0?t=1:(t=zr,zr<<=1,(zr&130023424)===0&&(zr=4194304)));var n=$e();e=Ct(e,t),e!==null&&(Wn(e,t,n),Ye(e,n))}function jd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),wa(e,n)}function Ed(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(p(314))}r!==null&&r.delete(t),wa(e,n)}var ka;ka=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||He.current)Qe=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return Qe=!1,pd(e,t,n);Qe=(e.flags&131072)!==0}else Qe=!1,ye&&(t.flags&1048576)!==0&&eu(t,br,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ml(e,t),e=t.pendingProps;var l=Nn(t,De.current);Tn(t,n),l=Wo(null,t,r,e,l,n);var o=Qo();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,We(r)?(o=!0,Xr(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Io(t),l.updater=fl,t.stateNode=l,l._reactInternals=t,Zo(t,r,e,n),t=ti(null,t,r,!0,o,n)):(t.tag=0,ye&&o&&Co(t),Ae(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ml(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Pd(r),e=pt(r,e),l){case 0:t=ei(null,t,r,e,n);break e;case 1:t=Yu(null,t,r,e,n);break e;case 11:t=Bu(null,t,r,e,n);break e;case 14:t=Hu(null,t,r,pt(r.type,e),n);break e}throw Error(p(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:pt(r,l),ei(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:pt(r,l),Yu(e,t,r,l,n);case 3:e:{if(Gu(t),e===null)throw Error(p(387));r=t.pendingProps,o=t.memoizedState,l=o.element,au(e,t),ol(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=zn(Error(p(423)),t),t=Ju(e,t,r,n,l);break e}else if(r!==l){l=zn(Error(p(424)),t),t=Ju(e,t,r,n,l);break e}else for(be=It(t.stateNode.containerInfo.firstChild),qe=t,ye=!0,ft=null,n=su(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(En(),r===l){t=Tt(e,t,n);break e}Ae(e,t,r,n)}t=t.child}return t;case 5:return fu(t),e===null&&Lo(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,ko(r,l)?i=null:o!==null&&ko(r,o)&&(t.flags|=32),Ku(e,t),Ae(e,t,i,n),t.child;case 6:return e===null&&Lo(t),null;case 13:return Xu(e,t,n);case 4:return Uo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Cn(t,null,r,n):Ae(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:pt(r,l),Bu(e,t,r,l,n);case 7:return Ae(e,t,t.pendingProps,n),t.child;case 8:return Ae(e,t,t.pendingProps.children,n),t.child;case 12:return Ae(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,ce(nl,r._currentValue),r._currentValue=i,o!==null)if(dt(o.value,i)){if(o.children===l.children&&!He.current){t=Tt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(o.tag===1){a=Pt(-1,n&-n),a.tag=2;var h=o.updateQueue;if(h!==null){h=h.shared;var x=h.pending;x===null?a.next=a:(a.next=x.next,x.next=a),h.pending=a}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Mo(o.return,n,t),u.lanes|=n;break}a=a.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(p(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Mo(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}Ae(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Tn(t,n),l=lt(l),r=r(l),t.flags|=1,Ae(e,t,r,n),t.child;case 14:return r=t.type,l=pt(r,t.pendingProps),l=pt(r.type,l),Hu(e,t,r,l,n);case 15:return Wu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:pt(r,l),ml(e,t),t.tag=1,We(r)?(e=!0,Xr(t)):e=!1,Tn(t,n),Mu(t,r,l),Zo(t,r,l,n),ti(null,t,r,!0,e,n);case 19:return qu(e,t,n);case 22:return Qu(e,t,n)}throw Error(p(156,t.tag))};function Sa(e,t){return ts(e,t)}function Cd(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 st(e,t,n,r){return new Cd(e,t,n,r)}function ki(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pd(e){if(typeof e=="function")return ki(e)?1:0;if(e!=null){if(e=e.$$typeof,e===tt)return 11;if(e===Je)return 14}return 2}function Gt(e,t){var n=e.alternate;return n===null?(n=st(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 jl(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")ki(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case he:return an(n.children,l,o,t);case Ve:i=8,l|=8;break;case ut:return e=st(12,n,t,l|2),e.elementType=ut,e.lanes=o,e;case Ue:return e=st(13,n,t,l),e.elementType=Ue,e.lanes=o,e;case Be:return e=st(19,n,t,l),e.elementType=Be,e.lanes=o,e;case Z:return El(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case at:i=10;break e;case St:i=9;break e;case tt:i=11;break e;case Je:i=14;break e;case _:i=16,r=null;break e}throw Error(p(130,e==null?e:typeof e,""))}return t=st(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function an(e,t,n,r){return e=st(7,e,r,t),e.lanes=n,e}function El(e,t,n,r){return e=st(22,e,r,t),e.elementType=Z,e.lanes=n,e.stateNode={isHidden:!1},e}function Si(e,t,n){return e=st(6,e,null,t),e.lanes=n,e}function Ni(e,t,n){return t=st(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Td(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=Jl(0),this.expirationTimes=Jl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function _i(e,t,n,r,l,o,i,u,a){return e=new Td(e,t,n,u,a),t===1?(t=1,o===!0&&(t|=8)):t=0,o=st(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Io(o),e}function Ld(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(g)}catch(w){console.error(w)}}return g(),Li.exports=Bd(),Li.exports}var Oa;function Wd(){if(Oa)return Fl;Oa=1;var g=Hd();return Fl.createRoot=g.createRoot,Fl.hydrateRoot=g.hydrateRoot,Fl}var Qd=Wd();const Kd=Ua(Qd),cn="/api",je={async get(g){const w=await fetch(`${cn}${g}`);if(!w.ok){const T=(await w.json().catch(()=>null))?.error||w.statusText;throw new Error(T)}return w.json()},async post(g,w){const p=await fetch(`${cn}${g}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!p.ok){const z=(await p.json().catch(()=>null))?.error||p.statusText;throw new Error(z)}return p.json()},async delete(g){const w=await fetch(`${cn}${g}`,{method:"DELETE"});if(!w.ok){const T=(await w.json().catch(()=>null))?.error||w.statusText;throw new Error(T)}return w.json()},async uploadFile(g,w){const p=new FormData;p.append("file",w);const T=await fetch(`${cn}${g}`,{method:"POST",body:p});if(!T.ok){const A=(await T.json().catch(()=>null))?.error||T.statusText;throw new Error(A)}return T.json()}},Ia={async getMe(){return je.get("/auth/me")},async logout(){return je.post("/auth/logout")}},Pe={async list(){return je.get("/jobs")},async get(g){return je.get(`/jobs/${g}`)},async create(g){return je.post("/jobs",g)},async cancel(g){return je.delete(`/jobs/${g}`)},async uploadFile(g,w){return je.uploadFile(`/jobs/${g}/upload`,w)},async getFiles(g){return je.get(`/jobs/${g}/files`)},async downloadFile(g,w){return`${cn}/jobs/${g}/files/${w}/download`},async getVideoUrl(g){return`${cn}/jobs/${g}/video`},async getTaskLogs(g,w,p={}){const T=new URLSearchParams;p.stepName&&T.append("step_name",p.stepName),p.logLevel&&T.append("log_level",p.logLevel),p.limit&&T.append("limit",p.limit.toString());const z=T.toString();return je.get(`/jobs/${g}/tasks/${w}/logs${z?"?"+z:""}`)},async getTaskSteps(g,w){return je.get(`/jobs/${g}/tasks/${w}/steps`)},streamTaskLogsWebSocket(g,w,p=0){const T=window.location.protocol==="https:"?"wss:":"ws:",z=window.location.host,A=`${T}//${z}${cn}/jobs/${g}/tasks/${w}/logs/ws?last_id=${p}`;return new WebSocket(A)},async retryTask(g,w){return je.post(`/jobs/${g}/tasks/${w}/retry`)},async getMetadata(g){return je.get(`/jobs/${g}/metadata`)},async getTasks(g){return je.get(`/jobs/${g}/tasks`)}},Yd={async list(){return je.get("/runners")}},On={async generateToken(g){return je.post("/admin/runners/tokens",{expires_in_hours:g})},async listTokens(){return je.get("/admin/runners/tokens")},async revokeToken(g){return je.delete(`/admin/runners/tokens/${g}`)},async listRunners(){return je.get("/admin/runners")},async verifyRunner(g){return je.post(`/admin/runners/${g}/verify`)},async deleteRunner(g){return je.delete(`/admin/runners/${g}`)}};function Aa(){const[g,w]=B.useState(null),[p,T]=B.useState(!0);B.useEffect(()=>{z()},[]);const z=async()=>{try{const D=await Ia.getMe();w(D)}catch{w(null)}finally{T(!1)}};return{user:g,loading:p,logout:async()=>{try{await Ia.logout()}catch(D){console.error("Logout error:",D)}finally{w(null)}},refresh:z}}function Gd(){return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-purple-600 via-blue-600 to-indigo-700",children:s.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-8 w-full max-w-md",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("h1",{className:"text-4xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-purple-600 to-blue-600 mb-2",children:"Fuego"}),s.jsx("p",{className:"text-gray-600 text-lg",children:"Blender Render Farm"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("a",{href:"/api/auth/google/login",className:"w-full flex items-center justify-center gap-3 bg-white border-2 border-gray-300 text-gray-700 font-semibold py-3 px-6 rounded-lg hover:bg-gray-50 hover:border-gray-400 transition-all duration-200 shadow-sm",children:[s.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[s.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),s.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),s.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),s.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Continue with Google"]}),s.jsxs("a",{href:"/api/auth/discord/login",className:"w-full flex items-center justify-center gap-3 bg-[#5865F2] text-white font-semibold py-3 px-6 rounded-lg hover:bg-[#4752C4] transition-all duration-200 shadow-lg",children:[s.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0a12.64 12.64 0 0 0-.617-1.25a.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.078.078 0 0 0 .084-.028a14.09 14.09 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13.107 13.107 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10.2 10.2 0 0 0 .372-.292a.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127a12.299 12.299 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028a19.839 19.839 0 0 0 6.002-3.03a.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418z"})}),"Continue with Discord"]})]})]})})}function Jd({children:g,activeTab:w,onTabChange:p}){const{user:T,logout:z}=Aa(),A=T?.is_admin||!1;return s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx("header",{className:"bg-white shadow-sm border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsx("h1",{className:"text-2xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-purple-600 to-blue-600",children:"Fuego"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-gray-700",children:T?.name||T?.email}),s.jsx("button",{onClick:z,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:"Logout"})]})]})})}),s.jsx("nav",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex space-x-8",children:[s.jsx("button",{onClick:()=>p("jobs"),className:`py-4 px-1 border-b-2 font-medium text-sm transition-colors ${w==="jobs"?"border-purple-600 text-purple-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Jobs"}),s.jsx("button",{onClick:()=>p("submit"),className:`py-4 px-1 border-b-2 font-medium text-sm transition-colors ${w==="submit"?"border-purple-600 text-purple-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Submit Job"}),s.jsx("button",{onClick:()=>p("runners"),className:`py-4 px-1 border-b-2 font-medium text-sm transition-colors ${w==="runners"?"border-purple-600 text-purple-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Runners"}),A&&s.jsx("button",{onClick:()=>p("admin"),className:`py-4 px-1 border-b-2 font-medium text-sm transition-colors ${w==="admin"?"border-purple-600 text-purple-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"Admin"})]})})}),s.jsx("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:g})]})}function Xd({videoUrl:g,onClose:w}){const p=B.useRef(null),[T,z]=B.useState(!0),[A,D]=B.useState(null);return B.useEffect(()=>{const V=p.current;if(!V)return;const H=()=>{z(!1)},M=()=>{D("Failed to load video"),z(!1)};return V.addEventListener("canplay",H),V.addEventListener("error",M),()=>{V.removeEventListener("canplay",H),V.removeEventListener("error",M)}},[g]),A?s.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-red-700",children:A}):s.jsxs("div",{className:"relative bg-black rounded-lg overflow-hidden",children:[T&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black bg-opacity-50",children:s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-white"})}),s.jsx("video",{ref:p,src:g,controls:!0,className:"w-full",onLoadedData:()=>z(!1),children:"Your browser does not support the video tag."})]})}function Zd({job:g,onClose:w,onUpdate:p}){const[T,z]=B.useState(g),[A,D]=B.useState([]),[V,H]=B.useState([]),[M,J]=B.useState(!0),[W,q]=B.useState(null),[X,Ne]=B.useState(null),[oe,b]=B.useState([]),[te,de]=B.useState([]),[ue,me]=B.useState(!1),E=B.useRef(null);B.useEffect(()=>{Q();const _=setInterval(Q,2e3);return()=>{clearInterval(_),E.current&&E.current.close()}},[g.id]),B.useEffect(()=>(X&&T.status==="running"?ut():E.current&&(E.current.close(),E.current=null,me(!1)),()=>{E.current&&(E.current.close(),E.current=null)}),[X,T.status]);const Q=async()=>{try{const[_,Z,N]=await Promise.all([Pe.get(g.id),Pe.getFiles(g.id),Pe.getTasks(g.id)]);z(_),D(Z),H(N),Z.find(C=>C.file_type==="output"&&C.file_name.endsWith(".mp4"))&&q(Pe.getVideoUrl(g.id))}catch(_){console.error("Failed to load job details:",_)}finally{J(!1)}},he=(_,Z)=>{window.open(Pe.downloadFile(g.id,_),"_blank")},Ve=async _=>{try{const[Z,N]=await Promise.all([Pe.getTaskLogs(g.id,_),Pe.getTaskSteps(g.id,_)]);b(Z),de(N)}catch(Z){console.error("Failed to load task logs:",Z)}},ut=()=>{if(!X||ue)return;me(!0);const _=Pe.streamTaskLogsWebSocket(g.id,X);E.current=_,_.onmessage=Z=>{try{const N=JSON.parse(Z.data);N.type==="log"&&N.data?b(O=>[...O,N.data]):N.type}catch(N){console.error("Failed to parse log message:",N)}},_.onerror=Z=>{console.error("WebSocket error:",Z),me(!1)},_.onclose=()=>{me(!1),T.status==="running"&&X&&setTimeout(()=>{T.status==="running"&&ut()},2e3)}},at=async _=>{Ne(_),await Ve(_)},St=_=>{switch(_){case"ERROR":return"text-red-600";case"WARN":return"text-yellow-600";case"DEBUG":return"text-gray-500";default:return"text-gray-900"}},tt=_=>{switch(_){case"completed":return"✓";case"failed":return"✗";case"running":return"⏳";case"skipped":return"⏸";default:return"○"}},Ue=_=>({pending:"bg-yellow-100 text-yellow-800",running:"bg-blue-100 text-blue-800",completed:"bg-green-100 text-green-800",failed:"bg-red-100 text-red-800"})[_]||"bg-gray-100 text-gray-800",Be=A.filter(_=>_.file_type==="output"),Je=A.filter(_=>_.file_type==="input");return s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[90vh] overflow-y-auto",children:[s.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex justify-between items-center",children:[s.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:T.name}),s.jsx("button",{onClick:w,className:"text-gray-400 hover:text-gray-600 text-2xl font-bold",children:"×"})]}),s.jsxs("div",{className:"p-6 space-y-6",children:[M&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600"})}),!M&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-gray-600",children:"Status"}),s.jsx("p",{className:"font-semibold text-gray-900",children:T.status})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-gray-600",children:"Progress"}),s.jsxs("p",{className:"font-semibold text-gray-900",children:[T.progress.toFixed(1),"%"]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-gray-600",children:"Frame Range"}),s.jsxs("p",{className:"font-semibold text-gray-900",children:[T.frame_start," - ",T.frame_end]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-gray-600",children:"Output Format"}),s.jsx("p",{className:"font-semibold text-gray-900",children:T.output_format})]})]}),W&&T.output_format==="MP4"&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Video Preview"}),s.jsx(Xd,{videoUrl:W})]}),Be.length>0&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Output Files"}),s.jsx("div",{className:"space-y-2",children:Be.map(_=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-gray-900",children:_.file_name}),s.jsxs("p",{className:"text-sm text-gray-600",children:[(_.file_size/1024/1024).toFixed(2)," MB"]})]}),s.jsx("button",{onClick:()=>he(_.id,_.file_name),className:"px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors",children:"Download"})]},_.id))})]}),Je.length>0&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Input Files"}),s.jsx("div",{className:"space-y-2",children:Je.map(_=>s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg",children:[s.jsx("p",{className:"font-medium text-gray-900",children:_.file_name}),s.jsxs("p",{className:"text-sm text-gray-600",children:[(_.file_size/1024/1024).toFixed(2)," MB"]})]},_.id))})]}),T.error_message&&s.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-red-700",children:[s.jsx("p",{className:"font-semibold",children:"Error:"}),s.jsx("p",{children:T.error_message})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Tasks"}),s.jsxs("div",{className:"space-y-4",children:[V.length>0&&s.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 mb-4",children:[s.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Task List"}),s.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:V.map(_=>s.jsxs("div",{onClick:()=>at(_.id),className:`flex items-center justify-between p-3 bg-white rounded cursor-pointer hover:bg-gray-100 transition-colors ${X===_.id?"ring-2 ring-purple-600":""}`,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${Ue(_.status)}`,children:_.status}),s.jsxs("span",{className:"font-medium text-gray-900",children:["Frame ",_.frame_start,_.frame_end!==_.frame_start?`-${_.frame_end}`:""]}),_.task_type&&_.task_type!=="render"&&s.jsxs("span",{className:"text-xs text-gray-500",children:["(",_.task_type,")"]})]}),s.jsx("div",{className:"text-sm text-gray-600",children:_.runner_id&&`Runner ${_.runner_id}`})]},_.id))})]}),te.length>0&&s.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[s.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Steps"}),s.jsx("div",{className:"space-y-2",children:te.map(_=>s.jsxs("div",{className:"flex items-center justify-between p-2 bg-white rounded",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:tt(_.status)}),s.jsx("span",{className:"font-medium",children:_.step_name})]}),_.duration_ms&&s.jsxs("span",{className:"text-sm text-gray-600",children:[(_.duration_ms/1e3).toFixed(2),"s"]})]},_.id))})]}),X&&s.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[s.jsxs("h4",{className:"font-medium text-gray-900 mb-2",children:["Logs ",ue&&s.jsx("span",{className:"text-sm text-green-600",children:"(streaming)"})]}),s.jsx("div",{className:"bg-black text-green-400 font-mono text-sm p-3 rounded max-h-96 overflow-y-auto",children:oe.length===0?s.jsx("p",{className:"text-gray-500",children:"No logs yet..."}):oe.map(_=>s.jsxs("div",{className:`${St(_.log_level)} mb-1`,children:[s.jsxs("span",{className:"text-gray-500",children:["[",new Date(_.created_at).toLocaleTimeString(),"]"]}),_.step_name&&s.jsxs("span",{className:"text-blue-400 ml-2",children:["[",_.step_name,"]"]}),s.jsx("span",{className:"ml-2",children:_.message})]},_.id))})]}),!X&&s.jsx("p",{className:"text-gray-600 text-sm",children:"Select a task to view logs and steps"})]})]})]})]})]})})}function qd(){const[g,w]=B.useState([]),[p,T]=B.useState(!0),[z,A]=B.useState(null);B.useEffect(()=>{D();const M=setInterval(D,5e3);return()=>clearInterval(M)},[]);const D=async()=>{try{const M=await Pe.list();w(M)}catch(M){console.error("Failed to load jobs:",M)}finally{T(!1)}},V=async M=>{if(confirm("Are you sure you want to cancel this job?"))try{await Pe.cancel(M),D()}catch(J){alert("Failed to cancel job: "+J.message)}},H=M=>{const J={pending:"bg-yellow-100 text-yellow-800",running:"bg-blue-100 text-blue-800",completed:"bg-green-100 text-green-800",failed:"bg-red-100 text-red-800",cancelled:"bg-gray-100 text-gray-800"};return J[M]||J.pending};return p?s.jsx("div",{className:"flex justify-center items-center h-64",children:s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600"})}):g.length===0?s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-gray-500 text-lg",children:"No jobs yet. Submit a job to get started!"})}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:g.map(M=>s.jsxs("div",{className:"bg-white rounded-lg shadow-md hover:shadow-lg transition-shadow p-6 border-l-4 border-purple-600",children:[s.jsxs("div",{className:"flex justify-between items-start mb-4",children:[s.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:M.name}),s.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${H(M.status)}`,children:M.status})]}),s.jsxs("div",{className:"space-y-2 text-sm text-gray-600 mb-4",children:[s.jsxs("p",{children:["Frames: ",M.frame_start," - ",M.frame_end]}),s.jsxs("p",{children:["Format: ",M.output_format]}),s.jsxs("p",{children:["Created: ",new Date(M.created_at).toLocaleString()]})]}),s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex justify-between text-xs text-gray-600 mb-1",children:[s.jsx("span",{children:"Progress"}),s.jsxs("span",{children:[M.progress.toFixed(1),"%"]})]}),s.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:s.jsx("div",{className:"bg-purple-600 h-2 rounded-full transition-all duration-300",style:{width:`${M.progress}%`}})})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>A(M),className:"flex-1 px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors font-medium",children:"View Details"}),(M.status==="pending"||M.status==="running")&&s.jsx("button",{onClick:()=>V(M.id),className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition-colors font-medium",children:"Cancel"})]})]},M.id))}),z&&s.jsx(Zd,{job:z,onClose:()=>A(null),onUpdate:D})]})}function bd({onSuccess:g}){const[w,p]=B.useState({name:"",frame_start:1,frame_end:10,output_format:"PNG",allow_parallel_runners:!0}),[T,z]=B.useState(null),[A,D]=B.useState(!1),[V,H]=B.useState(""),[M,J]=B.useState(null),[W,q]=B.useState(null),[X,Ne]=B.useState(null);B.useEffect(()=>{if(!X||M!=="extracting")return;let te=0;const de=30;let ue=null;const E=setInterval(async()=>{if(te++,te>de){J("error");try{await Pe.cancel(X)}catch{}return}try{const Q=await Pe.getMetadata(X);Q&&(q(Q),J("completed"),p(he=>({...he,frame_start:Q.frame_start||he.frame_start,frame_end:Q.frame_end||he.frame_end,output_format:Q.render_settings?.output_format||he.output_format})))}catch(Q){Q.message.includes("404")||Q.message.includes("not found")||J("error")}},2e3);return ue=setTimeout(()=>{clearInterval(E),M==="extracting"&&(J("error"),Pe.cancel(X).catch(()=>{}))},6e4),()=>{clearInterval(E),ue&&clearTimeout(ue),X&&M==="extracting"&&Pe.cancel(X).catch(()=>{})}},[X,M]);const oe=async te=>{const de=te.target.files[0];if(!de){z(null);return}if(z(de),J(null),q(null),Ne(null),de.name.toLowerCase().endsWith(".blend"))try{const ue=await Pe.create({name:"Metadata Extraction",frame_start:1,frame_end:10,output_format:"PNG",allow_parallel_runners:!0});Ne(ue.id),J("extracting"),await Pe.uploadFile(ue.id,de)}catch(ue){console.error("Failed to start metadata extraction:",ue),J("error")}},b=async te=>{te.preventDefault(),H(""),D(!0);try{if(!T)throw new Error("Please select a Blender file");if(w.frame_start<0||w.frame_endp({...w,name:te.target.value}),required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-600 focus:border-transparent",placeholder:"My Render Job"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Frame Start"}),s.jsx("input",{type:"number",value:w.frame_start,onChange:te=>p({...w,frame_start:te.target.value}),required:!0,min:"0",className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-600 focus:border-transparent"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Frame End"}),s.jsx("input",{type:"number",value:w.frame_end,onChange:te=>p({...w,frame_end:te.target.value}),required:!0,min:w.frame_start,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-600 focus:border-transparent"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Output Format"}),s.jsxs("select",{value:w.output_format,onChange:te=>p({...w,output_format:te.target.value}),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-600 focus:border-transparent",children:[s.jsx("option",{value:"PNG",children:"PNG"}),s.jsx("option",{value:"JPEG",children:"JPEG"}),s.jsx("option",{value:"EXR",children:"EXR"}),s.jsx("option",{value:"MP4",children:"MP4"})]})]}),s.jsxs("div",{className:"flex items-center",children:[s.jsx("input",{type:"checkbox",id:"allow_parallel_runners",checked:w.allow_parallel_runners,onChange:te=>p({...w,allow_parallel_runners:te.target.checked}),className:"h-4 w-4 text-purple-600 focus:ring-purple-500 border-gray-300 rounded"}),s.jsx("label",{htmlFor:"allow_parallel_runners",className:"ml-2 block text-sm text-gray-700",children:"Allow multiple runners to work on this job simultaneously"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Blender File (.blend)"}),s.jsx("input",{type:"file",accept:".blend",onChange:oe,required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-600 focus:border-transparent file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-purple-50 file:text-purple-700 hover:file:bg-purple-100"}),M==="extracting"&&s.jsx("div",{className:"mt-2 p-3 bg-blue-50 border border-blue-200 rounded-lg text-blue-700 text-sm",children:"Extracting metadata from blend file..."}),M==="completed"&&W&&s.jsxs("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-lg text-sm",children:[s.jsx("div",{className:"text-green-700 font-semibold mb-1",children:"Metadata extracted successfully!"}),s.jsxs("div",{className:"text-green-600 text-xs space-y-1",children:[s.jsxs("div",{children:["Frames: ",W.frame_start," - ",W.frame_end]}),s.jsxs("div",{children:["Resolution: ",W.render_settings?.resolution_x," x ",W.render_settings?.resolution_y]}),s.jsxs("div",{children:["Engine: ",W.render_settings?.engine]}),s.jsxs("div",{children:["Samples: ",W.render_settings?.samples]}),s.jsx("div",{className:"text-gray-600 mt-2",children:"Form fields have been auto-populated. You can adjust them if needed."}),(w.frame_startW.frame_end)&&s.jsxs("div",{className:"mt-2 p-2 bg-yellow-50 border border-yellow-200 rounded text-yellow-800 text-xs",children:[s.jsx("strong",{children:"Warning:"})," Your frame range (",w.frame_start,"-",w.frame_end,") exceeds the blend file's range (",W.frame_start,"-",W.frame_end,"). This may cause errors."]})]})]}),M==="error"&&s.jsx("div",{className:"mt-2 p-3 bg-yellow-50 border border-yellow-200 rounded-lg text-yellow-700 text-sm",children:"Could not extract metadata. Please fill in the form manually."})]}),s.jsx("button",{type:"submit",disabled:A,className:"w-full px-6 py-3 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors font-semibold disabled:opacity-50 disabled:cursor-not-allowed",children:A?"Submitting...":"Submit Job"})]})]})}function ef(){const[g,w]=B.useState([]),[p,T]=B.useState(!0);B.useEffect(()=>{z();const D=setInterval(z,5e3);return()=>clearInterval(D)},[]);const z=async()=>{try{const D=await Yd.list();w(D)}catch(D){console.error("Failed to load runners:",D)}finally{T(!1)}},A=D=>{const V=new Date,H=new Date(D);return V-H<6e4};return p?s.jsx("div",{className:"flex justify-center items-center h-64",children:s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600"})}):g.length===0?s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-gray-500 text-lg",children:"No runners connected."})}):s.jsx("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:g.map(D=>{const V=A(D.last_heartbeat);return s.jsxs("div",{className:"bg-white rounded-lg shadow-md hover:shadow-lg transition-shadow p-6 border-l-4 border-green-500",children:[s.jsxs("div",{className:"flex justify-between items-start mb-4",children:[s.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:D.name}),s.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${V?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:V?"Online":"Offline"})]}),s.jsxs("div",{className:"space-y-2 text-sm text-gray-600",children:[s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Hostname:"})," ",D.hostname]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"IP:"})," ",D.ip_address]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Last heartbeat:"})," ",new Date(D.last_heartbeat).toLocaleString()]}),D.capabilities&&s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Capabilities:"})," ",D.capabilities]})]})]},D.id)})})}function tf(){const[g,w]=B.useState("tokens"),[p,T]=B.useState([]),[z,A]=B.useState([]),[D,V]=B.useState(!1),[H,M]=B.useState(24),[J,W]=B.useState(null);B.useEffect(()=>{g==="tokens"?q():g==="runners"&&X()},[g]);const q=async()=>{V(!0);try{const E=await On.listTokens();T(E)}catch(E){console.error("Failed to load tokens:",E),alert("Failed to load tokens")}finally{V(!1)}},X=async()=>{V(!0);try{const E=await On.listRunners();A(E)}catch(E){console.error("Failed to load runners:",E),alert("Failed to load runners")}finally{V(!1)}},Ne=async()=>{V(!0);try{const E=await On.generateToken(H);W(E.token),await q()}catch(E){console.error("Failed to generate token:",E),alert("Failed to generate token")}finally{V(!1)}},oe=async E=>{if(confirm("Are you sure you want to revoke this token?"))try{await On.revokeToken(E),await q()}catch(Q){console.error("Failed to revoke token:",Q),alert("Failed to revoke token")}},b=async E=>{try{await On.verifyRunner(E),await X(),alert("Runner verified")}catch(Q){console.error("Failed to verify runner:",Q),alert("Failed to verify runner")}},te=async E=>{if(confirm("Are you sure you want to delete this runner?"))try{await On.deleteRunner(E),await X()}catch(Q){console.error("Failed to delete runner:",Q),alert("Failed to delete runner")}},de=E=>{navigator.clipboard.writeText(E),alert("Copied to clipboard!")},ue=E=>new Date(E)E;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex space-x-4 border-b border-gray-200",children:[s.jsx("button",{onClick:()=>w("tokens"),className:`py-2 px-4 border-b-2 font-medium ${g==="tokens"?"border-purple-600 text-purple-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"Registration Tokens"}),s.jsx("button",{onClick:()=>w("runners"),className:`py-2 px-4 border-b-2 font-medium ${g==="runners"?"border-purple-600 text-purple-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"Runner Management"})]}),g==="tokens"&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6",children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Generate Registration Token"}),s.jsxs("div",{className:"flex gap-4 items-end",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Expires in (hours)"}),s.jsx("input",{type:"number",min:"1",max:"168",value:H,onChange:E=>M(parseInt(E.target.value)||24),className:"w-32 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-600 focus:border-transparent"})]}),s.jsx("button",{onClick:Ne,disabled:D,className:"px-6 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Generate Token"})]}),J&&s.jsxs("div",{className:"mt-4 p-4 bg-green-50 border border-green-200 rounded-lg",children:[s.jsx("p",{className:"text-sm font-medium text-green-800 mb-2",children:"New Token Generated:"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"flex-1 px-3 py-2 bg-white border border-green-300 rounded text-sm font-mono break-all",children:J}),s.jsx("button",{onClick:()=>de(J),className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 transition-colors text-sm",children:"Copy"})]}),s.jsx("p",{className:"text-xs text-green-700 mt-2",children:"Save this token securely. It will not be shown again."})]})]}),s.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6",children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Active Tokens"}),D?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600"})}):p.length===0?s.jsx("p",{className:"text-gray-500 text-center py-8",children:"No tokens generated yet."}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[s.jsx("thead",{className:"bg-gray-50",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Token"}),s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Expires At"}),s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Created At"}),s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),s.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:p.map(E=>{const Q=ue(E.expires_at),he=me(E.used);return s.jsxs("tr",{children:[s.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:s.jsxs("code",{className:"text-sm font-mono text-gray-900",children:[E.token.substring(0,16),"..."]})}),s.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:Q?s.jsx("span",{className:"px-2 py-1 text-xs font-medium rounded-full bg-red-100 text-red-800",children:"Expired"}):he?s.jsx("span",{className:"px-2 py-1 text-xs font-medium rounded-full bg-yellow-100 text-yellow-800",children:"Used"}):s.jsx("span",{className:"px-2 py-1 text-xs font-medium rounded-full bg-green-100 text-green-800",children:"Active"})}),s.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:new Date(E.expires_at).toLocaleString()}),s.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:new Date(E.created_at).toLocaleString()}),s.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:!he&&!Q&&s.jsx("button",{onClick:()=>oe(E.id),className:"text-red-600 hover:text-red-800 font-medium",children:"Revoke"})})]},E.id)})})]})})]})]}),g==="runners"&&s.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6",children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Runner Management"}),D?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600"})}):z.length===0?s.jsx("p",{className:"text-gray-500 text-center py-8",children:"No runners registered."}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[s.jsx("thead",{className:"bg-gray-50",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Name"}),s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Hostname"}),s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Verified"}),s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Last Heartbeat"}),s.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),s.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:z.map(E=>{const Q=new Date(E.last_heartbeat)>new Date(Date.now()-6e4);return s.jsxs("tr",{children:[s.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:E.name}),s.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:E.hostname}),s.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:s.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded-full ${Q?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:Q?"Online":"Offline"})}),s.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:s.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded-full ${E.verified?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:E.verified?"Verified":"Unverified"})}),s.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:new Date(E.last_heartbeat).toLocaleString()}),s.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm space-x-2",children:[!E.verified&&s.jsx("button",{onClick:()=>b(E.id),className:"text-blue-600 hover:text-blue-800 font-medium",children:"Verify"}),s.jsx("button",{onClick:()=>te(E.id),className:"text-red-600 hover:text-red-800 font-medium",children:"Delete"})]})]},E.id)})})]})})]})]})}function nf(){const{user:g,loading:w}=Aa(),[p,T]=B.useState("jobs");return w?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600"})}):g?s.jsxs(Jd,{activeTab:p,onTabChange:T,children:[p==="jobs"&&s.jsx(qd,{}),p==="submit"&&s.jsx(bd,{onSuccess:()=>T("jobs")}),p==="runners"&&s.jsx(ef,{}),p==="admin"&&s.jsx(tf,{})]}):s.jsx(Gd,{})}Kd.createRoot(document.getElementById("root")).render(s.jsx(Ad.StrictMode,{children:s.jsx(nf,{})}));