const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StatsWindow-CIRZXtNg.js","assets/react-yfL0ty4i.js","assets/CharacterWindow-DB25PGyW.js","assets/InventoryWindow-CsRCfFA4.js","assets/RadarWindow-BWeCin-b.js","assets/CombatStatsWindow-DSDCf8zG.js","assets/CombatPickerWindow-EVVSrp8z.js","assets/IssuesWindow-B7wMTxUh.js","assets/VitalSharingWindow-Cr06Ao6f.js","assets/QuestStatusWindow-BZVZJ6b0.js","assets/AgentWindow-D4IwDfCh.js","assets/AdminUsersWindow-CjCV57tE.js"])))=>i.map(i=>d[i]); import{r as Nd,g as fh,a as sh}from"./react-yfL0ty4i.js";(function(){const p=document.createElement("link").relList;if(p&&p.supports&&p.supports("modulepreload"))return;for(const M of document.querySelectorAll('link[rel="modulepreload"]'))o(M);new MutationObserver(M=>{for(const U of M)if(U.type==="childList")for(const j of U.addedNodes)j.tagName==="LINK"&&j.rel==="modulepreload"&&o(j)}).observe(document,{childList:!0,subtree:!0});function A(M){const U={};return M.integrity&&(U.integrity=M.integrity),M.referrerPolicy&&(U.referrerPolicy=M.referrerPolicy),M.crossOrigin==="use-credentials"?U.credentials="include":M.crossOrigin==="anonymous"?U.credentials="omit":U.credentials="same-origin",U}function o(M){if(M.ep)return;M.ep=!0;const U=A(M);fetch(M.href,U)}})();var of={exports:{}},Sn={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var bd;function oh(){if(bd)return Sn;bd=1;var f=Symbol.for("react.transitional.element"),p=Symbol.for("react.fragment");function A(o,M,U){var j=null;if(U!==void 0&&(j=""+U),M.key!==void 0&&(j=""+M.key),"key"in M){U={};for(var O in M)O!=="key"&&(U[O]=M[O])}else U=M;return M=U.ref,{$$typeof:f,type:o,key:j,ref:M!==void 0?M:null,props:U}}return Sn.Fragment=p,Sn.jsx=A,Sn.jsxs=A,Sn}var pd;function rh(){return pd||(pd=1,of.exports=oh()),of.exports}var d=rh(),x=Nd();const pn=fh(x);var rf={exports:{}},bn={},df={exports:{}},mf={};/** * @license React * scheduler.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var zd;function dh(){return zd||(zd=1,(function(f){function p(S,R){var G=S.length;S.push(R);l:for(;0>>1,Y=S[H];if(0>>1;HM(I,G))RlM(_t,I)?(S[H]=_t,S[Rl]=G,H=Rl):(S[H]=I,S[ol]=G,H=ol);else if(RlM(_t,G))S[H]=_t,S[Rl]=G,H=Rl;else break l}}return R}function M(S,R){var G=S.sortIndex-R.sortIndex;return G!==0?G:S.id-R.id}if(f.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var U=performance;f.unstable_now=function(){return U.now()}}else{var j=Date,O=j.now();f.unstable_now=function(){return j.now()-O}}var h=[],_=[],B=1,y=null,N=3,C=!1,Q=!1,P=!1,fl=!1,Sl=typeof setTimeout=="function"?setTimeout:null,J=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function Ml(S){for(var R=A(_);R!==null;){if(R.callback===null)o(_);else if(R.startTime<=S)o(_),R.sortIndex=R.expirationTime,p(h,R);else break;R=A(_)}}function Vl(S){if(P=!1,Ml(S),!Q)if(A(h)!==null)Q=!0,F||(F=!0,xl());else{var R=A(_);R!==null&&bt(Vl,R.startTime-S)}}var F=!1,ll=-1,V=5,K=-1;function W(){return fl?!0:!(f.unstable_now()-KS&&W());){var H=y.callback;if(typeof H=="function"){y.callback=null,N=y.priorityLevel;var Y=H(y.expirationTime<=S);if(S=f.unstable_now(),typeof Y=="function"){y.callback=Y,Ml(S),R=!0;break t}y===A(h)&&o(h),Ml(S)}else o(h);y=A(h)}if(y!==null)R=!0;else{var sl=A(_);sl!==null&&bt(Vl,sl.startTime-S),R=!1}}break l}finally{y=null,N=G,C=!1}R=void 0}}finally{R?xl():F=!1}}}var xl;if(typeof w=="function")xl=function(){w(Ul)};else if(typeof MessageChannel<"u"){var jt=new MessageChannel,Tt=jt.port2;jt.port1.onmessage=Ul,xl=function(){Tt.postMessage(null)}}else xl=function(){Sl(Ul,0)};function bt(S,R){ll=Sl(function(){S(f.unstable_now())},R)}f.unstable_IdlePriority=5,f.unstable_ImmediatePriority=1,f.unstable_LowPriority=4,f.unstable_NormalPriority=3,f.unstable_Profiling=null,f.unstable_UserBlockingPriority=2,f.unstable_cancelCallback=function(S){S.callback=null},f.unstable_forceFrameRate=function(S){0>S||125H?(S.sortIndex=G,p(_,S),A(h)===null&&S===A(_)&&(P?(J(ll),ll=-1):P=!0,bt(Vl,G-H))):(S.sortIndex=Y,p(h,S),Q||C||(Q=!0,F||(F=!0,xl()))),S},f.unstable_shouldYield=W,f.unstable_wrapCallback=function(S){var R=N;return function(){var G=N;N=R;try{return S.apply(this,arguments)}finally{N=G}}}})(mf)),mf}var xd;function mh(){return xd||(xd=1,df.exports=dh()),df.exports}/** * @license React * react-dom-client.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ad;function hh(){if(Ad)return bn;Ad=1;var f=mh(),p=Nd(),A=sh();function o(l){var t="https://react.dev/errors/"+l;if(1Y||(l.current=H[Y],H[Y]=null,Y--)}function I(l,t){Y++,H[Y]=l.current,l.current=t}var Rl=sl(null),_t=sl(null),Wt=sl(null),An=sl(null);function Tn(l,t){switch(I(Wt,t),I(_t,l),I(Rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?Vr(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=Vr(t),l=Zr(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}ol(Rl),I(Rl,l)}function Ga(){ol(Rl),ol(_t),ol(Wt)}function Lu(l){l.memoizedState!==null&&I(An,l);var t=Rl.current,a=Zr(t,l.type);t!==a&&(I(_t,l),I(Rl,a))}function _n(l){_t.current===l&&(ol(Rl),ol(_t)),An.current===l&&(ol(An),hn._currentValue=G)}var Ku,gf;function za(l){if(Ku===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Ku=t&&t[1]||"",gf=-1)":-1n||s[e]!==g[n]){var T=` `+s[e].replace(" at new "," at ");return l.displayName&&T.includes("")&&(T=T.replace("",l.displayName)),T}while(1<=e&&0<=n);break}}}finally{Ju=!1,Error.prepareStackTrace=a}return(a=l?l.displayName||l.name:"")?za(a):""}function Xd(l,t){switch(l.tag){case 26:case 27:case 5:return za(l.type);case 16:return za("Lazy");case 13:return l.child!==t&&t!==null?za("Suspense Fallback"):za("Suspense");case 19:return za("SuspenseList");case 0:case 15:return wu(l.type,!1);case 11:return wu(l.type.render,!1);case 1:return wu(l.type,!0);case 31:return za("Activity");default:return""}}function Sf(l){try{var t="",a=null;do t+=Xd(l,a),a=l,l=l.return;while(l);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var ku=Object.prototype.hasOwnProperty,Wu=f.unstable_scheduleCallback,$u=f.unstable_cancelCallback,Gd=f.unstable_shouldYield,Qd=f.unstable_requestPaint,Fl=f.unstable_now,Vd=f.unstable_getCurrentPriorityLevel,bf=f.unstable_ImmediatePriority,pf=f.unstable_UserBlockingPriority,En=f.unstable_NormalPriority,Zd=f.unstable_LowPriority,zf=f.unstable_IdlePriority,Ld=f.log,Kd=f.unstable_setDisableYieldValue,_e=null,Il=null;function $t(l){if(typeof Ld=="function"&&Kd(l),Il&&typeof Il.setStrictMode=="function")try{Il.setStrictMode(_e,l)}catch{}}var Pl=Math.clz32?Math.clz32:kd,Jd=Math.log,wd=Math.LN2;function kd(l){return l>>>=0,l===0?32:31-(Jd(l)/wd|0)|0}var Mn=256,Dn=262144,Nn=4194304;function xa(l){var t=l&42;if(t!==0)return t;switch(l&-l){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function jn(l,t,a){var e=l.pendingLanes;if(e===0)return 0;var n=0,u=l.suspendedLanes,c=l.pingedLanes;l=l.warmLanes;var i=e&134217727;return i!==0?(e=i&~u,e!==0?n=xa(e):(c&=i,c!==0?n=xa(c):a||(a=i&~l,a!==0&&(n=xa(a))))):(i=e&~u,i!==0?n=xa(i):c!==0?n=xa(c):a||(a=e&~l,a!==0&&(n=xa(a)))),n===0?0:t!==0&&t!==n&&(t&u)===0&&(u=n&-n,a=t&-t,u>=a||u===32&&(a&4194048)!==0)?t:n}function Ee(l,t){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&t)===0}function Wd(l,t){switch(l){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xf(){var l=Nn;return Nn<<=1,(Nn&62914560)===0&&(Nn=4194304),l}function Fu(l){for(var t=[],a=0;31>a;a++)t.push(l);return t}function Me(l,t){l.pendingLanes|=t,t!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function $d(l,t,a,e,n,u){var c=l.pendingLanes;l.pendingLanes=a,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=a,l.entangledLanes&=a,l.errorRecoveryDisabledLanes&=a,l.shellSuspendCounter=0;var i=l.entanglements,s=l.expirationTimes,g=l.hiddenUpdates;for(a=c&~a;0"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var am=/[\n"\\]/g;function ft(l){return l.replace(am,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ec(l,t,a,e,n,u,c,i){l.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?l.type=c:l.removeAttribute("type"),t!=null?c==="number"?(t===0&&l.value===""||l.value!=t)&&(l.value=""+it(t)):l.value!==""+it(t)&&(l.value=""+it(t)):c!=="submit"&&c!=="reset"||l.removeAttribute("value"),t!=null?nc(l,c,it(t)):a!=null?nc(l,c,it(a)):e!=null&&l.removeAttribute("value"),n==null&&u!=null&&(l.defaultChecked=!!u),n!=null&&(l.checked=n&&typeof n!="function"&&typeof n!="symbol"),i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?l.name=""+it(i):l.removeAttribute("name")}function Hf(l,t,a,e,n,u,c,i){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(l.type=u),t!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){ac(l);return}a=a!=null?""+it(a):"",t=t!=null?""+it(t):a,i||t===l.value||(l.value=t),l.defaultValue=t}e=e??n,e=typeof e!="function"&&typeof e!="symbol"&&!!e,l.checked=i?l.checked:!!e,l.defaultChecked=!!e,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(l.name=c),ac(l)}function nc(l,t,a){t==="number"&&Cn(l.ownerDocument)===l||l.defaultValue===""+a||(l.defaultValue=""+a)}function Ja(l,t,a,e){if(l=l.options,t){t={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sc=!1;if(Ct)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){sc=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch{sc=!1}var It=null,oc=null,Hn=null;function Vf(){if(Hn)return Hn;var l,t=oc,a=t.length,e,n="value"in It?It.value:It.textContent,u=n.length;for(l=0;l=Re),kf=" ",Wf=!1;function $f(l,t){switch(l){case"keyup":return jm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ff(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var $a=!1;function Um(l,t){switch(l){case"compositionend":return Ff(t);case"keypress":return t.which!==32?null:(Wf=!0,kf);case"textInput":return l=t.data,l===kf&&Wf?null:l;default:return null}}function Cm(l,t){if($a)return l==="compositionend"||!yc&&$f(l,t)?(l=Vf(),Hn=oc=It=null,$a=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-l};l=e}l:{for(;a;){if(a.nextSibling){a=a.nextSibling;break l}a=a.parentNode}a=void 0}a=us(a)}}function is(l,t){return l&&t?l===t?!0:l&&l.nodeType===3?!1:t&&t.nodeType===3?is(l,t.parentNode):"contains"in l?l.contains(t):l.compareDocumentPosition?!!(l.compareDocumentPosition(t)&16):!1:!1}function fs(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var t=Cn(l.document);t instanceof l.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)l=t.contentWindow;else break;t=Cn(l.document)}return t}function Sc(l){var t=l&&l.nodeName&&l.nodeName.toLowerCase();return t&&(t==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||t==="textarea"||l.contentEditable==="true")}var Qm=Ct&&"documentMode"in document&&11>=document.documentMode,Fa=null,bc=null,Ye=null,pc=!1;function ss(l,t,a){var e=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;pc||Fa==null||Fa!==Cn(e)||(e=Fa,"selectionStart"in e&&Sc(e)?e={start:e.selectionStart,end:e.selectionEnd}:(e=(e.ownerDocument&&e.ownerDocument.defaultView||window).getSelection(),e={anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset}),Ye&&qe(Ye,e)||(Ye=e,e=Du(bc,"onSelect"),0>=c,n-=c,Et=1<<32-Pl(t)+n|a<$?(nl=X,X=null):nl=X.sibling;var il=b(m,X,v[$],E);if(il===null){X===null&&(X=nl);break}l&&X&&il.alternate===null&&t(m,X),r=u(il,r,$),cl===null?Z=il:cl.sibling=il,cl=il,X=nl}if($===v.length)return a(m,X),ul&&Ht(m,$),Z;if(X===null){for(;$$?(nl=X,X=null):nl=X.sibling;var pa=b(m,X,il.value,E);if(pa===null){X===null&&(X=nl);break}l&&X&&pa.alternate===null&&t(m,X),r=u(pa,r,$),cl===null?Z=pa:cl.sibling=pa,cl=pa,X=nl}if(il.done)return a(m,X),ul&&Ht(m,$),Z;if(X===null){for(;!il.done;$++,il=v.next())il=D(m,il.value,E),il!==null&&(r=u(il,r,$),cl===null?Z=il:cl.sibling=il,cl=il);return ul&&Ht(m,$),Z}for(X=e(X);!il.done;$++,il=v.next())il=z(X,m,$,il.value,E),il!==null&&(l&&il.alternate!==null&&X.delete(il.key===null?$:il.key),r=u(il,r,$),cl===null?Z=il:cl.sibling=il,cl=il);return l&&X.forEach(function(ih){return t(m,ih)}),ul&&Ht(m,$),Z}function vl(m,r,v,E){if(typeof v=="object"&&v!==null&&v.type===P&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case C:l:{for(var Z=v.key;r!==null;){if(r.key===Z){if(Z=v.type,Z===P){if(r.tag===7){a(m,r.sibling),E=n(r,v.props.children),E.return=m,m=E;break l}}else if(r.elementType===Z||typeof Z=="object"&&Z!==null&&Z.$$typeof===V&&Ca(Z)===r.type){a(m,r.sibling),E=n(r,v.props),Le(E,v),E.return=m,m=E;break l}a(m,r);break}else t(m,r);r=r.sibling}v.type===P?(E=Da(v.props.children,m.mode,E,v.key),E.return=m,m=E):(E=Kn(v.type,v.key,v.props,null,m.mode,E),Le(E,v),E.return=m,m=E)}return c(m);case Q:l:{for(Z=v.key;r!==null;){if(r.key===Z)if(r.tag===4&&r.stateNode.containerInfo===v.containerInfo&&r.stateNode.implementation===v.implementation){a(m,r.sibling),E=n(r,v.children||[]),E.return=m,m=E;break l}else{a(m,r);break}else t(m,r);r=r.sibling}E=Mc(v,m.mode,E),E.return=m,m=E}return c(m);case V:return v=Ca(v),vl(m,r,v,E)}if(bt(v))return q(m,r,v,E);if(xl(v)){if(Z=xl(v),typeof Z!="function")throw Error(o(150));return v=Z.call(v),L(m,r,v,E)}if(typeof v.then=="function")return vl(m,r,In(v),E);if(v.$$typeof===w)return vl(m,r,kn(m,v),E);Pn(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,r!==null&&r.tag===6?(a(m,r.sibling),E=n(r,v),E.return=m,m=E):(a(m,r),E=Ec(v,m.mode,E),E.return=m,m=E),c(m)):a(m,r)}return function(m,r,v,E){try{Ze=0;var Z=vl(m,r,v,E);return fe=null,Z}catch(X){if(X===ie||X===$n)throw X;var cl=tt(29,X,null,m.mode);return cl.lanes=E,cl.return=m,cl}finally{}}}var Ha=Us(!0),Cs=Us(!1),ea=!1;function Xc(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gc(l,t){l=l.updateQueue,t.updateQueue===l&&(t.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function na(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function ua(l,t,a){var e=l.updateQueue;if(e===null)return null;if(e=e.shared,(rl&2)!==0){var n=e.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t,t=Ln(l),vs(l,null,a),t}return Zn(l,e,t,a),Ln(l)}function Ke(l,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var e=t.lanes;e&=l.pendingLanes,a|=e,t.lanes=a,Tf(l,a)}}function Qc(l,t){var a=l.updateQueue,e=l.alternate;if(e!==null&&(e=e.updateQueue,a===e)){var n=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var c={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?n=u=c:u=u.next=c,a=a.next}while(a!==null);u===null?n=u=t:u=u.next=t}else n=u=t;a={baseState:e.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:e.shared,callbacks:e.callbacks},l.updateQueue=a;return}l=a.lastBaseUpdate,l===null?a.firstBaseUpdate=t:l.next=t,a.lastBaseUpdate=t}var Vc=!1;function Je(){if(Vc){var l=ce;if(l!==null)throw l}}function we(l,t,a,e){Vc=!1;var n=l.updateQueue;ea=!1;var u=n.firstBaseUpdate,c=n.lastBaseUpdate,i=n.shared.pending;if(i!==null){n.shared.pending=null;var s=i,g=s.next;s.next=null,c===null?u=g:c.next=g,c=s;var T=l.alternate;T!==null&&(T=T.updateQueue,i=T.lastBaseUpdate,i!==c&&(i===null?T.firstBaseUpdate=g:i.next=g,T.lastBaseUpdate=s))}if(u!==null){var D=n.baseState;c=0,T=g=s=null,i=u;do{var b=i.lane&-536870913,z=b!==i.lane;if(z?(el&b)===b:(e&b)===b){b!==0&&b===ue&&(Vc=!0),T!==null&&(T=T.next={lane:0,tag:i.tag,payload:i.payload,callback:null,next:null});l:{var q=l,L=i;b=t;var vl=a;switch(L.tag){case 1:if(q=L.payload,typeof q=="function"){D=q.call(vl,D,b);break l}D=q;break l;case 3:q.flags=q.flags&-65537|128;case 0:if(q=L.payload,b=typeof q=="function"?q.call(vl,D,b):q,b==null)break l;D=y({},D,b);break l;case 2:ea=!0}}b=i.callback,b!==null&&(l.flags|=64,z&&(l.flags|=8192),z=n.callbacks,z===null?n.callbacks=[b]:z.push(b))}else z={lane:b,tag:i.tag,payload:i.payload,callback:i.callback,next:null},T===null?(g=T=z,s=D):T=T.next=z,c|=b;if(i=i.next,i===null){if(i=n.shared.pending,i===null)break;z=i,i=z.next,z.next=null,n.lastBaseUpdate=z,n.shared.pending=null}}while(!0);T===null&&(s=D),n.baseState=s,n.firstBaseUpdate=g,n.lastBaseUpdate=T,u===null&&(n.shared.lanes=0),oa|=c,l.lanes=c,l.memoizedState=D}}function Rs(l,t){if(typeof l!="function")throw Error(o(191,l));l.call(t)}function Hs(l,t){var a=l.callbacks;if(a!==null)for(l.callbacks=null,l=0;lu?u:8;var c=S.T,i={};S.T=i,ii(l,!1,t,a);try{var s=n(),g=S.S;if(g!==null&&g(i,s),s!==null&&typeof s=="object"&&typeof s.then=="function"){var T=$m(s,e);$e(l,t,T,ct(l))}else $e(l,t,e,ct(l))}catch(D){$e(l,t,{then:function(){},status:"rejected",reason:D},ct())}finally{R.p=u,c!==null&&i.types!==null&&(c.types=i.types),S.T=c}}function a0(){}function ui(l,t,a,e){if(l.tag!==5)throw Error(o(476));var n=ho(l).queue;mo(l,n,t,G,a===null?a0:function(){return yo(l),a(e)})}function ho(l){var t=l.memoizedState;if(t!==null)return t;t={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xt,lastRenderedState:G},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xt,lastRenderedState:a},next:null},l.memoizedState=t,l=l.alternate,l!==null&&(l.memoizedState=t),t}function yo(l){var t=ho(l);t.next===null&&(t=l.alternate.memoizedState),$e(l,t.next.queue,{},ct())}function ci(){return Xl(hn)}function vo(){return El().memoizedState}function go(){return El().memoizedState}function e0(l){for(var t=l.return;t!==null;){switch(t.tag){case 24:case 3:var a=ct();l=na(a);var e=ua(t,l,a);e!==null&&($l(e,t,a),Ke(e,t,a)),t={cache:Hc()},l.payload=t;return}t=t.return}}function n0(l,t,a){var e=ct();a={lane:e,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},su(l)?bo(t,a):(a=Tc(l,t,a,e),a!==null&&($l(a,l,e),po(a,t,e)))}function So(l,t,a){var e=ct();$e(l,t,a,e)}function $e(l,t,a,e){var n={lane:e,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(su(l))bo(t,n);else{var u=l.alternate;if(l.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var c=t.lastRenderedState,i=u(c,a);if(n.hasEagerState=!0,n.eagerState=i,lt(i,c))return Zn(l,t,n,0),gl===null&&Vn(),!1}catch{}finally{}if(a=Tc(l,t,n,e),a!==null)return $l(a,l,e),po(a,t,e),!0}return!1}function ii(l,t,a,e){if(e={lane:2,revertLane:Xi(),gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},su(l)){if(t)throw Error(o(479))}else t=Tc(l,a,e,2),t!==null&&$l(t,l,2)}function su(l){var t=l.alternate;return l===k||t!==null&&t===k}function bo(l,t){oe=au=!0;var a=l.pending;a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t}function po(l,t,a){if((a&4194048)!==0){var e=t.lanes;e&=l.pendingLanes,a|=e,t.lanes=a,Tf(l,a)}}var Fe={readContext:Xl,use:uu,useCallback:Al,useContext:Al,useEffect:Al,useImperativeHandle:Al,useLayoutEffect:Al,useInsertionEffect:Al,useMemo:Al,useReducer:Al,useRef:Al,useState:Al,useDebugValue:Al,useDeferredValue:Al,useTransition:Al,useSyncExternalStore:Al,useId:Al,useHostTransitionStatus:Al,useFormState:Al,useActionState:Al,useOptimistic:Al,useMemoCache:Al,useCacheRefresh:Al};Fe.useEffectEvent=Al;var zo={readContext:Xl,use:uu,useCallback:function(l,t){return Zl().memoizedState=[l,t===void 0?null:t],l},useContext:Xl,useEffect:eo,useImperativeHandle:function(l,t,a){a=a!=null?a.concat([l]):null,iu(4194308,4,io.bind(null,t,l),a)},useLayoutEffect:function(l,t){return iu(4194308,4,l,t)},useInsertionEffect:function(l,t){iu(4,2,l,t)},useMemo:function(l,t){var a=Zl();t=t===void 0?null:t;var e=l();if(Ba){$t(!0);try{l()}finally{$t(!1)}}return a.memoizedState=[e,t],e},useReducer:function(l,t,a){var e=Zl();if(a!==void 0){var n=a(t);if(Ba){$t(!0);try{a(t)}finally{$t(!1)}}}else n=t;return e.memoizedState=e.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:n},e.queue=l,l=l.dispatch=n0.bind(null,k,l),[e.memoizedState,l]},useRef:function(l){var t=Zl();return l={current:l},t.memoizedState=l},useState:function(l){l=li(l);var t=l.queue,a=So.bind(null,k,t);return t.dispatch=a,[l.memoizedState,a]},useDebugValue:ei,useDeferredValue:function(l,t){var a=Zl();return ni(a,l,t)},useTransition:function(){var l=li(!1);return l=mo.bind(null,k,l.queue,!0,!1),Zl().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,t,a){var e=k,n=Zl();if(ul){if(a===void 0)throw Error(o(407));a=a()}else{if(a=t(),gl===null)throw Error(o(349));(el&127)!==0||Qs(e,t,a)}n.memoizedState=a;var u={value:a,getSnapshot:t};return n.queue=u,eo(Zs.bind(null,e,u,l),[l]),e.flags|=2048,de(9,{destroy:void 0},Vs.bind(null,e,u,a,t),null),a},useId:function(){var l=Zl(),t=gl.identifierPrefix;if(ul){var a=Mt,e=Et;a=(e&~(1<<32-Pl(e)-1)).toString(32)+a,t="_"+t+"R_"+a,a=eu++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof e.is=="string"?c.createElement("select",{is:e.is}):c.createElement("select"),e.multiple?u.multiple=!0:e.size&&(u.size=e.size);break;default:u=typeof e.is=="string"?c.createElement(n,{is:e.is}):c.createElement(n)}}u[ql]=t,u[Ll]=e;l:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)u.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break l;for(;c.sibling===null;){if(c.return===null||c.return===t)break l;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=u;l:switch(Ql(u,n,e),n){case"button":case"input":case"select":case"textarea":e=!!e.autoFocus;break l;case"img":e=!0;break l;default:e=!1}e&&Qt(t)}}return pl(t),zi(t,t.type,l===null?null:l.memoizedProps,t.pendingProps,a),null;case 6:if(l&&t.stateNode!=null)l.memoizedProps!==e&&Qt(t);else{if(typeof e!="string"&&t.stateNode===null)throw Error(o(166));if(l=Wt.current,ee(t)){if(l=t.stateNode,a=t.memoizedProps,e=null,n=Yl,n!==null)switch(n.tag){case 27:case 5:e=n.memoizedProps}l[ql]=t,l=!!(l.nodeValue===a||e!==null&&e.suppressHydrationWarning===!0||Gr(l.nodeValue,a)),l||ta(t,!0)}else l=Nu(l).createTextNode(e),l[ql]=t,t.stateNode=l}return pl(t),null;case 31:if(a=t.memoizedState,l===null||l.memoizedState!==null){if(e=ee(t),a!==null){if(l===null){if(!e)throw Error(o(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(o(557));l[ql]=t}else Na(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pl(t),l=!1}else a=Oc(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=a),l=!0;if(!l)return t.flags&256?(et(t),t):(et(t),null);if((t.flags&128)!==0)throw Error(o(558))}return pl(t),null;case 13:if(e=t.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(n=ee(t),e!==null&&e.dehydrated!==null){if(l===null){if(!n)throw Error(o(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));n[ql]=t}else Na(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pl(t),n=!1}else n=Oc(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=n),n=!0;if(!n)return t.flags&256?(et(t),t):(et(t),null)}return et(t),(t.flags&128)!==0?(t.lanes=a,t):(a=e!==null,l=l!==null&&l.memoizedState!==null,a&&(e=t.child,n=null,e.alternate!==null&&e.alternate.memoizedState!==null&&e.alternate.memoizedState.cachePool!==null&&(n=e.alternate.memoizedState.cachePool.pool),u=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(u=e.memoizedState.cachePool.pool),u!==n&&(e.flags|=2048)),a!==l&&a&&(t.child.flags|=8192),hu(t,t.updateQueue),pl(t),null);case 4:return Ga(),l===null&&Zi(t.stateNode.containerInfo),pl(t),null;case 10:return qt(t.type),pl(t),null;case 19:if(ol(_l),e=t.memoizedState,e===null)return pl(t),null;if(n=(t.flags&128)!==0,u=e.rendering,u===null)if(n)Pe(e,!1);else{if(Tl!==0||l!==null&&(l.flags&128)!==0)for(l=t.child;l!==null;){if(u=tu(l),u!==null){for(t.flags|=128,Pe(e,!1),l=u.updateQueue,t.updateQueue=l,hu(t,l),t.subtreeFlags=0,l=a,a=t.child;a!==null;)gs(a,l),a=a.sibling;return I(_l,_l.current&1|2),ul&&Ht(t,e.treeForkCount),t.child}l=l.sibling}e.tail!==null&&Fl()>bu&&(t.flags|=128,n=!0,Pe(e,!1),t.lanes=4194304)}else{if(!n)if(l=tu(u),l!==null){if(t.flags|=128,n=!0,l=l.updateQueue,t.updateQueue=l,hu(t,l),Pe(e,!0),e.tail===null&&e.tailMode==="hidden"&&!u.alternate&&!ul)return pl(t),null}else 2*Fl()-e.renderingStartTime>bu&&a!==536870912&&(t.flags|=128,n=!0,Pe(e,!1),t.lanes=4194304);e.isBackwards?(u.sibling=t.child,t.child=u):(l=e.last,l!==null?l.sibling=u:t.child=u,e.last=u)}return e.tail!==null?(l=e.tail,e.rendering=l,e.tail=l.sibling,e.renderingStartTime=Fl(),l.sibling=null,a=_l.current,I(_l,n?a&1|2:a&1),ul&&Ht(t,e.treeForkCount),l):(pl(t),null);case 22:case 23:return et(t),Lc(),e=t.memoizedState!==null,l!==null?l.memoizedState!==null!==e&&(t.flags|=8192):e&&(t.flags|=8192),e?(a&536870912)!==0&&(t.flags&128)===0&&(pl(t),t.subtreeFlags&6&&(t.flags|=8192)):pl(t),a=t.updateQueue,a!==null&&hu(t,a.retryQueue),a=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(t.flags|=2048),l!==null&&ol(Ua),null;case 24:return a=null,l!==null&&(a=l.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),qt(Dl),pl(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function s0(l,t){switch(Nc(t),t.tag){case 1:return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 3:return qt(Dl),Ga(),l=t.flags,(l&65536)!==0&&(l&128)===0?(t.flags=l&-65537|128,t):null;case 26:case 27:case 5:return _n(t),null;case 31:if(t.memoizedState!==null){if(et(t),t.alternate===null)throw Error(o(340));Na()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 13:if(et(t),l=t.memoizedState,l!==null&&l.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Na()}return l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 19:return ol(_l),null;case 4:return Ga(),null;case 10:return qt(t.type),null;case 22:case 23:return et(t),Lc(),l!==null&&ol(Ua),l=t.flags,l&65536?(t.flags=l&-65537|128,t):null;case 24:return qt(Dl),null;case 25:return null;default:return null}}function Ko(l,t){switch(Nc(t),t.tag){case 3:qt(Dl),Ga();break;case 26:case 27:case 5:_n(t);break;case 4:Ga();break;case 31:t.memoizedState!==null&&et(t);break;case 13:et(t);break;case 19:ol(_l);break;case 10:qt(t.type);break;case 22:case 23:et(t),Lc(),l!==null&&ol(Ua);break;case 24:qt(Dl)}}function ln(l,t){try{var a=t.updateQueue,e=a!==null?a.lastEffect:null;if(e!==null){var n=e.next;a=n;do{if((a.tag&l)===l){e=void 0;var u=a.create,c=a.inst;e=u(),c.destroy=e}a=a.next}while(a!==n)}}catch(i){ml(t,t.return,i)}}function fa(l,t,a){try{var e=t.updateQueue,n=e!==null?e.lastEffect:null;if(n!==null){var u=n.next;e=u;do{if((e.tag&l)===l){var c=e.inst,i=c.destroy;if(i!==void 0){c.destroy=void 0,n=t;var s=a,g=i;try{g()}catch(T){ml(n,s,T)}}}e=e.next}while(e!==u)}}catch(T){ml(t,t.return,T)}}function Jo(l){var t=l.updateQueue;if(t!==null){var a=l.stateNode;try{Hs(t,a)}catch(e){ml(l,l.return,e)}}}function wo(l,t,a){a.props=qa(l.type,l.memoizedProps),a.state=l.memoizedState;try{a.componentWillUnmount()}catch(e){ml(l,t,e)}}function tn(l,t){try{var a=l.ref;if(a!==null){switch(l.tag){case 26:case 27:case 5:var e=l.stateNode;break;case 30:e=l.stateNode;break;default:e=l.stateNode}typeof a=="function"?l.refCleanup=a(e):a.current=e}}catch(n){ml(l,t,n)}}function Dt(l,t){var a=l.ref,e=l.refCleanup;if(a!==null)if(typeof e=="function")try{e()}catch(n){ml(l,t,n)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(n){ml(l,t,n)}else a.current=null}function ko(l){var t=l.type,a=l.memoizedProps,e=l.stateNode;try{l:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&e.focus();break l;case"img":a.src?e.src=a.src:a.srcSet&&(e.srcset=a.srcSet)}}catch(n){ml(l,l.return,n)}}function xi(l,t,a){try{var e=l.stateNode;O0(e,l.type,a,t),e[Ll]=t}catch(n){ml(l,l.return,n)}}function Wo(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&ya(l.type)||l.tag===4}function Ai(l){l:for(;;){for(;l.sibling===null;){if(l.return===null||Wo(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&ya(l.type)||l.flags&2||l.child===null||l.tag===4)continue l;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Ti(l,t,a){var e=l.tag;if(e===5||e===6)l=l.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(l,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(l),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Ut));else if(e!==4&&(e===27&&ya(l.type)&&(a=l.stateNode,t=null),l=l.child,l!==null))for(Ti(l,t,a),l=l.sibling;l!==null;)Ti(l,t,a),l=l.sibling}function yu(l,t,a){var e=l.tag;if(e===5||e===6)l=l.stateNode,t?a.insertBefore(l,t):a.appendChild(l);else if(e!==4&&(e===27&&ya(l.type)&&(a=l.stateNode),l=l.child,l!==null))for(yu(l,t,a),l=l.sibling;l!==null;)yu(l,t,a),l=l.sibling}function $o(l){var t=l.stateNode,a=l.memoizedProps;try{for(var e=l.type,n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Ql(t,e,a),t[ql]=l,t[Ll]=a}catch(u){ml(l,l.return,u)}}var Vt=!1,Ol=!1,_i=!1,Fo=typeof WeakSet=="function"?WeakSet:Set,Bl=null;function o0(l,t){if(l=l.containerInfo,Ji=Bu,l=fs(l),Sc(l)){if("selectionStart"in l)var a={start:l.selectionStart,end:l.selectionEnd};else l:{a=(a=l.ownerDocument)&&a.defaultView||window;var e=a.getSelection&&a.getSelection();if(e&&e.rangeCount!==0){a=e.anchorNode;var n=e.anchorOffset,u=e.focusNode;e=e.focusOffset;try{a.nodeType,u.nodeType}catch{a=null;break l}var c=0,i=-1,s=-1,g=0,T=0,D=l,b=null;t:for(;;){for(var z;D!==a||n!==0&&D.nodeType!==3||(i=c+n),D!==u||e!==0&&D.nodeType!==3||(s=c+e),D.nodeType===3&&(c+=D.nodeValue.length),(z=D.firstChild)!==null;)b=D,D=z;for(;;){if(D===l)break t;if(b===a&&++g===n&&(i=c),b===u&&++T===e&&(s=c),(z=D.nextSibling)!==null)break;D=b,b=D.parentNode}D=z}a=i===-1||s===-1?null:{start:i,end:s}}else a=null}a=a||{start:0,end:0}}else a=null;for(wi={focusedElem:l,selectionRange:a},Bu=!1,Bl=t;Bl!==null;)if(t=Bl,l=t.child,(t.subtreeFlags&1028)!==0&&l!==null)l.return=t,Bl=l;else for(;Bl!==null;){switch(t=Bl,u=t.alternate,l=t.flags,t.tag){case 0:if((l&4)!==0&&(l=t.updateQueue,l=l!==null?l.events:null,l!==null))for(a=0;a title"))),Ql(u,e,a),u[ql]=l,Hl(u),e=u;break l;case"link":var c=ed("link","href",n).get(e+(a.href||""));if(c){for(var i=0;ivl&&(c=vl,vl=L,L=c);var m=cs(i,L),r=cs(i,vl);if(m&&r&&(z.rangeCount!==1||z.anchorNode!==m.node||z.anchorOffset!==m.offset||z.focusNode!==r.node||z.focusOffset!==r.offset)){var v=D.createRange();v.setStart(m.node,m.offset),z.removeAllRanges(),L>vl?(z.addRange(v),z.extend(r.node,r.offset)):(v.setEnd(r.node,r.offset),z.addRange(v))}}}}for(D=[],z=i;z=z.parentNode;)z.nodeType===1&&D.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;ia?32:a,S.T=null,a=Ui,Ui=null;var u=da,c=wt;if(Cl=0,ge=da=null,wt=0,(rl&6)!==0)throw Error(o(331));var i=rl;if(rl|=4,fr(u.current),ur(u,u.current,c,a),rl=i,fn(0,!1),Il&&typeof Il.onPostCommitFiberRoot=="function")try{Il.onPostCommitFiberRoot(_e,u)}catch{}return!0}finally{R.p=n,S.T=e,Er(l,t)}}function Dr(l,t,a){t=ot(a,t),t=ri(l.stateNode,t,2),l=ua(l,t,2),l!==null&&(Me(l,2),Nt(l))}function ml(l,t,a){if(l.tag===3)Dr(l,l,a);else for(;t!==null;){if(t.tag===3){Dr(t,l,a);break}else if(t.tag===1){var e=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof e.componentDidCatch=="function"&&(ra===null||!ra.has(e))){l=ot(a,l),a=No(2),e=ua(t,a,2),e!==null&&(jo(a,e,t,l),Me(e,2),Nt(e));break}}t=t.return}}function Bi(l,t,a){var e=l.pingCache;if(e===null){e=l.pingCache=new m0;var n=new Set;e.set(t,n)}else n=e.get(t),n===void 0&&(n=new Set,e.set(t,n));n.has(a)||(Di=!0,n.add(a),l=S0.bind(null,l,t,a),t.then(l,l))}function S0(l,t,a){var e=l.pingCache;e!==null&&e.delete(t),l.pingedLanes|=l.suspendedLanes&a,l.warmLanes&=~a,gl===l&&(el&a)===a&&(Tl===4||Tl===3&&(el&62914560)===el&&300>Fl()-Su?(rl&2)===0&&Se(l,0):Ni|=a,ve===el&&(ve=0)),Nt(l)}function Nr(l,t){t===0&&(t=xf()),l=Ma(l,t),l!==null&&(Me(l,t),Nt(l))}function b0(l){var t=l.memoizedState,a=0;t!==null&&(a=t.retryLane),Nr(l,a)}function p0(l,t){var a=0;switch(l.tag){case 31:case 13:var e=l.stateNode,n=l.memoizedState;n!==null&&(a=n.retryLane);break;case 19:e=l.stateNode;break;case 22:e=l.stateNode._retryCache;break;default:throw Error(o(314))}e!==null&&e.delete(t),Nr(l,a)}function z0(l,t){return Wu(l,t)}var _u=null,pe=null,qi=!1,Eu=!1,Yi=!1,ha=0;function Nt(l){l!==pe&&l.next===null&&(pe===null?_u=pe=l:pe=pe.next=l),Eu=!0,qi||(qi=!0,A0())}function fn(l,t){if(!Yi&&Eu){Yi=!0;do for(var a=!1,e=_u;e!==null;){if(l!==0){var n=e.pendingLanes;if(n===0)var u=0;else{var c=e.suspendedLanes,i=e.pingedLanes;u=(1<<31-Pl(42|l)+1)-1,u&=n&~(c&~i),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,Cr(e,u))}else u=el,u=jn(e,e===gl?u:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),(u&3)===0||Ee(e,u)||(a=!0,Cr(e,u));e=e.next}while(a);Yi=!1}}function x0(){jr()}function jr(){Eu=qi=!1;var l=0;ha!==0&&C0()&&(l=ha);for(var t=Fl(),a=null,e=_u;e!==null;){var n=e.next,u=Or(e,t);u===0?(e.next=null,a===null?_u=n:a.next=n,n===null&&(pe=a)):(a=e,(l!==0||(u&3)!==0)&&(Eu=!0)),e=n}Cl!==0&&Cl!==5||fn(l),ha!==0&&(ha=0)}function Or(l,t){for(var a=l.suspendedLanes,e=l.pingedLanes,n=l.expirationTimes,u=l.pendingLanes&-62914561;0i)break;var T=s.transferSize,D=s.initiatorType;T&&Qr(D)&&(s=s.responseEnd,c+=T*(s"u"?null:document;function Pr(l,t,a){var e=ze;if(e&&typeof t=="string"&&t){var n=ft(t);n='link[rel="'+l+'"][href="'+n+'"]',typeof a=="string"&&(n+='[crossorigin="'+a+'"]'),Ir.has(n)||(Ir.add(n),l={rel:l,crossOrigin:a,href:t},e.querySelector(n)===null&&(t=e.createElement("link"),Ql(t,"link",l),Hl(t),e.head.appendChild(t)))}}function V0(l){kt.D(l),Pr("dns-prefetch",l,null)}function Z0(l,t){kt.C(l,t),Pr("preconnect",l,t)}function L0(l,t,a){kt.L(l,t,a);var e=ze;if(e&&l&&t){var n='link[rel="preload"][as="'+ft(t)+'"]';t==="image"&&a&&a.imageSrcSet?(n+='[imagesrcset="'+ft(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(n+='[imagesizes="'+ft(a.imageSizes)+'"]')):n+='[href="'+ft(l)+'"]';var u=n;switch(t){case"style":u=xe(l);break;case"script":u=Ae(l)}vt.has(u)||(l=y({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:l,as:t},a),vt.set(u,l),e.querySelector(n)!==null||t==="style"&&e.querySelector(dn(u))||t==="script"&&e.querySelector(mn(u))||(t=e.createElement("link"),Ql(t,"link",l),Hl(t),e.head.appendChild(t)))}}function K0(l,t){kt.m(l,t);var a=ze;if(a&&l){var e=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+ft(e)+'"][href="'+ft(l)+'"]',u=n;switch(e){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ae(l)}if(!vt.has(u)&&(l=y({rel:"modulepreload",href:l},t),vt.set(u,l),a.querySelector(n)===null)){switch(e){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(mn(u)))return}e=a.createElement("link"),Ql(e,"link",l),Hl(e),a.head.appendChild(e)}}}function J0(l,t,a){kt.S(l,t,a);var e=ze;if(e&&l){var n=La(e).hoistableStyles,u=xe(l);t=t||"default";var c=n.get(u);if(!c){var i={loading:0,preload:null};if(c=e.querySelector(dn(u)))i.loading=5;else{l=y({rel:"stylesheet",href:l,"data-precedence":t},a),(a=vt.get(u))&&lf(l,a);var s=c=e.createElement("link");Hl(s),Ql(s,"link",l),s._p=new Promise(function(g,T){s.onload=g,s.onerror=T}),s.addEventListener("load",function(){i.loading|=1}),s.addEventListener("error",function(){i.loading|=2}),i.loading|=4,Ou(c,t,e)}c={type:"stylesheet",instance:c,count:1,state:i},n.set(u,c)}}}function w0(l,t){kt.X(l,t);var a=ze;if(a&&l){var e=La(a).hoistableScripts,n=Ae(l),u=e.get(n);u||(u=a.querySelector(mn(n)),u||(l=y({src:l,async:!0},t),(t=vt.get(n))&&tf(l,t),u=a.createElement("script"),Hl(u),Ql(u,"link",l),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},e.set(n,u))}}function k0(l,t){kt.M(l,t);var a=ze;if(a&&l){var e=La(a).hoistableScripts,n=Ae(l),u=e.get(n);u||(u=a.querySelector(mn(n)),u||(l=y({src:l,async:!0,type:"module"},t),(t=vt.get(n))&&tf(l,t),u=a.createElement("script"),Hl(u),Ql(u,"link",l),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},e.set(n,u))}}function ld(l,t,a,e){var n=(n=Wt.current)?ju(n):null;if(!n)throw Error(o(446));switch(l){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=xe(a.href),a=La(n).hoistableStyles,e=a.get(t),e||(e={type:"style",instance:null,count:0,state:null},a.set(t,e)),e):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){l=xe(a.href);var u=La(n).hoistableStyles,c=u.get(l);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(l,c),(u=n.querySelector(dn(l)))&&!u._p&&(c.instance=u,c.state.loading=5),vt.has(l)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},vt.set(l,a),u||W0(n,l,a,c.state))),t&&e===null)throw Error(o(528,""));return c}if(t&&e!==null)throw Error(o(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ae(a),a=La(n).hoistableScripts,e=a.get(t),e||(e={type:"script",instance:null,count:0,state:null},a.set(t,e)),e):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,l))}}function xe(l){return'href="'+ft(l)+'"'}function dn(l){return'link[rel="stylesheet"]['+l+"]"}function td(l){return y({},l,{"data-precedence":l.precedence,precedence:null})}function W0(l,t,a,e){l.querySelector('link[rel="preload"][as="style"]['+t+"]")?e.loading=1:(t=l.createElement("link"),e.preload=t,t.addEventListener("load",function(){return e.loading|=1}),t.addEventListener("error",function(){return e.loading|=2}),Ql(t,"link",a),Hl(t),l.head.appendChild(t))}function Ae(l){return'[src="'+ft(l)+'"]'}function mn(l){return"script[async]"+l}function ad(l,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var e=l.querySelector('style[data-href~="'+ft(a.href)+'"]');if(e)return t.instance=e,Hl(e),e;var n=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return e=(l.ownerDocument||l).createElement("style"),Hl(e),Ql(e,"style",n),Ou(e,a.precedence,l),t.instance=e;case"stylesheet":n=xe(a.href);var u=l.querySelector(dn(n));if(u)return t.state.loading|=4,t.instance=u,Hl(u),u;e=td(a),(n=vt.get(n))&&lf(e,n),u=(l.ownerDocument||l).createElement("link"),Hl(u);var c=u;return c._p=new Promise(function(i,s){c.onload=i,c.onerror=s}),Ql(u,"link",e),t.state.loading|=4,Ou(u,a.precedence,l),t.instance=u;case"script":return u=Ae(a.src),(n=l.querySelector(mn(u)))?(t.instance=n,Hl(n),n):(e=a,(n=vt.get(u))&&(e=y({},a),tf(e,n)),l=l.ownerDocument||l,n=l.createElement("script"),Hl(n),Ql(n,"link",e),l.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(e=t.instance,t.state.loading|=4,Ou(e,a.precedence,l));return t.instance}function Ou(l,t,a){for(var e=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=e.length?e[e.length-1]:null,u=n,c=0;c title"):null)}function $0(l,t,a){if(a===1||t.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return l=t.disabled,typeof t.precedence=="string"&&l==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function ud(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function F0(l,t,a,e){if(a.type==="stylesheet"&&(typeof e.media!="string"||matchMedia(e.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var n=xe(e.href),u=t.querySelector(dn(n));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=Cu.bind(l),t.then(l,l)),a.state.loading|=4,a.instance=u,Hl(u);return}u=t.ownerDocument||t,e=td(e),(n=vt.get(n))&&lf(e,n),u=u.createElement("link"),Hl(u);var c=u;c._p=new Promise(function(i,s){c.onload=i,c.onerror=s}),Ql(u,"link",e),a.instance=u}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(l.count++,a=Cu.bind(l),t.addEventListener("load",a),t.addEventListener("error",a))}}var af=0;function I0(l,t){return l.stylesheets&&l.count===0&&Hu(l,l.stylesheets),0af?50:800)+t);return l.unsuspend=a,function(){l.unsuspend=null,clearTimeout(e),clearTimeout(n)}}:null}function Cu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hu(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var Ru=null;function Hu(l,t){l.stylesheets=null,l.unsuspend!==null&&(l.count++,Ru=new Map,t.forEach(P0,l),Ru=null,Cu.call(l))}function P0(l,t){if(!(t.state.loading&4)){var a=Ru.get(l);if(a)var e=a.get(null);else{a=new Map,Ru.set(l,a);for(var n=l.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(f)}catch(p){console.error(p)}}return f(),rf.exports=hh(),rf.exports}var vh=yh();const jd=x.createContext({windows:[],openWindow:()=>{},closeWindow:()=>{},bringToFront:()=>{}}),gh=({children:f})=>{const[p,A]=x.useState([]),o=x.useRef(1e4),M=x.useCallback((O,h,_)=>{A(B=>B.find(N=>N.id===O)?B.map(N=>N.id===O?{...N,zIndex:++o.current}:N):[...B,{id:O,title:h,charName:_,zIndex:++o.current}])},[]),U=x.useCallback(O=>{A(h=>h.filter(_=>_.id!==O))},[]),j=x.useCallback(O=>{A(h=>h.map(_=>_.id===O?{..._,zIndex:++o.current}:_))},[]);return d.jsx(jd.Provider,{value:{windows:p,openWindow:M,closeWindow:U,bringToFront:j},children:f})},zn=()=>x.useContext(jd),gt={west:-102.1,east:102.1,north:102.1,south:-102.1};function xn(f,p,A,o){const M=(f-gt.west)/(gt.east-gt.west)*A,U=(gt.north-p)/(gt.north-gt.south)*o;return{x:M,y:U}}function Sh(f,p,A,o,M,U,j){const O=(f-o)/A,h=(p-M)/A,_=gt.west+O/U*(gt.east-gt.west),B=gt.north-h/j*(gt.north-gt.south);return{ew:_,ns:B}}function hf(f,p){const A=f>=0?"N":"S",o=p>=0?"E":"W";return`${Math.abs(f).toFixed(1)}${A}, ${Math.abs(p).toFixed(1)}${o}`}const Od=pn.memo(({players:f,imgW:p,imgH:A,getColor:o,onHover:M,onSelect:U,selectedPlayer:j})=>{const{openWindow:O}=zn(),[h,_]=x.useState(null);x.useEffect(()=>{const y=()=>_(null);return h&&window.addEventListener("click",y),()=>window.removeEventListener("click",y)},[h]);const B=x.useMemo(()=>f.filter(y=>y.ew!==void 0&&y.ns!==void 0).map(y=>({...y,pos:xn(y.ew,y.ns,p,A),color:o(y.character_name)})),[f,p,A,o]);return d.jsxs("div",{className:"ml-dots-layer",children:[B.map(y=>d.jsx("div",{className:`ml-dot ${j===y.character_name?"ml-dot-selected":""}`,style:{left:y.pos.x,top:y.pos.y,backgroundColor:y.color},onMouseEnter:N=>{var Q;const C=(Q=N.currentTarget.closest(".ml-map-container"))==null?void 0:Q.getBoundingClientRect();C&&M(y,N.clientX-C.left,N.clientY-C.top)},onMouseLeave:()=>M(null,0,0),onClick:()=>U(y.character_name),onDoubleClick:()=>O(`chat-${y.character_name}`,`Chat: ${y.character_name}`,y.character_name),onContextMenu:N=>{var Sl;N.preventDefault();const C=y.character_name,Q=(Sl=N.currentTarget.closest(".ml-map-container"))==null?void 0:Sl.getBoundingClientRect(),P=Q?N.clientX-Q.left:N.clientX,fl=Q?N.clientY-Q.top:N.clientY;_({name:C,x:P,y:fl})}},y.character_name)),h&&d.jsx("div",{style:{position:"fixed",left:h.x+410,top:h.y,background:"#1a1a1a",border:"1px solid #444",borderRadius:4,zIndex:9999,padding:"2px 0",fontSize:"0.75rem",boxShadow:"0 4px 12px rgba(0,0,0,0.5)",minWidth:120},children:[{label:"Chat",id:"chat"},{label:"Stats",id:"stats"},{label:"Inventory",id:"inv"},{label:"Character",id:"char"},{label:"Combat",id:"combat"},{label:"Radar",id:"radar"}].map(y=>d.jsx("div",{onClick:()=>{O(`${y.id}-${h.name}`,`${y.label}: ${h.name}`,h.name),_(null)},style:{padding:"4px 12px",cursor:"pointer",color:"#ccc"},onMouseEnter:N=>N.currentTarget.style.background="#333",onMouseLeave:N=>N.currentTarget.style.background="",children:y.label},y.id))})]})});Od.displayName="PlayerDots";const Zu="/api";async function At(f){const p=await fetch(`${Zu}${f}`,{credentials:"include"});if(!p.ok)throw new Error(`API ${f}: ${p.status}`);return p.json()}async function yf(f,p){var o;const A=await fetch(`${Zu}${f}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(p??{})});if(!A.ok){let M="";try{M=((o=await A.json())==null?void 0:o.detail)??""}catch{}throw new Error(`API ${f}: ${A.status}${M?` (${M})`:""}`)}return A.json()}async function bh(f,p){var o;const A=await fetch(`${Zu}${f}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(p??{})});if(!A.ok){let M="";try{M=((o=await A.json())==null?void 0:o.detail)??""}catch{}throw new Error(`API ${f}: ${A.status}${M?` (${M})`:""}`)}return A.json()}async function ph(f){var A;const p=await fetch(`${Zu}${f}`,{method:"DELETE",credentials:"include"});if(!p.ok){let o="";try{o=((A=await p.json())==null?void 0:A.detail)??""}catch{}throw new Error(`API ${f}: ${p.status}${o?` (${o})`:""}`)}return p.json()}function zh(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/ws/live`}const Ud=pn.memo(({imgW:f,imgH:p,getColor:A})=>{const[o,M]=x.useState([]);x.useEffect(()=>{const j=async()=>{try{const h=await At("/trails/?seconds=600");M(h.trails??[])}catch{}};j();const O=setInterval(j,2e3);return()=>clearInterval(O)},[]);const U=x.useMemo(()=>{const j={};for(const O of o){const{x:h,y:_}=xn(O.ew,O.ns,f,p);j[O.character_name]||(j[O.character_name]=[]),j[O.character_name].push(`${h},${_}`)}return Object.entries(j).filter(([,O])=>O.length>=2).map(([O,h])=>({name:O,points:h.join(" ")}))},[o,f,p]);return d.jsx("svg",{className:"ml-trails-svg",viewBox:`0 0 ${f} ${p}`,preserveAspectRatio:"none",children:U.map(j=>d.jsx("polyline",{points:j.points,stroke:A(j.name),fill:"none",strokeWidth:2,strokeOpacity:.7,strokeLinecap:"round",strokeLinejoin:"round"},j.name))})});Ud.displayName="TrailsSVG";const xh=({imgW:f,imgH:p,enabled:A})=>{const o=x.useRef(null),[M,U]=x.useState([]);return x.useEffect(()=>{if(!A)return;(async()=>{try{const O=await At("/spawns/heatmap?hours=24&limit=50000");U(O.spawn_points??[])}catch{}})()},[A]),x.useEffect(()=>{const j=o.current;if(!j||!A||M.length===0||f===0)return;j.width=f,j.height=p;const O=j.getContext("2d");if(O){O.clearRect(0,0,f,p);for(const h of M){const{x:_,y:B}=xn(h.ew,h.ns,f,p),y=Math.max(5,Math.min(12,5+Math.sqrt(h.intensity*.5))),N=O.createRadialGradient(_,B,0,_,B,y);N.addColorStop(0,`rgba(255, 0, 0, ${Math.min(.9,h.intensity/40)})`),N.addColorStop(.6,`rgba(255, 100, 0, ${Math.min(.4,h.intensity/120)})`),N.addColorStop(1,"rgba(255, 150, 0, 0)"),O.fillStyle=N,O.fillRect(_-y,B-y,y*2,y*2)}}},[M,f,p,A]),A?d.jsx("canvas",{ref:o,className:"ml-heatmap-canvas"}):null},Ah=({imgW:f,imgH:p,enabled:A})=>{const[o,M]=x.useState([]);x.useEffect(()=>{if(!A)return;const j=async()=>{try{const h=await At("/portals");M(h.portals??[])}catch{}};j();const O=setInterval(j,6e4);return()=>clearInterval(O)},[A]);const U=x.useMemo(()=>o.map(j=>({...j,pos:xn(j.coordinates.ew,j.coordinates.ns,f,p)})),[o,f,p]);return!A||U.length===0?null:d.jsx("div",{className:"ml-portals-layer",children:U.map((j,O)=>d.jsx("div",{className:"ml-portal-icon",style:{left:j.pos.x,top:j.pos.y},title:`${j.portal_name} (by ${j.discovered_by})`},O))})},_d=20,Ed=.3,Th=({players:f,getColor:p,onSelectPlayer:A,showHeatmap:o,showPortals:M,selectedPlayer:U})=>{var Vl;const j=x.useRef(null),O=x.useRef(null),[h,_]=x.useState({w:0,h:0}),[B,y]=x.useState(null),N=x.useRef(null),C=x.useRef({scale:1,offX:0,offY:0}),Q=x.useRef({dragging:!1,sx:0,sy:0,startOffX:0,startOffY:0}),P=x.useCallback(()=>{if(O.current){const{scale:F,offX:ll,offY:V}=C.current;O.current.style.transform=`translate(${ll}px, ${V}px) scale(${F})`}},[]),fl=x.useCallback(F=>{const ll=F.currentTarget;if(_({w:ll.naturalWidth,h:ll.naturalHeight}),j.current){const V=j.current.clientWidth,K=j.current.clientHeight,W=Math.min(V/ll.naturalWidth,K/ll.naturalHeight);C.current={scale:W,offX:(V-ll.naturalWidth*W)/2,offY:(K-ll.naturalHeight*W)/2},P()}},[P]),Sl=x.useCallback(F=>{var Tt;F.preventDefault();const ll=(Tt=j.current)==null?void 0:Tt.getBoundingClientRect();if(!ll)return;const V=C.current,K=F.deltaY<0?1.1:.9,W=Math.min(_d,Math.max(Ed,V.scale*K)),Ul=W/V.scale,xl=F.clientX-ll.left,jt=F.clientY-ll.top;C.current={scale:W,offX:xl-(xl-V.offX)*Ul,offY:jt-(jt-V.offY)*Ul},P()},[P]),J=x.useCallback(F=>{if(F.button!==0)return;const ll=C.current;Q.current={dragging:!0,sx:F.clientX,sy:F.clientY,startOffX:ll.offX,startOffY:ll.offY}},[]);x.useEffect(()=>{const F=V=>{const K=Q.current;if(K.dragging&&(C.current.offX=K.startOffX+(V.clientX-K.sx),C.current.offY=K.startOffY+(V.clientY-K.sy),P()),j.current&&h.w>0&&N.current){const W=j.current.getBoundingClientRect(),Ul=C.current,xl=Sh(V.clientX-W.left,V.clientY-W.top,Ul.scale,Ul.offX,Ul.offY,h.w,h.h);N.current.textContent=hf(xl.ns,xl.ew)}},ll=()=>{Q.current.dragging=!1};return window.addEventListener("mousemove",F),window.addEventListener("mouseup",ll),()=>{window.removeEventListener("mousemove",F),window.removeEventListener("mouseup",ll)}},[P,h.w,h.h]);const w=x.useRef(null);x.useEffect(()=>{if(!U||h.w===0||!j.current||w.current===U)return;const F=f.find(Ul=>Ul.character_name===U);if(!F)return;w.current=U;const{x:ll,y:V}=xn(F.ew,F.ns,h.w,h.h),K=j.current.getBoundingClientRect(),W=3;C.current={scale:Math.min(_d,Math.max(Ed,W)),offX:K.width/2-ll*W,offY:K.height/2-V*W},P()},[U,f,h.w,h.h,P]),x.useEffect(()=>{U||(w.current=null)},[U]);const Ml=x.useCallback((F,ll,V)=>{y(F?{x:ll,y:V,player:F}:null)},[]);return d.jsxs("div",{className:"ml-map-container",ref:j,onWheel:Sl,onMouseDown:J,children:[d.jsxs("div",{ref:O,className:"ml-map-group",children:[d.jsx("img",{src:"/dereth.png",alt:"Dereth",className:"ml-map-img",onLoad:fl,draggable:!1}),h.w>0&&d.jsxs(d.Fragment,{children:[d.jsx(xh,{imgW:h.w,imgH:h.h,enabled:o}),d.jsx(Ud,{imgW:h.w,imgH:h.h,getColor:p}),d.jsx(Od,{players:f,imgW:h.w,imgH:h.h,getColor:p,onHover:Ml,onSelect:A,selectedPlayer:U}),d.jsx(Ah,{imgW:h.w,imgH:h.h,enabled:M})]})]}),B&&d.jsxs("div",{className:"ml-tooltip",style:{left:B.x+12,top:B.y-10},children:[d.jsx("strong",{children:B.player.character_name}),d.jsx("br",{}),hf(B.player.ns,B.player.ew),d.jsx("br",{}),B.player.kills_per_hour," kph ยท ",(Vl=B.player.kills)==null?void 0:Vl.toLocaleString()," kills"]}),d.jsx("div",{className:"ml-coords",ref:N})]})},Cd=pn.memo(({player:f,vitals:p,color:A,onSelect:o,isSelected:M})=>{var B,y;const{openWindow:U}=zn(),j=(f.vt_state||"idle").toLowerCase(),O=j==="combat"||j==="hunt",h=(f.total_rares??0)>0?Math.round((f.total_kills??0)/(f.total_rares??1)).toLocaleString():null,_=f.character_name;return d.jsxs("li",{className:`ml-player-row ${M?"ml-player-selected":""}`,style:{borderLeftColor:A},children:[d.jsxs("div",{className:"ml-pr-header",onClick:o,children:[d.jsx("span",{className:"ml-pr-name",children:_}),d.jsx("span",{className:"ml-pr-coords",children:hf(f.ns,f.ew)})]}),d.jsxs("div",{className:"ml-pr-vitals",children:[d.jsx("div",{className:"ml-vital-bar hp",children:d.jsx("div",{className:"ml-vital-fill",style:{width:`${(p==null?void 0:p.health_percentage)??0}%`}})}),d.jsx("div",{className:"ml-vital-bar sta",children:d.jsx("div",{className:"ml-vital-fill",style:{width:`${(p==null?void 0:p.stamina_percentage)??0}%`}})}),d.jsx("div",{className:"ml-vital-bar mana",children:d.jsx("div",{className:"ml-vital-fill",style:{width:`${(p==null?void 0:p.mana_percentage)??0}%`}})})]}),d.jsxs("div",{className:"ml-pr-grid",children:[d.jsxs("span",{className:"ml-gs",title:"Session kills",children:["โš”๏ธ ",((B=f.kills)==null?void 0:B.toLocaleString())??0]}),d.jsxs("span",{className:"ml-gs",title:"Total kills",children:["๐Ÿ† ",(f.total_kills??0).toLocaleString()]}),d.jsxs("span",{className:"ml-gs",title:"Kills per hour",children:[f.kills_per_hour??"0"," ",d.jsx("span",{className:"ml-suffix",children:"KPH"})]}),d.jsxs("span",{className:"ml-gs",title:"Rares (session / total)",children:["๐Ÿ’Ž ",f.session_rares??0," / ",f.total_rares??0]}),d.jsx("span",{className:"ml-gs",title:"Kills per rare",children:h?d.jsxs(d.Fragment,{children:["๐Ÿ“Š ",h," ",d.jsx("span",{className:"ml-suffix",children:"KPR"})]}):""}),d.jsx("span",{className:`ml-meta-pill ${O?"active":j!=="idle"&&j!=="default"&&j!==""?"other":""}`,children:f.vt_state||"idle"}),d.jsxs("span",{className:"ml-gs",title:"Online time",children:["๐Ÿ• ",((y=f.onlinetime)==null?void 0:y.replace(/^00\./,""))??"--"]}),d.jsxs("span",{className:"ml-gs",title:"Deaths",children:["โ˜ ๏ธ ",f.deaths??"0"]}),d.jsxs("span",{className:"ml-gs",title:"Prismatic tapers",children:[d.jsx("img",{src:"/prismatic-taper-icon.png",className:"ml-taper-icon",alt:""}),f.prismatic_taper_count??"0"]})]}),d.jsxs("div",{className:"ml-pr-buttons",children:[d.jsx("button",{className:"ml-btn accent",onClick:()=>U(`chat-${_}`,`Chat: ${_}`,_),children:"Chat"}),d.jsx("button",{className:"ml-btn accent",onClick:()=>U(`stats-${_}`,`Stats: ${_}`,_),children:"Stats"}),d.jsx("button",{className:"ml-btn accent",onClick:()=>U(`inv-${_}`,`Inventory: ${_}`,_),children:"Inv"}),d.jsx("button",{className:"ml-btn",onClick:()=>U(`char-${_}`,`Character: ${_}`,_),children:"Char"}),d.jsx("button",{className:"ml-btn",onClick:()=>U(`combat-${_}`,`Combat: ${_}`,_),children:"Combat"}),d.jsx("button",{className:"ml-btn",onClick:()=>U(`radar-${_}`,`Radar: ${_}`,_),children:"Radar"})]})]})});Cd.displayName="PlayerRow";const _h=({players:f,vitals:p,getColor:A,onSelect:o,selectedPlayer:M})=>{const U=x.useRef(null),[j,O]=x.useState(!1),h=x.useCallback(()=>{U.current&&O(U.current.scrollTop>200)},[]);return d.jsxs("div",{style:{position:"relative",flex:1,minHeight:0},children:[d.jsx("ul",{className:"ml-player-list",ref:U,onScroll:h,children:f.map(_=>d.jsx(Cd,{player:_,vitals:p.get(_.character_name)??null,color:A(_.character_name),onSelect:()=>o(_.character_name),isSelected:M===_.character_name},_.character_name))}),j&&d.jsx("button",{onClick:()=>{var _;(_=U.current)==null||_.scrollTo({top:0,behavior:"smooth"})},style:{position:"absolute",bottom:8,right:8,width:28,height:28,borderRadius:"50%",background:"rgba(68,136,255,0.2)",border:"1px solid rgba(68,136,255,0.4)",color:"#6af",cursor:"pointer",fontSize:"0.8rem",display:"flex",alignItems:"center",justifyContent:"center"},children:"โ–ฒ"})]})},Eh=[{key:"name",label:"Name"},{key:"kph",label:"KPH"},{key:"skills",label:"S.Kills"},{key:"srares",label:"S.Rares"},{key:"tkills",label:"T.Kills"},{key:"kpr",label:"KPR"}],Mh=({value:f,onChange:p})=>d.jsx("div",{className:"ml-sort-buttons",children:Eh.map(A=>d.jsx("button",{className:`ml-sort-btn ${f===A.key?"active":""}`,onClick:()=>p(A.key),children:A.label},A.key))}),Dh=()=>At("/live"),Nh=()=>At("/combat-stats"),jh=()=>At("/server-health"),Oh=()=>At("/total-rares"),Uh=()=>At("/total-kills"),vy=(f,p)=>yf("/agent/ask",{message:f,session_id:p}),gy=()=>yf("/agent/sessions/new",{}),Sy=f=>At(`/agent/sessions/${encodeURIComponent(f)}/history`),Ch=()=>At("/me");async function Rh(){await fetch("/api/logout",{credentials:"include",redirect:"manual"}),window.location.href="/login"}const by=()=>At("/api-admin/users"),py=(f,p,A)=>yf("/api-admin/users",{username:f,password:p,is_admin:A}),zy=(f,p)=>bh(`/api-admin/users/${f}`,p),xy=f=>ph(`/api-admin/users/${f}`);function Hh(){const[f,p]=x.useState(null),[A,o]=x.useState(!0);return x.useEffect(()=>{let M=!1;return Ch().then(U=>{M||p(U)}).catch(()=>{M||p(null)}).finally(()=>{M||o(!1)}),()=>{M=!0}},[]),{user:f,loading:A}}const Bh=()=>{const{openWindow:f}=zn(),{user:p}=Hh(),A=!!(p!=null&&p.is_admin),o=x.useCallback(async()=>{if(confirm("Log out?"))try{await Rh()}catch{window.location.href="/login"}},[]);return d.jsxs("div",{className:"ml-tool-links",children:[d.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>f("agent","Overlord Assistant"),children:"๐Ÿค– Assistant"}),d.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},title:"Opens the player dashboard in a new tab",onClick:()=>window.open("/?view=dashboard","_blank","noopener"),children:"๐Ÿ‘ฅ Dashboard โ†—"}),d.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>f("queststatus","Quest Status"),children:"๐Ÿ“œ Quests"}),d.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>f("issues","Issues Board"),children:"๐Ÿ“‹ Issues"}),d.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>f("vitalsharing","Vital Sharing"),children:"๐Ÿค Vitals"}),d.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>f("combatpicker","Combat Stats"),children:"โš”๏ธ Combat"}),A&&d.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>f("adminusers","Admin ยท Users"),children:"๐Ÿ›ก๏ธ Admin"}),d.jsxs("span",{className:"ml-tool-link ml-tool-link-logout",style:{cursor:"pointer"},onClick:o,title:p?`Logged in as ${p.username}`:"Log out",children:["๐Ÿšช Log out",p?` (${p.username})`:""]})]})},qh=({players:f,vitals:p,serverHealth:A,totalRares:o,totalKills:M,getColor:U,onSelectPlayer:j,showHeatmap:O,showPortals:h,onToggleHeatmap:_,onTogglePortals:B,version:y,selectedPlayer:N})=>{var F,ll;const[C,Q]=x.useState("name"),[P,fl]=x.useState(""),Sl=x.useMemo(()=>f.reduce((V,K)=>V+(parseInt(K.kills_per_hour)||0),0),[f]),J=((F=A==null?void 0:A.status)==null?void 0:F.toLowerCase())==="online"||((ll=A==null?void 0:A.status)==null?void 0:ll.toLowerCase())==="up",w=x.useDeferredValue(f),Ml=x.useDeferredValue(p),Vl=x.useMemo(()=>{let V=[...w];switch(P&&(V=V.filter(K=>K.character_name.toLowerCase().startsWith(P.toLowerCase()))),C){case"kph":V.sort((K,W)=>(parseInt(W.kills_per_hour)||0)-(parseInt(K.kills_per_hour)||0));break;case"skills":V.sort((K,W)=>(W.kills||0)-(K.kills||0));break;case"srares":V.sort((K,W)=>(W.session_rares??0)-(K.session_rares??0));break;case"tkills":V.sort((K,W)=>(W.total_kills??0)-(K.total_kills??0));break;case"kpr":V.sort((K,W)=>{const Ul=(K.total_kills??0)/Math.max(1,K.total_rares??1),xl=(W.total_kills??0)/Math.max(1,W.total_rares??1);return Ul-xl});break;default:V.sort((K,W)=>K.character_name.localeCompare(W.character_name))}return V},[w,C,P]);return d.jsxs("div",{className:"ml-sidebar",children:[y&&d.jsxs("div",{className:"ml-version",children:["v",y]}),d.jsx("div",{className:"ml-sidebar-header",children:d.jsxs("span",{className:"ml-sidebar-title",style:{cursor:"pointer"},onClick:()=>{const V=document.createElement("div");V.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;background:#000;z-index:999999;display:flex;align-items:center;justify-content:center;";const K=document.createElement("video");K.src="/rick.mp4",K.autoplay=!0,K.loop=!0,K.style.cssText="width:100vw;height:100vh;object-fit:cover;",V.appendChild(K),document.body.appendChild(V),document.body.style.animation="ml-shake 0.05s 30";const W=document.createElement("style");W.textContent="@keyframes ml-shake{0%,100%{transform:translate(0) rotate(0)}25%{transform:translate(-15px,10px) rotate(-2deg)}50%{transform:translate(15px,-10px) rotate(2deg)}75%{transform:translate(-10px,-15px) rotate(-1deg)}} @keyframes ml-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}",document.head.appendChild(W),setTimeout(()=>{V.style.animation="ml-spin 3s linear infinite"},1500),K.play().catch(()=>{})},children:["Active Mosswart Enjoyers (",f.length,")"]})}),d.jsxs("div",{className:"ml-server-status",children:[d.jsx("span",{className:`ml-status-dot ${J?"online":"offline"}`}),d.jsxs("span",{className:"ml-status-text",children:["Coldeve ",J?"Online":"Offline"]}),(A==null?void 0:A.player_count)!=null&&d.jsxs("span",{className:"ml-status-detail",children:["๐Ÿ‘ฅ ",A.player_count]}),(A==null?void 0:A.latency_ms)!=null&&d.jsxs("span",{className:"ml-status-detail",children:[Math.round(A.latency_ms),"ms"]}),(A==null?void 0:A.uptime_seconds)!=null&&d.jsxs("span",{className:"ml-status-detail",children:["Up: ",Math.floor(A.uptime_seconds/3600),"h"]})]}),d.jsxs("div",{className:"ml-counters",children:[d.jsxs("div",{className:"ml-counter rares",children:[d.jsx("span",{className:"ml-counter-val",children:o}),d.jsx("span",{className:"ml-counter-lbl",children:"Rares"})]}),d.jsxs("div",{className:`ml-counter kph ${Sl>5e3?"ultra":""}`,children:[d.jsx("span",{className:"ml-counter-val",children:Sl.toLocaleString()}),d.jsx("span",{className:"ml-counter-lbl",children:"Server KPH"})]}),d.jsxs("div",{className:"ml-counter kills",children:[d.jsx("span",{className:"ml-counter-val",children:M.toLocaleString()}),d.jsx("span",{className:"ml-counter-lbl",children:"Kills"})]})]}),d.jsxs("div",{className:"ml-tool-links",children:[d.jsx("a",{href:"/inventory.html",target:"_blank",className:"ml-tool-link",children:"๐Ÿ” Inv Search"}),d.jsx("a",{href:"/suitbuilder.html",target:"_blank",className:"ml-tool-link",children:"๐Ÿ›ก๏ธ Suitbuilder"}),d.jsx("a",{href:"/debug.html",target:"_blank",className:"ml-tool-link",children:"๐Ÿ› Debug"})]}),d.jsx(Bh,{}),d.jsxs("div",{className:"ml-toggles",children:[d.jsxs("label",{className:"ml-toggle-label",children:[d.jsx("input",{type:"checkbox",checked:O,onChange:V=>_(V.target.checked)}),d.jsx("span",{children:"Spawn Heatmap"})]}),d.jsxs("label",{className:"ml-toggle-label",children:[d.jsx("input",{type:"checkbox",checked:h,onChange:V=>B(V.target.checked)}),d.jsx("span",{children:"Portals"})]})]}),d.jsx("div",{style:{borderTop:"1px solid #333",marginTop:4,paddingTop:4}}),d.jsx(Mh,{value:C,onChange:Q}),d.jsx("input",{className:"ml-filter",type:"text",placeholder:"Filter players...",value:P,onChange:V=>fl(V.target.value)}),d.jsx(_h,{players:Vl,vitals:Ml,getColor:U,onSelect:j,selectedPlayer:N})]})},Yh="modulepreload",Xh=function(f){return"/"+f},Md={},St=function(p,A,o){let M=Promise.resolve();if(A&&A.length>0){let j=function(_){return Promise.all(_.map(B=>Promise.resolve(B).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const O=document.querySelector("meta[property=csp-nonce]"),h=(O==null?void 0:O.nonce)||(O==null?void 0:O.getAttribute("nonce"));M=j(A.map(_=>{if(_=Xh(_),_ in Md)return;Md[_]=!0;const B=_.endsWith(".css"),y=B?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${_}"]${y}`))return;const N=document.createElement("link");if(N.rel=B?"stylesheet":Yh,B||(N.as="script"),N.crossOrigin="",N.href=_,h&&N.setAttribute("nonce",h),document.head.appendChild(N),B)return new Promise((C,Q)=>{N.addEventListener("load",C),N.addEventListener("error",()=>Q(new Error(`Unable to preload CSS for ${_}`)))})}))}function U(j){const O=new Event("vite:preloadError",{cancelable:!0});if(O.payload=j,window.dispatchEvent(O),!O.defaultPrevented)throw j}return M.then(j=>{for(const O of j||[])O.status==="rejected"&&U(O.reason);return p().catch(U)})},Rd=({id:f,title:p,zIndex:A,width:o=700,height:M=340,children:U})=>{const{closeWindow:j,bringToFront:O}=zn(),h=x.useRef(null),_=x.useRef({dragging:!1,sx:0,sy:0,ox:0,oy:0}),B=x.useRef({resizing:!1,sx:0,sy:0,sw:0,sh:0}),y=x.useRef({x:420,y:10+Math.random()*40}),[N,C]=x.useState({w:o,h:M}),Q=x.useCallback(fl=>{var J;fl.preventDefault(),O(f);const Sl=(J=h.current)==null?void 0:J.getBoundingClientRect();Sl&&(_.current={dragging:!0,sx:fl.clientX,sy:fl.clientY,ox:Sl.left,oy:Sl.top})},[f,O]),P=x.useCallback(fl=>{fl.preventDefault(),fl.stopPropagation(),B.current={resizing:!0,sx:fl.clientX,sy:fl.clientY,sw:N.w,sh:N.h}},[N.w,N.h]);return x.useEffect(()=>{const fl=J=>{const w=_.current;w.dragging&&h.current&&(y.current.x=w.ox+(J.clientX-w.sx),y.current.y=w.oy+(J.clientY-w.sy),h.current.style.left=`${y.current.x}px`,h.current.style.top=`${y.current.y}px`);const Ml=B.current;if(Ml.resizing){const Vl=Math.max(300,Ml.sw+(J.clientX-Ml.sx)),F=Math.max(200,Ml.sh+(J.clientY-Ml.sy));C({w:Vl,h:F})}},Sl=()=>{_.current.dragging=!1,B.current.resizing=!1};return window.addEventListener("mousemove",fl),window.addEventListener("mouseup",Sl),()=>{window.removeEventListener("mousemove",fl),window.removeEventListener("mouseup",Sl)}},[]),d.jsxs("div",{ref:h,className:"ml-window",style:{zIndex:A,width:N.w,height:N.h,left:y.current.x,top:y.current.y},onMouseDown:()=>O(f),children:[d.jsxs("div",{className:"ml-window-header",onMouseDown:Q,children:[d.jsx("span",{className:"ml-window-title",children:p}),d.jsx("button",{className:"ml-window-close",onClick:()=>j(f),children:"ร—"})]}),d.jsx("div",{className:"ml-window-content",children:U}),d.jsx("div",{className:"ml-window-resize",onMouseDown:P})]})},Gh={0:"#00FF00",2:"#FFFFFF",3:"#FF0000",4:"#FFFFFF",5:"#33CCFF",6:"#CCFF99",7:"#00FFFF",14:"#FFD700",15:"#FF69B4",17:"#AAAAFF",18:"#88FF88",21:"#FF8888",22:"#FFAA66"},Hd=50,Bd=f=>`mo-chat-history-${f}`;function Qh(f){try{const p=localStorage.getItem(Bd(f));return p?JSON.parse(p):[]}catch{return[]}}function Vh(f,p){try{localStorage.setItem(Bd(f),JSON.stringify(p.slice(-Hd)))}catch{}}const Zh=({id:f,charName:p,zIndex:A,messages:o,socket:M})=>{const U=x.useRef(null),[j,O]=x.useState(""),[h,_]=x.useState(!1),B=x.useRef(Qh(p)),y=x.useRef(-1),N=x.useRef(""),C=x.useRef(!1);x.useEffect(()=>{const J=U.current;J&&(C.current?_(!0):(J.scrollTop=J.scrollHeight,_(!1)))},[o.length]);const Q=x.useCallback(()=>{const J=U.current;if(!J)return;const w=J.scrollHeight-J.scrollTop-J.clientHeight<30;C.current=!w,w&&_(!1)},[]),P=x.useCallback(()=>{const J=U.current;J&&(J.scrollTop=J.scrollHeight,C.current=!1,_(!1))},[]),fl=x.useCallback(J=>{J.preventDefault();const w=j.trim();!w||!M||M.readyState!==WebSocket.OPEN||(M.send(JSON.stringify({player_name:p,command:w})),B.current.push(w),B.current.length>Hd&&B.current.shift(),Vh(p,B.current),y.current=-1,N.current="",O(""),C.current=!1)},[j,M,p]),Sl=x.useCallback(J=>{const w=B.current;if(w.length!==0){if(J.key==="ArrowUp")J.preventDefault(),y.current===-1?(N.current=j,y.current=w.length-1):y.current>0&&y.current--,O(w[y.current]);else if(J.key==="ArrowDown"){if(J.preventDefault(),y.current===-1)return;y.currentd.jsx("div",{className:"ml-chat-line",style:{color:Gh[J.color??2]??"#ddd"},children:J.text},w))}),h&&d.jsx("div",{onClick:P,style:{padding:"3px 0",textAlign:"center",fontSize:"0.65rem",color:"#6af",background:"#1a2a3a",cursor:"pointer",borderTop:"1px solid #334"},children:"โ–ผ New messages below"}),d.jsx("form",{className:"ml-chat-form",onSubmit:fl,children:d.jsx("input",{className:"ml-chat-input",value:j,onChange:J=>O(J.target.value),onKeyDown:Sl,placeholder:"Enter chat..."})})]})},Lh=x.lazy(()=>St(()=>import("./StatsWindow-CIRZXtNg.js"),__vite__mapDeps([0,1])).then(f=>({default:f.StatsWindow}))),Kh=x.lazy(()=>St(()=>import("./CharacterWindow-DB25PGyW.js"),__vite__mapDeps([2,1])).then(f=>({default:f.CharacterWindow}))),Jh=x.lazy(()=>St(()=>import("./InventoryWindow-CsRCfFA4.js"),__vite__mapDeps([3,1])).then(f=>({default:f.InventoryWindow}))),wh=x.lazy(()=>St(()=>import("./RadarWindow-BWeCin-b.js"),__vite__mapDeps([4,1])).then(f=>({default:f.RadarWindow}))),kh=x.lazy(()=>St(()=>import("./CombatStatsWindow-DSDCf8zG.js"),__vite__mapDeps([5,1])).then(f=>({default:f.CombatStatsWindow}))),Wh=x.lazy(()=>St(()=>import("./CombatPickerWindow-EVVSrp8z.js"),__vite__mapDeps([6,1])).then(f=>({default:f.CombatPickerWindow}))),$h=x.lazy(()=>St(()=>import("./IssuesWindow-B7wMTxUh.js"),__vite__mapDeps([7,1])).then(f=>({default:f.IssuesWindow}))),Fh=x.lazy(()=>St(()=>import("./VitalSharingWindow-Cr06Ao6f.js"),__vite__mapDeps([8,1])).then(f=>({default:f.VitalSharingWindow}))),Ih=x.lazy(()=>St(()=>import("./QuestStatusWindow-BZVZJ6b0.js"),__vite__mapDeps([9,1])).then(f=>({default:f.QuestStatusWindow}))),Ph=x.lazy(()=>St(()=>Promise.resolve().then(()=>ry),void 0).then(f=>({default:f.PlayerDashboardWindow}))),ly=x.lazy(()=>St(()=>import("./AgentWindow-D4IwDfCh.js"),__vite__mapDeps([10,1])).then(f=>({default:f.AgentWindow}))),ty=x.lazy(()=>St(()=>import("./AdminUsersWindow-CjCV57tE.js"),__vite__mapDeps([11,1])).then(f=>({default:f.AdminUsersWindow}))),qd=pn.memo(({characters:f,chatMessages:p,nearbyObjects:A,inventoryVersions:o,equipmentCantrips:M,characterStats:U,socket:j})=>{const{windows:O}=zn();return d.jsx(x.Suspense,{fallback:null,children:O.map(h=>{var y;const _=h.charName??"";switch(h.id.split("-")[0]){case"chat":return d.jsx(Zh,{id:h.id,charName:_,zIndex:h.zIndex,messages:p.get(_)??[],socket:j},h.id);case"stats":return d.jsx(Lh,{id:h.id,charName:_,zIndex:h.zIndex},h.id);case"char":return d.jsx(Kh,{id:h.id,charName:_,zIndex:h.zIndex,vitals:((y=f.get(_))==null?void 0:y.vitals)??void 0,liveStats:U.get(_)},h.id);case"inv":return d.jsx(Jh,{id:h.id,charName:_,zIndex:h.zIndex,inventoryVersion:o.get(_)??0,equipmentCantrips:M.get(_)},h.id);case"radar":return d.jsx(wh,{id:h.id,charName:_,zIndex:h.zIndex,socket:j,radarData:A.get(_)??null},h.id);case"combat":return d.jsx(kh,{id:h.id,charName:_,zIndex:h.zIndex},h.id);case"combatpicker":return d.jsx(Wh,{id:h.id,zIndex:h.zIndex,characters:f},h.id);case"issues":return d.jsx($h,{id:h.id,zIndex:h.zIndex},h.id);case"vitalsharing":return d.jsx(Fh,{id:h.id,zIndex:h.zIndex},h.id);case"queststatus":return d.jsx(Ih,{id:h.id,zIndex:h.zIndex},h.id);case"playerdash":return d.jsx(Ph,{id:h.id,zIndex:h.zIndex,characters:f},h.id);case"agent":return d.jsx(ly,{id:h.id,zIndex:h.zIndex},h.id);case"adminusers":return d.jsx(ty,{id:h.id,zIndex:h.zIndex},h.id);default:return null}})})});qd.displayName="WindowRenderer";let ay=0;const ey=({recentRares:f})=>{const[p,A]=x.useState([]),[o,M]=x.useState(0),[U,j]=x.useState([]);x.useEffect(()=>{if(f.length>o&&o>0){const h=f.slice(0,f.length-o);for(const _ of h){const B=++ay;A(y=>[...y,{key:B,charName:_.character_name,rareName:_.name,exiting:!1}]),O();try{const y=new AudioContext,N=y.createOscillator(),C=y.createGain();N.connect(C),C.connect(y.destination),N.frequency.value=880,N.type="sine",C.gain.value=.3,N.start(),C.gain.exponentialRampToValueAtTime(.001,y.currentTime+.5),N.stop(y.currentTime+.5)}catch{}setTimeout(()=>{A(y=>y.map(N=>N.key===B?{...N,exiting:!0}:N)),setTimeout(()=>{A(y=>y.filter(N=>N.key!==B))},500)},6e3)}}M(f.length)},[f.length]);const O=x.useCallback(()=>{const h=Date.now(),_=["#FFD700","#FF4444","#FF8800","#AA44FF","#4488FF"],B=Array.from({length:30},(y,N)=>{const C=Math.PI*2*N/30+(Math.random()-.5)*.5,Q=100+Math.random()*200;return{dx:Math.cos(C)*Q,dy:Math.sin(C)*Q-50,color:_[Math.floor(Math.random()*_.length)]}});j(y=>[...y,{id:h,particles:B}]),setTimeout(()=>j(y=>y.filter(N=>N.id!==h)),2200)},[]);return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"ml-rare-notifications",children:p.map(h=>d.jsxs("div",{className:`ml-rare-notif ${h.exiting?"exiting":""}`,children:[d.jsx("div",{className:"ml-rare-notif-title",children:"๐ŸŽ† LEGENDARY RARE! ๐ŸŽ†"}),d.jsx("div",{className:"ml-rare-notif-name",children:h.rareName}),d.jsx("div",{className:"ml-rare-notif-by",children:"found by"}),d.jsx("div",{className:"ml-rare-notif-char",children:h.charName})]},h.key))}),d.jsx("div",{className:"ml-fireworks",children:U.map(h=>d.jsx(pn.Fragment,{children:h.particles.map((_,B)=>d.jsx("div",{className:"ml-firework-particle",style:{left:"50%",top:"30%",backgroundColor:_.color,"--dx":`${_.dx}px`,"--dy":`${_.dy+200}px`}},B))},h.id))})]})};let ny=0;const uy=({deathAlerts:f})=>{const[p,A]=x.useState([]),o=x.useRef(0);return x.useEffect(()=>{if(f.length>o.current&&o.current>0){const M=f.slice(o.current);for(const U of M){const j=++ny;A(O=>[...O,{key:j,alert:U,exiting:!1}]);try{const O=new AudioContext,h=O.createOscillator(),_=O.createGain();h.connect(_),_.connect(O.destination),h.frequency.value=440,h.type="sawtooth",_.gain.value=.2,h.start(),_.gain.exponentialRampToValueAtTime(.001,O.currentTime+.8),h.stop(O.currentTime+.8)}catch{}setTimeout(()=>{A(O=>O.map(h=>h.key===j?{...h,exiting:!0}:h)),setTimeout(()=>A(O=>O.filter(h=>h.key!==j)),500)},8e3)}}o.current=f.length},[f.length]),p.length===0?null:d.jsx("div",{style:{position:"fixed",top:70,left:"50%",transform:"translateX(-50%)",zIndex:99999,display:"flex",flexDirection:"column",gap:6,pointerEvents:"none"},children:p.map(M=>d.jsxs("div",{style:{background:"linear-gradient(135deg, #2a0a0a, #1a0000)",border:"2px solid #cc4444",borderRadius:8,padding:"12px 24px",textAlign:"center",boxShadow:"0 0 30px rgba(204, 68, 68, 0.3)",animation:M.exiting?"ml-notif-out 0.5s ease-in forwards":"ml-notif-in 0.5s ease-out"},children:[d.jsx("div",{style:{fontSize:"1.2rem",fontWeight:800,color:"#ff4444"},children:"โ˜ ๏ธ CHARACTER DIED โ˜ ๏ธ"}),d.jsx("div",{style:{fontSize:"1rem",fontWeight:600,color:"#fff",marginTop:2},children:M.alert.character_name}),d.jsxs("div",{style:{fontSize:"0.8rem",color:"#c88",marginTop:2},children:["Vitae: ",M.alert.vitae,"%"]})]},M.key))})},Dd=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf","#ff4444","#44ff44","#4444ff","#ffff44","#ff44ff","#44ffff","#ff8844","#88ff44","#4488ff","#ff4488","#cc3333","#33cc33","#3333cc","#cccc33","#cc33cc","#33cccc","#cc6633","#66cc33","#3366cc","#cc3366","#ff6666","#66ff66","#6666ff","#ffff66","#ff66ff","#66ffff","#ffaa66","#aaff66","#66aaff","#ff66aa","#990099","#009900","#000099","#990000","#009999","#999900","#aa5500","#55aa00","#0055aa","#aa0055","#ffaaaa","#aaffaa","#aaaaff","#ffffaa","#ffaaff","#aaffff","#ffccaa","#ccffaa","#aaccff","#ffaacc"];function cy(f){let p=0;for(let A=0;A{let M=f.current.get(o);return M||(M=p.current{const p=iy(),[A,o]=x.useState(!1),[M,U]=x.useState(!1),[j,O]=x.useState(null),h=x.useMemo(()=>Array.from(f.characters.values()).filter(C=>C.telemetry).map(C=>C.telemetry),[f.characters]),_=x.useMemo(()=>new Map(Array.from(f.characters.values()).filter(C=>C.vitals).map(C=>[C.name,C.vitals])),[f.characters]),[B,y]=x.useState("");x.useEffect(()=>{fetch("/api/api-version",{credentials:"include"}).then(C=>C.json()).then(C=>y(C.version??"")).catch(()=>{})},[]);const N=x.useCallback(C=>{O(Q=>Q===C?null:C)},[]);return d.jsx(gh,{children:d.jsxs("div",{className:"ml-layout",children:[d.jsx(qh,{players:h,vitals:_,serverHealth:f.serverHealth,totalRares:f.totalRares,totalKills:f.totalKills,getColor:p,onSelectPlayer:N,showHeatmap:A,showPortals:M,onToggleHeatmap:o,onTogglePortals:U,version:B,selectedPlayer:j}),d.jsx(Th,{players:h,getColor:p,onSelectPlayer:N,showHeatmap:A,showPortals:M,selectedPlayer:j}),d.jsx(qd,{characters:f.characters,chatMessages:f.chatMessages,nearbyObjects:f.nearbyObjects,inventoryVersions:f.inventoryVersions,equipmentCantrips:f.equipmentCantrips,characterStats:f.characterStats,socket:f.socketRef.current}),d.jsx(ey,{recentRares:f.recentRares}),d.jsx(uy,{deathAlerts:f.deathAlerts})]})})};function sy(f){const p=x.useRef(null),A=x.useRef(0),o=x.useRef(f);o.current=f;const M=x.useCallback(()=>{var j;if(((j=p.current)==null?void 0:j.readyState)===WebSocket.OPEN)return;const U=new WebSocket(zh());p.current=U,U.addEventListener("message",O=>{try{const h=JSON.parse(O.data);o.current(h)}catch{}}),U.addEventListener("close",()=>{p.current=null,A.current=window.setTimeout(M,2e3)}),U.addEventListener("error",()=>{U.close()})},[]);return x.useEffect(()=>(M(),()=>{var U;clearTimeout(A.current),(U=p.current)==null||U.close(),p.current=null}),[M]),p}function Yd(){const[f,p]=x.useState(new Map),[A,o]=x.useState(null),[M,U]=x.useState(0),[j,O]=x.useState(0),[h,_]=x.useState([]),B=x.useRef(new Map),[y,N]=x.useState(0),[C,Q]=x.useState(new Map),P=x.useRef(new Map),[fl,Sl]=x.useState(0),J=x.useRef(new Map),[w,Ml]=x.useState(0),[Vl,F]=x.useState([]),[ll,V]=x.useState(new Map),K=x.useRef(f);K.current=f;const W=x.useCallback((S,R)=>{p(G=>{const H=new Map(G),Y=H.get(S)??{name:S,telemetry:null,vitals:null,combat:null,lastUpdate:0};return H.set(S,R(Y)),H})},[]),Ul=x.useCallback(S=>{var R,G;if(S.type){if(S.type==="telemetry"){const H=S;W(H.character_name,Y=>({...Y,telemetry:H,lastUpdate:Date.now()}))}else if(S.type==="vitals"){const H=S,Y=(R=K.current.get(H.character_name))==null?void 0:R.vitals;Y&&(Y.vitae??0)===0&&(H.vitae??0)>0&&F(sl=>[...sl,{character_name:H.character_name,vitae:H.vitae,timestamp:new Date().toISOString()}].slice(-50)),W(H.character_name,sl=>({...sl,vitals:H,lastUpdate:Date.now()}))}else if(S.type==="combat_stats"){const H=S;W(H.character_name,Y=>({...Y,combat:H,lastUpdate:Date.now()}))}else if(S.type==="rare"){const H=S;_(Y=>[H,...Y].slice(0,50))}else if(S.type==="inventory_delta"){const H=S;H.character_name&&Q(Y=>{const sl=new Map(Y);return sl.set(H.character_name,(sl.get(H.character_name)??0)+1),sl})}else if(S.type==="character_stats"){const H=S;J.current.set(H.character_name,S),Ml(Y=>Y+1)}else if(S.type==="equipment_cantrip_state"){const H=S;P.current.set(H.character_name,H),Sl(Y=>Y+1)}else if(S.type==="dungeon_map"){const H=S;H.landblock&&(window.__dungeonMapCache||(window.__dungeonMapCache={}),window.__dungeonMapCache[H.landblock]=H)}else if(S.type==="nearby_objects"){const H=S;if(V(Y=>{const sl=new Map(Y);return sl.set(H.character_name,H),sl}),H.is_dungeon&&H.landblock&&!((G=window.__dungeonMapCache)!=null&&G[H.landblock])){const Y=xl.current;(Y==null?void 0:Y.readyState)===WebSocket.OPEN&&Y.send(JSON.stringify({type:"request_dungeon_map",landblock:H.landblock}))}}else if(S.type==="chat"){const H=S,Y=B.current.get(H.character_name)??[];Y.push({text:H.text,color:H.color,timestamp:H.timestamp}),Y.length>1e3&&Y.splice(0,Y.length-1e3),B.current.set(H.character_name,Y),N(sl=>sl+1)}}},[W]),xl=sy(Ul);x.useEffect(()=>{const S=async()=>{try{const G=await Dh();p(H=>{var sl;const Y=new Map(H);for(const ol of G.players??[]){const I=Y.get(ol.character_name);Y.set(ol.character_name,{name:ol.character_name,telemetry:ol,vitals:(I==null?void 0:I.vitals)??null,combat:(I==null?void 0:I.combat)??null,lastUpdate:Date.now()})}for(const ol of Y.keys())(sl=G.players)!=null&&sl.some(I=>I.character_name===ol)||Y.delete(ol);return Y})}catch{}};S();const R=setInterval(S,5e3);return()=>clearInterval(R)},[]),x.useEffect(()=>{const S=async()=>{try{const G=await Nh();for(const H of G.stats??[])W(H.character_name,Y=>({...Y,combat:{...H,type:"combat_stats"}}))}catch{}};S();const R=setInterval(S,3e4);return()=>clearInterval(R)},[W]),x.useEffect(()=>{const S=async()=>{try{o(await jh())}catch{}};S();const R=setInterval(S,3e4);return()=>clearInterval(R)},[]),x.useEffect(()=>{const S=async()=>{try{const[G,H]=await Promise.all([Oh(),Uh()]);U(G.all_time??0),O(H.total??0)}catch{}};S();const R=setInterval(S,3e5);return()=>clearInterval(R)},[]);const jt=x.useMemo(()=>B.current,[y]),Tt=x.useMemo(()=>P.current,[fl]),bt=x.useMemo(()=>J.current,[w]);return{characters:f,serverHealth:A,totalRares:M,totalKills:j,recentRares:h,chatMessages:jt,nearbyObjects:ll,inventoryVersions:C,equipmentCantrips:Tt,characterStats:bt,deathAlerts:Vl,socketRef:xl}}const vf=({characters:f})=>{const[p,A]=x.useState("kph"),[o,M]=x.useState(!1),[U,j]=x.useState(null),O=x.useMemo(()=>{const y=Array.from(f.values()).filter(N=>N.telemetry).map(N=>{var Q,P,fl;const C=N.telemetry;return{name:N.name,kills:C.kills??0,kph:parseInt(C.kills_per_hour)||0,totalKills:C.total_kills??0,rares:C.total_rares??0,sessionRares:C.session_rares??0,deaths:parseInt(C.deaths)||0,totalDeaths:parseInt(C.total_deaths)||0,uptime:((Q=C.onlinetime)==null?void 0:Q.replace(/^00\./,""))??"",state:C.vt_state??"idle",tapers:parseInt(C.prismatic_taper_count)||0,hp:((P=N.vitals)==null?void 0:P.health_percentage)??0,vitae:((fl=N.vitals)==null?void 0:fl.vitae)??0}});return y.sort((N,C)=>{let Q=0;switch(p){case"name":Q=N.name.localeCompare(C.name);break;case"kills":Q=N.kills-C.kills;break;case"kph":Q=N.kph-C.kph;break;case"rares":Q=N.rares-C.rares;break;case"deaths":Q=N.totalDeaths-C.totalDeaths;break;case"uptime":Q=N.uptime.localeCompare(C.uptime);break;case"state":Q=N.state.localeCompare(C.state);break}return o?Q:-Q}),y},[f,p,o]),h=y=>{p===y?M(!o):(A(y),M(!1))},_=y=>({padding:"4px 6px",cursor:"pointer",userSelect:"none",color:p===y?"#6af":"#888",fontSize:"0.65rem",fontWeight:600,whiteSpace:"nowrap",borderBottom:"1px solid #444"}),B=y=>p===y?o?" โ–ฒ":" โ–ผ":"";return d.jsxs("div",{style:{flex:1,overflow:"auto",fontSize:"0.73rem"},children:[d.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[d.jsx("thead",{children:d.jsxs("tr",{style:{position:"sticky",top:0,background:"#1a1a1a",zIndex:1},children:[d.jsxs("th",{style:{..._("name"),textAlign:"left"},onClick:()=>h("name"),children:["Character",B("name")]}),d.jsxs("th",{style:{..._("state"),textAlign:"center"},onClick:()=>h("state"),children:["State",B("state")]}),d.jsxs("th",{style:{..._("kph"),textAlign:"right"},onClick:()=>h("kph"),children:["KPH",B("kph")]}),d.jsxs("th",{style:{..._("kills"),textAlign:"right"},onClick:()=>h("kills"),children:["Session",B("kills")]}),d.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"Total"}),d.jsxs("th",{style:{..._("rares"),textAlign:"right"},onClick:()=>h("rares"),children:["Rares",B("rares")]}),d.jsxs("th",{style:{..._("deaths"),textAlign:"right"},onClick:()=>h("deaths"),children:["Deaths",B("deaths")]}),d.jsxs("th",{style:{..._("uptime"),textAlign:"right"},onClick:()=>h("uptime"),children:["Uptime",B("uptime")]}),d.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"HP%"}),d.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"Vitae"}),d.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"Tapers"})]})}),d.jsx("tbody",{children:O.map(y=>{const N=y.state.toLowerCase(),C=N==="combat"||N==="hunt",Q=U===y.name;return d.jsxs("tr",{onClick:()=>j(Q?null:y.name),style:{borderBottom:"1px solid #1a1a1a",cursor:"pointer",background:Q?"rgba(102, 170, 255, 0.18)":void 0,outline:Q?"1px solid rgba(102, 170, 255, 0.55)":void 0,outlineOffset:"-1px"},children:[d.jsx("td",{style:{padding:"3px 10px 3px 6px",color:"#ccc",fontWeight:500,whiteSpace:"nowrap"},children:y.name}),d.jsx("td",{style:{textAlign:"center",padding:"3px 6px"},children:d.jsx("span",{style:{fontSize:"0.6rem",padding:"1px 6px",borderRadius:3,background:C?"rgba(68,204,68,0.15)":N==="idle"||N==="default"?"rgba(100,100,100,0.2)":"rgba(204,68,68,0.15)",color:C?"#4c4":N==="idle"||N==="default"?"#888":"#c44"},children:y.state})}),d.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#4c4",fontVariantNumeric:"tabular-nums"},children:y.kph.toLocaleString()}),d.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#ccc",fontVariantNumeric:"tabular-nums"},children:y.kills.toLocaleString()}),d.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#888",fontVariantNumeric:"tabular-nums"},children:y.totalKills.toLocaleString()}),d.jsxs("td",{style:{textAlign:"right",padding:"3px 6px",color:"#fc0",fontVariantNumeric:"tabular-nums"},children:[y.rares,y.sessionRares>0?` (${y.sessionRares})`:""]}),d.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:y.totalDeaths>0?"#c66":"#555",fontVariantNumeric:"tabular-nums"},children:y.totalDeaths}),d.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#888",fontVariantNumeric:"tabular-nums"},children:y.uptime}),d.jsxs("td",{style:{textAlign:"right",padding:"3px 6px",fontVariantNumeric:"tabular-nums",color:y.hp>80?"#4c4":y.hp>40?"#ca0":"#c44"},children:[y.hp.toFixed(0),"%"]}),d.jsx("td",{style:{textAlign:"right",padding:"3px 6px",fontVariantNumeric:"tabular-nums",color:y.vitae>0?"#f66":"#333"},children:y.vitae>0?`${y.vitae}%`:""}),d.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#888",fontVariantNumeric:"tabular-nums"},children:y.tapers.toLocaleString()})]},y.name)})})]}),O.length===0&&d.jsx("div",{style:{padding:20,color:"#666",textAlign:"center"},children:"No characters online"})]})},oy=({id:f,zIndex:p,characters:A})=>d.jsx(Rd,{id:f,title:"Player Dashboard",zIndex:p,width:850,height:500,children:d.jsx(vf,{characters:A})}),ry=Object.freeze(Object.defineProperty({__proto__:null,PlayerDashboardContent:vf,PlayerDashboardWindow:oy},Symbol.toStringTag,{value:"Module"})),dy=()=>{const f=Yd(),[p,A]=x.useState("");x.useEffect(()=>{const M=document.title;return document.title="Overlord Dashboard",()=>{document.title=M}},[]),x.useEffect(()=>{fetch("/api/api-version",{credentials:"include"}).then(M=>M.json()).then(M=>A(M.version??"")).catch(()=>{})},[]);const o=Array.from(f.characters.values()).filter(M=>M.telemetry).length;return d.jsxs("div",{className:"ml-dashboard-page",children:[d.jsxs("header",{className:"ml-dashboard-header",children:[d.jsx("span",{className:"ml-dashboard-title",children:"๐Ÿ‘ฅ Player Dashboard"}),d.jsxs("span",{className:"ml-dashboard-count",children:[o," online"]}),d.jsx("span",{style:{flex:1}}),p&&d.jsxs("span",{className:"ml-dashboard-version",children:["v",p]})]}),d.jsx("main",{className:"ml-dashboard-main",children:d.jsx(vf,{characters:f.characters})})]})};function my(){return new URLSearchParams(window.location.search).get("view")==="dashboard"?d.jsx(dy,{}):d.jsx(hy,{})}function hy(){const f=Yd();return d.jsx(fy,{data:f})}vh.createRoot(document.getElementById("root")).render(d.jsx(x.StrictMode,{children:d.jsx(my,{})}));"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});export{Rd as D,At as a,Sy as b,vy as c,gy as d,Hh as e,py as f,zy as g,xy as h,d as j,by as l,x as r,zn as u};