-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicrobotEvolutionLab.hta
More file actions
293 lines (291 loc) · 332 KB
/
Copy pathMicrobotEvolutionLab.hta
File metadata and controls
293 lines (291 loc) · 332 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8" />
<title>Microbot Evolution Lab - 0.1.228</title>
<HTA:APPLICATION
ID="MicrobotEvolutionLabApp"
APPLICATIONNAME="Microbot Evolution Lab"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
ICON="favicon.ico"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="maximize"
NAVIGABLE="yes"
/>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🤖</text></svg>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Microbot Evolution Lab - Beta 0.1.2</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;800&display=swap" rel="stylesheet">
<script>
window.onerror = function(msg, url, line) {
console.error("Diagnostic error listener caught:", msg, url, line);
}; var container = document.getElementById('root');
if (container) {
container.innerHTML = '<div style="background:#080E14;color:#FF6B00;padding:30px;font-family:monospace;min-height:100vh;">' +
'<h2 style="color:#00E5FF">⚠️ MICROBOT EVOLUTION LAB RUNTIME LOG</h2>' +
'<p style="margin-top:10px;"><strong>Error:</strong> ' + msg + '</p>' +
'<p><strong>Location:</strong> Line ' + lineNo + ':' + columnNo + '</p>' +
'<pre style="background:#0f1a24;padding:15px;border:1px solid #00E5FF;margin-top:15px;color:#fff;overflow:auto;">' + (error && error.stack ? error.stack : msg) + '</pre>' +
'</div>';
}
return false;
};
</script>
<script type="module" crossorigin>var ld=Object.defineProperty;var ad=(e,t,n)=>t in e?ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var R=(e,t,n)=>ad(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function ud(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wa={exports:{}},Li={},_a={exports:{}},$={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ar=Symbol.for("react.element"),cd=Symbol.for("react.portal"),dd=Symbol.for("react.fragment"),hd=Symbol.for("react.strict_mode"),fd=Symbol.for("react.profiler"),pd=Symbol.for("react.provider"),gd=Symbol.for("react.context"),md=Symbol.for("react.forward_ref"),yd=Symbol.for("react.suspense"),xd=Symbol.for("react.memo"),vd=Symbol.for("react.lazy"),Rl=Symbol.iterator;function Sd(e){return e===null||typeof e!="object"?null:(e=Rl&&e[Rl]||e["@@iterator"],typeof e=="function"?e:null)}var Ha={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ua=Object.assign,Za={};function _n(e,t,n){this.props=e,this.context=t,this.refs=Za,this.updater=n||Ha}_n.prototype.isReactComponent={};_n.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};_n.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Qa(){}Qa.prototype=_n.prototype;function bs(e,t,n){this.props=e,this.context=t,this.refs=Za,this.updater=n||Ha}var Ns=bs.prototype=new Qa;Ns.constructor=bs;Ua(Ns,_n.prototype);Ns.isPureReactComponent=!0;var bl=Array.isArray,Xa=Object.prototype.hasOwnProperty,Ts={current:null},Ya={key:!0,ref:!0,__self:!0,__source:!0};function Ja(e,t,n){var r,i={},o=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(o=""+t.key),t)Xa.call(t,r)&&!Ya.hasOwnProperty(r)&&(i[r]=t[r]);var u=arguments.length-2;if(u===1)i.children=n;else if(1<u){for(var c=Array(u),h=0;h<u;h++)c[h]=arguments[h+2];i.children=c}if(e&&e.defaultProps)for(r in u=e.defaultProps,u)i[r]===void 0&&(i[r]=u[r]);return{$$typeof:Ar,type:e,key:o,ref:l,props:i,_owner:Ts.current}}function wd(e,t){return{$$typeof:Ar,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function js(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ar}function Id(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Nl=/\/+/g;function io(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Id(""+e.key):t.toString(36)}function ii(e,t,n,r,i){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(o){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case Ar:case cd:l=!0}}if(l)return l=e,i=i(l),e=r===""?"."+io(l,0):r,bl(i)?(n="",e!=null&&(n=e.replace(Nl,"$&/")+"/"),ii(i,t,n,"",function(h){return h})):i!=null&&(js(i)&&(i=wd(i,n+(!i.key||l&&l.key===i.key?"":(""+i.key).replace(Nl,"$&/")+"/")+e)),t.push(i)),1;if(l=0,r=r===""?".":r+":",bl(e))for(var u=0;u<e.length;u++){o=e[u];var c=r+io(o,u);l+=ii(o,t,n,c,i)}else if(c=Sd(e),typeof c=="function")for(e=c.call(e),u=0;!(o=e.next()).done;)o=o.value,c=r+io(o,u++),l+=ii(o,t,n,c,i);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return l}function zr(e,t,n){if(e==null)return e;var r=[],i=0;return ii(e,r,"","",function(o){return t.call(n,o,i++)}),r}function Cd(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var je={current:null},oi={transition:null},Ed={ReactCurrentDispatcher:je,ReactCurrentBatchConfig:oi,ReactCurrentOwner:Ts};function $a(){throw Error("act(...) is not supported in production builds of React.")}$.Children={map:zr,forEach:function(e,t,n){zr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return zr(e,function(){t++}),t},toArray:function(e){return zr(e,function(t){return t})||[]},only:function(e){if(!js(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};$.Component=_n;$.Fragment=dd;$.Profiler=fd;$.PureComponent=bs;$.StrictMode=hd;$.Suspense=yd;$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ed;$.act=$a;$.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Ua({},e.props),i=e.key,o=e.ref,l=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,l=Ts.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var u=e.type.defaultProps;for(c in t)Xa.call(t,c)&&!Ya.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&u!==void 0?u[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){u=Array(c);for(var h=0;h<c;h++)u[h]=arguments[h+2];r.children=u}return{$$typeof:Ar,type:e.type,key:i,ref:o,props:r,_owner:l}};$.createContext=function(e){return e={$$typeof:gd,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:pd,_context:e},e.Consumer=e};$.createElement=Ja;$.createFactory=function(e){var t=Ja.bind(null,e);return t.type=e,t};$.createRef=function(){return{current:null}};$.forwardRef=function(e){return{$$typeof:md,render:e}};$.isValidElement=js;$.lazy=function(e){return{$$typeof:vd,_payload:{_status:-1,_result:e},_init:Cd}};$.memo=function(e,t){return{$$typeof:xd,type:e,compare:t===void 0?null:t}};$.startTransition=function(e){var t=oi.transition;oi.transition={};try{e()}finally{oi.transition=t}};$.unstable_act=$a;$.useCallback=function(e,t){return je.current.useCallback(e,t)};$.useContext=function(e){return je.current.useContext(e)};$.useDebugValue=function(){};$.useDeferredValue=function(e){return je.current.useDeferredValue(e)};$.useEffect=function(e,t){return je.current.useEffect(e,t)};$.useId=function(){return je.current.useId()};$.useImperativeHandle=function(e,t,n){return je.current.useImperativeHandle(e,t,n)};$.useInsertionEffect=function(e,t){return je.current.useInsertionEffect(e,t)};$.useLayoutEffect=function(e,t){return je.current.useLayoutEffect(e,t)};$.useMemo=function(e,t){return je.current.useMemo(e,t)};$.useReducer=function(e,t,n){return je.current.useReducer(e,t,n)};$.useRef=function(e){return je.current.useRef(e)};$.useState=function(e){return je.current.useState(e)};$.useSyncExternalStore=function(e,t,n){return je.current.useSyncExternalStore(e,t,n)};$.useTransition=function(){return je.current.useTransition()};$.version="18.3.1";_a.exports=$;var O=_a.exports;const As=ud(O);/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var kd=O,Md=Symbol.for("react.element"),Rd=Symbol.for("react.fragment"),bd=Object.prototype.hasOwnProperty,Nd=kd.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Td={key:!0,ref:!0,__self:!0,__source:!0};function Ka(e,t,n){var r,i={},o=null,l=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(l=t.ref);for(r in t)bd.call(t,r)&&!Td.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Md,type:e,key:o,ref:l,props:i,_owner:Nd.current}}Li.Fragment=Rd;Li.jsx=Ka;Li.jsxs=Ka;Wa.exports=Li;var s=Wa.exports,Fo={},qa={exports:{}},He={},eu={exports:{}},tu={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(e){function t(b,N){var g=b.length;b.push(N);e:for(;0<g;){var P=g-1>>>1,j=b[P];if(0<i(j,N))b[P]=N,b[g]=j,g=P;else break e}}function n(b){return b.length===0?null:b[0]}function r(b){if(b.length===0)return null;var N=b[0],g=b.pop();if(g!==N){b[0]=g;e:for(var P=0,j=b.length,W=j>>>1;P<W;){var J=2*(P+1)-1,ne=b[J],v=J+1,X=b[v];if(0>i(ne,g))v<j&&0>i(X,ne)?(b[P]=X,b[v]=g,P=v):(b[P]=ne,b[J]=g,P=J);else if(v<j&&0>i(X,g))b[P]=X,b[v]=g,P=v;else break e}}return N}function i(b,N){var g=b.sortIndex-N.sortIndex;return g!==0?g:b.id-N.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var c=[],h=[],m=1,S=null,y=3,C=!1,M=!1,w=!1,F=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(b){for(var N=n(h);N!==null;){if(N.callback===null)r(h);else if(N.startTime<=b)r(h),N.sortIndex=N.expirationTime,t(c,N);else break;N=n(h)}}function E(b){if(w=!1,x(b),!M)if(n(c)!==null)M=!0,k(a);else{var N=n(h);N!==null&&d(E,N.startTime-b)}}function a(b,N){M=!1,w&&(w=!1,p(A),A=-1),C=!0;var g=y;try{for(x(N),S=n(c);S!==null&&(!(S.expirationTime>N)||b&&!Y());){var P=S.callback;if(typeof P=="function"){S.callback=null,y=S.priorityLevel;var j=P(S.expirationTime<=N);N=e.unstable_now(),typeof j=="function"?S.callback=j:S===n(c)&&r(c),x(N)}else r(c);S=n(c)}if(S!==null)var W=!0;else{var J=n(h);J!==null&&d(E,J.startTime-N),W=!1}return W}finally{S=null,y=g,C=!1}}var I=!1,T=null,A=-1,Q=5,L=-1;function Y(){return!(e.unstable_now()-L<Q)}function ee(){if(T!==null){var b=e.unstable_now();L=b;var N=!0;try{N=T(!0,b)}finally{N?z():(I=!1,T=null)}}else I=!1}var z;if(typeof f=="function")z=function(){f(ee)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,H=V.port2;V.port1.onmessage=ee,z=function(){H.postMessage(null)}}else z=function(){F(ee,0)};function k(b){T=b,I||(I=!0,z())}function d(b,N){A=F(function(){b(e.unstable_now())},N)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(b){b.callback=null},e.unstable_continueExecution=function(){M||C||(M=!0,k(a))},e.unstable_forceFrameRate=function(b){0>b||125<b?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<b?Math.floor(1e3/b):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(b){switch(y){case 1:case 2:case 3:var N=3;break;default:N=y}var g=y;y=N;try{return b()}finally{y=g}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(b,N){switch(b){case 1:case 2:case 3:case 4:case 5:break;default:b=3}var g=y;y=b;try{return N()}finally{y=g}},e.unstable_scheduleCallback=function(b,N,g){var P=e.unstable_now();switch(typeof g=="object"&&g!==null?(g=g.delay,g=typeof g=="number"&&0<g?P+g:P):g=P,b){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=g+j,b={id:m++,callback:N,priorityLevel:b,startTime:g,expirationTime:j,sortIndex:-1},g>P?(b.sortIndex=g,t(h,b),n(c)===null&&b===n(h)&&(w?(p(A),A=-1):w=!0,d(E,g-P))):(b.sortIndex=j,t(c,b),M||C||(M=!0,k(a))),b},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(b){var N=y;return function(){var g=y;y=N;try{return b.apply(this,arguments)}finally{y=g}}}})(tu);eu.exports=tu;var jd=eu.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ad=O,_e=jd;function B(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var nu=new Set,gr={};function cn(e,t){Dn(e,t),Dn(e+"Capture",t)}function Dn(e,t){for(gr[e]=t,e=0;e<t.length;e++)nu.add(t[e])}var vt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bo=Object.prototype.hasOwnProperty,Fd=/^[: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]*$/,Tl={},jl={};function Bd(e){return Bo.call(jl,e)?!0:Bo.call(Tl,e)?!1:Fd.test(e)?jl[e]=!0:(Tl[e]=!0,!1)}function Pd(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 Dd(e,t,n,r){if(t===null||typeof t>"u"||Pd(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 Ae(e,t,n,r,i,o,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=l}var Ce={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ce[e]=new Ae(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ce[t]=new Ae(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ce[e]=new Ae(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ce[e]=new Ae(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){Ce[e]=new Ae(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ce[e]=new Ae(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ce[e]=new Ae(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ce[e]=new Ae(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ce[e]=new Ae(e,5,!1,e.toLowerCase(),null,!1,!1)});var Fs=/[\-:]([a-z])/g;function Bs(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(Fs,Bs);Ce[t]=new Ae(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(Fs,Bs);Ce[t]=new Ae(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(Fs,Bs);Ce[t]=new Ae(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ce[e]=new Ae(e,1,!1,e.toLowerCase(),null,!1,!1)});Ce.xlinkHref=new Ae("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ce[e]=new Ae(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ps(e,t,n,r){var i=Ce.hasOwnProperty(t)?Ce[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Dd(t,n,i,r)&&(n=null),r||i===null?Bd(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ct=Ad.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Gr=Symbol.for("react.element"),pn=Symbol.for("react.portal"),gn=Symbol.for("react.fragment"),Ds=Symbol.for("react.strict_mode"),Po=Symbol.for("react.profiler"),ru=Symbol.for("react.provider"),iu=Symbol.for("react.context"),zs=Symbol.for("react.forward_ref"),Do=Symbol.for("react.suspense"),zo=Symbol.for("react.suspense_list"),Gs=Symbol.for("react.memo"),kt=Symbol.for("react.lazy"),ou=Symbol.for("react.offscreen"),Al=Symbol.iterator;function Qn(e){return e===null||typeof e!="object"?null:(e=Al&&e[Al]||e["@@iterator"],typeof e=="function"?e:null)}var ue=Object.assign,oo;function tr(e){if(oo===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);oo=t&&t[1]||""}return`
`+oo+e}var so=!1;function lo(e,t){if(!e||so)return"";so=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(h){var r=h}Reflect.construct(e,[],t)}else{try{t.call()}catch(h){r=h}e.call(t.prototype)}else{try{throw Error()}catch(h){r=h}e()}}catch(h){if(h&&r&&typeof h.stack=="string"){for(var i=h.stack.split(`
`),o=r.stack.split(`
`),l=i.length-1,u=o.length-1;1<=l&&0<=u&&i[l]!==o[u];)u--;for(;1<=l&&0<=u;l--,u--)if(i[l]!==o[u]){if(l!==1||u!==1)do if(l--,u--,0>u||i[l]!==o[u]){var c=`
`+i[l].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=l&&0<=u);break}}}finally{so=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?tr(e):""}function zd(e){switch(e.tag){case 5:return tr(e.type);case 16:return tr("Lazy");case 13:return tr("Suspense");case 19:return tr("SuspenseList");case 0:case 2:case 15:return e=lo(e.type,!1),e;case 11:return e=lo(e.type.render,!1),e;case 1:return e=lo(e.type,!0),e;default:return""}}function Go(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 gn:return"Fragment";case pn:return"Portal";case Po:return"Profiler";case Ds:return"StrictMode";case Do:return"Suspense";case zo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case iu:return(e.displayName||"Context")+".Consumer";case ru:return(e._context.displayName||"Context")+".Provider";case zs:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Gs:return t=e.displayName||null,t!==null?t:Go(e.type)||"Memo";case kt:t=e._payload,e=e._init;try{return Go(e(t))}catch{}}return null}function Gd(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 Go(t);case 8:return t===Ds?"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 Ot(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function su(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Od(e){var t=su(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 i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(l){r=""+l,o.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Or(e){e._valueTracker||(e._valueTracker=Od(e))}function lu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=su(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function mi(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 Oo(e,t){var n=t.checked;return ue({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Fl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ot(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 au(e,t){t=t.checked,t!=null&&Ps(e,"checked",t,!1)}function Lo(e,t){au(e,t);var n=Ot(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")?Vo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Vo(e,t.type,Ot(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Bl(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 Vo(e,t,n){(t!=="number"||mi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var nr=Array.isArray;function Nn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ot(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Wo(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(B(91));return ue({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Pl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(B(92));if(nr(n)){if(1<n.length)throw Error(B(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ot(n)}}function uu(e,t){var n=Ot(t.value),r=Ot(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Dl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function cu(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function _o(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?cu(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Lr,du=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Lr=Lr||document.createElement("div"),Lr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Lr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function mr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var sr={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},Ld=["Webkit","ms","Moz","O"];Object.keys(sr).forEach(function(e){Ld.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),sr[t]=sr[e]})});function hu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||sr.hasOwnProperty(e)&&sr[e]?(""+t).trim():t+"px"}function fu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=hu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Vd=ue({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 Ho(e,t){if(t){if(Vd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(B(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(B(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(B(61))}if(t.style!=null&&typeof t.style!="object")throw Error(B(62))}}function Uo(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 Zo=null;function Os(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qo=null,Tn=null,jn=null;function zl(e){if(e=Pr(e)){if(typeof Qo!="function")throw Error(B(280));var t=e.stateNode;t&&(t=Ui(t),Qo(e.stateNode,e.type,t))}}function pu(e){Tn?jn?jn.push(e):jn=[e]:Tn=e}function gu(){if(Tn){var e=Tn,t=jn;if(jn=Tn=null,zl(e),t)for(e=0;e<t.length;e++)zl(t[e])}}function mu(e,t){return e(t)}function yu(){}var ao=!1;function xu(e,t,n){if(ao)return e(t,n);ao=!0;try{return mu(e,t,n)}finally{ao=!1,(Tn!==null||jn!==null)&&(yu(),gu())}}function yr(e,t){var n=e.stateNode;if(n===null)return null;var r=Ui(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(B(231,t,typeof n));return n}var Xo=!1;if(vt)try{var Xn={};Object.defineProperty(Xn,"passive",{get:function(){Xo=!0}}),window.addEventListener("test",Xn,Xn),window.removeEventListener("test",Xn,Xn)}catch{Xo=!1}function Wd(e,t,n,r,i,o,l,u,c){var h=Array.prototype.slice.call(arguments,3);try{t.apply(n,h)}catch(m){this.onError(m)}}var lr=!1,yi=null,xi=!1,Yo=null,_d={onError:function(e){lr=!0,yi=e}};function Hd(e,t,n,r,i,o,l,u,c){lr=!1,yi=null,Wd.apply(_d,arguments)}function Ud(e,t,n,r,i,o,l,u,c){if(Hd.apply(this,arguments),lr){if(lr){var h=yi;lr=!1,yi=null}else throw Error(B(198));xi||(xi=!0,Yo=h)}}function dn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function vu(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Gl(e){if(dn(e)!==e)throw Error(B(188))}function Zd(e){var t=e.alternate;if(!t){if(t=dn(e),t===null)throw Error(B(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Gl(i),e;if(o===r)return Gl(i),t;o=o.sibling}throw Error(B(188))}if(n.return!==r.return)n=i,r=o;else{for(var l=!1,u=i.child;u;){if(u===n){l=!0,n=i,r=o;break}if(u===r){l=!0,r=i,n=o;break}u=u.sibling}if(!l){for(u=o.child;u;){if(u===n){l=!0,n=o,r=i;break}if(u===r){l=!0,r=o,n=i;break}u=u.sibling}if(!l)throw Error(B(189))}}if(n.alternate!==r)throw Error(B(190))}if(n.tag!==3)throw Error(B(188));return n.stateNode.current===n?e:t}function Su(e){return e=Zd(e),e!==null?wu(e):null}function wu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=wu(e);if(t!==null)return t;e=e.sibling}return null}var Iu=_e.unstable_scheduleCallback,Ol=_e.unstable_cancelCallback,Qd=_e.unstable_shouldYield,Xd=_e.unstable_requestPaint,pe=_e.unstable_now,Yd=_e.unstable_getCurrentPriorityLevel,Ls=_e.unstable_ImmediatePriority,Cu=_e.unstable_UserBlockingPriority,vi=_e.unstable_NormalPriority,Jd=_e.unstable_LowPriority,Eu=_e.unstable_IdlePriority,Vi=null,ht=null;function $d(e){if(ht&&typeof ht.onCommitFiberRoot=="function")try{ht.onCommitFiberRoot(Vi,e,void 0,(e.current.flags&128)===128)}catch{}}var ot=Math.clz32?Math.clz32:eh,Kd=Math.log,qd=Math.LN2;function eh(e){return e>>>=0,e===0?32:31-(Kd(e)/qd|0)|0}var Vr=64,Wr=4194304;function rr(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 Si(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,l=n&268435455;if(l!==0){var u=l&~i;u!==0?r=rr(u):(o&=l,o!==0&&(r=rr(o)))}else l=n&~i,l!==0?r=rr(l):o!==0&&(r=rr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ot(t),i=1<<n,r|=e[n],t&=~i;return r}function th(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nh(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var l=31-ot(o),u=1<<l,c=i[l];c===-1?(!(u&n)||u&r)&&(i[l]=th(u,t)):c<=t&&(e.expiredLanes|=u),o&=~u}}function Jo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ku(){var e=Vr;return Vr<<=1,!(Vr&4194240)&&(Vr=64),e}function uo(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Fr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ot(t),e[t]=n}function rh(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<n;){var i=31-ot(n),o=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~o}}function Vs(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ot(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var te=0;function Mu(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Ru,Ws,bu,Nu,Tu,$o=!1,_r=[],jt=null,At=null,Ft=null,xr=new Map,vr=new Map,Rt=[],ih="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Ll(e,t){switch(e){case"focusin":case"focusout":jt=null;break;case"dragenter":case"dragleave":At=null;break;case"mouseover":case"mouseout":Ft=null;break;case"pointerover":case"pointerout":xr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":vr.delete(t.pointerId)}}function Yn(e,t,n,r,i,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},t!==null&&(t=Pr(t),t!==null&&Ws(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function oh(e,t,n,r,i){switch(t){case"focusin":return jt=Yn(jt,e,t,n,r,i),!0;case"dragenter":return At=Yn(At,e,t,n,r,i),!0;case"mouseover":return Ft=Yn(Ft,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return xr.set(o,Yn(xr.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,vr.set(o,Yn(vr.get(o)||null,e,t,n,r,i)),!0}return!1}function ju(e){var t=qt(e.target);if(t!==null){var n=dn(t);if(n!==null){if(t=n.tag,t===13){if(t=vu(n),t!==null){e.blockedOn=t,Tu(e.priority,function(){bu(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function si(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ko(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Zo=r,n.target.dispatchEvent(r),Zo=null}else return t=Pr(n),t!==null&&Ws(t),e.blockedOn=n,!1;t.shift()}return!0}function Vl(e,t,n){si(e)&&n.delete(t)}function sh(){$o=!1,jt!==null&&si(jt)&&(jt=null),At!==null&&si(At)&&(At=null),Ft!==null&&si(Ft)&&(Ft=null),xr.forEach(Vl),vr.forEach(Vl)}function Jn(e,t){e.blockedOn===t&&(e.blockedOn=null,$o||($o=!0,_e.unstable_scheduleCallback(_e.unstable_NormalPriority,sh)))}function Sr(e){function t(i){return Jn(i,e)}if(0<_r.length){Jn(_r[0],e);for(var n=1;n<_r.length;n++){var r=_r[n];r.blockedOn===e&&(r.blockedOn=null)}}for(jt!==null&&Jn(jt,e),At!==null&&Jn(At,e),Ft!==null&&Jn(Ft,e),xr.forEach(t),vr.forEach(t),n=0;n<Rt.length;n++)r=Rt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Rt.length&&(n=Rt[0],n.blockedOn===null);)ju(n),n.blockedOn===null&&Rt.shift()}var An=Ct.ReactCurrentBatchConfig,wi=!0;function lh(e,t,n,r){var i=te,o=An.transition;An.transition=null;try{te=1,_s(e,t,n,r)}finally{te=i,An.transition=o}}function ah(e,t,n,r){var i=te,o=An.transition;An.transition=null;try{te=4,_s(e,t,n,r)}finally{te=i,An.transition=o}}function _s(e,t,n,r){if(wi){var i=Ko(e,t,n,r);if(i===null)So(e,t,r,Ii,n),Ll(e,r);else if(oh(i,e,t,n,r))r.stopPropagation();else if(Ll(e,r),t&4&&-1<ih.indexOf(e)){for(;i!==null;){var o=Pr(i);if(o!==null&&Ru(o),o=Ko(e,t,n,r),o===null&&So(e,t,r,Ii,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else So(e,t,r,null,n)}}var Ii=null;function Ko(e,t,n,r){if(Ii=null,e=Os(r),e=qt(e),e!==null)if(t=dn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=vu(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ii=e,null}function Au(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Yd()){case Ls:return 1;case Cu:return 4;case vi:case Jd:return 16;case Eu:return 536870912;default:return 16}default:return 16}}var Nt=null,Hs=null,li=null;function Fu(){if(li)return li;var e,t=Hs,n=t.length,r,i="value"in Nt?Nt.value:Nt.textContent,o=i.length;for(e=0;e<n&&t[e]===i[e];e++);var l=n-e;for(r=1;r<=l&&t[n-r]===i[o-r];r++);return li=i.slice(e,1<r?1-r:void 0)}function ai(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Hr(){return!0}function Wl(){return!1}function Ue(e){function t(n,r,i,o,l){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=l,this.currentTarget=null;for(var u in e)e.hasOwnProperty(u)&&(n=e[u],this[u]=n?n(o):o[u]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Hr:Wl,this.isPropagationStopped=Wl,this}return ue(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Hr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Hr)},persist:function(){},isPersistent:Hr}),t}var Hn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Us=Ue(Hn),Br=ue({},Hn,{view:0,detail:0}),uh=Ue(Br),co,ho,$n,Wi=ue({},Br,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zs,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==$n&&($n&&e.type==="mousemove"?(co=e.screenX-$n.screenX,ho=e.screenY-$n.screenY):ho=co=0,$n=e),co)},movementY:function(e){return"movementY"in e?e.movementY:ho}}),_l=Ue(Wi),ch=ue({},Wi,{dataTransfer:0}),dh=Ue(ch),hh=ue({},Br,{relatedTarget:0}),fo=Ue(hh),fh=ue({},Hn,{animationName:0,elapsedTime:0,pseudoElement:0}),ph=Ue(fh),gh=ue({},Hn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),mh=Ue(gh),yh=ue({},Hn,{data:0}),Hl=Ue(yh),xh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vh={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Sh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sh[e])?!!t[e]:!1}function Zs(){return wh}var Ih=ue({},Br,{key:function(e){if(e.key){var t=xh[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ai(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?vh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zs,charCode:function(e){return e.type==="keypress"?ai(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ai(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ch=Ue(Ih),Eh=ue({},Wi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ul=Ue(Eh),kh=ue({},Br,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zs}),Mh=Ue(kh),Rh=ue({},Hn,{propertyName:0,elapsedTime:0,pseudoElement:0}),bh=Ue(Rh),Nh=ue({},Wi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Th=Ue(Nh),jh=[9,13,27,32],Qs=vt&&"CompositionEvent"in window,ar=null;vt&&"documentMode"in document&&(ar=document.documentMode);var Ah=vt&&"TextEvent"in window&&!ar,Bu=vt&&(!Qs||ar&&8<ar&&11>=ar),Zl=" ",Ql=!1;function Pu(e,t){switch(e){case"keyup":return jh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Du(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mn=!1;function Fh(e,t){switch(e){case"compositionend":return Du(t);case"keypress":return t.which!==32?null:(Ql=!0,Zl);case"textInput":return e=t.data,e===Zl&&Ql?null:e;default:return null}}function Bh(e,t){if(mn)return e==="compositionend"||!Qs&&Pu(e,t)?(e=Fu(),li=Hs=Nt=null,mn=!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.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Bu&&t.locale!=="ko"?null:t.data;default:return null}}var Ph={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Xl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ph[e.type]:t==="textarea"}function zu(e,t,n,r){pu(r),t=Ci(t,"onChange"),0<t.length&&(n=new Us("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var ur=null,wr=null;function Dh(e){Xu(e,0)}function _i(e){var t=vn(e);if(lu(t))return e}function zh(e,t){if(e==="change")return t}var Gu=!1;if(vt){var po;if(vt){var go="oninput"in document;if(!go){var Yl=document.createElement("div");Yl.setAttribute("oninput","return;"),go=typeof Yl.oninput=="function"}po=go}else po=!1;Gu=po&&(!document.documentMode||9<document.documentMode)}function Jl(){ur&&(ur.detachEvent("onpropertychange",Ou),wr=ur=null)}function Ou(e){if(e.propertyName==="value"&&_i(wr)){var t=[];zu(t,wr,e,Os(e)),xu(Dh,t)}}function Gh(e,t,n){e==="focusin"?(Jl(),ur=t,wr=n,ur.attachEvent("onpropertychange",Ou)):e==="focusout"&&Jl()}function Oh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _i(wr)}function Lh(e,t){if(e==="click")return _i(t)}function Vh(e,t){if(e==="input"||e==="change")return _i(t)}function Wh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lt=typeof Object.is=="function"?Object.is:Wh;function Ir(e,t){if(lt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Bo.call(t,i)||!lt(e[i],t[i]))return!1}return!0}function $l(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Kl(e,t){var n=$l(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=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=$l(n)}}function Lu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Vu(){for(var e=window,t=mi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=mi(e.document)}return t}function Xs(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 _h(e){var t=Vu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Lu(n.ownerDocument.documentElement,n)){if(r!==null&&Xs(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 i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Kl(n,o);var l=Kl(n,r);i&&l&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.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<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Hh=vt&&"documentMode"in document&&11>=document.documentMode,yn=null,qo=null,cr=null,es=!1;function ql(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;es||yn==null||yn!==mi(r)||(r=yn,"selectionStart"in r&&Xs(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}),cr&&Ir(cr,r)||(cr=r,r=Ci(qo,"onSelect"),0<r.length&&(t=new Us("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yn)))}function Ur(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var xn={animationend:Ur("Animation","AnimationEnd"),animationiteration:Ur("Animation","AnimationIteration"),animationstart:Ur("Animation","AnimationStart"),transitionend:Ur("Transition","TransitionEnd")},mo={},Wu={};vt&&(Wu=document.createElement("div").style,"AnimationEvent"in window||(delete xn.animationend.animation,delete xn.animationiteration.animation,delete xn.animationstart.animation),"TransitionEvent"in window||delete xn.transitionend.transition);function Hi(e){if(mo[e])return mo[e];if(!xn[e])return e;var t=xn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Wu)return mo[e]=t[n];return e}var _u=Hi("animationend"),Hu=Hi("animationiteration"),Uu=Hi("animationstart"),Zu=Hi("transitionend"),Qu=new Map,ea="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function _t(e,t){Qu.set(e,t),cn(t,[e])}for(var yo=0;yo<ea.length;yo++){var xo=ea[yo],Uh=xo.toLowerCase(),Zh=xo[0].toUpperCase()+xo.slice(1);_t(Uh,"on"+Zh)}_t(_u,"onAnimationEnd");_t(Hu,"onAnimationIteration");_t(Uu,"onAnimationStart");_t("dblclick","onDoubleClick");_t("focusin","onFocus");_t("focusout","onBlur");_t(Zu,"onTransitionEnd");Dn("onMouseEnter",["mouseout","mouseover"]);Dn("onMouseLeave",["mouseout","mouseover"]);Dn("onPointerEnter",["pointerout","pointerover"]);Dn("onPointerLeave",["pointerout","pointerover"]);cn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));cn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));cn("onBeforeInput",["compositionend","keypress","textInput","paste"]);cn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));cn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));cn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ir="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Qh=new Set("cancel close invalid load scroll toggle".split(" ").concat(ir));function ta(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Ud(r,t,void 0,e),e.currentTarget=null}function Xu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var l=r.length-1;0<=l;l--){var u=r[l],c=u.instance,h=u.currentTarget;if(u=u.listener,c!==o&&i.isPropagationStopped())break e;ta(i,u,h),o=c}else for(l=0;l<r.length;l++){if(u=r[l],c=u.instance,h=u.currentTarget,u=u.listener,c!==o&&i.isPropagationStopped())break e;ta(i,u,h),o=c}}}if(xi)throw e=Yo,xi=!1,Yo=null,e}function ie(e,t){var n=t[os];n===void 0&&(n=t[os]=new Set);var r=e+"__bubble";n.has(r)||(Yu(t,e,2,!1),n.add(r))}function vo(e,t,n){var r=0;t&&(r|=4),Yu(n,e,r,t)}var Zr="_reactListening"+Math.random().toString(36).slice(2);function Cr(e){if(!e[Zr]){e[Zr]=!0,nu.forEach(function(n){n!=="selectionchange"&&(Qh.has(n)||vo(n,!1,e),vo(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zr]||(t[Zr]=!0,vo("selectionchange",!1,t))}}function Yu(e,t,n,r){switch(Au(t)){case 1:var i=lh;break;case 4:i=ah;break;default:i=_s}n=i.bind(null,t,n,e),i=void 0,!Xo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function So(e,t,n,r,i){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var l=r.tag;if(l===3||l===4){var u=r.stateNode.containerInfo;if(u===i||u.nodeType===8&&u.parentNode===i)break;if(l===4)for(l=r.return;l!==null;){var c=l.tag;if((c===3||c===4)&&(c=l.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;l=l.return}for(;u!==null;){if(l=qt(u),l===null)return;if(c=l.tag,c===5||c===6){r=o=l;continue e}u=u.parentNode}}r=r.return}xu(function(){var h=o,m=Os(n),S=[];e:{var y=Qu.get(e);if(y!==void 0){var C=Us,M=e;switch(e){case"keypress":if(ai(n)===0)break e;case"keydown":case"keyup":C=Ch;break;case"focusin":M="focus",C=fo;break;case"focusout":M="blur",C=fo;break;case"beforeblur":case"afterblur":C=fo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":C=_l;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":C=dh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":C=Mh;break;case _u:case Hu:case Uu:C=ph;break;case Zu:C=bh;break;case"scroll":C=uh;break;case"wheel":C=Th;break;case"copy":case"cut":case"paste":C=mh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":C=Ul}var w=(t&4)!==0,F=!w&&e==="scroll",p=w?y!==null?y+"Capture":null:y;w=[];for(var f=h,x;f!==null;){x=f;var E=x.stateNode;if(x.tag===5&&E!==null&&(x=E,p!==null&&(E=yr(f,p),E!=null&&w.push(Er(f,E,x)))),F)break;f=f.return}0<w.length&&(y=new C(y,M,null,n,m),S.push({event:y,listeners:w}))}}if(!(t&7)){e:{if(y=e==="mouseover"||e==="pointerover",C=e==="mouseout"||e==="pointerout",y&&n!==Zo&&(M=n.relatedTarget||n.fromElement)&&(qt(M)||M[St]))break e;if((C||y)&&(y=m.window===m?m:(y=m.ownerDocument)?y.defaultView||y.parentWindow:window,C?(M=n.relatedTarget||n.toElement,C=h,M=M?qt(M):null,M!==null&&(F=dn(M),M!==F||M.tag!==5&&M.tag!==6)&&(M=null)):(C=null,M=h),C!==M)){if(w=_l,E="onMouseLeave",p="onMouseEnter",f="mouse",(e==="pointerout"||e==="pointerover")&&(w=Ul,E="onPointerLeave",p="onPointerEnter",f="pointer"),F=C==null?y:vn(C),x=M==null?y:vn(M),y=new w(E,f+"leave",C,n,m),y.target=F,y.relatedTarget=x,E=null,qt(m)===h&&(w=new w(p,f+"enter",M,n,m),w.target=x,w.relatedTarget=F,E=w),F=E,C&&M)t:{for(w=C,p=M,f=0,x=w;x;x=fn(x))f++;for(x=0,E=p;E;E=fn(E))x++;for(;0<f-x;)w=fn(w),f--;for(;0<x-f;)p=fn(p),x--;for(;f--;){if(w===p||p!==null&&w===p.alternate)break t;w=fn(w),p=fn(p)}w=null}else w=null;C!==null&&na(S,y,C,w,!1),M!==null&&F!==null&&na(S,F,M,w,!0)}}e:{if(y=h?vn(h):window,C=y.nodeName&&y.nodeName.toLowerCase(),C==="select"||C==="input"&&y.type==="file")var a=zh;else if(Xl(y))if(Gu)a=Vh;else{a=Oh;var I=Gh}else(C=y.nodeName)&&C.toLowerCase()==="input"&&(y.type==="checkbox"||y.type==="radio")&&(a=Lh);if(a&&(a=a(e,h))){zu(S,a,n,m);break e}I&&I(e,y,h),e==="focusout"&&(I=y._wrapperState)&&I.controlled&&y.type==="number"&&Vo(y,"number",y.value)}switch(I=h?vn(h):window,e){case"focusin":(Xl(I)||I.contentEditable==="true")&&(yn=I,qo=h,cr=null);break;case"focusout":cr=qo=yn=null;break;case"mousedown":es=!0;break;case"contextmenu":case"mouseup":case"dragend":es=!1,ql(S,n,m);break;case"selectionchange":if(Hh)break;case"keydown":case"keyup":ql(S,n,m)}var T;if(Qs)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else mn?Pu(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(Bu&&n.locale!=="ko"&&(mn||A!=="onCompositionStart"?A==="onCompositionEnd"&&mn&&(T=Fu()):(Nt=m,Hs="value"in Nt?Nt.value:Nt.textContent,mn=!0)),I=Ci(h,A),0<I.length&&(A=new Hl(A,e,null,n,m),S.push({event:A,listeners:I}),T?A.data=T:(T=Du(n),T!==null&&(A.data=T)))),(T=Ah?Fh(e,n):Bh(e,n))&&(h=Ci(h,"onBeforeInput"),0<h.length&&(m=new Hl("onBeforeInput","beforeinput",null,n,m),S.push({event:m,listeners:h}),m.data=T))}Xu(S,t)})}function Er(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ci(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=yr(e,n),o!=null&&r.unshift(Er(e,o,i)),o=yr(e,t),o!=null&&r.push(Er(e,o,i))),e=e.return}return r}function fn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function na(e,t,n,r,i){for(var o=t._reactName,l=[];n!==null&&n!==r;){var u=n,c=u.alternate,h=u.stateNode;if(c!==null&&c===r)break;u.tag===5&&h!==null&&(u=h,i?(c=yr(n,o),c!=null&&l.unshift(Er(n,c,u))):i||(c=yr(n,o),c!=null&&l.push(Er(n,c,u)))),n=n.return}l.length!==0&&e.push({event:t,listeners:l})}var Xh=/\r\n?/g,Yh=/\u0000|\uFFFD/g;function ra(e){return(typeof e=="string"?e:""+e).replace(Xh,`
`).replace(Yh,"")}function Qr(e,t,n){if(t=ra(t),ra(e)!==t&&n)throw Error(B(425))}function Ei(){}var ts=null,ns=null;function rs(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var is=typeof setTimeout=="function"?setTimeout:void 0,Jh=typeof clearTimeout=="function"?clearTimeout:void 0,ia=typeof Promise=="function"?Promise:void 0,$h=typeof queueMicrotask=="function"?queueMicrotask:typeof ia<"u"?function(e){return ia.resolve(null).then(e).catch(Kh)}:is;function Kh(e){setTimeout(function(){throw e})}function wo(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Sr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Sr(t)}function Bt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function oa(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Un=Math.random().toString(36).slice(2),dt="__reactFiber$"+Un,kr="__reactProps$"+Un,St="__reactContainer$"+Un,os="__reactEvents$"+Un,qh="__reactListeners$"+Un,ef="__reactHandles$"+Un;function qt(e){var t=e[dt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[St]||n[dt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=oa(e);e!==null;){if(n=e[dt])return n;e=oa(e)}return t}e=n,n=e.parentNode}return null}function Pr(e){return e=e[dt]||e[St],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function vn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(B(33))}function Ui(e){return e[kr]||null}var ss=[],Sn=-1;function Ht(e){return{current:e}}function oe(e){0>Sn||(e.current=ss[Sn],ss[Sn]=null,Sn--)}function re(e,t){Sn++,ss[Sn]=e.current,e.current=t}var Lt={},Re=Ht(Lt),De=Ht(!1),on=Lt;function zn(e,t){var n=e.type.contextTypes;if(!n)return Lt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ze(e){return e=e.childContextTypes,e!=null}function ki(){oe(De),oe(Re)}function sa(e,t,n){if(Re.current!==Lt)throw Error(B(168));re(Re,t),re(De,n)}function Ju(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(B(108,Gd(e)||"Unknown",i));return ue({},n,r)}function Mi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Lt,on=Re.current,re(Re,e),re(De,De.current),!0}function la(e,t,n){var r=e.stateNode;if(!r)throw Error(B(169));n?(e=Ju(e,t,on),r.__reactInternalMemoizedMergedChildContext=e,oe(De),oe(Re),re(Re,e)):oe(De),re(De,n)}var gt=null,Zi=!1,Io=!1;function $u(e){gt===null?gt=[e]:gt.push(e)}function tf(e){Zi=!0,$u(e)}function Ut(){if(!Io&>!==null){Io=!0;var e=0,t=te;try{var n=gt;for(te=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}gt=null,Zi=!1}catch(i){throw gt!==null&&(gt=gt.slice(e+1)),Iu(Ls,Ut),i}finally{te=t,Io=!1}}return null}var wn=[],In=0,Ri=null,bi=0,Qe=[],Xe=0,sn=null,mt=1,yt="";function Qt(e,t){wn[In++]=bi,wn[In++]=Ri,Ri=e,bi=t}function Ku(e,t,n){Qe[Xe++]=mt,Qe[Xe++]=yt,Qe[Xe++]=sn,sn=e;var r=mt;e=yt;var i=32-ot(r)-1;r&=~(1<<i),n+=1;var o=32-ot(t)+i;if(30<o){var l=i-i%5;o=(r&(1<<l)-1).toString(32),r>>=l,i-=l,mt=1<<32-ot(t)+i|n<<i|r,yt=o+e}else mt=1<<o|n<<i|r,yt=e}function Ys(e){e.return!==null&&(Qt(e,1),Ku(e,1,0))}function Js(e){for(;e===Ri;)Ri=wn[--In],wn[In]=null,bi=wn[--In],wn[In]=null;for(;e===sn;)sn=Qe[--Xe],Qe[Xe]=null,yt=Qe[--Xe],Qe[Xe]=null,mt=Qe[--Xe],Qe[Xe]=null}var We=null,Ve=null,se=!1,it=null;function qu(e,t){var n=Ye(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function aa(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,We=e,Ve=Bt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,We=e,Ve=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=sn!==null?{id:mt,overflow:yt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ye(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,We=e,Ve=null,!0):!1;default:return!1}}function ls(e){return(e.mode&1)!==0&&(e.flags&128)===0}function as(e){if(se){var t=Ve;if(t){var n=t;if(!aa(e,t)){if(ls(e))throw Error(B(418));t=Bt(n.nextSibling);var r=We;t&&aa(e,t)?qu(r,n):(e.flags=e.flags&-4097|2,se=!1,We=e)}}else{if(ls(e))throw Error(B(418));e.flags=e.flags&-4097|2,se=!1,We=e}}}function ua(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;We=e}function Xr(e){if(e!==We)return!1;if(!se)return ua(e),se=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!rs(e.type,e.memoizedProps)),t&&(t=Ve)){if(ls(e))throw ec(),Error(B(418));for(;t;)qu(e,t),t=Bt(t.nextSibling)}if(ua(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(B(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ve=Bt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ve=null}}else Ve=We?Bt(e.stateNode.nextSibling):null;return!0}function ec(){for(var e=Ve;e;)e=Bt(e.nextSibling)}function Gn(){Ve=We=null,se=!1}function $s(e){it===null?it=[e]:it.push(e)}var nf=Ct.ReactCurrentBatchConfig;function Kn(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(B(309));var r=n.stateNode}if(!r)throw Error(B(147,e));var i=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(l){var u=i.refs;l===null?delete u[o]:u[o]=l},t._stringRef=o,t)}if(typeof e!="string")throw Error(B(284));if(!n._owner)throw Error(B(290,e))}return e}function Yr(e,t){throw e=Object.prototype.toString.call(t),Error(B(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ca(e){var t=e._init;return t(e._payload)}function tc(e){function t(p,f){if(e){var x=p.deletions;x===null?(p.deletions=[f],p.flags|=16):x.push(f)}}function n(p,f){if(!e)return null;for(;f!==null;)t(p,f),f=f.sibling;return null}function r(p,f){for(p=new Map;f!==null;)f.key!==null?p.set(f.key,f):p.set(f.index,f),f=f.sibling;return p}function i(p,f){return p=Gt(p,f),p.index=0,p.sibling=null,p}function o(p,f,x){return p.index=x,e?(x=p.alternate,x!==null?(x=x.index,x<f?(p.flags|=2,f):x):(p.flags|=2,f)):(p.flags|=1048576,f)}function l(p){return e&&p.alternate===null&&(p.flags|=2),p}function u(p,f,x,E){return f===null||f.tag!==6?(f=No(x,p.mode,E),f.return=p,f):(f=i(f,x),f.return=p,f)}function c(p,f,x,E){var a=x.type;return a===gn?m(p,f,x.props.children,E,x.key):f!==null&&(f.elementType===a||typeof a=="object"&&a!==null&&a.$$typeof===kt&&ca(a)===f.type)?(E=i(f,x.props),E.ref=Kn(p,f,x),E.return=p,E):(E=gi(x.type,x.key,x.props,null,p.mode,E),E.ref=Kn(p,f,x),E.return=p,E)}function h(p,f,x,E){return f===null||f.tag!==4||f.stateNode.containerInfo!==x.containerInfo||f.stateNode.implementation!==x.implementation?(f=To(x,p.mode,E),f.return=p,f):(f=i(f,x.children||[]),f.return=p,f)}function m(p,f,x,E,a){return f===null||f.tag!==7?(f=rn(x,p.mode,E,a),f.return=p,f):(f=i(f,x),f.return=p,f)}function S(p,f,x){if(typeof f=="string"&&f!==""||typeof f=="number")return f=No(""+f,p.mode,x),f.return=p,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case Gr:return x=gi(f.type,f.key,f.props,null,p.mode,x),x.ref=Kn(p,null,f),x.return=p,x;case pn:return f=To(f,p.mode,x),f.return=p,f;case kt:var E=f._init;return S(p,E(f._payload),x)}if(nr(f)||Qn(f))return f=rn(f,p.mode,x,null),f.return=p,f;Yr(p,f)}return null}function y(p,f,x,E){var a=f!==null?f.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return a!==null?null:u(p,f,""+x,E);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Gr:return x.key===a?c(p,f,x,E):null;case pn:return x.key===a?h(p,f,x,E):null;case kt:return a=x._init,y(p,f,a(x._payload),E)}if(nr(x)||Qn(x))return a!==null?null:m(p,f,x,E,null);Yr(p,x)}return null}function C(p,f,x,E,a){if(typeof E=="string"&&E!==""||typeof E=="number")return p=p.get(x)||null,u(f,p,""+E,a);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case Gr:return p=p.get(E.key===null?x:E.key)||null,c(f,p,E,a);case pn:return p=p.get(E.key===null?x:E.key)||null,h(f,p,E,a);case kt:var I=E._init;return C(p,f,x,I(E._payload),a)}if(nr(E)||Qn(E))return p=p.get(x)||null,m(f,p,E,a,null);Yr(f,E)}return null}function M(p,f,x,E){for(var a=null,I=null,T=f,A=f=0,Q=null;T!==null&&A<x.length;A++){T.index>A?(Q=T,T=null):Q=T.sibling;var L=y(p,T,x[A],E);if(L===null){T===null&&(T=Q);break}e&&T&&L.alternate===null&&t(p,T),f=o(L,f,A),I===null?a=L:I.sibling=L,I=L,T=Q}if(A===x.length)return n(p,T),se&&Qt(p,A),a;if(T===null){for(;A<x.length;A++)T=S(p,x[A],E),T!==null&&(f=o(T,f,A),I===null?a=T:I.sibling=T,I=T);return se&&Qt(p,A),a}for(T=r(p,T);A<x.length;A++)Q=C(T,p,A,x[A],E),Q!==null&&(e&&Q.alternate!==null&&T.delete(Q.key===null?A:Q.key),f=o(Q,f,A),I===null?a=Q:I.sibling=Q,I=Q);return e&&T.forEach(function(Y){return t(p,Y)}),se&&Qt(p,A),a}function w(p,f,x,E){var a=Qn(x);if(typeof a!="function")throw Error(B(150));if(x=a.call(x),x==null)throw Error(B(151));for(var I=a=null,T=f,A=f=0,Q=null,L=x.next();T!==null&&!L.done;A++,L=x.next()){T.index>A?(Q=T,T=null):Q=T.sibling;var Y=y(p,T,L.value,E);if(Y===null){T===null&&(T=Q);break}e&&T&&Y.alternate===null&&t(p,T),f=o(Y,f,A),I===null?a=Y:I.sibling=Y,I=Y,T=Q}if(L.done)return n(p,T),se&&Qt(p,A),a;if(T===null){for(;!L.done;A++,L=x.next())L=S(p,L.value,E),L!==null&&(f=o(L,f,A),I===null?a=L:I.sibling=L,I=L);return se&&Qt(p,A),a}for(T=r(p,T);!L.done;A++,L=x.next())L=C(T,p,A,L.value,E),L!==null&&(e&&L.alternate!==null&&T.delete(L.key===null?A:L.key),f=o(L,f,A),I===null?a=L:I.sibling=L,I=L);return e&&T.forEach(function(ee){return t(p,ee)}),se&&Qt(p,A),a}function F(p,f,x,E){if(typeof x=="object"&&x!==null&&x.type===gn&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Gr:e:{for(var a=x.key,I=f;I!==null;){if(I.key===a){if(a=x.type,a===gn){if(I.tag===7){n(p,I.sibling),f=i(I,x.props.children),f.return=p,p=f;break e}}else if(I.elementType===a||typeof a=="object"&&a!==null&&a.$$typeof===kt&&ca(a)===I.type){n(p,I.sibling),f=i(I,x.props),f.ref=Kn(p,I,x),f.return=p,p=f;break e}n(p,I);break}else t(p,I);I=I.sibling}x.type===gn?(f=rn(x.props.children,p.mode,E,x.key),f.return=p,p=f):(E=gi(x.type,x.key,x.props,null,p.mode,E),E.ref=Kn(p,f,x),E.return=p,p=E)}return l(p);case pn:e:{for(I=x.key;f!==null;){if(f.key===I)if(f.tag===4&&f.stateNode.containerInfo===x.containerInfo&&f.stateNode.implementation===x.implementation){n(p,f.sibling),f=i(f,x.children||[]),f.return=p,p=f;break e}else{n(p,f);break}else t(p,f);f=f.sibling}f=To(x,p.mode,E),f.return=p,p=f}return l(p);case kt:return I=x._init,F(p,f,I(x._payload),E)}if(nr(x))return M(p,f,x,E);if(Qn(x))return w(p,f,x,E);Yr(p,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,f!==null&&f.tag===6?(n(p,f.sibling),f=i(f,x),f.return=p,p=f):(n(p,f),f=No(x,p.mode,E),f.return=p,p=f),l(p)):n(p,f)}return F}var On=tc(!0),nc=tc(!1),Ni=Ht(null),Ti=null,Cn=null,Ks=null;function qs(){Ks=Cn=Ti=null}function el(e){var t=Ni.current;oe(Ni),e._currentValue=t}function us(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 Fn(e,t){Ti=e,Ks=Cn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Pe=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if(Ks!==e)if(e={context:e,memoizedValue:t,next:null},Cn===null){if(Ti===null)throw Error(B(308));Cn=e,Ti.dependencies={lanes:0,firstContext:e}}else Cn=Cn.next=e;return t}var en=null;function tl(e){en===null?en=[e]:en.push(e)}function rc(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,tl(t)):(n.next=i.next,i.next=n),t.interleaved=n,wt(e,r)}function wt(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 Mt=!1;function nl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ic(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 xt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Pt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,wt(e,n)}return i=r.interleaved,i===null?(t.next=t,tl(r)):(t.next=i.next,i.next=t),r.interleaved=t,wt(e,n)}function ui(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,Vs(e,n)}}function da(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=l:o=o.next=l,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,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 ji(e,t,n,r){var i=e.updateQueue;Mt=!1;var o=i.firstBaseUpdate,l=i.lastBaseUpdate,u=i.shared.pending;if(u!==null){i.shared.pending=null;var c=u,h=c.next;c.next=null,l===null?o=h:l.next=h,l=c;var m=e.alternate;m!==null&&(m=m.updateQueue,u=m.lastBaseUpdate,u!==l&&(u===null?m.firstBaseUpdate=h:u.next=h,m.lastBaseUpdate=c))}if(o!==null){var S=i.baseState;l=0,m=h=c=null,u=o;do{var y=u.lane,C=u.eventTime;if((r&y)===y){m!==null&&(m=m.next={eventTime:C,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var M=e,w=u;switch(y=t,C=n,w.tag){case 1:if(M=w.payload,typeof M=="function"){S=M.call(C,S,y);break e}S=M;break e;case 3:M.flags=M.flags&-65537|128;case 0:if(M=w.payload,y=typeof M=="function"?M.call(C,S,y):M,y==null)break e;S=ue({},S,y);break e;case 2:Mt=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,y=i.effects,y===null?i.effects=[u]:y.push(u))}else C={eventTime:C,lane:y,tag:u.tag,payload:u.payload,callback:u.callback,next:null},m===null?(h=m=C,c=S):m=m.next=C,l|=y;if(u=u.next,u===null){if(u=i.shared.pending,u===null)break;y=u,u=y.next,y.next=null,i.lastBaseUpdate=y,i.shared.pending=null}}while(!0);if(m===null&&(c=S),i.baseState=c,i.firstBaseUpdate=h,i.lastBaseUpdate=m,t=i.shared.interleaved,t!==null){i=t;do l|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);an|=l,e.lanes=l,e.memoizedState=S}}function ha(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(B(191,i));i.call(r)}}}var Dr={},ft=Ht(Dr),Mr=Ht(Dr),Rr=Ht(Dr);function tn(e){if(e===Dr)throw Error(B(174));return e}function rl(e,t){switch(re(Rr,t),re(Mr,e),re(ft,Dr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:_o(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=_o(t,e)}oe(ft),re(ft,t)}function Ln(){oe(ft),oe(Mr),oe(Rr)}function oc(e){tn(Rr.current);var t=tn(ft.current),n=_o(t,e.type);t!==n&&(re(Mr,e),re(ft,n))}function il(e){Mr.current===e&&(oe(ft),oe(Mr))}var le=Ht(0);function Ai(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Co=[];function ol(){for(var e=0;e<Co.length;e++)Co[e]._workInProgressVersionPrimary=null;Co.length=0}var ci=Ct.ReactCurrentDispatcher,Eo=Ct.ReactCurrentBatchConfig,ln=0,ae=null,me=null,xe=null,Fi=!1,dr=!1,br=0,rf=0;function Ee(){throw Error(B(321))}function sl(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!lt(e[n],t[n]))return!1;return!0}function ll(e,t,n,r,i,o){if(ln=o,ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ci.current=e===null||e.memoizedState===null?af:uf,e=n(r,i),dr){o=0;do{if(dr=!1,br=0,25<=o)throw Error(B(301));o+=1,xe=me=null,t.updateQueue=null,ci.current=cf,e=n(r,i)}while(dr)}if(ci.current=Bi,t=me!==null&&me.next!==null,ln=0,xe=me=ae=null,Fi=!1,t)throw Error(B(300));return e}function al(){var e=br!==0;return br=0,e}function ct(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xe===null?ae.memoizedState=xe=e:xe=xe.next=e,xe}function Ke(){if(me===null){var e=ae.alternate;e=e!==null?e.memoizedState:null}else e=me.next;var t=xe===null?ae.memoizedState:xe.next;if(t!==null)xe=t,me=e;else{if(e===null)throw Error(B(310));me=e,e={memoizedState:me.memoizedState,baseState:me.baseState,baseQueue:me.baseQueue,queue:me.queue,next:null},xe===null?ae.memoizedState=xe=e:xe=xe.next=e}return xe}function Nr(e,t){return typeof t=="function"?t(e):t}function ko(e){var t=Ke(),n=t.queue;if(n===null)throw Error(B(311));n.lastRenderedReducer=e;var r=me,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var l=i.next;i.next=o.next,o.next=l}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var u=l=null,c=null,h=o;do{var m=h.lane;if((ln&m)===m)c!==null&&(c=c.next={lane:0,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),r=h.hasEagerState?h.eagerState:e(r,h.action);else{var S={lane:m,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null};c===null?(u=c=S,l=r):c=c.next=S,ae.lanes|=m,an|=m}h=h.next}while(h!==null&&h!==o);c===null?l=r:c.next=u,lt(r,t.memoizedState)||(Pe=!0),t.memoizedState=r,t.baseState=l,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do o=i.lane,ae.lanes|=o,an|=o,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Mo(e){var t=Ke(),n=t.queue;if(n===null)throw Error(B(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var l=i=i.next;do o=e(o,l.action),l=l.next;while(l!==i);lt(o,t.memoizedState)||(Pe=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function sc(){}function lc(e,t){var n=ae,r=Ke(),i=t(),o=!lt(r.memoizedState,i);if(o&&(r.memoizedState=i,Pe=!0),r=r.queue,ul(cc.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||xe!==null&&xe.memoizedState.tag&1){if(n.flags|=2048,Tr(9,uc.bind(null,n,r,i,t),void 0,null),ve===null)throw Error(B(349));ln&30||ac(n,t,i)}return i}function ac(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ae.updateQueue,t===null?(t={lastEffect:null,stores:null},ae.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function uc(e,t,n,r){t.value=n,t.getSnapshot=r,dc(t)&&hc(e)}function cc(e,t,n){return n(function(){dc(t)&&hc(e)})}function dc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!lt(e,n)}catch{return!0}}function hc(e){var t=wt(e,1);t!==null&&st(t,e,1,-1)}function fa(e){var t=ct();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:e},t.queue=e,e=e.dispatch=lf.bind(null,ae,e),[t.memoizedState,e]}function Tr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ae.updateQueue,t===null?(t={lastEffect:null,stores:null},ae.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function fc(){return Ke().memoizedState}function di(e,t,n,r){var i=ct();ae.flags|=e,i.memoizedState=Tr(1|t,n,void 0,r===void 0?null:r)}function Qi(e,t,n,r){var i=Ke();r=r===void 0?null:r;var o=void 0;if(me!==null){var l=me.memoizedState;if(o=l.destroy,r!==null&&sl(r,l.deps)){i.memoizedState=Tr(t,n,o,r);return}}ae.flags|=e,i.memoizedState=Tr(1|t,n,o,r)}function pa(e,t){return di(8390656,8,e,t)}function ul(e,t){return Qi(2048,8,e,t)}function pc(e,t){return Qi(4,2,e,t)}function gc(e,t){return Qi(4,4,e,t)}function mc(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yc(e,t,n){return n=n!=null?n.concat([e]):null,Qi(4,4,mc.bind(null,t,e),n)}function cl(){}function xc(e,t){var n=Ke();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sl(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function vc(e,t){var n=Ke();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sl(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Sc(e,t,n){return ln&21?(lt(n,t)||(n=ku(),ae.lanes|=n,an|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Pe=!0),e.memoizedState=n)}function of(e,t){var n=te;te=n!==0&&4>n?n:4,e(!0);var r=Eo.transition;Eo.transition={};try{e(!1),t()}finally{te=n,Eo.transition=r}}function wc(){return Ke().memoizedState}function sf(e,t,n){var r=zt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ic(e))Cc(t,n);else if(n=rc(e,t,n,r),n!==null){var i=Te();st(n,e,r,i),Ec(n,t,r)}}function lf(e,t,n){var r=zt(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ic(e))Cc(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var l=t.lastRenderedState,u=o(l,n);if(i.hasEagerState=!0,i.eagerState=u,lt(u,l)){var c=t.interleaved;c===null?(i.next=i,tl(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=rc(e,t,i,r),n!==null&&(i=Te(),st(n,e,r,i),Ec(n,t,r))}}function Ic(e){var t=e.alternate;return e===ae||t!==null&&t===ae}function Cc(e,t){dr=Fi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ec(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Vs(e,n)}}var Bi={readContext:$e,useCallback:Ee,useContext:Ee,useEffect:Ee,useImperativeHandle:Ee,useInsertionEffect:Ee,useLayoutEffect:Ee,useMemo:Ee,useReducer:Ee,useRef:Ee,useState:Ee,useDebugValue:Ee,useDeferredValue:Ee,useTransition:Ee,useMutableSource:Ee,useSyncExternalStore:Ee,useId:Ee,unstable_isNewReconciler:!1},af={readContext:$e,useCallback:function(e,t){return ct().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:pa,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,di(4194308,4,mc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return di(4194308,4,e,t)},useInsertionEffect:function(e,t){return di(4,2,e,t)},useMemo:function(e,t){var n=ct();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ct();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=sf.bind(null,ae,e),[r.memoizedState,e]},useRef:function(e){var t=ct();return e={current:e},t.memoizedState=e},useState:fa,useDebugValue:cl,useDeferredValue:function(e){return ct().memoizedState=e},useTransition:function(){var e=fa(!1),t=e[0];return e=of.bind(null,e[1]),ct().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ae,i=ct();if(se){if(n===void 0)throw Error(B(407));n=n()}else{if(n=t(),ve===null)throw Error(B(349));ln&30||ac(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,pa(cc.bind(null,r,o,e),[e]),r.flags|=2048,Tr(9,uc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ct(),t=ve.identifierPrefix;if(se){var n=yt,r=mt;n=(r&~(1<<32-ot(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=br++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=rf++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},uf={readContext:$e,useCallback:xc,useContext:$e,useEffect:ul,useImperativeHandle:yc,useInsertionEffect:pc,useLayoutEffect:gc,useMemo:vc,useReducer:ko,useRef:fc,useState:function(){return ko(Nr)},useDebugValue:cl,useDeferredValue:function(e){var t=Ke();return Sc(t,me.memoizedState,e)},useTransition:function(){var e=ko(Nr)[0],t=Ke().memoizedState;return[e,t]},useMutableSource:sc,useSyncExternalStore:lc,useId:wc,unstable_isNewReconciler:!1},cf={readContext:$e,useCallback:xc,useContext:$e,useEffect:ul,useImperativeHandle:yc,useInsertionEffect:pc,useLayoutEffect:gc,useMemo:vc,useReducer:Mo,useRef:fc,useState:function(){return Mo(Nr)},useDebugValue:cl,useDeferredValue:function(e){var t=Ke();return me===null?t.memoizedState=e:Sc(t,me.memoizedState,e)},useTransition:function(){var e=Mo(Nr)[0],t=Ke().memoizedState;return[e,t]},useMutableSource:sc,useSyncExternalStore:lc,useId:wc,unstable_isNewReconciler:!1};function nt(e,t){if(e&&e.defaultProps){t=ue({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function cs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ue({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Xi={isMounted:function(e){return(e=e._reactInternals)?dn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Te(),i=zt(e),o=xt(r,i);o.payload=t,n!=null&&(o.callback=n),t=Pt(e,o,i),t!==null&&(st(t,e,i,r),ui(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Te(),i=zt(e),o=xt(r,i);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Pt(e,o,i),t!==null&&(st(t,e,i,r),ui(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Te(),r=zt(e),i=xt(n,r);i.tag=2,t!=null&&(i.callback=t),t=Pt(e,i,r),t!==null&&(st(t,e,r,n),ui(t,e,r))}};function ga(e,t,n,r,i,o,l){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,l):t.prototype&&t.prototype.isPureReactComponent?!Ir(n,r)||!Ir(i,o):!0}function kc(e,t,n){var r=!1,i=Lt,o=t.contextType;return typeof o=="object"&&o!==null?o=$e(o):(i=ze(t)?on:Re.current,r=t.contextTypes,o=(r=r!=null)?zn(e,i):Lt),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Xi,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function ma(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Xi.enqueueReplaceState(t,t.state,null)}function ds(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},nl(e);var o=t.contextType;typeof o=="object"&&o!==null?i.context=$e(o):(o=ze(t)?on:Re.current,i.context=zn(e,o)),i.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(cs(e,t,o,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Xi.enqueueReplaceState(i,i.state,null),ji(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Vn(e,t){try{var n="",r=t;do n+=zd(r),r=r.return;while(r);var i=n}catch(o){i=`
Error generating stack: `+o.message+`
`+o.stack}return{value:e,source:t,stack:i,digest:null}}function Ro(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function hs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var df=typeof WeakMap=="function"?WeakMap:Map;function Mc(e,t,n){n=xt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Di||(Di=!0,Is=r),hs(e,t)},n}function Rc(e,t,n){n=xt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){hs(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){hs(e,t),typeof r!="function"&&(Dt===null?Dt=new Set([this]):Dt.add(this));var l=t.stack;this.componentDidCatch(t.value,{componentStack:l!==null?l:""})}),n}function ya(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new df;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=kf.bind(null,e,t,n),t.then(e,e))}function xa(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function va(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=xt(-1,1),t.tag=2,Pt(n,t,1))),n.lanes|=1),e)}var hf=Ct.ReactCurrentOwner,Pe=!1;function Ne(e,t,n,r){t.child=e===null?nc(t,null,n,r):On(t,e.child,n,r)}function Sa(e,t,n,r,i){n=n.render;var o=t.ref;return Fn(t,i),r=ll(e,t,n,r,o,i),n=al(),e!==null&&!Pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,It(e,t,i)):(se&&n&&Ys(t),t.flags|=1,Ne(e,t,r,i),t.child)}function wa(e,t,n,r,i){if(e===null){var o=n.type;return typeof o=="function"&&!xl(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,bc(e,t,o,r,i)):(e=gi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&i)){var l=o.memoizedProps;if(n=n.compare,n=n!==null?n:Ir,n(l,r)&&e.ref===t.ref)return It(e,t,i)}return t.flags|=1,e=Gt(o,r),e.ref=t.ref,e.return=t,t.child=e}function bc(e,t,n,r,i){if(e!==null){var o=e.memoizedProps;if(Ir(o,r)&&e.ref===t.ref)if(Pe=!1,t.pendingProps=r=o,(e.lanes&i)!==0)e.flags&131072&&(Pe=!0);else return t.lanes=e.lanes,It(e,t,i)}return fs(e,t,n,r,i)}function Nc(e,t,n){var r=t.pendingProps,i=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},re(kn,Oe),Oe|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,re(kn,Oe),Oe|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,re(kn,Oe),Oe|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,re(kn,Oe),Oe|=r;return Ne(e,t,i,n),t.child}function Tc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function fs(e,t,n,r,i){var o=ze(n)?on:Re.current;return o=zn(t,o),Fn(t,i),n=ll(e,t,n,r,o,i),r=al(),e!==null&&!Pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,It(e,t,i)):(se&&r&&Ys(t),t.flags|=1,Ne(e,t,n,i),t.child)}function Ia(e,t,n,r,i){if(ze(n)){var o=!0;Mi(t)}else o=!1;if(Fn(t,i),t.stateNode===null)hi(e,t),kc(t,n,r),ds(t,n,r,i),r=!0;else if(e===null){var l=t.stateNode,u=t.memoizedProps;l.props=u;var c=l.context,h=n.contextType;typeof h=="object"&&h!==null?h=$e(h):(h=ze(n)?on:Re.current,h=zn(t,h));var m=n.getDerivedStateFromProps,S=typeof m=="function"||typeof l.getSnapshotBeforeUpdate=="function";S||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(u!==r||c!==h)&&ma(t,l,r,h),Mt=!1;var y=t.memoizedState;l.state=y,ji(t,r,l,i),c=t.memoizedState,u!==r||y!==c||De.current||Mt?(typeof m=="function"&&(cs(t,n,m,r),c=t.memoizedState),(u=Mt||ga(t,n,u,r,y,c,h))?(S||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(t.flags|=4194308)):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),l.props=r,l.state=c,l.context=h,r=u):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{l=t.stateNode,ic(e,t),u=t.memoizedProps,h=t.type===t.elementType?u:nt(t.type,u),l.props=h,S=t.pendingProps,y=l.context,c=n.contextType,typeof c=="object"&&c!==null?c=$e(c):(c=ze(n)?on:Re.current,c=zn(t,c));var C=n.getDerivedStateFromProps;(m=typeof C=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(u!==S||y!==c)&&ma(t,l,r,c),Mt=!1,y=t.memoizedState,l.state=y,ji(t,r,l,i);var M=t.memoizedState;u!==S||y!==M||De.current||Mt?(typeof C=="function"&&(cs(t,n,C,r),M=t.memoizedState),(h=Mt||ga(t,n,h,r,y,M,c)||!1)?(m||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(r,M,c),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(r,M,c)),typeof l.componentDidUpdate=="function"&&(t.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof l.componentDidUpdate!="function"||u===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=M),l.props=r,l.state=M,l.context=c,r=h):(typeof l.componentDidUpdate!="function"||u===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),r=!1)}return ps(e,t,n,r,o,i)}function ps(e,t,n,r,i,o){Tc(e,t);var l=(t.flags&128)!==0;if(!r&&!l)return i&&la(t,n,!1),It(e,t,o);r=t.stateNode,hf.current=t;var u=l&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&l?(t.child=On(t,e.child,null,o),t.child=On(t,null,u,o)):Ne(e,t,u,o),t.memoizedState=r.state,i&&la(t,n,!0),t.child}function jc(e){var t=e.stateNode;t.pendingContext?sa(e,t.pendingContext,t.pendingContext!==t.context):t.context&&sa(e,t.context,!1),rl(e,t.containerInfo)}function Ca(e,t,n,r,i){return Gn(),$s(i),t.flags|=256,Ne(e,t,n,r),t.child}var gs={dehydrated:null,treeContext:null,retryLane:0};function ms(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ac(e,t,n){var r=t.pendingProps,i=le.current,o=!1,l=(t.flags&128)!==0,u;if((u=l)||(u=e!==null&&e.memoizedState===null?!1:(i&2)!==0),u?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),re(le,i&1),e===null)return as(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(l=r.children,e=r.fallback,o?(r=t.mode,o=t.child,l={mode:"hidden",children:l},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=l):o=$i(l,r,0,null),e=rn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=ms(n),t.memoizedState=gs,e):dl(t,l));if(i=e.memoizedState,i!==null&&(u=i.dehydrated,u!==null))return ff(e,t,l,r,u,i,n);if(o){o=r.fallback,l=t.mode,i=e.child,u=i.sibling;var c={mode:"hidden",children:r.children};return!(l&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Gt(i,c),r.subtreeFlags=i.subtreeFlags&14680064),u!==null?o=Gt(u,o):(o=rn(o,l,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,l=e.child.memoizedState,l=l===null?ms(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},o.memoizedState=l,o.childLanes=e.childLanes&~n,t.memoizedState=gs,r}return o=e.child,e=o.sibling,r=Gt(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function dl(e,t){return t=$i({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Jr(e,t,n,r){return r!==null&&$s(r),On(t,e.child,null,n),e=dl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ff(e,t,n,r,i,o,l){if(n)return t.flags&256?(t.flags&=-257,r=Ro(Error(B(422))),Jr(e,t,l,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,i=t.mode,r=$i({mode:"visible",children:r.children},i,0,null),o=rn(o,i,l,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&On(t,e.child,null,l),t.child.memoizedState=ms(l),t.memoizedState=gs,o);if(!(t.mode&1))return Jr(e,t,l,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var u=r.dgst;return r=u,o=Error(B(419)),r=Ro(o,r,void 0),Jr(e,t,l,r)}if(u=(l&e.childLanes)!==0,Pe||u){if(r=ve,r!==null){switch(l&-l){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|l)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,wt(e,i),st(r,e,i,-1))}return yl(),r=Ro(Error(B(421))),Jr(e,t,l,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Mf.bind(null,e),i._reactRetry=t,null):(e=o.treeContext,Ve=Bt(i.nextSibling),We=t,se=!0,it=null,e!==null&&(Qe[Xe++]=mt,Qe[Xe++]=yt,Qe[Xe++]=sn,mt=e.id,yt=e.overflow,sn=t),t=dl(t,r.children),t.flags|=4096,t)}function Ea(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),us(e.return,t,n)}function bo(e,t,n,r,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function Fc(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Ne(e,t,r.children,n),r=le.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ea(e,n,t);else if(e.tag===19)Ea(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(re(le,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Ai(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bo(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ai(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bo(t,!0,n,null,o);break;case"together":bo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function hi(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function It(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),an|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(B(153));if(t.child!==null){for(e=t.child,n=Gt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Gt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function pf(e,t,n){switch(t.tag){case 3:jc(t),Gn();break;case 5:oc(t);break;case 1:ze(t.type)&&Mi(t);break;case 4:rl(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;re(Ni,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(re(le,le.current&1),t.flags|=128,null):n&t.child.childLanes?Ac(e,t,n):(re(le,le.current&1),e=It(e,t,n),e!==null?e.sibling:null);re(le,le.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Fc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),re(le,le.current),r)break;return null;case 22:case 23:return t.lanes=0,Nc(e,t,n)}return It(e,t,n)}var Bc,ys,Pc,Dc;Bc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ys=function(){};Pc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,tn(ft.current);var o=null;switch(n){case"input":i=Oo(e,i),r=Oo(e,r),o=[];break;case"select":i=ue({},i,{value:void 0}),r=ue({},r,{value:void 0}),o=[];break;case"textarea":i=Wo(e,i),r=Wo(e,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ei)}Ho(n,r);var l;n=null;for(h in i)if(!r.hasOwnProperty(h)&&i.hasOwnProperty(h)&&i[h]!=null)if(h==="style"){var u=i[h];for(l in u)u.hasOwnProperty(l)&&(n||(n={}),n[l]="")}else h!=="dangerouslySetInnerHTML"&&h!=="children"&&h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(gr.hasOwnProperty(h)?o||(o=[]):(o=o||[]).push(h,null));for(h in r){var c=r[h];if(u=i!=null?i[h]:void 0,r.hasOwnProperty(h)&&c!==u&&(c!=null||u!=null))if(h==="style")if(u){for(l in u)!u.hasOwnProperty(l)||c&&c.hasOwnProperty(l)||(n||(n={}),n[l]="");for(l in c)c.hasOwnProperty(l)&&u[l]!==c[l]&&(n||(n={}),n[l]=c[l])}else n||(o||(o=[]),o.push(h,n)),n=c;else h==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,u=u?u.__html:void 0,c!=null&&u!==c&&(o=o||[]).push(h,c)):h==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(h,""+c):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&(gr.hasOwnProperty(h)?(c!=null&&h==="onScroll"&&ie("scroll",e),o||u===c||(o=[])):(o=o||[]).push(h,c))}n&&(o=o||[]).push("style",n);var h=o;(t.updateQueue=h)&&(t.flags|=4)}};Dc=function(e,t,n,r){n!==r&&(t.flags|=4)};function qn(e,t){if(!se)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ke(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function gf(e,t,n){var r=t.pendingProps;switch(Js(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ke(t),null;case 1:return ze(t.type)&&ki(),ke(t),null;case 3:return r=t.stateNode,Ln(),oe(De),oe(Re),ol(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Xr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,it!==null&&(ks(it),it=null))),ys(e,t),ke(t),null;case 5:il(t);var i=tn(Rr.current);if(n=t.type,e!==null&&t.stateNode!=null)Pc(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(B(166));return ke(t),null}if(e=tn(ft.current),Xr(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[dt]=t,r[kr]=o,e=(t.mode&1)!==0,n){case"dialog":ie("cancel",r),ie("close",r);break;case"iframe":case"object":case"embed":ie("load",r);break;case"video":case"audio":for(i=0;i<ir.length;i++)ie(ir[i],r);break;case"source":ie("error",r);break;case"img":case"image":case"link":ie("error",r),ie("load",r);break;case"details":ie("toggle",r);break;case"input":Fl(r,o),ie("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},ie("invalid",r);break;case"textarea":Pl(r,o),ie("invalid",r)}Ho(n,o),i=null;for(var l in o)if(o.hasOwnProperty(l)){var u=o[l];l==="children"?typeof u=="string"?r.textContent!==u&&(o.suppressHydrationWarning!==!0&&Qr(r.textContent,u,e),i=["children",u]):typeof u=="number"&&r.textContent!==""+u&&(o.suppressHydrationWarning!==!0&&Qr(r.textContent,u,e),i=["children",""+u]):gr.hasOwnProperty(l)&&u!=null&&l==="onScroll"&&ie("scroll",r)}switch(n){case"input":Or(r),Bl(r,o,!0);break;case"textarea":Or(r),Dl(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=Ei)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{l=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=cu(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=l.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),n==="select"&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[dt]=t,e[kr]=r,Bc(e,t,!1,!1),t.stateNode=e;e:{switch(l=Uo(n,r),n){case"dialog":ie("cancel",e),ie("close",e),i=r;break;case"iframe":case"object":case"embed":ie("load",e),i=r;break;case"video":case"audio":for(i=0;i<ir.length;i++)ie(ir[i],e);i=r;break;case"source":ie("error",e),i=r;break;case"img":case"image":case"link":ie("error",e),ie("load",e),i=r;break;case"details":ie("toggle",e),i=r;break;case"input":Fl(e,r),i=Oo(e,r),ie("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=ue({},r,{value:void 0}),ie("invalid",e);break;case"textarea":Pl(e,r),i=Wo(e,r),ie("invalid",e);break;default:i=r}Ho(n,i),u=i;for(o in u)if(u.hasOwnProperty(o)){var c=u[o];o==="style"?fu(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&du(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&mr(e,c):typeof c=="number"&&mr(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(gr.hasOwnProperty(o)?c!=null&&o==="onScroll"&&ie("scroll",e):c!=null&&Ps(e,o,c,l))}switch(n){case"input":Or(e),Bl(e,r,!1);break;case"textarea":Or(e),Dl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ot(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Nn(e,!!r.multiple,o,!1):r.defaultValue!=null&&Nn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Ei)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return ke(t),null;case 6:if(e&&t.stateNode!=null)Dc(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(B(166));if(n=tn(Rr.current),tn(ft.current),Xr(t)){if(r=t.stateNode,n=t.memoizedProps,r[dt]=t,(o=r.nodeValue!==n)&&(e=We,e!==null))switch(e.tag){case 3:Qr(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Qr(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[dt]=t,t.stateNode=r}return ke(t),null;case 13:if(oe(le),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(se&&Ve!==null&&t.mode&1&&!(t.flags&128))ec(),Gn(),t.flags|=98560,o=!1;else if(o=Xr(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(B(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(B(317));o[dt]=t}else Gn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ke(t),o=!1}else it!==null&&(ks(it),it=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||le.current&1?ye===0&&(ye=3):yl())),t.updateQueue!==null&&(t.flags|=4),ke(t),null);case 4:return Ln(),ys(e,t),e===null&&Cr(t.stateNode.containerInfo),ke(t),null;case 10:return el(t.type._context),ke(t),null;case 17:return ze(t.type)&&ki(),ke(t),null;case 19:if(oe(le),o=t.memoizedState,o===null)return ke(t),null;if(r=(t.flags&128)!==0,l=o.rendering,l===null)if(r)qn(o,!1);else{if(ye!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=Ai(e),l!==null){for(t.flags|=128,qn(o,!1),r=l.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,l=o.alternate,l===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=l.childLanes,o.lanes=l.lanes,o.child=l.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=l.memoizedProps,o.memoizedState=l.memoizedState,o.updateQueue=l.updateQueue,o.type=l.type,e=l.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return re(le,le.current&1|2),t.child}e=e.sibling}o.tail!==null&&pe()>Wn&&(t.flags|=128,r=!0,qn(o,!1),t.lanes=4194304)}else{if(!r)if(e=Ai(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),qn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!se)return ke(t),null}else 2*pe()-o.renderingStartTime>Wn&&n!==1073741824&&(t.flags|=128,r=!0,qn(o,!1),t.lanes=4194304);o.isBackwards?(l.sibling=t.child,t.child=l):(n=o.last,n!==null?n.sibling=l:t.child=l,o.last=l)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=pe(),t.sibling=null,n=le.current,re(le,r?n&1|2:n&1),t):(ke(t),null);case 22:case 23:return ml(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Oe&1073741824&&(ke(t),t.subtreeFlags&6&&(t.flags|=8192)):ke(t),null;case 24:return null;case 25:return null}throw Error(B(156,t.tag))}function mf(e,t){switch(Js(t),t.tag){case 1:return ze(t.type)&&ki(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ln(),oe(De),oe(Re),ol(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return il(t),null;case 13:if(oe(le),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(B(340));Gn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return oe(le),null;case 4:return Ln(),null;case 10:return el(t.type._context),null;case 22:case 23:return ml(),null;case 24:return null;default:return null}}var $r=!1,Me=!1,yf=typeof WeakSet=="function"?WeakSet:Set,G=null;function En(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ce(e,t,r)}else n.current=null}function xs(e,t,n){try{n()}catch(r){ce(e,t,r)}}var ka=!1;function xf(e,t){if(ts=wi,e=Vu(),Xs(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 i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var l=0,u=-1,c=-1,h=0,m=0,S=e,y=null;t:for(;;){for(var C;S!==n||i!==0&&S.nodeType!==3||(u=l+i),S!==o||r!==0&&S.nodeType!==3||(c=l+r),S.nodeType===3&&(l+=S.nodeValue.length),(C=S.firstChild)!==null;)y=S,S=C;for(;;){if(S===e)break t;if(y===n&&++h===i&&(u=l),y===o&&++m===r&&(c=l),(C=S.nextSibling)!==null)break;S=y,y=S.parentNode}S=C}n=u===-1||c===-1?null:{start:u,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ns={focusedElem:e,selectionRange:n},wi=!1,G=t;G!==null;)if(t=G,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var M=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(M!==null){var w=M.memoizedProps,F=M.memoizedState,p=t.stateNode,f=p.getSnapshotBeforeUpdate(t.elementType===t.type?w:nt(t.type,w),F);p.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(B(163))}}catch(E){ce(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return M=ka,ka=!1,M}function hr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&xs(t,n,o)}i=i.next}while(i!==r)}}function Yi(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 vs(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function zc(e){var t=e.alternate;t!==null&&(e.alternate=null,zc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[dt],delete t[kr],delete t[os],delete t[qh],delete t[ef])),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 Gc(e){return e.tag===5||e.tag===3||e.tag===4}function Ma(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(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 Ss(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=Ei));else if(r!==4&&(e=e.child,e!==null))for(Ss(e,t,n),e=e.sibling;e!==null;)Ss(e,t,n),e=e.sibling}function ws(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(ws(e,t,n),e=e.sibling;e!==null;)ws(e,t,n),e=e.sibling}var we=null,rt=!1;function Et(e,t,n){for(n=n.child;n!==null;)Oc(e,t,n),n=n.sibling}function Oc(e,t,n){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount(Vi,n)}catch{}switch(n.tag){case 5:Me||En(n,t);case 6:var r=we,i=rt;we=null,Et(e,t,n),we=r,rt=i,we!==null&&(rt?(e=we,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):we.removeChild(n.stateNode));break;case 18:we!==null&&(rt?(e=we,n=n.stateNode,e.nodeType===8?wo(e.parentNode,n):e.nodeType===1&&wo(e,n),Sr(e)):wo(we,n.stateNode));break;case 4:r=we,i=rt,we=n.stateNode.containerInfo,rt=!0,Et(e,t,n),we=r,rt=i;break;case 0:case 11:case 14:case 15:if(!Me&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&xs(n,t,l),i=i.next}while(i!==r)}Et(e,t,n);break;case 1:if(!Me&&(En(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){ce(n,t,u)}Et(e,t,n);break;case 21:Et(e,t,n);break;case 22:n.mode&1?(Me=(r=Me)||n.memoizedState!==null,Et(e,t,n),Me=r):Et(e,t,n);break;default:Et(e,t,n)}}function Ra(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yf),t.forEach(function(r){var i=Rf.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function tt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=e,l=t,u=l;e:for(;u!==null;){switch(u.tag){case 5:we=u.stateNode,rt=!1;break e;case 3:we=u.stateNode.containerInfo,rt=!0;break e;case 4:we=u.stateNode.containerInfo,rt=!0;break e}u=u.return}if(we===null)throw Error(B(160));Oc(o,l,i),we=null,rt=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(h){ce(i,t,h)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Lc(t,e),t=t.sibling}function Lc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(tt(t,e),ut(e),r&4){try{hr(3,e,e.return),Yi(3,e)}catch(w){ce(e,e.return,w)}try{hr(5,e,e.return)}catch(w){ce(e,e.return,w)}}break;case 1:tt(t,e),ut(e),r&512&&n!==null&&En(n,n.return);break;case 5:if(tt(t,e),ut(e),r&512&&n!==null&&En(n,n.return),e.flags&32){var i=e.stateNode;try{mr(i,"")}catch(w){ce(e,e.return,w)}}if(r&4&&(i=e.stateNode,i!=null)){var o=e.memoizedProps,l=n!==null?n.memoizedProps:o,u=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{u==="input"&&o.type==="radio"&&o.name!=null&&au(i,o),Uo(u,l);var h=Uo(u,o);for(l=0;l<c.length;l+=2){var m=c[l],S=c[l+1];m==="style"?fu(i,S):m==="dangerouslySetInnerHTML"?du(i,S):m==="children"?mr(i,S):Ps(i,m,S,h)}switch(u){case"input":Lo(i,o);break;case"textarea":uu(i,o);break;case"select":var y=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var C=o.value;C!=null?Nn(i,!!o.multiple,C,!1):y!==!!o.multiple&&(o.defaultValue!=null?Nn(i,!!o.multiple,o.defaultValue,!0):Nn(i,!!o.multiple,o.multiple?[]:"",!1))}i[kr]=o}catch(w){ce(e,e.return,w)}}break;case 6:if(tt(t,e),ut(e),r&4){if(e.stateNode===null)throw Error(B(162));i=e.stateNode,o=e.memoizedProps;try{i.nodeValue=o}catch(w){ce(e,e.return,w)}}break;case 3:if(tt(t,e),ut(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Sr(t.containerInfo)}catch(w){ce(e,e.return,w)}break;case 4:tt(t,e),ut(e);break;case 13:tt(t,e),ut(e),i=e.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(pl=pe())),r&4&&Ra(e);break;case 22:if(m=n!==null&&n.memoizedState!==null,e.mode&1?(Me=(h=Me)||m,tt(t,e),Me=h):tt(t,e),ut(e),r&8192){if(h=e.memoizedState!==null,(e.stateNode.isHidden=h)&&!m&&e.mode&1)for(G=e,m=e.child;m!==null;){for(S=G=m;G!==null;){switch(y=G,C=y.child,y.tag){case 0:case 11:case 14:case 15:hr(4,y,y.return);break;case 1:En(y,y.return);var M=y.stateNode;if(typeof M.componentWillUnmount=="function"){r=y,n=y.return;try{t=r,M.props=t.memoizedProps,M.state=t.memoizedState,M.componentWillUnmount()}catch(w){ce(r,n,w)}}break;case 5:En(y,y.return);break;case 22:if(y.memoizedState!==null){Na(S);continue}}C!==null?(C.return=y,G=C):Na(S)}m=m.sibling}e:for(m=null,S=e;;){if(S.tag===5){if(m===null){m=S;try{i=S.stateNode,h?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(u=S.stateNode,c=S.memoizedProps.style,l=c!=null&&c.hasOwnProperty("display")?c.display:null,u.style.display=hu("display",l))}catch(w){ce(e,e.return,w)}}}else if(S.tag===6){if(m===null)try{S.stateNode.nodeValue=h?"":S.memoizedProps}catch(w){ce(e,e.return,w)}}else if((S.tag!==22&&S.tag!==23||S.memoizedState===null||S===e)&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===e)break e;for(;S.sibling===null;){if(S.return===null||S.return===e)break e;m===S&&(m=null),S=S.return}m===S&&(m=null),S.sibling.return=S.return,S=S.sibling}}break;case 19:tt(t,e),ut(e),r&4&&Ra(e);break;case 21:break;default:tt(t,e),ut(e)}}function ut(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Gc(n)){var r=n;break e}n=n.return}throw Error(B(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(mr(i,""),r.flags&=-33);var o=Ma(e);ws(e,o,i);break;case 3:case 4:var l=r.stateNode.containerInfo,u=Ma(e);Ss(e,u,l);break;default:throw Error(B(161))}}catch(c){ce(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function vf(e,t,n){G=e,Vc(e)}function Vc(e,t,n){for(var r=(e.mode&1)!==0;G!==null;){var i=G,o=i.child;if(i.tag===22&&r){var l=i.memoizedState!==null||$r;if(!l){var u=i.alternate,c=u!==null&&u.memoizedState!==null||Me;u=$r;var h=Me;if($r=l,(Me=c)&&!h)for(G=i;G!==null;)l=G,c=l.child,l.tag===22&&l.memoizedState!==null?Ta(i):c!==null?(c.return=l,G=c):Ta(i);for(;o!==null;)G=o,Vc(o),o=o.sibling;G=i,$r=u,Me=h}ba(e)}else i.subtreeFlags&8772&&o!==null?(o.return=i,G=o):ba(e)}}function ba(e){for(;G!==null;){var t=G;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Me||Yi(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Me)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:nt(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&ha(t,o,r);break;case 3:var l=t.updateQueue;if(l!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ha(t,l,n)}break;case 5:var u=t.stateNode;if(n===null&&t.flags&4){n=u;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var h=t.alternate;if(h!==null){var m=h.memoizedState;if(m!==null){var S=m.dehydrated;S!==null&&Sr(S)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(B(163))}Me||t.flags&512&&vs(t)}catch(y){ce(t,t.return,y)}}if(t===e){G=null;break}if(n=t.sibling,n!==null){n.return=t.return,G=n;break}G=t.return}}function Na(e){for(;G!==null;){var t=G;if(t===e){G=null;break}var n=t.sibling;if(n!==null){n.return=t.return,G=n;break}G=t.return}}function Ta(e){for(;G!==null;){var t=G;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Yi(4,t)}catch(c){ce(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){ce(t,i,c)}}var o=t.return;try{vs(t)}catch(c){ce(t,o,c)}break;case 5:var l=t.return;try{vs(t)}catch(c){ce(t,l,c)}}}catch(c){ce(t,t.return,c)}if(t===e){G=null;break}var u=t.sibling;if(u!==null){u.return=t.return,G=u;break}G=t.return}}var Sf=Math.ceil,Pi=Ct.ReactCurrentDispatcher,hl=Ct.ReactCurrentOwner,Je=Ct.ReactCurrentBatchConfig,q=0,ve=null,ge=null,Ie=0,Oe=0,kn=Ht(0),ye=0,jr=null,an=0,Ji=0,fl=0,fr=null,Be=null,pl=0,Wn=1/0,pt=null,Di=!1,Is=null,Dt=null,Kr=!1,Tt=null,zi=0,pr=0,Cs=null,fi=-1,pi=0;function Te(){return q&6?pe():fi!==-1?fi:fi=pe()}function zt(e){return e.mode&1?q&2&&Ie!==0?Ie&-Ie:nf.transition!==null?(pi===0&&(pi=ku()),pi):(e=te,e!==0||(e=window.event,e=e===void 0?16:Au(e.type)),e):1}function st(e,t,n,r){if(50<pr)throw pr=0,Cs=null,Error(B(185));Fr(e,n,r),(!(q&2)||e!==ve)&&(e===ve&&(!(q&2)&&(Ji|=n),ye===4&&bt(e,Ie)),Ge(e,r),n===1&&q===0&&!(t.mode&1)&&(Wn=pe()+500,Zi&&Ut()))}function Ge(e,t){var n=e.callbackNode;nh(e,t);var r=Si(e,e===ve?Ie:0);if(r===0)n!==null&&Ol(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ol(n),t===1)e.tag===0?tf(ja.bind(null,e)):$u(ja.bind(null,e)),$h(function(){!(q&6)&&Ut()}),n=null;else{switch(Mu(r)){case 1:n=Ls;break;case 4:n=Cu;break;case 16:n=vi;break;case 536870912:n=Eu;break;default:n=vi}n=Yc(n,Wc.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Wc(e,t){if(fi=-1,pi=0,q&6)throw Error(B(327));var n=e.callbackNode;if(Bn()&&e.callbackNode!==n)return null;var r=Si(e,e===ve?Ie:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Gi(e,r);else{t=r;var i=q;q|=2;var o=Hc();(ve!==e||Ie!==t)&&(pt=null,Wn=pe()+500,nn(e,t));do try{Cf();break}catch(u){_c(e,u)}while(!0);qs(),Pi.current=o,q=i,ge!==null?t=0:(ve=null,Ie=0,t=ye)}if(t!==0){if(t===2&&(i=Jo(e),i!==0&&(r=i,t=Es(e,i))),t===1)throw n=jr,nn(e,0),bt(e,r),Ge(e,pe()),n;if(t===6)bt(e,r);else{if(i=e.current.alternate,!(r&30)&&!wf(i)&&(t=Gi(e,r),t===2&&(o=Jo(e),o!==0&&(r=o,t=Es(e,o))),t===1))throw n=jr,nn(e,0),bt(e,r),Ge(e,pe()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(B(345));case 2:Xt(e,Be,pt);break;case 3:if(bt(e,r),(r&130023424)===r&&(t=pl+500-pe(),10<t)){if(Si(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Te(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=is(Xt.bind(null,e,Be,pt),t);break}Xt(e,Be,pt);break;case 4:if(bt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var l=31-ot(r);o=1<<l,l=t[l],l>i&&(i=l),r&=~o}if(r=i,r=pe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Sf(r/1960))-r,10<r){e.timeoutHandle=is(Xt.bind(null,e,Be,pt),r);break}Xt(e,Be,pt);break;case 5:Xt(e,Be,pt);break;default:throw Error(B(329))}}}return Ge(e,pe()),e.callbackNode===n?Wc.bind(null,e):null}function Es(e,t){var n=fr;return e.current.memoizedState.isDehydrated&&(nn(e,t).flags|=256),e=Gi(e,t),e!==2&&(t=Be,Be=n,t!==null&&ks(t)),e}function ks(e){Be===null?Be=e:Be.push.apply(Be,e)}function wf(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!lt(o(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bt(e,t){for(t&=~fl,t&=~Ji,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ot(t),r=1<<n;e[n]=-1,t&=~r}}function ja(e){if(q&6)throw Error(B(327));Bn();var t=Si(e,0);if(!(t&1))return Ge(e,pe()),null;var n=Gi(e,t);if(e.tag!==0&&n===2){var r=Jo(e);r!==0&&(t=r,n=Es(e,r))}if(n===1)throw n=jr,nn(e,0),bt(e,t),Ge(e,pe()),n;if(n===6)throw Error(B(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Xt(e,Be,pt),Ge(e,pe()),null}function gl(e,t){var n=q;q|=1;try{return e(t)}finally{q=n,q===0&&(Wn=pe()+500,Zi&&Ut())}}function un(e){Tt!==null&&Tt.tag===0&&!(q&6)&&Bn();var t=q;q|=1;var n=Je.transition,r=te;try{if(Je.transition=null,te=1,e)return e()}finally{te=r,Je.transition=n,q=t,!(q&6)&&Ut()}}function ml(){Oe=kn.current,oe(kn)}function nn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Jh(n)),ge!==null)for(n=ge.return;n!==null;){var r=n;switch(Js(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ki();break;case 3:Ln(),oe(De),oe(Re),ol();break;case 5:il(r);break;case 4:Ln();break;case 13:oe(le);break;case 19:oe(le);break;case 10:el(r.type._context);break;case 22:case 23:ml()}n=n.return}if(ve=e,ge=e=Gt(e.current,null),Ie=Oe=t,ye=0,jr=null,fl=Ji=an=0,Be=fr=null,en!==null){for(t=0;t<en.length;t++)if(n=en[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var l=o.next;o.next=i,r.next=l}n.pending=r}en=null}return e}function _c(e,t){do{var n=ge;try{if(qs(),ci.current=Bi,Fi){for(var r=ae.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Fi=!1}if(ln=0,xe=me=ae=null,dr=!1,br=0,hl.current=null,n===null||n.return===null){ye=1,jr=t,ge=null;break}e:{var o=e,l=n.return,u=n,c=t;if(t=Ie,u.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var h=c,m=u,S=m.tag;if(!(m.mode&1)&&(S===0||S===11||S===15)){var y=m.alternate;y?(m.updateQueue=y.updateQueue,m.memoizedState=y.memoizedState,m.lanes=y.lanes):(m.updateQueue=null,m.memoizedState=null)}var C=xa(l);if(C!==null){C.flags&=-257,va(C,l,u,o,t),C.mode&1&&ya(o,h,t),t=C,c=h;var M=t.updateQueue;if(M===null){var w=new Set;w.add(c),t.updateQueue=w}else M.add(c);break e}else{if(!(t&1)){ya(o,h,t),yl();break e}c=Error(B(426))}}else if(se&&u.mode&1){var F=xa(l);if(F!==null){!(F.flags&65536)&&(F.flags|=256),va(F,l,u,o,t),$s(Vn(c,u));break e}}o=c=Vn(c,u),ye!==4&&(ye=2),fr===null?fr=[o]:fr.push(o),o=l;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var p=Mc(o,c,t);da(o,p);break e;case 1:u=c;var f=o.type,x=o.stateNode;if(!(o.flags&128)&&(typeof f.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Dt===null||!Dt.has(x)))){o.flags|=65536,t&=-t,o.lanes|=t;var E=Rc(o,u,t);da(o,E);break e}}o=o.return}while(o!==null)}Zc(n)}catch(a){t=a,ge===n&&n!==null&&(ge=n=n.return);continue}break}while(!0)}function Hc(){var e=Pi.current;return Pi.current=Bi,e===null?Bi:e}function yl(){(ye===0||ye===3||ye===2)&&(ye=4),ve===null||!(an&268435455)&&!(Ji&268435455)||bt(ve,Ie)}function Gi(e,t){var n=q;q|=2;var r=Hc();(ve!==e||Ie!==t)&&(pt=null,nn(e,t));do try{If();break}catch(i){_c(e,i)}while(!0);if(qs(),q=n,Pi.current=r,ge!==null)throw Error(B(261));return ve=null,Ie=0,ye}function If(){for(;ge!==null;)Uc(ge)}function Cf(){for(;ge!==null&&!Qd();)Uc(ge)}function Uc(e){var t=Xc(e.alternate,e,Oe);e.memoizedProps=e.pendingProps,t===null?Zc(e):ge=t,hl.current=null}function Zc(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=mf(n,t),n!==null){n.flags&=32767,ge=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ye=6,ge=null;return}}else if(n=gf(n,t,Oe),n!==null){ge=n;return}if(t=t.sibling,t!==null){ge=t;return}ge=t=e}while(t!==null);ye===0&&(ye=5)}function Xt(e,t,n){var r=te,i=Je.transition;try{Je.transition=null,te=1,Ef(e,t,n,r)}finally{Je.transition=i,te=r}return null}function Ef(e,t,n,r){do Bn();while(Tt!==null);if(q&6)throw Error(B(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(B(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(rh(e,o),e===ve&&(ge=ve=null,Ie=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Kr||(Kr=!0,Yc(vi,function(){return Bn(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Je.transition,Je.transition=null;var l=te;te=1;var u=q;q|=4,hl.current=null,xf(e,n),Lc(n,e),_h(ns),wi=!!ts,ns=ts=null,e.current=n,vf(n),Xd(),q=u,te=l,Je.transition=o}else e.current=n;if(Kr&&(Kr=!1,Tt=e,zi=i),o=e.pendingLanes,o===0&&(Dt=null),$d(n.stateNode),Ge(e,pe()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Di)throw Di=!1,e=Is,Is=null,e;return zi&1&&e.tag!==0&&Bn(),o=e.pendingLanes,o&1?e===Cs?pr++:(pr=0,Cs=e):pr=0,Ut(),null}function Bn(){if(Tt!==null){var e=Mu(zi),t=Je.transition,n=te;try{if(Je.transition=null,te=16>e?16:e,Tt===null)var r=!1;else{if(e=Tt,Tt=null,zi=0,q&6)throw Error(B(331));var i=q;for(q|=4,G=e.current;G!==null;){var o=G,l=o.child;if(G.flags&16){var u=o.deletions;if(u!==null){for(var c=0;c<u.length;c++){var h=u[c];for(G=h;G!==null;){var m=G;switch(m.tag){case 0:case 11:case 15:hr(8,m,o)}var S=m.child;if(S!==null)S.return=m,G=S;else for(;G!==null;){m=G;var y=m.sibling,C=m.return;if(zc(m),m===h){G=null;break}if(y!==null){y.return=C,G=y;break}G=C}}}var M=o.alternate;if(M!==null){var w=M.child;if(w!==null){M.child=null;do{var F=w.sibling;w.sibling=null,w=F}while(w!==null)}}G=o}}if(o.subtreeFlags&2064&&l!==null)l.return=o,G=l;else e:for(;G!==null;){if(o=G,o.flags&2048)switch(o.tag){case 0:case 11:case 15:hr(9,o,o.return)}var p=o.sibling;if(p!==null){p.return=o.return,G=p;break e}G=o.return}}var f=e.current;for(G=f;G!==null;){l=G;var x=l.child;if(l.subtreeFlags&2064&&x!==null)x.return=l,G=x;else e:for(l=f;G!==null;){if(u=G,u.flags&2048)try{switch(u.tag){case 0:case 11:case 15:Yi(9,u)}}catch(a){ce(u,u.return,a)}if(u===l){G=null;break e}var E=u.sibling;if(E!==null){E.return=u.return,G=E;break e}G=u.return}}if(q=i,Ut(),ht&&typeof ht.onPostCommitFiberRoot=="function")try{ht.onPostCommitFiberRoot(Vi,e)}catch{}r=!0}return r}finally{te=n,Je.transition=t}}return!1}function Aa(e,t,n){t=Vn(n,t),t=Mc(e,t,1),e=Pt(e,t,1),t=Te(),e!==null&&(Fr(e,1,t),Ge(e,t))}function ce(e,t,n){if(e.tag===3)Aa(e,e,n);else for(;t!==null;){if(t.tag===3){Aa(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Dt===null||!Dt.has(r))){e=Vn(n,e),e=Rc(t,e,1),t=Pt(t,e,1),e=Te(),t!==null&&(Fr(t,1,e),Ge(t,e));break}}t=t.return}}function kf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Te(),e.pingedLanes|=e.suspendedLanes&n,ve===e&&(Ie&n)===n&&(ye===4||ye===3&&(Ie&130023424)===Ie&&500>pe()-pl?nn(e,0):fl|=n),Ge(e,t)}function Qc(e,t){t===0&&(e.mode&1?(t=Wr,Wr<<=1,!(Wr&130023424)&&(Wr=4194304)):t=1);var n=Te();e=wt(e,t),e!==null&&(Fr(e,t,n),Ge(e,n))}function Mf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Qc(e,n)}function Rf(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(B(314))}r!==null&&r.delete(t),Qc(e,n)}var Xc;Xc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||De.current)Pe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Pe=!1,pf(e,t,n);Pe=!!(e.flags&131072)}else Pe=!1,se&&t.flags&1048576&&Ku(t,bi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;hi(e,t),e=t.pendingProps;var i=zn(t,Re.current);Fn(t,n),i=ll(null,t,r,e,i,n);var o=al();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ze(r)?(o=!0,Mi(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,nl(t),i.updater=Xi,t.stateNode=i,i._reactInternals=t,ds(t,r,e,n),t=ps(null,t,r,!0,o,n)):(t.tag=0,se&&o&&Ys(t),Ne(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(hi(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Nf(r),e=nt(r,e),i){case 0:t=fs(null,t,r,e,n);break e;case 1:t=Ia(null,t,r,e,n);break e;case 11:t=Sa(null,t,r,e,n);break e;case 14:t=wa(null,t,r,nt(r.type,e),n);break e}throw Error(B(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:nt(r,i),fs(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:nt(r,i),Ia(e,t,r,i,n);case 3:e:{if(jc(t),e===null)throw Error(B(387));r=t.pendingProps,o=t.memoizedState,i=o.element,ic(e,t),ji(t,r,null,n);var l=t.memoizedState;if(r=l.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Vn(Error(B(423)),t),t=Ca(e,t,r,n,i);break e}else if(r!==i){i=Vn(Error(B(424)),t),t=Ca(e,t,r,n,i);break e}else for(Ve=Bt(t.stateNode.containerInfo.firstChild),We=t,se=!0,it=null,n=nc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gn(),r===i){t=It(e,t,n);break e}Ne(e,t,r,n)}t=t.child}return t;case 5:return oc(t),e===null&&as(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,l=i.children,rs(r,i)?l=null:o!==null&&rs(r,o)&&(t.flags|=32),Tc(e,t),Ne(e,t,l,n),t.child;case 6:return e===null&&as(t),null;case 13:return Ac(e,t,n);case 4:return rl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=On(t,null,r,n):Ne(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:nt(r,i),Sa(e,t,r,i,n);case 7:return Ne(e,t,t.pendingProps,n),t.child;case 8:return Ne(e,t,t.pendingProps.children,n),t.child;case 12:return Ne(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,l=i.value,re(Ni,r._currentValue),r._currentValue=l,o!==null)if(lt(o.value,l)){if(o.children===i.children&&!De.current){t=It(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){l=o.child;for(var c=u.firstContext;c!==null;){if(c.context===r){if(o.tag===1){c=xt(-1,n&-n),c.tag=2;var h=o.updateQueue;if(h!==null){h=h.shared;var m=h.pending;m===null?c.next=c:(c.next=m.next,m.next=c),h.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),us(o.return,n,t),u.lanes|=n;break}c=c.next}}else if(o.tag===10)l=o.type===t.type?null:o.child;else if(o.tag===18){if(l=o.return,l===null)throw Error(B(341));l.lanes|=n,u=l.alternate,u!==null&&(u.lanes|=n),us(l,n,t),l=o.sibling}else l=o.child;if(l!==null)l.return=o;else for(l=o;l!==null;){if(l===t){l=null;break}if(o=l.sibling,o!==null){o.return=l.return,l=o;break}l=l.return}o=l}Ne(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Fn(t,n),i=$e(i),r=r(i),t.flags|=1,Ne(e,t,r,n),t.child;case 14:return r=t.type,i=nt(r,t.pendingProps),i=nt(r.type,i),wa(e,t,r,i,n);case 15:return bc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:nt(r,i),hi(e,t),t.tag=1,ze(r)?(e=!0,Mi(t)):e=!1,Fn(t,n),kc(t,r,i),ds(t,r,i,n),ps(null,t,r,!0,e,n);case 19:return Fc(e,t,n);case 22:return Nc(e,t,n)}throw Error(B(156,t.tag))};function Yc(e,t){return Iu(e,t)}function bf(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 Ye(e,t,n,r){return new bf(e,t,n,r)}function xl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Nf(e){if(typeof e=="function")return xl(e)?1:0;if(e!=null){if(e=e.$$typeof,e===zs)return 11;if(e===Gs)return 14}return 2}function Gt(e,t){var n=e.alternate;return n===null?(n=Ye(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 gi(e,t,n,r,i,o){var l=2;if(r=e,typeof e=="function")xl(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case gn:return rn(n.children,i,o,t);case Ds:l=8,i|=8;break;case Po:return e=Ye(12,n,t,i|2),e.elementType=Po,e.lanes=o,e;case Do:return e=Ye(13,n,t,i),e.elementType=Do,e.lanes=o,e;case zo:return e=Ye(19,n,t,i),e.elementType=zo,e.lanes=o,e;case ou:return $i(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ru:l=10;break e;case iu:l=9;break e;case zs:l=11;break e;case Gs:l=14;break e;case kt:l=16,r=null;break e}throw Error(B(130,e==null?e:typeof e,""))}return t=Ye(l,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function rn(e,t,n,r){return e=Ye(7,e,r,t),e.lanes=n,e}function $i(e,t,n,r){return e=Ye(22,e,r,t),e.elementType=ou,e.lanes=n,e.stateNode={isHidden:!1},e}function No(e,t,n){return e=Ye(6,e,null,t),e.lanes=n,e}function To(e,t,n){return t=Ye(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Tf(e,t,n,r,i){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=uo(0),this.expirationTimes=uo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uo(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function vl(e,t,n,r,i,o,l,u,c){return e=new Tf(e,t,n,u,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Ye(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nl(o),e}function jf(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:pn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Jc(e){if(!e)return Lt;e=e._reactInternals;e:{if(dn(e)!==e||e.tag!==1)throw Error(B(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ze(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(B(171))}if(e.tag===1){var n=e.type;if(ze(n))return Ju(e,n,t)}return t}function $c(e,t,n,r,i,o,l,u,c){return e=vl(n,r,!0,e,i,o,l,u,c),e.context=Jc(null),n=e.current,r=Te(),i=zt(n),o=xt(r,i),o.callback=t??null,Pt(n,o,i),e.current.lanes=i,Fr(e,i,r),Ge(e,r),e}function Ki(e,t,n,r){var i=t.current,o=Te(),l=zt(i);return n=Jc(n),t.context===null?t.context=n:t.pendingContext=n,t=xt(o,l),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Pt(i,t,l),e!==null&&(st(e,i,l,o),ui(e,i,l)),l}function Oi(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Fa(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Sl(e,t){Fa(e,t),(e=e.alternate)&&Fa(e,t)}function Af(){return null}var Kc=typeof reportError=="function"?reportError:function(e){console.error(e)};function wl(e){this._internalRoot=e}qi.prototype.render=wl.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(B(409));Ki(e,t,null,null)};qi.prototype.unmount=wl.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;un(function(){Ki(null,e,null,null)}),t[St]=null}};function qi(e){this._internalRoot=e}qi.prototype.unstable_scheduleHydration=function(e){if(e){var t=Nu();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Rt.length&&t!==0&&t<Rt[n].priority;n++);Rt.splice(n,0,e),n===0&&ju(e)}};function Il(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function eo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ba(){}function Ff(e,t,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var h=Oi(l);o.call(h)}}var l=$c(t,r,e,0,null,!1,!1,"",Ba);return e._reactRootContainer=l,e[St]=l.current,Cr(e.nodeType===8?e.parentNode:e),un(),l}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var u=r;r=function(){var h=Oi(c);u.call(h)}}var c=vl(e,0,!1,null,null,!1,!1,"",Ba);return e._reactRootContainer=c,e[St]=c.current,Cr(e.nodeType===8?e.parentNode:e),un(function(){Ki(t,c,n,r)}),c}function to(e,t,n,r,i){var o=n._reactRootContainer;if(o){var l=o;if(typeof i=="function"){var u=i;i=function(){var c=Oi(l);u.call(c)}}Ki(t,l,e,i)}else l=Ff(n,t,e,i,r);return Oi(l)}Ru=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=rr(t.pendingLanes);n!==0&&(Vs(t,n|1),Ge(t,pe()),!(q&6)&&(Wn=pe()+500,Ut()))}break;case 13:un(function(){var r=wt(e,1);if(r!==null){var i=Te();st(r,e,1,i)}}),Sl(e,1)}};Ws=function(e){if(e.tag===13){var t=wt(e,134217728);if(t!==null){var n=Te();st(t,e,134217728,n)}Sl(e,134217728)}};bu=function(e){if(e.tag===13){var t=zt(e),n=wt(e,t);if(n!==null){var r=Te();st(n,e,t,r)}Sl(e,t)}};Nu=function(){return te};Tu=function(e,t){var n=te;try{return te=e,t()}finally{te=n}};Qo=function(e,t,n){switch(t){case"input":if(Lo(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=Ui(r);if(!i)throw Error(B(90));lu(r),Lo(r,i)}}}break;case"textarea":uu(e,n);break;case"select":t=n.value,t!=null&&Nn(e,!!n.multiple,t,!1)}};mu=gl;yu=un;var Bf={usingClientEntryPoint:!1,Events:[Pr,vn,Ui,pu,gu,gl]},er={findFiberByHostInstance:qt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Pf={bundleType:er.bundleType,version:er.version,rendererPackageName:er.rendererPackageName,rendererConfig:er.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ct.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Su(e),e===null?null:e.stateNode},findFiberByHostInstance:er.findFiberByHostInstance||Af,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qr.isDisabled&&qr.supportsFiber)try{Vi=qr.inject(Pf),ht=qr}catch{}}He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Bf;He.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Il(t))throw Error(B(200));return jf(e,t,null,n)};He.createRoot=function(e,t){if(!Il(e))throw Error(B(299));var n=!1,r="",i=Kc;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=vl(e,1,!1,null,null,n,!1,r,i),e[St]=t.current,Cr(e.nodeType===8?e.parentNode:e),new wl(t)};He.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(B(188)):(e=Object.keys(e).join(","),Error(B(268,e)));return e=Su(t),e=e===null?null:e.stateNode,e};He.flushSync=function(e){return un(e)};He.hydrate=function(e,t,n){if(!eo(t))throw Error(B(200));return to(null,e,t,!0,n)};He.hydrateRoot=function(e,t,n){if(!Il(e))throw Error(B(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",l=Kc;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(l=n.onRecoverableError)),t=$c(t,null,e,1,n??null,i,!1,o,l),e[St]=t.current,Cr(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new qi(t)};He.render=function(e,t,n){if(!eo(t))throw Error(B(200));return to(null,e,t,!1,n)};He.unmountComponentAtNode=function(e){if(!eo(e))throw Error(B(40));return e._reactRootContainer?(un(function(){to(null,null,e,!1,function(){e._reactRootContainer=null,e[St]=null})}),!0):!1};He.unstable_batchedUpdates=gl;He.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!eo(n))throw Error(B(200));if(e==null||e._reactInternals===void 0)throw Error(B(38));return to(e,t,n,!1,r)};He.version="18.3.1-next-f1338f8080-20240426";function qc(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qc)}catch(e){console.error(e)}}qc(),qa.exports=He;var Df=qa.exports,Pa=Df;Fo.createRoot=Pa.createRoot,Fo.hydrateRoot=Pa.hydrateRoot;class Da{constructor(t,n,r=60){R(this,"cellSize");R(this,"cols");R(this,"rows");R(this,"grid");this.cellSize=r,this.cols=Math.ceil(t/r),this.rows=Math.ceil(n/r),this.grid=new Map}clear(){this.grid.clear()}getKey(t,n){return`${t},${n}`}insert(t){const n=Math.floor(t.x/this.cellSize),r=Math.floor(t.y/this.cellSize),i=this.getKey(n,r);this.grid.has(i)||this.grid.set(i,[]),this.grid.get(i).push(t)}getNearby(t,n,r){const i=Math.max(0,Math.floor((t-r)/this.cellSize)),o=Math.min(this.cols-1,Math.floor((t+r)/this.cellSize)),l=Math.max(0,Math.floor((n-r)/this.cellSize)),u=Math.min(this.rows-1,Math.floor((n+r)/this.cellSize)),c=[];for(let h=i;h<=o;h++)for(let m=l;m<=u;m++){const S=this.getKey(h,m),y=this.grid.get(S);y&&c.push(...y)}return c}}class Mn{constructor(t,n=12,r=8,i=0){R(this,"boundary");R(this,"capacity");R(this,"maxDepth");R(this,"depth");R(this,"points",[]);R(this,"divided",!1);R(this,"northwest",null);R(this,"northeast",null);R(this,"southwest",null);R(this,"southeast",null);this.boundary=t,this.capacity=n,this.maxDepth=r,this.depth=i}subdivide(){const{x:t,y:n,width:r,height:i}=this.boundary,o=r/2,l=i/2,u=this.depth+1;this.northwest=new Mn({x:t,y:n,width:o,height:l},this.capacity,this.maxDepth,u),this.northeast=new Mn({x:t+o,y:n,width:o,height:l},this.capacity,this.maxDepth,u),this.southwest=new Mn({x:t,y:n+l,width:o,height:l},this.capacity,this.maxDepth,u),this.southeast=new Mn({x:t+o,y:n+l,width:o,height:l},this.capacity,this.maxDepth,u),this.divided=!0}insert(t){if(!this.contains(this.boundary,t))return!1;if(this.points.length<this.capacity&&!this.divided)return this.points.push(t),!0;if(this.depth>=this.maxDepth)return this.points.push(t),!0;if(!this.divided){let n=!0;for(let r=1;r<this.points.length;r++)if(this.points[r].x!==this.points[0].x||this.points[r].y!==this.points[0].y){n=!1;break}if(n&&this.points.length>0&&t.x===this.points[0].x&&t.y===this.points[0].y)return this.points.push(t),!0;this.subdivide();for(const r of this.points)this.insertToChildren(r);this.points=[]}return this.insertToChildren(t)}insertToChildren(t){return this.northwest&&this.northwest.insert(t)||this.northeast&&this.northeast.insert(t)||this.southwest&&this.southwest.insert(t)||this.southeast&&this.southeast.insert(t)||!1}contains(t,n){return n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height}queryRange(t,n=[]){var r,i,o,l;if(!this.intersectsCircle(this.boundary,t))return n;for(const u of this.points)(u.x-t.x)*(u.x-t.x)+(u.y-t.y)*(u.y-t.y)<=t.radius*t.radius&&n.push(u);return this.divided&&((r=this.northwest)==null||r.queryRange(t,n),(i=this.northeast)==null||i.queryRange(t,n),(o=this.southwest)==null||o.queryRange(t,n),(l=this.southeast)==null||l.queryRange(t,n)),n}intersectsCircle(t,n){const r=Math.max(t.x,Math.min(n.x,t.x+t.width)),i=Math.max(t.y,Math.min(n.y,t.y+t.height)),o=n.x-r,l=n.y-i;return o*o+l*l<=n.radius*n.radius}clear(){this.points=[],this.divided=!1,this.northwest=null,this.northeast=null,this.southwest=null,this.southeast=null}}class qe{constructor(t,n,r=50){R(this,"pool",[]);R(this,"factory");R(this,"resetFn");this.factory=t,this.resetFn=n;for(let i=0;i<r;i++)this.pool.push(this.factory())}acquire(){const t=this.pool.pop()||this.factory();return this.resetFn(t),t}release(t){this.pool.push(t)}get size(){return this.pool.length}}new qe(()=>({x1:0,y1:0,x2:0,y2:0,intensity:1}),e=>{e.x1=0,e.y1=0,e.x2=0,e.y2=0,e.intensity=1},100);new qe(()=>({x:0,y:0}),e=>{e.x=0,e.y=0},200);new qe(()=>({id:"",x:0,y:0,value:25,radius:3.5,type:"NUTRIENT_DOT",color:"#00E676"}),e=>{e.id="",e.x=0,e.y=0,e.value=25,e.radius=3.5,e.type="NUTRIENT_DOT",e.color="#00E676"},150);const ei=new qe(()=>({id:0,x:0,y:0,vx:0,vy:0,life:0,maxLife:0,color:"#ffffff",size:1}),e=>{e.id=0,e.x=0,e.y=0,e.vx=0,e.vy=0,e.life=0,e.maxLife=0,e.color="#ffffff",e.size=1},100);new qe(()=>({x:0,y:0,life:1,color:"#ffffff"}),e=>{e.x=0,e.y=0,e.life=1,e.color="#ffffff"},500);new qe(()=>({x:0,y:0,intensity:1,color:"#00E676"}),e=>{e.x=0,e.y=0,e.intensity=1,e.color="#00E676"},1e3);new qe(()=>({id:"",x:0,y:0,radius:4,color:"#34d399"}),e=>{e.id="",e.x=0,e.y=0,e.radius=4,e.color="#34d399"},1e3);new qe(()=>({x:0,y:0,activationLevel:0,color:"#06b6d4"}),e=>{e.x=0,e.y=0,e.activationLevel=0,e.color="#06b6d4"},1e3);new qe(()=>({x:0,y:0,z:0,nx:0,ny:0,nz:1}),e=>{e.x=0,e.y=0,e.z=0,e.nx=0,e.ny=0,e.nz=1},5e3);new qe(()=>({x:0,y:0,vx:0,vy:0,life:1}),e=>{e.x=0,e.y=0,e.vx=0,e.vy=0,e.life=1},2e3);new qe(()=>({x:0,y:0,radius:3,viralLoad:1}),e=>{e.x=0,e.y=0,e.radius=3,e.viralLoad=1},3e3);class zf{constructor(t,n,r=10){R(this,"resolution");R(this,"cols");R(this,"rows");R(this,"buffer");R(this,"activeEmitters",[]);R(this,"emitterPool");this.resolution=r,this.cols=Math.ceil(t/r),this.rows=Math.ceil(n/r),this.buffer=new Float32Array(this.cols*this.rows),this.emitterPool=new qe(()=>({x:0,y:0,amount:0,life:0,active:!1}),i=>{i.active=!1},100)}registerEmitter(t,n,r,i=60){const o=this.emitterPool.acquire();o.x=t,o.y=n,o.amount=r,o.life=i,o.active=!0,this.activeEmitters.push(o)}processEmitters(){for(let t=this.activeEmitters.length-1;t>=0;t--){const n=this.activeEmitters[t];n.life<=0?(this.emitterPool.release(n),this.activeEmitters.splice(t,1)):(this.addPheromone(n.x,n.y,n.amount),n.life--)}}addPheromone(t,n,r){const i=Math.floor(t/this.resolution),o=Math.floor(n/this.resolution);i>=0&&i<this.cols&&o>=0&&o<this.rows&&(this.buffer[o*this.cols+i]+=r)}getPheromone(t,n){const r=Math.floor(t/this.resolution),i=Math.floor(n/this.resolution);return r>=0&&r<this.cols&&i>=0&&i<this.rows?this.buffer[i*this.cols+r]:0}decay(t=.98){const n=new Float32Array(this.cols*this.rows),r=.1;for(let i=0;i<this.rows;i++)for(let o=0;o<this.cols;o++){const l=i*this.cols+o;let u=this.buffer[l];if(u>0){let c=0,h=0;i>0&&(h+=this.buffer[(i-1)*this.cols+o],c++),i<this.rows-1&&(h+=this.buffer[(i+1)*this.cols+o],c++),o>0&&(h+=this.buffer[i*this.cols+(o-1)],c++),o<this.cols-1&&(h+=this.buffer[i*this.cols+(o+1)],c++);const m=u*(1-r)+h/Math.max(1,c)*r;n[l]=m*t,n[l]<.01&&(n[l]=0)}}this.buffer=n}}const Jt=class Jt{constructor(){R(this,"nextSpeciesId",1)}static getInstance(){return Jt.instance||(Jt.instance=new Jt),Jt.instance}evaluateMatingCompatibility(t,n){const r=this.calculateAlleleDistance(t,n),i=.4;if(r>i)return{compatible:!1,distance:r,isHybrid:!1,fertilityFactor:0};const o=t.speciesId!==n.speciesId;let l=1;return o&&(l=Math.max(.1,1-r/i)),{compatible:!0,distance:r,isHybrid:o,fertilityFactor:l}}calculateAlleleDistance(t,n){if(!t.genome||!n.genome)return 0;let r=0;return r+=Math.abs(t.genome.speedAllele.baseValue-n.genome.speedAllele.baseValue),r+=Math.abs(t.genome.visionAllele.baseValue-n.genome.visionAllele.baseValue),r+=Math.abs(t.genome.efficiencyAllele.baseValue-n.genome.efficiencyAllele.baseValue),r/3}getSpeciesId(){return this.nextSpeciesId++}};R(Jt,"instance");let Rn=Jt;class za{constructor(t=60){R(this,"cellSize");R(this,"grid",new Map);this.cellSize=t}getKey(t,n){const r=Math.floor(t/this.cellSize),i=Math.floor(n/this.cellSize);return`${r},${i}`}clear(){this.grid.clear()}insert(t){const n=this.getKey(t.x,t.y);let r=this.grid.get(n);r||(r=[],this.grid.set(n,r)),r.push(t)}query(t,n,r){const i=[],o=Math.floor((t-r)/this.cellSize),l=Math.floor((t+r)/this.cellSize),u=Math.floor((n-r)/this.cellSize),c=Math.floor((n+r)/this.cellSize),h=r*r;for(let m=o;m<=l;m++)for(let S=u;S<=c;S++){const y=`${m},${S}`,C=this.grid.get(y);if(C)for(let M=0;M<C.length;M++){const w=C[M],F=w.x-t,p=w.y-n;F*F+p*p<=h&&i.push(w)}}return i}}class Gf{constructor(){R(this,"ctx",null);R(this,"isMuted",!0);R(this,"masterGain",null);R(this,"masterVolume",.3);R(this,"lastFeedTime",0);R(this,"feedCooldownMs",80);R(this,"activeOscCount",0);R(this,"maxConcurrentOsc",6);R(this,"spatialPanners",new Map);R(this,"telemetryBufferIdx",0);R(this,"telemetrySize",256);R(this,"velocityMetrics",new Float32Array(256));R(this,"stressMetrics",new Float32Array(256));R(this,"droneOsc",null);R(this,"droneGain",null)}sanitizeReset(){if(this.spatialPanners.forEach(t=>{try{t.disconnect()}catch{}}),this.spatialPanners.clear(),this.masterGain&&this.ctx)try{this.masterGain.gain.setValueAtTime(this.masterGain.gain.value,this.ctx.currentTime),this.masterGain.gain.linearRampToValueAtTime(0,this.ctx.currentTime+.05)}catch{}if(this.activeOscCount=0,this.ctx&&this.ctx.state==="suspended")try{this.ctx.resume()}catch{}}dispose(){if(this.stopAmbientDrone(),this.spatialPanners.forEach(t=>{try{t.disconnect()}catch{}}),this.spatialPanners.clear(),this.masterGain){try{this.masterGain.disconnect()}catch{}this.masterGain=null}if(this.ctx){try{this.ctx.state!=="closed"&&this.ctx.close()}catch{}this.ctx=null}this.activeOscCount=0}initCtx(){if(!this.ctx&&typeof window<"u"){const t=window.AudioContext||window.webkitAudioContext;if(t)try{this.ctx=new t,this.masterGain=this.ctx.createGain(),this.masterGain.gain.setValueAtTime(this.masterVolume,this.ctx.currentTime),this.masterGain.connect(this.ctx.destination)}catch{this.ctx=null,this.masterGain=null}}}setVolume(t){this.masterVolume=Math.max(0,Math.min(1,t)),this.masterGain&&this.ctx&&this.masterGain.gain.setValueAtTime(this.masterVolume,this.ctx.currentTime)}getSpatialPanner(t){if(!this.ctx)return null;const n=Math.max(-1,Math.min(1,(t-400)/400)),r=Math.round(n*10);if(!this.spatialPanners.has(r)){const i=this.ctx.createStereoPanner();i.pan.value=n,i.connect(this.masterGain),this.spatialPanners.set(r,i)}return this.spatialPanners.get(r)||null}getVolume(){return this.masterVolume}playFeedSound(t=440){if(this.isMuted)return;const n=performance.now();if(!(n-this.lastFeedTime<this.feedCooldownMs)&&(this.lastFeedTime=n,!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain))))try{const r=Math.max(220,Math.min(880,t)),i=this.ctx.createOscillator(),o=this.ctx.createGain();i.type="sine",i.frequency.setValueAtTime(r,this.ctx.currentTime),o.gain.setValueAtTime(0,this.ctx.currentTime),o.gain.linearRampToValueAtTime(.06,this.ctx.currentTime+.01),o.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+.12),i.connect(o),o.connect(this.masterGain),this.activeOscCount++,i.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{o.disconnect()}catch{}},i.start(),i.stop(this.ctx.currentTime+.12)}catch{}}playAmbientDrone(t,n){if(this.velocityMetrics[this.telemetryBufferIdx]=t,this.stressMetrics[this.telemetryBufferIdx]=n,this.telemetryBufferIdx=(this.telemetryBufferIdx+1)%this.telemetrySize,this.isMuted){this.stopAmbientDrone();return}if(this.initCtx(),!(!this.ctx||!this.masterGain))try{(!this.droneOsc||!this.droneGain)&&(this.droneOsc=this.ctx.createOscillator(),this.droneGain=this.ctx.createGain(),this.droneOsc.type="sine",this.droneOsc.connect(this.droneGain),this.droneGain.connect(this.masterGain),this.droneGain.gain.setValueAtTime(.001,this.ctx.currentTime),this.droneOsc.start());const r=50+t*20,i=Math.max(.001,Math.min(.15,n*.15));this.droneOsc.frequency.setTargetAtTime(r,this.ctx.currentTime,.5),this.droneGain.gain.setTargetAtTime(i,this.ctx.currentTime,1)}catch{}}stopAmbientDrone(){if(this.droneOsc&&this.droneGain){try{this.droneOsc.stop(),this.droneOsc.disconnect(),this.droneGain.disconnect()}catch{}this.droneOsc=null,this.droneGain=null}}playBiomeHum(t){if(!this.isMuted&&!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain)))try{const n=this.ctx.createOscillator(),r=this.ctx.createGain();if(t==="TOXIC_SLUDGE")n.type="sawtooth",n.frequency.setValueAtTime(60,this.ctx.currentTime);else if(t==="CRYO_ZONE")n.type="sine",n.frequency.setValueAtTime(180,this.ctx.currentTime);else if(t==="HIGH_G_FIELD")n.type="triangle",n.frequency.setValueAtTime(45,this.ctx.currentTime);else return;r.gain.setValueAtTime(0,this.ctx.currentTime),r.gain.linearRampToValueAtTime(.04,this.ctx.currentTime+1),r.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+3),n.connect(r),r.connect(this.masterGain),this.activeOscCount++,n.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{r.disconnect()}catch{}},n.start(),n.stop(this.ctx.currentTime+3)}catch{}}toggleMute(){return this.isMuted=!this.isMuted,this.isMuted&&this.masterGain&&this.ctx?this.masterGain.gain.setValueAtTime(0,this.ctx.currentTime):!this.isMuted&&this.masterGain&&this.ctx&&this.masterGain.gain.setValueAtTime(this.masterVolume,this.ctx.currentTime),this.isMuted}getMuted(){return this.isMuted}playDisasterSound(t){if(!this.isMuted&&!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain)))try{const n=this.ctx.createOscillator(),r=this.ctx.createGain();t==="METEOR"||t==="STORM"?(n.type="sawtooth",n.frequency.setValueAtTime(150,this.ctx.currentTime),n.frequency.exponentialRampToValueAtTime(40,this.ctx.currentTime+1)):t==="VOID"||t==="INVERSION"?(n.type="triangle",n.frequency.setValueAtTime(40,this.ctx.currentTime),n.frequency.linearRampToValueAtTime(120,this.ctx.currentTime+.8)):(n.type="square",n.frequency.setValueAtTime(200,this.ctx.currentTime)),r.gain.setValueAtTime(0,this.ctx.currentTime),r.gain.linearRampToValueAtTime(.15,this.ctx.currentTime+.1),r.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+1),n.connect(r),r.connect(this.masterGain),this.activeOscCount++,n.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{r.disconnect()}catch{}},n.start(),n.stop(this.ctx.currentTime+1)}catch{}}playSpeciationEvent(t){if(!this.isMuted&&!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain)))try{const n=this.getSpatialPanner(t);if(!n)return;const r=this.ctx.createOscillator(),i=this.ctx.createGain();r.type="square",r.frequency.setValueAtTime(440,this.ctx.currentTime),r.frequency.exponentialRampToValueAtTime(880,this.ctx.currentTime+.1),i.gain.setValueAtTime(0,this.ctx.currentTime),i.gain.linearRampToValueAtTime(.1,this.ctx.currentTime+.05),i.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+.3),r.connect(i),i.connect(n),this.activeOscCount++,r.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{i.disconnect()}catch{}},r.start(),r.stop(this.ctx.currentTime+.3)}catch{}}playExtinctionEvent(t){if(!this.isMuted&&!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain)))try{const n=this.getSpatialPanner(t);if(!n)return;const r=this.ctx.createOscillator(),i=this.ctx.createGain();r.type="sawtooth",r.frequency.setValueAtTime(120,this.ctx.currentTime),r.frequency.exponentialRampToValueAtTime(20,this.ctx.currentTime+.4),i.gain.setValueAtTime(0,this.ctx.currentTime),i.gain.linearRampToValueAtTime(.1,this.ctx.currentTime+.05),i.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+.5),r.connect(i),i.connect(n),this.activeOscCount++,r.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{i.disconnect()}catch{}},r.start(),r.stop(this.ctx.currentTime+.5)}catch{}}}const Le=new Gf;function Of(e,t,n,r,i,o){let l=0,u=0,c=0,h=0;for(const p of n){const f=e.x-p.x,x=e.y-p.y,E=Math.hypot(f,x);if(E<p.radius+e.visionRadius){const a=(p.radius+e.visionRadius-E)/(p.radius+e.visionRadius);c+=f/(E||1)*a*4,h+=x/(E||1)*a*4}}if(Math.hypot(c,h)>.1)return l+=c,u+=h,{desiredHeading:Math.atan2(u,l),state:"EVADING_HAZARD"};let m=null,S=1/0;for(const p of t){const f=p.x-e.x,x=p.y-e.y,E=Math.hypot(f,x);E<=e.visionRadius&&E<S&&(S=E,m=p)}if(m){const p=m.x-e.x,f=m.y-e.y;return{desiredHeading:Math.atan2(f,p),state:"SEEKING_ENERGY"}}if(o&&e.battery>e.maxBattery*.5){const x=new Float32Array(4);x[0]=e.x+Math.cos(e.heading-.5)*20,x[1]=e.y+Math.sin(e.heading-.5)*20,x[2]=e.x+Math.cos(e.heading+.5)*20,x[3]=e.y+Math.sin(e.heading+.5)*20;const E=o.getPheromone(x[0],x[1]),a=o.getPheromone(x[2],x[3]);if(E>.1||a>.1){if(E>a)return{desiredHeading:e.heading-.2,state:"WANDERING"};if(a>E)return{desiredHeading:e.heading+.2,state:"WANDERING"}}}const y=60;let C=0,M=0;if(e.x<y?C=(y-e.x)/y:e.x>r-y&&(C=-(e.x-(r-y))/y),e.y<y?M=(y-e.y)/y:e.y>i-y&&(M=-(e.y-(i-y))/y),Math.hypot(C,M)>.1)return{desiredHeading:Math.atan2(M+Math.sin(e.heading)*.5,C+Math.cos(e.heading)*.5),state:"WANDERING"};const w=(Math.random()-.5)*.3;return{desiredHeading:e.heading+w,state:"WANDERING"}}const $t=class $t{constructor(){R(this,"globalStressIndex",0);R(this,"stressHistory",new Float32Array(1e3));R(this,"markerBuffer",new Float32Array(3e3));R(this,"historyIndex",0);R(this,"maxHistory",1e3);R(this,"defaultMarkers",new Map);this.initDefaultMarkers()}initDefaultMarkers(){this.defaultMarkers.set("STRESS_SPEED_BOOST",{geneId:"SPEED",activationLevel:0,heritability:.75,stressThreshold:.4}),this.defaultMarkers.set("STRESS_EFFICIENCY_BOOST",{geneId:"EFFICIENCY",activationLevel:0,heritability:.6,stressThreshold:.5}),this.defaultMarkers.set("RADIATION_DEFENSE",{geneId:"ARMOR",activationLevel:0,heritability:.8,stressThreshold:.6})}getDefaultMarkers(){return Array.from(this.defaultMarkers.values()).map(t=>({...t}))}static getInstance(){return $t.instance||($t.instance=new $t),$t.instance}getGlobalStress(){return this.globalStressIndex}updateGlobalStress(t){this.globalStressIndex=t}recordStressFrame(){this.stressHistory[this.historyIndex]=this.globalStressIndex,this.historyIndex=(this.historyIndex+1)%this.maxHistory}modulateGeneExpression(t,n){t.epigenome||(t.epigenome=this.getDefaultMarkers());for(const r of t.epigenome)n>=r.stressThreshold?r.activationLevel=Math.min(1,r.activationLevel+.05*n):r.activationLevel=Math.max(0,r.activationLevel-.01),r.geneId==="SPEED"&&r.activationLevel>0?t.speed=Math.min(10,t.maxSpeed*(1+.25*r.activationLevel)):r.geneId==="EFFICIENCY"&&r.activationLevel>0?t.energyEfficiency=Math.min(3,t.energyEfficiency*(1+.2*r.activationLevel)):r.geneId==="ARMOR"&&r.activationLevel>0&&(t.armorGene=Math.min(.9,(t.armorGene||0)+.05*r.activationLevel))}inheritEpigenome(t,n=.85){return t.map(r=>{const i=Math.random()<r.heritability;return{...r,activationLevel:i?r.activationLevel*n:0}})}packMarkerBuffer(t){var r,i,o;let n=0;for(let l=0;l<t.length&&n<3e3;l++){const u=t[l].epigenome||[];this.markerBuffer[n++]=((r=u[0])==null?void 0:r.activationLevel)||0,this.markerBuffer[n++]=((i=u[1])==null?void 0:i.activationLevel)||0,this.markerBuffer[n++]=((o=u[2])==null?void 0:o.activationLevel)||0}return this.markerBuffer.subarray(0,n)}getStressHistory(){const t=new Float32Array(this.maxHistory);return t.set(this.stressHistory.subarray(this.historyIndex),0),t.set(this.stressHistory.subarray(0,this.historyIndex),this.maxHistory-this.historyIndex),t}};R($t,"instance");let bn=$t;const Kt=class Kt{constructor(){}static getInstance(){return Kt.instance||(Kt.instance=new Kt),Kt.instance}safeSqrt(t){return isNaN(t)||t<=0?0:Math.sqrt(t)}safeAtan2(t,n){return isNaN(t)||isNaN(n)?0:Math.atan2(t,n)}safeDiv(t,n,r=0){if(isNaN(t)||isNaN(n)||n===0)return r;const i=t/n;return isFinite(i)?i:r}clampVector(t,n=1e3){const r=isNaN(t.x)||!isFinite(t.x)?0:t.x,i=isNaN(t.y)||!isFinite(t.y)?0:t.y,o=this.safeSqrt(r*r+i*i);if(o>n){const l=n/o;return{x:r*l,y:i*l}}return{x:r,y:i}}sanitizePosition(t,n,r,i){let o=isNaN(t)||!isFinite(t)?r/2:t,l=isNaN(n)||!isFinite(n)?i/2:n;return o=Math.max(0,Math.min(r,o)),l=Math.max(0,Math.min(i,l)),{x:o,y:l}}sanitizeMicrobotState(t,n,r){const i=this.sanitizePosition(t.x,t.y,n,r);t.x=i.x,t.y=i.y,t.vx=isNaN(t.vx)||!isFinite(t.vx)?0:Math.max(-10,Math.min(10,t.vx)),t.vy=isNaN(t.vy)||!isFinite(t.vy)?0:Math.max(-10,Math.min(10,t.vy)),t.speed=isNaN(t.speed)||!isFinite(t.speed)?2:Math.max(.5,Math.min(10,t.speed)),t.battery=isNaN(t.battery)||!isFinite(t.battery)?t.maxBattery:Math.max(0,Math.min(t.maxBattery,t.battery))}};R(Kt,"instance");let Pn=Kt;function be(e,t,n){return isNaN(e)?t:Math.max(t,Math.min(n,e))}function Yt(e){return isNaN(e)||!isFinite(e)?0:e}function Lf(e,t,n,r,i,o,l,u=15,c=[]){const h=Math.hypot(n*i,r*i),m=Math.max(1,Math.ceil(isNaN(h)?1:h/10)),S=Pn.getInstance().safeDiv(n*i,m,0),y=Pn.getInstance().safeDiv(r*i,m,0);let C=e,M=t,w=!1;for(let F=0;F<m;F++){C+=S,M+=y,C=Yt(C),M=Yt(M);for(const p of c)if(Math.hypot(C-p.x,M-p.y)<p.radius){w=!0;const f=Pn.getInstance().safeAtan2(M-p.y,C-p.x);C=p.x+Math.cos(f)*p.radius,M=p.y+Math.sin(f)*p.radius}if(C<u||C>o-u||M<u||M>l-u){C=be(C,u,o-u),M=be(M,u,l-u);break}}return{x:C,y:M,hitHazard:w}}const Vf={};function Wf(e){const t=window.location.protocol==="file:"||window.location.href.includes("app.asar")||window.location.protocol==="tauri:"||window.location.href.includes("android_asset");let n=e.startsWith("/")?e.substring(1):e;if(window.location.href.includes("android_asset")||window.location.origin==="https://localhost"||window.location.protocol==="file:"||window.location.protocol==="capacitor:"||window.location.protocol==="ionic:"){const r=window.location.href.split("index.html")[0];return r.endsWith("/")?`${r}${n}`:`${r}/${n}`}if(typeof import.meta<"u"&&Vf){const r="./";let i=r.endsWith("/")?`${r}${n}`:`${r}/${n}`;return i.startsWith("/")&&(i="."+i),i}return t?(n.startsWith("./")&&(n=n.substring(2)),n):e}function _f(e){let t=Wf(e);t.startsWith("/")&&(t="."+t);try{const n=typeof window<"u"?window.location.href:"http://localhost";return new URL(t,n).href}catch{return t}}class Ga{constructor(){R(this,"worker",null);R(this,"isSupported");R(this,"workerScriptUrl","");R(this,"errorStrikes",0);R(this,"maxStrikes",3);R(this,"onWorkerRestarted");R(this,"lastStateSnapshot",null);this.isSupported=typeof window<"u"&&typeof window.Worker<"u"}initWorker(t){if(!(!this.isSupported||this.errorStrikes>=this.maxStrikes)){this.workerScriptUrl=typeof t=="string"?t:t.href;try{const n=typeof t=="string"?_f(t):t;this.worker=new Worker(n,{type:"module"})}catch{try{this.worker=new Worker(this.workerScriptUrl)}catch(r){console.warn("Worker initialization fallback:",r)}}this.worker&&(this.worker.onerror=n=>{console.error("Web Worker Error:",n),this.errorStrikes++,this.terminate(),this.errorStrikes<=this.maxStrikes?(console.log(`Self-healing Worker Auto-Restarting (Attempt ${this.errorStrikes}/${this.maxStrikes})...`),setTimeout(()=>{this.initWorker(this.workerScriptUrl),this.onWorkerRestarted&&this.onWorkerRestarted()},500)):console.error("Worker exceeded max retry strikes, operating in main thread fallback.")})}}resetStrikes(){this.errorStrikes=0}getLastSnapshot(){return this.lastStateSnapshot}saveSnapshot(t){this.lastStateSnapshot=t,this.postTask("RESTORE_SNAPSHOT",{snapshot:t})}postTask(t,n){t==="RESTORE_SNAPSHOT"&&(this.lastStateSnapshot=n.snapshot),this.worker&&this.worker.postMessage({type:t,payload:n})}terminate(){this.worker&&(this.worker.terminate(),this.worker=null)}}class Oa{constructor(t,n,r=10){R(this,"width");R(this,"height");R(this,"resolution");R(this,"cols");R(this,"rows");R(this,"buffer");this.width=t,this.height=n,this.resolution=r,this.cols=Math.ceil(t/r),this.rows=Math.ceil(n/r),this.buffer=new Float32Array(this.cols*this.rows)}addPheromone(t,n,r){const i=Math.floor(t/this.resolution),o=Math.floor(n/this.resolution);if(i>=0&&i<this.cols&&o>=0&&o<this.rows){const l=o*this.cols+i;this.buffer[l]=Math.min(1,this.buffer[l]+r)}}getPheromone(t,n){const r=Math.floor(t/this.resolution),i=Math.floor(n/this.resolution);return r>=0&&r<this.cols&&i>=0&&i<this.rows?this.buffer[i*this.cols+r]:0}decay(t){for(let n=0;n<this.buffer.length;n++)this.buffer[n]>0&&(this.buffer[n]=Math.max(0,this.buffer[n]-t))}reset(){this.buffer.fill(0)}}class Hf{constructor(){R(this,"eventQueue",[]);R(this,"activeEvent",null)}triggerCataclysm(t,n,r,i=300){const o={id:`cataclysm-${Date.now()}-${Math.floor(Math.random()*1e3)}`,type:t,durationFrames:i,remainingFrames:i,intensity:1,epicenterX:n/2,epicenterY:r/2,radius:Math.min(n,r)*.45};return this.eventQueue.push(o),this.activeEvent||(this.activeEvent=this.eventQueue.shift()||null),o}getActiveEvent(){return this.activeEvent}update(){if(!this.activeEvent){this.eventQueue.length>0&&(this.activeEvent=this.eventQueue.shift()||null);return}this.activeEvent.remainingFrames--,this.activeEvent.remainingFrames<=0&&(this.activeEvent=this.eventQueue.shift()||null)}reset(){this.eventQueue=[],this.activeEvent=null}computeTectonicDeformation(t,n,r){if(r.type!=="TECTONIC_INVERSION")return{dx:0,dy:0,heightShift:0};const i=Math.hypot(t-r.epicenterX,n-r.epicenterY);if(i>r.radius)return{dx:0,dy:0,heightShift:0};const o=i/r.radius,l=Math.sin(o*Math.PI*2)*r.intensity,u=Math.atan2(n-r.epicenterY,t-r.epicenterX);return{dx:Math.cos(u)*l*5,dy:Math.sin(u)*l*5,heightShift:(1-o)*20*r.intensity}}computeSolarStormEffects(t){return t.type!=="SOLAR_STORM"?{energyBlackout:!1,forceFieldInversion:!1,visionReduction:1}:{energyBlackout:Math.random()<.3*t.intensity,forceFieldInversion:t.remainingFrames%20<10,visionReduction:Math.max(.2,1-.7*t.intensity)}}}class Uf{constructor(){R(this,"viralSpores",[]);R(this,"baseInfectionRate",.05);R(this,"antibodyDecayRate",.002)}updateSpores(t,n){for(let r=this.viralSpores.length-1;r>=0;r--){const i=this.viralSpores[r];i.x+=i.vx,i.y+=i.vy,i.lifetimeFrames--,(i.x<0||i.x>t||i.y<0||i.y>n||i.lifetimeFrames<=0)&&this.viralSpores.splice(r,1)}}calculateInfectionProbability(t,n){const r=n.antibodyLevels[t.genomeSequence]||0,o=Math.min(1,this.baseInfectionRate*t.viralLoad)*(1-Math.min(.95,r));return Math.max(.001,o)}spliceViralGenes(t,n){if(!t)return t;const r={...t};return r.speedAllele&&(r.speedAllele={...r.speedAllele,baseValue:Math.max(.5,Math.min(10,r.speedAllele.baseValue*(1+n.length%5*.05)))}),r}updateImmunityProfile(t){if(t){for(const n of Object.keys(t.antibodyLevels))t.antibodyLevels[n]=Math.max(0,t.antibodyLevels[n]-this.antibodyDecayRate);if(t.isInfected&&t.activeVirusId){const n=t.antibodyLevels[t.activeVirusId]||0;t.antibodyLevels[t.activeVirusId]=Math.min(1,n+.015),t.antibodyLevels[t.activeVirusId]>=.85&&(t.isInfected=!1,t.viralLoad=0)}}}packAntibodyLevelsToFloat32(t,n){if(!t||!t.antibodyLevels)return;const r=Object.values(t.antibodyLevels);for(let i=0;i<r.length&&i<n.length;i++)n[i]=r[i]}}class Zf{constructor(){R(this,"currentCondition",{weather:"TEMPERATE",temperatureCelsius:22,humidityPercent:50,atmosphericPressure:1,cycleFrameCount:0});R(this,"cycleDurationFrames",1800)}updateAtmosphere(){this.currentCondition.cycleFrameCount++,this.currentCondition.cycleFrameCount%this.cycleDurationFrames===0&&this.shiftWeather()}shiftWeather(){const t=["TEMPERATE","HEATWAVE","GLACIAL_BLIZZARD","ACID_RAIN","HIGH_PRESSURE_GALE"],n=Math.floor(Math.random()*t.length);switch(this.currentCondition.weather=t[n],this.currentCondition.weather){case"HEATWAVE":this.currentCondition.temperatureCelsius=48,this.currentCondition.humidityPercent=20,this.currentCondition.atmosphericPressure=1.1;break;case"GLACIAL_BLIZZARD":this.currentCondition.temperatureCelsius=-18,this.currentCondition.humidityPercent=85,this.currentCondition.atmosphericPressure=1.3;break;case"ACID_RAIN":this.currentCondition.temperatureCelsius=30,this.currentCondition.humidityPercent=95,this.currentCondition.atmosphericPressure=.9;break;case"HIGH_PRESSURE_GALE":this.currentCondition.temperatureCelsius=15,this.currentCondition.humidityPercent=60,this.currentCondition.atmosphericPressure=1.45;break;default:this.currentCondition.temperatureCelsius=22,this.currentCondition.humidityPercent=50,this.currentCondition.atmosphericPressure=1;break}}calculateThermalBatteryDrain(t){const n=this.currentCondition.temperatureCelsius;let r=1;return n>35&&(r+=(n-35)*.02),n<5&&(r+=(5-n)*.025),t*r}calculateThermalMobilityDrag(t){const n=this.currentCondition.temperatureCelsius;return n<0?t*Math.max(.4,1+n*.015):t}calculateInsulationEfficiency(t,n){const r=this.currentCondition.temperatureCelsius;return r>30?Math.min(1,.5+(t||0)*.5):r<5?Math.min(1,.5+(n||0)*.5):1}}class Qf{constructor(t,n,r){R(this,"width");R(this,"height");R(this,"config");R(this,"microbots",[]);R(this,"energyParticles",[]);R(this,"hazards",[]);R(this,"speedFields",[]);R(this,"fluidZones",[]);R(this,"gravityWells",[]);R(this,"catalystZones",[]);R(this,"chemicalGrid");R(this,"pheromoneGrid");R(this,"meteors",[]);R(this,"voidRifts",[]);R(this,"portals",[]);R(this,"biomes",[]);R(this,"spores",[]);R(this,"viralManager",new Uf);R(this,"atmosphereManager",new Zf);R(this,"cataclysmManager",new Hf);R(this,"activeDisasters",[]);R(this,"disasterParticles",[]);R(this,"selectedMicrobotId",null);R(this,"threadManager");R(this,"wasmModule",null);R(this,"energyPositionsX",new Float32Array(5e3));R(this,"energyPositionsY",new Float32Array(5e3));R(this,"raycastBuffer",new Float32Array(100));R(this,"spatialGrid");R(this,"spatialHash");R(this,"totalBirths",0);R(this,"totalDeaths",0);R(this,"generationCount",1);R(this,"frameCount",0);R(this,"seasonFrameCount",0);R(this,"disasterTimer",0);R(this,"SEASON_DURATION_FRAMES",2700);R(this,"populationHistory",new Array(30).fill(45));R(this,"birthHistory",new Array(30).fill(0));R(this,"deathHistory",new Array(30).fill(0));R(this,"historyTimeline",[]);R(this,"positionBuffer");R(this,"positionsView");R(this,"lastFrameTime",performance.now());R(this,"actualTPS",0);R(this,"recentBirths",0);R(this,"recentDeaths",0);R(this,"nextBotIdNum",1);R(this,"nextFoodIdNum",1);R(this,"nextFieldIdNum",1);R(this,"speciationDiversityBuffer",new Float32Array(100));R(this,"speciationDiversityIndex",0);this.width=t,this.height=n,this.config=r,this.spatialGrid=new Da(t,n,100),this.threadManager=new Ga,this.threadManager.initWorker(new URL("data:video/mp2t;base64,Ly8gV2ViIFdvcmtlciB0aHJlYWQgb2ZmbG9hZGluZyBoZWF2eSBnZW5ldGljIGNhbGN1bGF0aW9ucyBhbmQgc3BhdGlhbCBwaHlzaWNzDQpzZWxmLm9ubWVzc2FnZSA9IChldmVudDogTWVzc2FnZUV2ZW50KSA9PiB7DQogIGNvbnN0IHsgdHlwZSwgcGF5bG9hZCB9ID0gZXZlbnQuZGF0YTsNCiAgaWYgKHR5cGUgPT09ICdDQUxDVUxBVEVfRElTVEFOQ0VTJykgew0KICAgIGNvbnN0IHsgYm90cywgZm9vZCB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCByZXN1bHRzID0gW107DQogICAgZm9yIChsZXQgaSA9IDA7IGkgPCBib3RzLmxlbmd0aDsgaSsrKSB7DQogICAgICBsZXQgY2xvc2VzdERpc3QgPSBJbmZpbml0eTsNCiAgICAgIGxldCBjbG9zZXN0Rm9vZElkID0gbnVsbDsNCiAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgZm9vZC5sZW5ndGg7IGorKykgew0KICAgICAgICBjb25zdCBkeCA9IGZvb2Rbal0ueCAtIGJvdHNbaV0ueDsNCiAgICAgICAgY29uc3QgZHkgPSBmb29kW2pdLnkgLSBib3RzW2ldLnk7DQogICAgICAgIGNvbnN0IGRTcSA9IGR4ICogZHggKyBkeSAqIGR5Ow0KICAgICAgICBpZiAoZFNxIDwgY2xvc2VzdERpc3QpIHsNCiAgICAgICAgICBjbG9zZXN0RGlzdCA9IGRTcTsNCiAgICAgICAgICBjbG9zZXN0Rm9vZElkID0gZm9vZFtqXS5pZDsNCiAgICAgICAgfQ0KICAgICAgfQ0KICAgICAgcmVzdWx0cy5wdXNoKHsgYm90SWQ6IGJvdHNbaV0uaWQsIGNsb3Nlc3RGb29kSWQsIGRpc3RhbmNlOiBNYXRoLnNxcnQoY2xvc2VzdERpc3QpIH0pOw0KICAgIH0NCiAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdHlwZTogJ0RJU1RBTkNFU19DQUxDVUxBVEVEJywgcGF5bG9hZDogcmVzdWx0cyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQ1JPU1NPVkVSX0ROQScpIHsNCiAgICBjb25zdCB7IHBhcmVudEEsIHBhcmVudEIsIG11dGF0aW9uUmF0ZSB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCBvZmZzcHJpbmcgPSB7DQogICAgICBzcGVlZDogTWF0aC5yYW5kb20oKSA8IDAuNSA/IHBhcmVudEEuc3BlZWQgOiBwYXJlbnRCLnNwZWVkLA0KICAgICAgdmlzaW9uUmFkaXVzOiBNYXRoLnJhbmRvbSgpIDwgMC41ID8gcGFyZW50QS52aXNpb25SYWRpdXMgOiBwYXJlbnRCLnZpc2lvblJhZGl1cywNCiAgICAgIGVuZXJneUVmZmljaWVuY3k6IE1hdGgucmFuZG9tKCkgPCAwLjUgPyBwYXJlbnRBLmVuZXJneUVmZmljaWVuY3kgOiBwYXJlbnRCLmVuZXJneUVmZmljaWVuY3ksDQogICAgICBodWU6IE1hdGgucmFuZG9tKCkgPCAwLjUgPyBwYXJlbnRBLmh1ZSA6IHBhcmVudEIuaHVlDQogICAgfTsNCiAgICBpZiAoTWF0aC5yYW5kb20oKSA8IG11dGF0aW9uUmF0ZSkgew0KICAgICAgb2Zmc3ByaW5nLnNwZWVkICs9IChNYXRoLnJhbmRvbSgpIC0gMC41KSAqIDAuNDsNCiAgICAgIG9mZnNwcmluZy52aXNpb25SYWRpdXMgKz0gKE1hdGgucmFuZG9tKCkgLSAwLjUpICogMTU7DQogICAgfQ0KICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB0eXBlOiAnRE5BX0NST1NTT1ZFUl9DT01QTEVURScsIHBheWxvYWQ6IG9mZnNwcmluZyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQkFUQ0hfQ09MTElTSU9OUycpIHsNCiAgICBjb25zdCB7IGVudGl0aWVzLCByYWRpdXMgfSA9IHBheWxvYWQ7DQogICAgY29uc3QgY29sbGlzaW9ucyA9IFtdOw0KICAgIGNvbnN0IHJhZFNxID0gcmFkaXVzICogcmFkaXVzOw0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZW50aXRpZXMubGVuZ3RoOyBpKyspIHsNCiAgICAgIGZvciAobGV0IGogPSBpICsgMTsgaiA8IGVudGl0aWVzLmxlbmd0aDsgaisrKSB7DQogICAgICAgIGNvbnN0IGR4ID0gZW50aXRpZXNbal0ueCAtIGVudGl0aWVzW2ldLng7DQogICAgICAgIGNvbnN0IGR5ID0gZW50aXRpZXNbal0ueSAtIGVudGl0aWVzW2ldLnk7DQogICAgICAgIGlmIChkeCAqIGR4ICsgZHkgKiBkeSA8PSByYWRTcSkgew0KICAgICAgICAgIGNvbGxpc2lvbnMucHVzaChbZW50aXRpZXNbaV0uaWQsIGVudGl0aWVzW2pdLmlkXSk7DQogICAgICAgIH0NCiAgICAgIH0NCiAgICB9DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdDT0xMSVNJT05TX0NPTVBVVEVEJywgcGF5bG9hZDogY29sbGlzaW9ucyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnUVVBRFRSRUVfQlVJTEQnKSB7DQogICAgY29uc3QgeyBwb2ludHMgfSA9IHBheWxvYWQ7DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdRVUFEVFJFRV9CVUlMVCcsIHBheWxvYWQ6IHsgY291bnQ6IHBvaW50cy5sZW5ndGggfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnU1BFQ0lBVElPTl9RVUVSSUVTJykgew0KICAgIC8vIFByb2Nlc3MgRmxvYXQzMkFycmF5IGFycmF5cyBmb3IgemVyby1jb3B5IHNlcmlhbGl6YXRpb24gb3ZlcmhlYWQNCiAgICBjb25zdCB7IGdlbm9tZUEsIGdlbm9tZUIgfSA9IHBheWxvYWQ7DQogICAgbGV0IGRpc3RhbmNlID0gMDsNCiAgICBpZiAoZ2Vub21lQSAmJiBnZW5vbWVCICYmIGdlbm9tZUEubGVuZ3RoID09PSBnZW5vbWVCLmxlbmd0aCkgew0KICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBnZW5vbWVBLmxlbmd0aDsgaSsrKSB7DQogICAgICAgIGRpc3RhbmNlICs9IE1hdGgucG93KGdlbm9tZUFbaV0gLSBnZW5vbWVCW2ldLCAyKTsNCiAgICAgIH0NCiAgICAgIGRpc3RhbmNlID0gTWF0aC5zcXJ0KGRpc3RhbmNlKTsNCiAgICB9DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdTUEVDSUFUSU9OX1JFU1VMVCcsIHBheWxvYWQ6IHsgZGlzdGFuY2UgfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQkFUQ0hfUEhZU0lDU19RVUVSWScpIHsNCiAgICBjb25zdCB7IHBvc2l0aW9uc0J1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCBjb29yZHMgPSBuZXcgRmxvYXQzMkFycmF5KHBvc2l0aW9uc0J1ZmZlcik7DQogICAgY29uc3QgcmVzdWx0cyA9IG5ldyBGbG9hdDMyQXJyYXkoY29vcmRzLmxlbmd0aCAvIDIpOw0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgY29vcmRzLmxlbmd0aDsgaSArPSAyKSB7DQogICAgICByZXN1bHRzW2kgLyAyXSA9IE1hdGguaHlwb3QoY29vcmRzW2ldLCBjb29yZHNbaSArIDFdKTsNCiAgICB9DQogICAgKHNlbGYgYXMgYW55KS5wb3N0TWVzc2FnZSh7IHR5cGU6ICdQSFlTSUNTX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IHJlc3VsdHMuYnVmZmVyIH0sIFtyZXN1bHRzLmJ1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdXQVNNX1NQQVRJQUxfU1RBVEUnKSB7DQogICAgY29uc3QgeyBzcGF0aWFsQnVmZmVyIH0gPSBwYXlsb2FkOw0KICAgIChzZWxmIGFzIGFueSkucG9zdE1lc3NhZ2UoeyB0eXBlOiAnV0FTTV9TUEFUSUFMX1VQREFURUQnLCBwYXlsb2FkOiBzcGF0aWFsQnVmZmVyIH0sIFtzcGF0aWFsQnVmZmVyXSk7DQogIH0gZWxzZSBpZiAodHlwZSA9PT0gJ0JJT01FX1BIWVNJQ1NfUVVFUlknKSB7DQogICAgY29uc3QgeyBiaW9tZUJ1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICAoc2VsZiBhcyBhbnkpLnBvc3RNZXNzYWdlKHsgdHlwZTogJ0JJT01FX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IGJpb21lQnVmZmVyIH0sIFtiaW9tZUJ1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdQTEFTVElDSVRZX1FVRVJZJykgew0KICAgIGNvbnN0IHsgd2VpZ2h0c0J1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICAoc2VsZiBhcyBhbnkpLnBvc3RNZXNzYWdlKHsgdHlwZTogJ1BMQVNUSUNJVFlfUVVFUllfUkVTVUxUJywgcGF5bG9hZDogd2VpZ2h0c0J1ZmZlciB9LCBbd2VpZ2h0c0J1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdSRVNUT1JFX1NOQVBTSE9UJykgew0KICAgIGNvbnN0IHsgc25hcHNob3Q6IF9zbmFwc2hvdCB9ID0gcGF5bG9hZDsNCiAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdHlwZTogJ1NOQVBTSE9UX1JFU1RPUkVEJywgcGF5bG9hZDogeyBzdWNjZXNzOiB0cnVlLCB0aW1lc3RhbXA6IERhdGUubm93KCkgfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnR0VUX1NOQVBTSE9UJykgew0KICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB0eXBlOiAnU05BUFNIT1RfU0VSSUFMSVpFRCcsIHBheWxvYWQ6IHsgdGltZXN0YW1wOiBEYXRlLm5vdygpIH0gfSk7DQogIH0NCn07DQo=",import.meta.url)),this.spatialHash=new za(60),this.chemicalGrid=new Oa(t,n,20),this.positionBuffer=new SharedArrayBuffer(1e3*2*4),this.positionsView=new Float32Array(this.positionBuffer),this.generateBiomes(),this.initWASM(),this.resetSimulation()}async initWASM(){try{const n=await(await fetch("./physics.wasm")).arrayBuffer(),r=await WebAssembly.instantiate(n,{env:{abort:()=>console.log("WASM abort")}});this.wasmModule=r.instance.exports,console.log("WASM Physics Module initialized successfully.")}catch(t){console.error("Failed to initialize WASM module:",t)}}generateBiomes(){this.biomes=[];const t=2,n=2,r=this.width/t,i=this.height/n,o=["NORMAL","TOXIC_SLUDGE","CRYO_ZONE","HIGH_G_FIELD"];for(let u=o.length-1;u>0;u--){const c=Math.floor(Math.random()*(u+1));[o[u],o[c]]=[o[c],o[u]]}let l=0;for(let u=0;u<t;u++)for(let c=0;c<n;c++){const h=o[l%o.length];let m="rgba(255,255,255,0)";h==="TOXIC_SLUDGE"&&(m="rgba(163, 230, 53, 0.05)"),h==="CRYO_ZONE"&&(m="rgba(56, 189, 248, 0.05)"),h==="HIGH_G_FIELD"&&(m="rgba(244, 63, 94, 0.05)"),this.biomes.push({id:`biome-${u}-${c}`,type:h,x:u*r,y:c*i,width:r,height:i,color:m}),l++}}getBiomeAt(t,n){return this.biomes.find(r=>t>=r.x&&t<=r.x+r.width&&n>=r.y&&n<=r.y+r.height)}resetSimulation(){this.microbots=[],this.energyParticles=[],this.hazards=[],this.speedFields=[],this.fluidZones=[],this.gravityWells=[],this.catalystZones=[],this.chemicalGrid.reset(),this.portals=[],this.activeDisasters=[],this.selectedMicrobotId=null,this.totalBirths=0,this.totalDeaths=0,this.generationCount=1,this.nextBotIdNum=1,this.frameCount=0,this.seasonFrameCount=0,this.lastFrameTime=performance.now(),this.actualTPS=0,this.historyTimeline=[],this.threadManager.terminate(),this.threadManager=new Ga,this.threadManager.initWorker(new URL("data:video/mp2t;base64,Ly8gV2ViIFdvcmtlciB0aHJlYWQgb2ZmbG9hZGluZyBoZWF2eSBnZW5ldGljIGNhbGN1bGF0aW9ucyBhbmQgc3BhdGlhbCBwaHlzaWNzDQpzZWxmLm9ubWVzc2FnZSA9IChldmVudDogTWVzc2FnZUV2ZW50KSA9PiB7DQogIGNvbnN0IHsgdHlwZSwgcGF5bG9hZCB9ID0gZXZlbnQuZGF0YTsNCiAgaWYgKHR5cGUgPT09ICdDQUxDVUxBVEVfRElTVEFOQ0VTJykgew0KICAgIGNvbnN0IHsgYm90cywgZm9vZCB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCByZXN1bHRzID0gW107DQogICAgZm9yIChsZXQgaSA9IDA7IGkgPCBib3RzLmxlbmd0aDsgaSsrKSB7DQogICAgICBsZXQgY2xvc2VzdERpc3QgPSBJbmZpbml0eTsNCiAgICAgIGxldCBjbG9zZXN0Rm9vZElkID0gbnVsbDsNCiAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgZm9vZC5sZW5ndGg7IGorKykgew0KICAgICAgICBjb25zdCBkeCA9IGZvb2Rbal0ueCAtIGJvdHNbaV0ueDsNCiAgICAgICAgY29uc3QgZHkgPSBmb29kW2pdLnkgLSBib3RzW2ldLnk7DQogICAgICAgIGNvbnN0IGRTcSA9IGR4ICogZHggKyBkeSAqIGR5Ow0KICAgICAgICBpZiAoZFNxIDwgY2xvc2VzdERpc3QpIHsNCiAgICAgICAgICBjbG9zZXN0RGlzdCA9IGRTcTsNCiAgICAgICAgICBjbG9zZXN0Rm9vZElkID0gZm9vZFtqXS5pZDsNCiAgICAgICAgfQ0KICAgICAgfQ0KICAgICAgcmVzdWx0cy5wdXNoKHsgYm90SWQ6IGJvdHNbaV0uaWQsIGNsb3Nlc3RGb29kSWQsIGRpc3RhbmNlOiBNYXRoLnNxcnQoY2xvc2VzdERpc3QpIH0pOw0KICAgIH0NCiAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdHlwZTogJ0RJU1RBTkNFU19DQUxDVUxBVEVEJywgcGF5bG9hZDogcmVzdWx0cyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQ1JPU1NPVkVSX0ROQScpIHsNCiAgICBjb25zdCB7IHBhcmVudEEsIHBhcmVudEIsIG11dGF0aW9uUmF0ZSB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCBvZmZzcHJpbmcgPSB7DQogICAgICBzcGVlZDogTWF0aC5yYW5kb20oKSA8IDAuNSA/IHBhcmVudEEuc3BlZWQgOiBwYXJlbnRCLnNwZWVkLA0KICAgICAgdmlzaW9uUmFkaXVzOiBNYXRoLnJhbmRvbSgpIDwgMC41ID8gcGFyZW50QS52aXNpb25SYWRpdXMgOiBwYXJlbnRCLnZpc2lvblJhZGl1cywNCiAgICAgIGVuZXJneUVmZmljaWVuY3k6IE1hdGgucmFuZG9tKCkgPCAwLjUgPyBwYXJlbnRBLmVuZXJneUVmZmljaWVuY3kgOiBwYXJlbnRCLmVuZXJneUVmZmljaWVuY3ksDQogICAgICBodWU6IE1hdGgucmFuZG9tKCkgPCAwLjUgPyBwYXJlbnRBLmh1ZSA6IHBhcmVudEIuaHVlDQogICAgfTsNCiAgICBpZiAoTWF0aC5yYW5kb20oKSA8IG11dGF0aW9uUmF0ZSkgew0KICAgICAgb2Zmc3ByaW5nLnNwZWVkICs9IChNYXRoLnJhbmRvbSgpIC0gMC41KSAqIDAuNDsNCiAgICAgIG9mZnNwcmluZy52aXNpb25SYWRpdXMgKz0gKE1hdGgucmFuZG9tKCkgLSAwLjUpICogMTU7DQogICAgfQ0KICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB0eXBlOiAnRE5BX0NST1NTT1ZFUl9DT01QTEVURScsIHBheWxvYWQ6IG9mZnNwcmluZyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQkFUQ0hfQ09MTElTSU9OUycpIHsNCiAgICBjb25zdCB7IGVudGl0aWVzLCByYWRpdXMgfSA9IHBheWxvYWQ7DQogICAgY29uc3QgY29sbGlzaW9ucyA9IFtdOw0KICAgIGNvbnN0IHJhZFNxID0gcmFkaXVzICogcmFkaXVzOw0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZW50aXRpZXMubGVuZ3RoOyBpKyspIHsNCiAgICAgIGZvciAobGV0IGogPSBpICsgMTsgaiA8IGVudGl0aWVzLmxlbmd0aDsgaisrKSB7DQogICAgICAgIGNvbnN0IGR4ID0gZW50aXRpZXNbal0ueCAtIGVudGl0aWVzW2ldLng7DQogICAgICAgIGNvbnN0IGR5ID0gZW50aXRpZXNbal0ueSAtIGVudGl0aWVzW2ldLnk7DQogICAgICAgIGlmIChkeCAqIGR4ICsgZHkgKiBkeSA8PSByYWRTcSkgew0KICAgICAgICAgIGNvbGxpc2lvbnMucHVzaChbZW50aXRpZXNbaV0uaWQsIGVudGl0aWVzW2pdLmlkXSk7DQogICAgICAgIH0NCiAgICAgIH0NCiAgICB9DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdDT0xMSVNJT05TX0NPTVBVVEVEJywgcGF5bG9hZDogY29sbGlzaW9ucyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnUVVBRFRSRUVfQlVJTEQnKSB7DQogICAgY29uc3QgeyBwb2ludHMgfSA9IHBheWxvYWQ7DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdRVUFEVFJFRV9CVUlMVCcsIHBheWxvYWQ6IHsgY291bnQ6IHBvaW50cy5sZW5ndGggfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnU1BFQ0lBVElPTl9RVUVSSUVTJykgew0KICAgIC8vIFByb2Nlc3MgRmxvYXQzMkFycmF5IGFycmF5cyBmb3IgemVyby1jb3B5IHNlcmlhbGl6YXRpb24gb3ZlcmhlYWQNCiAgICBjb25zdCB7IGdlbm9tZUEsIGdlbm9tZUIgfSA9IHBheWxvYWQ7DQogICAgbGV0IGRpc3RhbmNlID0gMDsNCiAgICBpZiAoZ2Vub21lQSAmJiBnZW5vbWVCICYmIGdlbm9tZUEubGVuZ3RoID09PSBnZW5vbWVCLmxlbmd0aCkgew0KICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBnZW5vbWVBLmxlbmd0aDsgaSsrKSB7DQogICAgICAgIGRpc3RhbmNlICs9IE1hdGgucG93KGdlbm9tZUFbaV0gLSBnZW5vbWVCW2ldLCAyKTsNCiAgICAgIH0NCiAgICAgIGRpc3RhbmNlID0gTWF0aC5zcXJ0KGRpc3RhbmNlKTsNCiAgICB9DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdTUEVDSUFUSU9OX1JFU1VMVCcsIHBheWxvYWQ6IHsgZGlzdGFuY2UgfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQkFUQ0hfUEhZU0lDU19RVUVSWScpIHsNCiAgICBjb25zdCB7IHBvc2l0aW9uc0J1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCBjb29yZHMgPSBuZXcgRmxvYXQzMkFycmF5KHBvc2l0aW9uc0J1ZmZlcik7DQogICAgY29uc3QgcmVzdWx0cyA9IG5ldyBGbG9hdDMyQXJyYXkoY29vcmRzLmxlbmd0aCAvIDIpOw0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgY29vcmRzLmxlbmd0aDsgaSArPSAyKSB7DQogICAgICByZXN1bHRzW2kgLyAyXSA9IE1hdGguaHlwb3QoY29vcmRzW2ldLCBjb29yZHNbaSArIDFdKTsNCiAgICB9DQogICAgKHNlbGYgYXMgYW55KS5wb3N0TWVzc2FnZSh7IHR5cGU6ICdQSFlTSUNTX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IHJlc3VsdHMuYnVmZmVyIH0sIFtyZXN1bHRzLmJ1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdXQVNNX1NQQVRJQUxfU1RBVEUnKSB7DQogICAgY29uc3QgeyBzcGF0aWFsQnVmZmVyIH0gPSBwYXlsb2FkOw0KICAgIChzZWxmIGFzIGFueSkucG9zdE1lc3NhZ2UoeyB0eXBlOiAnV0FTTV9TUEFUSUFMX1VQREFURUQnLCBwYXlsb2FkOiBzcGF0aWFsQnVmZmVyIH0sIFtzcGF0aWFsQnVmZmVyXSk7DQogIH0gZWxzZSBpZiAodHlwZSA9PT0gJ0JJT01FX1BIWVNJQ1NfUVVFUlknKSB7DQogICAgY29uc3QgeyBiaW9tZUJ1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICAoc2VsZiBhcyBhbnkpLnBvc3RNZXNzYWdlKHsgdHlwZTogJ0JJT01FX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IGJpb21lQnVmZmVyIH0sIFtiaW9tZUJ1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdQTEFTVElDSVRZX1FVRVJZJykgew0KICAgIGNvbnN0IHsgd2VpZ2h0c0J1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICAoc2VsZiBhcyBhbnkpLnBvc3RNZXNzYWdlKHsgdHlwZTogJ1BMQVNUSUNJVFlfUVVFUllfUkVTVUxUJywgcGF5bG9hZDogd2VpZ2h0c0J1ZmZlciB9LCBbd2VpZ2h0c0J1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdSRVNUT1JFX1NOQVBTSE9UJykgew0KICAgIGNvbnN0IHsgc25hcHNob3Q6IF9zbmFwc2hvdCB9ID0gcGF5bG9hZDsNCiAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdHlwZTogJ1NOQVBTSE9UX1JFU1RPUkVEJywgcGF5bG9hZDogeyBzdWNjZXNzOiB0cnVlLCB0aW1lc3RhbXA6IERhdGUubm93KCkgfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnR0VUX1NOQVBTSE9UJykgew0KICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB0eXBlOiAnU05BUFNIT1RfU0VSSUFMSVpFRCcsIHBheWxvYWQ6IHsgdGltZXN0YW1wOiBEYXRlLm5vdygpIH0gfSk7DQogIH0NCn07DQo=",import.meta.url)),this.spatialGrid.clear(),this.nextFieldIdNum=1,this.recentBirths=0,this.recentDeaths=0,this.populationHistory=new Array(30).fill(this.config.startPopulation),this.birthHistory=new Array(30).fill(0),this.deathHistory=new Array(30).fill(0),this.historyTimeline=[];for(let t=0;t<this.config.startPopulation;t++)this.spawnMicrobot();this.spawnMultipleFood(80),this.updateHazardsCount(),this.microbots.length>0&&(this.selectedMicrobotId=this.microbots[0].id)}exportSyntheticRulesets(){return JSON.stringify({version:"0.1.224",timestamp:Date.now(),gravityWells:this.gravityWells,speedFields:this.speedFields,fluidZones:this.fluidZones},null,2)}exportNASBrainArchitectures(){const t=this.microbots.map(n=>({botId:n.id,nasBrain:n.nasBrain,organelles:n.organelles,mitochondrialDNA:n.mitochondrialDNA})).filter(n=>n.nasBrain||n.organelles&&n.organelles.length>0);return JSON.stringify({version:"0.1.224",timestamp:Date.now(),architectures:t},null,2)}exportState(){const t={microbots:this.microbots,energyParticles:this.energyParticles,hazards:this.hazards,speedFields:this.speedFields,fluidZones:this.fluidZones,gravityWells:this.gravityWells,catalystZones:this.catalystZones,chemicalGridBuffer:Array.from(this.chemicalGrid.buffer),meteors:this.meteors,activeDisasters:this.activeDisasters,config:this.config,stats:{totalBirths:this.totalBirths,totalDeaths:this.totalDeaths,generationCount:this.generationCount,frameCount:this.frameCount}};return btoa(JSON.stringify(t))}importState(t){try{const n=JSON.parse(atob(t));this.microbots=n.microbots||[],this.energyParticles=n.energyParticles||[],this.hazards=n.hazards||[],this.speedFields=n.speedFields||[],this.fluidZones=n.fluidZones||[],this.gravityWells=n.gravityWells||[],this.catalystZones=n.catalystZones||[],n.chemicalGridBuffer&&this.chemicalGrid.buffer.set(n.chemicalGridBuffer),this.meteors=n.meteors||[],this.activeDisasters=n.activeDisasters||[],this.config={...this.config,...n.config},n.stats&&(this.totalBirths=n.stats.totalBirths,this.totalDeaths=n.stats.totalDeaths,this.generationCount=n.stats.generationCount,this.frameCount=n.stats.frameCount),this.nextBotIdNum=this.microbots.length+1,this.nextFoodIdNum=this.energyParticles.length+1,console.log("Successfully imported ecosystem state")}catch(n){console.error("Failed to import state hash:",n)}}resize(t,n){this.width=Math.max(400,t),this.height=Math.max(400,n),this.spatialGrid=new Da(this.width,this.height,60),this.chemicalGrid=new Oa(this.width,this.height,20),this.pheromoneGrid=new zf(this.width,this.height,10),this.spatialHash=new za(80),this.generateBiomes()}spawnMicrobot(t,n){const r=`MB-${String(this.nextBotIdNum++).padStart(4,"0")}`;let i=Math.random()*(this.width-100)+50,o=Math.random()*(this.height-100)+50,l=2+(Math.random()-.5)*.5,u=.1+(Math.random()-.5)*.04,c=120+(Math.random()-.5)*30,h=100,m=1,S=185,y=1,C=null,M=Math.random()*.5,w=Math.random()>.8?1:0,F=Math.random()*.8+1,p=[{geneId:"SPEED_BOOST",activationLevel:0,heritability:.3,stressThreshold:8},{geneId:"VISION_BOOST",activationLevel:0,heritability:.2,stressThreshold:6}];if(t){i=t.x+(Math.random()-.5)*20,o=t.y+(Math.random()-.5)*20,y=t.generation+1,C=t.id,t.offspringCount++,n&&n.offspringCount++,y>this.generationCount&&(this.generationCount=y);const a=this.config.currentSeason==="AUTUMN"?1.5:1,I=this.config.mutationRate*a;l=be(Yt(t.speed+(Math.random()-.5)*I*1.5),1,5),u=be(Yt(t.turnRate+(Math.random()-.5)*I*.1),.04,.3),c=be(Yt(t.visionRadius+(Math.random()-.5)*I*50),60,260),m=be(Yt(t.energyEfficiency+(Math.random()-.5)*I*.4),.6,2.5),S=Yt((t.hue+(Math.random()-.5)*I*80+360)%360),M=be((t.armorGene||0)+(Math.random()-.5)*I*.2,0,.8),w=(t.inkGlandGene||0)>.5?Math.random()<I*2?0:1:Math.random()<I*2?1:0,F=be((t.panicGene||1)+(Math.random()-.5)*I*.5,1,2.5),t.epigenome&&(p=t.epigenome.map(T=>{const A=Math.random()<T.heritability;return{...T,activationLevel:A?T.activationLevel*.8:0}}))}const f=l>3.4&&m>1.4,x=f?"#f43f5e":`hsl(${Math.round(S)}, 95%, 55%)`,E={id:r,speciesId:(t==null?void 0:t.speciesId)||Rn.getInstance().getSpeciesId(),isHybrid:t&&n?Rn.getInstance().evaluateMatingCompatibility(t,n).isHybrid:!1,fertility:t&&n?Rn.getInstance().evaluateMatingCompatibility(t,n).fertilityFactor:(t==null?void 0:t.fertility)??1,x:i,y:o,vx:Math.cos(Math.random()*Math.PI*2)*l,vy:Math.sin(Math.random()*Math.PI*2)*l,heading:Math.random()*Math.PI*2,speed:l,maxSpeed:l,turnRate:u,visionRadius:c,battery:h,maxBattery:h,energyEfficiency:m,hue:S,color:x,generation:y,parentId:C,offspringCount:0,age:0,behaviorState:"WANDERING",energyCollected:0,isPredator:f,teleportCooldown:0,armorGene:M,inkGlandGene:w,inkCooldown:0,panicGene:F,panicTimer:0,trail:[],batteryHistory:new Array(30).fill(h),genome:{speedAllele:{geneId:"SPEED",baseValue:l,quantumVariance:2,state:"ENTANGLED",observationProbability:.5},visionAllele:{geneId:"VISION",baseValue:c,quantumVariance:50,state:"ENTANGLED",observationProbability:.5},efficiencyAllele:{geneId:"EFFICIENCY",baseValue:m,quantumVariance:.8,state:"ENTANGLED",observationProbability:.5},mutationTendency:{geneId:"MUTATION",baseValue:.1,quantumVariance:.1,state:"ENTANGLED",observationProbability:.5},adhesionGene:{geneId:"ADHESION",baseValue:Math.random()<.2?.8:.2,quantumVariance:.5,state:"ENTANGLED",observationProbability:.1}},epigenome:p};return Pn.getInstance().sanitizeMicrobotState(E,this.width,this.height),this.microbots.push(E),this.totalBirths++,this.recentBirths++,E}spawnMultipleBots(t){for(let n=0;n<t;n++)this.spawnMicrobot()}spawnFoodParticle(t="NUTRIENT_DOT",n,r){const i=n??Math.random()*(this.width-60)+30,o=r??Math.random()*(this.height-60)+30,l=t==="SUPER_CHARGER"?50:t==="MUTAGEN_ORB"?30:25,u=t==="SUPER_CHARGER"?5:t==="MUTAGEN_ORB"?6:3.5,c=t==="SUPER_CHARGER"?"#00E5FF":t==="MUTAGEN_ORB"?"#E040FB":"#00E676";this.energyParticles.push({id:`F-${this.nextFoodIdNum++}`,x:i,y:o,value:l,radius:u,type:t,color:c})}spawnFood(t,n,r){const i=t??Math.random()*(this.width-80)+40,o=n??Math.random()*(this.height-80)+40;let l=r||"NUTRIENT_DOT";if(!r){const S=Math.random();S<.78?l="NUTRIENT_DOT":S<.9?l="SUPER_CHARGER":l="MUTAGEN_ORB"}let u=25,c=4,h="#00E676";l==="SUPER_CHARGER"?(u=50,c=6,h="#00E5FF"):l==="MUTAGEN_ORB"&&(u=30,c=5,h="#E040FB");const m={id:`EP-${this.nextFoodIdNum++}`,x:i,y:o,value:u,radius:c,type:l,color:h};this.energyParticles.push(m)}spawnMultipleFood(t){for(let n=0;n<t;n++)this.spawnFood()}spawnHazard(t,n){const r=`HZ-${this.hazards.length+1}`,i=60+Math.random()*40,o=t??Math.random()*(this.width-i*2)+i,l=n??Math.random()*(this.height-i*2)+i,u=Math.random()*Math.PI*2;this.hazards.push({id:r,x:o,y:l,radius:i,damageRate:.8,vx:Math.cos(u)*1.5,vy:Math.sin(u)*1.5})}spawnSpeedField(t,n){const r=`SF-${this.nextFieldIdNum++}`;this.speedFields.push({id:r,x:t,y:n,radius:50,multiplier:1.8})}triggerMeteorStrike(t,n){const r=t??Math.random()*(this.width-200)+100,i=n??Math.random()*(this.height-200)+100;Le.playDisasterSound("METEOR"),this.meteors.push({id:`M-${Date.now()}`,x:r,y:i,radius:10,maxRadius:110,progress:0})}triggerVoidRift(t,n){const r=t??Math.random()*(this.width-200)+100,i=n??Math.random()*(this.height-200)+100;Le.playDisasterSound("VOID"),this.voidRifts.push({id:`VR-${Date.now()}`,x:r,y:i,radius:90,pullForce:2.8})}getElevation(t,n){return .5}spawnSpore(t,n){const r=t!==void 0?t:Math.random()*(this.width-60)+30,i=n!==void 0?n:Math.random()*(this.height-60)+30;this.spores||(this.spores=[]),this.spores.push({id:`SPORE-${Date.now()}-${Math.floor(Math.random()*1e3)}`,x:r,y:i,vx:(Math.random()-.5)*2,vy:(Math.random()-.5)*2,radius:3,hostId:null,life:1e3})}clearHazards(){this.hazards=[]}spawnPortalPair(){const t=`PORTAL-${Date.now()}-A`,n=`PORTAL-${Date.now()}-B`,r=Math.random()*(this.width/2-100)+50,i=Math.random()*(this.height-100)+50,o=Math.random()*(this.width/2-100)+(this.width/2+50),l=Math.random()*(this.height-100)+50;this.portals.push({id:t,x:r,y:i,radius:45,linkedId:n}),this.portals.push({id:n,x:o,y:l,radius:45,linkedId:t})}runBenchmark(){console.log("--- STARTING DIAGNOSTIC BENCHMARK ---"),this.resetSimulation(),this.config.isPaused=!1,this.spawnMultipleBots(3e3),this.spawnMultipleFood(200),this.updateHazardsCount(),setTimeout(()=>{console.log(`Benchmark Complete. Actual TPS: ${this.actualTPS.toFixed(1)}`),alert(`Diagnostic Benchmark Complete!
Average Simulation TPS with 3000 bots: ${this.actualTPS.toFixed(1)}`)},5e3)}updateHazardsCount(){for(;this.hazards.length<this.config.hazardCount;)this.spawnHazard();this.hazards.length>this.config.hazardCount&&(this.hazards=this.hazards.slice(0,this.config.hazardCount))}overrideMicrobotGenes(t,n){const r=this.microbots.find(i=>i.id===t);r&&(n.speed!==void 0&&(r.speed=n.speed),n.visionRadius!==void 0&&(r.visionRadius=n.visionRadius),n.energyEfficiency!==void 0&&(r.energyEfficiency=n.energyEfficiency),n.turnRate!==void 0&&(r.turnRate=n.turnRate),n.hue!==void 0&&(r.hue=n.hue,r.color=`hsl(${Math.round(n.hue)}, 95%, 55%)`),r.isPredator=r.speed>3.4&&r.energyEfficiency>1.4,r.isPredator&&(r.color="#f43f5e"))}triggerSolarFlare(){Le.playDisasterSound("FLARE"),this.activeDisasters.push({type:"SOLAR_FLARE",active:!0,intensity:1,durationLeft:200});for(let t=0;t<30;t++){const n=ei.acquire();n.x=this.width/2+(Math.random()-.5)*100,n.y=this.height/2+(Math.random()-.5)*100,n.vx=(Math.random()-.5)*25,n.vy=(Math.random()-.5)*25,n.life=100+Math.random()*50,n.color="#FFD700",this.disasterParticles.push(n)}}triggerRadiationStorm(){Le.playDisasterSound("STORM"),this.activeDisasters.push({type:"RADIATION_STORM",active:!0,intensity:.8,durationLeft:400});for(let t=0;t<30;t++){const n=ei.acquire();n.x=this.width/2+(Math.random()-.5)*100,n.y=this.height/2+(Math.random()-.5)*100,n.vx=(Math.random()-.5)*15,n.vy=(Math.random()-.5)*15,n.life=100+Math.random()*50,n.color="#39ff14",this.disasterParticles.push(n)}}triggerMagneticInversion(){Le.playDisasterSound("INVERSION"),this.activeDisasters.push({type:"MAGNETIC_INVERSION",active:!0,intensity:1,durationLeft:300});for(let t=0;t<40;t++){const n=ei.acquire();n.x=this.width/2,n.y=this.height/2,n.vx=(Math.random()-.5)*20,n.vy=(Math.random()-.5)*20,n.life=80+Math.random()*40,n.color="#9d00ff",this.disasterParticles.push(n)}}getLineageTree(t){const n=this.microbots.find(o=>o.id===t)||null;let r=null;n&&n.parentId&&(r=this.microbots.find(o=>o.id===n.parentId)||null);const i=n?this.microbots.filter(o=>o.parentId===n.id):[];return{parent:r,current:n,children:i}}selectRandomMicrobot(){if(this.microbots.length===0)return this.selectedMicrobotId=null,null;const t=Math.floor(Math.random()*this.microbots.length),n=this.microbots[t];return this.selectedMicrobotId=n.id,n}getSelectedMicrobot(){return this.selectedMicrobotId&&this.microbots.find(t=>t.id===this.selectedMicrobotId)||null}update(t=1){var p,f,x,E;if(this.config.isPaused)return;const n=performance.now(),r=n-this.lastFrameTime;this.actualTPS=r>0?1e3/r:0,this.lastFrameTime=n;const i=this.config.simSpeed*t;if(this.config.autoSeasonCycle&&(this.seasonFrameCount+=i,this.seasonFrameCount>=this.SEASON_DURATION_FRAMES)){this.seasonFrameCount=0;const a=["SPRING","SUMMER","AUTUMN","WINTER"],I=a.indexOf(this.config.currentSeason),T=a[(I+1)%a.length];this.config.currentSeason=T}if(this.config.autoDisastersEnabled&&(this.disasterTimer+=i,this.disasterTimer>=this.config.disasterScheduleInterval)){this.disasterTimer=0;const a=["SOLAR_FLARE","RADIATION_STORM","MAGNETIC_INVERSION"],I=a[Math.floor(Math.random()*a.length)];I==="SOLAR_FLARE"?this.triggerSolarFlare():I==="RADIATION_STORM"?this.triggerRadiationStorm():this.triggerMagneticInversion()}let o=1,l=1,u=1;this.config.currentSeason==="SPRING"?o=1.5:this.config.currentSeason==="SUMMER"?u=1.15:this.config.currentSeason==="AUTUMN"?o=.75:this.config.currentSeason==="WINTER"&&(o=.4,l=1.4);let c=1;if(this.config.weatherEvent==="SOLAR_FLARE")c=2.5;else if(this.config.weatherEvent==="RESOURCE_BLOOM")this.frameCount%8===0&&this.energyParticles.length<this.config.maxEnergyParticles*1.5&&this.spawnFood();else if(this.config.weatherEvent==="TOXIC_DRIFT")for(const a of this.hazards){const I=a.vx||1.2,T=a.vy||1.2;a.x+=I*i,a.y+=T*i,(a.x<a.radius||a.x>this.width-a.radius)&&(a.vx=-I),(a.y<a.radius||a.y>this.height-a.radius)&&(a.vy=-T)}for(let a=this.activeDisasters.length-1;a>=0;a--){const I=this.activeDisasters[a];I.durationLeft-=i,I.durationLeft<=0&&this.activeDisasters.splice(a,1)}const h=this.activeDisasters.some(a=>a.type==="RADIATION_STORM"),m=this.activeDisasters.some(a=>a.type==="MAGNETIC_INVERSION");this.frameCount%5===0&&(this.chemicalGrid.decay(.04*i),this.pheromoneGrid&&(this.pheromoneGrid.processEmitters(),this.pheromoneGrid.decay(.02*i)));for(let a=this.spores.length-1;a>=0;a--){const I=this.spores[a];if(I.life-=i,!I.hostId){I.x+=I.vx*i,I.y+=I.vy*i,I.x<0&&(I.x+=this.width),I.x>this.width&&(I.x-=this.width),I.y<0&&(I.y+=this.height),I.y>this.height&&(I.y-=this.height);for(const T of this.microbots)if(!T.isInfected&&!T.hasAntibodies){const A=Math.hypot(T.x-I.x,T.y-I.y);if(A<T.visionRadius*.5&&(I.vx+=(T.x-I.x)*.01,I.vy+=(T.y-I.y)*.01),A<15){I.hostId=T.id,T.isInfected=!0,T.infectionTimer=800;break}}}I.life<=0&&this.spores.splice(a,1)}this.spatialGrid.clear();const S=new Mn({x:0,y:0,width:this.width,height:this.height},8);for(const a of this.energyParticles)this.spatialGrid.insert(a),S.insert(a);const y=this.config.energySpawnRate*o;this.frameCount%Math.max(1,Math.floor(20/y))===0&&this.energyParticles.length<this.config.maxEnergyParticles&&this.spawnFood();const C=new Set,M=new Set;let w=0;for(const a of this.microbots){if(a.age+=i,w<1e3&&(this.positionsView[w*2]=a.x,this.positionsView[w*2+1]=a.y),w++,!a.isPredator&&a.speed>3.4&&a.energyEfficiency>1.4&&(a.isPredator=!0,a.color="#f43f5e"),a.teleportCooldown&&a.teleportCooldown>0)a.teleportCooldown-=i;else for(const g of this.portals)if(Math.hypot(a.x-g.x,a.y-g.y)<g.radius){const j=this.portals.find(W=>W.id===g.linkedId);if(j){a.x=j.x+(Math.random()-.5)*20,a.y=j.y+(Math.random()-.5)*20,a.teleportCooldown=60;break}}let I=a.speed*u;if(a.panicTimer&&a.panicTimer>0&&(I*=a.panicGene||1.5,a.panicTimer-=i),a.inkCooldown&&a.inkCooldown>0&&(a.inkCooldown-=i),a.behaviorState==="REPRODUCING"||a.battery>a.maxBattery*.8){const g=(Math.abs(a.vx)+Math.abs(a.vy))*.1;this.pheromoneGrid.addPheromone(a.x-a.vx,a.y-a.vy,g)}const T=this.getElevation(a.x,a.y),A=this.getElevation(a.x+1,a.y)-T,Q=this.getElevation(a.x,a.y+1)-T;a.vx-=A*15*i,a.vy-=Q*15*i;const L=.85+T*.1;a.vx*=L,a.vy*=L;const Y=this.getBiomeAt(a.x,a.y);if(Y){if(Y.type==="TOXIC_SLUDGE")I*=.6,a.battery-=.15*i;else if(Y.type==="CRYO_ZONE")I*=.4,a.battery-=.08*(1.5/a.energyEfficiency)*i;else if(Y.type==="HIGH_G_FIELD"){const g=Y.x+Y.width/2,P=Y.y+Y.height/2,j=Math.atan2(P-a.y,g-a.x),W=.5;a.vx+=Math.cos(j)*W*i,a.vy+=Math.sin(j)*W*i}}if(h&&(a.battery-=.1*i,Math.random()<.005*i&&(a.hue=(a.hue+Math.random()*40-20+360)%360,a.color=`hsl(${Math.round(a.hue)}, 95%, 55%)`)),(a.battery<a.maxBattery*.25||Y&&(Y.type==="TOXIC_SLUDGE"||Y.type==="CRYO_ZONE")||h)&&a.genome){const g=a.genome,P=[g.speedAllele,g.visionAllele,g.efficiencyAllele];for(const j of P)if(j.state==="ENTANGLED"||j.state==="DECAYING"){j.state="OBSERVED";const J=Math.random()<j.observationProbability?j.quantumVariance:-j.quantumVariance;j.geneId==="SPEED"?(a.speed=be(a.speed+J,1,5),a.maxSpeed=a.speed):j.geneId==="VISION"?a.visionRadius=be(a.visionRadius+J,40,260):j.geneId==="EFFICIENCY"&&(a.energyEfficiency=be(a.energyEfficiency+J,.4,3))}}m&&Math.random()<.05*i&&(a.heading+=Math.PI,a.vx=-a.vx,a.vy=-a.vy);for(const g of this.speedFields)Math.hypot(a.x-g.x,a.y-g.y)<g.radius&&(I*=g.multiplier);for(const g of this.fluidZones)if(Math.hypot(a.x-g.x,a.y-g.y)<g.radius)if(g.isNonNewtonian){const j=a.vx*a.vx+a.vy*a.vy,W=Math.max(.1,1-g.baseDrag*j*.05);a.vx*=W,a.vy*=W,I*=W}else a.vx*=g.baseDrag,a.vy*=g.baseDrag,I*=g.baseDrag;for(const g of this.gravityWells){const P=g.x-a.x,j=g.y-a.y,W=Math.hypot(P,j);if(W>0&&W<g.radius){const J=g.force*(1-W/g.radius);a.vx+=P/W*J*i,a.vy+=j/W*J*i}}for(const g of this.catalystZones)if(Math.hypot(a.x-g.x,a.y-g.y)<g.radius&&a.genome){const j=g.mutationDirection*.02*i;g.targetGene==="SPEED"?(a.genome.speedAllele.baseValue=be(a.genome.speedAllele.baseValue+j,1,5),a.speed=a.genome.speedAllele.baseValue,a.maxSpeed=a.speed):g.targetGene==="VISION"?(a.genome.visionAllele.baseValue=be(a.genome.visionAllele.baseValue+j*20,40,260),a.visionRadius=a.genome.visionAllele.baseValue):g.targetGene==="EFFICIENCY"&&(a.genome.efficiencyAllele.baseValue=be(a.genome.efficiencyAllele.baseValue+j*.5,.4,3),a.energyEfficiency=a.genome.efficiencyAllele.baseValue)}this.frameCount%15===0&&(a.trail.push({x:a.x,y:a.y}),a.trail.length>12&&a.trail.shift(),this.config.showPheromoneTrails&&this.chemicalGrid.addPheromone(a.x,a.y,.1*i));const z=this.spatialGrid.getNearby(a.x,a.y,a.visionRadius),V=Of(a,z,this.hazards,this.width,this.height,this.pheromoneGrid);if(a.behaviorState=V.state,a.behaviorState==="WANDERING"||a.behaviorState==="SEEKING_ENERGY"){const g=this.chemicalGrid.getPheromone(a.x+Math.cos(a.heading-.5)*15,a.y+Math.sin(a.heading-.5)*15),P=this.chemicalGrid.getPheromone(a.x+Math.cos(a.heading+.5)*15,a.y+Math.sin(a.heading+.5)*15),j=this.chemicalGrid.getPheromone(a.x+Math.cos(a.heading)*15,a.y+Math.sin(a.heading)*15);(g>0||P>0||j>0)&&(g>P&&g>j?V.desiredHeading-=.2:P>g&&P>j&&(V.desiredHeading+=.2))}if(a.isPredator){let g=null,P=a.visionRadius;for(const j of this.microbots)if(j.id!==a.id&&!j.isPredator){const W=Math.hypot(a.x-j.x,a.y-j.y);W<P&&(P=W,g=j)}if(g){a.behaviorState="HUNTING_PREY";const j=Math.atan2(g.y-a.y,g.x-a.x);if(V.desiredHeading=j,g.panicGene&&(!g.panicTimer||g.panicTimer<=0)&&(g.panicTimer=60,g.behaviorState="EVADING_HAZARD"),g.inkGlandGene&&g.inkGlandGene>.5&&(!g.inkCooldown||g.inkCooldown<=0)&&(g.inkCooldown=300,this.hazards.push({id:`INK-${Date.now()}`,x:g.x,y:g.y,radius:40,damageRate:.5,vx:0,vy:0})),P<16){const J=35*(g.armorGene?1-g.armorGene:1);a.battery=Math.min(a.maxBattery,a.battery+J),a.energyCollected+=J,g.battery-=J}}}let H=V.desiredHeading-a.heading;for(;H<-Math.PI;)H+=Math.PI*2;for(;H>Math.PI;)H-=Math.PI*2;if(a.heading+=be(H,-a.turnRate*i,a.turnRate*i),a.symbiontPartnerId){const g=this.microbots.find(P=>P.id===a.symbiontPartnerId);if(g&&Math.hypot(a.x-g.x,a.y-g.y)<100){const j=a.battery+g.battery;a.battery=j/2,g.battery=j/2,a.visionRadius=Math.max(a.visionRadius,g.visionRadius);const W=(a.vx+g.vx)/2,J=(a.vy+g.vy)/2;a.vx=W,a.vy=J,g.vx=W,g.vy=J,this.config.showPheromoneTrails&&this.chemicalGrid.addPheromone((a.x+g.x)/2,(a.y+g.y)/2,.2)}}a.isInfected&&(a.battery-=this.config.batteryDrainMultiplier*2*i,a.infectionTimer!==void 0&&(a.infectionTimer-=i,a.infectionTimer<=0&&(a.isInfected=!1,Math.random()>.5&&(a.hasAntibodies=!0,a.hue=130)))),a.vx=Math.cos(a.heading)*I,a.vy=Math.sin(a.heading)*I;const k=Lf(a.x,a.y,a.vx,a.vy,i,this.width,this.height,15,this.hazards);a.x=k.x,a.y=k.y,k.hitHazard&&(a.heading+=Math.PI),a.temperature=22+(this.config.weatherEvent==="SOLAR_FLARE"?18:0),this.config.weatherEvent==="TOXIC_DRIFT"&&(a.radiationExposure=(a.radiationExposure||0)+.1*i),a.battery<a.maxBattery*.3||a.radiationExposure&&a.radiationExposure>5?(a.epigeneticStress=(a.epigeneticStress||0)+.05*i,bn.getInstance().updateGlobalStress(Math.max(bn.getInstance().getGlobalStress(),a.epigeneticStress))):a.epigeneticStress=Math.max(0,(a.epigeneticStress||0)-.01*i),a.epigenome&&a.epigeneticStress&&a.epigeneticStress>0&&a.epigenome.forEach(g=>{a.epigeneticStress>g.stressThreshold&&g.activationLevel<1&&(g.activationLevel=Math.min(1,g.activationLevel+.02*i),g.geneId==="SPEED_BOOST"?a.speed=Math.min(a.maxSpeed*1.5,a.speed*(1+.01*g.activationLevel)):g.geneId==="VISION_BOOST"&&(a.visionRadius=Math.min(300,a.visionRadius*(1+.02*g.activationLevel))))});const d=Math.pow(a.speed,1.3)*(a.mass||1),b=a.nasBrain?a.nasBrain.passiveEnergyCost*.05:0,N=(.08*(d/(a.energyEfficiency||1))+b)*this.config.batteryDrainMultiplier*c*l*i;if(a.battery-=N,this.frameCount%10===0&&(a.batteryHistory||(a.batteryHistory=[]),a.batteryHistory.push(Math.max(0,a.battery)),a.batteryHistory.length>30&&a.batteryHistory.shift()),a.isParasite){for(const g of this.microbots)if(g.id!==a.id&&!g.isParasite&&Math.hypot(g.x-a.x,g.y-a.y)<18){const j=.5*i;g.battery=Math.max(0,g.battery-j),a.battery=Math.min(a.maxBattery,a.battery+j)}}for(const g of this.microbots)if(g.id!==a.id&&!a.isPredator&&!g.isPredator&&Math.hypot(g.x-a.x,g.y-a.y)<25&&Math.abs(a.hue-g.hue)<20){a.symbiontPartnerId=g.id;const j=(a.battery+g.battery)/2;a.battery=j,g.battery=j}for(const g of this.microbots)if(g.id!==a.id){const P=g.x-a.x,j=g.y-a.y,W=P*P+j*j;if(W<100&&W>0){const J=Math.sqrt(W),ne=P/J,v=j/J;if((p=a.genome)!=null&&p.adhesionGene&&((f=g.genome)!=null&&f.adhesionGene)&&a.genome.adhesionGene.baseValue>.6&&g.genome.adhesionGene.baseValue>.6)if(!a.clusterId&&!g.clusterId){const U=`C-${Date.now()}-${Math.floor(Math.random()*1e3)}`;a.clusterId=U,g.clusterId=U,a.boundTo=[g.id],g.boundTo=[a.id]}else a.clusterId&&!g.clusterId?(g.clusterId=a.clusterId,(x=a.boundTo)==null||x.push(g.id),g.boundTo=[a.id]):!a.clusterId&&g.clusterId&&(a.clusterId=g.clusterId,(E=g.boundTo)==null||E.push(a.id),a.boundTo=[g.id]);if(a.clusterId&&a.clusterId===g.clusterId){const Z=(10-J)*.1;a.x-=ne*Z,a.y-=v*Z,g.x+=ne*Z,g.y+=v*Z;continue}a.x-=ne*1.5,a.y-=v*1.5,g.x+=ne*1.5,g.y+=v*1.5;const X=a.vx-g.vx,D=a.vy-g.vy,_=2*(ne*X+v*D)/2;a.vx-=_*ne,a.vy-=_*v,g.vx+=_*ne,g.vy+=_*v}}if(a.isInfected)if(a.infectionTimer=(a.infectionTimer||0)+i,a.battery-=.1*i,a.behaviorState="INFECTED",a.infectionTimer>=300)a.isInfected=!1,a.hasAntibodies=!0;else for(const g of this.microbots)g.id!==a.id&&!g.isInfected&&!g.hasAntibodies&&Math.hypot(a.x-g.x,a.y-g.y)<20&&Math.random()<.35&&(g.isInfected=!0,g.infectionTimer=0);if(a.battery<=0){M.add(a.id),this.totalDeaths++,this.recentDeaths++;continue}for(const g of z){if(C.has(g.id))continue;const P=Math.hypot(a.x-g.x,a.y-g.y);if(P<12&&(P<10+g.radius&&(a.battery=Math.min(a.maxBattery,a.battery+g.value*a.energyEfficiency),a.energyCollected+=g.value,Le.playFeedSound(440+a.hue%300)),g.type==="MUTAGEN_ORB"&&(a.speed=Math.max(1,Math.min(5,a.speed+(Math.random()-.5)*1.2)),a.visionRadius=Math.max(60,Math.min(260,a.visionRadius+(Math.random()-.5)*40)),a.energyEfficiency=Math.max(.6,Math.min(2.5,a.energyEfficiency+(Math.random()-.5)*.5))),a.battery>=a.maxBattery*.95&&this.microbots.length<this.config.maxPopulation)){let j=!1;const W=[],J=a.visionRadius*a.visionRadius;for(const ne of this.microbots)if(ne.id!==a.id){const v=ne.x-a.x,X=ne.y-a.y;v*v+X*X<=J&&W.push(ne)}for(const ne of W)if(ne.battery>=ne.maxBattery*.8&&Rn.getInstance().evaluateMatingCompatibility(a,ne).compatible){a.battery-=45,ne.battery-=45,a.behaviorState="REPRODUCING",ne.behaviorState="REPRODUCING",this.spawnMicrobot(a,ne),j=!0;break}j||(a.battery-=45,a.behaviorState="REPRODUCING",this.spawnMicrobot(a))}}}C.size>0&&(this.energyParticles=this.energyParticles.filter(a=>!C.has(a.id))),M.size>0&&(this.microbots=this.microbots.filter(a=>!M.has(a.id)));const F=new Map;for(const a of this.microbots)a.clusterId&&(F.has(a.clusterId)||F.set(a.clusterId,[]),F.get(a.clusterId).push(a));for(F.forEach(a=>{if(a.length<2)return;let I=0,T=0,A=0;a.forEach(ee=>{I+=ee.vx,T+=ee.vy,A+=ee.battery});const Q=I/a.length,L=T/a.length,Y=A/a.length;a.forEach(ee=>{ee.vx=Q,ee.vy=L,ee.battery=Y})});this.microbots.length<12;)this.spawnMicrobot();for(let a=this.disasterParticles.length-1;a>=0;a--){const I=this.disasterParticles[a];I.x+=I.vx*i,I.y+=I.vy*i,I.life-=2*i,I.life<=0&&(ei.release(I),this.disasterParticles.splice(a,1))}if(this.frameCount%30===0&&this.updateTelemetryBuffers(),this.frameCount%60===0&&this.recordHistorySnapshot(),this.frameCount%180===0&&this.biomes.length>0&&this.microbots.length>0){const a=this.microbots[Math.floor(Math.random()*this.microbots.length)],I=this.getBiomeAt(a.x,a.y);I&&Le.playBiomeHum(I.type)}}updateTelemetryBuffers(){bn.getInstance().recordStressFrame(),this.populationHistory.push(this.microbots.length),this.populationHistory.length>30&&this.populationHistory.shift(),this.birthHistory.push(this.recentBirths),this.birthHistory.length>30&&this.birthHistory.shift(),this.deathHistory.push(this.recentDeaths),this.deathHistory.length>30&&this.deathHistory.shift(),this.recentBirths=0,this.recentDeaths=0}recordHistorySnapshot(){const t=this.getStats();this.historyTimeline.push({time:Math.floor(this.frameCount/60),population:t.currentPopulation,avgSpeed:t.avgSpeed,avgVision:t.avgVision,diversity:t.shannonDiversityIndex}),this.historyTimeline.length>60&&this.historyTimeline.shift()}triggerOutbreak(){if(Le.playDisasterSound("VIRUS"),this.microbots.length===0)return;const t=Math.floor(Math.random()*this.microbots.length);this.microbots[t].isInfected=!0,this.microbots[t].infectionTimer=0}getStats(){const t=this.microbots.length;let n=0,r=0,i=0,o=0,l=0;const u=new Array(10).fill(0),c=new Array(10).fill(0),h=new Array(10).fill(0),m=new Array(12).fill(0),S={NORMAL:0,TOXIC_SLUDGE:0,CRYO_ZONE:0,HIGH_G_FIELD:0};for(const w of this.microbots){n+=w.speed,r+=w.visionRadius,i+=w.energyEfficiency,w.isPredator&&o++,w.isInfected&&l++;const F=Math.max(0,Math.min(9,Math.floor((w.speed-1)/4*10)));u[F]++;const p=Math.max(0,Math.min(9,Math.floor((w.visionRadius-60)/200*10)));c[p]++;const f=Math.max(0,Math.min(9,Math.floor((w.energyEfficiency-.6)/1.9*10)));h[f]++;const x=Math.max(0,Math.min(11,Math.floor(w.hue/360*12)));m[x]++;const E=this.getBiomeAt(w.x,w.y);E&&S[E.type]!==void 0?S[E.type]++:S.NORMAL++}let y=0;if(t>0){for(const w of m)if(w>0){const F=w/t;y-=F*Math.log(F)}}this.speciationDiversityBuffer[this.speciationDiversityIndex]=y,this.speciationDiversityIndex=(this.speciationDiversityIndex+1)%100;const C=new Float32Array(100);for(let w=0;w<100;w++){const F=(this.speciationDiversityIndex+w)%100;C[w]=this.speciationDiversityBuffer[F]}const M=Math.min(100,Math.floor(this.seasonFrameCount/this.SEASON_DURATION_FRAMES*100));return{currentPopulation:t,generationCount:this.generationCount,energyParticleCount:this.energyParticles.length,avgSpeed:t>0?n/t:0,avgVision:t>0?r/t:0,avgEfficiency:t>0?i/t:0,totalBirths:this.totalBirths,totalDeaths:this.totalDeaths,predatorCount:o,infectedCount:l,shannonDiversityIndex:parseFloat(y.toFixed(2)),currentSeason:this.config.currentSeason,seasonProgressPct:M,actualTPS:this.actualTPS,populationHistory:[...this.populationHistory],birthHistory:[...this.birthHistory],deathHistory:[...this.deathHistory],stressHistory:bn.getInstance().getStressHistory(),speedHistogram:u,visionHistogram:c,efficiencyHistogram:h,diversityBuckets:m,biomePopulation:S,historyTimeline:this.historyTimeline,speciationDiversityRingBuffer:C}}}const ed="microbot_evolution_lab_config",ti={startPopulation:45,maxPopulation:250,mutationRate:.15,energySpawnRate:4,maxEnergyParticles:120,hazardCount:3,batteryDrainMultiplier:1,simSpeed:1,targetFPS:60,isPaused:!1,showSensoryRings:!0,showMovementTrails:!0,showTargetVectors:!0,showEnergyForceLines:!0,showSensoryRaycasts:!0,showPheromoneTrails:!0,isSplitView:!1,weatherEvent:"CLEAR",brushMode:"NONE",heatmapMode:"OFF",currentSeason:"SPRING",autoSeasonCycle:!1,enableFrameInterpolation:!0,headlessMode:!1,showTerrainContour:!1,autoDisastersEnabled:!1,disasterScheduleInterval:3600};function Xf(){try{const e=localStorage.getItem(ed);if(e){const t=JSON.parse(e),n={...ti};for(const r in t)r in ti&&typeof t[r]==typeof ti[r]&&(n[r]=t[r]);return n.isPaused=!1,n}}catch(e){console.error("Failed to load config from storage:",e)}return{...ti}}function Yf(e){try{localStorage.setItem(ed,JSON.stringify(e))}catch(t){console.error("Failed to save config to storage:",t)}}/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var Jf={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $f=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),K=(e,t)=>{const n=O.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:u="",children:c,...h},m)=>O.createElement("svg",{ref:m,...Jf,width:i,height:i,stroke:r,strokeWidth:l?Number(o)*24/Number(i):o,className:["lucide",`lucide-${$f(e)}`,u].join(" "),...h},[...t.map(([S,y])=>O.createElement(S,y)),...Array.isArray(c)?c:[c]]));return n.displayName=`${e}`,n};/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Cl=K("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const td=K("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kf=K("AlertOctagon",[["polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2",key:"h1p8hx"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const or=K("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qf=K("Award",[["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}],["path",{d:"M15.477 12.89 17 22l-5-3-5 3 1.523-9.11",key:"em7aur"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const e0=K("BatteryCharging",[["path",{d:"M15 7h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1sdynx"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1",key:"1gkd3k"}],["path",{d:"m11 7-3 5h4l-3 5",key:"b4a64w"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const t0=K("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ni=K("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ri=K("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const n0=K("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const r0=K("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const i0=K("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vt=K("Dna",[["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m17 6-2.5-2.5",key:"5cdfhj"}],["path",{d:"m14 8-1-1",key:"15nbz5"}],["path",{d:"m7 18 2.5 2.5",key:"16tu1a"}],["path",{d:"m3.5 14.5.5.5",key:"hapbhd"}],["path",{d:"m20 9 .5.5",key:"1n7z02"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m10 16 1.5 1.5",key:"11lckj"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ms=K("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const o0=K("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nd=K("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rd=K("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const s0=K("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const l0=K("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const a0=K("MousePointerClick",[["path",{d:"m9 9 5 12 1.8-5.2L21 14Z",key:"1b76lo"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const u0=K("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const c0=K("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Rs=K("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const d0=K("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const h0=K("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const f0=K("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const El=K("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const p0=K("Skull",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["path",{d:"M8 20v2h8v-2",key:"ded4og"}],["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M16 20a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20",key:"xq9p5u"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const g0=K("Sliders",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const id=K("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const m0=K("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kl=K("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const y0=K("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const x0=K("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v0=K("Wind",[["path",{d:"M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2",key:"1k4u03"}],["path",{d:"M9.6 4.6A2 2 0 1 1 11 8H2",key:"b7d0fd"}],["path",{d:"M12.6 19.4A2 2 0 1 0 14 16H2",key:"1p5cb3"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wt=K("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ml=K("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),S0=As.memo(({buckets:e,shannonIndex:t=1.8})=>{const n=O.useMemo(()=>Math.max(1,...e),[e]),r=t<.8;return s.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.85)",border:r?"1px solid #f43f5e":"1px solid rgba(0, 229, 255, 0.3)",borderRadius:12,padding:"8px 12px",backdropFilter:"blur(12px)",boxShadow:r?"0 0 15px rgba(244, 63, 94, 0.4)":"0 6px 20px rgba(0,0,0,0.4)",width:175},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4},children:[s.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.62rem",fontWeight:800,color:r?"#f43f5e":"#ffffff",letterSpacing:"0.05em",display:"flex",alignItems:"center",gap:4},children:[r&&s.jsx(td,{style:{width:10,height:10,color:"#f43f5e"}}),"GENETIC DIVERSITY"]}),s.jsxs("span",{style:{fontSize:"0.62rem",fontFamily:"'JetBrains Mono', monospace",color:r?"#f43f5e":"#00E5FF",fontWeight:800},children:["H: ",t.toFixed(2)]})]}),s.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:24,paddingTop:2},children:e.map((i,o)=>{const l=i/n*100,u=Math.round(o/e.length*360);return s.jsx("div",{title:`Group ${o+1}: ${i} bots`,style:{flex:1,height:`${Math.max(15,l)}%`,backgroundColor:`hsl(${u}, 90%, 60%)`,borderRadius:"2px 2px 0 0",transition:"height 0.2s ease",boxShadow:`0 0 4px hsl(${u}, 90%, 60%)`}},o)})})]})}),w0=({config:e,stats:t,onUpdateConfig:n,onReset:r,onStep:i,onOpenRosterMenu:o,onOpenGuide:l,onOpenBlueprintStudio:u,onSpawnFood:c,onSpawnBots:h,onSpawnHazard:m,onTriggerMeteor:S,onTriggerVoidRift:y,onTriggerOutbreak:C,onTriggerRadiationStorm:M,onTriggerMagneticInversion:w,onTriggerSolarFlare:F,onTriggerPortal:p,onExportTelemetryCSV:f,onExportConfigJSON:x,onImportConfigJSON:E})=>{const a=O.useRef(null),I=A=>{var Y;const Q=(Y=A.target.files)==null?void 0:Y[0];if(!Q)return;const L=new FileReader;L.onload=ee=>{var z;try{const V=JSON.parse((z=ee.target)==null?void 0:z.result);E(V)}catch{alert("Invalid JSON preset file!")}},L.readAsText(Q)},T={SPRING:"🌸 Spring",SUMMER:"☀️ Summer",AUTUMN:"🍂 Autumn",WINTER:"❄️ Winter"};return s.jsxs("header",{className:"top-nav-bar",children:[s.jsxs("div",{className:"brand-badge",children:[s.jsx("div",{className:"brand-icon-box",children:s.jsx(r0,{style:{width:22,height:22}})}),s.jsxs("div",{children:[s.jsxs("h1",{className:"brand-title",children:["MICROBOT ",s.jsx("span",{children:"EVOLUTION LAB"})]}),s.jsx("p",{className:"brand-sub",children:"2D Autonomous Artificial Life & Genetic Evolution Engine"})]})]}),s.jsxs("div",{className:"glass-deck-pill",children:[s.jsx("button",{onClick:()=>n({isPaused:!e.isPaused}),className:e.isPaused?"btn-holo btn-holo-green":"btn-holo btn-holo-orange",children:e.isPaused?s.jsxs(s.Fragment,{children:[s.jsx(c0,{style:{width:13,height:13,fill:"currentColor"}}),s.jsx("span",{children:"RESUME"})]}):s.jsxs(s.Fragment,{children:[s.jsx(u0,{style:{width:13,height:13,fill:"currentColor"}}),s.jsx("span",{children:"PAUSE"})]})}),s.jsx("button",{onClick:i,disabled:!e.isPaused,className:"btn-holo btn-holo-dark",style:{opacity:e.isPaused?1:.4},children:"STEP"}),s.jsxs("button",{onClick:r,className:"btn-holo btn-holo-dark",children:[s.jsx(h0,{style:{width:12,height:12}}),s.jsx("span",{children:"RESET"})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginLeft:6,fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E5FF"},children:[s.jsx("span",{style:{fontWeight:800,color:"#ffffff"},children:"SPEED:"}),s.jsx("input",{type:"range",min:"0.01",max:"5.0",step:"0.05",value:e.simSpeed,onChange:A=>n({simSpeed:parseFloat(A.target.value)}),style:{width:70,height:4}}),s.jsxs("span",{style:{fontWeight:800,width:64},children:[e.simSpeed.toFixed(2),"x (",t.actualTPS?t.actualTPS.toFixed(0):0," TPS)"]})]}),s.jsx("div",{style:{display:"flex",alignItems:"center",gap:4,marginLeft:4},children:s.jsxs("select",{value:e.targetFPS||60,onChange:A=>n({targetFPS:parseInt(A.target.value,10)}),style:{background:"#080E14",color:"#00E5FF",fontWeight:800,border:"1px solid rgba(0, 229, 255, 0.4)",borderRadius:6,padding:"2px 4px",fontSize:"0.65rem",cursor:"pointer"},children:[s.jsx("option",{value:"30",children:"30 FPS"}),s.jsx("option",{value:"60",children:"60 FPS"}),s.jsx("option",{value:"120",children:"120 FPS"}),s.jsx("option",{value:"240",children:"MAX FPS"})]})})]}),s.jsxs("div",{className:"glass-deck-pill",children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E676"},children:[s.jsx(v0,{style:{width:12,height:12}}),s.jsxs("select",{value:e.currentSeason||"SPRING",onChange:A=>n({currentSeason:A.target.value}),style:{background:"#080E14",color:"#00E676",fontWeight:800,border:"1px solid rgba(0, 230, 118, 0.4)",borderRadius:6,padding:"3px 6px",fontSize:"0.68rem",cursor:"pointer"},children:[s.jsx("option",{value:"SPRING",children:T.SPRING}),s.jsx("option",{value:"SUMMER",children:T.SUMMER}),s.jsx("option",{value:"AUTUMN",children:T.AUTUMN}),s.jsx("option",{value:"WINTER",children:T.WINTER})]}),s.jsxs("span",{style:{color:"#8B949E",fontSize:"0.62rem"},children:["(",t.seasonProgressPct||0,"%)"]})]}),s.jsxs("button",{onClick:()=>n({showPheromoneTrails:!e.showPheromoneTrails}),className:e.showPheromoneTrails?"btn-holo btn-holo-magenta":"btn-holo btn-holo-dark",style:{fontSize:"0.68rem",padding:"4px 8px"},children:[s.jsx(id,{style:{width:12,height:12}}),s.jsx("span",{children:"PHEROMONES"})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[s.jsx("button",{onClick:()=>Le.toggleMute(),className:Le.getMuted()?"btn-holo btn-holo-dark":"btn-holo btn-holo-cyan",style:{fontSize:"0.68rem",padding:"4px 8px"},title:"Toggle Procedural Spatial Audio",children:s.jsx("span",{children:Le.getMuted()?"🔇 MUTED":"🔊 AUDIO"})}),s.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",defaultValue:.3,onChange:A=>Le.setVolume(parseFloat(A.target.value)),style:{width:50,height:3,accentColor:"#00E5FF"},title:"Master Volume"})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#FF6B00"},children:[s.jsx(m0,{style:{width:12,height:12}}),s.jsxs("select",{value:e.weatherEvent||"CLEAR",onChange:A=>n({weatherEvent:A.target.value}),style:{background:"#080E14",color:"#FF6B00",fontWeight:800,border:"1px solid rgba(255, 107, 0, 0.4)",borderRadius:6,padding:"3px 6px",fontSize:"0.68rem",cursor:"pointer"},children:[s.jsx("option",{value:"CLEAR",children:"☀️ Weather: Clear"}),s.jsx("option",{value:"SOLAR_FLARE",children:"🔥 Solar Flare (+Drain)"}),s.jsx("option",{value:"TOXIC_DRIFT",children:"☣️ Toxic Drift (Hazards)"}),s.jsx("option",{value:"RESOURCE_BLOOM",children:"🌸 Resource Bloom (Food)"})]})]})]}),s.jsxs("div",{className:"glass-deck-pill",children:[s.jsx("button",{onClick:()=>n({autoDisastersEnabled:!e.autoDisastersEnabled}),className:e.autoDisastersEnabled?"btn-holo btn-holo-orange":"btn-holo btn-holo-dark",style:{fontSize:"0.65rem"},title:"Toggle Automated Periodic Disasters",children:s.jsx("span",{children:e.autoDisastersEnabled?"🔥 AUTO-DISASTERS ON":"🔥 AUTO-DISASTERS OFF"})}),s.jsx("button",{onClick:x,className:"btn-holo btn-holo-cyan",title:"Save preset .json",children:s.jsx(Ms,{style:{width:12,height:12}})}),s.jsx("button",{onClick:()=>{var A;return(A=a.current)==null?void 0:A.click()},className:"btn-holo btn-holo-cyan",title:"Load preset .json",children:s.jsx(y0,{style:{width:12,height:12}})}),s.jsx("input",{ref:a,type:"file",accept:".json",onChange:I,style:{display:"none"}}),s.jsxs("button",{onClick:f,className:"btn-holo btn-holo-green",title:"Export CSV Data",children:[s.jsx(Ms,{style:{width:12,height:12}}),s.jsx("span",{children:"CSV"})]}),s.jsxs("button",{onClick:u,className:"btn-holo btn-holo-cyan",children:[s.jsx(Vt,{style:{width:13,height:13}}),s.jsx("span",{children:"BLUEPRINT STUDIO"})]}),s.jsx("button",{onClick:l,className:"btn-holo btn-holo-cyan",children:s.jsx(s0,{style:{width:13,height:13}})}),s.jsxs("button",{onClick:o,className:"btn-holo btn-holo-magenta",children:[s.jsx(kl,{style:{width:13,height:13}}),s.jsx("span",{children:"ROSTER"})]}),s.jsxs("button",{onClick:c,className:"btn-holo btn-holo-green",children:[s.jsx(Rs,{style:{width:13,height:13}}),s.jsx("span",{children:"+20 FOOD"})]}),s.jsxs("button",{onClick:h,className:"btn-holo btn-holo-cyan",children:[s.jsx(Rs,{style:{width:13,height:13}}),s.jsx("span",{children:"+10 BOTS"})]}),s.jsxs("button",{onClick:m,className:"btn-holo btn-holo-orange",children:[s.jsx(El,{style:{width:13,height:13}}),s.jsx("span",{children:"+HAZARD"})]}),s.jsx("button",{onClick:S,className:"btn-holo btn-holo-orange",title:"Invoke Meteor Strike",children:s.jsx("span",{children:"☄️ METEOR"})}),s.jsx("button",{onClick:p,className:"btn-holo btn-holo-magenta",title:"Spawn Linked Portals",children:s.jsx("span",{children:"🌀 PORTAL"})}),s.jsx("button",{onClick:y,className:"btn-holo btn-holo-magenta",title:"Invoke Gravitational Void Rift",children:s.jsx("span",{children:"🌌 RIFT"})}),s.jsx("button",{onClick:C,className:"btn-holo btn-holo-green",title:"Inject Viral Outbreak",children:s.jsx("span",{children:"☣️ VIRUS"})}),s.jsx("button",{onClick:M,className:"btn-holo btn-holo-orange",title:"Trigger Radiation Storm",children:s.jsx("span",{children:"☢️ STORM"})}),s.jsx("button",{onClick:F,className:"btn-holo btn-holo-orange",title:"Trigger Solar Flare",children:s.jsx("span",{children:"☀️ FLARE"})}),s.jsx("button",{onClick:w,className:"btn-holo btn-holo-magenta",title:"Trigger Magnetic Inversion",children:s.jsx("span",{children:"🧲 INVERT"})})]}),s.jsx(S0,{buckets:t.diversityBuckets||new Array(12).fill(1),shannonIndex:t.shannonDiversityIndex})]})};function I0(e){const t={timestamp:new Date().toISOString(),generation:e.generationCount,speciationThreshold:.4,hybridInfertilityPenalty:1,pheromoneGrid:e.pheromoneGrid?{cols:e.pheromoneGrid.cols,rows:e.pheromoneGrid.rows,bufferLength:e.pheromoneGrid.buffer.length}:null,species:[]},n=new Map;for(const l of e.microbots)l.speciesId&&n.set(l.speciesId,(n.get(l.speciesId)||0)+1);n.forEach((l,u)=>{t.species.push({speciesId:u,population:l})});const r=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=`microbot_speciation_profile_gen${e.generationCount}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}const C0=({config:e,engine:t,onUpdateConfig:n,onExportStateSync:r,onImportStateSync:i,onRunBenchmark:o,onSpawnSpore:l,onExportRunData:u,onExportEpigenetics:c})=>{const[h,m]=O.useState("all");return s.jsxs("div",{className:"glass-panel",style:{padding:"12px 14px"},children:[s.jsxs("div",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.85rem",fontWeight:800,color:"#ffffff",letterSpacing:"0.05em",marginBottom:10,display:"flex",alignItems:"center",gap:6},children:[s.jsx("span",{style:{color:"#00E5FF"},children:"●"})," PARAMETERS & CONTROLS",s.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:6},children:[s.jsx("span",{style:{fontSize:"0.6rem",padding:"2px 6px",borderRadius:4,background:"rgba(244, 63, 94, 0.2)",border:"1px solid rgba(244, 63, 94, 0.4)",color:"#F43F5E",fontWeight:800},children:"🔥 CATACLYSM READY"}),s.jsx("span",{style:{fontSize:"0.6rem",padding:"2px 6px",borderRadius:4,background:"rgba(59, 130, 246, 0.2)",border:"1px solid rgba(59, 130, 246, 0.4)",color:"#3B82F6",fontWeight:800},children:"🌤️ CLIMATE & IMMUNITY"}),s.jsxs("select",{value:e.targetFPS||60,onChange:S=>n({targetFPS:parseInt(S.target.value,10)}),style:{background:"#080E14",color:"#00E676",fontWeight:800,border:"1px solid rgba(0, 230, 118, 0.4)",borderRadius:6,padding:"2px 6px",fontSize:"0.62rem",cursor:"pointer"},children:[s.jsx("option",{value:"60",children:"60 FPS (Smooth)"}),s.jsx("option",{value:"30",children:"30 FPS (Balanced)"}),s.jsx("option",{value:"15",children:"15 FPS (Battery Saver)"})]}),s.jsx("span",{style:{fontSize:"0.62rem",color:"#00E676"},children:"⚡ WORKER ON"}),s.jsx("button",{onClick:()=>alert("WASM SIMD Spatial Hashing Engine Active (64KB Shared Memory)"),className:"btn-holo btn-holo-cyan",style:{fontSize:"0.62rem",padding:"2px 6px",display:"flex",alignItems:"center",gap:4},children:"⚡ WASM GRID ON"}),s.jsx("span",{style:{fontSize:"0.62rem",color:"#00E676",border:"1px solid rgba(0,230,118,0.4)",borderRadius:6,padding:"2px 6px",background:"#080E14"},children:"🌿 BIOMES ON"})]})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.6)",borderRadius:10,border:"1px solid rgba(0, 229, 255, 0.2)",padding:"8px 10px"},children:[s.jsxs("div",{className:"accordion-header",onClick:()=>m(h==="pop"?"all":"pop"),style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[s.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#00E5FF",display:"flex",alignItems:"center",gap:6},children:[s.jsx(x0,{style:{width:13,height:13}})," Population Dynamics"]}),h==="pop"||h==="all"?s.jsx(ri,{style:{width:14,height:14,color:"#8B949E"}}):s.jsx(ni,{style:{width:14,height:14,color:"#8B949E"}})]}),(h==="pop"||h==="all")&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,overflow:"hidden",transition:"max-height 0.3s ease, opacity 0.3s ease",maxHeight:600,opacity:1},children:[s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Start Pop"}),s.jsx("span",{style:{color:"#00E5FF",fontWeight:700},children:e.startPopulation})]}),s.jsx("input",{type:"range",min:"10",max:"150",step:"5",value:e.startPopulation,onChange:S=>n({startPopulation:parseInt(S.target.value,10)}),style:{width:"100%",height:4}})]}),s.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:s.jsx("path",{d:"M 0 14 L 10 10 L 20 12 L 30 6 L 40 4 L 50 8",fill:"none",stroke:"#00E5FF",strokeWidth:"1.5"})})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Max Population"}),s.jsx("span",{style:{color:"#00E5FF",fontWeight:700},children:e.maxPopulation})]}),s.jsx("input",{type:"range",min:"50",max:"400",step:"10",value:e.maxPopulation,onChange:S=>n({maxPopulation:parseInt(S.target.value,10)}),style:{width:"100%",height:4}})]}),s.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:s.jsx("path",{d:"M 0 12 L 12 14 L 25 8 L 38 4 L 50 2",fill:"none",stroke:"#00E676",strokeWidth:"1.5"})})]})]})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.6)",borderRadius:10,border:"1px solid rgba(224, 64, 251, 0.2)",padding:"8px 10px"},children:[s.jsxs("div",{className:"accordion-header",onClick:()=>m(h==="gen"?"all":"gen"),style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[s.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#E040FB",display:"flex",alignItems:"center",gap:6},children:[s.jsx(Vt,{style:{width:13,height:13}})," Genetic Dynamics"]}),h==="gen"||h==="all"?s.jsx(ri,{style:{width:14,height:14,color:"#8B949E"}}):s.jsx(ni,{style:{width:14,height:14,color:"#8B949E"}})]}),(h==="gen"||h==="all")&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Mutation Tendency"}),s.jsxs("span",{style:{color:"#E040FB",fontWeight:800},children:[(e.mutationRate*100).toFixed(0),"%"]})]}),s.jsx("input",{type:"range",min:"0.01",max:"0.50",step:"0.01",value:e.mutationRate,onChange:S=>n({mutationRate:parseFloat(S.target.value)}),style:{width:"100%",height:4,marginTop:4}})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Symbiosis & Parasitism"}),s.jsx("span",{style:{color:"#00E5FF",fontWeight:800},children:"ENABLED"})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Battery Drain Rate"}),s.jsxs("span",{style:{color:"#E040FB",fontWeight:700},children:[e.batteryDrainMultiplier.toFixed(1),"x"]})]}),s.jsx("input",{type:"range",min:"0.2",max:"3.0",step:"0.1",value:e.batteryDrainMultiplier,onChange:S=>{const y=parseFloat(S.target.value);n({batteryDrainMultiplier:isNaN(y)?1:Math.max(.1,Math.min(5,y))})},style:{width:"100%",height:4}})]}),s.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:s.jsx("path",{d:"M 0 14 L 12 10 L 25 12 L 38 6 L 50 4",fill:"none",stroke:"#E040FB",strokeWidth:"1.5"})})]})]})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.6)",borderRadius:10,border:"1px solid rgba(255, 107, 0, 0.2)",padding:"8px 10px"},children:[s.jsxs("div",{className:"accordion-header",onClick:()=>m(h==="env"?"all":"env"),style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[s.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#FF6B00",display:"flex",alignItems:"center",gap:6},children:[s.jsx(El,{style:{width:13,height:13}})," Environmental Forces"]}),h==="env"||h==="all"?s.jsx(ri,{style:{width:14,height:14,color:"#8B949E"}}):s.jsx(ni,{style:{width:14,height:14,color:"#8B949E"}})]}),(h==="env"||h==="all")&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Energy Spawn Rate"}),s.jsxs("span",{style:{color:"#FF6B00",fontWeight:700},children:[e.energySpawnRate.toFixed(1),"/s"]})]}),s.jsx("input",{type:"range",min:"0.5",max:"12.0",step:"0.5",value:e.energySpawnRate,onChange:S=>{const y=parseFloat(S.target.value);n({energySpawnRate:isNaN(y)?5:Math.max(.1,Math.min(20,y))})},style:{width:"100%",height:4}})]}),s.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:s.jsx("path",{d:"M 0 12 L 15 14 L 30 6 L 50 2",fill:"none",stroke:"#FF6B00",strokeWidth:"1.5"})})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Hazard Zones"}),s.jsx("span",{style:{color:"#FF6B00",fontWeight:700},children:e.hazardCount})]}),s.jsx("input",{type:"range",min:"0",max:"12",step:"1",value:e.hazardCount,onChange:S=>n({hazardCount:parseInt(S.target.value,10)}),style:{width:"100%",height:4}})]}),s.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:s.jsx("path",{d:"M 0 14 L 10 10 L 20 12 L 30 4 L 40 10 L 50 6",fill:"none",stroke:"#FF6B00",strokeWidth:"1.5"})})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginTop:8},children:[s.jsx("span",{children:"Show Terrain Contour"}),s.jsx("button",{onClick:()=>n({showTerrainContour:!e.showTerrainContour}),className:e.showTerrainContour?"btn-holo btn-holo-cyan":"btn-holo btn-holo-dark",style:{padding:"2px 8px"},children:e.showTerrainContour?"ON":"OFF"})]})]})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.6)",borderRadius:10,border:"1px solid rgba(0, 150, 255, 0.2)",padding:"8px 10px"},children:[s.jsxs("div",{className:"accordion-header",onClick:()=>m(h==="sync"?"all":"sync"),style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[s.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#0096FF",display:"flex",alignItems:"center",gap:6},children:[s.jsx(n0,{style:{width:13,height:13}})," Ecosystem Sync"]}),h==="sync"||h==="all"?s.jsx(ri,{style:{width:14,height:14,color:"#8B949E"}}):s.jsx(ni,{style:{width:14,height:14,color:"#8B949E"}})]}),(h==="sync"||h==="all")&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{className:"btn-holo btn-holo-cyan",style:{flex:1,justifyContent:"center",fontSize:"0.65rem"},onClick:r,children:"Export State"}),s.jsx("button",{className:"btn-holo btn-holo-magenta",style:{flex:1,justifyContent:"center",fontSize:"0.65rem"},onClick:i,children:"Import State"})]}),s.jsx("button",{className:"btn-holo btn-holo-orange",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem"},onClick:o,children:"Run Diagnostic Benchmark (3000 bots)"}),l&&s.jsx("button",{className:"btn-holo btn-holo-magenta",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem"},onClick:l,children:"Spawn Parasitic Spores"}),u&&s.jsx("button",{className:"btn-holo btn-holo-cyan",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem"},onClick:u,children:"Export Full Run Data (JSON)"}),c&&s.jsx("button",{className:"btn-holo btn-holo-magenta",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem"},onClick:c,children:"Export Epigenetic Profiles (JSON)"}),s.jsxs("button",{onClick:()=>I0(t),className:"btn-holo btn-holo-cyan",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem",display:"flex",alignItems:"center",gap:6},children:[s.jsx(Ms,{size:12}),"Export Speciation Profile"]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginTop:4},children:[s.jsx("span",{children:"Headless Mode (100x Speed)"}),s.jsx("button",{onClick:()=>n({headlessMode:!e.headlessMode}),className:e.headlessMode?"btn-holo btn-holo-cyan":"btn-holo btn-holo-dark",style:{padding:"2px 8px"},children:e.headlessMode?"ON":"OFF"})]})]})]})]})]})},E0=({bot:e,stats:t,onClose:n,onOverrideGenes:r,onOpenLineageModal:i,onOpenCrisprModal:o,onOpenNeuralModal:l})=>{const[u,c]=O.useState("telemetry");if(!e)return s.jsxs("div",{className:"glass-panel",style:{padding:"24px 16px",textAlign:"center"},children:[s.jsx(i0,{style:{width:28,height:28,color:"#00E5FF",margin:"0 auto 8px auto",display:"block"}}),s.jsx("p",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.8rem",color:"#ffffff",fontWeight:800},children:"BOT DATA HUB"}),s.jsxs("p",{style:{fontSize:"0.7rem",color:"#8B949E",marginTop:4},children:["Select any microbot on the canvas grid or click ",s.jsx("strong",{style:{color:"#00E5FF"},children:"SELECT BOT MENU"})," to view real-time telemetry."]})]});const h=Math.max(0,Math.min(100,e.battery/e.maxBattery*100)),m=e.batteryHistory||new Array(30).fill(e.battery),S=Math.max(e.maxBattery,...m),y={WANDERING:{bg:"rgba(30, 41, 59, 0.6)",border:"#334155",text:"#cbd5e1",label:"WANDERING 🧭"},SEEKING_ENERGY:{bg:"rgba(0, 230, 118, 0.2)",border:"#00E676",text:"#00E676",label:"HUNTING FOOD 🍏"},EVADING_HAZARD:{bg:"rgba(255, 107, 0, 0.2)",border:"#FF6B00",text:"#FF6B00",label:"FLEEING HAZARD 💥"},REPRODUCING:{bg:"rgba(224, 64, 251, 0.2)",border:"#E040FB",text:"#E040FB",label:"SEEKING MATE 🧬"}},C=y[e.behaviorState]||y.WANDERING;return s.jsxs("div",{className:"glass-panel",style:{padding:"14px",border:"1px solid rgba(0, 229, 255, 0.4)",boxShadow:"0 0 25px rgba(0, 229, 255, 0.15)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.battery<25&&s.jsx(td,{style:{width:16,height:16,color:"#FF6B00"}}),s.jsxs("div",{children:[s.jsx("div",{style:{fontFamily:"'JetBrains Mono', monospace",fontWeight:800,fontSize:"0.95rem",color:"#00E5FF"},children:e.id}),s.jsxs("div",{style:{fontSize:"0.65rem",color:"#8B949E",fontFamily:"'JetBrains Mono', monospace"},children:["GEN R",e.generation," • PARENT: ",e.parentId||"ORIGIN"]})]})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsxs("button",{onClick:i,className:"btn-holo btn-holo-magenta",style:{padding:"4px 8px",fontSize:"0.65rem"},title:"View Family Lineage Tree",children:[s.jsx(rd,{style:{width:12,height:12}}),s.jsx("span",{children:"TREE"})]}),o&&s.jsxs("button",{onClick:o,className:"btn-holo btn-holo-cyan",style:{padding:"4px 8px",fontSize:"0.65rem"},title:"Open CRISPR Editor",children:[s.jsx(Vt,{style:{width:12,height:12}}),s.jsx("span",{children:"CRISPR"})]}),l&&s.jsxs("button",{onClick:l,className:"btn-holo btn-holo-cyan",style:{padding:"4px 8px",fontSize:"0.65rem"},title:"View Neural Brain",children:[s.jsx(Cl,{style:{width:12,height:12}}),s.jsx("span",{children:"NEURAL"})]}),s.jsx("button",{onClick:n,style:{background:"transparent",border:"none",color:"#8B949E",cursor:"pointer",padding:4},title:"Deselect",children:s.jsx(Wt,{style:{width:16,height:16}})})]})]}),s.jsxs("div",{style:{display:"flex",gap:6,marginBottom:10,borderBottom:"1px solid rgba(255, 255, 255, 0.08)",paddingBottom:6},children:[s.jsxs("button",{onClick:()=>c("telemetry"),className:u==="telemetry"?"btn-holo btn-holo-cyan":"btn-holo btn-holo-dark",style:{flex:1,padding:"4px 6px",fontSize:"0.68rem"},children:[s.jsx(g0,{style:{width:12,height:12}})," TELEMETRY"]}),s.jsxs("button",{onClick:()=>c("dna"),className:u==="dna"?"btn-holo btn-holo-magenta":"btn-holo btn-holo-dark",style:{flex:1,padding:"4px 6px",fontSize:"0.68rem"},children:[s.jsx(Vt,{style:{width:12,height:12}})," GENE INSPECTOR"]})]}),u==="telemetry"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{padding:"5px 10px",borderRadius:8,background:C.bg,border:"1px solid "+C.border,color:C.text,fontSize:"0.7rem",fontFamily:"'JetBrains Mono', monospace",fontWeight:800,display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[s.jsx("span",{children:"BEHAVIOR:"}),s.jsx("span",{children:C.label})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)",marginBottom:10},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",marginBottom:4},children:[s.jsxs("span",{style:{color:"#8B949E",display:"flex",alignItems:"center",gap:4},children:[s.jsx(e0,{style:{width:13,height:13,color:"#00E5FF"}})," Battery Charge"]}),s.jsxs("span",{style:{color:"#00E5FF",fontWeight:800},children:[e.battery.toFixed(1)," / ",e.maxBattery.toFixed(0)," (",h.toFixed(0),"%)"]})]}),s.jsx("div",{style:{width:"100%",height:6,background:"#1e293b",borderRadius:3,overflow:"hidden"},children:s.jsx("div",{style:{height:"100%",width:`${h}%`,background:h>40?"linear-gradient(90deg, #00E5FF, #00E676)":h>20?"#FF6B00":"#f43f5e",transition:"width 0.2s ease"}})})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(0, 229, 255, 0.15)",marginBottom:10},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginBottom:4},children:[s.jsx("span",{children:"Battery Charge Trend"}),s.jsx("span",{style:{color:"#00E5FF"},children:"Live"})]}),s.jsx("svg",{viewBox:"0 0 100 24",style:{width:"100%",height:24,overflow:"visible"},children:s.jsx("path",{d:m.map((M,w)=>{const F=w/(m.length-1)*100,p=24-M/S*20;return`${w===0?"M":"L"} ${F} ${p}`}).join(" "),fill:"none",stroke:"#00E5FF",strokeWidth:"1.8"})})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(224, 64, 251, 0.15)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginBottom:6},children:[s.jsx("span",{children:"Speed/Vision/Efficiency"}),s.jsx("span",{style:{color:"#E040FB"},children:"Last Mins"})]}),s.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:32},children:t.speedHistogram.map((M,w)=>{const F=Math.max(1,...t.speedHistogram),p=M/F*100;return s.jsx("div",{style:{flex:1,height:`${Math.max(15,p)}%`,backgroundColor:w<3?"#E040FB":w<7?"#00E5FF":"#00E676",borderRadius:"2px 2px 0 0"}},w)})})]})]}):s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[s.jsx("div",{style:{fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#E040FB",fontWeight:800},children:"REAL-TIME GENETIC OVERRIDES"}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[s.jsx(nd,{style:{width:12,height:12,color:"#00E5FF"}})," Speed"]}),s.jsxs("span",{style:{color:"#00E5FF",fontWeight:800},children:[e.speed.toFixed(2)," px/f"]})]}),s.jsx("input",{type:"range",min:"1.0",max:"5.0",step:"0.1",value:e.speed,onChange:M=>r(e.id,{speed:parseFloat(M.target.value)}),style:{width:"100%",height:4,marginTop:4}})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[s.jsx(o0,{style:{width:12,height:12,color:"#60a5fa"}})," Vision Radius"]}),s.jsxs("span",{style:{color:"#60a5fa",fontWeight:800},children:[e.visionRadius.toFixed(0)," px"]})]}),s.jsx("input",{type:"range",min:"60",max:"260",step:"5",value:e.visionRadius,onChange:M=>r(e.id,{visionRadius:parseInt(M.target.value,10)}),style:{width:"100%",height:4,marginTop:4}})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[s.jsx(Ml,{style:{width:12,height:12,color:"#00E676"}})," Efficiency"]}),s.jsxs("span",{style:{color:"#00E676",fontWeight:800},children:[e.energyEfficiency.toFixed(2),"x"]})]}),s.jsx("input",{type:"range",min:"0.6",max:"2.5",step:"0.1",value:e.energyEfficiency,onChange:M=>r(e.id,{energyEfficiency:parseFloat(M.target.value)}),style:{width:"100%",height:4,marginTop:4}})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Color Hue Alignment"}),s.jsxs("span",{style:{color:e.color,fontWeight:800},children:[e.hue.toFixed(0),"°"]})]}),s.jsx("input",{type:"range",min:"0",max:"360",step:"5",value:e.hue,onChange:M=>r(e.id,{hue:parseInt(M.target.value,10)}),style:{width:"100%",height:4,marginTop:4}})]})]})]})},k0=({bots:e})=>{const t=O.useRef(null);return O.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d");if(!r)return;let i;const o=()=>{r.fillStyle="#060A10",r.fillRect(0,0,n.width,n.height),r.strokeStyle="rgba(0, 229, 255, 0.1)",r.lineWidth=1;for(let l=0;l<n.width;l+=20)r.beginPath(),r.moveTo(l,0),r.lineTo(l,n.height),r.stroke();for(let l=0;l<n.height;l+=20)r.beginPath(),r.moveTo(0,l),r.lineTo(n.width,l),r.stroke();r.globalCompositeOperation="screen",e.forEach(l=>{const c=10+Math.max(0,Math.min(1,(l.speed-1)/4))*(n.width-20),h=Math.max(0,Math.min(1,(l.energyEfficiency-.6)/1.9)),m=n.height-10-h*(n.height-20),y=3+Math.max(0,Math.min(1,(l.visionRadius-40)/110))*7,C=r.createRadialGradient(c,m,0,c,m,y);C.addColorStop(0,l.color),C.addColorStop(1,"rgba(0,0,0,0)"),r.fillStyle=C,r.beginPath(),r.arc(c,m,y,0,Math.PI*2),r.fill()}),r.globalCompositeOperation="source-over",r.fillStyle="rgba(255,255,255,0.4)",r.font="8px 'JetBrains Mono'",r.fillText("SPEED →",n.width/2-15,n.height-4),r.save(),r.translate(8,n.height/2+25),r.rotate(-Math.PI/2),r.fillText("EFFICIENCY →",0,0),r.restore(),i=requestAnimationFrame(o)};return o(),()=>cancelAnimationFrame(i)},[e]),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.75)",borderRadius:10,border:"1px solid rgba(0, 229, 255, 0.25)",padding:"10px",marginTop:8},children:[s.jsxs("div",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#00E5FF",display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx(Cl,{style:{width:13,height:13}})," 2D GENETIC DRIFT"]}),s.jsx("span",{style:{color:"#8B949E",fontSize:"0.65rem"},children:"Speed / Eff / Vis"})]}),s.jsx("canvas",{ref:t,width:220,height:150,style:{borderRadius:8,border:"1px solid rgba(0,229,255,0.1)",width:"100%"}})]})};class La{static mapGenomeToPhenotype(t){var o,l,u,c;const n=((o=t==null?void 0:t.defenseAllele)==null?void 0:o.baseValue)||1,r=((l=t==null?void 0:t.speedAllele)==null?void 0:l.baseValue)||1,i=((u=t==null?void 0:t.visionAllele)==null?void 0:u.baseValue)||100;return{armorPlatesCount:Math.min(8,Math.max(0,Math.floor(n*2))),armorThickness:Math.min(6,Math.max(1,n*1.5)),thrustFinsLength:Math.min(15,Math.max(3,r*3)),thrustFinsAngle:Math.PI/4,bioluminescentLureGlow:Math.min(1,i/250),lureHue:(((c=t==null?void 0:t.hueAllele)==null?void 0:c.baseValue)||180)%360}}static renderPhenotype(t,n,r){if(t.save(),t.translate(n.x,n.y),t.rotate(n.heading||0),r.thrustFinsLength>0&&(t.fillStyle=n.color||"#00E5FF",t.beginPath(),t.moveTo(-n.radius,-n.radius*.5),t.lineTo(-n.radius-r.thrustFinsLength,-n.radius*.8),t.lineTo(-n.radius-r.thrustFinsLength*.5,0),t.lineTo(-n.radius-r.thrustFinsLength,n.radius*.8),t.lineTo(-n.radius,n.radius*.5),t.fill()),r.armorPlatesCount>0){t.strokeStyle="#94a3b8",t.lineWidth=r.armorThickness;for(let i=0;i<r.armorPlatesCount;i++){const o=i/r.armorPlatesCount*Math.PI*2;t.beginPath(),t.arc(0,0,n.radius+r.armorThickness*.5,o,o+Math.PI/r.armorPlatesCount*.8),t.stroke()}}r.bioluminescentLureGlow>0&&(t.shadowColor=`hsl(${r.lureHue}, 100%, 50%)`,t.shadowBlur=12*r.bioluminescentLureGlow,t.fillStyle=`hsl(${r.lureHue}, 100%, 70%)`,t.beginPath(),t.arc(n.radius+6,0,3*r.bioluminescentLureGlow,0,Math.PI*2),t.fill(),t.shadowBlur=0),t.restore()}}const jo=({engine:e,onSelectBot:t,onSelectRandomBot:n,onUpdateConfig:r})=>{const i=O.useRef(null),o=O.useRef(null),l=O.useRef(null),u=O.useRef(null),c=O.useRef(null),h=O.useRef(null),m=O.useRef(null),S=O.useRef(!0),y=O.useRef(!1),C=O.useRef(window.devicePixelRatio||1),M=O.useRef(0),[w,F]=As.useState(!1);O.useEffect(()=>{const z=i.current;if(!z)return;const V=()=>{const b=z.getBoundingClientRect(),N=Math.max(600,Math.floor(z.clientWidth||b.width||1e3)),g=Math.max(400,Math.floor(z.clientHeight||b.height||650)),P=o.current;if(P){const j=C.current;P.width=Math.floor(N*j),P.height=Math.floor(g*j),P.style.width=`${N}px`,P.style.height=`${g}px`;const W=P.getContext("2d");W&&W.scale(j,j),e.resize(N,g),S.current=!0}};let H=performance.now();const k=setInterval(()=>{const b=performance.now();if(b-H>=1e3){const N=M.current;M.current=0,H=b,N<30&&C.current>.5?(C.current=Math.max(.5,C.current-.25),V()):N>55&&C.current<(window.devicePixelRatio||1)&&(C.current=Math.min(window.devicePixelRatio||1,C.current+.1),V())}},1e3);V();const d=new ResizeObserver(V);return d.observe(z),()=>{d.disconnect(),clearInterval(k)}},[e]),O.useEffect(()=>{const z=()=>{y.current=!1};return window.addEventListener("mouseup",z),()=>{window.removeEventListener("mouseup",z)}},[]);const p=(z,V)=>{m.current||(m.current=document.createElement("canvas"));const H=m.current;if(H.width!==z||H.height!==V||S.current){H.width=z,H.height=V;const k=H.getContext("2d");if(k){k.clearRect(0,0,z,V);for(const d of e.gravityWells||[]){const b=k.createRadialGradient(d.x,d.y,0,d.x,d.y,d.radius);b.addColorStop(0,"rgba(139, 92, 246, 0.4)"),b.addColorStop(1,"rgba(139, 92, 246, 0)"),k.fillStyle=b,k.beginPath(),k.arc(d.x,d.y,d.radius,0,Math.PI*2),k.fill()}for(const d of e.fluidZones||[]){const b=k.createRadialGradient(d.x,d.y,0,d.x,d.y,d.radius);b.addColorStop(0,d.isNonNewtonian?"rgba(59, 130, 246, 0.3)":"rgba(14, 165, 233, 0.3)"),b.addColorStop(1,"rgba(14, 165, 233, 0)"),k.fillStyle=b,k.beginPath(),k.arc(d.x,d.y,d.radius,0,Math.PI*2),k.fill()}for(const d of e.catalystZones||[]){const b=k.createRadialGradient(d.x,d.y,0,d.x,d.y,d.radius);b.addColorStop(0,d.mutationDirection>0?"rgba(34, 197, 94, 0.3)":"rgba(239, 68, 68, 0.3)"),b.addColorStop(1,"rgba(34, 197, 94, 0)"),k.fillStyle=b,k.beginPath(),k.arc(d.x,d.y,d.radius,0,Math.PI*2),k.fill()}}}return H},f=(z,V)=>{l.current||(l.current=document.createElement("canvas"));const H=l.current;H.width=z,H.height=V;const k=H.getContext("2d");if(!k)return H;k.fillStyle="#080E14",k.fillRect(0,0,z,V),k.strokeStyle="rgba(0, 229, 255, 0.05)",k.lineWidth=1;const d=40;for(let N=0;N<z;N+=d)k.beginPath(),k.moveTo(N,0),k.lineTo(N,V),k.stroke();for(let N=0;N<V;N+=d)k.beginPath(),k.moveTo(0,N),k.lineTo(z,N),k.stroke();k.strokeStyle="rgba(0, 229, 255, 0.08)";const b=60;for(let N=0;N<z;N+=b)k.beginPath(),k.moveTo(N,0),k.lineTo(N,V),k.stroke();for(let N=0;N<V;N+=b)k.beginPath(),k.moveTo(0,N),k.lineTo(z,N),k.stroke();if(e&&e.biomes)for(const N of e.biomes)N.color!=="rgba(255,255,255,0)"&&(k.fillStyle=N.color,k.fillRect(N.x,N.y,N.width,N.height)),k.strokeStyle="rgba(0, 229, 255, 0.15)",k.lineWidth=1,k.strokeRect(N.x,N.y,N.width,N.height),k.fillStyle="rgba(255, 255, 255, 0.1)",k.font="8px 'JetBrains Mono', monospace",k.fillText(N.type.replace(/_/g," "),N.x+8,N.y+16);if(e&&e.config.showTerrainContour){k.fillStyle="rgba(0, 229, 255, 0.05)";const N=10;for(let g=0;g<V;g+=N)for(let P=0;P<z;P+=N){const j=e.getElevation(P,g);j>.3&&j<.32&&k.fillRect(P,g,N,N),j>.6&&j<.62&&k.fillRect(P,g,N,N),j>.8&&j<.82&&k.fillRect(P,g,N,N)}}return S.current=!1,H},x=(z,V)=>{h.current||(h.current=document.createElement("canvas"));const H=h.current;(H.width!==z||H.height!==V)&&(H.width=z,H.height=V);const k=H.getContext("2d");if(k&&e.pheromoneGrid){k.clearRect(0,0,z,V),k.fillStyle="rgba(255, 107, 0, 0.8)";const d=e.pheromoneGrid,b=d.buffer,N=d.cols,g=10;for(let P=0;P<b.length;P++){const j=b[P];if(j>.05){const W=Math.floor(P/N),J=P%N;k.globalAlpha=Math.min(1,j*.5),k.fillRect(J*g,W*g,g,g)}}k.globalAlpha=1}return H};O.useEffect(()=>{let z,V=performance.now();const H=()=>{const k=o.current;if(k){const d=k.getContext("2d");if(d){if(M.current++,document.hidden){z=requestAnimationFrame(H);return}const b=performance.now();let N=(b-V)/(1e3/(e.config.targetFPS||60));if(N>3&&(N=3),V=b,e.config.headlessMode){for(let v=0;v<100;v++)e.update(N);d.fillStyle="#080E14",d.fillRect(0,0,k.width,k.height),d.font="800 16px 'JetBrains Mono', monospace",d.fillStyle="#00E5FF",d.textAlign="center",d.fillText("HEADLESS MODE ACTIVE (100x SPEED)",k.width/2,k.height/2),d.font="800 10px 'JetBrains Mono', monospace",d.fillStyle="#8B949E",d.fillText(`Generation ${e.generationCount} | Pop: ${e.microbots.length}`,k.width/2,k.height/2+20),z=requestAnimationFrame(H);return}e.update(N),(S.current||!l.current)&&f(k.width,k.height),u.current?(u.current.width!==k.width||u.current.height!==k.height)&&(u.current.width=k.width,u.current.height=k.height):(u.current=document.createElement("canvas"),u.current.width=k.width,u.current.height=k.height);const g=u.current.getContext("2d");g&&(g.fillStyle="rgba(8, 14, 20, 0.25)",g.fillRect(0,0,k.width,k.height)),d.clearRect(0,0,k.width,k.height),d.drawImage(l.current,0,0);const P=p(k.width,k.height);d.drawImage(P,0,0),e.config.enableFrameInterpolation&&d.drawImage(u.current,0,0);const j=e.config.heatmapMode||"OFF";if(j!=="OFF"){const D=k.width/20,_=k.height/15;for(let U=0;U<20;U++)for(let Z=0;Z<15;Z++){const de=U*D+D/2,Fe=Z*_+_/2;let Ze=0,at="255, 107, 0";if(j==="MORTALITY"){at="244, 63, 94";for(const he of e.hazards)Math.hypot(de-he.x,Fe-he.y)<he.radius*1.5&&(Ze+=.35)}else if(j==="FOOD_DENSITY"){at="0, 230, 118";for(const he of e.energyParticles)Math.hypot(de-he.x,Fe-he.y)<100&&(Ze+=.25)}else if(j==="TRAFFIC"){at="0, 229, 255";for(const he of e.microbots)Math.hypot(de-he.x,Fe-he.y)<120&&(Ze+=.2)}Ze=Math.min(.65,Ze),Ze>.05&&(d.fillStyle=`rgba(${at}, ${Ze})`,d.fillRect(U*D,Z*_,D,_))}}const W=k.width*.5,J=k.height*.5;if(d.save(),d.globalAlpha=.08,d.fillStyle="#16a34a",d.fillRect(0,0,W,J),d.fillStyle="#dc2626",d.fillRect(W,0,W,J),d.fillStyle="#ea580c",d.fillRect(0,J,W,J),d.fillStyle="#0284c7",d.fillRect(W,J,W,J),d.restore(),e.config.showPheromoneTrails&&e.chemicalGrid){c.current||(c.current=document.createElement("canvas")),(c.current.width!==k.width||c.current.height!==k.height)&&(c.current.width=k.width,c.current.height=k.height);const v=c.current.getContext("2d");if(v){v.clearRect(0,0,k.width,k.height),v.fillStyle="#00E676";const X=e.chemicalGrid,D=X.buffer,_=X.cols,U=X.resolution;for(let Z=0;Z<D.length;Z++){const de=D[Z];if(de>.05){const Fe=Math.floor(Z/_),Ze=Z%_;v.globalAlpha=de*.8,v.fillRect(Ze*U,Fe*U,U,U)}}v.globalAlpha=1,d.drawImage(c.current,0,0)}}if(e.config.showPheromoneTrails&&e.pheromoneGrid){const v=x(k.width,k.height);d.drawImage(v,0,0)}d.strokeStyle="rgba(0, 229, 255, 0.12)",d.lineWidth=1.5;for(let v=50;v<k.height;v+=120)d.beginPath(),d.moveTo(0,v),d.lineTo(k.width,v+Math.sin(v+Date.now()*.002)*15),d.stroke();for(const v of e.speedFields){const X=d.createRadialGradient(v.x,v.y,5,v.x,v.y,v.radius);X.addColorStop(0,"rgba(0, 229, 255, 0.3)"),X.addColorStop(1,"rgba(0, 229, 255, 0)"),d.fillStyle=X,d.beginPath(),d.arc(v.x,v.y,v.radius,0,Math.PI*2),d.fill(),d.strokeStyle="rgba(0, 229, 255, 0.5)",d.lineWidth=1,d.beginPath(),d.arc(v.x,v.y,v.radius,0,Math.PI*2),d.stroke()}if(e.spores){d.fillStyle="#E040FB";for(const v of e.spores)v.hostId||(d.beginPath(),d.arc(v.x,v.y,v.radius,0,Math.PI*2),d.fill(),d.shadowBlur=10,d.shadowColor="#E040FB",d.stroke(),d.shadowBlur=0)}for(const v of e.portals){const X=Date.now()/300,D=d.createRadialGradient(v.x,v.y,2,v.x,v.y,v.radius);D.addColorStop(0,"rgba(217, 70, 239, 0.8)"),D.addColorStop(.5,"rgba(139, 92, 246, 0.4)"),D.addColorStop(1,"rgba(139, 92, 246, 0)"),d.fillStyle=D,d.beginPath(),d.arc(v.x,v.y,v.radius,0,Math.PI*2),d.fill(),d.strokeStyle="rgba(217, 70, 239, 0.9)",d.lineWidth=2,d.beginPath(),d.arc(v.x,v.y,v.radius*.8,X,X+Math.PI),d.stroke(),d.strokeStyle="rgba(139, 92, 246, 0.9)",d.beginPath(),d.arc(v.x,v.y,v.radius*.6,-X,-X+Math.PI),d.stroke(),d.font="800 10px 'JetBrains Mono', monospace",d.fillStyle="#d946ef",d.textAlign="center",d.fillText("PORTAL",v.x,v.y-v.radius-5)}g&&e.config.enableFrameInterpolation&&g.drawImage(k,0,0);for(const v of e.hazards){const X=Math.sin(Date.now()/350)*4,D=Math.max(10,v.radius+X),_=d.createRadialGradient(v.x,v.y,5,v.x,v.y,D);_.addColorStop(0,"rgba(255, 107, 0, 0.35)"),_.addColorStop(.7,"rgba(255, 107, 0, 0.15)"),_.addColorStop(1,"rgba(255, 107, 0, 0)"),d.fillStyle=_,d.beginPath(),d.arc(v.x,v.y,D,0,Math.PI*2),d.fill(),d.strokeStyle="rgba(255, 107, 0, 0.6)",d.lineWidth=1.5,d.setLineDash([6,6]),d.beginPath(),d.arc(v.x,v.y,v.radius,0,Math.PI*2),d.stroke(),d.setLineDash([]),d.font="800 9px 'JetBrains Mono', monospace",d.fillStyle="rgba(255, 107, 0, 0.8)",d.textAlign="center",d.fillText(v.id,v.x,v.y+3)}for(const v of e.energyParticles){if(d.shadowColor=v.color,d.shadowBlur=10,d.fillStyle=v.color,d.beginPath(),d.arc(v.x,v.y,v.radius,0,Math.PI*2),d.fill(),v.type==="SUPER_CHARGER")d.strokeStyle="#ffffff",d.lineWidth=1,d.stroke();else if(v.type==="MUTAGEN_ORB"){const X=v.radius+Math.sin(Date.now()/150)*2;d.strokeStyle="#E040FB",d.lineWidth=1.2,d.beginPath(),d.arc(v.x,v.y,X,0,Math.PI*2),d.stroke()}d.shadowBlur=0}for(const v of e.disasterParticles)d.fillStyle=v.color,d.globalAlpha=v.life/150,d.beginPath(),d.arc(v.x,v.y,2+v.life/50,0,Math.PI*2),d.fill();if(d.globalAlpha=1,e.config.showEnergyForceLines){d.lineWidth=1;for(const v of e.microbots){const X=e.spatialGrid.getNearby(v.x,v.y,v.visionRadius);for(const D of X){const _=Math.hypot(v.x-D.x,v.y-D.y);if(_<=v.visionRadius){const U=(1-_/v.visionRadius)*.45;d.strokeStyle=D.type==="MUTAGEN_ORB"?`rgba(224, 64, 251, ${U})`:D.type==="SUPER_CHARGER"?`rgba(0, 229, 255, ${U})`:`rgba(0, 230, 118, ${U})`,d.beginPath(),d.moveTo(v.x,v.y),d.quadraticCurveTo((v.x+D.x)/2+Math.sin(Date.now()/200+v.x)*10,(v.y+D.y)/2+Math.cos(Date.now()/200+v.y)*10,D.x,D.y),d.stroke()}}}}const ne=e.getSelectedMicrobot();for(const v of e.microbots){const X=ne&&ne.id===v.id;if(v.boundTo&&v.boundTo.length>0){d.save(),d.lineWidth=3,d.strokeStyle="rgba(0, 255, 128, 0.6)",d.lineCap="round",d.beginPath();for(const at of v.boundTo){const he=e.microbots.find(Se=>Se.id===at);he&&he.id>v.id&&(d.moveTo(v.x,v.y),d.lineTo(he.x,he.y))}d.stroke(),d.restore()}if(e.config.showSensoryRaycasts||X){const he=Math.PI*.8,Se=v.heading-he/2;for(let fe=0;fe<8;fe++){const Zt=Se+fe/7*he;let no="rgba(0, 229, 255, 0.15)",hn=v.visionRadius;for(const et of e.energyParticles){const Zn=Math.hypot(v.x-et.x,v.y-et.y);if(Zn<v.visionRadius){const ro=Math.atan2(et.y-v.y,et.x-v.x);Math.abs(ro-Zt)<.25&&(no=et.color,hn=Math.min(hn,Zn))}}for(const et of e.hazards){const Zn=Math.hypot(v.x-et.x,v.y-et.y);if(Zn<v.visionRadius+et.radius){const ro=Math.atan2(et.y-v.y,et.x-v.x);Math.abs(ro-Zt)<.3&&(no="rgba(255, 107, 0, 0.7)",hn=Math.min(hn,Zn))}}const od=v.x+Math.cos(Zt)*hn,sd=v.y+Math.sin(Zt)*hn;d.strokeStyle=no,d.lineWidth=X?1.5:1,d.beginPath(),d.moveTo(v.x,v.y),d.lineTo(od,sd),d.stroke()}}if(e.config.showMovementTrails&&v.trail.length>1){const at=v.genome&&Object.values(v.genome).some(fe=>fe.state==="DECAYING"),he=v.genome&&Object.values(v.genome).some(fe=>fe.state==="ENTANGLED"),Se=v.trail.length;Se>1&&(d.lineCap="round",d.lineJoin="round");for(let fe=1;fe<Se;fe++){const Zt=Math.pow(fe/Se,2)*.7;at?(d.strokeStyle=fe%2===0?"#f43f5e":v.color,d.lineWidth=1.5+fe/Se*2,d.setLineDash([2,4])):he?(d.strokeStyle="#E040FB",d.lineWidth=1.5+fe/Se*2,d.setLineDash([4,2])):(d.strokeStyle=v.color,d.lineWidth=1.5+fe/Se*2.5,d.setLineDash([]),d.shadowColor=v.color,d.shadowBlur=4),d.globalAlpha=Zt,d.shadowBlur=v.organelles&&v.organelles.length>0?22+fe/Se*14:18+fe/Se*12,d.shadowColor=d.strokeStyle,d.beginPath(),d.moveTo(v.trail[fe-1].x,v.trail[fe-1].y),d.lineTo(v.trail[fe].x,v.trail[fe].y),d.stroke(),d.globalAlpha=Zt*.6,d.shadowBlur=4,d.shadowColor="#ffffff",d.lineWidth=1,d.strokeStyle="#ffffff",d.stroke()}d.setLineDash([]),d.shadowBlur=0,d.globalAlpha=1}const D=14;d.strokeStyle=v.color,d.lineWidth=1.2,d.globalAlpha=.5,d.beginPath(),d.moveTo(v.x,v.y),d.lineTo(v.x+Math.cos(v.heading)*D,v.y+Math.sin(v.heading)*D),d.stroke(),d.globalAlpha=1,(X||e.config.showSensoryRings)&&(d.strokeStyle=X?v.isPredator?"#f43f5e":"#00E5FF":"rgba(0, 229, 255, 0.12)",d.lineWidth=X?1.5:.8,d.beginPath(),d.arc(v.x,v.y,v.visionRadius,0,Math.PI*2),d.stroke());const _=La.mapGenomeToPhenotype(v.genome);La.renderPhenotype(d,v,_),d.save(),d.translate(v.x,v.y),d.rotate(v.heading),d.shadowColor=v.color,d.shadowBlur=X?20:10,d.fillStyle=v.color,d.beginPath(),d.moveTo(10,0),d.lineTo(-8,-6),d.lineTo(-4,0),d.lineTo(-8,6),d.closePath(),d.fill(),v.isPredator&&(d.strokeStyle="#f43f5e",d.lineWidth=1.5,d.beginPath(),d.moveTo(8,-4),d.lineTo(14,-7),d.moveTo(8,4),d.lineTo(14,7),d.stroke()),d.fillStyle="#ffffff",d.beginPath(),d.arc(6,0,2,0,Math.PI*2),d.fill(),d.shadowBlur=0,d.restore();const U=Math.max(0,Math.min(1,v.battery/v.maxBattery)),Z=20,de=3,Fe=v.x-Z/2,Ze=v.y-14;if(d.fillStyle="rgba(0, 0, 0, 0.7)",d.fillRect(Fe,Ze,Z,de),d.fillStyle=U>.4?"#00E676":U>.2?"#FF6B00":"#f43f5e",d.fillRect(Fe,Ze,Z*U,de),X){const he=18+Math.sin(Date.now()/200)*3;d.strokeStyle=v.isPredator?"#f43f5e":"#00E5FF",d.lineWidth=2,d.beginPath(),d.arc(v.x,v.y,he,0,Math.PI*2),d.stroke();const Se=v.behaviorState==="HUNTING_PREY"?"Predator Hunting ⚔️":v.behaviorState==="SEEKING_ENERGY"?"Hunting Food 🍏":v.behaviorState==="EVADING_HAZARD"?"Fleeing Hazard 💥":v.behaviorState==="REPRODUCING"?"Seeking Mate 🧬":"Wandering 🧭";d.font="800 11px 'JetBrains Mono', monospace",d.fillStyle=v.isPredator?"#f43f5e":"#00E5FF",d.textAlign="center",d.fillText(`★ ${v.id} (${Se})`,v.x,v.y-22)}}}if(d&&e.cataclysmManager&&e.cataclysmManager.getActiveEvent()){const b=e.cataclysmManager.getActiveEvent();b&&b.type==="TECTONIC_INVERSION"?(d.save(),d.fillStyle="rgba(255, 107, 0, 0.08)",d.fillRect(0,0,k.width,k.height),d.restore()):b&&b.type==="SOLAR_STORM"&&(d.save(),d.fillStyle="rgba(224, 64, 251, 0.08)",d.fillRect(0,0,k.width,k.height),d.restore())}if(d&&e.atmosphereManager){const b=e.atmosphereManager.currentCondition.weather;b==="HEATWAVE"?(d.save(),d.fillStyle="rgba(245, 158, 11, 0.05)",d.fillRect(0,0,k.width,k.height),d.restore()):b==="GLACIAL_BLIZZARD"&&(d.save(),d.fillStyle="rgba(147, 197, 253, 0.06)",d.fillRect(0,0,k.width,k.height),d.restore())}}z=requestAnimationFrame(H)};return H(),()=>cancelAnimationFrame(z)},[e]);const E=z=>{const V=o.current;if(!V)return;const H=V.getBoundingClientRect(),k=z.clientX-H.left,d=z.clientY-H.top,b=e.config.brushMode||"NONE";if(b==="PAINT_FOOD")e.spawnFood(k,d);else if(b==="PAINT_HAZARD")e.spawnHazard(k,d);else if(b==="PAINT_SPEED_FIELD")e.spawnSpeedField(k,d);else{let N=null,g=28;for(const P of e.microbots){const j=Math.hypot(P.x-k,P.y-d);j<g&&(g=j,N=P)}if(N)t(N.id);else for(let P=0;P<5;P++)e.spawnFood(k+(Math.random()-.5)*20,d+(Math.random()-.5)*20)}},a=O.useRef(null),I=(z,V=!1)=>{z.cancelable&&z.preventDefault();const H=o.current;if(H){if(z.touches.length===2){const k=z.touches[0],d=z.touches[1],b=Math.hypot(k.clientX-d.clientX,k.clientY-d.clientY);if(a.current&&V){const N=b-a.current;Math.abs(N)>2&&(C.current=Math.max(.1,Math.min(3,C.current+N*.008)))}a.current=b;return}if(a.current=null,z.touches.length===1){const k=H.getBoundingClientRect(),d=z.touches[0].clientX-k.left,b=z.touches[0].clientY-k.top,N=e.config.brushMode||"NONE";if(N==="PAINT_FOOD")e.spawnFood(d,b),!V&&navigator.vibrate&&navigator.vibrate(10);else if(N==="PAINT_HAZARD")e.spawnHazard(d,b),!V&&navigator.vibrate&&navigator.vibrate([15,30,15]);else if(N==="PAINT_SPEED_FIELD")e.spawnSpeedField(d,b),!V&&navigator.vibrate&&navigator.vibrate(15);else if(!V){let g=null,P=35;for(const j of e.microbots){const W=Math.hypot(j.x-d,j.y-b);W<P&&(P=W,g=j)}if(g)t(g.id),navigator.vibrate&&navigator.vibrate(20);else{for(let j=0;j<5;j++)e.spawnFood(d+(Math.random()-.5)*20,b+(Math.random()-.5)*20);navigator.vibrate&&navigator.vibrate(10)}}}}},T=e.getSelectedMicrobot(),A=e.config.brushMode||"NONE",Q=e.config.heatmapMode||"OFF",L=e.microbots.length<15,Y=e.activeDisasters.some(z=>z.type==="RADIATION_STORM"),ee=e.activeDisasters.some(z=>z.type==="MAGNETIC_INVERSION");return s.jsxs("div",{ref:i,className:"canvas-viewport-card",style:{width:"100%",height:"100%"},children:[L&&s.jsxs("div",{style:{position:"absolute",top:60,left:"50%",transform:"translateX(-50%)",zIndex:22,display:"flex",alignItems:"center",gap:8,padding:"6px 18px",background:"rgba(244, 63, 94, 0.85)",border:"1px solid #f43f5e",borderRadius:12,color:"#ffffff",fontFamily:"'JetBrains Mono', monospace",fontSize:"0.75rem",fontWeight:800,boxShadow:"0 0 25px rgba(244, 63, 94, 0.5)",pointerEvents:"none"},children:[s.jsx(or,{style:{width:14,height:14}}),s.jsx("span",{children:"⚠️ EXTINCTION CRISIS ALERT: POPULATION BELOW 15 BOTS! RECOVERY INITIATED"})]}),Y&&s.jsxs("div",{style:{position:"absolute",top:96,left:"50%",transform:"translateX(-50%)",zIndex:22,display:"flex",alignItems:"center",gap:8,padding:"6px 18px",background:"rgba(245, 158, 11, 0.85)",border:"1px solid #f59e0b",borderRadius:12,color:"#ffffff",fontFamily:"'JetBrains Mono', monospace",fontSize:"0.75rem",fontWeight:800,boxShadow:"0 0 25px rgba(245, 158, 11, 0.5)",pointerEvents:"none"},children:[s.jsx(or,{style:{width:14,height:14}}),s.jsx("span",{children:"☢️ GLOBAL RADIATION STORM ACTIVE: MUTATION RATES INCREASED"})]}),ee&&s.jsxs("div",{style:{position:"absolute",top:132,left:"50%",transform:"translateX(-50%)",zIndex:22,display:"flex",alignItems:"center",gap:8,padding:"6px 18px",background:"rgba(217, 70, 239, 0.85)",border:"1px solid #d946ef",borderRadius:12,color:"#ffffff",fontFamily:"'JetBrains Mono', monospace",fontSize:"0.75rem",fontWeight:800,boxShadow:"0 0 25px rgba(217, 70, 239, 0.5)",pointerEvents:"none"},children:[s.jsx(or,{style:{width:14,height:14}}),s.jsx("span",{children:"🧲 POLARITY INVERSION: ALL HEADINGS REVERSED"})]}),s.jsxs("div",{style:{position:"absolute",top:14,left:"50%",transform:"translateX(-50%)",zIndex:20,display:"flex",alignItems:"center",gap:12,padding:"6px 16px",background:"rgba(15, 26, 36, 0.85)",border:"1px solid rgba(0, 229, 255, 0.35)",borderRadius:20,backdropFilter:"blur(12px)",boxShadow:"0 8px 24px rgba(0,0,0,0.5)",pointerEvents:"auto"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("div",{style:{width:10,height:10,borderRadius:"50%",backgroundColor:T?T.color:"#00E5FF",boxShadow:"0 0 10px "+(T?T.color:"#00E5FF")}}),s.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.8rem",fontWeight:800,color:"#ffffff"},children:["TRACKING: ",T?T.id:"SEARCHING..."]})]}),s.jsxs("button",{onClick:n,className:"btn-holo btn-holo-cyan",style:{padding:"4px 10px",fontSize:"0.68rem"},children:[s.jsx(kl,{style:{width:12,height:12}}),s.jsx("span",{children:"SWITCH BOT"})]})]}),s.jsxs("div",{style:{position:"absolute",top:14,right:14,zIndex:20,display:"flex",alignItems:"center",gap:6,padding:"4px 8px",background:"rgba(15, 26, 36, 0.85)",border:"1px solid rgba(0, 229, 255, 0.3)",borderRadius:10,backdropFilter:"blur(12px)"},children:[s.jsxs("span",{style:{fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",display:"flex",alignItems:"center",gap:4},children:[s.jsx(l0,{style:{width:12,height:12}})," HEATMAP:"]}),s.jsxs("select",{value:Q,onChange:z=>r({heatmapMode:z.target.value}),style:{background:"#080E14",color:"#00E5FF",fontWeight:800,border:"1px solid rgba(0, 229, 255, 0.4)",borderRadius:6,padding:"2px 6px",fontSize:"0.65rem",cursor:"pointer"},children:[s.jsx("option",{value:"OFF",children:"Off"}),s.jsx("option",{value:"MORTALITY",children:"🔴 Mortality"}),s.jsx("option",{value:"FOOD_DENSITY",children:"🟢 Food Density"}),s.jsx("option",{value:"TRAFFIC",children:"🔵 Traffic Pathing"})]})]}),s.jsxs("div",{style:{position:"absolute",top:14,left:14,zIndex:20,display:"flex",alignItems:"center",gap:6,padding:"4px 8px",background:"rgba(15, 26, 36, 0.85)",border:"1px solid rgba(0, 229, 255, 0.3)",borderRadius:10,backdropFilter:"blur(12px)"},children:[s.jsx("span",{style:{fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:"BRUSH:"}),s.jsxs("button",{onClick:()=>r({brushMode:A==="PAINT_FOOD"?"NONE":"PAINT_FOOD"}),className:A==="PAINT_FOOD"?"btn-holo btn-holo-green":"btn-holo btn-holo-dark",style:{padding:"3px 6px",fontSize:"0.65rem"},children:[s.jsx(Ml,{style:{width:10,height:10}})," FOOD"]}),s.jsxs("button",{onClick:()=>e.spawnFood(void 0,void 0,"MUTAGEN_ORB"),className:"btn-holo btn-holo-magenta",style:{padding:"3px 6px",fontSize:"0.65rem"},title:"Spawn Mutagen Orb",children:[s.jsx(Vt,{style:{width:10,height:10}})," MUTAGEN"]}),s.jsxs("button",{onClick:()=>r({brushMode:A==="PAINT_HAZARD"?"NONE":"PAINT_HAZARD"}),className:A==="PAINT_HAZARD"?"btn-holo btn-holo-orange":"btn-holo btn-holo-dark",style:{padding:"3px 6px",fontSize:"0.65rem"},children:[s.jsx(El,{style:{width:10,height:10}})," HAZARD"]}),s.jsxs("button",{onClick:()=>r({brushMode:A==="PAINT_SPEED_FIELD"?"NONE":"PAINT_SPEED_FIELD"}),className:A==="PAINT_SPEED_FIELD"?"btn-holo btn-holo-cyan":"btn-holo btn-holo-dark",style:{padding:"3px 6px",fontSize:"0.65rem"},children:[s.jsx(id,{style:{width:10,height:10}})," SPEED FIELD"]})]}),s.jsx("canvas",{ref:o,onMouseDown:z=>{y.current=!0,E(z)},onMouseMove:z=>{y.current&&E(z)},onMouseUp:()=>{y.current=!1},onTouchStart:z=>I(z,!1),onTouchMove:z=>I(z,!0),onTouchEnd:()=>{a.current=null},onWheel:z=>{z.cancelable&&z.preventDefault();const V=-z.deltaY;C.current=Math.max(.1,Math.min(3,C.current+V*.001))},style:{display:"block",width:"100%",height:"100%",cursor:A!=="NONE"?"cell":"crosshair",touchAction:"none"}}),w&&s.jsxs("div",{style:{position:"absolute",inset:0,zIndex:50,background:"rgba(8, 14, 20, 0.92)",backdropFilter:"blur(12px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#F0F6FC",gap:12},children:[s.jsx(or,{style:{width:48,height:48,color:"#FF6B00"}}),s.jsx("div",{style:{fontSize:"1.1rem",fontWeight:600},children:"Render Context or WASM Interrupted"}),s.jsx("div",{style:{fontSize:"0.85rem",color:"#8B949E"},children:"Zero-Failure Guardrails active. Click below to recover render and WASM pipeline."}),s.jsx("button",{onClick:()=>F(!1),style:{padding:"8px 20px",background:"#00E5FF",color:"#080E14",fontWeight:700,borderRadius:6,border:"none",cursor:"pointer"},children:"Recover Immunity & Climate Pipeline"})]}),s.jsxs("div",{style:{position:"absolute",bottom:14,left:14,zIndex:20,background:"rgba(15, 26, 36, 0.75)",padding:"5px 12px",borderRadius:8,border:"1px solid rgba(255, 255, 255, 0.1)",fontSize:"0.7rem",color:"#8B949E",display:"flex",alignItems:"center",gap:6,pointerEvents:"none",fontFamily:"'JetBrains Mono', monospace"},children:[s.jsx(a0,{style:{width:14,height:14,color:"#00E676"}}),s.jsx("span",{children:A==="PAINT_FOOD"?"Click or drag to paint food clusters!":A==="PAINT_HAZARD"?"Click to paint hazard zones!":A==="PAINT_SPEED_FIELD"?"Click to paint speed fields!":"Click anywhere on canvas to drop food!"})]})]})},M0=({stats:e})=>{const t=e.populationHistory||new Array(30).fill(45),n=e.birthHistory||new Array(30).fill(0),r=e.deathHistory||new Array(30).fill(0),i=Math.max(1,...t),o=Math.max(1,...n),l=Math.max(1,...r);return s.jsx("div",{className:"analytics-cube-container",children:s.jsxs("div",{className:"cube-card-3d",children:[s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",borderRadius:8,padding:6,border:"1px solid rgba(0, 229, 255, 0.2)",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.55rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E5FF",fontWeight:800},children:[s.jsx("span",{children:"POPULATION TIME"}),s.jsx("span",{children:e.currentPopulation})]}),s.jsx("svg",{viewBox:"0 0 100 30",style:{width:"100%",height:24,overflow:"visible"},children:s.jsx("path",{d:t.map((u,c)=>{const h=c/(t.length-1)*100,m=30-u/i*24;return`${c===0?"M":"L"} ${h} ${m}`}).join(" "),fill:"none",stroke:"#00E5FF",strokeWidth:"2"})})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",borderRadius:8,padding:6,border:"1px solid rgba(0, 230, 118, 0.2)",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.55rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E676",fontWeight:800},children:[s.jsx("span",{children:"TOTAL BIRTHS"}),s.jsx("span",{children:e.totalBirths})]}),s.jsx("svg",{viewBox:"0 0 100 30",style:{width:"100%",height:24,overflow:"visible"},children:s.jsx("path",{d:`${n.map((u,c)=>{const h=c/(n.length-1)*100,m=30-u/o*22;return`${c===0?"M":"L"} ${h} ${m}`}).join(" ")} L 100 30 L 0 30 Z`,fill:"rgba(0, 230, 118, 0.25)",stroke:"#00E676",strokeWidth:"1.5"})})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",borderRadius:8,padding:6,border:"1px solid rgba(224, 64, 251, 0.2)",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.55rem",fontFamily:"'JetBrains Mono', monospace",color:"#E040FB",fontWeight:800},children:[s.jsx("span",{children:"GEN COUNT"}),s.jsxs("span",{children:["#",e.generationCount]})]}),s.jsx("svg",{viewBox:"0 0 100 30",style:{width:"100%",height:24,overflow:"visible"},children:s.jsx("path",{d:n.map((u,c)=>{const h=c/(n.length-1)*100,m=28-u/o*20;return`${c===0?"M":"L"} ${h} ${m}`}).join(" "),fill:"none",stroke:"#E040FB",strokeWidth:"2"})})]}),s.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",borderRadius:8,padding:6,border:"1px solid rgba(255, 107, 0, 0.2)",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.55rem",fontFamily:"'JetBrains Mono', monospace",color:"#FF6B00",fontWeight:800},children:[s.jsx("span",{children:"DEATH RATE"}),s.jsx("span",{children:e.totalDeaths})]}),s.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:2,height:24,paddingTop:2},children:r.slice(-15).map((u,c)=>{const h=l>0?u/l*100:10;return s.jsx("div",{style:{flex:1,height:`${Math.max(15,h)}%`,backgroundColor:"#FF6B00",borderRadius:"1px 1px 0 0"}},c)})})]})]})})},R0=({isOpen:e,onClose:t})=>e?s.jsx("div",{style:{position:"fixed",inset:0,zIndex:50,background:"rgba(3, 7, 18, 0.85)",backdropFilter:"blur(10px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:s.jsxs("div",{style:{background:"#0b0f19",border:"2px solid #00f0ff",borderRadius:"18px",maxWidth:"620px",width:"100%",padding:"24px",boxShadow:"0 0 40px rgba(0, 240, 255, 0.3)",position:"relative"},children:[s.jsx("button",{onClick:t,style:{position:"absolute",top:16,right:16,background:"transparent",border:"none",color:"#94a3b8",cursor:"pointer"},children:s.jsx(Wt,{style:{width:20,height:20}})}),s.jsxs("h2",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"1.2rem",color:"#ffffff",marginBottom:6,display:"flex",alignItems:"center",gap:10},children:[s.jsx(Ml,{style:{color:"#00f0ff"}})," HOW TO PLAY MICROBOT EVOLUTION LAB"]}),s.jsx("p",{style:{fontSize:"0.8rem",color:"#94a3b8",marginBottom:20},children:"A 100% automated autonomous artificial life sandbox. Watch microbots steer, search for food, avoid hazards, and reproduce!"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[s.jsxs("div",{style:{background:"rgba(15, 23, 42, 0.6)",padding:12,borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.08)",display:"flex",gap:12},children:[s.jsx("div",{style:{width:32,height:32,borderRadius:8,background:"rgba(0, 240, 255, 0.2)",color:"#00f0ff",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,flexShrink:0},children:"1"}),s.jsxs("div",{children:[s.jsx("h4",{style:{fontSize:"0.85rem",color:"#ffffff",fontWeight:700},children:"Inspect Microbot Telemetry"}),s.jsxs("p",{style:{fontSize:"0.75rem",color:"#94a3b8",marginTop:2},children:["Click ",s.jsx("strong",{children:"🎯 SELECT BOT"})," or click any microbot directly on the canvas grid to inspect its real-time battery level, movement speed, vision range, and behavior state."]})]})]}),s.jsxs("div",{style:{background:"rgba(15, 23, 42, 0.6)",padding:12,borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.08)",display:"flex",gap:12},children:[s.jsx("div",{style:{width:32,height:32,borderRadius:8,background:"rgba(16, 185, 129, 0.2)",color:"#34d399",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,flexShrink:0},children:"2"}),s.jsxs("div",{children:[s.jsx("h4",{style:{fontSize:"0.85rem",color:"#ffffff",fontWeight:700},children:"Interactive Mouse Canvas Spawner"}),s.jsxs("p",{style:{fontSize:"0.75rem",color:"#94a3b8",marginTop:2},children:["Click anywhere on the simulation grid to drop ",s.jsx("strong",{children:"5 green food particles"})," directly under your cursor, or use ",s.jsx("strong",{children:"🍏 +20 FOOD"})," and ",s.jsx("strong",{children:"🤖 +10 BOTS"})," buttons!"]})]})]}),s.jsxs("div",{style:{background:"rgba(15, 23, 42, 0.6)",padding:12,borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.08)",display:"flex",gap:12},children:[s.jsx("div",{style:{width:32,height:32,borderRadius:8,background:"rgba(168, 85, 247, 0.2)",color:"#c084fc",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,flexShrink:0},children:"3"}),s.jsxs("div",{children:[s.jsx("h4",{style:{fontSize:"0.85rem",color:"#ffffff",fontWeight:700},children:"Genetic Evolution & Hazards"}),s.jsx("p",{style:{fontSize:"0.75rem",color:"#94a3b8",marginTop:2},children:"When microbots reach full battery, they reproduce asexually. Offspring inherit mutated traits (speed, vision, energy efficiency). Spawn red hazard zones to watch microbots evolve evasion!"})]})]})]}),s.jsx("div",{style:{marginTop:24,textAlign:"right"},children:s.jsx("button",{onClick:t,className:"btn btn-cyan",style:{padding:"10px 24px",fontSize:"0.85rem"},children:"START EXPERIMENT"})})]})}):null,b0=({isOpen:e,microbots:t,selectedBotId:n,onSelectBot:r,onClose:i})=>{const[o,l]=O.useState(""),[u,c]=O.useState("gen");if(!e)return null;const h=t.filter(m=>m.id.toLowerCase().includes(o.toLowerCase())).sort((m,S)=>u==="gen"?S.generation-m.generation:u==="battery"?S.battery-m.battery:u==="age"?S.age-m.age:u==="offspring"?S.offspringCount-m.offspringCount:0);return s.jsx("div",{style:{position:"fixed",inset:0,zIndex:60,background:"rgba(3, 7, 18, 0.85)",backdropFilter:"blur(10px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:s.jsxs("div",{style:{background:"#0b0f19",border:"2px solid #00f0ff",borderRadius:"18px",maxWidth:"680px",width:"100%",maxHeight:"85vh",display:"flex",flexDirection:"column",boxShadow:"0 0 40px rgba(0, 240, 255, 0.3)",overflow:"hidden"},children:[s.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid rgba(255, 255, 255, 0.1)",display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(15, 23, 42, 0.9)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,color:"#00f0ff"},children:[s.jsx(kl,{style:{width:22,height:22}}),s.jsxs("div",{children:[s.jsx("h2",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"1rem",fontWeight:800,color:"#ffffff"},children:"SELECT MICROBOT FROM ROSTER"}),s.jsxs("p",{style:{fontSize:"0.72rem",color:"#94a3b8"},children:["Active Population: ",t.length," Microbots"]})]})]}),s.jsx("button",{onClick:i,style:{background:"transparent",border:"none",color:"#94a3b8",cursor:"pointer",padding:4},children:s.jsx(Wt,{style:{width:20,height:20}})})]}),s.jsxs("div",{style:{padding:"12px 20px",background:"rgba(15, 23, 42, 0.5)",display:"flex",gap:12,borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{flex:1,position:"relative",display:"flex",alignItems:"center"},children:[s.jsx(f0,{style:{width:14,height:14,color:"#94a3b8",position:"absolute",left:10}}),s.jsx("input",{type:"text",placeholder:"Search by ID (e.g. MB-0005)...",value:o,onChange:m=>l(m.target.value),style:{width:"100%",padding:"6px 10px 6px 32px",background:"#030712",border:"1px solid rgba(0, 240, 255, 0.3)",borderRadius:8,color:"#ffffff",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",outline:"none"}})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"0.72rem",color:"#94a3b8",fontFamily:"'JetBrains Mono', monospace"},children:[s.jsx("span",{children:"SORT:"}),s.jsxs("select",{value:u,onChange:m=>c(m.target.value),style:{background:"#030712",color:"#00f0ff",fontWeight:700,border:"1px solid rgba(0, 240, 255, 0.3)",borderRadius:8,padding:"6px 10px",fontSize:"0.75rem",cursor:"pointer"},children:[s.jsx("option",{value:"gen",children:"Highest Generation"}),s.jsx("option",{value:"battery",children:"Most Battery"}),s.jsx("option",{value:"age",children:"Oldest Age"}),s.jsx("option",{value:"offspring",children:"Most Offspring"})]})]})]}),s.jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px",display:"flex",flexDirection:"column",gap:10},children:h.length===0?s.jsxs("div",{style:{textAlign:"center",padding:"40px",color:"#94a3b8",fontSize:"0.8rem"},children:['No microbots found matching "',o,'".']}):h.map(m=>{const S=m.id===n,y=Math.max(0,Math.min(100,m.battery/m.maxBattery*100));return s.jsxs("div",{style:{background:S?"rgba(0, 240, 255, 0.12)":"rgba(15, 23, 42, 0.7)",border:S?"2px solid #00f0ff":"1px solid rgba(255, 255, 255, 0.1)",borderRadius:12,padding:"12px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,transition:"all 0.2s ease"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[s.jsx("div",{style:{width:18,height:18,borderRadius:"50%",backgroundColor:m.color,border:"2px solid #ffffff",boxShadow:"0 0 8px "+m.color}}),s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontWeight:800,fontSize:"0.9rem",color:"#ffffff"},children:m.id}),s.jsxs("span",{style:{fontSize:"0.65rem",background:"rgba(168, 85, 247, 0.2)",color:"#c084fc",border:"1px solid rgba(168, 85, 247, 0.4)",padding:"2px 6px",borderRadius:6,fontWeight:700,fontFamily:"'JetBrains Mono', monospace"},children:["GEN #",m.generation]})]}),s.jsxs("div",{style:{display:"flex",gap:12,fontSize:"0.7rem",color:"#94a3b8",marginTop:4,fontFamily:"'JetBrains Mono', monospace"},children:[s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[s.jsx(nd,{style:{width:12,height:12,color:"#00f0ff"}})," ",m.speed.toFixed(1)," px/f"]}),s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[s.jsx(qf,{style:{width:12,height:12,color:"#fbbf24"}})," ",m.offspringCount," kids"]}),s.jsxs("span",{children:["State: ",s.jsx("strong",{style:{color:"#34d399"},children:m.behaviorState.replace("_"," ")})]})]})]})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[s.jsxs("div",{style:{width:90},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",color:"#00f0ff",marginBottom:3,fontFamily:"'JetBrains Mono', monospace"},children:[s.jsx("span",{children:"Charge"}),s.jsxs("span",{children:[y.toFixed(0),"%"]})]}),s.jsx("div",{style:{width:"100%",height:6,background:"#1e293b",borderRadius:3,overflow:"hidden"},children:s.jsx("div",{style:{height:"100%",width:`${y}%`,background:y>40?"#00f0ff":"#fbbf24"}})})]}),s.jsx("button",{onClick:()=>{r(m.id),i()},className:S?"btn btn-cyan":"btn btn-purple",style:{padding:"6px 12px",fontSize:"0.72rem"},children:S?"✓ SELECTED":"SELECT THIS BOT"})]})]},m.id)})})]})})},N0=({isOpen:e,selectedBot:t,engine:n,onSelectBot:r,onClose:i})=>{if(!e||!t||!n)return null;const o=h=>{const m=[];let S=h;for(;S.parentId;){const y=n.microbots.find(C=>C.id===S.parentId);if(!y)break;m.unshift(y),S=y}return m},l=(h,m=0)=>{const S=n.microbots.filter(y=>y.parentId===h.id);return S.length===0?null:s.jsx("div",{style:{marginLeft:m>0?20:0,borderLeft:m>0?"1px dashed #546575":"none",paddingLeft:m>0?10:0},children:S.map(y=>s.jsxs("div",{style:{marginTop:8},children:[s.jsxs("div",{onClick:()=>r(y.id),style:{background:"rgba(15, 26, 36, 0.8)",border:"1px solid rgba(0, 230, 118, 0.4)",borderRadius:8,padding:"6px 12px",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},children:[s.jsx("div",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:y.color}}),s.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.75rem",fontWeight:600,color:"#00E676"},children:[y.id," (Gen ",y.generation,")"]})]}),l(y,m+1)]},y.id))})},u=o(t),c=t.parentId&&u.length===0;return s.jsx("div",{style:{position:"fixed",inset:0,zIndex:60,background:"rgba(3, 7, 18, 0.85)",backdropFilter:"blur(10px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:s.jsxs("div",{style:{background:"#0b0f19",border:"2px solid #E040FB",borderRadius:"18px",maxWidth:"680px",width:"100%",maxHeight:"90vh",overflowY:"auto",padding:"24px",boxShadow:"0 0 40px rgba(224, 64, 251, 0.3)",position:"relative"},children:[s.jsx("button",{onClick:i,style:{position:"absolute",top:16,right:16,background:"transparent",border:"none",color:"#8B949E",cursor:"pointer"},children:s.jsx(Wt,{style:{width:20,height:20}})}),s.jsxs("h2",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"1.1rem",color:"#ffffff",marginBottom:6,display:"flex",alignItems:"center",gap:10},children:[s.jsx(rd,{style:{color:"#E040FB"}})," INTERACTIVE FAMILY LINEAGE TREE"]}),s.jsxs("p",{style:{fontSize:"0.75rem",color:"#8B949E",marginBottom:20},children:["Tracking genealogical heritage and offspring mutations for ",s.jsx("strong",{children:t.id})," (Gen #",t.generation,")."]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,alignItems:"flex-start"},children:[s.jsx("div",{style:{fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginBottom:4},children:"ANCESTRY LINEAGE"}),c&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#f43f5e",fontSize:"0.75rem",fontStyle:"italic",marginBottom:8},children:[s.jsx(p0,{style:{width:14,height:14}})," Origin Parent Extinct"]}),u.map(h=>s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%"},children:[s.jsxs("div",{onClick:()=>r(h.id),style:{background:"rgba(15, 26, 36, 0.8)",border:"1px solid rgba(0, 229, 255, 0.4)",borderRadius:10,padding:"6px 14px",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8,alignSelf:"flex-start"},children:[s.jsx("div",{style:{width:10,height:10,borderRadius:"50%",backgroundColor:h.color}}),s.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.8rem",fontWeight:700,color:"#00E5FF"},children:[h.id," (Gen ",h.generation,")"]})]}),s.jsx("div",{style:{color:"#E040FB",fontSize:"1.2rem",margin:"4px 0",alignSelf:"flex-start",paddingLeft:12},children:"↓"})]},h.id)),s.jsxs("div",{style:{background:"rgba(224, 64, 251, 0.15)",border:"2px solid #E040FB",borderRadius:14,padding:"12px 24px",boxShadow:"0 0 20px rgba(224, 64, 251, 0.3)",alignSelf:"stretch",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:10},children:[s.jsx("div",{style:{width:16,height:16,borderRadius:"50%",backgroundColor:t.color,boxShadow:"0 0 10px "+t.color}}),s.jsx("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontWeight:800,fontSize:"1.1rem",color:"#ffffff"},children:t.id})]}),s.jsxs("div",{style:{fontSize:"0.72rem",color:"#E040FB",fontFamily:"'JetBrains Mono', monospace",marginTop:4},children:["Generation #",t.generation," • Speed: ",t.speed.toFixed(1)," px/f • Vision: ",t.visionRadius.toFixed(0),"px"]})]}),s.jsx("div",{style:{color:"#E040FB",fontSize:"1.2rem",margin:"4px 0",alignSelf:"flex-start",paddingLeft:12},children:"↓"}),s.jsxs("div",{style:{width:"100%"},children:[s.jsx("div",{style:{fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginBottom:8},children:"OFFSPRING DESCENDANTS"}),n.microbots.filter(h=>h.parentId===t.id).length===0?s.jsx("div",{style:{fontSize:"0.75rem",color:"#546575",fontStyle:"italic"},children:"No active offspring descendants."}):l(t)]})]}),s.jsx("div",{style:{marginTop:24,textAlign:"right"},children:s.jsx("button",{onClick:i,className:"btn-holo btn-holo-magenta",style:{padding:"8px 18px"},children:"CLOSE TREE"})})]})})},T0=({isOpen:e,onSpawnBlueprint:t,onClose:n})=>{const[r,i]=O.useState("ALPHA-STRAIN-V1"),[o,l]=O.useState(3.2),[u,c]=O.useState(160),[h,m]=O.useState(1.8),[S]=O.useState(.15),[y,C]=O.useState(280),[M,w]=O.useState(5);if(!e)return null;const F=`hsl(${y}, 95%, 55%)`,p=()=>{t({speed:o,maxSpeed:o,visionRadius:u,energyEfficiency:h,turnRate:S,hue:y,color:F},M),n()};return s.jsx("div",{style:{position:"fixed",inset:0,zIndex:60,background:"rgba(3, 7, 18, 0.85)",backdropFilter:"blur(12px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:s.jsxs("div",{style:{background:"#0b0f19",border:"2px solid #00E5FF",borderRadius:"18px",maxWidth:"560px",width:"100%",padding:"24px",boxShadow:"0 0 40px rgba(0, 229, 255, 0.3)",position:"relative"},children:[s.jsx("button",{onClick:n,style:{position:"absolute",top:16,right:16,background:"transparent",border:"none",color:"#8B949E",cursor:"pointer"},children:s.jsx(Wt,{style:{width:20,height:20}})}),s.jsxs("h2",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"1.1rem",color:"#ffffff",marginBottom:6,display:"flex",alignItems:"center",gap:10},children:[s.jsx(Vt,{style:{color:"#00E5FF"}})," BLUEPRINT STUDIO & GENE DESIGNER"]}),s.jsx("p",{style:{fontSize:"0.75rem",color:"#8B949E",marginBottom:20},children:"Craft custom genetic strains and spawn custom artificial life blueprints into the evolution matrix."}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[s.jsxs("div",{children:[s.jsx("label",{style:{fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",display:"block",marginBottom:4},children:"STRAIN NAME DESIGNATION"}),s.jsx("input",{type:"text",value:r,onChange:f=>i(f.target.value),style:{width:"100%",background:"#080E14",border:"1px solid rgba(0, 229, 255, 0.3)",borderRadius:8,padding:"8px 12px",color:"#00E5FF",fontFamily:"'JetBrains Mono', monospace",fontWeight:800}})]}),s.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.7rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Target Velocity (Speed)"}),s.jsxs("span",{style:{color:"#00E5FF",fontWeight:800},children:[o.toFixed(1)," px/f"]})]}),s.jsx("input",{type:"range",min:"1.0",max:"5.0",step:"0.1",value:o,onChange:f=>l(parseFloat(f.target.value)),style:{width:"100%",height:4,marginTop:6}})]}),s.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.7rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Sensory Vision Radius"}),s.jsxs("span",{style:{color:"#60a5fa",fontWeight:800},children:[u," px"]})]}),s.jsx("input",{type:"range",min:"60",max:"260",step:"5",value:u,onChange:f=>c(parseInt(f.target.value,10)),style:{width:"100%",height:4,marginTop:6}})]}),s.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.7rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Energy Efficiency Rating"}),s.jsxs("span",{style:{color:"#00E676",fontWeight:800},children:[h.toFixed(1),"x"]})]}),s.jsx("input",{type:"range",min:"0.6",max:"2.5",step:"0.1",value:h,onChange:f=>m(parseFloat(f.target.value)),style:{width:"100%",height:4,marginTop:6}})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[s.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Pigment Hue"}),s.jsxs("span",{style:{color:F,fontWeight:800},children:[y,"°"]})]}),s.jsx("input",{type:"range",min:"0",max:"360",step:"5",value:y,onChange:f=>C(parseInt(f.target.value,10)),style:{width:"100%",height:4,marginTop:6}})]}),s.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[s.jsx("span",{children:"Spawn Count"}),s.jsxs("span",{style:{color:"#E040FB",fontWeight:800},children:[M," Bots"]})]}),s.jsx("input",{type:"range",min:"1",max:"25",step:"1",value:M,onChange:f=>w(parseInt(f.target.value,10)),style:{width:"100%",height:4,marginTop:6}})]})]})]}),s.jsxs("div",{style:{marginTop:24,display:"flex",gap:10,justifyContent:"flex-end"},children:[s.jsx("button",{onClick:n,className:"btn-holo btn-holo-dark",children:"CANCEL"}),s.jsxs("button",{onClick:p,className:"btn-holo btn-holo-cyan",style:{padding:"8px 18px"},children:[s.jsx(Rs,{style:{width:14,height:14}})," SPAWN STRAIN BLUEPRINT"]})]})]})})},j0=({bot:e,onClose:t,onUpdateTraits:n})=>{if(!e)return s.jsx("div",{className:"glass-modal-overlay",children:s.jsxs("div",{className:"glass-modal",style:{width:400},children:[s.jsxs("div",{className:"modal-header",children:[s.jsxs("h2",{children:[s.jsx(Vt,{})," CRISPR EDITOR"]}),s.jsx("button",{className:"btn-icon",onClick:t,children:s.jsx(Wt,{})})]}),s.jsx("div",{style:{padding:20,textAlign:"center",color:"#8B949E"},children:s.jsx("p",{children:"No microbot selected for editing."})})]})});const r=(i,o)=>o?s.jsxs("div",{style:{marginBottom:15,background:"rgba(0,0,0,0.3)",padding:10,borderRadius:8,border:"1px solid rgba(0,229,255,0.1)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:5},children:[s.jsx("span",{style:{color:"#00E5FF",fontWeight:"bold",fontSize:"0.8rem"},children:i}),s.jsxs("span",{style:{color:o.state==="ENTANGLED"?"#FFD700":o.state==="OBSERVED"?"#00E676":"#FF6B00",fontSize:"0.7rem"},children:["[",o.state,"]"]})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:"#8B949E",fontSize:"0.7rem"},children:[s.jsxs("span",{children:["Base: ",o.baseValue.toFixed(2)]}),s.jsxs("span",{children:["Var: ±",o.quantumVariance.toFixed(2)]}),s.jsxs("span",{children:["Prob: ",(o.observationProbability*100).toFixed(0),"%"]})]})]}):null;return s.jsx("div",{className:"glass-modal-overlay",children:s.jsxs("div",{className:"glass-modal",style:{width:450,maxHeight:"80vh",overflowY:"auto"},children:[s.jsxs("div",{className:"modal-header",children:[s.jsxs("h2",{children:[s.jsx(Vt,{})," CRISPR EDITOR"]}),s.jsx("button",{className:"btn-icon",onClick:t,children:s.jsx(Wt,{})})]}),s.jsxs("div",{style:{padding:15},children:[s.jsxs("div",{style:{marginBottom:20},children:[s.jsxs("h3",{style:{color:"#fff",fontSize:"0.9rem",marginBottom:10},children:["Target: ",e.id]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[s.jsxs("div",{children:[s.jsx("label",{style:{color:"#8B949E",fontSize:"0.7rem"},children:"Speed"}),s.jsx("input",{type:"range",min:"1",max:"5",step:"0.1",value:e.speed,onChange:i=>n(e.id,{speed:parseFloat(i.target.value)}),style:{width:"100%"}})]}),s.jsxs("div",{children:[s.jsx("label",{style:{color:"#8B949E",fontSize:"0.7rem"},children:"Vision"}),s.jsx("input",{type:"range",min:"40",max:"260",step:"5",value:e.visionRadius,onChange:i=>n(e.id,{visionRadius:parseFloat(i.target.value)}),style:{width:"100%"}})]}),s.jsxs("div",{children:[s.jsx("label",{style:{color:"#8B949E",fontSize:"0.7rem"},children:"Efficiency"}),s.jsx("input",{type:"range",min:"0.4",max:"3",step:"0.1",value:e.energyEfficiency,onChange:i=>n(e.id,{energyEfficiency:parseFloat(i.target.value)}),style:{width:"100%"}})]}),s.jsxs("div",{children:[s.jsx("label",{style:{color:"#8B949E",fontSize:"0.7rem"},children:"Turn Rate"}),s.jsx("input",{type:"range",min:"0.05",max:"0.3",step:"0.01",value:e.turnRate,onChange:i=>n(e.id,{turnRate:parseFloat(i.target.value)}),style:{width:"100%"}})]})]})]}),s.jsx("h3",{style:{color:"#FFD700",fontSize:"0.8rem",marginBottom:10,borderBottom:"1px solid rgba(255,215,0,0.2)",paddingBottom:5},children:"QUANTUM GENOME (SUPERPOSITION)"}),e.genome?s.jsxs(s.Fragment,{children:[r("Speed Allele",e.genome.speedAllele),r("Vision Allele",e.genome.visionAllele),r("Efficiency Allele",e.genome.efficiencyAllele)]}):s.jsx("div",{style:{textAlign:"center",color:"#8B949E",padding:10},children:"No quantum genome data available."}),s.jsx("button",{className:"btn-holo btn-holo-green",style:{width:"100%",marginTop:10,justifyContent:"center"},onClick:t,children:"APPLY & CLOSE"})]})]})})},A0=({bot:e,onClose:t})=>{const[n,r]=O.useState(0),i=O.useRef(null);return O.useEffect(()=>{let o;const l=()=>{r(u=>(u+.1)%(Math.PI*2)),o=requestAnimationFrame(l)};return l(),()=>cancelAnimationFrame(o)},[]),O.useEffect(()=>{var M,w;const o=i.current;if(!o)return;const l=o.getContext("2d");if(!l)return;l.clearRect(0,0,o.width,o.height);const u=[{label:"ENERGY",val:e.battery/e.maxBattery},{label:"VISION",val:e.visionRadius/300},{label:"PANIC",val:e.panicTimer&&e.panicTimer>0?1:0},{label:"AGE",val:Math.min(e.age/5e3,1)}],c=[{val:Math.sin(n+0)*.5+.5},{val:Math.sin(n+1)*.5+.5},{val:Math.sin(n+2)*.5+.5},{val:Math.sin(n+3)*.5+.5},{val:Math.sin(n+4)*.5+.5}],h=[{label:"SPEED",val:e.speed/e.maxSpeed},{label:"TURN",val:e.turnRate/.5},{label:"ADHESION",val:((w=(M=e.genome)==null?void 0:M.adhesionGene)==null?void 0:w.baseValue)||0}],m=[u,c,h],S=o.width,y=o.height,C=[50,S/2,S-50];for(let F=0;F<m.length-1;F++){const p=m[F],f=m[F+1],x=C[F],E=C[F+1];p.forEach((a,I)=>{const T=y/(p.length+1)*(I+1);f.forEach((A,Q)=>{const L=y/(f.length+1)*(Q+1),Y=(I*3+Q*7+e.id.charCodeAt(0))%10/10,ee=a.val*Y;l.beginPath(),l.moveTo(x,T),l.lineTo(E,L),l.strokeStyle=`rgba(0, 229, 255, ${.1+ee*.4})`,l.lineWidth=1+ee*2,l.stroke();const z=(Math.sin(n+Y*5)+1)/2,V=x+(E-x)*z,H=T+(L-T)*z;ee>.3&&(l.beginPath(),l.arc(V,H,2,0,Math.PI*2),l.fillStyle=`rgba(255, 255, 255, ${ee})`,l.fill())})})}for(let F=0;F<m.length;F++){const p=m[F],f=C[F];p.forEach((x,E)=>{const a=y/(p.length+1)*(E+1);if(l.beginPath(),l.arc(f,a,8+x.val*4,0,Math.PI*2),l.fillStyle=F===1?"#E040FB":"#00E5FF",l.fill(),l.strokeStyle="rgba(255, 255, 255, 0.8)",l.lineWidth=2,l.stroke(),x.label){l.fillStyle="#8B949E",l.font='10px "JetBrains Mono", monospace',l.textAlign=F===0?"right":"left";const I=F===0?f-20:f+20;l.fillText(x.label,I,a+4),l.fillStyle="#FFFFFF",l.fillText((x.val*100).toFixed(0)+"%",I,a+16)}})}},[e,n]),s.jsx("div",{className:"modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(5, 8, 12, 0.85)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},children:s.jsxs("div",{className:"glass-panel",style:{width:"600px",height:"450px",position:"relative",display:"flex",flexDirection:"column",boxShadow:"0 0 50px rgba(0, 229, 255, 0.2)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid rgba(0, 229, 255, 0.2)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[s.jsx(t0,{style:{width:20,height:20,color:"#E040FB"}}),s.jsx("h2",{style:{fontFamily:"'JetBrains Mono', monospace",color:"#ffffff",fontSize:"1.1rem",margin:0},children:"LIVE NEURAL BRAIN VISUALIZER"})]}),s.jsx("button",{onClick:t,style:{background:"transparent",border:"none",color:"#8B949E",cursor:"pointer"},children:s.jsx(Wt,{style:{width:24,height:24}})})]}),s.jsxs("div",{style:{padding:"10px 20px",display:"flex",alignItems:"center",gap:20,background:"rgba(0,0,0,0.2)"},children:[s.jsxs("div",{children:[s.jsx("span",{style:{fontSize:"0.7rem",color:"#8B949E",fontFamily:"'JetBrains Mono', monospace"},children:"BOT ID"}),s.jsx("div",{style:{color:"#00E5FF",fontWeight:700},children:e.id})]}),s.jsxs("div",{children:[s.jsx("span",{style:{fontSize:"0.7rem",color:"#8B949E",fontFamily:"'JetBrains Mono', monospace"},children:"BEHAVIOR STATE"}),s.jsxs("div",{style:{color:"#E040FB",fontWeight:700,display:"flex",alignItems:"center",gap:6},children:[s.jsx(Cl,{style:{width:14,height:14}})," ",e.behaviorState]})]})]}),s.jsx("div",{style:{flex:1,padding:20,position:"relative"},children:s.jsx("canvas",{ref:i,width:560,height:320,style:{width:"100%",height:"100%",filter:"drop-shadow(0 0 8px rgba(0,229,255,0.4))"}})})]})})},F0=({bots:e})=>{const t=O.useRef(null),[n,r]=O.useState({x:0,y:0}),[i,o]=O.useState(1),[l,u]=O.useState({x:0,y:0}),c=O.useRef(!1),h=O.useRef({x:0,y:0});O.useEffect(()=>{const w=t.current;if(!w)return;const F=w.getContext("2d");if(!F)return;let p,f=0;const x=()=>{f+=.005,F.fillStyle="#060A10",F.fillRect(0,0,w.width,w.height);const E=w.width/2+l.x,a=w.height/2+l.y,I=80*i;F.strokeStyle="rgba(0, 229, 255, 0.15)",F.lineWidth=1;const T={};e.forEach(A=>{T[A.color]||(T[A.color]={count:0,hue:A.hue}),T[A.color].count++}),Object.keys(T).forEach((A,Q)=>{const L=T[A],Y=Q/Object.keys(T).length*Math.PI*2+f+n.y,ee=L.hue/360*Math.PI+n.x,z=I*Math.sin(ee)*Math.cos(Y),V=I*Math.cos(ee),k=180/(180+I*Math.sin(ee)*Math.sin(Y)),d=E+z*k,b=a+V*k;F.fillStyle=A,F.beginPath(),F.arc(d,b,Math.max(2,(2+Math.log2(L.count))*k),0,Math.PI*2),F.fill(),L.count>5&&(F.font="600 8px 'JetBrains Mono'",F.fillStyle="rgba(255,255,255,0.5)",F.fillText(`n:${L.count}`,d+5,b))}),p=requestAnimationFrame(x)};return x(),()=>cancelAnimationFrame(p)},[e]);const m=w=>{c.current=!0,h.current={x:w.clientX,y:w.clientY}},S=w=>{if(!c.current)return;const F=w.clientX-h.current.x,p=w.clientY-h.current.y;h.current={x:w.clientX,y:w.clientY},w.shiftKey?u(f=>({x:f.x+F,y:f.y+p})):r(f=>({x:f.x-p*.01,y:f.y+F*.01}))},y=()=>{c.current=!1},C=w=>{w.preventDefault(),o(F=>Math.max(.1,Math.min(5,F-w.deltaY*.001)))},M=()=>{const w=t.current;if(!w)return;const F=w.toDataURL("image/png"),p=document.createElement("a");p.href=F,p.download=`genetic_constellation_${Date.now()}.png`,p.click()};return s.jsxs("div",{style:{background:"rgba(11, 15, 25, 0.85)",border:"1px solid rgba(0, 229, 255, 0.3)",borderRadius:12,padding:8},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:4},children:[s.jsx("span",{style:{fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E5FF",fontWeight:800},children:"3D GENETIC CONSTELLATION MAP"}),s.jsx("button",{onClick:M,style:{background:"transparent",border:"none",color:"#00E5FF",fontSize:"0.6rem",cursor:"pointer"},title:"Export 3D Snapshot PNG",children:"📸 PNG"})]}),s.jsx("canvas",{ref:t,width:180,height:130,style:{borderRadius:8,cursor:"grab"},onMouseDown:m,onMouseMove:S,onMouseUp:y,onMouseLeave:y,onWheel:C})]})},Va=({error:e,onRecover:t})=>e?s.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(3, 7, 18, 0.9)",backdropFilter:"blur(8px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:9999,color:"#f8fafc",fontFamily:"'Inter', sans-serif"},children:s.jsxs("div",{className:"holo-panel",style:{padding:"30px 40px",maxWidth:600,textAlign:"center",borderColor:"rgba(244, 63, 94, 0.4)"},children:[s.jsx(Kf,{size:48,color:"#f43f5e",style:{margin:"0 auto 20px"}}),s.jsx("h2",{style:{fontSize:"1.5rem",fontWeight:700,margin:"0 0 10px",color:"#f43f5e"},children:"Simulation Exception"}),s.jsx("p",{style:{fontSize:"0.9rem",color:"#94a3b8",margin:"0 0 20px",lineHeight:1.5},children:"An unhandled error occurred in the simulation engine or web worker thread."}),s.jsx("div",{style:{background:"rgba(0,0,0,0.4)",padding:15,borderRadius:8,fontFamily:"'JetBrains Mono', monospace",fontSize:"0.8rem",color:"#fb7185",textAlign:"left",marginBottom:30,border:"1px solid rgba(244, 63, 94, 0.2)",wordBreak:"break-all"},children:e.message||"Unknown Error"}),s.jsxs("button",{onClick:t,style:{background:"linear-gradient(135deg, #f43f5e 0%, #be123c 100%)",color:"#fff",border:"none",padding:"12px 24px",borderRadius:8,fontSize:"0.9rem",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:8,margin:"0 auto"},children:[s.jsx(d0,{size:16})," Recover and Restart Engine"]})]})}):null;class B0{constructor(){R(this,"listeners",new Set);R(this,"lastStats",null);R(this,"intervalId",null);R(this,"organelleRingBuffer",new Float32Array(50));R(this,"pendingUpdate",!1)}getOrganelleRingBuffer(){return this.organelleRingBuffer}subscribe(t){return this.listeners.add(t),this.lastStats&&t(this.lastStats),()=>this.listeners.delete(t)}startPolling(t,n=80){this.intervalId&&this.stopPolling(),this.intervalId=window.setInterval(()=>{this.pendingUpdate||(this.pendingUpdate=!0,requestAnimationFrame(()=>{this.lastStats=t.getStats(),this.listeners.forEach(r=>r(this.lastStats)),this.pendingUpdate=!1}))},n)}stopPolling(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}forceUpdate(t){this.lastStats=t.getStats(),this.listeners.forEach(n=>n(this.lastStats))}}const Ao=new B0,P0=()=>{const[e,t]=O.useState(Xf),n=O.useRef(null);n.current||(n.current=new Qf(1200,800,{...e,isPaused:!1}));const r=n.current,[i,o]=O.useState(()=>r.selectRandomMicrobot()),[l,u]=O.useState(()=>r.getStats()),[c,h]=O.useState(!1),[m,S]=O.useState(!1),[y,C]=O.useState(!1),[M,w]=O.useState(!1),[F,p]=O.useState(!1),[f,x]=O.useState(!1),[E,a]=O.useState(null);O.useEffect(()=>{const D=Z=>{a(Z.error||new Error(Z.message))},_=Z=>{a(Z.reason instanceof Error?Z.reason:new Error(String(Z.reason)))},U=Z=>{Z.preventDefault(),a(new Error("WebGL Context Lost: The GPU has dropped the context. Click 'Recover' to restart rendering."))};return window.addEventListener("error",D),window.addEventListener("unhandledrejection",_),window.addEventListener("webglcontextlost",U,!0),()=>{window.removeEventListener("error",D),window.removeEventListener("unhandledrejection",_),window.removeEventListener("webglcontextlost",U,!0),Le.dispose()}},[]),O.useEffect(()=>{const D=()=>{!document.hidden&&r&&r.update(.01)};return document.addEventListener("visibilitychange",D),()=>document.removeEventListener("visibilitychange",D)},[r]),O.useEffect(()=>{Ao.startPolling(r,33);const D=Ao.subscribe(_=>{u(_);const U=r.getSelectedMicrobot();if(!U&&r.microbots.length>0){const Z=r.selectRandomMicrobot();o(Z)}else U?o({...U}):(r.selectedMicrobotId&&(r.selectedMicrobotId=null),o(null))});return()=>{D(),Ao.stopPolling()}},[r]);const I=D=>{t(_=>{const U={..._,...D};return Yf(U),r&&(r.config=U,"hazardCount"in D&&r.updateHazardsCount()),U})},T=()=>{if(r){r.resetSimulation();const D=r.selectRandomMicrobot();o(D?{...D}:null),u(r.getStats())}},A=()=>{r&&e.isPaused&&(r.update(1),u(r.getStats()))},Q=D=>{if(r)if(D){r.selectedMicrobotId=D;const _=r.getSelectedMicrobot();o(_?{..._}:null)}else r.selectedMicrobotId=null,o(null)},L=()=>{if(r){const D=r.selectRandomMicrobot();o(D?{...D}:null)}},Y=()=>{r&&r.spawnMultipleFood(20)},ee=()=>{r&&(r.spawnMultipleBots(10),i||L())},z=()=>{r&&(r.spawnHazard(),t(D=>({...D,hazardCount:r.hazards.length})))},V=()=>{r&&r.triggerSolarFlare()},H=()=>{r&&r.spawnPortalPair()},k=()=>{if(r&&typeof r.spawnSpore=="function")for(let D=0;D<5;D++)r.spawnSpore()},d=(D,_)=>{if(r){for(let U=0;U<_;U++){const Z=r.spawnMicrobot();r.overrideMicrobotGenes(Z.id,D)}u(r.getStats())}},b=(D,_)=>{if(r){r.overrideMicrobotGenes(D,_);const U=r.getSelectedMicrobot();U&&o({...U})}},N=()=>{if(!r)return;const D=`Timestamp (ISO 8601),Time (s),Population,Avg Speed,Avg Vision,Total Births,Total Deaths,Predators,Season
`,_=l.historyTimeline.map(Fe=>`${new Date(Fe.time*1e3).toISOString()},${Fe.time},${Fe.population},${Fe.avgSpeed.toFixed(2)},${Fe.avgVision.toFixed(1)},${l.totalBirths},${l.totalDeaths},${l.predatorCount},${l.currentSeason}`).join(`
`),U=new Blob([D+_],{type:"text/csv"}),Z=URL.createObjectURL(U),de=document.createElement("a");de.href=Z,de.download=`microbot_telemetry_${new Date().toISOString().slice(0,10)}.csv`,de.click(),URL.revokeObjectURL(Z)},g=()=>{if(!r)return;const D={timestamp:new Date().toISOString(),config:e,stats:l,populationHistory:r.populationHistory,birthHistory:r.birthHistory,deathHistory:r.deathHistory,generationCount:r.generationCount,totalDeaths:r.totalDeaths},_=new Blob([JSON.stringify(D,null,2)],{type:"application/json"}),U=URL.createObjectURL(_),Z=document.createElement("a");Z.href=U,Z.download=`microbot_telemetry_${Date.now()}.json`,Z.click(),URL.revokeObjectURL(U)},P=()=>{if(!r)return;const D=r.microbots.filter(de=>de.epigenome&&de.epigenome.length>0).map(de=>({id:de.id,generation:de.generation,stress:de.epigeneticStress,epigenome:de.epigenome})),_=new Blob([JSON.stringify({timestamp:new Date().toISOString(),profiles:D},null,2)],{type:"application/json"}),U=URL.createObjectURL(_),Z=document.createElement("a");Z.href=U,Z.download=`microbot_epigenetics_${Date.now()}.json`,Z.click(),URL.revokeObjectURL(U)},j=()=>{const D="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e,null,2)),_=document.createElement("a");_.href=D,_.download=`microbot_preset_config_${new Date().toISOString().slice(0,10)}.json`,_.click()},W=D=>{I(D),alert("Simulation Preset Loaded Successfully!")},J=()=>{if(!r)return;const D=r.exportState();navigator.clipboard.writeText(D).then(()=>{alert("Ecosystem state copied to clipboard as sync hash!")}).catch(_=>{console.error("Failed to copy",_),alert("Failed to copy to clipboard.")})},ne=()=>{if(!r)return;const D=prompt("Paste your sync hash here:");D&&(r.importState(D),u(r.getStats()),alert("Ecosystem synced successfully!"))},v=i&&r?r.getLineageTree(i.id):{current:null};let X="radial-gradient(circle at 50% 30%, rgba(15, 30, 45, 0.6) 0%, rgba(8, 14, 20, 0.95) 70%)";return l.currentSeason==="WINTER"?X="radial-gradient(circle at 50% 30%, rgba(10, 20, 45, 0.6) 0%, rgba(5, 10, 25, 0.95) 70%)":l.currentSeason==="SUMMER"&&(X="radial-gradient(circle at 50% 30%, rgba(45, 30, 15, 0.6) 0%, rgba(20, 14, 8, 0.95) 70%)"),r!=null&&r.activeDisasters.some(D=>D.type==="RADIATION_STORM"&&D.active)&&(X="radial-gradient(circle at 50% 30%, rgba(20, 45, 15, 0.6) 0%, rgba(10, 25, 5, 0.95) 70%)"),s.jsxs("div",{className:"app-container",style:{background:`${X}, radial-gradient(circle at 80% 80%, rgba(224, 64, 251, 0.05) 0%, transparent 50%), radial-gradient(circle at 20% 80%, rgba(0, 229, 255, 0.05) 0%, transparent 50%)`},children:[s.jsx(Va,{error:E,onRecover:()=>{a(null),T()}}),s.jsx(b0,{isOpen:m,microbots:r.microbots,selectedBotId:i?i.id:null,onSelectBot:D=>Q(D),onClose:()=>S(!1)}),s.jsx(R0,{isOpen:c,onClose:()=>h(!1)}),s.jsx(N0,{isOpen:y,selectedBot:v.current,engine:r,onSelectBot:D=>{Q(D)},onClose:()=>C(!1)}),M&&s.jsx(T0,{isOpen:!0,onClose:()=>w(!1),onSpawnBlueprint:d}),F&&s.jsx(j0,{bot:i,onClose:()=>p(!1),onUpdateTraits:b}),f&&i&&s.jsx(A0,{bot:i,onClose:()=>x(!1)}),E&&s.jsx(Va,{error:E,onRecover:()=>a(null)}),s.jsx(w0,{config:e,stats:l,onUpdateConfig:I,onReset:T,onStep:A,onOpenRosterMenu:()=>S(!0),onOpenGuide:()=>h(!0),onOpenBlueprintStudio:()=>w(!0),onSpawnFood:Y,onSpawnBots:ee,onSpawnHazard:z,onTriggerMeteor:()=>r==null?void 0:r.triggerMeteorStrike(),onTriggerVoidRift:()=>r==null?void 0:r.triggerVoidRift(),onTriggerOutbreak:()=>r==null?void 0:r.triggerOutbreak(),onTriggerRadiationStorm:()=>r==null?void 0:r.triggerRadiationStorm(),onTriggerMagneticInversion:()=>r==null?void 0:r.triggerMagneticInversion(),onTriggerSolarFlare:V,onTriggerPortal:H,onExportTelemetryCSV:N,onExportConfigJSON:j,onImportConfigJSON:W}),s.jsxs("main",{className:"workspace-grid",children:[s.jsxs("div",{className:"sidebar-col",children:[s.jsx("div",{className:"inspector-panel-container",children:s.jsx(E0,{bot:i,stats:l,onClose:()=>Q(null),onOverrideGenes:b,onOpenLineageModal:()=>C(!0),onOpenCrisprModal:()=>p(!0),onOpenNeuralModal:()=>x(!0)})}),s.jsx(C0,{config:e,engine:n.current,onUpdateConfig:I,onExportStateSync:J,onImportStateSync:ne,onRunBenchmark:()=>r==null?void 0:r.runBenchmark(),onSpawnSpore:k,onExportRunData:g,onExportEpigenetics:P}),s.jsx(F0,{bots:(r==null?void 0:r.microbots)||[]}),s.jsx(k0,{bots:r?r.microbots:[]})]}),s.jsxs("div",{className:"main-viewport-col",children:[e.isSplitView?s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,height:"100%"},children:[s.jsx(jo,{engine:r,onSelectBot:Q,onSelectRandomBot:L,onUpdateConfig:I}),s.jsx(jo,{engine:r,onSelectBot:Q,onSelectRandomBot:L,onUpdateConfig:I})]}):s.jsx(jo,{engine:r,onSelectBot:Q,onSelectRandomBot:L,onUpdateConfig:I}),s.jsx(M0,{stats:l})]})]})]})};class D0 extends O.Component{constructor(){super(...arguments);R(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("Uncaught render error:",n,r)}render(){var n;return this.state.hasError?s.jsxs("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0,0,0,0.85)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:99999,color:"white",fontFamily:"'JetBrains Mono', monospace"},children:[s.jsx(or,{color:"#ff3366",size:64,style:{marginBottom:20}}),s.jsx("h1",{style:{color:"#ff3366",margin:0},children:"Render Exception Detected"}),s.jsx("p",{style:{maxWidth:600,textAlign:"center",color:"#ccc",margin:"20px 0"},children:((n=this.state.error)==null?void 0:n.message)||"Unknown error"}),s.jsx("button",{onClick:()=>window.location.reload(),style:{padding:"10px 20px",background:"rgba(255, 51, 102, 0.2)",border:"1px solid #ff3366",color:"#ff3366",borderRadius:8,cursor:"pointer",fontWeight:"bold"},children:"Reboot Simulation Kernel"})]}):this.props.children}}Fo.createRoot(document.getElementById("root")).render(s.jsx(As.StrictMode,{children:s.jsx(D0,{children:s.jsx(P0,{})})}));</script>
<style rel="stylesheet" crossorigin>:root{--bg-void: #080E14;--panel-glass: rgba(15, 26, 36, .75);--panel-border: rgba(0, 229, 255, .22);--panel-glow: rgba(0, 229, 255, .15);--glass-backdrop-filter: blur(12px) saturate(180%);--cyan-glow: #00E5FF;--magenta-glow: #E040FB;--orange-hazard: #FF6B00;--bio-green: #00E676;--text-primary: #F0F6FC;--text-muted: #8B949E;--text-dim: #546575}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){:root{--glass-backdrop-filter: blur(16px) saturate(200%)}}@media (max-width: 768px){.app-container{padding:4px}}*{box-sizing:border-box;margin:0;padding:0}body{font-family:Inter,system-ui,-apple-system,sans-serif;background-color:var(--bg-void);color:var(--text-primary);min-height:100vh;overflow:hidden;-webkit-user-select:none;user-select:none}.app-container{display:flex;flex-direction:column;height:100vh;width:100vw;overflow:hidden;background:radial-gradient(circle at 50% 30%,#0f1e2d99,#080e14f2 70%),radial-gradient(circle at 80% 80%,rgba(224,64,251,.05) 0%,transparent 50%),radial-gradient(circle at 20% 80%,rgba(0,229,255,.05) 0%,transparent 50%);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);position:relative}.top-nav-bar{display:flex;align-items:center;justify-content:space-between;padding:10px 18px;z-index:30;gap:12px}.brand-badge{display:flex;align-items:center;gap:10px}.brand-icon-box{width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,#00e5ffcc,#e040fbcc);display:flex;align-items:center;justify-content:center;color:#fff;box-shadow:0 0 15px #00e5ff66}.brand-title{font-family:JetBrains Mono,monospace;font-size:1rem;font-weight:800;letter-spacing:.05em;color:#fff;text-shadow:0 0 10px rgba(0,229,255,.4)}.brand-title span{color:var(--cyan-glow)}.brand-sub{font-size:.68rem;color:var(--text-muted);font-family:Inter,sans-serif}.glass-deck-pill{background:#080e14a6;border:1px solid rgba(255,255,255,.08);border-top:1px solid rgba(255,255,255,.15);border-left:1px solid rgba(255,255,255,.12);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border-radius:12px;padding:6px 12px;display:flex;align-items:center;gap:10px;box-shadow:0 8px 32px #0009,inset 0 0 10px #00e5ff1a;transition:border-color .3s ease,box-shadow .3s ease}.glass-deck-pill:hover{border-color:#00e5ffb3;box-shadow:0 8px 32px #0009,inset 0 0 15px #00e5ff33,0 0 20px #00e5ff33}.holo-panel{background:#080e14bf;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(255,255,255,.08);border-top:1px solid rgba(255,255,255,.15);border-left:1px solid rgba(255,255,255,.12);border-radius:16px;box-shadow:0 10px 40px #000c,inset 0 0 20px #00e5ff26,0 0 15px #00e5ff1a;transition:box-shadow .3s ease,border-color .3s ease}.holo-panel:hover{border-color:#00e5ff99;box-shadow:0 10px 40px #000c,inset 0 0 30px #00e5ff40,0 0 25px #00e5ff33}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.glass-panel{-webkit-backdrop-filter:blur(16px) saturate(180%);backdrop-filter:blur(16px) saturate(180%);border-width:.5px}}.btn-holo{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:8px;font-family:JetBrains Mono,monospace;font-size:.72rem;font-weight:700;cursor:pointer;border:1px solid transparent;transition:all .2s ease;text-transform:uppercase}.btn-holo-cyan{background:#00e5ff1f;border-color:#00e5ff59;color:var(--cyan-glow)}.btn-holo-cyan:hover{background:#00e5ff40;box-shadow:0 0 14px #00e5ff66}.btn-holo-magenta{background:#e040fb1f;border-color:#e040fb59;color:var(--magenta-glow)}.btn-holo-magenta:hover{background:#e040fb40;box-shadow:0 0 14px #e040fb66}.btn-holo-green{background:#00e6761f;border-color:#00e67659;color:var(--bio-green)}.btn-holo-green:hover{background:#00e67640;box-shadow:0 0 14px #00e67666}.btn-holo-orange{background:#ff6b001f;border-color:#ff6b0059;color:var(--orange-hazard)}.btn-holo-orange:hover{background:#ff6b0040;box-shadow:0 0 14px #ff6b0066}.btn-holo-dark{background:#ffffff0d;border-color:#ffffff1f;color:var(--text-muted)}.btn-holo-dark:hover{background:#ffffff1f;color:#fff}@keyframes pulse-glow{0%{box-shadow:0 0 10px #00e5ff66}50%{box-shadow:0 0 25px #00e5ffcc}to{box-shadow:0 0 10px #00e5ff66}}.glass-panel{background:#0c141ca6;backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid rgba(0,229,255,.35);box-shadow:0 8px 32px #000000a6,inset 0 1px #ffffff0d;will-change:transform;transform:translateZ(0);position:relative;transition:border-color .25s ease,box-shadow .25s ease}@media (max-width: 768px){.glass-panel{background:#0c141cd9;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.glass-panel{border-width:.5px;box-shadow:0 4px 20px #00000080,inset 0 .5px #ffffff1a}}.glass-panel:hover{border-color:#00e5ff8c;box-shadow:0 8px 32px #000000bf,0 0 16px #00e5ff40}.accordion-header{cursor:pointer;transition:opacity .2s ease,transform .1s ease;-webkit-user-select:none;user-select:none}.accordion-header:hover{opacity:.8}.accordion-header:active{transform:scale(.98)}.workspace-grid{display:grid;grid-template-columns:320px 1fr;grid-template-rows:1fr auto;gap:12px;padding:0 16px 16px;flex:1;overflow:hidden}.sidebar-col{display:flex;flex-direction:column;gap:12px;overflow-y:auto;padding-right:8px;scrollbar-gutter:stable}.main-viewport-col{position:relative;display:flex;flex-direction:column;gap:12px;overflow:hidden}.canvas-viewport-card{flex:1;position:relative;border-radius:16px;border:1px solid rgba(0,229,255,.25);overflow:hidden;background:#04080d;box-shadow:inset 0 0 40px #000000e6,0 0 25px #00e5ff1a}input[type=range]{accent-color:var(--cyan-glow);cursor:pointer}.analytics-cube-container{position:absolute;bottom:16px;right:16px;z-index:25;width:220px;height:180px;perspective:900px;pointer-events:auto}.cube-card-3d{width:100%;height:100%;background:#0f1a24d9;border:1px solid rgba(0,229,255,.35);border-radius:14px;-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);transform:rotateY(-8deg) rotateX(6deg);transition:transform .3s ease,box-shadow .3s ease;box-shadow:-10px 15px 25px #0009,0 0 20px #00e5ff33;padding:10px;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:6px}.cube-card-3d:hover{transform:rotateY(0) rotateX(0) scale(1.03);box-shadow:0 15px 35px #000c,0 0 30px #00e5ff59}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:#080e1466}::-webkit-scrollbar-thumb{background:#00e5ff40;border-radius:3px}::-webkit-scrollbar-thumb:hover{background:#00e5ff80}@media (max-width: 768px){.workspace-grid{display:flex;flex-direction:column;padding:0 4px 4px;gap:8px}.sidebar-col{position:absolute;bottom:0;left:0;right:0;max-height:45vh;z-index:50;background:#080e14f2;border-top:2px solid rgba(0,229,255,.5);border-radius:20px 20px 0 0;padding:16px 12px calc(16px + env(safe-area-inset-bottom));box-shadow:0 -10px 40px #000000e6,inset 0 2px 10px #00e5ff33;backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px)}.main-viewport-col{flex:1;margin-bottom:40vh}.analytics-cube-container{transform:scale(.7);bottom:45vh;right:8px}.top-nav-bar{padding:6px 10px}.brand-title{font-size:.85rem}}</style>
</head>
<body>
<div id="root"></div>
<!-- Deployment cache bust 1 -->
</body>
</html>